blob: 3ca0ef0ce177b11fd5c3ce2c15ec8f376cfada1d [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
sewardjde4a1d02002-03-22 01:27:54 +000065AC_PROG_RANLIB
66
bartcddeaf52008-05-25 15:58:11 +000067# If no AR variable was specified, look up the name of the archiver. Otherwise
68# do not touch the AR variable.
69if test "x$AR" = "x"; then
70 AC_PATH_PROGS([AR], ["${LD%ld}ar" "ar"], [ar])
71fi
72AC_ARG_VAR([AR],[Archiver command])
73
gobrye721a522002-03-22 13:38:30 +000074# Check for the compiler support
75if test "${GCC}" != "yes" ; then
76 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
77fi
78
sewardj2f685952002-12-22 19:32:23 +000079# figure out where perl lives
80AC_PATH_PROG(PERL, perl)
81
njn9315df32003-04-16 20:50:50 +000082# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000083AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000084AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000085
daywalker48ccca52002-04-15 00:31:58 +000086# some older automake's don't have it so try something on our own
87ifdef([AM_PROG_AS],[AM_PROG_AS],
88[
gobry1be19852002-03-26 20:44:55 +000089AS="${CC}"
90AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000091
gobry1be19852002-03-26 20:44:55 +000092ASFLAGS=""
93AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000094])
gobry3b777892002-04-04 09:18:39 +000095
gobry3b777892002-04-04 09:18:39 +000096
sewardjf33b4332008-07-18 18:20:42 +000097# Check we have GNU sed: some of the stuff done by "make install" relies
98# on some pretty fancy sed expressions, and AIX sed doesn't produce the
99# same results, causing install to fail
100
101AC_MSG_CHECKING([for GNU sed])
102
103[sed_firstline=`sed --version | head -n 1`]
104
105case "${sed_firstline}" in
106 GNU*)
107 AC_MSG_RESULT([ok, looks like GNU sed])
108 ;;
109 *)
110 AC_MSG_RESULT([please ensure first 'sed' in your path is GNU sed])
111 AC_MSG_RESULT([note: GNU sed is only required at build/install time])
112 AC_MSG_ERROR([build/install requires that 'sed' is GNU sed])
113 ;;
114esac
115
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
njn7fd6d382009-01-22 21:56:32 +0000217# VGCONF_OS is the primary build OS. It is passed in to compilation of many
218# C files via -VGO_$(VGCONF_OS) and -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000219AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000220AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000221
gobrye721a522002-03-22 13:38:30 +0000222case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000223 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000224 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000225 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000226
227 # Ok, this is linux. Check the kernel version
228 AC_MSG_CHECKING([for the kernel version])
229
230 kernel=`uname -r`
231
232 case "${kernel}" in
233 2.6.*)
234 AC_MSG_RESULT([2.6 family (${kernel})])
235 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
236 ;;
237
238 2.4.*)
239 AC_MSG_RESULT([2.4 family (${kernel})])
240 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
241 ;;
242
mueller8c68e042004-01-03 15:21:14 +0000243 *)
244 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000245 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000246 ;;
247 esac
248
249 ;;
250
sewardj03d86f22006-10-17 00:57:24 +0000251 aix5.1.*)
252 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000253 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000254 ;;
255 aix5.2.*)
256 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000257 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000258 ;;
259 aix5.3.*)
260 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000261 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000262 ;;
263
mueller8c68e042004-01-03 15:21:14 +0000264 *freebsd*)
265 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000266 VGCONF_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000267 ;;
268
269 *)
270 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000271 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000272 ;;
273esac
274
njn7fd6d382009-01-22 21:56:32 +0000275#----------------------------------------------------------------------------
276
tomd6398392006-06-07 17:44:36 +0000277# If we are building on a 64 bit platform test to see if the system
278# supports building 32 bit programs and disable 32 bit support if it
279# does not support building 32 bit programs
280
njn7fd6d382009-01-22 21:56:32 +0000281case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000282 amd64-linux|ppc64-linux)
283 AC_MSG_CHECKING([for 32 bit build support])
284 safe_CFLAGS=$CFLAGS
285 CFLAGS="-m32"
286 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000287 return 0;
tomd6398392006-06-07 17:44:36 +0000288 ],
289 [
290 AC_MSG_RESULT([yes])
291 ], [
292 vg_cv_only64bit="yes"
293 AC_MSG_RESULT([no])
294 ])
295 CFLAGS=$safe_CFLAGS;;
296esac
297
298if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
299 AC_MSG_ERROR(
300 [--enable-only32bit was specified but system does not support 32 bit builds])
301fi
nethercote888ecb72004-08-23 14:54:40 +0000302
njn7fd6d382009-01-22 21:56:32 +0000303#----------------------------------------------------------------------------
304
305# VGCONF_ARCH_PRI is the arch for the primary build target. By default it's
306# the same as ARCH_MAX. But if, say, we do a build on an amd64 machine, but
307# --enable-only32bit has been requested, then ARCH_MAX (see above) will be
308# "amd64" since that reflects the most that this cpu can do, but
309# VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the arch
310# corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
311# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
312# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
313AC_SUBST(VGCONF_ARCH_PRI)
314
315# VGCONF_PLATFORM_PRI_CAPS is the primary build target. The entire system,
316# including regression and performance tests, will be built for this target.
317# The "_CAPS" indicates that the name is in capital letters, because it's
318# used to create various Makefile variables, which are all in caps by
319# convention. This is in contrast to VGCONF_ARCH_PRI and VGCONF_OS which
320# are not in caps.
321AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
322
323# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
324# Valgrind and tools will also be built for this target, but not the
325# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000326#
njn7fd6d382009-01-22 21:56:32 +0000327# By default, the primary arch is the same as the "max" arch, as commented
328# above (at the definition of ARCH_MAX). We may choose to downgrade it in
329# the big case statement just below here, in the case where we're building
330# on a 64 bit machine but have been requested only to do a 32 bit build.
331AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
332
sewardj01262142006-01-04 01:20:28 +0000333AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000334
njn7fd6d382009-01-22 21:56:32 +0000335case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000336 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000337 VGCONF_ARCH_PRI="x86"
338 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
339 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000340 valt_load_address_normal="0x38000000"
341 valt_load_address_inner="0x28000000"
sewardj3e38ce02004-11-23 01:17:29 +0000342 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
sewardj01262142006-01-04 01:20:28 +0000343 ;;
344 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000345 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000346 VGCONF_ARCH_PRI="amd64"
347 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
348 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000349 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000350 VGCONF_ARCH_PRI="x86"
351 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
352 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000353 else
njn7fd6d382009-01-22 21:56:32 +0000354 VGCONF_ARCH_PRI="amd64"
355 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
356 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000357 fi
njnd74b0ef2009-01-20 06:06:52 +0000358 valt_load_address_normal="0x38000000"
359 valt_load_address_inner="0x28000000"
sewardj01262142006-01-04 01:20:28 +0000360 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
361 ;;
362 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000363 VGCONF_ARCH_PRI="ppc32"
364 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
365 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000366 valt_load_address_normal="0x38000000"
367 valt_load_address_inner="0x28000000"
sewardj01262142006-01-04 01:20:28 +0000368 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
369 ;;
sewardj03d86f22006-10-17 00:57:24 +0000370 ppc64-aix5)
371 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000372 VGCONF_ARCH_PRI="ppc64"
373 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
374 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000375 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000376 VGCONF_ARCH_PRI="ppc32"
377 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
378 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000379 else
njn7fd6d382009-01-22 21:56:32 +0000380 VGCONF_ARCH_PRI="ppc64"
381 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
382 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000383 fi
njnd74b0ef2009-01-20 06:06:52 +0000384 valt_load_address_normal="0x38000000"
385 valt_load_address_inner="0x28000000"
sewardj03d86f22006-10-17 00:57:24 +0000386 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
387 ;;
sewardj01262142006-01-04 01:20:28 +0000388 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000389 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000390 VGCONF_ARCH_PRI="ppc64"
391 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
392 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000393 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000394 VGCONF_ARCH_PRI="ppc32"
395 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
396 VGCONF_PLATFORM_SEC_CAPS=""
397 VGCONF_ARCH_PRI="ppc32"
sewardj86e992f2006-01-28 18:39:09 +0000398 else
njn7fd6d382009-01-22 21:56:32 +0000399 VGCONF_ARCH_PRI="ppc64"
400 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
401 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000402 fi
njnd74b0ef2009-01-20 06:06:52 +0000403 valt_load_address_normal="0x38000000"
404 valt_load_address_inner="0x28000000"
sewardj01262142006-01-04 01:20:28 +0000405 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
406 ;;
nethercote888ecb72004-08-23 14:54:40 +0000407 *)
njn7fd6d382009-01-22 21:56:32 +0000408 VGCONF_ARCH_PRI="unknown"
409 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
410 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
nethercote888ecb72004-08-23 14:54:40 +0000411 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000412 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000413 ;;
414esac
sewardjde4a1d02002-03-22 01:27:54 +0000415
njn7fd6d382009-01-22 21:56:32 +0000416#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000417
njn7fd6d382009-01-22 21:56:32 +0000418# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
419# defined.
420AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
421 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
422 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX )
423AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
424 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX )
425AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
426 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
427 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
428 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
429 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
430AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
431 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
432 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj03d86f22006-10-17 00:57:24 +0000433
njn7fd6d382009-01-22 21:56:32 +0000434# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
435# become defined.
436AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
437 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
438 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
439AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
440 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
441AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
442 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
443 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
444AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
445 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
446AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
447 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
448 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
449AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
450 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
451
452# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000453# Relies on the assumption that the primary and secondary targets are
454# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000455AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
456 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
457 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
458 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
459 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
460AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
461 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
462 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
sewardj03d86f22006-10-17 00:57:24 +0000463
464
njn7fd6d382009-01-22 21:56:32 +0000465# Sometimes, in the Makefile.am files, it's useful to know whether or not
466# there is a secondary target.
467AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC_CAPS,
468 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000469
tomb637bad2005-11-08 12:28:35 +0000470
njn7fd6d382009-01-22 21:56:32 +0000471#----------------------------------------------------------------------------
472# Inner Valgrind?
473#----------------------------------------------------------------------------
474
njnd74b0ef2009-01-20 06:06:52 +0000475# Check if this should be built as an inner Valgrind, to be run within
476# another Valgrind. Choose the load address accordingly.
477AC_SUBST(VALT_LOAD_ADDRESS)
478AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
479 [AC_ARG_ENABLE(inner,
480 [ --enable-inner enables self-hosting],
481 [vg_cv_inner=$enableval],
482 [vg_cv_inner=no])])
483if test "$vg_cv_inner" = yes; then
484 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
485 VALT_LOAD_ADDRESS=$valt_load_address_inner
486else
487 VALT_LOAD_ADDRESS=$valt_load_address_normal
488fi
489
490
njn7fd6d382009-01-22 21:56:32 +0000491#----------------------------------------------------------------------------
492# Libc and suppressions
493#----------------------------------------------------------------------------
494# This variable will collect the suppression files to be used.
495DEFAULT_SUPP=""
496AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000497
dirk07596a22008-04-25 11:33:30 +0000498GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000499
sewardjde4a1d02002-03-22 01:27:54 +0000500AC_EGREP_CPP([GLIBC_22], [
501#include <features.h>
502#ifdef __GNU_LIBRARY__
503 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
504 GLIBC_22
505 #endif
506#endif
507],
dirk07596a22008-04-25 11:33:30 +0000508GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000509
sewardj08c7f012002-10-07 23:56:55 +0000510AC_EGREP_CPP([GLIBC_23], [
511#include <features.h>
512#ifdef __GNU_LIBRARY__
513 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
514 GLIBC_23
515 #endif
516#endif
517],
dirk07596a22008-04-25 11:33:30 +0000518GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000519
njn781dba52005-06-30 04:06:38 +0000520AC_EGREP_CPP([GLIBC_24], [
521#include <features.h>
522#ifdef __GNU_LIBRARY__
523 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
524 GLIBC_24
525 #endif
526#endif
527],
dirk07596a22008-04-25 11:33:30 +0000528GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000529
dirkaece45c2006-10-12 08:17:49 +0000530AC_EGREP_CPP([GLIBC_25], [
531#include <features.h>
532#ifdef __GNU_LIBRARY__
533 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
534 GLIBC_25
535 #endif
536#endif
537],
dirk07596a22008-04-25 11:33:30 +0000538GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000539
dirkc8bd0c52007-05-23 17:39:08 +0000540AC_EGREP_CPP([GLIBC_26], [
541#include <features.h>
542#ifdef __GNU_LIBRARY__
543 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
544 GLIBC_26
545 #endif
546#endif
547],
dirk07596a22008-04-25 11:33:30 +0000548GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000549
sewardj68c80c12007-11-18 14:40:02 +0000550AC_EGREP_CPP([GLIBC_27], [
551#include <features.h>
552#ifdef __GNU_LIBRARY__
553 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
554 GLIBC_27
555 #endif
556#endif
557],
dirk07596a22008-04-25 11:33:30 +0000558GLIBC_VERSION="2.7")
559
560AC_EGREP_CPP([GLIBC_28], [
561#include <features.h>
562#ifdef __GNU_LIBRARY__
563 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
564 GLIBC_28
565 #endif
566#endif
567],
568GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000569
dirkd2e31eb2008-11-19 23:58:36 +0000570AC_EGREP_CPP([GLIBC_29], [
571#include <features.h>
572#ifdef __GNU_LIBRARY__
573 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
574 GLIBC_29
575 #endif
576#endif
577],
578GLIBC_VERSION="2.9")
579
sewardj03d86f22006-10-17 00:57:24 +0000580AC_EGREP_CPP([AIX5_LIBC], [
581#include <standards.h>
582#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
583 AIX5_LIBC
584#endif
585],
dirk07596a22008-04-25 11:33:30 +0000586GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000587
dirk07596a22008-04-25 11:33:30 +0000588AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000589
dirk07596a22008-04-25 11:33:30 +0000590case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000591 2.2)
592 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000593 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000594 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
595 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000596 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000597 ;;
598
sewardj08c7f012002-10-07 23:56:55 +0000599 2.3)
600 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000601 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000602 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000603 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000604 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000605 ;;
606
njn781dba52005-06-30 04:06:38 +0000607 2.4)
608 AC_MSG_RESULT(2.4 family)
609 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000610 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000611 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000612 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000613 ;;
614
dirkaece45c2006-10-12 08:17:49 +0000615 2.5)
616 AC_MSG_RESULT(2.5 family)
617 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000618 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000619 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000620 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000621 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000622 2.6)
623 AC_MSG_RESULT(2.6 family)
624 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000625 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000626 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000627 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000628 ;;
629 2.7)
630 AC_MSG_RESULT(2.7 family)
631 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000632 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000633 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000634 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000635 ;;
dirk07596a22008-04-25 11:33:30 +0000636 2.8)
637 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000638 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000639 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
640 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
641 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
642 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000643 2.9)
644 AC_MSG_RESULT(2.9 family)
645 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
646 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
647 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
648 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
649 ;;
sewardj03d86f22006-10-17 00:57:24 +0000650 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000651 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
652 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 +0000653 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
654 ;;
dirkaece45c2006-10-12 08:17:49 +0000655
sewardjde4a1d02002-03-22 01:27:54 +0000656 *)
657 AC_MSG_RESULT(unsupported version)
dirkd2e31eb2008-11-19 23:58:36 +0000658 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.9])
dirk07596a22008-04-25 11:33:30 +0000659 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
sewardjde4a1d02002-03-22 01:27:54 +0000660 ;;
661esac
662
dirk07596a22008-04-25 11:33:30 +0000663AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000664
sewardj414f3582008-07-18 20:46:00 +0000665
666# Add default suppressions for the X client libraries. Make no
667# attempt to detect whether such libraries are installed on the
668# build machine (or even if any X facilities are present); just
669# add the suppressions antidisirregardless.
670DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
671DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000672
sewardj5744c022008-10-19 18:58:13 +0000673# Add glibc and X11 suppressions for exp-ptrcheck
674DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
675
sewardj2e10a682003-04-07 19:36:41 +0000676
njn7fd6d382009-01-22 21:56:32 +0000677#----------------------------------------------------------------------------
678# Checking for various library functions and other definitions
679#----------------------------------------------------------------------------
680
bart59e2f182008-04-28 16:22:53 +0000681# Check for CLOCK_MONOTONIC
682
683AC_MSG_CHECKING([for CLOCK_MONOTONIC])
684
685AC_TRY_COMPILE(
686[
687#include <time.h>
688], [
689 struct timespec t;
690 clock_gettime(CLOCK_MONOTONIC, &t);
691 return 0;
692],
693[
694AC_MSG_RESULT([yes])
695AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
696 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
697], [
698AC_MSG_RESULT([no])
699])
700
bartfea06922008-05-03 09:12:15 +0000701
702# Check for PTHREAD_MUTEX_ADAPTIVE_NP
703
704AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
705
706AC_TRY_COMPILE(
707[
708#define _GNU_SOURCE
709#include <pthread.h>
710], [
711 return (PTHREAD_MUTEX_ADAPTIVE_NP);
712],
713[
714AC_MSG_RESULT([yes])
715AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
716 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
717], [
718AC_MSG_RESULT([no])
719])
720
721
722# Check for PTHREAD_MUTEX_ERRORCHECK_NP
723
724AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
725
726AC_TRY_COMPILE(
727[
728#define _GNU_SOURCE
729#include <pthread.h>
730], [
731 return (PTHREAD_MUTEX_ERRORCHECK_NP);
732],
733[
734AC_MSG_RESULT([yes])
735AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
736 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
737], [
738AC_MSG_RESULT([no])
739])
740
741
742# Check for PTHREAD_MUTEX_RECURSIVE_NP
743
744AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
745
746AC_TRY_COMPILE(
747[
748#define _GNU_SOURCE
749#include <pthread.h>
750], [
751 return (PTHREAD_MUTEX_RECURSIVE_NP);
752],
753[
754AC_MSG_RESULT([yes])
755AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
756 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
757], [
758AC_MSG_RESULT([no])
759])
760
761
762# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
763
764AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
765
766AC_TRY_COMPILE(
767[
768#define _GNU_SOURCE
769#include <pthread.h>
770], [
771 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
772 return 0;
773],
774[
775AC_MSG_RESULT([yes])
776AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
777 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
778], [
779AC_MSG_RESULT([no])
780])
781
782
barte8900ff2008-10-13 19:22:35 +0000783# Check whether FILE has a member called _lock and whether it's a pointer.
784
785AC_MSG_CHECKING([for FILE::_lock])
786
787AC_TRY_COMPILE(
788[
789 #include <stdio.h>
790], [
791 void *p;
792 p = stdout->_lock;
793 return 0;
794], [
795AC_MSG_RESULT([yes])
796AC_DEFINE([HAVE_LIBC_FILE_LOCK], 1,
797 [Define to 1 if FILE has a member called _lock.])
798], [
799AC_MSG_RESULT([no])
800])
801
802
bart5e389f12008-04-05 12:53:15 +0000803# Check whether pthread_mutex_t has a member called __m_kind.
804
805AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
806
bart56730cd2008-05-11 06:41:46 +0000807AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000808[
bart56730cd2008-05-11 06:41:46 +0000809 #include <pthread.h>
810], [
bart5e389f12008-04-05 12:53:15 +0000811 pthread_mutex_t m;
812 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000813], [
bart5e389f12008-04-05 12:53:15 +0000814AC_MSG_RESULT([yes])
815AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
816 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
817], [
818AC_MSG_RESULT([no])
819])
820
821
822# Check whether pthread_mutex_t has a member called __data.__kind.
823
824AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
825
bart56730cd2008-05-11 06:41:46 +0000826AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000827[
bart56730cd2008-05-11 06:41:46 +0000828#include <pthread.h>
829], [
bart5e389f12008-04-05 12:53:15 +0000830 pthread_mutex_t m;
831 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000832], [
bart5e389f12008-04-05 12:53:15 +0000833AC_MSG_RESULT([yes])
834AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
835 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
836], [
837AC_MSG_RESULT([no])
838])
839
840
bart62c370e2008-05-12 18:50:51 +0000841# does this compiler support -maltivec and does it have the include file
842# <altivec.h> ?
843
844AC_MSG_CHECKING([for Altivec])
845
846safe_CFLAGS=$CFLAGS
847CFLAGS="-maltivec"
848
849AC_TRY_COMPILE(
850[
851#include <altivec.h>
852], [
853 vector unsigned int v;
854],
855[
856ac_have_altivec=yes
857AC_MSG_RESULT([yes])
858], [
859ac_have_altivec=no
860AC_MSG_RESULT([no])
861])
862CFLAGS=$safe_CFLAGS
863
864AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
865AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
866
867
barta50aa8a2008-04-27 06:06:57 +0000868# Check for eventfd_t, eventfd() and eventfd_read()
869AC_MSG_CHECKING([for eventfd()])
870
871AC_TRY_LINK(
872[
873#include <sys/eventfd.h>
874], [
875 eventfd_t ev;
876 int fd;
877
878 fd = eventfd(5, 0);
879 eventfd_read(fd, &ev);
880 return 0;
881],
882[
883AC_MSG_RESULT([yes])
884AC_DEFINE([HAVE_EVENTFD], 1,
885 [Define to 1 if you have the `eventfd' function.])
886AC_DEFINE([HAVE_EVENTFD_READ], 1,
887 [Define to 1 if you have the `eventfd_read' function.])
888], [
889AC_MSG_RESULT([no])
890])
891
892
njn7fd6d382009-01-22 21:56:32 +0000893#----------------------------------------------------------------------------
894# Checking for supported compiler flags.
895#----------------------------------------------------------------------------
896
sewardj535c50f2005-06-04 23:14:53 +0000897# does this compiler support -m32 ?
898AC_MSG_CHECKING([if gcc accepts -m32])
899
900safe_CFLAGS=$CFLAGS
901CFLAGS="-m32"
902
903AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000904 return 0;
sewardj535c50f2005-06-04 23:14:53 +0000905],
906[
907FLAG_M32="-m32"
908AC_MSG_RESULT([yes])
909], [
910FLAG_M32=""
911AC_MSG_RESULT([no])
912])
913CFLAGS=$safe_CFLAGS
914
915AC_SUBST(FLAG_M32)
916
917
sewardj03d86f22006-10-17 00:57:24 +0000918# does this compiler support -maix32 ?
919AC_MSG_CHECKING([if gcc accepts -maix32])
920
921safe_CFLAGS=$CFLAGS
922CFLAGS="-maix32"
923
924AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000925 return 0;
sewardj03d86f22006-10-17 00:57:24 +0000926],
927[
928FLAG_MAIX32="-maix32"
929AC_MSG_RESULT([yes])
930], [
931FLAG_MAIX32=""
932AC_MSG_RESULT([no])
933])
934CFLAGS=$safe_CFLAGS
935
936AC_SUBST(FLAG_MAIX32)
937
938
sewardj01262142006-01-04 01:20:28 +0000939# does this compiler support -m64 ?
940AC_MSG_CHECKING([if gcc accepts -m64])
941
942safe_CFLAGS=$CFLAGS
943CFLAGS="-m64"
944
945AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000946 return 0;
sewardj01262142006-01-04 01:20:28 +0000947],
948[
949FLAG_M64="-m64"
950AC_MSG_RESULT([yes])
951], [
952FLAG_M64=""
953AC_MSG_RESULT([no])
954])
955CFLAGS=$safe_CFLAGS
956
957AC_SUBST(FLAG_M64)
958
959
sewardj03d86f22006-10-17 00:57:24 +0000960# does this compiler support -maix64 ?
961AC_MSG_CHECKING([if gcc accepts -maix64])
962
963safe_CFLAGS=$CFLAGS
964CFLAGS="-maix64"
965
966AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000967 return 0;
sewardj03d86f22006-10-17 00:57:24 +0000968],
969[
970FLAG_MAIX64="-maix64"
971AC_MSG_RESULT([yes])
972], [
973FLAG_MAIX64=""
974AC_MSG_RESULT([no])
975])
976CFLAGS=$safe_CFLAGS
977
978AC_SUBST(FLAG_MAIX64)
979
980
sewardj67f1fcc2005-07-03 10:41:02 +0000981# does this compiler support -mmmx ?
982AC_MSG_CHECKING([if gcc accepts -mmmx])
983
984safe_CFLAGS=$CFLAGS
985CFLAGS="-mmmx"
986
987AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000988 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +0000989],
990[
991FLAG_MMMX="-mmmx"
992AC_MSG_RESULT([yes])
993], [
994FLAG_MMMX=""
995AC_MSG_RESULT([no])
996])
997CFLAGS=$safe_CFLAGS
998
999AC_SUBST(FLAG_MMMX)
1000
1001
1002# does this compiler support -msse ?
1003AC_MSG_CHECKING([if gcc accepts -msse])
1004
1005safe_CFLAGS=$CFLAGS
1006CFLAGS="-msse"
1007
1008AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001009 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001010],
1011[
1012FLAG_MSSE="-msse"
1013AC_MSG_RESULT([yes])
1014], [
1015FLAG_MSSE=""
1016AC_MSG_RESULT([no])
1017])
1018CFLAGS=$safe_CFLAGS
1019
1020AC_SUBST(FLAG_MSSE)
1021
1022
sewardj5b754b42002-06-03 22:53:35 +00001023# does this compiler support -mpreferred-stack-boundary=2 ?
1024AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1025
daywalker3664f562003-10-17 13:43:46 +00001026safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001027CFLAGS="-mpreferred-stack-boundary=2"
1028
1029AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001030 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001031],
1032[
1033PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001034AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001035], [
1036PREFERRED_STACK_BOUNDARY=""
1037AC_MSG_RESULT([no])
1038])
daywalker3664f562003-10-17 13:43:46 +00001039CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001040
1041AC_SUBST(PREFERRED_STACK_BOUNDARY)
1042
sewardj535c50f2005-06-04 23:14:53 +00001043
sewardjb5f6f512005-03-10 23:59:00 +00001044# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001045AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001046
1047safe_CFLAGS=$CFLAGS
1048CFLAGS="-Wno-pointer-sign"
1049
1050AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001051 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001052],
1053[
1054no_pointer_sign=yes
1055AC_MSG_RESULT([yes])
1056], [
1057no_pointer_sign=no
1058AC_MSG_RESULT([no])
1059])
1060CFLAGS=$safe_CFLAGS
1061
1062if test x$no_pointer_sign = xyes; then
1063 CFLAGS="$CFLAGS -Wno-pointer-sign"
1064fi
1065
sewardj535c50f2005-06-04 23:14:53 +00001066
tom1e946682005-10-12 11:27:33 +00001067# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001068AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001069
1070safe_CFLAGS=$CFLAGS
1071CFLAGS="-Wdeclaration-after-statement"
1072
1073AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001074 return 0;
tom1e946682005-10-12 11:27:33 +00001075],
1076[
tome9814c32005-10-12 11:30:43 +00001077declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001078FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001079AC_MSG_RESULT([yes])
1080], [
tome9814c32005-10-12 11:30:43 +00001081declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001082FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001083AC_MSG_RESULT([no])
1084])
1085CFLAGS=$safe_CFLAGS
1086
sewardj72a547e2006-01-25 02:58:28 +00001087AC_SUBST(FLAG_WDECL_AFTER_STMT)
1088
tome9814c32005-10-12 11:30:43 +00001089if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001090 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1091fi
1092
sewardj00f1e622006-03-12 16:47:10 +00001093
bart9d865fa2008-06-23 12:11:49 +00001094# does this compiler support -Wno-format-zero-length ?
1095
1096AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1097
1098safe_CFLAGS=$CFLAGS
1099CFLAGS="-Wno-format-zero-length"
1100
1101AC_TRY_COMPILE(
1102[ ],
1103[
1104 return 0;
1105],
1106[
1107AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1108AC_MSG_RESULT([yes])
1109],
1110[
1111AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1112AC_MSG_RESULT([no])
1113])
1114CFLAGS=$safe_CFLAGS
1115
1116
bart56730cd2008-05-11 06:41:46 +00001117# does this compiler support -Wextra or the older -W ?
1118
1119AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1120
1121safe_CFLAGS=$CFLAGS
1122CFLAGS="-Wextra"
1123
1124AC_TRY_COMPILE(
1125[ ],
1126[
1127 return 0;
1128],
1129[
1130AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1131AC_MSG_RESULT([-Wextra])
1132], [
1133 CFLAGS="-W"
1134 AC_TRY_COMPILE(
1135 [ ],
1136 [
1137 return 0;
1138 ],
1139 [
1140 AC_SUBST([FLAG_W_EXTRA], [-W])
1141 AC_MSG_RESULT([-W])
1142 ], [
1143 AC_SUBST([FLAG_W_EXTRA], [])
1144 AC_MSG_RESULT([not supported])
1145 ])
1146])
1147CFLAGS=$safe_CFLAGS
1148
1149
sewardja72c26d2007-05-01 13:44:08 +00001150# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001151AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001152
1153safe_CFLAGS=$CFLAGS
1154CFLAGS="-fno-stack-protector"
1155
1156AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001157 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001158],
1159[
1160no_stack_protector=yes
1161FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1162AC_MSG_RESULT([yes])
1163], [
1164no_stack_protector=no
1165FLAG_FNO_STACK_PROTECTOR=""
1166AC_MSG_RESULT([no])
1167])
1168CFLAGS=$safe_CFLAGS
1169
1170AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1171
1172if test x$no_stack_protector = xyes; then
1173 CFLAGS="$CFLAGS -fno-stack-protector"
1174fi
1175
1176
bart56730cd2008-05-11 06:41:46 +00001177# does this compiler support --param inline-unit-growth=... ?
1178
1179AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1180
1181safe_CFLAGS=$CFLAGS
1182CFLAGS="--param inline-unit-growth=900"
1183
1184AC_TRY_COMPILE(
1185[ ],
1186[
1187 return 0;
1188],
1189[
1190AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1191 ["--param inline-unit-growth=900"])
1192AC_MSG_RESULT([yes])
1193], [
1194AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1195AC_MSG_RESULT([no])
1196])
1197CFLAGS=$safe_CFLAGS
1198
1199
tomd55121e2005-12-19 12:40:13 +00001200# does this compiler support __builtin_expect?
1201AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001202
tomd55121e2005-12-19 12:40:13 +00001203AC_TRY_LINK(, [
1204return __builtin_expect(1, 1) ? 1 : 0
1205],
1206[
1207ac_have_builtin_expect=yes
1208AC_MSG_RESULT([yes])
1209], [
1210ac_have_builtin_expect=no
1211AC_MSG_RESULT([no])
1212])
1213if test x$ac_have_builtin_expect = xyes ; then
1214 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1215fi
1216
tom1e946682005-10-12 11:27:33 +00001217
bartcd529dc2008-06-26 08:43:12 +00001218# does this compiler have built-in functions for atomic memory access ?
1219AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1220
1221AC_TRY_LINK(,
1222[
1223 int variable = 1;
bart99ae6102008-09-21 11:24:00 +00001224 return (__sync_bool_compare_and_swap(&variable, 1, 2)
bartd5a131f2008-12-21 16:09:03 +00001225 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bartcd529dc2008-06-26 08:43:12 +00001226],
1227[
1228 AC_MSG_RESULT([yes])
1229 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1230],
1231[
1232 AC_MSG_RESULT([no])
1233])
1234
1235
sewardj00f1e622006-03-12 16:47:10 +00001236# does the ppc assembler support "mtocrf" et al?
1237AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1238
1239AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001240__asm__ __volatile__("mtocrf 4,0");
1241__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001242],
1243[
1244ac_have_as_ppc_mftocrf=yes
1245AC_MSG_RESULT([yes])
1246], [
1247ac_have_as_ppc_mftocrf=no
1248AC_MSG_RESULT([no])
1249])
1250if test x$ac_have_as_ppc_mftocrf = xyes ; then
1251 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1252fi
1253
1254
sewardjf0aabf82007-03-22 00:24:21 +00001255# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001256# Note, this doesn't generate a C-level symbol. It generates a
1257# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001258AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1259
1260AC_TRY_COMPILE(, [
1261 do { long long int x;
1262 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1263 while (0)
1264],
1265[
1266ac_have_as_sse3=yes
1267AC_MSG_RESULT([yes])
1268], [
1269ac_have_as_sse3=no
1270AC_MSG_RESULT([no])
1271])
sewardjfa18a262007-03-22 12:13:13 +00001272
1273AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001274
1275
sewardj6d6da5b2008-02-09 12:07:40 +00001276# Ditto for SSSE3 instructions (note extra S)
1277# Note, this doesn't generate a C-level symbol. It generates a
1278# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1279AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1280
1281AC_TRY_COMPILE(, [
1282 do { long long int x;
1283 __asm__ __volatile__(
1284 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1285 while (0)
1286],
1287[
1288ac_have_as_ssse3=yes
1289AC_MSG_RESULT([yes])
1290], [
1291ac_have_as_ssse3=no
1292AC_MSG_RESULT([no])
1293])
1294
1295AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1296
1297
sewardjb5f6f512005-03-10 23:59:00 +00001298# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001299if test "x${cross_compiling}" = "xno"; then
1300# Native compilation: check whether running a program using TLS succeeds.
1301# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1302# succeeds but running programs using TLS fails.
1303AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1304 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1305 [vg_cv_tls=$enableval],
1306 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1307 [[return foo;]])],
1308 [vg_cv_tls=yes],
1309 [vg_cv_tls=no])])])
1310else
1311# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001312AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1313 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1314 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001315 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001316 [[return foo;]])],
1317 [vg_cv_tls=yes],
1318 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001319fi
sewardjb5f6f512005-03-10 23:59:00 +00001320
1321if test "$vg_cv_tls" = yes; then
1322AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1323fi
sewardj5b754b42002-06-03 22:53:35 +00001324
sewardj535c50f2005-06-04 23:14:53 +00001325
njn7fd6d382009-01-22 21:56:32 +00001326#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001327# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001328#----------------------------------------------------------------------------
1329
sewardjde4a1d02002-03-22 01:27:54 +00001330AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001331AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001332 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001333 endian.h \
1334 mqueue.h \
1335 sys/endian.h \
1336 sys/epoll.h \
1337 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001338 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001339 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001340 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001341 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001342 sys/syscall.h \
1343 sys/time.h \
1344 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001345 ])
sewardjde4a1d02002-03-22 01:27:54 +00001346
njn7fd6d382009-01-22 21:56:32 +00001347#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001348# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001349#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001350AC_TYPE_UID_T
1351AC_TYPE_OFF_T
1352AC_TYPE_SIZE_T
1353AC_HEADER_TIME
1354
sewardj535c50f2005-06-04 23:14:53 +00001355
njn7fd6d382009-01-22 21:56:32 +00001356#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001357# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001358#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001359AC_FUNC_MEMCMP
1360AC_FUNC_MMAP
1361AC_TYPE_SIGNAL
1362
bart71bad292008-04-27 11:43:23 +00001363AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001364
bartf5ceec82008-04-26 07:45:10 +00001365AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001366 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001367 epoll_create \
1368 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001369 floor \
bartce48fa92008-04-26 10:59:46 +00001370 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001371 mallinfo \
1372 memchr \
1373 memset \
1374 mkdir \
1375 ppoll \
bart6d45e922009-01-20 13:45:38 +00001376 pthread_barrier_init \
1377 pthread_condattr_setclock \
1378 pthread_mutex_timedlock \
1379 pthread_rwlock_timedrdlock \
1380 pthread_rwlock_timedwrlock \
1381 pthread_spin_lock \
bartf5ceec82008-04-26 07:45:10 +00001382 semtimedop \
1383 signalfd \
bart71bad292008-04-27 11:43:23 +00001384 syscall \
bartf5ceec82008-04-26 07:45:10 +00001385 strchr \
1386 strdup \
1387 strpbrk \
1388 strrchr \
1389 strstr \
1390 timerfd \
1391 utimensat \
1392 ])
sewardjde4a1d02002-03-22 01:27:54 +00001393
bart623eec32008-07-29 17:54:49 +00001394# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1395# libraries with any shared object and/or executable. This is NOT what we
1396# want for e.g. vgpreload_core-x86-linux.so
1397LIBS=""
sewardj80637752006-03-02 13:48:21 +00001398
bart6d45e922009-01-20 13:45:38 +00001399AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1400 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001401AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1402 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001403AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1404 [test x$ac_cv_func_pthread_spin_lock = xyes])
1405
njn7fd6d382009-01-22 21:56:32 +00001406
1407#----------------------------------------------------------------------------
1408# MPI checks
1409#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001410# Do we have a useable MPI setup on the primary and/or secondary targets?
1411# On Linux, by default, assumes mpicc and -m32/-m64
1412# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001413# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001414# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1415# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001416MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001417if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1418 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001419 MPI_CC="mpxlc"
1420fi
1421
sewardje9fa5062006-03-12 18:29:18 +00001422mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001423if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1424 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001425 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001426elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1427 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001428 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001429elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001430 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001431elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001432 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001433fi
1434
sewardj03d86f22006-10-17 00:57:24 +00001435mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001436if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1437 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001438 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001439elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001440 mflag_secondary=-q32
1441fi
1442
1443
sewardj0ad46092006-03-02 17:09:16 +00001444AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001445 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001446 MPI_CC=$withval
1447)
sewardj03d86f22006-10-17 00:57:24 +00001448AC_SUBST(MPI_CC)
1449
1450## See if MPI_CC works for the primary target
1451##
1452AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001453saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001454saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001455CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001456CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001457AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001458#include <mpi.h>
1459#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001460],[
1461 int r = MPI_Init(NULL,NULL);
1462 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1463 return r;
1464], [
sewardj03d86f22006-10-17 00:57:24 +00001465ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001466AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001467], [
sewardj03d86f22006-10-17 00:57:24 +00001468ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001469AC_MSG_RESULT([no])
1470])
sewardj0ad46092006-03-02 17:09:16 +00001471CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001472CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001473AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001474
sewardj03d86f22006-10-17 00:57:24 +00001475## See if MPI_CC works for the secondary target. Complication: what if
1476## there is no secondary target? We need this to then fail.
1477## Kludge this by making MPI_CC something which will surely fail in
1478## such a case.
1479##
1480AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1481saved_CC=$CC
1482saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001483if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001484 CC="$MPI_CC this will surely fail"
1485else
1486 CC=$MPI_CC
1487fi
1488CFLAGS=$mflag_secondary
1489AC_TRY_LINK([
1490#include <mpi.h>
1491#include <stdio.h>
1492],[
1493 int r = MPI_Init(NULL,NULL);
1494 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1495 return r;
1496], [
1497ac_have_mpi2_sec=yes
1498AC_MSG_RESULT([yes, $MPI_CC])
1499], [
1500ac_have_mpi2_sec=no
1501AC_MSG_RESULT([no])
1502])
1503CC=$saved_CC
1504CFLAGS=$saved_CFLAGS
1505AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001506
1507
njn7fd6d382009-01-22 21:56:32 +00001508#----------------------------------------------------------------------------
1509# Other library checks
1510#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001511# There now follow some tests for QtCore, Boost, and OpenMP. These
1512# tests are present because Drd has some regression tests that use
1513# these packages. All regression test programs all compiled only
1514# for the primary target. And so it is important that the configure
1515# checks that follow, use the correct -m32 or -m64 flag for the
1516# primary target (called $mflag_primary). Otherwise, we can end up
1517# in a situation (eg) where, on amd64-linux, the test for Boost checks
1518# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1519# only build (meaning, the primary target is x86-linux), the build
1520# of the regtest programs that use Boost fails, because they are
1521# build as 32-bit (IN THIS EXAMPLE).
1522#
1523# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1524# NEEDED BY THE REGRESSION TEST PROGRAMS.
1525
1526
bart21d3cfc2008-08-02 09:08:17 +00001527# The test below verifies whether the QtCore package been installed.
1528# This test works as follows:
1529# - If pkg-config was not installed at the time autogen.sh was run,
1530# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1531# autogen.sh. Augogen.sh will generate a configure script that prints
1532# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1533# - If pkg-config was installed at the time autogen.sh was run,
1534# the generated configure script will try to detect the presence of the
1535# Qt4 QtCore library by looking up compile and linker flags in the file
1536# called QtCore.pc.
1537# - pkg-config settings can be overridden via the configure variables
1538# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1539# configure script -- see also ./configure --help).
1540# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1541# the pkg-config executable is not present on the system on which the
1542# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001543
bart21d3cfc2008-08-02 09:08:17 +00001544ifdef(
1545 [PKG_CHECK_EXISTS],
1546 [PKG_CHECK_EXISTS(
1547 [QtCore],
1548 [
1549 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001550 # Paranoia: don't trust the result reported by pkg-config, but when
1551 # pkg-config reports that QtCore has been found, verify whether linking
1552 # programs with QtCore succeeds.
1553 AC_LANG(C++)
1554 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001555 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001556 AC_TRY_LINK(
1557 [#include <QMutex>],
1558 [QMutex Mutex;],
1559 [ac_have_qtcore=yes],
1560 [
1561 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1562 ac_have_qtcore=no
1563 ]
1564 )
1565 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001566 ],
1567 [
1568 ac_have_qtcore=no
1569 ]
1570 )
1571 ],
1572 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1573 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1574 [ac_have_qtcore=no]
1575)
bart41ac62a2008-07-07 16:58:03 +00001576
1577AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1578
1579
bart62f54e42008-07-28 11:35:10 +00001580# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1581# See also http://doc.trolltech.com/4.3/qmutex.html.
1582if test x$ac_have_qtcore = xyes; then
1583 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1584 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001585 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001586 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001587 AC_TRY_COMPILE([
1588 #include <QtCore/QMutex>
1589 ],
1590 [
1591 QMutex M;
1592 M.tryLock(1);
1593 M.unlock();
1594 return 0;
1595 ],
1596 [
1597 AC_MSG_RESULT([yes])
1598 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1599 ],
1600 [
1601 AC_MSG_RESULT([no])
1602 ])
bart21d3cfc2008-08-02 09:08:17 +00001603 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001604 AC_LANG(C)
1605fi
1606
1607
sewardj493c4ef2008-12-13 16:45:19 +00001608# Check whether the boost library 1.35 or later has been installed.
1609# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1610
1611AC_MSG_CHECKING([for boost])
1612
1613AC_LANG(C++)
1614safe_CXXFLAGS=$CXXFLAGS
1615CXXFLAGS="-lboost_thread-mt $mflag_primary"
1616
1617AC_LINK_IFELSE(
1618[
1619#include <boost/thread.hpp>
1620static void thread_func(void)
1621{ }
1622int main(int argc, char** argv)
1623{
1624 boost::thread t(thread_func);
1625 return 0;
1626}
1627],
1628[
1629ac_have_boost_1_35=yes
1630AC_SUBST([BOOST_CFLAGS], [])
1631AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1632AC_MSG_RESULT([yes])
1633], [
1634ac_have_boost_1_35=no
1635AC_MSG_RESULT([no])
1636])
1637
1638CXXFLAGS=$safe_CXXFLAGS
1639AC_LANG(C)
1640
1641AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1642
1643
1644# does this compiler support -fopenmp, does it have the include file
1645# <omp.h> and does it have libgomp ?
1646
1647AC_MSG_CHECKING([for OpenMP])
1648
1649safe_CFLAGS=$CFLAGS
1650CFLAGS="-fopenmp"
1651
1652AC_LINK_IFELSE(
1653[
1654#include <omp.h>
1655int main(int argc, char** argv)
1656{
1657 omp_set_dynamic(0);
1658 return 0;
1659}
1660],
1661[
1662ac_have_openmp=yes
1663AC_MSG_RESULT([yes])
1664], [
1665ac_have_openmp=no
1666AC_MSG_RESULT([no])
1667])
1668CFLAGS=$safe_CFLAGS
1669
1670AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1671
1672
njn7fd6d382009-01-22 21:56:32 +00001673#----------------------------------------------------------------------------
1674# Ok. We're done checking.
1675#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001676
gobrye721a522002-03-22 13:38:30 +00001677AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001678 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001679 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001680 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001681 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001682 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001683 docs/lib/Makefile
1684 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001685 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001686 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001687 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001688 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001689 perf/Makefile
1690 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001691 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001692 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001693 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001694 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001695 memcheck/Makefile
1696 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001697 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001698 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001699 memcheck/tests/linux/Makefile
njna454ec02009-01-19 03:16:59 +00001700 memcheck/tests/x86-linux/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001701 memcheck/docs/Makefile
1702 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001703 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001704 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001705 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001706 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001707 callgrind/Makefile
1708 callgrind/callgrind_annotate
1709 callgrind/callgrind_control
1710 callgrind/tests/Makefile
1711 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001712 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001713 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001714 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001715 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001716 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001717 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001718 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001719 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001720 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001721 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001722 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001723 none/Makefile
1724 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001725 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001726 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001727 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001728 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +00001729 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001730 exp-omega/Makefile
1731 exp-omega/tests/Makefile
1732 exp-omega/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001733 exp-ptrcheck/Makefile
1734 exp-ptrcheck/tests/Makefile
1735 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001736 drd/Makefile
1737 drd/docs/Makefile
1738 drd/scripts/download-and-build-splash2
1739 drd/tests/Makefile
bart0b2b4622008-06-17 19:19:16 +00001740)
gobry3b777892002-04-04 09:18:39 +00001741
1742cat<<EOF
1743
njn7fd6d382009-01-22 21:56:32 +00001744 configure.in: ARCH_MAX = ${ARCH_MAX}
1745 configure.in: VGCONF_ARCH_PRI = ${VGCONF_ARCH_PRI}
sewardje95d94f2008-09-19 09:02:19 +00001746
njn7fd6d382009-01-22 21:56:32 +00001747 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1748 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001749 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001750
gobry3b777892002-04-04 09:18:39 +00001751EOF