blob: 3ae6c73483bc4b76f1db3c69c80162d178c9e5b9 [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
njn8738c282004-11-23 16:31:56 +000018# Where is VEX ?
njnfe408942004-11-23 17:52:24 +000019# Nb: For the 2nd arg, the help string, AS_HELP_STRING is the proper way, but
20# older autoconfs don't support it... here's what it would say:
21#
sewardj85a9dca2005-07-26 10:42:57 +000022# AS_HELP_STRING([--with-vex], [Vex directory]),
njnfe408942004-11-23 17:52:24 +000023#
njn8738c282004-11-23 16:31:56 +000024AC_ARG_WITH(vex,
sewardj85a9dca2005-07-26 10:42:57 +000025 [ --with-vex=/path/to/vex/dir Vex directory],
njn8738c282004-11-23 16:31:56 +000026[
27 AC_CHECK_FILE($withval/pub/libvex.h,
28 [VEX_DIR=$withval],
29 [AC_MSG_ERROR([Directory '$withval' does not exist, or does not contain Vex])])
30],
31[
njn17adf1e2005-09-16 03:59:37 +000032 VEX_DIR='$(top_srcdir)/VEX'
njn8738c282004-11-23 16:31:56 +000033])
sewardj50629ec2004-11-22 13:44:11 +000034AC_SUBST(VEX_DIR)
35
njn657d9512005-06-24 15:20:52 +000036# "make distcheck" first builds a tarball, then extracts it.
37# Then it creates a build directory different from the extracted sources
38# (called _build), and issues
39#
40# ../configure $(DISTCHECK_CONFIGURE_FLAGS)
41#
42# and then builds, runs "make check", installs using DESTDIR, runs make
43# installcheck, uninstalls, checks whether the installed base is empty
44# again, then does yet another "make dist" and compares the resulting
45# tarball with the one it started off with for identical content. Then it
46# tests "make distclean" for no leftover files.
47#
48# So this line means: when doing "make dist", use the same --with-vex value
49# that you used when running configure to configure this tree in the first
50# place.
51AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], [--with-vex=$VEX_DIR])
52
sewardjde4a1d02002-03-22 01:27:54 +000053# Checks for programs.
sewardjb5f6f512005-03-10 23:59:00 +000054CFLAGS="-Wno-long-long"
gobrye721a522002-03-22 13:38:30 +000055
sewardjde4a1d02002-03-22 01:27:54 +000056AC_PROG_LN_S
57AC_PROG_CC
bart0affa492008-03-18 17:53:09 +000058AM_PROG_CC_C_O
sewardjde4a1d02002-03-22 01:27:54 +000059AC_PROG_CPP
njn25e49d8e72002-09-23 09:36:25 +000060AC_PROG_CXX
sewardjde4a1d02002-03-22 01:27:54 +000061AC_PROG_RANLIB
62
bartcddeaf52008-05-25 15:58:11 +000063# If no AR variable was specified, look up the name of the archiver. Otherwise
64# do not touch the AR variable.
65if test "x$AR" = "x"; then
66 AC_PATH_PROGS([AR], ["${LD%ld}ar" "ar"], [ar])
67fi
68AC_ARG_VAR([AR],[Archiver command])
69
gobrye721a522002-03-22 13:38:30 +000070# Check for the compiler support
71if test "${GCC}" != "yes" ; then
72 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
73fi
74
sewardj2f685952002-12-22 19:32:23 +000075# figure out where perl lives
76AC_PATH_PROG(PERL, perl)
77
njn9315df32003-04-16 20:50:50 +000078# figure out where gdb lives
sewardjf8722ca2008-11-17 00:20:45 +000079AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
njnfe408942004-11-23 17:52:24 +000080AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
njn9315df32003-04-16 20:50:50 +000081
daywalker48ccca52002-04-15 00:31:58 +000082# some older automake's don't have it so try something on our own
83ifdef([AM_PROG_AS],[AM_PROG_AS],
84[
gobry1be19852002-03-26 20:44:55 +000085AS="${CC}"
86AC_SUBST(AS)
gobry3b777892002-04-04 09:18:39 +000087
gobry1be19852002-03-26 20:44:55 +000088ASFLAGS=""
89AC_SUBST(ASFLAGS)
daywalker48ccca52002-04-15 00:31:58 +000090])
gobry3b777892002-04-04 09:18:39 +000091
gobry3b777892002-04-04 09:18:39 +000092
sewardjf33b4332008-07-18 18:20:42 +000093# Check we have GNU sed: some of the stuff done by "make install" relies
94# on some pretty fancy sed expressions, and AIX sed doesn't produce the
95# same results, causing install to fail
96
97AC_MSG_CHECKING([for GNU sed])
98
99[sed_firstline=`sed --version | head -n 1`]
100
101case "${sed_firstline}" in
102 GNU*)
103 AC_MSG_RESULT([ok, looks like GNU sed])
104 ;;
105 *)
106 AC_MSG_RESULT([please ensure first 'sed' in your path is GNU sed])
107 AC_MSG_RESULT([note: GNU sed is only required at build/install time])
108 AC_MSG_ERROR([build/install requires that 'sed' is GNU sed])
109 ;;
110esac
111
112
sewardj535c50f2005-06-04 23:14:53 +0000113# We don't want gcc < 3.0
gobrye721a522002-03-22 13:38:30 +0000114AC_MSG_CHECKING([for a supported version of gcc])
115
sewardjf33b4332008-07-18 18:20:42 +0000116[gcc_version=`${CC} --version | head -n 1 | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
gobrye721a522002-03-22 13:38:30 +0000117
118case "${gcc_version}" in
bart76719bf2008-04-19 07:47:56 +0000119 2.*)
gobrye721a522002-03-22 13:38:30 +0000120 AC_MSG_RESULT([no (${gcc_version})])
sewardj535c50f2005-06-04 23:14:53 +0000121 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
122 ;;
gobrye721a522002-03-22 13:38:30 +0000123 *)
124 AC_MSG_RESULT([ok (${gcc_version})])
125 ;;
126esac
127
gobrye721a522002-03-22 13:38:30 +0000128
sewardje95d94f2008-09-19 09:02:19 +0000129# Checks for the platform, with the aim of setting VG_ARCH_MAX. Note
130# that VG_ARCH_MAX must be set to reflect the most that this CPU can
131# do: for example if it is a 64-bit capable PowerPC, then it must be
132# set to ppc64 and not ppc32. Ditto for amd64.
133#
134# We will later in this file set VG_ARCH_PRI, which is the arch for
135# the primary target. For example, suppose we do a build on an amd64
136# machine, but --enable-only32bit has been requested. Then
137# VG_ARCH_MAX will be "amd64" since that reflects the most that this
138# cpu can do, but VG_ARCH_PRI will be "x86", since that reflects the
139# arch corresponding to the primary build (VG_PLATFORM_PRI).
sewardj03d86f22006-10-17 00:57:24 +0000140
sewardjde4a1d02002-03-22 01:27:54 +0000141AC_CANONICAL_HOST
142
143AC_MSG_CHECKING([for a supported CPU])
sewardje95d94f2008-09-19 09:02:19 +0000144AC_SUBST(VG_ARCH_MAX)
sewardjbc692db2006-01-04 03:31:07 +0000145
sewardj9b0567a2006-01-17 02:56:18 +0000146AC_SUBST(VG_ARCH_ALL)
147VG_ARCH_ALL="amd64 ppc32 ppc64 x86"
148
gobrye721a522002-03-22 13:38:30 +0000149case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000150 i?86)
151 AC_MSG_RESULT([ok (${host_cpu})])
sewardje95d94f2008-09-19 09:02:19 +0000152 VG_ARCH_MAX="x86"
sewardjde4a1d02002-03-22 01:27:54 +0000153 ;;
154
njnfe408942004-11-23 17:52:24 +0000155 x86_64)
156 AC_MSG_RESULT([ok (${host_cpu})])
sewardje95d94f2008-09-19 09:02:19 +0000157 VG_ARCH_MAX="amd64"
njnfe408942004-11-23 17:52:24 +0000158 ;;
159
sewardj2c48c7b2005-11-29 13:05:56 +0000160 powerpc64)
sewardj03d86f22006-10-17 00:57:24 +0000161# This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000162 AC_MSG_RESULT([ok (${host_cpu})])
sewardje95d94f2008-09-19 09:02:19 +0000163 VG_ARCH_MAX="ppc64"
sewardj2c48c7b2005-11-29 13:05:56 +0000164 ;;
165
166 powerpc)
sewardj03d86f22006-10-17 00:57:24 +0000167# Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
168# Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000169 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000170 case "${host_os}" in
171 aix5.*)
sewardje95d94f2008-09-19 09:02:19 +0000172 VG_ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000173 ;;
174 *)
sewardje95d94f2008-09-19 09:02:19 +0000175 VG_ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000176 ;;
177 esac
nethercote9bcc9062004-10-13 13:50:01 +0000178 ;;
179
sewardjde4a1d02002-03-22 01:27:54 +0000180 *)
181 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000182 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000183 ;;
184esac
185
sewardj86e992f2006-01-28 18:39:09 +0000186# Sometimes it's convenient to subvert the bi-arch build system and
187# just have a single build even though the underlying platform is
188# capable of both. Hence handle --enable-only64bit and
189# --enable-only32bit. Complain if both are issued :-)
190
191# Check if a 64-bit only build has been requested
192AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
193 [AC_ARG_ENABLE(only64bit,
194 [ --enable-only64bit do a 64-bit only build],
195 [vg_cv_only64bit=$enableval],
196 [vg_cv_only64bit=no])])
197
198# Check if a 32-bit only build has been requested
199AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
200 [AC_ARG_ENABLE(only32bit,
201 [ --enable-only32bit do a 32-bit only build],
202 [vg_cv_only32bit=$enableval],
203 [vg_cv_only32bit=no])])
204
205# Stay sane
206if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
207 AC_MSG_ERROR(
208 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
209fi
210
211
njncfc000e2009-01-20 06:56:26 +0000212# This variable will collect the individual suppression files
213# depending on the results of autoconf
214DEFAULT_SUPP=""
215AC_SUBST(DEFAULT_SUPP)
sewardj86e992f2006-01-28 18:39:09 +0000216
sewardjde4a1d02002-03-22 01:27:54 +0000217AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000218AC_SUBST(VG_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000219
gobrye721a522002-03-22 13:38:30 +0000220case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000221 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000222 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000223 VG_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000224
225 # Ok, this is linux. Check the kernel version
226 AC_MSG_CHECKING([for the kernel version])
227
228 kernel=`uname -r`
229
230 case "${kernel}" in
231 2.6.*)
232 AC_MSG_RESULT([2.6 family (${kernel})])
233 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
234 ;;
235
236 2.4.*)
237 AC_MSG_RESULT([2.4 family (${kernel})])
238 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
239 ;;
240
mueller8c68e042004-01-03 15:21:14 +0000241 *)
242 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000243 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000244 ;;
245 esac
246
247 ;;
248
sewardj03d86f22006-10-17 00:57:24 +0000249 aix5.1.*)
250 AC_MSG_RESULT([ok (${host_os})])
251 VG_OS="aix5"
252 ;;
253 aix5.2.*)
254 AC_MSG_RESULT([ok (${host_os})])
255 VG_OS="aix5"
256 ;;
257 aix5.3.*)
258 AC_MSG_RESULT([ok (${host_os})])
259 VG_OS="aix5"
260 ;;
261
mueller8c68e042004-01-03 15:21:14 +0000262 *freebsd*)
263 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000264 VG_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000265 ;;
266
267 *)
268 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000269 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000270 ;;
271esac
272
tomd6398392006-06-07 17:44:36 +0000273# If we are building on a 64 bit platform test to see if the system
274# supports building 32 bit programs and disable 32 bit support if it
275# does not support building 32 bit programs
276
sewardje95d94f2008-09-19 09:02:19 +0000277case "$VG_ARCH_MAX-$VG_OS" in
tomd6398392006-06-07 17:44:36 +0000278 amd64-linux|ppc64-linux)
279 AC_MSG_CHECKING([for 32 bit build support])
280 safe_CFLAGS=$CFLAGS
281 CFLAGS="-m32"
282 AC_TRY_LINK(, [
283 int main () { return 0 ; }
284 ],
285 [
286 AC_MSG_RESULT([yes])
287 ], [
288 vg_cv_only64bit="yes"
289 AC_MSG_RESULT([no])
290 ])
291 CFLAGS=$safe_CFLAGS;;
292esac
293
294if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
295 AC_MSG_ERROR(
296 [--enable-only32bit was specified but system does not support 32 bit builds])
297fi
nethercote888ecb72004-08-23 14:54:40 +0000298
sewardj01262142006-01-04 01:20:28 +0000299# Establish VG_PLATFORM_PRI. This is the primary build target. The
300# entire system, including regression and performance tests, will be
sewardjbc692db2006-01-04 03:31:07 +0000301# built for this target.
sewardj01262142006-01-04 01:20:28 +0000302#
sewardjbc692db2006-01-04 03:31:07 +0000303# Also establish VG_PLATFORM_SEC, the secondary build target, if
sewardj01262142006-01-04 01:20:28 +0000304# possible. The system will also be built for this target, but not
sewardjbc692db2006-01-04 03:31:07 +0000305# the regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000306#
sewardje95d94f2008-09-19 09:02:19 +0000307# Also establish VG_ARCH_PRI, which is the arch for the primary
308# build target. The various makefiles building regression tests
309# sometimes need to see this.
sewardj01262142006-01-04 01:20:28 +0000310AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000311
sewardj01262142006-01-04 01:20:28 +0000312AC_SUBST(VG_PLATFORM_PRI)
313AC_SUBST(VG_PLATFORM_SEC)
sewardje95d94f2008-09-19 09:02:19 +0000314AC_SUBST(VG_ARCH_PRI)
sewardj01262142006-01-04 01:20:28 +0000315
sewardje95d94f2008-09-19 09:02:19 +0000316# By default, the primary arch is the same as the "max" arch, as
317# commented above (at the definition of VG_ARCH_MAX). We may choose
318# to downgrade it in the big case statement just below here, in the
319# case where we're building on a 64 bit machine but have been
320# requested only to do a 32 bit build.
321VG_ARCH_PRI=$VG_ARCH_MAX
322
323case "$VG_ARCH_MAX-$VG_OS" in
sewardj01262142006-01-04 01:20:28 +0000324 x86-linux)
325 VG_PLATFORM_PRI="X86_LINUX"
326 VG_PLATFORM_SEC=""
njnd74b0ef2009-01-20 06:06:52 +0000327 valt_load_address_normal="0x38000000"
328 valt_load_address_inner="0x28000000"
sewardj3e38ce02004-11-23 01:17:29 +0000329 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
sewardj01262142006-01-04 01:20:28 +0000330 ;;
331 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000332 if test x$vg_cv_only64bit = xyes; then
333 VG_PLATFORM_PRI="AMD64_LINUX"
334 VG_PLATFORM_SEC=""
335 elif test x$vg_cv_only32bit = xyes; then
336 VG_PLATFORM_PRI="X86_LINUX"
337 VG_PLATFORM_SEC=""
sewardje95d94f2008-09-19 09:02:19 +0000338 VG_ARCH_PRI="x86"
sewardj86e992f2006-01-28 18:39:09 +0000339 else
340 VG_PLATFORM_PRI="AMD64_LINUX"
341 VG_PLATFORM_SEC="X86_LINUX"
342 fi
njnd74b0ef2009-01-20 06:06:52 +0000343 valt_load_address_normal="0x38000000"
344 valt_load_address_inner="0x28000000"
sewardj01262142006-01-04 01:20:28 +0000345 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
346 ;;
347 ppc32-linux)
348 VG_PLATFORM_PRI="PPC32_LINUX"
349 VG_PLATFORM_SEC=""
njnd74b0ef2009-01-20 06:06:52 +0000350 valt_load_address_normal="0x38000000"
351 valt_load_address_inner="0x28000000"
sewardj01262142006-01-04 01:20:28 +0000352 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
353 ;;
sewardj03d86f22006-10-17 00:57:24 +0000354 ppc64-aix5)
355 if test x$vg_cv_only64bit = xyes; then
356 VG_PLATFORM_PRI="PPC64_AIX5"
357 VG_PLATFORM_SEC=""
358 elif test x$vg_cv_only32bit = xyes; then
359 VG_PLATFORM_PRI="PPC32_AIX5"
360 VG_PLATFORM_SEC=""
sewardje95d94f2008-09-19 09:02:19 +0000361 VG_ARCH_PRI="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000362 else
363 VG_PLATFORM_PRI="PPC64_AIX5"
364 VG_PLATFORM_SEC="PPC32_AIX5"
365 fi
njnd74b0ef2009-01-20 06:06:52 +0000366 valt_load_address_normal="0x38000000"
367 valt_load_address_inner="0x28000000"
sewardj03d86f22006-10-17 00:57:24 +0000368 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
369 ;;
sewardj01262142006-01-04 01:20:28 +0000370 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000371 if test x$vg_cv_only64bit = xyes; then
372 VG_PLATFORM_PRI="PPC64_LINUX"
373 VG_PLATFORM_SEC=""
374 elif test x$vg_cv_only32bit = xyes; then
375 VG_PLATFORM_PRI="PPC32_LINUX"
376 VG_PLATFORM_SEC=""
sewardje95d94f2008-09-19 09:02:19 +0000377 VG_ARCH_PRI="ppc32"
sewardj86e992f2006-01-28 18:39:09 +0000378 else
379 VG_PLATFORM_PRI="PPC64_LINUX"
380 VG_PLATFORM_SEC="PPC32_LINUX"
381 fi
njnd74b0ef2009-01-20 06:06:52 +0000382 valt_load_address_normal="0x38000000"
383 valt_load_address_inner="0x28000000"
sewardj01262142006-01-04 01:20:28 +0000384 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
385 ;;
nethercote888ecb72004-08-23 14:54:40 +0000386 *)
sewardj01262142006-01-04 01:20:28 +0000387 VG_PLATFORM_PRI="unknown"
388 VG_PLATFORM_SEC="unknown"
nethercote888ecb72004-08-23 14:54:40 +0000389 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000390 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000391 ;;
392esac
sewardjde4a1d02002-03-22 01:27:54 +0000393
njna454ec02009-01-19 03:16:59 +0000394# Set up VGA_<arch>. Either one or two of these become defined.
395#
396AM_CONDITIONAL(VGA_X86,
397 test x$VG_PLATFORM_PRI = xX86_LINUX \
398 -o x$VG_PLATFORM_SEC = xX86_LINUX )
399AM_CONDITIONAL(VGA_AMD64,
400 test x$VG_PLATFORM_PRI = xAMD64_LINUX )
401AM_CONDITIONAL(VGA_PPC32,
402 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
403 -o x$VG_PLATFORM_SEC = xPPC32_LINUX \
404 -o x$VG_PLATFORM_PRI = xPPC32_AIX5 \
405 -o x$VG_PLATFORM_SEC = xPPC32_AIX5 )
406AM_CONDITIONAL(VGA_PPC64,
407 test x$VG_PLATFORM_PRI = xPPC64_LINUX \
408 -o x$VG_PLATFORM_PRI = xPPC64_AIX5 )
409
sewardj03d86f22006-10-17 00:57:24 +0000410# Set up VGP_<platform>. Either one or two of these become defined.
sewardj01262142006-01-04 01:20:28 +0000411#
sewardj03d86f22006-10-17 00:57:24 +0000412AM_CONDITIONAL(VGP_X86_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000413 test x$VG_PLATFORM_PRI = xX86_LINUX \
414 -o x$VG_PLATFORM_SEC = xX86_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000415AM_CONDITIONAL(VGP_AMD64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000416 test x$VG_PLATFORM_PRI = xAMD64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000417AM_CONDITIONAL(VGP_PPC32_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000418 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
419 -o x$VG_PLATFORM_SEC = xPPC32_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000420AM_CONDITIONAL(VGP_PPC64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000421 test x$VG_PLATFORM_PRI = xPPC64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000422AM_CONDITIONAL(VGP_PPC32_AIX5,
423 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
424 -o x$VG_PLATFORM_SEC = xPPC32_AIX5)
425AM_CONDITIONAL(VGP_PPC64_AIX5,
426 test x$VG_PLATFORM_PRI = xPPC64_AIX5)
427
428# Similarly, set up VGO_<os>. Exactly one of these becomes defined.
429# Relies on the assumption that the primary and secondary targets are
430# for the same OS, so therefore only necessary to test the primary.
431#
432AM_CONDITIONAL(VGO_LINUX,
433 test x$VG_PLATFORM_PRI = xX86_LINUX \
434 -o x$VG_PLATFORM_PRI = xAMD64_LINUX \
435 -o x$VG_PLATFORM_PRI = xPPC32_LINUX \
436 -o x$VG_PLATFORM_PRI = xPPC64_LINUX)
437AM_CONDITIONAL(VGO_AIX5,
438 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
439 -o x$VG_PLATFORM_PRI = xPPC64_AIX5)
440
441
442# Sometimes, in the Makefile.am-s, it's useful to know
443# whether or not there is a secondary target.
444#
445AM_CONDITIONAL(VGP_HAVE_SECONDARY,
446 test x$VG_PLATFORM_SEC != x)
tomfb7bcde2005-11-07 15:24:38 +0000447
tomb637bad2005-11-08 12:28:35 +0000448
njnd74b0ef2009-01-20 06:06:52 +0000449# Check if this should be built as an inner Valgrind, to be run within
450# another Valgrind. Choose the load address accordingly.
451AC_SUBST(VALT_LOAD_ADDRESS)
452AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
453 [AC_ARG_ENABLE(inner,
454 [ --enable-inner enables self-hosting],
455 [vg_cv_inner=$enableval],
456 [vg_cv_inner=no])])
457if test "$vg_cv_inner" = yes; then
458 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
459 VALT_LOAD_ADDRESS=$valt_load_address_inner
460else
461 VALT_LOAD_ADDRESS=$valt_load_address_normal
462fi
463
464
sewardjde4a1d02002-03-22 01:27:54 +0000465
sewardj01262142006-01-04 01:20:28 +0000466
dirk07596a22008-04-25 11:33:30 +0000467GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000468
sewardjde4a1d02002-03-22 01:27:54 +0000469AC_EGREP_CPP([GLIBC_22], [
470#include <features.h>
471#ifdef __GNU_LIBRARY__
472 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
473 GLIBC_22
474 #endif
475#endif
476],
dirk07596a22008-04-25 11:33:30 +0000477GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000478
sewardj08c7f012002-10-07 23:56:55 +0000479AC_EGREP_CPP([GLIBC_23], [
480#include <features.h>
481#ifdef __GNU_LIBRARY__
482 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
483 GLIBC_23
484 #endif
485#endif
486],
dirk07596a22008-04-25 11:33:30 +0000487GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000488
njn781dba52005-06-30 04:06:38 +0000489AC_EGREP_CPP([GLIBC_24], [
490#include <features.h>
491#ifdef __GNU_LIBRARY__
492 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
493 GLIBC_24
494 #endif
495#endif
496],
dirk07596a22008-04-25 11:33:30 +0000497GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000498
dirkaece45c2006-10-12 08:17:49 +0000499AC_EGREP_CPP([GLIBC_25], [
500#include <features.h>
501#ifdef __GNU_LIBRARY__
502 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
503 GLIBC_25
504 #endif
505#endif
506],
dirk07596a22008-04-25 11:33:30 +0000507GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000508
dirkc8bd0c52007-05-23 17:39:08 +0000509AC_EGREP_CPP([GLIBC_26], [
510#include <features.h>
511#ifdef __GNU_LIBRARY__
512 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
513 GLIBC_26
514 #endif
515#endif
516],
dirk07596a22008-04-25 11:33:30 +0000517GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000518
sewardj68c80c12007-11-18 14:40:02 +0000519AC_EGREP_CPP([GLIBC_27], [
520#include <features.h>
521#ifdef __GNU_LIBRARY__
522 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
523 GLIBC_27
524 #endif
525#endif
526],
dirk07596a22008-04-25 11:33:30 +0000527GLIBC_VERSION="2.7")
528
529AC_EGREP_CPP([GLIBC_28], [
530#include <features.h>
531#ifdef __GNU_LIBRARY__
532 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
533 GLIBC_28
534 #endif
535#endif
536],
537GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000538
dirkd2e31eb2008-11-19 23:58:36 +0000539AC_EGREP_CPP([GLIBC_29], [
540#include <features.h>
541#ifdef __GNU_LIBRARY__
542 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
543 GLIBC_29
544 #endif
545#endif
546],
547GLIBC_VERSION="2.9")
548
sewardj03d86f22006-10-17 00:57:24 +0000549AC_EGREP_CPP([AIX5_LIBC], [
550#include <standards.h>
551#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
552 AIX5_LIBC
553#endif
554],
dirk07596a22008-04-25 11:33:30 +0000555GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000556
dirk07596a22008-04-25 11:33:30 +0000557AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000558
dirk07596a22008-04-25 11:33:30 +0000559case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000560 2.2)
561 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000562 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000563 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
564 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000565 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000566 ;;
567
sewardj08c7f012002-10-07 23:56:55 +0000568 2.3)
569 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000570 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000571 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000572 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000573 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000574 ;;
575
njn781dba52005-06-30 04:06:38 +0000576 2.4)
577 AC_MSG_RESULT(2.4 family)
578 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000579 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000580 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000581 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000582 ;;
583
dirkaece45c2006-10-12 08:17:49 +0000584 2.5)
585 AC_MSG_RESULT(2.5 family)
586 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000587 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000588 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000589 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000590 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000591 2.6)
592 AC_MSG_RESULT(2.6 family)
593 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000594 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000595 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000596 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000597 ;;
598 2.7)
599 AC_MSG_RESULT(2.7 family)
600 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000601 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000602 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000603 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000604 ;;
dirk07596a22008-04-25 11:33:30 +0000605 2.8)
606 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000607 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000608 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
609 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
610 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
611 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000612 2.9)
613 AC_MSG_RESULT(2.9 family)
614 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
615 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
616 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
617 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
618 ;;
sewardj03d86f22006-10-17 00:57:24 +0000619 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000620 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
621 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 +0000622 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
623 ;;
dirkaece45c2006-10-12 08:17:49 +0000624
sewardjde4a1d02002-03-22 01:27:54 +0000625 *)
626 AC_MSG_RESULT(unsupported version)
dirkd2e31eb2008-11-19 23:58:36 +0000627 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.9])
dirk07596a22008-04-25 11:33:30 +0000628 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
sewardjde4a1d02002-03-22 01:27:54 +0000629 ;;
630esac
631
dirk07596a22008-04-25 11:33:30 +0000632AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000633
sewardj414f3582008-07-18 20:46:00 +0000634
635# Add default suppressions for the X client libraries. Make no
636# attempt to detect whether such libraries are installed on the
637# build machine (or even if any X facilities are present); just
638# add the suppressions antidisirregardless.
639DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
640DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000641
sewardj5744c022008-10-19 18:58:13 +0000642# Add glibc and X11 suppressions for exp-ptrcheck
643DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
644
sewardj2e10a682003-04-07 19:36:41 +0000645
bart59e2f182008-04-28 16:22:53 +0000646# Check for CLOCK_MONOTONIC
647
648AC_MSG_CHECKING([for CLOCK_MONOTONIC])
649
650AC_TRY_COMPILE(
651[
652#include <time.h>
653], [
654 struct timespec t;
655 clock_gettime(CLOCK_MONOTONIC, &t);
656 return 0;
657],
658[
659AC_MSG_RESULT([yes])
660AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
661 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
662], [
663AC_MSG_RESULT([no])
664])
665
bartfea06922008-05-03 09:12:15 +0000666
667# Check for PTHREAD_MUTEX_ADAPTIVE_NP
668
669AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
670
671AC_TRY_COMPILE(
672[
673#define _GNU_SOURCE
674#include <pthread.h>
675], [
676 return (PTHREAD_MUTEX_ADAPTIVE_NP);
677],
678[
679AC_MSG_RESULT([yes])
680AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
681 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
682], [
683AC_MSG_RESULT([no])
684])
685
686
687# Check for PTHREAD_MUTEX_ERRORCHECK_NP
688
689AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
690
691AC_TRY_COMPILE(
692[
693#define _GNU_SOURCE
694#include <pthread.h>
695], [
696 return (PTHREAD_MUTEX_ERRORCHECK_NP);
697],
698[
699AC_MSG_RESULT([yes])
700AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
701 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
702], [
703AC_MSG_RESULT([no])
704])
705
706
707# Check for PTHREAD_MUTEX_RECURSIVE_NP
708
709AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
710
711AC_TRY_COMPILE(
712[
713#define _GNU_SOURCE
714#include <pthread.h>
715], [
716 return (PTHREAD_MUTEX_RECURSIVE_NP);
717],
718[
719AC_MSG_RESULT([yes])
720AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
721 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
722], [
723AC_MSG_RESULT([no])
724])
725
726
727# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
728
729AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
730
731AC_TRY_COMPILE(
732[
733#define _GNU_SOURCE
734#include <pthread.h>
735], [
736 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
737 return 0;
738],
739[
740AC_MSG_RESULT([yes])
741AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
742 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
743], [
744AC_MSG_RESULT([no])
745])
746
747
barte8900ff2008-10-13 19:22:35 +0000748# Check whether FILE has a member called _lock and whether it's a pointer.
749
750AC_MSG_CHECKING([for FILE::_lock])
751
752AC_TRY_COMPILE(
753[
754 #include <stdio.h>
755], [
756 void *p;
757 p = stdout->_lock;
758 return 0;
759], [
760AC_MSG_RESULT([yes])
761AC_DEFINE([HAVE_LIBC_FILE_LOCK], 1,
762 [Define to 1 if FILE has a member called _lock.])
763], [
764AC_MSG_RESULT([no])
765])
766
767
bart5e389f12008-04-05 12:53:15 +0000768# Check whether pthread_mutex_t has a member called __m_kind.
769
770AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
771
bart56730cd2008-05-11 06:41:46 +0000772AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000773[
bart56730cd2008-05-11 06:41:46 +0000774 #include <pthread.h>
775], [
bart5e389f12008-04-05 12:53:15 +0000776 pthread_mutex_t m;
777 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000778], [
bart5e389f12008-04-05 12:53:15 +0000779AC_MSG_RESULT([yes])
780AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
781 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
782], [
783AC_MSG_RESULT([no])
784])
785
786
787# Check whether pthread_mutex_t has a member called __data.__kind.
788
789AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
790
bart56730cd2008-05-11 06:41:46 +0000791AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000792[
bart56730cd2008-05-11 06:41:46 +0000793#include <pthread.h>
794], [
bart5e389f12008-04-05 12:53:15 +0000795 pthread_mutex_t m;
796 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000797], [
bart5e389f12008-04-05 12:53:15 +0000798AC_MSG_RESULT([yes])
799AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
800 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
801], [
802AC_MSG_RESULT([no])
803])
804
805
bart62c370e2008-05-12 18:50:51 +0000806# does this compiler support -maltivec and does it have the include file
807# <altivec.h> ?
808
809AC_MSG_CHECKING([for Altivec])
810
811safe_CFLAGS=$CFLAGS
812CFLAGS="-maltivec"
813
814AC_TRY_COMPILE(
815[
816#include <altivec.h>
817], [
818 vector unsigned int v;
819],
820[
821ac_have_altivec=yes
822AC_MSG_RESULT([yes])
823], [
824ac_have_altivec=no
825AC_MSG_RESULT([no])
826])
827CFLAGS=$safe_CFLAGS
828
829AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
830AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
831
832
barta50aa8a2008-04-27 06:06:57 +0000833# Check for eventfd_t, eventfd() and eventfd_read()
834AC_MSG_CHECKING([for eventfd()])
835
836AC_TRY_LINK(
837[
838#include <sys/eventfd.h>
839], [
840 eventfd_t ev;
841 int fd;
842
843 fd = eventfd(5, 0);
844 eventfd_read(fd, &ev);
845 return 0;
846],
847[
848AC_MSG_RESULT([yes])
849AC_DEFINE([HAVE_EVENTFD], 1,
850 [Define to 1 if you have the `eventfd' function.])
851AC_DEFINE([HAVE_EVENTFD_READ], 1,
852 [Define to 1 if you have the `eventfd_read' function.])
853], [
854AC_MSG_RESULT([no])
855])
856
857
sewardj535c50f2005-06-04 23:14:53 +0000858# does this compiler support -m32 ?
859AC_MSG_CHECKING([if gcc accepts -m32])
860
861safe_CFLAGS=$CFLAGS
862CFLAGS="-m32"
863
864AC_TRY_COMPILE(, [
865int main () { return 0 ; }
866],
867[
868FLAG_M32="-m32"
869AC_MSG_RESULT([yes])
870], [
871FLAG_M32=""
872AC_MSG_RESULT([no])
873])
874CFLAGS=$safe_CFLAGS
875
876AC_SUBST(FLAG_M32)
877
878
sewardj03d86f22006-10-17 00:57:24 +0000879# does this compiler support -maix32 ?
880AC_MSG_CHECKING([if gcc accepts -maix32])
881
882safe_CFLAGS=$CFLAGS
883CFLAGS="-maix32"
884
885AC_TRY_COMPILE(, [
886int main () { return 0 ; }
887],
888[
889FLAG_MAIX32="-maix32"
890AC_MSG_RESULT([yes])
891], [
892FLAG_MAIX32=""
893AC_MSG_RESULT([no])
894])
895CFLAGS=$safe_CFLAGS
896
897AC_SUBST(FLAG_MAIX32)
898
899
sewardj01262142006-01-04 01:20:28 +0000900# does this compiler support -m64 ?
901AC_MSG_CHECKING([if gcc accepts -m64])
902
903safe_CFLAGS=$CFLAGS
904CFLAGS="-m64"
905
906AC_TRY_COMPILE(, [
907int main () { return 0 ; }
908],
909[
910FLAG_M64="-m64"
911AC_MSG_RESULT([yes])
912], [
913FLAG_M64=""
914AC_MSG_RESULT([no])
915])
916CFLAGS=$safe_CFLAGS
917
918AC_SUBST(FLAG_M64)
919
920
sewardj03d86f22006-10-17 00:57:24 +0000921# does this compiler support -maix64 ?
922AC_MSG_CHECKING([if gcc accepts -maix64])
923
924safe_CFLAGS=$CFLAGS
925CFLAGS="-maix64"
926
927AC_TRY_COMPILE(, [
928int main () { return 0 ; }
929],
930[
931FLAG_MAIX64="-maix64"
932AC_MSG_RESULT([yes])
933], [
934FLAG_MAIX64=""
935AC_MSG_RESULT([no])
936])
937CFLAGS=$safe_CFLAGS
938
939AC_SUBST(FLAG_MAIX64)
940
941
sewardj67f1fcc2005-07-03 10:41:02 +0000942# does this compiler support -mmmx ?
943AC_MSG_CHECKING([if gcc accepts -mmmx])
944
945safe_CFLAGS=$CFLAGS
946CFLAGS="-mmmx"
947
948AC_TRY_COMPILE(, [
949int main () { return 0 ; }
950],
951[
952FLAG_MMMX="-mmmx"
953AC_MSG_RESULT([yes])
954], [
955FLAG_MMMX=""
956AC_MSG_RESULT([no])
957])
958CFLAGS=$safe_CFLAGS
959
960AC_SUBST(FLAG_MMMX)
961
962
963# does this compiler support -msse ?
964AC_MSG_CHECKING([if gcc accepts -msse])
965
966safe_CFLAGS=$CFLAGS
967CFLAGS="-msse"
968
969AC_TRY_COMPILE(, [
970int main () { return 0 ; }
971],
972[
973FLAG_MSSE="-msse"
974AC_MSG_RESULT([yes])
975], [
976FLAG_MSSE=""
977AC_MSG_RESULT([no])
978])
979CFLAGS=$safe_CFLAGS
980
981AC_SUBST(FLAG_MSSE)
982
983
sewardj5b754b42002-06-03 22:53:35 +0000984# does this compiler support -mpreferred-stack-boundary=2 ?
985AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
986
daywalker3664f562003-10-17 13:43:46 +0000987safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000988CFLAGS="-mpreferred-stack-boundary=2"
989
990AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000991int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000992],
993[
994PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000995AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000996], [
997PREFERRED_STACK_BOUNDARY=""
998AC_MSG_RESULT([no])
999])
daywalker3664f562003-10-17 13:43:46 +00001000CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +00001001
1002AC_SUBST(PREFERRED_STACK_BOUNDARY)
1003
sewardj535c50f2005-06-04 23:14:53 +00001004
sewardjb5f6f512005-03-10 23:59:00 +00001005# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001006AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001007
1008safe_CFLAGS=$CFLAGS
1009CFLAGS="-Wno-pointer-sign"
1010
1011AC_TRY_COMPILE(, [
1012int main () { return 0 ; }
1013],
1014[
1015no_pointer_sign=yes
1016AC_MSG_RESULT([yes])
1017], [
1018no_pointer_sign=no
1019AC_MSG_RESULT([no])
1020])
1021CFLAGS=$safe_CFLAGS
1022
1023if test x$no_pointer_sign = xyes; then
1024 CFLAGS="$CFLAGS -Wno-pointer-sign"
1025fi
1026
sewardj535c50f2005-06-04 23:14:53 +00001027
tom1e946682005-10-12 11:27:33 +00001028# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001029AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001030
1031safe_CFLAGS=$CFLAGS
1032CFLAGS="-Wdeclaration-after-statement"
1033
1034AC_TRY_COMPILE(, [
1035int main () { return 0 ; }
1036],
1037[
tome9814c32005-10-12 11:30:43 +00001038declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001039FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001040AC_MSG_RESULT([yes])
1041], [
tome9814c32005-10-12 11:30:43 +00001042declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001043FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001044AC_MSG_RESULT([no])
1045])
1046CFLAGS=$safe_CFLAGS
1047
sewardj72a547e2006-01-25 02:58:28 +00001048AC_SUBST(FLAG_WDECL_AFTER_STMT)
1049
tome9814c32005-10-12 11:30:43 +00001050if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001051 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1052fi
1053
sewardj00f1e622006-03-12 16:47:10 +00001054
bart9d865fa2008-06-23 12:11:49 +00001055# does this compiler support -Wno-format-zero-length ?
1056
1057AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1058
1059safe_CFLAGS=$CFLAGS
1060CFLAGS="-Wno-format-zero-length"
1061
1062AC_TRY_COMPILE(
1063[ ],
1064[
1065 return 0;
1066],
1067[
1068AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1069AC_MSG_RESULT([yes])
1070],
1071[
1072AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1073AC_MSG_RESULT([no])
1074])
1075CFLAGS=$safe_CFLAGS
1076
1077
bart56730cd2008-05-11 06:41:46 +00001078# does this compiler support -Wextra or the older -W ?
1079
1080AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1081
1082safe_CFLAGS=$CFLAGS
1083CFLAGS="-Wextra"
1084
1085AC_TRY_COMPILE(
1086[ ],
1087[
1088 return 0;
1089],
1090[
1091AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1092AC_MSG_RESULT([-Wextra])
1093], [
1094 CFLAGS="-W"
1095 AC_TRY_COMPILE(
1096 [ ],
1097 [
1098 return 0;
1099 ],
1100 [
1101 AC_SUBST([FLAG_W_EXTRA], [-W])
1102 AC_MSG_RESULT([-W])
1103 ], [
1104 AC_SUBST([FLAG_W_EXTRA], [])
1105 AC_MSG_RESULT([not supported])
1106 ])
1107])
1108CFLAGS=$safe_CFLAGS
1109
1110
sewardja72c26d2007-05-01 13:44:08 +00001111# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001112AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001113
1114safe_CFLAGS=$CFLAGS
1115CFLAGS="-fno-stack-protector"
1116
1117AC_TRY_COMPILE(, [
1118int main () { return 0 ; }
1119],
1120[
1121no_stack_protector=yes
1122FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1123AC_MSG_RESULT([yes])
1124], [
1125no_stack_protector=no
1126FLAG_FNO_STACK_PROTECTOR=""
1127AC_MSG_RESULT([no])
1128])
1129CFLAGS=$safe_CFLAGS
1130
1131AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1132
1133if test x$no_stack_protector = xyes; then
1134 CFLAGS="$CFLAGS -fno-stack-protector"
1135fi
1136
1137
bart56730cd2008-05-11 06:41:46 +00001138# does this compiler support --param inline-unit-growth=... ?
1139
1140AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1141
1142safe_CFLAGS=$CFLAGS
1143CFLAGS="--param inline-unit-growth=900"
1144
1145AC_TRY_COMPILE(
1146[ ],
1147[
1148 return 0;
1149],
1150[
1151AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1152 ["--param inline-unit-growth=900"])
1153AC_MSG_RESULT([yes])
1154], [
1155AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1156AC_MSG_RESULT([no])
1157])
1158CFLAGS=$safe_CFLAGS
1159
1160
tomd55121e2005-12-19 12:40:13 +00001161# does this compiler support __builtin_expect?
1162AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001163
tomd55121e2005-12-19 12:40:13 +00001164AC_TRY_LINK(, [
1165return __builtin_expect(1, 1) ? 1 : 0
1166],
1167[
1168ac_have_builtin_expect=yes
1169AC_MSG_RESULT([yes])
1170], [
1171ac_have_builtin_expect=no
1172AC_MSG_RESULT([no])
1173])
1174if test x$ac_have_builtin_expect = xyes ; then
1175 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1176fi
1177
tom1e946682005-10-12 11:27:33 +00001178
bartcd529dc2008-06-26 08:43:12 +00001179# does this compiler have built-in functions for atomic memory access ?
1180AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1181
1182AC_TRY_LINK(,
1183[
1184 int variable = 1;
bart99ae6102008-09-21 11:24:00 +00001185 return (__sync_bool_compare_and_swap(&variable, 1, 2)
bartd5a131f2008-12-21 16:09:03 +00001186 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bartcd529dc2008-06-26 08:43:12 +00001187],
1188[
1189 AC_MSG_RESULT([yes])
1190 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1191],
1192[
1193 AC_MSG_RESULT([no])
1194])
1195
1196
sewardj00f1e622006-03-12 16:47:10 +00001197# does the ppc assembler support "mtocrf" et al?
1198AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1199
1200AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001201__asm__ __volatile__("mtocrf 4,0");
1202__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001203],
1204[
1205ac_have_as_ppc_mftocrf=yes
1206AC_MSG_RESULT([yes])
1207], [
1208ac_have_as_ppc_mftocrf=no
1209AC_MSG_RESULT([no])
1210])
1211if test x$ac_have_as_ppc_mftocrf = xyes ; then
1212 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1213fi
1214
1215
sewardjf0aabf82007-03-22 00:24:21 +00001216# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001217# Note, this doesn't generate a C-level symbol. It generates a
1218# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001219AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1220
1221AC_TRY_COMPILE(, [
1222 do { long long int x;
1223 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1224 while (0)
1225],
1226[
1227ac_have_as_sse3=yes
1228AC_MSG_RESULT([yes])
1229], [
1230ac_have_as_sse3=no
1231AC_MSG_RESULT([no])
1232])
sewardjfa18a262007-03-22 12:13:13 +00001233
1234AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001235
1236
sewardj6d6da5b2008-02-09 12:07:40 +00001237# Ditto for SSSE3 instructions (note extra S)
1238# Note, this doesn't generate a C-level symbol. It generates a
1239# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1240AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1241
1242AC_TRY_COMPILE(, [
1243 do { long long int x;
1244 __asm__ __volatile__(
1245 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1246 while (0)
1247],
1248[
1249ac_have_as_ssse3=yes
1250AC_MSG_RESULT([yes])
1251], [
1252ac_have_as_ssse3=no
1253AC_MSG_RESULT([no])
1254])
1255
1256AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1257
1258
sewardjb5f6f512005-03-10 23:59:00 +00001259# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001260if test "x${cross_compiling}" = "xno"; then
1261# Native compilation: check whether running a program using TLS succeeds.
1262# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1263# succeeds but running programs using TLS fails.
1264AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1265 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1266 [vg_cv_tls=$enableval],
1267 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1268 [[return foo;]])],
1269 [vg_cv_tls=yes],
1270 [vg_cv_tls=no])])])
1271else
1272# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001273AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1274 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1275 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001276 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001277 [[return foo;]])],
1278 [vg_cv_tls=yes],
1279 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001280fi
sewardjb5f6f512005-03-10 23:59:00 +00001281
1282if test "$vg_cv_tls" = yes; then
1283AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1284fi
sewardj5b754b42002-06-03 22:53:35 +00001285
sewardj535c50f2005-06-04 23:14:53 +00001286
bart62f54e42008-07-28 11:35:10 +00001287# Checks for C header files.
sewardjde4a1d02002-03-22 01:27:54 +00001288AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001289AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001290 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001291 endian.h \
1292 mqueue.h \
1293 sys/endian.h \
1294 sys/epoll.h \
1295 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001296 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001297 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001298 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001299 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001300 sys/syscall.h \
1301 sys/time.h \
1302 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001303 ])
sewardjde4a1d02002-03-22 01:27:54 +00001304
1305# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +00001306AC_TYPE_UID_T
1307AC_TYPE_OFF_T
1308AC_TYPE_SIZE_T
1309AC_HEADER_TIME
1310
sewardj535c50f2005-06-04 23:14:53 +00001311
sewardjde4a1d02002-03-22 01:27:54 +00001312# Checks for library functions.
1313AC_FUNC_MEMCMP
1314AC_FUNC_MMAP
1315AC_TYPE_SIGNAL
1316
bart71bad292008-04-27 11:43:23 +00001317AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001318
bartf5ceec82008-04-26 07:45:10 +00001319AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001320 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001321 epoll_create \
1322 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001323 floor \
bartce48fa92008-04-26 10:59:46 +00001324 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001325 mallinfo \
1326 memchr \
1327 memset \
1328 mkdir \
1329 ppoll \
bart6d45e922009-01-20 13:45:38 +00001330 pthread_barrier_init \
1331 pthread_condattr_setclock \
1332 pthread_mutex_timedlock \
1333 pthread_rwlock_timedrdlock \
1334 pthread_rwlock_timedwrlock \
1335 pthread_spin_lock \
bartf5ceec82008-04-26 07:45:10 +00001336 semtimedop \
1337 signalfd \
bart71bad292008-04-27 11:43:23 +00001338 syscall \
bartf5ceec82008-04-26 07:45:10 +00001339 strchr \
1340 strdup \
1341 strpbrk \
1342 strrchr \
1343 strstr \
1344 timerfd \
1345 utimensat \
1346 ])
sewardjde4a1d02002-03-22 01:27:54 +00001347
bart623eec32008-07-29 17:54:49 +00001348# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1349# libraries with any shared object and/or executable. This is NOT what we
1350# want for e.g. vgpreload_core-x86-linux.so
1351LIBS=""
sewardj80637752006-03-02 13:48:21 +00001352
bart6d45e922009-01-20 13:45:38 +00001353AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1354 [test x$ac_cv_func_pthread_barrier_init = xyes])
1355AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1356 [test x$ac_cv_func_pthread_spin_lock = xyes])
1357
sewardj03d86f22006-10-17 00:57:24 +00001358# Do we have a useable MPI setup on the primary and/or secondary targets?
1359# On Linux, by default, assumes mpicc and -m32/-m64
1360# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001361# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001362# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1363# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001364MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +00001365if test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
1366 -o x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
1367 MPI_CC="mpxlc"
1368fi
1369
sewardje9fa5062006-03-12 18:29:18 +00001370mflag_primary=
1371if test x$VG_PLATFORM_PRI = xX86_LINUX \
1372 -o x$VG_PLATFORM_PRI = xPPC32_LINUX ; then
1373 mflag_primary=$FLAG_M32
1374elif test x$VG_PLATFORM_PRI = xAMD64_LINUX \
1375 -o x$VG_PLATFORM_PRI = xPPC64_LINUX ; then
1376 mflag_primary=$FLAG_M64
sewardj03d86f22006-10-17 00:57:24 +00001377elif test x$VG_PLATFORM_PRI = xPPC32_AIX5 ; then
1378 mflag_primary=-q32
1379elif test x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
1380 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001381fi
1382
sewardj03d86f22006-10-17 00:57:24 +00001383mflag_secondary=
1384if test x$VG_PLATFORM_SEC = xX86_LINUX \
1385 -o x$VG_PLATFORM_SEC = xPPC32_LINUX ; then
1386 mflag_secondary=$FLAG_M32
1387elif test x$VG_PLATFORM_SEC = xPPC32_AIX5 ; then
1388 mflag_secondary=-q32
1389fi
1390
1391
sewardj0ad46092006-03-02 17:09:16 +00001392AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001393 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001394 MPI_CC=$withval
1395)
sewardj03d86f22006-10-17 00:57:24 +00001396AC_SUBST(MPI_CC)
1397
1398## See if MPI_CC works for the primary target
1399##
1400AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001401saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001402saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001403CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001404CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001405AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001406#include <mpi.h>
1407#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001408],[
1409 int r = MPI_Init(NULL,NULL);
1410 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1411 return r;
1412], [
sewardj03d86f22006-10-17 00:57:24 +00001413ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001414AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001415], [
sewardj03d86f22006-10-17 00:57:24 +00001416ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001417AC_MSG_RESULT([no])
1418])
sewardj0ad46092006-03-02 17:09:16 +00001419CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001420CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001421AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001422
sewardj03d86f22006-10-17 00:57:24 +00001423## See if MPI_CC works for the secondary target. Complication: what if
1424## there is no secondary target? We need this to then fail.
1425## Kludge this by making MPI_CC something which will surely fail in
1426## such a case.
1427##
1428AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1429saved_CC=$CC
1430saved_CFLAGS=$CFLAGS
1431if test x$VG_PLATFORM_SEC = x ; then
1432 CC="$MPI_CC this will surely fail"
1433else
1434 CC=$MPI_CC
1435fi
1436CFLAGS=$mflag_secondary
1437AC_TRY_LINK([
1438#include <mpi.h>
1439#include <stdio.h>
1440],[
1441 int r = MPI_Init(NULL,NULL);
1442 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1443 return r;
1444], [
1445ac_have_mpi2_sec=yes
1446AC_MSG_RESULT([yes, $MPI_CC])
1447], [
1448ac_have_mpi2_sec=no
1449AC_MSG_RESULT([no])
1450])
1451CC=$saved_CC
1452CFLAGS=$saved_CFLAGS
1453AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001454
1455
sewardj493c4ef2008-12-13 16:45:19 +00001456# There now follow some tests for QtCore, Boost, and OpenMP. These
1457# tests are present because Drd has some regression tests that use
1458# these packages. All regression test programs all compiled only
1459# for the primary target. And so it is important that the configure
1460# checks that follow, use the correct -m32 or -m64 flag for the
1461# primary target (called $mflag_primary). Otherwise, we can end up
1462# in a situation (eg) where, on amd64-linux, the test for Boost checks
1463# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1464# only build (meaning, the primary target is x86-linux), the build
1465# of the regtest programs that use Boost fails, because they are
1466# build as 32-bit (IN THIS EXAMPLE).
1467#
1468# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1469# NEEDED BY THE REGRESSION TEST PROGRAMS.
1470
1471
bart21d3cfc2008-08-02 09:08:17 +00001472# The test below verifies whether the QtCore package been installed.
1473# This test works as follows:
1474# - If pkg-config was not installed at the time autogen.sh was run,
1475# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1476# autogen.sh. Augogen.sh will generate a configure script that prints
1477# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1478# - If pkg-config was installed at the time autogen.sh was run,
1479# the generated configure script will try to detect the presence of the
1480# Qt4 QtCore library by looking up compile and linker flags in the file
1481# called QtCore.pc.
1482# - pkg-config settings can be overridden via the configure variables
1483# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1484# configure script -- see also ./configure --help).
1485# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1486# the pkg-config executable is not present on the system on which the
1487# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001488
bart21d3cfc2008-08-02 09:08:17 +00001489ifdef(
1490 [PKG_CHECK_EXISTS],
1491 [PKG_CHECK_EXISTS(
1492 [QtCore],
1493 [
1494 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001495 # Paranoia: don't trust the result reported by pkg-config, but when
1496 # pkg-config reports that QtCore has been found, verify whether linking
1497 # programs with QtCore succeeds.
1498 AC_LANG(C++)
1499 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001500 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001501 AC_TRY_LINK(
1502 [#include <QMutex>],
1503 [QMutex Mutex;],
1504 [ac_have_qtcore=yes],
1505 [
1506 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1507 ac_have_qtcore=no
1508 ]
1509 )
1510 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001511 ],
1512 [
1513 ac_have_qtcore=no
1514 ]
1515 )
1516 ],
1517 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1518 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1519 [ac_have_qtcore=no]
1520)
bart41ac62a2008-07-07 16:58:03 +00001521
1522AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1523
1524
bart62f54e42008-07-28 11:35:10 +00001525# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1526# See also http://doc.trolltech.com/4.3/qmutex.html.
1527if test x$ac_have_qtcore = xyes; then
1528 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1529 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001530 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001531 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001532 AC_TRY_COMPILE([
1533 #include <QtCore/QMutex>
1534 ],
1535 [
1536 QMutex M;
1537 M.tryLock(1);
1538 M.unlock();
1539 return 0;
1540 ],
1541 [
1542 AC_MSG_RESULT([yes])
1543 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1544 ],
1545 [
1546 AC_MSG_RESULT([no])
1547 ])
bart21d3cfc2008-08-02 09:08:17 +00001548 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001549 AC_LANG(C)
1550fi
1551
1552
sewardj493c4ef2008-12-13 16:45:19 +00001553# Check whether the boost library 1.35 or later has been installed.
1554# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1555
1556AC_MSG_CHECKING([for boost])
1557
1558AC_LANG(C++)
1559safe_CXXFLAGS=$CXXFLAGS
1560CXXFLAGS="-lboost_thread-mt $mflag_primary"
1561
1562AC_LINK_IFELSE(
1563[
1564#include <boost/thread.hpp>
1565static void thread_func(void)
1566{ }
1567int main(int argc, char** argv)
1568{
1569 boost::thread t(thread_func);
1570 return 0;
1571}
1572],
1573[
1574ac_have_boost_1_35=yes
1575AC_SUBST([BOOST_CFLAGS], [])
1576AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1577AC_MSG_RESULT([yes])
1578], [
1579ac_have_boost_1_35=no
1580AC_MSG_RESULT([no])
1581])
1582
1583CXXFLAGS=$safe_CXXFLAGS
1584AC_LANG(C)
1585
1586AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1587
1588
1589# does this compiler support -fopenmp, does it have the include file
1590# <omp.h> and does it have libgomp ?
1591
1592AC_MSG_CHECKING([for OpenMP])
1593
1594safe_CFLAGS=$CFLAGS
1595CFLAGS="-fopenmp"
1596
1597AC_LINK_IFELSE(
1598[
1599#include <omp.h>
1600int main(int argc, char** argv)
1601{
1602 omp_set_dynamic(0);
1603 return 0;
1604}
1605],
1606[
1607ac_have_openmp=yes
1608AC_MSG_RESULT([yes])
1609], [
1610ac_have_openmp=no
1611AC_MSG_RESULT([no])
1612])
1613CFLAGS=$safe_CFLAGS
1614
1615AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1616
1617
sewardj80637752006-03-02 13:48:21 +00001618# -------------------- ok. We're done. --------------------
1619
gobrye721a522002-03-22 13:38:30 +00001620AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001621 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001622 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001623 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001624 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001625 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001626 docs/lib/Makefile
1627 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001628 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001629 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001630 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001631 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001632 perf/Makefile
1633 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001634 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001635 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001636 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001637 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001638 memcheck/Makefile
1639 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001640 memcheck/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001641 memcheck/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001642 memcheck/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001643 memcheck/tests/x86/Makefile
njn3b3b76d2009-01-19 03:44:19 +00001644 memcheck/tests/linux/Makefile
njna454ec02009-01-19 03:16:59 +00001645 memcheck/tests/x86-linux/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001646 memcheck/docs/Makefile
1647 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001648 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001649 cachegrind/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001650 cachegrind/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001651 cachegrind/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001652 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001653 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001654 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001655 callgrind/Makefile
1656 callgrind/callgrind_annotate
1657 callgrind/callgrind_control
1658 callgrind/tests/Makefile
1659 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001660 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001661 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001662 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001663 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001664 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001665 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001666 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001667 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001668 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001669 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001670 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001671 none/Makefile
1672 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001673 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001674 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001675 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001676 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +00001677 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001678 exp-omega/Makefile
1679 exp-omega/tests/Makefile
1680 exp-omega/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001681 exp-ptrcheck/Makefile
1682 exp-ptrcheck/tests/Makefile
1683 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001684 drd/Makefile
1685 drd/docs/Makefile
1686 drd/scripts/download-and-build-splash2
1687 drd/tests/Makefile
bart0b2b4622008-06-17 19:19:16 +00001688)
gobry3b777892002-04-04 09:18:39 +00001689
1690cat<<EOF
1691
sewardje95d94f2008-09-19 09:02:19 +00001692 configure.in: VG_ARCH_MAX = ${VG_ARCH_MAX}
1693 configure.in: VG_ARCH_PRI = ${VG_ARCH_PRI}
1694
1695 Primary build target: ${VG_PLATFORM_PRI}
1696 Secondary build target: ${VG_PLATFORM_SEC}
1697 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001698
gobry3b777892002-04-04 09:18:39 +00001699EOF