blob: c982457c46a9a0f3ea08d32a55849ae53446a0bb [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
njnf76d27a2009-05-28 01:53:07 +000028AC_PROG_OBJC
sewardjde4a1d02002-03-22 01:27:54 +000029AC_PROG_RANLIB
30
bartcddeaf52008-05-25 15:58:11 +000031# If no AR variable was specified, look up the name of the archiver. Otherwise
32# do not touch the AR variable.
33if test "x$AR" = "x"; then
bart325cd972009-04-04 14:36:51 +000034 AC_PATH_PROGS([AR], [`echo $LD | sed 's/ld$/ar/'` "ar"], [ar])
bartcddeaf52008-05-25 15:58:11 +000035fi
36AC_ARG_VAR([AR],[Archiver command])
37
gobrye721a522002-03-22 13:38:30 +000038# Check for the compiler support
39if test "${GCC}" != "yes" ; then
40 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
41fi
42
sewardj2f685952002-12-22 19:32:23 +000043# figure out where perl lives
44AC_PATH_PROG(PERL, perl)
45
njn9315df32003-04-16 20:50:50 +000046# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000047AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000048AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000049
daywalker48ccca52002-04-15 00:31:58 +000050# some older automake's don't have it so try something on our own
51ifdef([AM_PROG_AS],[AM_PROG_AS],
52[
gobry1be19852002-03-26 20:44:55 +000053AS="${CC}"
54AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000055
gobry1be19852002-03-26 20:44:55 +000056ASFLAGS=""
57AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000058])
gobry3b777892002-04-04 09:18:39 +000059
gobry3b777892002-04-04 09:18:39 +000060
njn0d2e58f2009-02-25 04:57:56 +000061# Check if 'diff' supports -u (universal diffs) and use it if possible.
62
63AC_MSG_CHECKING([for diff -u])
64AC_SUBST(DIFF)
65
66# Comparing two identical files results in 0, unless -u isn't supported (as
67# it's not on AIX).
njn31f665e2009-02-26 21:25:50 +000068tmpfile="tmp-xxx-yyy-zzz"
69touch $tmpfile;
70if diff -u $tmpfile $tmpfile ; then
njn0d2e58f2009-02-25 04:57:56 +000071 AC_MSG_RESULT([yes])
72 DIFF="diff -u"
73else
74 AC_MSG_RESULT([no])
75 DIFF="diff"
76fi
njn31f665e2009-02-26 21:25:50 +000077rm $tmpfile
njn0d2e58f2009-02-25 04:57:56 +000078
79
sewardj535c50f2005-06-04 23:14:53 +000080# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +000081AC_MSG_CHECKING([for a supported version of gcc])
82
sewardjf33b4332008-07-18 18:20:42 +000083[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +000084
85case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +000086 2.*)
gobrye721a522002-03-22 13:38:30 +000087 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +000088 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
89 ;;
gobrye721a522002-03-22 13:38:30 +000090 *)
91 AC_MSG_RESULT([ok (${gcc_version})])
92 ;;
93esac
94
njn7fd6d382009-01-22 21:56:32 +000095#----------------------------------------------------------------------------
96# Arch/OS/platform tests.
97#----------------------------------------------------------------------------
98# We create a number of arch/OS/platform-related variables. We prefix them
99# all with "VGCONF_" which indicates that they are defined at
100# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
101# variables used when compiling C files.
sewardj03d86f22006-10-17 00:57:24 +0000102
sewardjde4a1d02002-03-22 01:27:54 +0000103AC_CANONICAL_HOST
104
105AC_MSG_CHECKING([for a supported CPU])
sewardjbc692db2006-01-04 03:31:07 +0000106
njn7fd6d382009-01-22 21:56:32 +0000107# ARCH_MAX reflects the most that this CPU can do: for example if it
108# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
109# Ditto for amd64. It is used for more configuration below, but is not used
110# outside this file.
gobrye721a522002-03-22 13:38:30 +0000111case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000112 i?86)
113 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000114 ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000115 ;;
116
njnfe408942004-11-23 17:52:24 +0000117 x86_64)
118 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000119 ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000120 ;;
121
sewardj2c48c7b2005-11-29 13:05:56 +0000122 powerpc64)
njn7fd6d382009-01-22 21:56:32 +0000123 # This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000124 AC_MSG_RESULT([ok (${host_cpu})])
njn7fd6d382009-01-22 21:56:32 +0000125 ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000126 ;;
127
128 powerpc)
njn7fd6d382009-01-22 21:56:32 +0000129 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
130 # Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000131 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000132 case "${host_os}" in
133 aix5.*)
njn7fd6d382009-01-22 21:56:32 +0000134 ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000135 ;;
136 *)
njn7fd6d382009-01-22 21:56:32 +0000137 ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000138 ;;
139 esac
nethercote9bcc9062004-10-13 13:50:01 +0000140 ;;
141
sewardjde4a1d02002-03-22 01:27:54 +0000142 *)
143 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000144 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000145 ;;
146esac
147
njn7fd6d382009-01-22 21:56:32 +0000148#----------------------------------------------------------------------------
149
sewardj86e992f2006-01-28 18:39:09 +0000150# Sometimes it's convenient to subvert the bi-arch build system and
151# just have a single build even though the underlying platform is
152# capable of both. Hence handle --enable-only64bit and
153# --enable-only32bit. Complain if both are issued :-)
njn7fd6d382009-01-22 21:56:32 +0000154# [Actually, if either of these options are used, I think both get built,
155# but only one gets installed. So if you use an in-place build, both can be
156# used. --njn]
sewardj86e992f2006-01-28 18:39:09 +0000157
158# Check if a 64-bit only build has been requested
159AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
160 [AC_ARG_ENABLE(only64bit,
161 [ --enable-only64bit do a 64-bit only build],
162 [vg_cv_only64bit=$enableval],
163 [vg_cv_only64bit=no])])
164
165# Check if a 32-bit only build has been requested
166AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
167 [AC_ARG_ENABLE(only32bit,
168 [ --enable-only32bit do a 32-bit only build],
169 [vg_cv_only32bit=$enableval],
170 [vg_cv_only32bit=no])])
171
172# Stay sane
173if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
174 AC_MSG_ERROR(
175 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
176fi
177
njn7fd6d382009-01-22 21:56:32 +0000178#----------------------------------------------------------------------------
sewardj86e992f2006-01-28 18:39:09 +0000179
njn311303f2009-02-06 03:46:50 +0000180# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
181# compilation of many C files via -VGO_$(VGCONF_OS) and
182# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000183AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000184AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000185
njnf76d27a2009-05-28 01:53:07 +0000186DEFAULT_SUPP=""
187
gobrye721a522002-03-22 13:38:30 +0000188case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000189 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000190 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000191 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000192
193 # Ok, this is linux. Check the kernel version
194 AC_MSG_CHECKING([for the kernel version])
195
196 kernel=`uname -r`
197
198 case "${kernel}" in
199 2.6.*)
200 AC_MSG_RESULT([2.6 family (${kernel})])
201 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
202 ;;
203
204 2.4.*)
205 AC_MSG_RESULT([2.4 family (${kernel})])
206 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
207 ;;
208
mueller8c68e042004-01-03 15:21:14 +0000209 *)
210 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000211 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000212 ;;
213 esac
214
215 ;;
216
sewardj03d86f22006-10-17 00:57:24 +0000217 aix5.1.*)
218 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000219 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000220 ;;
221 aix5.2.*)
222 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000223 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000224 ;;
225 aix5.3.*)
226 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000227 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000228 ;;
229
mueller8c68e042004-01-03 15:21:14 +0000230 *freebsd*)
231 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000232 VGCONF_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000233 ;;
234
njnf76d27a2009-05-28 01:53:07 +0000235 *darwin*)
236 AC_MSG_RESULT([ok (${host_os})])
237 VGCONF_OS="darwin"
238
239 AC_MSG_CHECKING([for the kernel version])
240 kernel=`uname -r`
241
242 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
243 # has only one relevant version, the OS version. The `uname` check
244 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
245 # X 10.5.6, and "Darwin 10.x" would presumably be Mac OS X 10.6.x
246 # Snow Leopard and darwin10.supp), and we don't know of an macros
247 # similar to __GLIBC__ to get that info.
248 #
249 # XXX: `uname -r` won't do the right thing for cross-compiles, but
250 # that's not a problem yet.
251 case "${kernel}" in
252 9.*)
253 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
254 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
255 ;;
256 *)
257 AC_MSG_RESULT([unsupported (${kernel})])
258 AC_MSG_ERROR([Valgrind works on Darwin 9.x (Mac OS X 10.5)])
259 ;;
260 esac
261 ;;
262
sewardjde4a1d02002-03-22 01:27:54 +0000263 *)
264 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000265 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000266 ;;
267esac
268
njn7fd6d382009-01-22 21:56:32 +0000269#----------------------------------------------------------------------------
270
tomd6398392006-06-07 17:44:36 +0000271# If we are building on a 64 bit platform test to see if the system
272# supports building 32 bit programs and disable 32 bit support if it
273# does not support building 32 bit programs
274
njn7fd6d382009-01-22 21:56:32 +0000275case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000276 amd64-linux|ppc64-linux)
277 AC_MSG_CHECKING([for 32 bit build support])
278 safe_CFLAGS=$CFLAGS
279 CFLAGS="-m32"
280 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000281 return 0;
tomd6398392006-06-07 17:44:36 +0000282 ],
283 [
284 AC_MSG_RESULT([yes])
285 ], [
286 vg_cv_only64bit="yes"
287 AC_MSG_RESULT([no])
288 ])
289 CFLAGS=$safe_CFLAGS;;
290esac
291
292if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
293 AC_MSG_ERROR(
294 [--enable-only32bit was specified but system does not support 32 bit builds])
295fi
nethercote888ecb72004-08-23 14:54:40 +0000296
njn7fd6d382009-01-22 21:56:32 +0000297#----------------------------------------------------------------------------
298
njn311303f2009-02-06 03:46:50 +0000299# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
300# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
301# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
302# above) will be "amd64" since that reflects the most that this cpu can do,
303# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
304# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000305# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
306# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
307AC_SUBST(VGCONF_ARCH_PRI)
308
njn3f8a6e92009-06-02 00:20:47 +0000309# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
310# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
311# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
312# It is empty if there is no secondary target.
313AC_SUBST(VGCONF_ARCH_SEC)
314
njn311303f2009-02-06 03:46:50 +0000315# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
316# The entire system, including regression and performance tests, will be
317# built for this target. The "_CAPS" indicates that the name is in capital
318# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000319# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000320# convention and cannot contain '-' characters. This is in contrast to
321# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000322AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
323
324# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
325# Valgrind and tools will also be built for this target, but not the
326# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000327#
njn7fd6d382009-01-22 21:56:32 +0000328# By default, the primary arch is the same as the "max" arch, as commented
329# above (at the definition of ARCH_MAX). We may choose to downgrade it in
330# the big case statement just below here, in the case where we're building
331# on a 64 bit machine but have been requested only to do a 32 bit build.
332AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
333
sewardj01262142006-01-04 01:20:28 +0000334AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000335
njn7fd6d382009-01-22 21:56:32 +0000336case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000337 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000338 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000339 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000340 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
341 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000342 valt_load_address_normal="0x38000000"
343 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000344 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000345 ;;
346 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000347 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000348 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000349 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000350 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
351 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000352 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000353 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000354 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000355 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
356 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000357 else
njn7fd6d382009-01-22 21:56:32 +0000358 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000359 VGCONF_ARCH_SEC="x86"
njn7fd6d382009-01-22 21:56:32 +0000360 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
361 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000362 fi
njnd74b0ef2009-01-20 06:06:52 +0000363 valt_load_address_normal="0x38000000"
364 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000365 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000366 ;;
367 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000368 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000369 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000370 VGCONF_PLATFORM_PRI_CAPS="PPC32_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 ;;
sewardj03d86f22006-10-17 00:57:24 +0000376 ppc64-aix5)
377 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000378 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000379 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000380 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
381 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000382 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000383 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000384 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000385 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
386 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000387 else
njn7fd6d382009-01-22 21:56:32 +0000388 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000389 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000390 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
391 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000392 fi
njnd74b0ef2009-01-20 06:06:52 +0000393 valt_load_address_normal="0x38000000"
394 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000395 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj03d86f22006-10-17 00:57:24 +0000396 ;;
sewardj01262142006-01-04 01:20:28 +0000397 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000398 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000399 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000400 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000401 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
402 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000403 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000404 VGCONF_ARCH_PRI="ppc32"
njn3f8a6e92009-06-02 00:20:47 +0000405 VGCONF_ARCH_SEC=""
njn7fd6d382009-01-22 21:56:32 +0000406 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
407 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000408 else
njn7fd6d382009-01-22 21:56:32 +0000409 VGCONF_ARCH_PRI="ppc64"
njn3f8a6e92009-06-02 00:20:47 +0000410 VGCONF_ARCH_SEC="ppc32"
njn7fd6d382009-01-22 21:56:32 +0000411 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
412 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000413 fi
njnd74b0ef2009-01-20 06:06:52 +0000414 valt_load_address_normal="0x38000000"
415 valt_load_address_inner="0x28000000"
njn377c43f2009-05-19 07:39:22 +0000416 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
sewardj01262142006-01-04 01:20:28 +0000417 ;;
njnf76d27a2009-05-28 01:53:07 +0000418 x86-darwin)
419 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000420 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000421 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
422 VGCONF_PLATFORM_SEC_CAPS=""
423 valt_load_address_normal="0x0"
424 valt_load_address_inner="0x0"
425 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
426 ;;
427 amd64-darwin)
428 if test x$vg_cv_only64bit = xyes; then
429 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000430 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000431 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
432 VGCONF_PLATFORM_SEC_CAPS=""
433 elif test x$vg_cv_only32bit = xyes; then
434 VGCONF_ARCH_PRI="x86"
njn3f8a6e92009-06-02 00:20:47 +0000435 VGCONF_ARCH_SEC=""
njnf76d27a2009-05-28 01:53:07 +0000436 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
437 VGCONF_PLATFORM_SEC_CAPS=""
438 VGCONF_ARCH_PRI_CAPS="x86"
439 else
440 VGCONF_ARCH_PRI="amd64"
njn3f8a6e92009-06-02 00:20:47 +0000441 VGCONF_ARCH_SEC="x86"
njnf76d27a2009-05-28 01:53:07 +0000442 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
443 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
444 fi
445 valt_load_address_normal="0x0"
446 valt_load_address_inner="0x0"
447 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
448 ;;
nethercote888ecb72004-08-23 14:54:40 +0000449 *)
njn7fd6d382009-01-22 21:56:32 +0000450 VGCONF_ARCH_PRI="unknown"
njn3f8a6e92009-06-02 00:20:47 +0000451 VGCONF_ARCH_SEC="unknown"
njn7fd6d382009-01-22 21:56:32 +0000452 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
453 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
njn377c43f2009-05-19 07:39:22 +0000454 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
sewardj3e38ce02004-11-23 01:17:29 +0000455 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000456 ;;
457esac
sewardjde4a1d02002-03-22 01:27:54 +0000458
njn7fd6d382009-01-22 21:56:32 +0000459#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000460
njn7fd6d382009-01-22 21:56:32 +0000461# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
462# defined.
463AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
464 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
njnf76d27a2009-05-28 01:53:07 +0000465 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
466 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
467 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000468AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
njnf76d27a2009-05-28 01:53:07 +0000469 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
470 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
njn7fd6d382009-01-22 21:56:32 +0000471AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
472 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
473 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
474 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
475 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
476AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
477 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
478 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj03d86f22006-10-17 00:57:24 +0000479
njn7fd6d382009-01-22 21:56:32 +0000480# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
481# become defined.
482AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
483 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
484 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
485AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
486 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
487AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
488 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
489 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
490AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
491 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
njnf76d27a2009-05-28 01:53:07 +0000492
njn7fd6d382009-01-22 21:56:32 +0000493AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
494 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
495 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
496AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
497 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
498
njnf76d27a2009-05-28 01:53:07 +0000499AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
500 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
501 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
502AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
503 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
504
505
njn7fd6d382009-01-22 21:56:32 +0000506# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000507# Relies on the assumption that the primary and secondary targets are
508# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000509AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
510 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
511 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
512 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
513 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
514AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
515 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
516 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
njnf76d27a2009-05-28 01:53:07 +0000517AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
518 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
519 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
sewardj03d86f22006-10-17 00:57:24 +0000520
521
njn7fd6d382009-01-22 21:56:32 +0000522# Sometimes, in the Makefile.am files, it's useful to know whether or not
523# there is a secondary target.
njnee0c66a2009-06-01 23:59:20 +0000524AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
njn7fd6d382009-01-22 21:56:32 +0000525 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000526
tomb637bad2005-11-08 12:28:35 +0000527
njn7fd6d382009-01-22 21:56:32 +0000528#----------------------------------------------------------------------------
529# Inner Valgrind?
530#----------------------------------------------------------------------------
531
njnd74b0ef2009-01-20 06:06:52 +0000532# Check if this should be built as an inner Valgrind, to be run within
533# another Valgrind. Choose the load address accordingly.
534AC_SUBST(VALT_LOAD_ADDRESS)
535AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
536 [AC_ARG_ENABLE(inner,
537 [ --enable-inner enables self-hosting],
538 [vg_cv_inner=$enableval],
539 [vg_cv_inner=no])])
540if test "$vg_cv_inner" = yes; then
541 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
542 VALT_LOAD_ADDRESS=$valt_load_address_inner
543else
544 VALT_LOAD_ADDRESS=$valt_load_address_normal
545fi
546
547
njn7fd6d382009-01-22 21:56:32 +0000548#----------------------------------------------------------------------------
549# Libc and suppressions
550#----------------------------------------------------------------------------
551# This variable will collect the suppression files to be used.
njn7fd6d382009-01-22 21:56:32 +0000552AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000553
dirk07596a22008-04-25 11:33:30 +0000554GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000555
sewardjde4a1d02002-03-22 01:27:54 +0000556AC_EGREP_CPP([GLIBC_22], [
557#include <features.h>
558#ifdef __GNU_LIBRARY__
559 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
560 GLIBC_22
561 #endif
562#endif
563],
dirk07596a22008-04-25 11:33:30 +0000564GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000565
sewardj08c7f012002-10-07 23:56:55 +0000566AC_EGREP_CPP([GLIBC_23], [
567#include <features.h>
568#ifdef __GNU_LIBRARY__
569 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
570 GLIBC_23
571 #endif
572#endif
573],
dirk07596a22008-04-25 11:33:30 +0000574GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000575
njn781dba52005-06-30 04:06:38 +0000576AC_EGREP_CPP([GLIBC_24], [
577#include <features.h>
578#ifdef __GNU_LIBRARY__
579 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
580 GLIBC_24
581 #endif
582#endif
583],
dirk07596a22008-04-25 11:33:30 +0000584GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000585
dirkaece45c2006-10-12 08:17:49 +0000586AC_EGREP_CPP([GLIBC_25], [
587#include <features.h>
588#ifdef __GNU_LIBRARY__
589 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
590 GLIBC_25
591 #endif
592#endif
593],
dirk07596a22008-04-25 11:33:30 +0000594GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000595
dirkc8bd0c52007-05-23 17:39:08 +0000596AC_EGREP_CPP([GLIBC_26], [
597#include <features.h>
598#ifdef __GNU_LIBRARY__
599 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
600 GLIBC_26
601 #endif
602#endif
603],
dirk07596a22008-04-25 11:33:30 +0000604GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000605
sewardj68c80c12007-11-18 14:40:02 +0000606AC_EGREP_CPP([GLIBC_27], [
607#include <features.h>
608#ifdef __GNU_LIBRARY__
609 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
610 GLIBC_27
611 #endif
612#endif
613],
dirk07596a22008-04-25 11:33:30 +0000614GLIBC_VERSION="2.7")
615
616AC_EGREP_CPP([GLIBC_28], [
617#include <features.h>
618#ifdef __GNU_LIBRARY__
619 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
620 GLIBC_28
621 #endif
622#endif
623],
624GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000625
dirkd2e31eb2008-11-19 23:58:36 +0000626AC_EGREP_CPP([GLIBC_29], [
627#include <features.h>
628#ifdef __GNU_LIBRARY__
629 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
630 GLIBC_29
631 #endif
632#endif
633],
634GLIBC_VERSION="2.9")
635
sewardj5d425e82009-02-01 19:01:11 +0000636AC_EGREP_CPP([GLIBC_210], [
637#include <features.h>
638#ifdef __GNU_LIBRARY__
639 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
640 GLIBC_210
641 #endif
642#endif
643],
644GLIBC_VERSION="2.10")
645
sewardj03d86f22006-10-17 00:57:24 +0000646AC_EGREP_CPP([AIX5_LIBC], [
647#include <standards.h>
648#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
649 AIX5_LIBC
650#endif
651],
dirk07596a22008-04-25 11:33:30 +0000652GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000653
njnf76d27a2009-05-28 01:53:07 +0000654# not really a version check
655AC_EGREP_CPP([DARWIN_LIBC], [
656#include <sys/cdefs.h>
657#if defined(__DARWIN_VERS_1050)
658 DARWIN_LIBC
659#endif
660],
661GLIBC_VERSION="darwin")
662
dirk07596a22008-04-25 11:33:30 +0000663AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000664
dirk07596a22008-04-25 11:33:30 +0000665case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000666 2.2)
667 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000668 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000669 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
670 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000671 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000672 ;;
673
sewardj08c7f012002-10-07 23:56:55 +0000674 2.3)
675 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000676 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000677 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000678 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000679 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000680 ;;
681
njn781dba52005-06-30 04:06:38 +0000682 2.4)
683 AC_MSG_RESULT(2.4 family)
684 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000685 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000686 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000687 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000688 ;;
689
dirkaece45c2006-10-12 08:17:49 +0000690 2.5)
691 AC_MSG_RESULT(2.5 family)
692 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000693 DEFAULT_SUPP="glibc-2.5.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}"
dirkaece45c2006-10-12 08:17:49 +0000696 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000697 2.6)
698 AC_MSG_RESULT(2.6 family)
699 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000700 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000701 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000702 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000703 ;;
704 2.7)
705 AC_MSG_RESULT(2.7 family)
706 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000707 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000708 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000709 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000710 ;;
dirk07596a22008-04-25 11:33:30 +0000711 2.8)
712 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000713 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000714 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
715 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
716 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
717 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000718 2.9)
719 AC_MSG_RESULT(2.9 family)
720 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
721 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
722 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
723 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
724 ;;
sewardj5d425e82009-02-01 19:01:11 +0000725 2.10)
726 AC_MSG_RESULT(2.10 family)
727 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
728 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
729 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
730 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
731 ;;
sewardj03d86f22006-10-17 00:57:24 +0000732 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000733 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
734 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 +0000735 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
736 ;;
njnf76d27a2009-05-28 01:53:07 +0000737 darwin)
738 AC_MSG_RESULT(Darwin)
739 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
740 # DEFAULT_SUPP set by kernel version check above.
741 ;;
dirkaece45c2006-10-12 08:17:49 +0000742
sewardjde4a1d02002-03-22 01:27:54 +0000743 *)
744 AC_MSG_RESULT(unsupported version)
sewardj5d425e82009-02-01 19:01:11 +0000745 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.10])
dirk07596a22008-04-25 11:33:30 +0000746 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
njnf76d27a2009-05-28 01:53:07 +0000747 AC_MSG_ERROR([or Darwin libc])
sewardjde4a1d02002-03-22 01:27:54 +0000748 ;;
749esac
750
dirk07596a22008-04-25 11:33:30 +0000751AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000752
sewardj414f3582008-07-18 20:46:00 +0000753
754# Add default suppressions for the X client libraries. Make no
755# attempt to detect whether such libraries are installed on the
756# build machine (or even if any X facilities are present); just
757# add the suppressions antidisirregardless.
758DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
759DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000760
sewardj5744c022008-10-19 18:58:13 +0000761# Add glibc and X11 suppressions for exp-ptrcheck
762DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
763
sewardj2e10a682003-04-07 19:36:41 +0000764
njn7fd6d382009-01-22 21:56:32 +0000765#----------------------------------------------------------------------------
766# Checking for various library functions and other definitions
767#----------------------------------------------------------------------------
768
bart59e2f182008-04-28 16:22:53 +0000769# Check for CLOCK_MONOTONIC
770
771AC_MSG_CHECKING([for CLOCK_MONOTONIC])
772
773AC_TRY_COMPILE(
774[
775#include <time.h>
776], [
777 struct timespec t;
778 clock_gettime(CLOCK_MONOTONIC, &t);
779 return 0;
780],
781[
782AC_MSG_RESULT([yes])
783AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
784 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
785], [
786AC_MSG_RESULT([no])
787])
788
bartfea06922008-05-03 09:12:15 +0000789
790# Check for PTHREAD_MUTEX_ADAPTIVE_NP
791
792AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
793
794AC_TRY_COMPILE(
795[
796#define _GNU_SOURCE
797#include <pthread.h>
798], [
799 return (PTHREAD_MUTEX_ADAPTIVE_NP);
800],
801[
802AC_MSG_RESULT([yes])
803AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
804 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
805], [
806AC_MSG_RESULT([no])
807])
808
809
810# Check for PTHREAD_MUTEX_ERRORCHECK_NP
811
812AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
813
814AC_TRY_COMPILE(
815[
816#define _GNU_SOURCE
817#include <pthread.h>
818], [
819 return (PTHREAD_MUTEX_ERRORCHECK_NP);
820],
821[
822AC_MSG_RESULT([yes])
823AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
824 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
825], [
826AC_MSG_RESULT([no])
827])
828
829
830# Check for PTHREAD_MUTEX_RECURSIVE_NP
831
832AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
833
834AC_TRY_COMPILE(
835[
836#define _GNU_SOURCE
837#include <pthread.h>
838], [
839 return (PTHREAD_MUTEX_RECURSIVE_NP);
840],
841[
842AC_MSG_RESULT([yes])
843AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
844 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
845], [
846AC_MSG_RESULT([no])
847])
848
849
850# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
851
852AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
853
854AC_TRY_COMPILE(
855[
856#define _GNU_SOURCE
857#include <pthread.h>
858], [
859 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
860 return 0;
861],
862[
863AC_MSG_RESULT([yes])
864AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
865 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
866], [
867AC_MSG_RESULT([no])
868])
869
870
bart5e389f12008-04-05 12:53:15 +0000871# Check whether pthread_mutex_t has a member called __m_kind.
872
873AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
874
bart56730cd2008-05-11 06:41:46 +0000875AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000876[
bart56730cd2008-05-11 06:41:46 +0000877 #include <pthread.h>
878], [
bart5e389f12008-04-05 12:53:15 +0000879 pthread_mutex_t m;
880 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000881], [
bart5e389f12008-04-05 12:53:15 +0000882AC_MSG_RESULT([yes])
883AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
884 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
885], [
886AC_MSG_RESULT([no])
887])
888
889
890# Check whether pthread_mutex_t has a member called __data.__kind.
891
892AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
893
bart56730cd2008-05-11 06:41:46 +0000894AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000895[
bart56730cd2008-05-11 06:41:46 +0000896#include <pthread.h>
897], [
bart5e389f12008-04-05 12:53:15 +0000898 pthread_mutex_t m;
899 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000900], [
bart5e389f12008-04-05 12:53:15 +0000901AC_MSG_RESULT([yes])
902AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
903 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
904], [
905AC_MSG_RESULT([no])
906])
907
908
bart62c370e2008-05-12 18:50:51 +0000909# does this compiler support -maltivec and does it have the include file
910# <altivec.h> ?
911
912AC_MSG_CHECKING([for Altivec])
913
914safe_CFLAGS=$CFLAGS
915CFLAGS="-maltivec"
916
917AC_TRY_COMPILE(
918[
919#include <altivec.h>
920], [
921 vector unsigned int v;
922],
923[
924ac_have_altivec=yes
925AC_MSG_RESULT([yes])
926], [
927ac_have_altivec=no
928AC_MSG_RESULT([no])
929])
930CFLAGS=$safe_CFLAGS
931
932AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
933AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
934
935
bart36dd85a2009-04-26 07:11:48 +0000936# Check for pthread_create@GLIBC2.0
937AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
938
bart16e1c5a2009-04-26 07:38:53 +0000939safe_CFLAGS=$CFLAGS
940CFLAGS="-lpthread"
bart36dd85a2009-04-26 07:11:48 +0000941AC_TRY_LINK(
942[
943extern int pthread_create_glibc_2_0(void*, const void*,
944 void *(*)(void*), void*);
945__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
946], [
bart276ed3a2009-05-10 15:41:45 +0000947#ifdef __powerpc__
948/*
949 * Apparently on PowerPC linking this program succeeds and generates an
950 * executable with the undefined symbol pthread_create@GLIBC_2.0.
951 */
952#error This test does not work properly on PowerPC.
953#else
bart16e1c5a2009-04-26 07:38:53 +0000954 pthread_create_glibc_2_0(0, 0, 0, 0);
bart276ed3a2009-05-10 15:41:45 +0000955#endif
bart16e1c5a2009-04-26 07:38:53 +0000956 return 0;
bart36dd85a2009-04-26 07:11:48 +0000957],
958[
959ac_have_pthread_create_glibc_2_0=yes
960AC_MSG_RESULT([yes])
961AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
962 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
963], [
964ac_have_pthread_create_glibc_2_0=no
965AC_MSG_RESULT([no])
966])
bart16e1c5a2009-04-26 07:38:53 +0000967CFLAGS=$safe_CFLAGS
bart36dd85a2009-04-26 07:11:48 +0000968
969AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
bart24f53902009-04-26 11:29:02 +0000970 test x$ac_have_pthread_create_glibc_2_0 = xyes)
bart36dd85a2009-04-26 07:11:48 +0000971
972
barta50aa8a2008-04-27 06:06:57 +0000973# Check for eventfd_t, eventfd() and eventfd_read()
974AC_MSG_CHECKING([for eventfd()])
975
976AC_TRY_LINK(
977[
978#include <sys/eventfd.h>
979], [
980 eventfd_t ev;
981 int fd;
982
983 fd = eventfd(5, 0);
984 eventfd_read(fd, &ev);
985 return 0;
986],
987[
988AC_MSG_RESULT([yes])
989AC_DEFINE([HAVE_EVENTFD], 1,
990 [Define to 1 if you have the `eventfd' function.])
991AC_DEFINE([HAVE_EVENTFD_READ], 1,
992 [Define to 1 if you have the `eventfd_read' function.])
993], [
994AC_MSG_RESULT([no])
995])
996
997
njn7fd6d382009-01-22 21:56:32 +0000998#----------------------------------------------------------------------------
999# Checking for supported compiler flags.
1000#----------------------------------------------------------------------------
1001
sewardj535c50f2005-06-04 23:14:53 +00001002# does this compiler support -m32 ?
1003AC_MSG_CHECKING([if gcc accepts -m32])
1004
1005safe_CFLAGS=$CFLAGS
1006CFLAGS="-m32"
1007
1008AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001009 return 0;
sewardj535c50f2005-06-04 23:14:53 +00001010],
1011[
1012FLAG_M32="-m32"
1013AC_MSG_RESULT([yes])
1014], [
1015FLAG_M32=""
1016AC_MSG_RESULT([no])
1017])
1018CFLAGS=$safe_CFLAGS
1019
1020AC_SUBST(FLAG_M32)
1021
1022
sewardj03d86f22006-10-17 00:57:24 +00001023# does this compiler support -maix32 ?
1024AC_MSG_CHECKING([if gcc accepts -maix32])
1025
1026safe_CFLAGS=$CFLAGS
1027CFLAGS="-maix32"
1028
1029AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001030 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001031],
1032[
1033FLAG_MAIX32="-maix32"
1034AC_MSG_RESULT([yes])
1035], [
1036FLAG_MAIX32=""
1037AC_MSG_RESULT([no])
1038])
1039CFLAGS=$safe_CFLAGS
1040
1041AC_SUBST(FLAG_MAIX32)
1042
1043
sewardj01262142006-01-04 01:20:28 +00001044# does this compiler support -m64 ?
1045AC_MSG_CHECKING([if gcc accepts -m64])
1046
1047safe_CFLAGS=$CFLAGS
1048CFLAGS="-m64"
1049
1050AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001051 return 0;
sewardj01262142006-01-04 01:20:28 +00001052],
1053[
1054FLAG_M64="-m64"
1055AC_MSG_RESULT([yes])
1056], [
1057FLAG_M64=""
1058AC_MSG_RESULT([no])
1059])
1060CFLAGS=$safe_CFLAGS
1061
1062AC_SUBST(FLAG_M64)
1063
1064
sewardj03d86f22006-10-17 00:57:24 +00001065# does this compiler support -maix64 ?
1066AC_MSG_CHECKING([if gcc accepts -maix64])
1067
1068safe_CFLAGS=$CFLAGS
1069CFLAGS="-maix64"
1070
1071AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001072 return 0;
sewardj03d86f22006-10-17 00:57:24 +00001073],
1074[
1075FLAG_MAIX64="-maix64"
1076AC_MSG_RESULT([yes])
1077], [
1078FLAG_MAIX64=""
1079AC_MSG_RESULT([no])
1080])
1081CFLAGS=$safe_CFLAGS
1082
1083AC_SUBST(FLAG_MAIX64)
1084
1085
sewardj67f1fcc2005-07-03 10:41:02 +00001086# does this compiler support -mmmx ?
1087AC_MSG_CHECKING([if gcc accepts -mmmx])
1088
1089safe_CFLAGS=$CFLAGS
1090CFLAGS="-mmmx"
1091
1092AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001093 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001094],
1095[
1096FLAG_MMMX="-mmmx"
1097AC_MSG_RESULT([yes])
1098], [
1099FLAG_MMMX=""
1100AC_MSG_RESULT([no])
1101])
1102CFLAGS=$safe_CFLAGS
1103
1104AC_SUBST(FLAG_MMMX)
1105
1106
1107# does this compiler support -msse ?
1108AC_MSG_CHECKING([if gcc accepts -msse])
1109
1110safe_CFLAGS=$CFLAGS
1111CFLAGS="-msse"
1112
1113AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001114 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001115],
1116[
1117FLAG_MSSE="-msse"
1118AC_MSG_RESULT([yes])
1119], [
1120FLAG_MSSE=""
1121AC_MSG_RESULT([no])
1122])
1123CFLAGS=$safe_CFLAGS
1124
1125AC_SUBST(FLAG_MSSE)
1126
1127
sewardj5b754b42002-06-03 22:53:35 +00001128# does this compiler support -mpreferred-stack-boundary=2 ?
1129AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1130
daywalker3664f562003-10-17 13:43:46 +00001131safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001132CFLAGS="-mpreferred-stack-boundary=2"
1133
1134AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001135 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001136],
1137[
1138PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001139AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001140], [
1141PREFERRED_STACK_BOUNDARY=""
1142AC_MSG_RESULT([no])
1143])
daywalker3664f562003-10-17 13:43:46 +00001144CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001145
1146AC_SUBST(PREFERRED_STACK_BOUNDARY)
1147
sewardj535c50f2005-06-04 23:14:53 +00001148
sewardjb5f6f512005-03-10 23:59:00 +00001149# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001150AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001151
1152safe_CFLAGS=$CFLAGS
1153CFLAGS="-Wno-pointer-sign"
1154
1155AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001156 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001157],
1158[
1159no_pointer_sign=yes
1160AC_MSG_RESULT([yes])
1161], [
1162no_pointer_sign=no
1163AC_MSG_RESULT([no])
1164])
1165CFLAGS=$safe_CFLAGS
1166
1167if test x$no_pointer_sign = xyes; then
1168 CFLAGS="$CFLAGS -Wno-pointer-sign"
1169fi
1170
sewardj535c50f2005-06-04 23:14:53 +00001171
tom1e946682005-10-12 11:27:33 +00001172# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001173AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001174
1175safe_CFLAGS=$CFLAGS
1176CFLAGS="-Wdeclaration-after-statement"
1177
1178AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001179 return 0;
tom1e946682005-10-12 11:27:33 +00001180],
1181[
tome9814c32005-10-12 11:30:43 +00001182declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001183FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001184AC_MSG_RESULT([yes])
1185], [
tome9814c32005-10-12 11:30:43 +00001186declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001187FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001188AC_MSG_RESULT([no])
1189])
1190CFLAGS=$safe_CFLAGS
1191
sewardj72a547e2006-01-25 02:58:28 +00001192AC_SUBST(FLAG_WDECL_AFTER_STMT)
1193
tome9814c32005-10-12 11:30:43 +00001194if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001195 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1196fi
1197
sewardj00f1e622006-03-12 16:47:10 +00001198
barte026bd22009-07-04 12:17:07 +00001199# does this compiler support -Wno-empty-body ?
1200
1201AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1202
1203safe_CFLAGS=$CFLAGS
1204CFLAGS="-Wno-empty-body"
1205
1206AC_TRY_COMPILE(
1207[ ],
1208[
1209 return 0;
1210],
1211[
1212AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1213AC_MSG_RESULT([yes])
1214],
1215[
1216AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1217AC_MSG_RESULT([no])
1218])
1219CFLAGS=$safe_CFLAGS
1220
1221
bart9d865fa2008-06-23 12:11:49 +00001222# does this compiler support -Wno-format-zero-length ?
1223
1224AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1225
1226safe_CFLAGS=$CFLAGS
1227CFLAGS="-Wno-format-zero-length"
1228
1229AC_TRY_COMPILE(
1230[ ],
1231[
1232 return 0;
1233],
1234[
1235AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1236AC_MSG_RESULT([yes])
1237],
1238[
1239AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1240AC_MSG_RESULT([no])
1241])
1242CFLAGS=$safe_CFLAGS
1243
1244
bart56730cd2008-05-11 06:41:46 +00001245# does this compiler support -Wextra or the older -W ?
1246
1247AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1248
1249safe_CFLAGS=$CFLAGS
1250CFLAGS="-Wextra"
1251
1252AC_TRY_COMPILE(
1253[ ],
1254[
1255 return 0;
1256],
1257[
1258AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1259AC_MSG_RESULT([-Wextra])
1260], [
1261 CFLAGS="-W"
1262 AC_TRY_COMPILE(
1263 [ ],
1264 [
1265 return 0;
1266 ],
1267 [
1268 AC_SUBST([FLAG_W_EXTRA], [-W])
1269 AC_MSG_RESULT([-W])
1270 ], [
1271 AC_SUBST([FLAG_W_EXTRA], [])
1272 AC_MSG_RESULT([not supported])
1273 ])
1274])
1275CFLAGS=$safe_CFLAGS
1276
1277
sewardja72c26d2007-05-01 13:44:08 +00001278# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001279AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001280
1281safe_CFLAGS=$CFLAGS
1282CFLAGS="-fno-stack-protector"
1283
1284AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001285 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001286],
1287[
1288no_stack_protector=yes
1289FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1290AC_MSG_RESULT([yes])
1291], [
1292no_stack_protector=no
1293FLAG_FNO_STACK_PROTECTOR=""
1294AC_MSG_RESULT([no])
1295])
1296CFLAGS=$safe_CFLAGS
1297
1298AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1299
1300if test x$no_stack_protector = xyes; then
1301 CFLAGS="$CFLAGS -fno-stack-protector"
1302fi
1303
1304
bart56730cd2008-05-11 06:41:46 +00001305# does this compiler support --param inline-unit-growth=... ?
1306
1307AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1308
1309safe_CFLAGS=$CFLAGS
1310CFLAGS="--param inline-unit-growth=900"
1311
1312AC_TRY_COMPILE(
1313[ ],
1314[
1315 return 0;
1316],
1317[
1318AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1319 ["--param inline-unit-growth=900"])
1320AC_MSG_RESULT([yes])
1321], [
1322AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1323AC_MSG_RESULT([no])
1324])
1325CFLAGS=$safe_CFLAGS
1326
1327
tomd55121e2005-12-19 12:40:13 +00001328# does this compiler support __builtin_expect?
1329AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001330
tomd55121e2005-12-19 12:40:13 +00001331AC_TRY_LINK(, [
1332return __builtin_expect(1, 1) ? 1 : 0
1333],
1334[
1335ac_have_builtin_expect=yes
1336AC_MSG_RESULT([yes])
1337], [
1338ac_have_builtin_expect=no
1339AC_MSG_RESULT([no])
1340])
1341if test x$ac_have_builtin_expect = xyes ; then
1342 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1343fi
1344
tom1e946682005-10-12 11:27:33 +00001345
sewardj00f1e622006-03-12 16:47:10 +00001346# does the ppc assembler support "mtocrf" et al?
1347AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1348
1349AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001350__asm__ __volatile__("mtocrf 4,0");
1351__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001352],
1353[
1354ac_have_as_ppc_mftocrf=yes
1355AC_MSG_RESULT([yes])
1356], [
1357ac_have_as_ppc_mftocrf=no
1358AC_MSG_RESULT([no])
1359])
1360if test x$ac_have_as_ppc_mftocrf = xyes ; then
1361 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1362fi
1363
1364
sewardjf0aabf82007-03-22 00:24:21 +00001365# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001366# Note, this doesn't generate a C-level symbol. It generates a
1367# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001368AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1369
1370AC_TRY_COMPILE(, [
1371 do { long long int x;
1372 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1373 while (0)
1374],
1375[
1376ac_have_as_sse3=yes
1377AC_MSG_RESULT([yes])
1378], [
1379ac_have_as_sse3=no
1380AC_MSG_RESULT([no])
1381])
sewardjfa18a262007-03-22 12:13:13 +00001382
1383AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001384
1385
sewardj6d6da5b2008-02-09 12:07:40 +00001386# Ditto for SSSE3 instructions (note extra S)
1387# Note, this doesn't generate a C-level symbol. It generates a
1388# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1389AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1390
1391AC_TRY_COMPILE(, [
1392 do { long long int x;
1393 __asm__ __volatile__(
1394 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1395 while (0)
1396],
1397[
1398ac_have_as_ssse3=yes
1399AC_MSG_RESULT([yes])
1400], [
1401ac_have_as_ssse3=no
1402AC_MSG_RESULT([no])
1403])
1404
1405AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1406
1407
sewardjb5f6f512005-03-10 23:59:00 +00001408# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001409if test "x${cross_compiling}" = "xno"; then
1410# Native compilation: check whether running a program using TLS succeeds.
1411# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1412# succeeds but running programs using TLS fails.
1413AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1414 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1415 [vg_cv_tls=$enableval],
1416 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1417 [[return foo;]])],
1418 [vg_cv_tls=yes],
1419 [vg_cv_tls=no])])])
1420else
1421# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001422AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1423 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1424 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001425 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001426 [[return foo;]])],
1427 [vg_cv_tls=yes],
1428 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001429fi
sewardjb5f6f512005-03-10 23:59:00 +00001430
1431if test "$vg_cv_tls" = yes; then
1432AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1433fi
sewardj5b754b42002-06-03 22:53:35 +00001434
sewardj535c50f2005-06-04 23:14:53 +00001435
njn7fd6d382009-01-22 21:56:32 +00001436#----------------------------------------------------------------------------
njnf76d27a2009-05-28 01:53:07 +00001437# Check for /proc filesystem
1438#----------------------------------------------------------------------------
1439AC_CHECK_FILES(/proc/self/fd /proc/self/exe /proc/self/maps,
1440 [ AC_DEFINE([HAVE_PROC], 1, [can use /proc filesystem]) ],
1441 [])
1442
1443
1444#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001445# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001446#----------------------------------------------------------------------------
1447
sewardjde4a1d02002-03-22 01:27:54 +00001448AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001449AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001450 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001451 endian.h \
1452 mqueue.h \
1453 sys/endian.h \
1454 sys/epoll.h \
1455 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001456 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001457 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001458 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001459 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001460 sys/syscall.h \
1461 sys/time.h \
1462 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001463 ])
sewardjde4a1d02002-03-22 01:27:54 +00001464
njn7fd6d382009-01-22 21:56:32 +00001465#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001466# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001467#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001468AC_TYPE_UID_T
1469AC_TYPE_OFF_T
1470AC_TYPE_SIZE_T
1471AC_HEADER_TIME
1472
sewardj535c50f2005-06-04 23:14:53 +00001473
njn7fd6d382009-01-22 21:56:32 +00001474#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001475# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001476#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001477AC_FUNC_MEMCMP
1478AC_FUNC_MMAP
1479AC_TYPE_SIGNAL
1480
bart71bad292008-04-27 11:43:23 +00001481AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001482
bartf5ceec82008-04-26 07:45:10 +00001483AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001484 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001485 epoll_create \
1486 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001487 floor \
bartce48fa92008-04-26 10:59:46 +00001488 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001489 mallinfo \
1490 memchr \
1491 memset \
1492 mkdir \
njnf76d27a2009-05-28 01:53:07 +00001493 mremap \
bartf5ceec82008-04-26 07:45:10 +00001494 ppoll \
bart6d45e922009-01-20 13:45:38 +00001495 pthread_barrier_init \
1496 pthread_condattr_setclock \
1497 pthread_mutex_timedlock \
1498 pthread_rwlock_timedrdlock \
1499 pthread_rwlock_timedwrlock \
1500 pthread_spin_lock \
bartf5ceec82008-04-26 07:45:10 +00001501 semtimedop \
1502 signalfd \
njn6cc22472009-03-16 03:46:48 +00001503 sigwaitinfo \
bart71bad292008-04-27 11:43:23 +00001504 syscall \
bartf5ceec82008-04-26 07:45:10 +00001505 strchr \
1506 strdup \
1507 strpbrk \
1508 strrchr \
1509 strstr \
1510 timerfd \
1511 utimensat \
1512 ])
sewardjde4a1d02002-03-22 01:27:54 +00001513
bart623eec32008-07-29 17:54:49 +00001514# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1515# libraries with any shared object and/or executable. This is NOT what we
1516# want for e.g. vgpreload_core-x86-linux.so
1517LIBS=""
sewardj80637752006-03-02 13:48:21 +00001518
bart6d45e922009-01-20 13:45:38 +00001519AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1520 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001521AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1522 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001523AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1524 [test x$ac_cv_func_pthread_spin_lock = xyes])
1525
njn7fd6d382009-01-22 21:56:32 +00001526
1527#----------------------------------------------------------------------------
1528# MPI checks
1529#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001530# Do we have a useable MPI setup on the primary and/or secondary targets?
1531# On Linux, by default, assumes mpicc and -m32/-m64
1532# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001533# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001534# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1535# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001536MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001537if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1538 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001539 MPI_CC="mpxlc"
1540fi
1541
sewardje9fa5062006-03-12 18:29:18 +00001542mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001543if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1544 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001545 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001546elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1547 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001548 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001549elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001550 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001551elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001552 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001553fi
1554
sewardj03d86f22006-10-17 00:57:24 +00001555mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001556if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1557 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001558 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001559elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001560 mflag_secondary=-q32
1561fi
1562
1563
sewardj0ad46092006-03-02 17:09:16 +00001564AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001565 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001566 MPI_CC=$withval
1567)
sewardj03d86f22006-10-17 00:57:24 +00001568AC_SUBST(MPI_CC)
1569
1570## See if MPI_CC works for the primary target
1571##
1572AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001573saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001574saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001575CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001576CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001577AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001578#include <mpi.h>
1579#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001580],[
1581 int r = MPI_Init(NULL,NULL);
1582 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1583 return r;
1584], [
sewardj03d86f22006-10-17 00:57:24 +00001585ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001586AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001587], [
sewardj03d86f22006-10-17 00:57:24 +00001588ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001589AC_MSG_RESULT([no])
1590])
sewardj0ad46092006-03-02 17:09:16 +00001591CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001592CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001593AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001594
sewardj03d86f22006-10-17 00:57:24 +00001595## See if MPI_CC works for the secondary target. Complication: what if
1596## there is no secondary target? We need this to then fail.
1597## Kludge this by making MPI_CC something which will surely fail in
1598## such a case.
1599##
1600AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1601saved_CC=$CC
1602saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001603if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001604 CC="$MPI_CC this will surely fail"
1605else
1606 CC=$MPI_CC
1607fi
1608CFLAGS=$mflag_secondary
1609AC_TRY_LINK([
1610#include <mpi.h>
1611#include <stdio.h>
1612],[
1613 int r = MPI_Init(NULL,NULL);
1614 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1615 return r;
1616], [
1617ac_have_mpi2_sec=yes
1618AC_MSG_RESULT([yes, $MPI_CC])
1619], [
1620ac_have_mpi2_sec=no
1621AC_MSG_RESULT([no])
1622])
1623CC=$saved_CC
1624CFLAGS=$saved_CFLAGS
1625AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001626
1627
njn7fd6d382009-01-22 21:56:32 +00001628#----------------------------------------------------------------------------
1629# Other library checks
1630#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001631# There now follow some tests for QtCore, Boost, and OpenMP. These
1632# tests are present because Drd has some regression tests that use
1633# these packages. All regression test programs all compiled only
1634# for the primary target. And so it is important that the configure
1635# checks that follow, use the correct -m32 or -m64 flag for the
1636# primary target (called $mflag_primary). Otherwise, we can end up
1637# in a situation (eg) where, on amd64-linux, the test for Boost checks
1638# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1639# only build (meaning, the primary target is x86-linux), the build
1640# of the regtest programs that use Boost fails, because they are
1641# build as 32-bit (IN THIS EXAMPLE).
1642#
1643# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1644# NEEDED BY THE REGRESSION TEST PROGRAMS.
1645
1646
bart21d3cfc2008-08-02 09:08:17 +00001647# The test below verifies whether the QtCore package been installed.
1648# This test works as follows:
1649# - If pkg-config was not installed at the time autogen.sh was run,
1650# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1651# autogen.sh. Augogen.sh will generate a configure script that prints
1652# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1653# - If pkg-config was installed at the time autogen.sh was run,
1654# the generated configure script will try to detect the presence of the
1655# Qt4 QtCore library by looking up compile and linker flags in the file
1656# called QtCore.pc.
1657# - pkg-config settings can be overridden via the configure variables
1658# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1659# configure script -- see also ./configure --help).
1660# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1661# the pkg-config executable is not present on the system on which the
1662# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001663
bart21d3cfc2008-08-02 09:08:17 +00001664ifdef(
1665 [PKG_CHECK_EXISTS],
1666 [PKG_CHECK_EXISTS(
1667 [QtCore],
1668 [
1669 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001670 # Paranoia: don't trust the result reported by pkg-config, but when
1671 # pkg-config reports that QtCore has been found, verify whether linking
1672 # programs with QtCore succeeds.
1673 AC_LANG(C++)
1674 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001675 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001676 AC_TRY_LINK(
1677 [#include <QMutex>],
1678 [QMutex Mutex;],
1679 [ac_have_qtcore=yes],
1680 [
1681 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1682 ac_have_qtcore=no
1683 ]
1684 )
1685 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001686 ],
1687 [
1688 ac_have_qtcore=no
1689 ]
1690 )
1691 ],
1692 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1693 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1694 [ac_have_qtcore=no]
1695)
bart41ac62a2008-07-07 16:58:03 +00001696
1697AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1698
1699
bart62f54e42008-07-28 11:35:10 +00001700# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1701# See also http://doc.trolltech.com/4.3/qmutex.html.
1702if test x$ac_have_qtcore = xyes; then
1703 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1704 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001705 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001706 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001707 AC_TRY_COMPILE([
1708 #include <QtCore/QMutex>
1709 ],
1710 [
1711 QMutex M;
1712 M.tryLock(1);
1713 M.unlock();
1714 return 0;
1715 ],
1716 [
1717 AC_MSG_RESULT([yes])
1718 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1719 ],
1720 [
1721 AC_MSG_RESULT([no])
1722 ])
bart21d3cfc2008-08-02 09:08:17 +00001723 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001724 AC_LANG(C)
1725fi
1726
1727
sewardj493c4ef2008-12-13 16:45:19 +00001728# Check whether the boost library 1.35 or later has been installed.
1729# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1730
1731AC_MSG_CHECKING([for boost])
1732
1733AC_LANG(C++)
1734safe_CXXFLAGS=$CXXFLAGS
1735CXXFLAGS="-lboost_thread-mt $mflag_primary"
1736
1737AC_LINK_IFELSE(
1738[
1739#include <boost/thread.hpp>
1740static void thread_func(void)
1741{ }
1742int main(int argc, char** argv)
1743{
1744 boost::thread t(thread_func);
1745 return 0;
1746}
1747],
1748[
1749ac_have_boost_1_35=yes
1750AC_SUBST([BOOST_CFLAGS], [])
1751AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1752AC_MSG_RESULT([yes])
1753], [
1754ac_have_boost_1_35=no
1755AC_MSG_RESULT([no])
1756])
1757
1758CXXFLAGS=$safe_CXXFLAGS
1759AC_LANG(C)
1760
1761AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1762
1763
1764# does this compiler support -fopenmp, does it have the include file
1765# <omp.h> and does it have libgomp ?
1766
1767AC_MSG_CHECKING([for OpenMP])
1768
1769safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001770CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001771
1772AC_LINK_IFELSE(
1773[
1774#include <omp.h>
1775int main(int argc, char** argv)
1776{
1777 omp_set_dynamic(0);
1778 return 0;
1779}
1780],
1781[
1782ac_have_openmp=yes
1783AC_MSG_RESULT([yes])
1784], [
1785ac_have_openmp=no
1786AC_MSG_RESULT([no])
1787])
1788CFLAGS=$safe_CFLAGS
1789
1790AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1791
1792
sewardjc876a2f2009-01-22 22:44:30 +00001793# does this compiler have built-in functions for atomic memory access ?
1794AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1795
1796safe_CFLAGS=$CFLAGS
1797CFLAGS="$mflag_primary"
1798
1799AC_TRY_LINK(,
1800[
1801 int variable = 1;
1802 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1803 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1804],
1805[
bartc82d1372009-05-31 16:21:23 +00001806 ac_have_builtin_atomic=yes
sewardjc876a2f2009-01-22 22:44:30 +00001807 AC_MSG_RESULT([yes])
1808 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1809],
1810[
bartc82d1372009-05-31 16:21:23 +00001811 ac_have_builtin_atomic=no
sewardjc876a2f2009-01-22 22:44:30 +00001812 AC_MSG_RESULT([no])
1813])
1814
1815CFLAGS=$safe_CFLAGS
1816
bartc82d1372009-05-31 16:21:23 +00001817AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1818
sewardjc876a2f2009-01-22 22:44:30 +00001819
njn7fd6d382009-01-22 21:56:32 +00001820#----------------------------------------------------------------------------
1821# Ok. We're done checking.
1822#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001823
njn8b68b642009-06-24 00:37:09 +00001824# Nb: VEX/Makefile is generated from Makefile.vex.in.
1825AC_CONFIG_FILES([
sewardjde4a1d02002-03-22 01:27:54 +00001826 Makefile
njn8b68b642009-06-24 00:37:09 +00001827 VEX/Makefile:Makefile.vex.in
njn25cac76cb2002-09-23 11:21:57 +00001828 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001829 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001830 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001831 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001832 docs/lib/Makefile
1833 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001834 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001835 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001836 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001837 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001838 perf/Makefile
1839 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001840 include/Makefile
njn7a6e7462002-11-09 17:53:30 +00001841 auxprogs/Makefile
njn8b68b642009-06-24 00:37:09 +00001842 mpi/Makefile
njn25ab726032002-09-23 16:24:41 +00001843 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001844 memcheck/Makefile
1845 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001846 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001847 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001848 memcheck/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001849 memcheck/tests/darwin/Makefile
njna454ec02009-01-19 03:16:59 +00001850 memcheck/tests/x86-linux/Makefile
njn29a5c012009-05-06 06:15:55 +00001851 memcheck/perf/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001852 memcheck/docs/Makefile
1853 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001854 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001855 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001856 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001857 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001858 callgrind/Makefile
1859 callgrind/callgrind_annotate
1860 callgrind/callgrind_control
1861 callgrind/tests/Makefile
1862 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001863 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001864 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001865 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001866 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001867 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001868 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001869 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001870 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001871 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001872 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001873 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001874 none/Makefile
1875 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001876 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001877 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001878 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001879 none/tests/x86/Makefile
njn0458a122009-02-13 06:23:46 +00001880 none/tests/linux/Makefile
njnf76d27a2009-05-28 01:53:07 +00001881 none/tests/darwin/Makefile
njn06ca3322009-04-15 23:10:04 +00001882 none/tests/x86-linux/Makefile
njn9bc8c002002-10-02 13:49:13 +00001883 none/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001884 exp-ptrcheck/Makefile
1885 exp-ptrcheck/tests/Makefile
1886 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001887 drd/Makefile
1888 drd/docs/Makefile
1889 drd/scripts/download-and-build-splash2
1890 drd/tests/Makefile
njn8b68b642009-06-24 00:37:09 +00001891])
1892AC_OUTPUT
gobry3b777892002-04-04 09:18:39 +00001893
1894cat<<EOF
1895
njn311303f2009-02-06 03:46:50 +00001896 Maximum build arch: ${ARCH_MAX}
1897 Primary build arch: ${VGCONF_ARCH_PRI}
njn3f8a6e92009-06-02 00:20:47 +00001898 Secondary build arch: ${VGCONF_ARCH_SEC}
njn311303f2009-02-06 03:46:50 +00001899 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001900 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1901 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001902 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001903
gobry3b777892002-04-04 09:18:39 +00001904EOF