blob: 47abcf2ddff8c0ba44f4d8b188410171bf42c667 [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
njn311303f2009-02-06 03:46:50 +0000217# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
218# compilation of many C files via -VGO_$(VGCONF_OS) and
219# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
sewardjde4a1d02002-03-22 01:27:54 +0000220AC_MSG_CHECKING([for a supported OS])
njn7fd6d382009-01-22 21:56:32 +0000221AC_SUBST(VGCONF_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000222
gobrye721a522002-03-22 13:38:30 +0000223case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000224 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000225 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000226 VGCONF_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000227
228 # Ok, this is linux. Check the kernel version
229 AC_MSG_CHECKING([for the kernel version])
230
231 kernel=`uname -r`
232
233 case "${kernel}" in
234 2.6.*)
235 AC_MSG_RESULT([2.6 family (${kernel})])
236 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
237 ;;
238
239 2.4.*)
240 AC_MSG_RESULT([2.4 family (${kernel})])
241 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
242 ;;
243
mueller8c68e042004-01-03 15:21:14 +0000244 *)
245 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000246 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000247 ;;
248 esac
249
250 ;;
251
sewardj03d86f22006-10-17 00:57:24 +0000252 aix5.1.*)
253 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000254 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000255 ;;
256 aix5.2.*)
257 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000258 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000259 ;;
260 aix5.3.*)
261 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000262 VGCONF_OS="aix5"
sewardj03d86f22006-10-17 00:57:24 +0000263 ;;
264
mueller8c68e042004-01-03 15:21:14 +0000265 *freebsd*)
266 AC_MSG_RESULT([ok (${host_os})])
njn7fd6d382009-01-22 21:56:32 +0000267 VGCONF_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000268 ;;
269
270 *)
271 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000272 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000273 ;;
274esac
275
njn7fd6d382009-01-22 21:56:32 +0000276#----------------------------------------------------------------------------
277
tomd6398392006-06-07 17:44:36 +0000278# If we are building on a 64 bit platform test to see if the system
279# supports building 32 bit programs and disable 32 bit support if it
280# does not support building 32 bit programs
281
njn7fd6d382009-01-22 21:56:32 +0000282case "$ARCH_MAX-$VGCONF_OS" in
tomd6398392006-06-07 17:44:36 +0000283 amd64-linux|ppc64-linux)
284 AC_MSG_CHECKING([for 32 bit build support])
285 safe_CFLAGS=$CFLAGS
286 CFLAGS="-m32"
287 AC_TRY_LINK(, [
njn9890ee12009-01-21 22:25:50 +0000288 return 0;
tomd6398392006-06-07 17:44:36 +0000289 ],
290 [
291 AC_MSG_RESULT([yes])
292 ], [
293 vg_cv_only64bit="yes"
294 AC_MSG_RESULT([no])
295 ])
296 CFLAGS=$safe_CFLAGS;;
297esac
298
299if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
300 AC_MSG_ERROR(
301 [--enable-only32bit was specified but system does not support 32 bit builds])
302fi
nethercote888ecb72004-08-23 14:54:40 +0000303
njn7fd6d382009-01-22 21:56:32 +0000304#----------------------------------------------------------------------------
305
njn311303f2009-02-06 03:46:50 +0000306# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
307# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
308# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
309# above) will be "amd64" since that reflects the most that this cpu can do,
310# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
311# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
njn7fd6d382009-01-22 21:56:32 +0000312# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
313# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
314AC_SUBST(VGCONF_ARCH_PRI)
315
njn311303f2009-02-06 03:46:50 +0000316# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
317# The entire system, including regression and performance tests, will be
318# built for this target. The "_CAPS" indicates that the name is in capital
319# letters, and it also uses '_' rather than '-' as a separator, because it's
njn7fd6d382009-01-22 21:56:32 +0000320# used to create various Makefile variables, which are all in caps by
njn311303f2009-02-06 03:46:50 +0000321# convention and cannot contain '-' characters. This is in contrast to
322# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
njn7fd6d382009-01-22 21:56:32 +0000323AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
324
325# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
326# Valgrind and tools will also be built for this target, but not the
327# regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000328#
njn7fd6d382009-01-22 21:56:32 +0000329# By default, the primary arch is the same as the "max" arch, as commented
330# above (at the definition of ARCH_MAX). We may choose to downgrade it in
331# the big case statement just below here, in the case where we're building
332# on a 64 bit machine but have been requested only to do a 32 bit build.
333AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
334
sewardj01262142006-01-04 01:20:28 +0000335AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000336
njn7fd6d382009-01-22 21:56:32 +0000337case "$ARCH_MAX-$VGCONF_OS" in
sewardj01262142006-01-04 01:20:28 +0000338 x86-linux)
njn7fd6d382009-01-22 21:56:32 +0000339 VGCONF_ARCH_PRI="x86"
340 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"
sewardj3e38ce02004-11-23 01:17:29 +0000344 AC_MSG_RESULT([ok (${host_cpu}-${host_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"
349 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
350 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000351 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000352 VGCONF_ARCH_PRI="x86"
353 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
354 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000355 else
njn7fd6d382009-01-22 21:56:32 +0000356 VGCONF_ARCH_PRI="amd64"
357 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
358 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000359 fi
njnd74b0ef2009-01-20 06:06:52 +0000360 valt_load_address_normal="0x38000000"
361 valt_load_address_inner="0x28000000"
sewardj01262142006-01-04 01:20:28 +0000362 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
363 ;;
364 ppc32-linux)
njn7fd6d382009-01-22 21:56:32 +0000365 VGCONF_ARCH_PRI="ppc32"
366 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
367 VGCONF_PLATFORM_SEC_CAPS=""
njnd74b0ef2009-01-20 06:06:52 +0000368 valt_load_address_normal="0x38000000"
369 valt_load_address_inner="0x28000000"
sewardj01262142006-01-04 01:20:28 +0000370 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
371 ;;
sewardj03d86f22006-10-17 00:57:24 +0000372 ppc64-aix5)
373 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000374 VGCONF_ARCH_PRI="ppc64"
375 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
376 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000377 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000378 VGCONF_ARCH_PRI="ppc32"
379 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
380 VGCONF_PLATFORM_SEC_CAPS=""
sewardj03d86f22006-10-17 00:57:24 +0000381 else
njn7fd6d382009-01-22 21:56:32 +0000382 VGCONF_ARCH_PRI="ppc64"
383 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
384 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
sewardj03d86f22006-10-17 00:57:24 +0000385 fi
njnd74b0ef2009-01-20 06:06:52 +0000386 valt_load_address_normal="0x38000000"
387 valt_load_address_inner="0x28000000"
sewardj03d86f22006-10-17 00:57:24 +0000388 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
389 ;;
sewardj01262142006-01-04 01:20:28 +0000390 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000391 if test x$vg_cv_only64bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000392 VGCONF_ARCH_PRI="ppc64"
393 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
394 VGCONF_PLATFORM_SEC_CAPS=""
sewardj86e992f2006-01-28 18:39:09 +0000395 elif test x$vg_cv_only32bit = xyes; then
njn7fd6d382009-01-22 21:56:32 +0000396 VGCONF_ARCH_PRI="ppc32"
397 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
398 VGCONF_PLATFORM_SEC_CAPS=""
399 VGCONF_ARCH_PRI="ppc32"
sewardj86e992f2006-01-28 18:39:09 +0000400 else
njn7fd6d382009-01-22 21:56:32 +0000401 VGCONF_ARCH_PRI="ppc64"
402 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
403 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
sewardj86e992f2006-01-28 18:39:09 +0000404 fi
njnd74b0ef2009-01-20 06:06:52 +0000405 valt_load_address_normal="0x38000000"
406 valt_load_address_inner="0x28000000"
sewardj01262142006-01-04 01:20:28 +0000407 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
408 ;;
nethercote888ecb72004-08-23 14:54:40 +0000409 *)
njn7fd6d382009-01-22 21:56:32 +0000410 VGCONF_ARCH_PRI="unknown"
411 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
412 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
nethercote888ecb72004-08-23 14:54:40 +0000413 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000414 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000415 ;;
416esac
sewardjde4a1d02002-03-22 01:27:54 +0000417
njn7fd6d382009-01-22 21:56:32 +0000418#----------------------------------------------------------------------------
njna454ec02009-01-19 03:16:59 +0000419
njn7fd6d382009-01-22 21:56:32 +0000420# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
421# defined.
422AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
423 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
424 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX )
425AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
426 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX )
427AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
428 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
429 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
430 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
431 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
432AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
433 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
434 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
sewardj03d86f22006-10-17 00:57:24 +0000435
njn7fd6d382009-01-22 21:56:32 +0000436# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
437# become defined.
438AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
439 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
440 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
441AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
442 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
443AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
444 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
445 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
446AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
447 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
448AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
449 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
450 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
451AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
452 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
453
454# Similarly, set up VGCONF_OF_IS_<os>. Exactly one of these becomes defined.
sewardj03d86f22006-10-17 00:57:24 +0000455# Relies on the assumption that the primary and secondary targets are
456# for the same OS, so therefore only necessary to test the primary.
njn7fd6d382009-01-22 21:56:32 +0000457AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
458 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
459 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
460 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
461 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
462AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
463 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
464 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
sewardj03d86f22006-10-17 00:57:24 +0000465
466
njn7fd6d382009-01-22 21:56:32 +0000467# Sometimes, in the Makefile.am files, it's useful to know whether or not
468# there is a secondary target.
469AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC_CAPS,
470 test x$VGCONF_PLATFORM_SEC_CAPS != x)
tomfb7bcde2005-11-07 15:24:38 +0000471
tomb637bad2005-11-08 12:28:35 +0000472
njn7fd6d382009-01-22 21:56:32 +0000473#----------------------------------------------------------------------------
474# Inner Valgrind?
475#----------------------------------------------------------------------------
476
njnd74b0ef2009-01-20 06:06:52 +0000477# Check if this should be built as an inner Valgrind, to be run within
478# another Valgrind. Choose the load address accordingly.
479AC_SUBST(VALT_LOAD_ADDRESS)
480AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
481 [AC_ARG_ENABLE(inner,
482 [ --enable-inner enables self-hosting],
483 [vg_cv_inner=$enableval],
484 [vg_cv_inner=no])])
485if test "$vg_cv_inner" = yes; then
486 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
487 VALT_LOAD_ADDRESS=$valt_load_address_inner
488else
489 VALT_LOAD_ADDRESS=$valt_load_address_normal
490fi
491
492
njn7fd6d382009-01-22 21:56:32 +0000493#----------------------------------------------------------------------------
494# Libc and suppressions
495#----------------------------------------------------------------------------
496# This variable will collect the suppression files to be used.
497DEFAULT_SUPP=""
498AC_SUBST(DEFAULT_SUPP)
sewardj01262142006-01-04 01:20:28 +0000499
dirk07596a22008-04-25 11:33:30 +0000500GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000501
sewardjde4a1d02002-03-22 01:27:54 +0000502AC_EGREP_CPP([GLIBC_22], [
503#include <features.h>
504#ifdef __GNU_LIBRARY__
505 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
506 GLIBC_22
507 #endif
508#endif
509],
dirk07596a22008-04-25 11:33:30 +0000510GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000511
sewardj08c7f012002-10-07 23:56:55 +0000512AC_EGREP_CPP([GLIBC_23], [
513#include <features.h>
514#ifdef __GNU_LIBRARY__
515 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
516 GLIBC_23
517 #endif
518#endif
519],
dirk07596a22008-04-25 11:33:30 +0000520GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000521
njn781dba52005-06-30 04:06:38 +0000522AC_EGREP_CPP([GLIBC_24], [
523#include <features.h>
524#ifdef __GNU_LIBRARY__
525 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
526 GLIBC_24
527 #endif
528#endif
529],
dirk07596a22008-04-25 11:33:30 +0000530GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000531
dirkaece45c2006-10-12 08:17:49 +0000532AC_EGREP_CPP([GLIBC_25], [
533#include <features.h>
534#ifdef __GNU_LIBRARY__
535 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
536 GLIBC_25
537 #endif
538#endif
539],
dirk07596a22008-04-25 11:33:30 +0000540GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000541
dirkc8bd0c52007-05-23 17:39:08 +0000542AC_EGREP_CPP([GLIBC_26], [
543#include <features.h>
544#ifdef __GNU_LIBRARY__
545 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
546 GLIBC_26
547 #endif
548#endif
549],
dirk07596a22008-04-25 11:33:30 +0000550GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000551
sewardj68c80c12007-11-18 14:40:02 +0000552AC_EGREP_CPP([GLIBC_27], [
553#include <features.h>
554#ifdef __GNU_LIBRARY__
555 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
556 GLIBC_27
557 #endif
558#endif
559],
dirk07596a22008-04-25 11:33:30 +0000560GLIBC_VERSION="2.7")
561
562AC_EGREP_CPP([GLIBC_28], [
563#include <features.h>
564#ifdef __GNU_LIBRARY__
565 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
566 GLIBC_28
567 #endif
568#endif
569],
570GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000571
dirkd2e31eb2008-11-19 23:58:36 +0000572AC_EGREP_CPP([GLIBC_29], [
573#include <features.h>
574#ifdef __GNU_LIBRARY__
575 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
576 GLIBC_29
577 #endif
578#endif
579],
580GLIBC_VERSION="2.9")
581
sewardj5d425e82009-02-01 19:01:11 +0000582AC_EGREP_CPP([GLIBC_210], [
583#include <features.h>
584#ifdef __GNU_LIBRARY__
585 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 10)
586 GLIBC_210
587 #endif
588#endif
589],
590GLIBC_VERSION="2.10")
591
sewardj03d86f22006-10-17 00:57:24 +0000592AC_EGREP_CPP([AIX5_LIBC], [
593#include <standards.h>
594#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
595 AIX5_LIBC
596#endif
597],
dirk07596a22008-04-25 11:33:30 +0000598GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000599
dirk07596a22008-04-25 11:33:30 +0000600AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000601
dirk07596a22008-04-25 11:33:30 +0000602case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000603 2.2)
604 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000605 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000606 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
607 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000608 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000609 ;;
610
sewardj08c7f012002-10-07 23:56:55 +0000611 2.3)
612 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000613 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000614 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000615 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000616 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000617 ;;
618
njn781dba52005-06-30 04:06:38 +0000619 2.4)
620 AC_MSG_RESULT(2.4 family)
621 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000622 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000623 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000624 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000625 ;;
626
dirkaece45c2006-10-12 08:17:49 +0000627 2.5)
628 AC_MSG_RESULT(2.5 family)
629 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000630 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000631 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000632 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000633 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000634 2.6)
635 AC_MSG_RESULT(2.6 family)
636 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000637 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000638 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000639 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000640 ;;
641 2.7)
642 AC_MSG_RESULT(2.7 family)
643 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000644 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000645 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000646 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000647 ;;
dirk07596a22008-04-25 11:33:30 +0000648 2.8)
649 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000650 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000651 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
652 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
653 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
654 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000655 2.9)
656 AC_MSG_RESULT(2.9 family)
657 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
658 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
659 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
660 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
661 ;;
sewardj5d425e82009-02-01 19:01:11 +0000662 2.10)
663 AC_MSG_RESULT(2.10 family)
664 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
665 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
666 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
667 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
668 ;;
sewardj03d86f22006-10-17 00:57:24 +0000669 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000670 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
671 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 +0000672 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
673 ;;
dirkaece45c2006-10-12 08:17:49 +0000674
sewardjde4a1d02002-03-22 01:27:54 +0000675 *)
676 AC_MSG_RESULT(unsupported version)
sewardj5d425e82009-02-01 19:01:11 +0000677 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.10])
dirk07596a22008-04-25 11:33:30 +0000678 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
sewardjde4a1d02002-03-22 01:27:54 +0000679 ;;
680esac
681
dirk07596a22008-04-25 11:33:30 +0000682AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000683
sewardj414f3582008-07-18 20:46:00 +0000684
685# Add default suppressions for the X client libraries. Make no
686# attempt to detect whether such libraries are installed on the
687# build machine (or even if any X facilities are present); just
688# add the suppressions antidisirregardless.
689DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
690DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000691
sewardj5744c022008-10-19 18:58:13 +0000692# Add glibc and X11 suppressions for exp-ptrcheck
693DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
694
sewardj2e10a682003-04-07 19:36:41 +0000695
njn7fd6d382009-01-22 21:56:32 +0000696#----------------------------------------------------------------------------
697# Checking for various library functions and other definitions
698#----------------------------------------------------------------------------
699
bart59e2f182008-04-28 16:22:53 +0000700# Check for CLOCK_MONOTONIC
701
702AC_MSG_CHECKING([for CLOCK_MONOTONIC])
703
704AC_TRY_COMPILE(
705[
706#include <time.h>
707], [
708 struct timespec t;
709 clock_gettime(CLOCK_MONOTONIC, &t);
710 return 0;
711],
712[
713AC_MSG_RESULT([yes])
714AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
715 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
716], [
717AC_MSG_RESULT([no])
718])
719
bartfea06922008-05-03 09:12:15 +0000720
721# Check for PTHREAD_MUTEX_ADAPTIVE_NP
722
723AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
724
725AC_TRY_COMPILE(
726[
727#define _GNU_SOURCE
728#include <pthread.h>
729], [
730 return (PTHREAD_MUTEX_ADAPTIVE_NP);
731],
732[
733AC_MSG_RESULT([yes])
734AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
735 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
736], [
737AC_MSG_RESULT([no])
738])
739
740
741# Check for PTHREAD_MUTEX_ERRORCHECK_NP
742
743AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
744
745AC_TRY_COMPILE(
746[
747#define _GNU_SOURCE
748#include <pthread.h>
749], [
750 return (PTHREAD_MUTEX_ERRORCHECK_NP);
751],
752[
753AC_MSG_RESULT([yes])
754AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
755 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
756], [
757AC_MSG_RESULT([no])
758])
759
760
761# Check for PTHREAD_MUTEX_RECURSIVE_NP
762
763AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
764
765AC_TRY_COMPILE(
766[
767#define _GNU_SOURCE
768#include <pthread.h>
769], [
770 return (PTHREAD_MUTEX_RECURSIVE_NP);
771],
772[
773AC_MSG_RESULT([yes])
774AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
775 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
776], [
777AC_MSG_RESULT([no])
778])
779
780
781# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
782
783AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
784
785AC_TRY_COMPILE(
786[
787#define _GNU_SOURCE
788#include <pthread.h>
789], [
790 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
791 return 0;
792],
793[
794AC_MSG_RESULT([yes])
795AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
796 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
797], [
798AC_MSG_RESULT([no])
799])
800
801
barte8900ff2008-10-13 19:22:35 +0000802# Check whether FILE has a member called _lock and whether it's a pointer.
803
804AC_MSG_CHECKING([for FILE::_lock])
805
806AC_TRY_COMPILE(
807[
808 #include <stdio.h>
809], [
810 void *p;
811 p = stdout->_lock;
812 return 0;
813], [
814AC_MSG_RESULT([yes])
815AC_DEFINE([HAVE_LIBC_FILE_LOCK], 1,
816 [Define to 1 if FILE has a member called _lock.])
817], [
818AC_MSG_RESULT([no])
819])
820
821
bart5e389f12008-04-05 12:53:15 +0000822# Check whether pthread_mutex_t has a member called __m_kind.
823
824AC_MSG_CHECKING([for pthread_mutex_t::__m_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.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000832], [
bart5e389f12008-04-05 12:53:15 +0000833AC_MSG_RESULT([yes])
834AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
835 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
836], [
837AC_MSG_RESULT([no])
838])
839
840
841# Check whether pthread_mutex_t has a member called __data.__kind.
842
843AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
844
bart56730cd2008-05-11 06:41:46 +0000845AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000846[
bart56730cd2008-05-11 06:41:46 +0000847#include <pthread.h>
848], [
bart5e389f12008-04-05 12:53:15 +0000849 pthread_mutex_t m;
850 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000851], [
bart5e389f12008-04-05 12:53:15 +0000852AC_MSG_RESULT([yes])
853AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
854 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
855], [
856AC_MSG_RESULT([no])
857])
858
859
bart62c370e2008-05-12 18:50:51 +0000860# does this compiler support -maltivec and does it have the include file
861# <altivec.h> ?
862
863AC_MSG_CHECKING([for Altivec])
864
865safe_CFLAGS=$CFLAGS
866CFLAGS="-maltivec"
867
868AC_TRY_COMPILE(
869[
870#include <altivec.h>
871], [
872 vector unsigned int v;
873],
874[
875ac_have_altivec=yes
876AC_MSG_RESULT([yes])
877], [
878ac_have_altivec=no
879AC_MSG_RESULT([no])
880])
881CFLAGS=$safe_CFLAGS
882
883AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
884AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
885
886
barta50aa8a2008-04-27 06:06:57 +0000887# Check for eventfd_t, eventfd() and eventfd_read()
888AC_MSG_CHECKING([for eventfd()])
889
890AC_TRY_LINK(
891[
892#include <sys/eventfd.h>
893], [
894 eventfd_t ev;
895 int fd;
896
897 fd = eventfd(5, 0);
898 eventfd_read(fd, &ev);
899 return 0;
900],
901[
902AC_MSG_RESULT([yes])
903AC_DEFINE([HAVE_EVENTFD], 1,
904 [Define to 1 if you have the `eventfd' function.])
905AC_DEFINE([HAVE_EVENTFD_READ], 1,
906 [Define to 1 if you have the `eventfd_read' function.])
907], [
908AC_MSG_RESULT([no])
909])
910
911
njn7fd6d382009-01-22 21:56:32 +0000912#----------------------------------------------------------------------------
913# Checking for supported compiler flags.
914#----------------------------------------------------------------------------
915
sewardj535c50f2005-06-04 23:14:53 +0000916# does this compiler support -m32 ?
917AC_MSG_CHECKING([if gcc accepts -m32])
918
919safe_CFLAGS=$CFLAGS
920CFLAGS="-m32"
921
922AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000923 return 0;
sewardj535c50f2005-06-04 23:14:53 +0000924],
925[
926FLAG_M32="-m32"
927AC_MSG_RESULT([yes])
928], [
929FLAG_M32=""
930AC_MSG_RESULT([no])
931])
932CFLAGS=$safe_CFLAGS
933
934AC_SUBST(FLAG_M32)
935
936
sewardj03d86f22006-10-17 00:57:24 +0000937# does this compiler support -maix32 ?
938AC_MSG_CHECKING([if gcc accepts -maix32])
939
940safe_CFLAGS=$CFLAGS
941CFLAGS="-maix32"
942
943AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000944 return 0;
sewardj03d86f22006-10-17 00:57:24 +0000945],
946[
947FLAG_MAIX32="-maix32"
948AC_MSG_RESULT([yes])
949], [
950FLAG_MAIX32=""
951AC_MSG_RESULT([no])
952])
953CFLAGS=$safe_CFLAGS
954
955AC_SUBST(FLAG_MAIX32)
956
957
sewardj01262142006-01-04 01:20:28 +0000958# does this compiler support -m64 ?
959AC_MSG_CHECKING([if gcc accepts -m64])
960
961safe_CFLAGS=$CFLAGS
962CFLAGS="-m64"
963
964AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000965 return 0;
sewardj01262142006-01-04 01:20:28 +0000966],
967[
968FLAG_M64="-m64"
969AC_MSG_RESULT([yes])
970], [
971FLAG_M64=""
972AC_MSG_RESULT([no])
973])
974CFLAGS=$safe_CFLAGS
975
976AC_SUBST(FLAG_M64)
977
978
sewardj03d86f22006-10-17 00:57:24 +0000979# does this compiler support -maix64 ?
980AC_MSG_CHECKING([if gcc accepts -maix64])
981
982safe_CFLAGS=$CFLAGS
983CFLAGS="-maix64"
984
985AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000986 return 0;
sewardj03d86f22006-10-17 00:57:24 +0000987],
988[
989FLAG_MAIX64="-maix64"
990AC_MSG_RESULT([yes])
991], [
992FLAG_MAIX64=""
993AC_MSG_RESULT([no])
994])
995CFLAGS=$safe_CFLAGS
996
997AC_SUBST(FLAG_MAIX64)
998
999
sewardj67f1fcc2005-07-03 10:41:02 +00001000# does this compiler support -mmmx ?
1001AC_MSG_CHECKING([if gcc accepts -mmmx])
1002
1003safe_CFLAGS=$CFLAGS
1004CFLAGS="-mmmx"
1005
1006AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001007 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001008],
1009[
1010FLAG_MMMX="-mmmx"
1011AC_MSG_RESULT([yes])
1012], [
1013FLAG_MMMX=""
1014AC_MSG_RESULT([no])
1015])
1016CFLAGS=$safe_CFLAGS
1017
1018AC_SUBST(FLAG_MMMX)
1019
1020
1021# does this compiler support -msse ?
1022AC_MSG_CHECKING([if gcc accepts -msse])
1023
1024safe_CFLAGS=$CFLAGS
1025CFLAGS="-msse"
1026
1027AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001028 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001029],
1030[
1031FLAG_MSSE="-msse"
1032AC_MSG_RESULT([yes])
1033], [
1034FLAG_MSSE=""
1035AC_MSG_RESULT([no])
1036])
1037CFLAGS=$safe_CFLAGS
1038
1039AC_SUBST(FLAG_MSSE)
1040
1041
sewardj5b754b42002-06-03 22:53:35 +00001042# does this compiler support -mpreferred-stack-boundary=2 ?
1043AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1044
daywalker3664f562003-10-17 13:43:46 +00001045safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001046CFLAGS="-mpreferred-stack-boundary=2"
1047
1048AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001049 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001050],
1051[
1052PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001053AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001054], [
1055PREFERRED_STACK_BOUNDARY=""
1056AC_MSG_RESULT([no])
1057])
daywalker3664f562003-10-17 13:43:46 +00001058CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001059
1060AC_SUBST(PREFERRED_STACK_BOUNDARY)
1061
sewardj535c50f2005-06-04 23:14:53 +00001062
sewardjb5f6f512005-03-10 23:59:00 +00001063# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001064AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001065
1066safe_CFLAGS=$CFLAGS
1067CFLAGS="-Wno-pointer-sign"
1068
1069AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001070 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001071],
1072[
1073no_pointer_sign=yes
1074AC_MSG_RESULT([yes])
1075], [
1076no_pointer_sign=no
1077AC_MSG_RESULT([no])
1078])
1079CFLAGS=$safe_CFLAGS
1080
1081if test x$no_pointer_sign = xyes; then
1082 CFLAGS="$CFLAGS -Wno-pointer-sign"
1083fi
1084
sewardj535c50f2005-06-04 23:14:53 +00001085
tom1e946682005-10-12 11:27:33 +00001086# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001087AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001088
1089safe_CFLAGS=$CFLAGS
1090CFLAGS="-Wdeclaration-after-statement"
1091
1092AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001093 return 0;
tom1e946682005-10-12 11:27:33 +00001094],
1095[
tome9814c32005-10-12 11:30:43 +00001096declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001097FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001098AC_MSG_RESULT([yes])
1099], [
tome9814c32005-10-12 11:30:43 +00001100declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001101FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001102AC_MSG_RESULT([no])
1103])
1104CFLAGS=$safe_CFLAGS
1105
sewardj72a547e2006-01-25 02:58:28 +00001106AC_SUBST(FLAG_WDECL_AFTER_STMT)
1107
tome9814c32005-10-12 11:30:43 +00001108if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001109 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1110fi
1111
sewardj00f1e622006-03-12 16:47:10 +00001112
bart9d865fa2008-06-23 12:11:49 +00001113# does this compiler support -Wno-format-zero-length ?
1114
1115AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1116
1117safe_CFLAGS=$CFLAGS
1118CFLAGS="-Wno-format-zero-length"
1119
1120AC_TRY_COMPILE(
1121[ ],
1122[
1123 return 0;
1124],
1125[
1126AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1127AC_MSG_RESULT([yes])
1128],
1129[
1130AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1131AC_MSG_RESULT([no])
1132])
1133CFLAGS=$safe_CFLAGS
1134
1135
bart56730cd2008-05-11 06:41:46 +00001136# does this compiler support -Wextra or the older -W ?
1137
1138AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1139
1140safe_CFLAGS=$CFLAGS
1141CFLAGS="-Wextra"
1142
1143AC_TRY_COMPILE(
1144[ ],
1145[
1146 return 0;
1147],
1148[
1149AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1150AC_MSG_RESULT([-Wextra])
1151], [
1152 CFLAGS="-W"
1153 AC_TRY_COMPILE(
1154 [ ],
1155 [
1156 return 0;
1157 ],
1158 [
1159 AC_SUBST([FLAG_W_EXTRA], [-W])
1160 AC_MSG_RESULT([-W])
1161 ], [
1162 AC_SUBST([FLAG_W_EXTRA], [])
1163 AC_MSG_RESULT([not supported])
1164 ])
1165])
1166CFLAGS=$safe_CFLAGS
1167
1168
sewardja72c26d2007-05-01 13:44:08 +00001169# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001170AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001171
1172safe_CFLAGS=$CFLAGS
1173CFLAGS="-fno-stack-protector"
1174
1175AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001176 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001177],
1178[
1179no_stack_protector=yes
1180FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1181AC_MSG_RESULT([yes])
1182], [
1183no_stack_protector=no
1184FLAG_FNO_STACK_PROTECTOR=""
1185AC_MSG_RESULT([no])
1186])
1187CFLAGS=$safe_CFLAGS
1188
1189AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1190
1191if test x$no_stack_protector = xyes; then
1192 CFLAGS="$CFLAGS -fno-stack-protector"
1193fi
1194
1195
bart56730cd2008-05-11 06:41:46 +00001196# does this compiler support --param inline-unit-growth=... ?
1197
1198AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1199
1200safe_CFLAGS=$CFLAGS
1201CFLAGS="--param inline-unit-growth=900"
1202
1203AC_TRY_COMPILE(
1204[ ],
1205[
1206 return 0;
1207],
1208[
1209AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1210 ["--param inline-unit-growth=900"])
1211AC_MSG_RESULT([yes])
1212], [
1213AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1214AC_MSG_RESULT([no])
1215])
1216CFLAGS=$safe_CFLAGS
1217
1218
tomd55121e2005-12-19 12:40:13 +00001219# does this compiler support __builtin_expect?
1220AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001221
tomd55121e2005-12-19 12:40:13 +00001222AC_TRY_LINK(, [
1223return __builtin_expect(1, 1) ? 1 : 0
1224],
1225[
1226ac_have_builtin_expect=yes
1227AC_MSG_RESULT([yes])
1228], [
1229ac_have_builtin_expect=no
1230AC_MSG_RESULT([no])
1231])
1232if test x$ac_have_builtin_expect = xyes ; then
1233 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1234fi
1235
tom1e946682005-10-12 11:27:33 +00001236
sewardj00f1e622006-03-12 16:47:10 +00001237# does the ppc assembler support "mtocrf" et al?
1238AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1239
1240AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001241__asm__ __volatile__("mtocrf 4,0");
1242__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001243],
1244[
1245ac_have_as_ppc_mftocrf=yes
1246AC_MSG_RESULT([yes])
1247], [
1248ac_have_as_ppc_mftocrf=no
1249AC_MSG_RESULT([no])
1250])
1251if test x$ac_have_as_ppc_mftocrf = xyes ; then
1252 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1253fi
1254
1255
sewardjf0aabf82007-03-22 00:24:21 +00001256# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001257# Note, this doesn't generate a C-level symbol. It generates a
1258# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001259AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1260
1261AC_TRY_COMPILE(, [
1262 do { long long int x;
1263 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1264 while (0)
1265],
1266[
1267ac_have_as_sse3=yes
1268AC_MSG_RESULT([yes])
1269], [
1270ac_have_as_sse3=no
1271AC_MSG_RESULT([no])
1272])
sewardjfa18a262007-03-22 12:13:13 +00001273
1274AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001275
1276
sewardj6d6da5b2008-02-09 12:07:40 +00001277# Ditto for SSSE3 instructions (note extra S)
1278# Note, this doesn't generate a C-level symbol. It generates a
1279# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1280AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1281
1282AC_TRY_COMPILE(, [
1283 do { long long int x;
1284 __asm__ __volatile__(
1285 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1286 while (0)
1287],
1288[
1289ac_have_as_ssse3=yes
1290AC_MSG_RESULT([yes])
1291], [
1292ac_have_as_ssse3=no
1293AC_MSG_RESULT([no])
1294])
1295
1296AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1297
1298
sewardjb5f6f512005-03-10 23:59:00 +00001299# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001300if test "x${cross_compiling}" = "xno"; then
1301# Native compilation: check whether running a program using TLS succeeds.
1302# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1303# succeeds but running programs using TLS fails.
1304AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1305 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1306 [vg_cv_tls=$enableval],
1307 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1308 [[return foo;]])],
1309 [vg_cv_tls=yes],
1310 [vg_cv_tls=no])])])
1311else
1312# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001313AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1314 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1315 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001316 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001317 [[return foo;]])],
1318 [vg_cv_tls=yes],
1319 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001320fi
sewardjb5f6f512005-03-10 23:59:00 +00001321
1322if test "$vg_cv_tls" = yes; then
1323AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1324fi
sewardj5b754b42002-06-03 22:53:35 +00001325
sewardj535c50f2005-06-04 23:14:53 +00001326
njn7fd6d382009-01-22 21:56:32 +00001327#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001328# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001329#----------------------------------------------------------------------------
1330
sewardjde4a1d02002-03-22 01:27:54 +00001331AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001332AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001333 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001334 endian.h \
1335 mqueue.h \
1336 sys/endian.h \
1337 sys/epoll.h \
1338 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001339 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001340 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001341 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001342 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001343 sys/syscall.h \
1344 sys/time.h \
1345 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001346 ])
sewardjde4a1d02002-03-22 01:27:54 +00001347
njn7fd6d382009-01-22 21:56:32 +00001348#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001349# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001350#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001351AC_TYPE_UID_T
1352AC_TYPE_OFF_T
1353AC_TYPE_SIZE_T
1354AC_HEADER_TIME
1355
sewardj535c50f2005-06-04 23:14:53 +00001356
njn7fd6d382009-01-22 21:56:32 +00001357#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001358# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001359#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001360AC_FUNC_MEMCMP
1361AC_FUNC_MMAP
1362AC_TYPE_SIGNAL
1363
bart71bad292008-04-27 11:43:23 +00001364AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001365
bartf5ceec82008-04-26 07:45:10 +00001366AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001367 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001368 epoll_create \
1369 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001370 floor \
bartce48fa92008-04-26 10:59:46 +00001371 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001372 mallinfo \
1373 memchr \
1374 memset \
1375 mkdir \
1376 ppoll \
bart6d45e922009-01-20 13:45:38 +00001377 pthread_barrier_init \
1378 pthread_condattr_setclock \
1379 pthread_mutex_timedlock \
1380 pthread_rwlock_timedrdlock \
1381 pthread_rwlock_timedwrlock \
1382 pthread_spin_lock \
bartf5ceec82008-04-26 07:45:10 +00001383 semtimedop \
1384 signalfd \
bart71bad292008-04-27 11:43:23 +00001385 syscall \
bartf5ceec82008-04-26 07:45:10 +00001386 strchr \
1387 strdup \
1388 strpbrk \
1389 strrchr \
1390 strstr \
1391 timerfd \
1392 utimensat \
1393 ])
sewardjde4a1d02002-03-22 01:27:54 +00001394
bart623eec32008-07-29 17:54:49 +00001395# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1396# libraries with any shared object and/or executable. This is NOT what we
1397# want for e.g. vgpreload_core-x86-linux.so
1398LIBS=""
sewardj80637752006-03-02 13:48:21 +00001399
bart6d45e922009-01-20 13:45:38 +00001400AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1401 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001402AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1403 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001404AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1405 [test x$ac_cv_func_pthread_spin_lock = xyes])
1406
njn7fd6d382009-01-22 21:56:32 +00001407
1408#----------------------------------------------------------------------------
1409# MPI checks
1410#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001411# Do we have a useable MPI setup on the primary and/or secondary targets?
1412# On Linux, by default, assumes mpicc and -m32/-m64
1413# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001414# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001415# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1416# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001417MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001418if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1419 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001420 MPI_CC="mpxlc"
1421fi
1422
sewardje9fa5062006-03-12 18:29:18 +00001423mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001424if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1425 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001426 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001427elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1428 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001429 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001430elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001431 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001432elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001433 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001434fi
1435
sewardj03d86f22006-10-17 00:57:24 +00001436mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001437if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1438 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001439 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001440elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001441 mflag_secondary=-q32
1442fi
1443
1444
sewardj0ad46092006-03-02 17:09:16 +00001445AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001446 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001447 MPI_CC=$withval
1448)
sewardj03d86f22006-10-17 00:57:24 +00001449AC_SUBST(MPI_CC)
1450
1451## See if MPI_CC works for the primary target
1452##
1453AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001454saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001455saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001456CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001457CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001458AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001459#include <mpi.h>
1460#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001461],[
1462 int r = MPI_Init(NULL,NULL);
1463 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1464 return r;
1465], [
sewardj03d86f22006-10-17 00:57:24 +00001466ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001467AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001468], [
sewardj03d86f22006-10-17 00:57:24 +00001469ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001470AC_MSG_RESULT([no])
1471])
sewardj0ad46092006-03-02 17:09:16 +00001472CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001473CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001474AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001475
sewardj03d86f22006-10-17 00:57:24 +00001476## See if MPI_CC works for the secondary target. Complication: what if
1477## there is no secondary target? We need this to then fail.
1478## Kludge this by making MPI_CC something which will surely fail in
1479## such a case.
1480##
1481AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1482saved_CC=$CC
1483saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001484if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001485 CC="$MPI_CC this will surely fail"
1486else
1487 CC=$MPI_CC
1488fi
1489CFLAGS=$mflag_secondary
1490AC_TRY_LINK([
1491#include <mpi.h>
1492#include <stdio.h>
1493],[
1494 int r = MPI_Init(NULL,NULL);
1495 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1496 return r;
1497], [
1498ac_have_mpi2_sec=yes
1499AC_MSG_RESULT([yes, $MPI_CC])
1500], [
1501ac_have_mpi2_sec=no
1502AC_MSG_RESULT([no])
1503])
1504CC=$saved_CC
1505CFLAGS=$saved_CFLAGS
1506AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001507
1508
njn7fd6d382009-01-22 21:56:32 +00001509#----------------------------------------------------------------------------
1510# Other library checks
1511#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001512# There now follow some tests for QtCore, Boost, and OpenMP. These
1513# tests are present because Drd has some regression tests that use
1514# these packages. All regression test programs all compiled only
1515# for the primary target. And so it is important that the configure
1516# checks that follow, use the correct -m32 or -m64 flag for the
1517# primary target (called $mflag_primary). Otherwise, we can end up
1518# in a situation (eg) where, on amd64-linux, the test for Boost checks
1519# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1520# only build (meaning, the primary target is x86-linux), the build
1521# of the regtest programs that use Boost fails, because they are
1522# build as 32-bit (IN THIS EXAMPLE).
1523#
1524# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1525# NEEDED BY THE REGRESSION TEST PROGRAMS.
1526
1527
bart21d3cfc2008-08-02 09:08:17 +00001528# The test below verifies whether the QtCore package been installed.
1529# This test works as follows:
1530# - If pkg-config was not installed at the time autogen.sh was run,
1531# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1532# autogen.sh. Augogen.sh will generate a configure script that prints
1533# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1534# - If pkg-config was installed at the time autogen.sh was run,
1535# the generated configure script will try to detect the presence of the
1536# Qt4 QtCore library by looking up compile and linker flags in the file
1537# called QtCore.pc.
1538# - pkg-config settings can be overridden via the configure variables
1539# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1540# configure script -- see also ./configure --help).
1541# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1542# the pkg-config executable is not present on the system on which the
1543# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001544
bart21d3cfc2008-08-02 09:08:17 +00001545ifdef(
1546 [PKG_CHECK_EXISTS],
1547 [PKG_CHECK_EXISTS(
1548 [QtCore],
1549 [
1550 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001551 # Paranoia: don't trust the result reported by pkg-config, but when
1552 # pkg-config reports that QtCore has been found, verify whether linking
1553 # programs with QtCore succeeds.
1554 AC_LANG(C++)
1555 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001556 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001557 AC_TRY_LINK(
1558 [#include <QMutex>],
1559 [QMutex Mutex;],
1560 [ac_have_qtcore=yes],
1561 [
1562 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1563 ac_have_qtcore=no
1564 ]
1565 )
1566 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001567 ],
1568 [
1569 ac_have_qtcore=no
1570 ]
1571 )
1572 ],
1573 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1574 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1575 [ac_have_qtcore=no]
1576)
bart41ac62a2008-07-07 16:58:03 +00001577
1578AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1579
1580
bart62f54e42008-07-28 11:35:10 +00001581# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1582# See also http://doc.trolltech.com/4.3/qmutex.html.
1583if test x$ac_have_qtcore = xyes; then
1584 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1585 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001586 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001587 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001588 AC_TRY_COMPILE([
1589 #include <QtCore/QMutex>
1590 ],
1591 [
1592 QMutex M;
1593 M.tryLock(1);
1594 M.unlock();
1595 return 0;
1596 ],
1597 [
1598 AC_MSG_RESULT([yes])
1599 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1600 ],
1601 [
1602 AC_MSG_RESULT([no])
1603 ])
bart21d3cfc2008-08-02 09:08:17 +00001604 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001605 AC_LANG(C)
1606fi
1607
1608
sewardj493c4ef2008-12-13 16:45:19 +00001609# Check whether the boost library 1.35 or later has been installed.
1610# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1611
1612AC_MSG_CHECKING([for boost])
1613
1614AC_LANG(C++)
1615safe_CXXFLAGS=$CXXFLAGS
1616CXXFLAGS="-lboost_thread-mt $mflag_primary"
1617
1618AC_LINK_IFELSE(
1619[
1620#include <boost/thread.hpp>
1621static void thread_func(void)
1622{ }
1623int main(int argc, char** argv)
1624{
1625 boost::thread t(thread_func);
1626 return 0;
1627}
1628],
1629[
1630ac_have_boost_1_35=yes
1631AC_SUBST([BOOST_CFLAGS], [])
1632AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1633AC_MSG_RESULT([yes])
1634], [
1635ac_have_boost_1_35=no
1636AC_MSG_RESULT([no])
1637])
1638
1639CXXFLAGS=$safe_CXXFLAGS
1640AC_LANG(C)
1641
1642AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1643
1644
1645# does this compiler support -fopenmp, does it have the include file
1646# <omp.h> and does it have libgomp ?
1647
1648AC_MSG_CHECKING([for OpenMP])
1649
1650safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001651CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001652
1653AC_LINK_IFELSE(
1654[
1655#include <omp.h>
1656int main(int argc, char** argv)
1657{
1658 omp_set_dynamic(0);
1659 return 0;
1660}
1661],
1662[
1663ac_have_openmp=yes
1664AC_MSG_RESULT([yes])
1665], [
1666ac_have_openmp=no
1667AC_MSG_RESULT([no])
1668])
1669CFLAGS=$safe_CFLAGS
1670
1671AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1672
1673
sewardjc876a2f2009-01-22 22:44:30 +00001674# does this compiler have built-in functions for atomic memory access ?
1675AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1676
1677safe_CFLAGS=$CFLAGS
1678CFLAGS="$mflag_primary"
1679
1680AC_TRY_LINK(,
1681[
1682 int variable = 1;
1683 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1684 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1685],
1686[
1687 AC_MSG_RESULT([yes])
1688 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1689],
1690[
1691 AC_MSG_RESULT([no])
1692])
1693
1694CFLAGS=$safe_CFLAGS
1695
1696
njn7fd6d382009-01-22 21:56:32 +00001697#----------------------------------------------------------------------------
1698# Ok. We're done checking.
1699#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001700
gobrye721a522002-03-22 13:38:30 +00001701AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001702 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001703 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001704 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001705 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001706 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001707 docs/lib/Makefile
1708 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001709 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001710 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001711 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001712 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001713 perf/Makefile
1714 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001715 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001716 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001717 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001718 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001719 memcheck/Makefile
1720 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001721 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001722 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001723 memcheck/tests/linux/Makefile
njna454ec02009-01-19 03:16:59 +00001724 memcheck/tests/x86-linux/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001725 memcheck/docs/Makefile
1726 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001727 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001728 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001729 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001730 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001731 callgrind/Makefile
1732 callgrind/callgrind_annotate
1733 callgrind/callgrind_control
1734 callgrind/tests/Makefile
1735 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001736 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001737 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001738 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001739 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001740 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001741 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001742 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001743 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001744 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001745 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001746 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001747 none/Makefile
1748 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001749 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001750 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001751 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001752 none/tests/x86/Makefile
njn0458a122009-02-13 06:23:46 +00001753 none/tests/linux/Makefile
njn9bc8c002002-10-02 13:49:13 +00001754 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001755 exp-omega/Makefile
1756 exp-omega/tests/Makefile
1757 exp-omega/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001758 exp-ptrcheck/Makefile
1759 exp-ptrcheck/tests/Makefile
1760 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001761 drd/Makefile
1762 drd/docs/Makefile
1763 drd/scripts/download-and-build-splash2
1764 drd/tests/Makefile
bart0b2b4622008-06-17 19:19:16 +00001765)
gobry3b777892002-04-04 09:18:39 +00001766
1767cat<<EOF
1768
njn311303f2009-02-06 03:46:50 +00001769 Maximum build arch: ${ARCH_MAX}
1770 Primary build arch: ${VGCONF_ARCH_PRI}
1771 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001772 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1773 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001774 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001775
gobry3b777892002-04-04 09:18:39 +00001776EOF