blob: 63fa8e4d08cff8e6fe3b7252ce22989a72c0b69a [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
bart5e389f12008-04-05 12:53:15 +0000802# Check whether pthread_mutex_t has a member called __m_kind.
803
804AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
805
bart56730cd2008-05-11 06:41:46 +0000806AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000807[
bart56730cd2008-05-11 06:41:46 +0000808 #include <pthread.h>
809], [
bart5e389f12008-04-05 12:53:15 +0000810 pthread_mutex_t m;
811 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000812], [
bart5e389f12008-04-05 12:53:15 +0000813AC_MSG_RESULT([yes])
814AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
815 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
816], [
817AC_MSG_RESULT([no])
818])
819
820
821# Check whether pthread_mutex_t has a member called __data.__kind.
822
823AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
824
bart56730cd2008-05-11 06:41:46 +0000825AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000826[
bart56730cd2008-05-11 06:41:46 +0000827#include <pthread.h>
828], [
bart5e389f12008-04-05 12:53:15 +0000829 pthread_mutex_t m;
830 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000831], [
bart5e389f12008-04-05 12:53:15 +0000832AC_MSG_RESULT([yes])
833AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
834 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
835], [
836AC_MSG_RESULT([no])
837])
838
839
bart62c370e2008-05-12 18:50:51 +0000840# does this compiler support -maltivec and does it have the include file
841# <altivec.h> ?
842
843AC_MSG_CHECKING([for Altivec])
844
845safe_CFLAGS=$CFLAGS
846CFLAGS="-maltivec"
847
848AC_TRY_COMPILE(
849[
850#include <altivec.h>
851], [
852 vector unsigned int v;
853],
854[
855ac_have_altivec=yes
856AC_MSG_RESULT([yes])
857], [
858ac_have_altivec=no
859AC_MSG_RESULT([no])
860])
861CFLAGS=$safe_CFLAGS
862
863AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
864AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
865
866
barta50aa8a2008-04-27 06:06:57 +0000867# Check for eventfd_t, eventfd() and eventfd_read()
868AC_MSG_CHECKING([for eventfd()])
869
870AC_TRY_LINK(
871[
872#include <sys/eventfd.h>
873], [
874 eventfd_t ev;
875 int fd;
876
877 fd = eventfd(5, 0);
878 eventfd_read(fd, &ev);
879 return 0;
880],
881[
882AC_MSG_RESULT([yes])
883AC_DEFINE([HAVE_EVENTFD], 1,
884 [Define to 1 if you have the `eventfd' function.])
885AC_DEFINE([HAVE_EVENTFD_READ], 1,
886 [Define to 1 if you have the `eventfd_read' function.])
887], [
888AC_MSG_RESULT([no])
889])
890
891
njn7fd6d382009-01-22 21:56:32 +0000892#----------------------------------------------------------------------------
893# Checking for supported compiler flags.
894#----------------------------------------------------------------------------
895
sewardj535c50f2005-06-04 23:14:53 +0000896# does this compiler support -m32 ?
897AC_MSG_CHECKING([if gcc accepts -m32])
898
899safe_CFLAGS=$CFLAGS
900CFLAGS="-m32"
901
902AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000903 return 0;
sewardj535c50f2005-06-04 23:14:53 +0000904],
905[
906FLAG_M32="-m32"
907AC_MSG_RESULT([yes])
908], [
909FLAG_M32=""
910AC_MSG_RESULT([no])
911])
912CFLAGS=$safe_CFLAGS
913
914AC_SUBST(FLAG_M32)
915
916
sewardj03d86f22006-10-17 00:57:24 +0000917# does this compiler support -maix32 ?
918AC_MSG_CHECKING([if gcc accepts -maix32])
919
920safe_CFLAGS=$CFLAGS
921CFLAGS="-maix32"
922
923AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000924 return 0;
sewardj03d86f22006-10-17 00:57:24 +0000925],
926[
927FLAG_MAIX32="-maix32"
928AC_MSG_RESULT([yes])
929], [
930FLAG_MAIX32=""
931AC_MSG_RESULT([no])
932])
933CFLAGS=$safe_CFLAGS
934
935AC_SUBST(FLAG_MAIX32)
936
937
sewardj01262142006-01-04 01:20:28 +0000938# does this compiler support -m64 ?
939AC_MSG_CHECKING([if gcc accepts -m64])
940
941safe_CFLAGS=$CFLAGS
942CFLAGS="-m64"
943
944AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000945 return 0;
sewardj01262142006-01-04 01:20:28 +0000946],
947[
948FLAG_M64="-m64"
949AC_MSG_RESULT([yes])
950], [
951FLAG_M64=""
952AC_MSG_RESULT([no])
953])
954CFLAGS=$safe_CFLAGS
955
956AC_SUBST(FLAG_M64)
957
958
sewardj03d86f22006-10-17 00:57:24 +0000959# does this compiler support -maix64 ?
960AC_MSG_CHECKING([if gcc accepts -maix64])
961
962safe_CFLAGS=$CFLAGS
963CFLAGS="-maix64"
964
965AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000966 return 0;
sewardj03d86f22006-10-17 00:57:24 +0000967],
968[
969FLAG_MAIX64="-maix64"
970AC_MSG_RESULT([yes])
971], [
972FLAG_MAIX64=""
973AC_MSG_RESULT([no])
974])
975CFLAGS=$safe_CFLAGS
976
977AC_SUBST(FLAG_MAIX64)
978
979
sewardj67f1fcc2005-07-03 10:41:02 +0000980# does this compiler support -mmmx ?
981AC_MSG_CHECKING([if gcc accepts -mmmx])
982
983safe_CFLAGS=$CFLAGS
984CFLAGS="-mmmx"
985
986AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +0000987 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +0000988],
989[
990FLAG_MMMX="-mmmx"
991AC_MSG_RESULT([yes])
992], [
993FLAG_MMMX=""
994AC_MSG_RESULT([no])
995])
996CFLAGS=$safe_CFLAGS
997
998AC_SUBST(FLAG_MMMX)
999
1000
1001# does this compiler support -msse ?
1002AC_MSG_CHECKING([if gcc accepts -msse])
1003
1004safe_CFLAGS=$CFLAGS
1005CFLAGS="-msse"
1006
1007AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001008 return 0;
sewardj67f1fcc2005-07-03 10:41:02 +00001009],
1010[
1011FLAG_MSSE="-msse"
1012AC_MSG_RESULT([yes])
1013], [
1014FLAG_MSSE=""
1015AC_MSG_RESULT([no])
1016])
1017CFLAGS=$safe_CFLAGS
1018
1019AC_SUBST(FLAG_MSSE)
1020
1021
sewardj5b754b42002-06-03 22:53:35 +00001022# does this compiler support -mpreferred-stack-boundary=2 ?
1023AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1024
daywalker3664f562003-10-17 13:43:46 +00001025safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001026CFLAGS="-mpreferred-stack-boundary=2"
1027
1028AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001029 return 0;
sewardj5b754b42002-06-03 22:53:35 +00001030],
1031[
1032PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +00001033AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +00001034], [
1035PREFERRED_STACK_BOUNDARY=""
1036AC_MSG_RESULT([no])
1037])
daywalker3664f562003-10-17 13:43:46 +00001038CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001039
1040AC_SUBST(PREFERRED_STACK_BOUNDARY)
1041
sewardj535c50f2005-06-04 23:14:53 +00001042
sewardjb5f6f512005-03-10 23:59:00 +00001043# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001044AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001045
1046safe_CFLAGS=$CFLAGS
1047CFLAGS="-Wno-pointer-sign"
1048
1049AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001050 return 0;
sewardjb5f6f512005-03-10 23:59:00 +00001051],
1052[
1053no_pointer_sign=yes
1054AC_MSG_RESULT([yes])
1055], [
1056no_pointer_sign=no
1057AC_MSG_RESULT([no])
1058])
1059CFLAGS=$safe_CFLAGS
1060
1061if test x$no_pointer_sign = xyes; then
1062 CFLAGS="$CFLAGS -Wno-pointer-sign"
1063fi
1064
sewardj535c50f2005-06-04 23:14:53 +00001065
tom1e946682005-10-12 11:27:33 +00001066# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001067AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001068
1069safe_CFLAGS=$CFLAGS
1070CFLAGS="-Wdeclaration-after-statement"
1071
1072AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001073 return 0;
tom1e946682005-10-12 11:27:33 +00001074],
1075[
tome9814c32005-10-12 11:30:43 +00001076declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001077FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001078AC_MSG_RESULT([yes])
1079], [
tome9814c32005-10-12 11:30:43 +00001080declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001081FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001082AC_MSG_RESULT([no])
1083])
1084CFLAGS=$safe_CFLAGS
1085
sewardj72a547e2006-01-25 02:58:28 +00001086AC_SUBST(FLAG_WDECL_AFTER_STMT)
1087
tome9814c32005-10-12 11:30:43 +00001088if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001089 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1090fi
1091
sewardj00f1e622006-03-12 16:47:10 +00001092
bart9d865fa2008-06-23 12:11:49 +00001093# does this compiler support -Wno-format-zero-length ?
1094
1095AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1096
1097safe_CFLAGS=$CFLAGS
1098CFLAGS="-Wno-format-zero-length"
1099
1100AC_TRY_COMPILE(
1101[ ],
1102[
1103 return 0;
1104],
1105[
1106AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1107AC_MSG_RESULT([yes])
1108],
1109[
1110AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1111AC_MSG_RESULT([no])
1112])
1113CFLAGS=$safe_CFLAGS
1114
1115
bart56730cd2008-05-11 06:41:46 +00001116# does this compiler support -Wextra or the older -W ?
1117
1118AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1119
1120safe_CFLAGS=$CFLAGS
1121CFLAGS="-Wextra"
1122
1123AC_TRY_COMPILE(
1124[ ],
1125[
1126 return 0;
1127],
1128[
1129AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1130AC_MSG_RESULT([-Wextra])
1131], [
1132 CFLAGS="-W"
1133 AC_TRY_COMPILE(
1134 [ ],
1135 [
1136 return 0;
1137 ],
1138 [
1139 AC_SUBST([FLAG_W_EXTRA], [-W])
1140 AC_MSG_RESULT([-W])
1141 ], [
1142 AC_SUBST([FLAG_W_EXTRA], [])
1143 AC_MSG_RESULT([not supported])
1144 ])
1145])
1146CFLAGS=$safe_CFLAGS
1147
1148
sewardja72c26d2007-05-01 13:44:08 +00001149# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001150AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001151
1152safe_CFLAGS=$CFLAGS
1153CFLAGS="-fno-stack-protector"
1154
1155AC_TRY_COMPILE(, [
njn9890ee12009-01-21 22:25:50 +00001156 return 0;
sewardja72c26d2007-05-01 13:44:08 +00001157],
1158[
1159no_stack_protector=yes
1160FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1161AC_MSG_RESULT([yes])
1162], [
1163no_stack_protector=no
1164FLAG_FNO_STACK_PROTECTOR=""
1165AC_MSG_RESULT([no])
1166])
1167CFLAGS=$safe_CFLAGS
1168
1169AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1170
1171if test x$no_stack_protector = xyes; then
1172 CFLAGS="$CFLAGS -fno-stack-protector"
1173fi
1174
1175
bart56730cd2008-05-11 06:41:46 +00001176# does this compiler support --param inline-unit-growth=... ?
1177
1178AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1179
1180safe_CFLAGS=$CFLAGS
1181CFLAGS="--param inline-unit-growth=900"
1182
1183AC_TRY_COMPILE(
1184[ ],
1185[
1186 return 0;
1187],
1188[
1189AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1190 ["--param inline-unit-growth=900"])
1191AC_MSG_RESULT([yes])
1192], [
1193AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1194AC_MSG_RESULT([no])
1195])
1196CFLAGS=$safe_CFLAGS
1197
1198
tomd55121e2005-12-19 12:40:13 +00001199# does this compiler support __builtin_expect?
1200AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001201
tomd55121e2005-12-19 12:40:13 +00001202AC_TRY_LINK(, [
1203return __builtin_expect(1, 1) ? 1 : 0
1204],
1205[
1206ac_have_builtin_expect=yes
1207AC_MSG_RESULT([yes])
1208], [
1209ac_have_builtin_expect=no
1210AC_MSG_RESULT([no])
1211])
1212if test x$ac_have_builtin_expect = xyes ; then
1213 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1214fi
1215
tom1e946682005-10-12 11:27:33 +00001216
sewardj00f1e622006-03-12 16:47:10 +00001217# does the ppc assembler support "mtocrf" et al?
1218AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1219
1220AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001221__asm__ __volatile__("mtocrf 4,0");
1222__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001223],
1224[
1225ac_have_as_ppc_mftocrf=yes
1226AC_MSG_RESULT([yes])
1227], [
1228ac_have_as_ppc_mftocrf=no
1229AC_MSG_RESULT([no])
1230])
1231if test x$ac_have_as_ppc_mftocrf = xyes ; then
1232 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1233fi
1234
1235
sewardjf0aabf82007-03-22 00:24:21 +00001236# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001237# Note, this doesn't generate a C-level symbol. It generates a
1238# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001239AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1240
1241AC_TRY_COMPILE(, [
1242 do { long long int x;
1243 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1244 while (0)
1245],
1246[
1247ac_have_as_sse3=yes
1248AC_MSG_RESULT([yes])
1249], [
1250ac_have_as_sse3=no
1251AC_MSG_RESULT([no])
1252])
sewardjfa18a262007-03-22 12:13:13 +00001253
1254AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001255
1256
sewardj6d6da5b2008-02-09 12:07:40 +00001257# Ditto for SSSE3 instructions (note extra S)
1258# Note, this doesn't generate a C-level symbol. It generates a
1259# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1260AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1261
1262AC_TRY_COMPILE(, [
1263 do { long long int x;
1264 __asm__ __volatile__(
1265 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1266 while (0)
1267],
1268[
1269ac_have_as_ssse3=yes
1270AC_MSG_RESULT([yes])
1271], [
1272ac_have_as_ssse3=no
1273AC_MSG_RESULT([no])
1274])
1275
1276AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1277
1278
sewardjb5f6f512005-03-10 23:59:00 +00001279# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001280if test "x${cross_compiling}" = "xno"; then
1281# Native compilation: check whether running a program using TLS succeeds.
1282# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1283# succeeds but running programs using TLS fails.
1284AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1285 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1286 [vg_cv_tls=$enableval],
1287 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1288 [[return foo;]])],
1289 [vg_cv_tls=yes],
1290 [vg_cv_tls=no])])])
1291else
1292# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001293AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1294 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1295 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001296 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001297 [[return foo;]])],
1298 [vg_cv_tls=yes],
1299 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001300fi
sewardjb5f6f512005-03-10 23:59:00 +00001301
1302if test "$vg_cv_tls" = yes; then
1303AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1304fi
sewardj5b754b42002-06-03 22:53:35 +00001305
sewardj535c50f2005-06-04 23:14:53 +00001306
njn7fd6d382009-01-22 21:56:32 +00001307#----------------------------------------------------------------------------
bart62f54e42008-07-28 11:35:10 +00001308# Checks for C header files.
njn7fd6d382009-01-22 21:56:32 +00001309#----------------------------------------------------------------------------
1310
sewardjde4a1d02002-03-22 01:27:54 +00001311AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001312AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001313 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001314 endian.h \
1315 mqueue.h \
1316 sys/endian.h \
1317 sys/epoll.h \
1318 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001319 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001320 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001321 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001322 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001323 sys/syscall.h \
1324 sys/time.h \
1325 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001326 ])
sewardjde4a1d02002-03-22 01:27:54 +00001327
njn7fd6d382009-01-22 21:56:32 +00001328#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001329# Checks for typedefs, structures, and compiler characteristics.
njn7fd6d382009-01-22 21:56:32 +00001330#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001331AC_TYPE_UID_T
1332AC_TYPE_OFF_T
1333AC_TYPE_SIZE_T
1334AC_HEADER_TIME
1335
sewardj535c50f2005-06-04 23:14:53 +00001336
njn7fd6d382009-01-22 21:56:32 +00001337#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001338# Checks for library functions.
njn7fd6d382009-01-22 21:56:32 +00001339#----------------------------------------------------------------------------
sewardjde4a1d02002-03-22 01:27:54 +00001340AC_FUNC_MEMCMP
1341AC_FUNC_MMAP
1342AC_TYPE_SIGNAL
1343
bart71bad292008-04-27 11:43:23 +00001344AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001345
bartf5ceec82008-04-26 07:45:10 +00001346AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001347 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001348 epoll_create \
1349 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001350 floor \
bartce48fa92008-04-26 10:59:46 +00001351 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001352 mallinfo \
1353 memchr \
1354 memset \
1355 mkdir \
1356 ppoll \
bart6d45e922009-01-20 13:45:38 +00001357 pthread_barrier_init \
1358 pthread_condattr_setclock \
1359 pthread_mutex_timedlock \
1360 pthread_rwlock_timedrdlock \
1361 pthread_rwlock_timedwrlock \
1362 pthread_spin_lock \
bartf5ceec82008-04-26 07:45:10 +00001363 semtimedop \
1364 signalfd \
bart71bad292008-04-27 11:43:23 +00001365 syscall \
bartf5ceec82008-04-26 07:45:10 +00001366 strchr \
1367 strdup \
1368 strpbrk \
1369 strrchr \
1370 strstr \
1371 timerfd \
1372 utimensat \
1373 ])
sewardjde4a1d02002-03-22 01:27:54 +00001374
bart623eec32008-07-29 17:54:49 +00001375# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1376# libraries with any shared object and/or executable. This is NOT what we
1377# want for e.g. vgpreload_core-x86-linux.so
1378LIBS=""
sewardj80637752006-03-02 13:48:21 +00001379
bart6d45e922009-01-20 13:45:38 +00001380AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1381 [test x$ac_cv_func_pthread_barrier_init = xyes])
bart2eaa8f22009-01-20 14:01:16 +00001382AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1383 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
bart6d45e922009-01-20 13:45:38 +00001384AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1385 [test x$ac_cv_func_pthread_spin_lock = xyes])
1386
njn7fd6d382009-01-22 21:56:32 +00001387
1388#----------------------------------------------------------------------------
1389# MPI checks
1390#----------------------------------------------------------------------------
sewardj03d86f22006-10-17 00:57:24 +00001391# Do we have a useable MPI setup on the primary and/or secondary targets?
1392# On Linux, by default, assumes mpicc and -m32/-m64
1393# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001394# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001395# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1396# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001397MPI_CC="mpicc"
njn7fd6d382009-01-22 21:56:32 +00001398if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1399 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001400 MPI_CC="mpxlc"
1401fi
1402
sewardje9fa5062006-03-12 18:29:18 +00001403mflag_primary=
njn7fd6d382009-01-22 21:56:32 +00001404if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1405 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001406 mflag_primary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001407elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1408 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
sewardje9fa5062006-03-12 18:29:18 +00001409 mflag_primary=$FLAG_M64
njn7fd6d382009-01-22 21:56:32 +00001410elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001411 mflag_primary=-q32
njn7fd6d382009-01-22 21:56:32 +00001412elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001413 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001414fi
1415
sewardj03d86f22006-10-17 00:57:24 +00001416mflag_secondary=
njn7fd6d382009-01-22 21:56:32 +00001417if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1418 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
sewardj03d86f22006-10-17 00:57:24 +00001419 mflag_secondary=$FLAG_M32
njn7fd6d382009-01-22 21:56:32 +00001420elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
sewardj03d86f22006-10-17 00:57:24 +00001421 mflag_secondary=-q32
1422fi
1423
1424
sewardj0ad46092006-03-02 17:09:16 +00001425AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001426 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001427 MPI_CC=$withval
1428)
sewardj03d86f22006-10-17 00:57:24 +00001429AC_SUBST(MPI_CC)
1430
1431## See if MPI_CC works for the primary target
1432##
1433AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001434saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001435saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001436CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001437CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001438AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001439#include <mpi.h>
1440#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001441],[
1442 int r = MPI_Init(NULL,NULL);
1443 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1444 return r;
1445], [
sewardj03d86f22006-10-17 00:57:24 +00001446ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001447AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001448], [
sewardj03d86f22006-10-17 00:57:24 +00001449ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001450AC_MSG_RESULT([no])
1451])
sewardj0ad46092006-03-02 17:09:16 +00001452CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001453CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001454AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001455
sewardj03d86f22006-10-17 00:57:24 +00001456## See if MPI_CC works for the secondary target. Complication: what if
1457## there is no secondary target? We need this to then fail.
1458## Kludge this by making MPI_CC something which will surely fail in
1459## such a case.
1460##
1461AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1462saved_CC=$CC
1463saved_CFLAGS=$CFLAGS
njn7fd6d382009-01-22 21:56:32 +00001464if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
sewardj03d86f22006-10-17 00:57:24 +00001465 CC="$MPI_CC this will surely fail"
1466else
1467 CC=$MPI_CC
1468fi
1469CFLAGS=$mflag_secondary
1470AC_TRY_LINK([
1471#include <mpi.h>
1472#include <stdio.h>
1473],[
1474 int r = MPI_Init(NULL,NULL);
1475 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1476 return r;
1477], [
1478ac_have_mpi2_sec=yes
1479AC_MSG_RESULT([yes, $MPI_CC])
1480], [
1481ac_have_mpi2_sec=no
1482AC_MSG_RESULT([no])
1483])
1484CC=$saved_CC
1485CFLAGS=$saved_CFLAGS
1486AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001487
1488
njn7fd6d382009-01-22 21:56:32 +00001489#----------------------------------------------------------------------------
1490# Other library checks
1491#----------------------------------------------------------------------------
sewardj493c4ef2008-12-13 16:45:19 +00001492# There now follow some tests for QtCore, Boost, and OpenMP. These
1493# tests are present because Drd has some regression tests that use
1494# these packages. All regression test programs all compiled only
1495# for the primary target. And so it is important that the configure
1496# checks that follow, use the correct -m32 or -m64 flag for the
1497# primary target (called $mflag_primary). Otherwise, we can end up
1498# in a situation (eg) where, on amd64-linux, the test for Boost checks
1499# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1500# only build (meaning, the primary target is x86-linux), the build
1501# of the regtest programs that use Boost fails, because they are
1502# build as 32-bit (IN THIS EXAMPLE).
1503#
1504# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1505# NEEDED BY THE REGRESSION TEST PROGRAMS.
1506
1507
bart21d3cfc2008-08-02 09:08:17 +00001508# The test below verifies whether the QtCore package been installed.
1509# This test works as follows:
1510# - If pkg-config was not installed at the time autogen.sh was run,
1511# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1512# autogen.sh. Augogen.sh will generate a configure script that prints
1513# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1514# - If pkg-config was installed at the time autogen.sh was run,
1515# the generated configure script will try to detect the presence of the
1516# Qt4 QtCore library by looking up compile and linker flags in the file
1517# called QtCore.pc.
1518# - pkg-config settings can be overridden via the configure variables
1519# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1520# configure script -- see also ./configure --help).
1521# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1522# the pkg-config executable is not present on the system on which the
1523# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001524
bart21d3cfc2008-08-02 09:08:17 +00001525ifdef(
1526 [PKG_CHECK_EXISTS],
1527 [PKG_CHECK_EXISTS(
1528 [QtCore],
1529 [
1530 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001531 # Paranoia: don't trust the result reported by pkg-config, but when
1532 # pkg-config reports that QtCore has been found, verify whether linking
1533 # programs with QtCore succeeds.
1534 AC_LANG(C++)
1535 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001536 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001537 AC_TRY_LINK(
1538 [#include <QMutex>],
1539 [QMutex Mutex;],
1540 [ac_have_qtcore=yes],
1541 [
1542 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1543 ac_have_qtcore=no
1544 ]
1545 )
1546 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001547 ],
1548 [
1549 ac_have_qtcore=no
1550 ]
1551 )
1552 ],
1553 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1554 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1555 [ac_have_qtcore=no]
1556)
bart41ac62a2008-07-07 16:58:03 +00001557
1558AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1559
1560
bart62f54e42008-07-28 11:35:10 +00001561# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1562# See also http://doc.trolltech.com/4.3/qmutex.html.
1563if test x$ac_have_qtcore = xyes; then
1564 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1565 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001566 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001567 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001568 AC_TRY_COMPILE([
1569 #include <QtCore/QMutex>
1570 ],
1571 [
1572 QMutex M;
1573 M.tryLock(1);
1574 M.unlock();
1575 return 0;
1576 ],
1577 [
1578 AC_MSG_RESULT([yes])
1579 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1580 ],
1581 [
1582 AC_MSG_RESULT([no])
1583 ])
bart21d3cfc2008-08-02 09:08:17 +00001584 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001585 AC_LANG(C)
1586fi
1587
1588
sewardj493c4ef2008-12-13 16:45:19 +00001589# Check whether the boost library 1.35 or later has been installed.
1590# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1591
1592AC_MSG_CHECKING([for boost])
1593
1594AC_LANG(C++)
1595safe_CXXFLAGS=$CXXFLAGS
1596CXXFLAGS="-lboost_thread-mt $mflag_primary"
1597
1598AC_LINK_IFELSE(
1599[
1600#include <boost/thread.hpp>
1601static void thread_func(void)
1602{ }
1603int main(int argc, char** argv)
1604{
1605 boost::thread t(thread_func);
1606 return 0;
1607}
1608],
1609[
1610ac_have_boost_1_35=yes
1611AC_SUBST([BOOST_CFLAGS], [])
1612AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1613AC_MSG_RESULT([yes])
1614], [
1615ac_have_boost_1_35=no
1616AC_MSG_RESULT([no])
1617])
1618
1619CXXFLAGS=$safe_CXXFLAGS
1620AC_LANG(C)
1621
1622AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1623
1624
1625# does this compiler support -fopenmp, does it have the include file
1626# <omp.h> and does it have libgomp ?
1627
1628AC_MSG_CHECKING([for OpenMP])
1629
1630safe_CFLAGS=$CFLAGS
sewardjc876a2f2009-01-22 22:44:30 +00001631CFLAGS="-fopenmp $mflag_primary"
sewardj493c4ef2008-12-13 16:45:19 +00001632
1633AC_LINK_IFELSE(
1634[
1635#include <omp.h>
1636int main(int argc, char** argv)
1637{
1638 omp_set_dynamic(0);
1639 return 0;
1640}
1641],
1642[
1643ac_have_openmp=yes
1644AC_MSG_RESULT([yes])
1645], [
1646ac_have_openmp=no
1647AC_MSG_RESULT([no])
1648])
1649CFLAGS=$safe_CFLAGS
1650
1651AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1652
1653
sewardjc876a2f2009-01-22 22:44:30 +00001654# does this compiler have built-in functions for atomic memory access ?
1655AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1656
1657safe_CFLAGS=$CFLAGS
1658CFLAGS="$mflag_primary"
1659
1660AC_TRY_LINK(,
1661[
1662 int variable = 1;
1663 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1664 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1665],
1666[
1667 AC_MSG_RESULT([yes])
1668 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1669],
1670[
1671 AC_MSG_RESULT([no])
1672])
1673
1674CFLAGS=$safe_CFLAGS
1675
1676
njn7fd6d382009-01-22 21:56:32 +00001677#----------------------------------------------------------------------------
1678# Ok. We're done checking.
1679#----------------------------------------------------------------------------
sewardj80637752006-03-02 13:48:21 +00001680
gobrye721a522002-03-22 13:38:30 +00001681AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001682 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001683 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001684 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001685 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001686 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001687 docs/lib/Makefile
1688 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001689 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001690 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001691 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001692 tests/vg_regtest
njn107bc572009-02-16 00:42:10 +00001693 tests/os_test
njnec0c27a2005-12-10 23:11:28 +00001694 perf/Makefile
1695 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001696 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001697 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001698 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001699 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001700 memcheck/Makefile
1701 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001702 memcheck/tests/amd64/Makefile
njnc6168192004-11-29 13:54:10 +00001703 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001704 memcheck/tests/linux/Makefile
njna454ec02009-01-19 03:16:59 +00001705 memcheck/tests/x86-linux/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001706 memcheck/docs/Makefile
1707 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001708 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001709 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001710 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001711 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001712 callgrind/Makefile
1713 callgrind/callgrind_annotate
1714 callgrind/callgrind_control
1715 callgrind/tests/Makefile
1716 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001717 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001718 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001719 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001720 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001721 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001722 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001723 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001724 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001725 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001726 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001727 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001728 none/Makefile
1729 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001730 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001731 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001732 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001733 none/tests/x86/Makefile
njn0458a122009-02-13 06:23:46 +00001734 none/tests/linux/Makefile
njn9bc8c002002-10-02 13:49:13 +00001735 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001736 exp-omega/Makefile
1737 exp-omega/tests/Makefile
1738 exp-omega/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001739 exp-ptrcheck/Makefile
1740 exp-ptrcheck/tests/Makefile
1741 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001742 drd/Makefile
1743 drd/docs/Makefile
1744 drd/scripts/download-and-build-splash2
1745 drd/tests/Makefile
bart0b2b4622008-06-17 19:19:16 +00001746)
gobry3b777892002-04-04 09:18:39 +00001747
1748cat<<EOF
1749
njn311303f2009-02-06 03:46:50 +00001750 Maximum build arch: ${ARCH_MAX}
1751 Primary build arch: ${VGCONF_ARCH_PRI}
1752 Build OS: ${VGCONF_OS}
njn7fd6d382009-01-22 21:56:32 +00001753 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1754 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
sewardje95d94f2008-09-19 09:02:19 +00001755 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001756
gobry3b777892002-04-04 09:18:39 +00001757EOF