blob: d81021d94bde4f9157f122a416f6f17e29c8fda5 [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
sewardj45f4e7c2005-09-27 19:20:21 +0000149AC_SUBST(VALT_LOAD_ADDRESS)
sewardjde4a1d02002-03-22 01:27:54 +0000150
gobrye721a522002-03-22 13:38:30 +0000151case "${host_cpu}" in
sewardjde4a1d02002-03-22 01:27:54 +0000152 i?86)
153 AC_MSG_RESULT([ok (${host_cpu})])
sewardje95d94f2008-09-19 09:02:19 +0000154 VG_ARCH_MAX="x86"
sewardjd7baad42006-05-20 01:13:38 +0000155 valt_load_address_normal="0x38000000"
156 valt_load_address_inner="0x28000000"
sewardjde4a1d02002-03-22 01:27:54 +0000157 ;;
158
njnfe408942004-11-23 17:52:24 +0000159 x86_64)
160 AC_MSG_RESULT([ok (${host_cpu})])
sewardje95d94f2008-09-19 09:02:19 +0000161 VG_ARCH_MAX="amd64"
sewardjd7baad42006-05-20 01:13:38 +0000162 valt_load_address_normal="0x38000000"
163 valt_load_address_inner="0x28000000"
njnfe408942004-11-23 17:52:24 +0000164 ;;
165
sewardj2c48c7b2005-11-29 13:05:56 +0000166 powerpc64)
sewardj03d86f22006-10-17 00:57:24 +0000167# This value can only happen on Linux, not on AIX
sewardj2c48c7b2005-11-29 13:05:56 +0000168 AC_MSG_RESULT([ok (${host_cpu})])
sewardje95d94f2008-09-19 09:02:19 +0000169 VG_ARCH_MAX="ppc64"
sewardjd7baad42006-05-20 01:13:38 +0000170 valt_load_address_normal="0x38000000"
171 valt_load_address_inner="0x28000000"
sewardj2c48c7b2005-11-29 13:05:56 +0000172 ;;
173
174 powerpc)
sewardj03d86f22006-10-17 00:57:24 +0000175# Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
176# Whereas in Linux that means only a 32-bit capable CPU.
cerion85665ca2005-06-20 15:51:07 +0000177 AC_MSG_RESULT([ok (${host_cpu})])
sewardj03d86f22006-10-17 00:57:24 +0000178 case "${host_os}" in
179 aix5.*)
sewardje95d94f2008-09-19 09:02:19 +0000180 VG_ARCH_MAX="ppc64"
sewardj03d86f22006-10-17 00:57:24 +0000181 ;;
182 *)
sewardje95d94f2008-09-19 09:02:19 +0000183 VG_ARCH_MAX="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000184 ;;
185 esac
sewardjd7baad42006-05-20 01:13:38 +0000186 valt_load_address_normal="0x38000000"
187 valt_load_address_inner="0x28000000"
nethercote9bcc9062004-10-13 13:50:01 +0000188 ;;
189
sewardjde4a1d02002-03-22 01:27:54 +0000190 *)
191 AC_MSG_RESULT([no (${host_cpu})])
nethercote81d5c662004-10-13 13:18:51 +0000192 AC_MSG_ERROR([Unsupported host architecture. Sorry])
sewardjde4a1d02002-03-22 01:27:54 +0000193 ;;
194esac
195
sewardj45f4e7c2005-09-27 19:20:21 +0000196# Check if this should be built as an inner Valgrind, to be run within
197# another Valgrind. Choose the load address accordingly.
sewardj86e992f2006-01-28 18:39:09 +0000198AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
199 [AC_ARG_ENABLE(inner,
200 [ --enable-inner enables self-hosting],
201 [vg_cv_inner=$enableval],
202 [vg_cv_inner=no])])
sewardj45f4e7c2005-09-27 19:20:21 +0000203if test "$vg_cv_inner" = yes; then
204 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
205 VALT_LOAD_ADDRESS=$valt_load_address_inner
206else
207 VALT_LOAD_ADDRESS=$valt_load_address_normal
208fi
209
sewardj86e992f2006-01-28 18:39:09 +0000210# Sometimes it's convenient to subvert the bi-arch build system and
211# just have a single build even though the underlying platform is
212# capable of both. Hence handle --enable-only64bit and
213# --enable-only32bit. Complain if both are issued :-)
214
215# Check if a 64-bit only build has been requested
216AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
217 [AC_ARG_ENABLE(only64bit,
218 [ --enable-only64bit do a 64-bit only build],
219 [vg_cv_only64bit=$enableval],
220 [vg_cv_only64bit=no])])
221
222# Check if a 32-bit only build has been requested
223AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
224 [AC_ARG_ENABLE(only32bit,
225 [ --enable-only32bit do a 32-bit only build],
226 [vg_cv_only32bit=$enableval],
227 [vg_cv_only32bit=no])])
228
229# Stay sane
230if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
231 AC_MSG_ERROR(
232 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
233fi
234
235
236
sewardjde4a1d02002-03-22 01:27:54 +0000237AC_MSG_CHECKING([for a supported OS])
nethercote888ecb72004-08-23 14:54:40 +0000238AC_SUBST(VG_OS)
sewardjde4a1d02002-03-22 01:27:54 +0000239
gobrye721a522002-03-22 13:38:30 +0000240case "${host_os}" in
mueller8c68e042004-01-03 15:21:14 +0000241 *linux*)
sewardjde4a1d02002-03-22 01:27:54 +0000242 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000243 VG_OS="linux"
mueller8c68e042004-01-03 15:21:14 +0000244
245 # Ok, this is linux. Check the kernel version
246 AC_MSG_CHECKING([for the kernel version])
247
248 kernel=`uname -r`
249
250 case "${kernel}" in
251 2.6.*)
252 AC_MSG_RESULT([2.6 family (${kernel})])
253 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
254 ;;
255
256 2.4.*)
257 AC_MSG_RESULT([2.4 family (${kernel})])
258 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
259 ;;
260
mueller8c68e042004-01-03 15:21:14 +0000261 *)
262 AC_MSG_RESULT([unsupported (${kernel})])
nethercote4fa681f2004-11-08 17:51:39 +0000263 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
mueller8c68e042004-01-03 15:21:14 +0000264 ;;
265 esac
266
267 ;;
268
sewardj03d86f22006-10-17 00:57:24 +0000269 aix5.1.*)
270 AC_MSG_RESULT([ok (${host_os})])
271 VG_OS="aix5"
272 ;;
273 aix5.2.*)
274 AC_MSG_RESULT([ok (${host_os})])
275 VG_OS="aix5"
276 ;;
277 aix5.3.*)
278 AC_MSG_RESULT([ok (${host_os})])
279 VG_OS="aix5"
280 ;;
281
mueller8c68e042004-01-03 15:21:14 +0000282 *freebsd*)
283 AC_MSG_RESULT([ok (${host_os})])
nethercote888ecb72004-08-23 14:54:40 +0000284 VG_OS="freebsd"
sewardjde4a1d02002-03-22 01:27:54 +0000285 ;;
286
287 *)
288 AC_MSG_RESULT([no (${host_os})])
mueller8c68e042004-01-03 15:21:14 +0000289 AC_MSG_ERROR([Valgrind is operating system specific. Sorry. Please consider doing a port.])
sewardjde4a1d02002-03-22 01:27:54 +0000290 ;;
291esac
292
tomd6398392006-06-07 17:44:36 +0000293# If we are building on a 64 bit platform test to see if the system
294# supports building 32 bit programs and disable 32 bit support if it
295# does not support building 32 bit programs
296
sewardje95d94f2008-09-19 09:02:19 +0000297case "$VG_ARCH_MAX-$VG_OS" in
tomd6398392006-06-07 17:44:36 +0000298 amd64-linux|ppc64-linux)
299 AC_MSG_CHECKING([for 32 bit build support])
300 safe_CFLAGS=$CFLAGS
301 CFLAGS="-m32"
302 AC_TRY_LINK(, [
303 int main () { return 0 ; }
304 ],
305 [
306 AC_MSG_RESULT([yes])
307 ], [
308 vg_cv_only64bit="yes"
309 AC_MSG_RESULT([no])
310 ])
311 CFLAGS=$safe_CFLAGS;;
312esac
313
314if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
315 AC_MSG_ERROR(
316 [--enable-only32bit was specified but system does not support 32 bit builds])
317fi
nethercote888ecb72004-08-23 14:54:40 +0000318
sewardj01262142006-01-04 01:20:28 +0000319# Establish VG_PLATFORM_PRI. This is the primary build target. The
320# entire system, including regression and performance tests, will be
sewardjbc692db2006-01-04 03:31:07 +0000321# built for this target.
sewardj01262142006-01-04 01:20:28 +0000322#
sewardjbc692db2006-01-04 03:31:07 +0000323# Also establish VG_PLATFORM_SEC, the secondary build target, if
sewardj01262142006-01-04 01:20:28 +0000324# possible. The system will also be built for this target, but not
sewardjbc692db2006-01-04 03:31:07 +0000325# the regression or performance tests.
sewardj01262142006-01-04 01:20:28 +0000326#
sewardje95d94f2008-09-19 09:02:19 +0000327# Also establish VG_ARCH_PRI, which is the arch for the primary
328# build target. The various makefiles building regression tests
329# sometimes need to see this.
sewardj01262142006-01-04 01:20:28 +0000330AC_MSG_CHECKING([for a supported CPU/OS combination])
nethercote888ecb72004-08-23 14:54:40 +0000331
sewardj01262142006-01-04 01:20:28 +0000332AC_SUBST(VG_PLATFORM_PRI)
333AC_SUBST(VG_PLATFORM_SEC)
sewardje95d94f2008-09-19 09:02:19 +0000334AC_SUBST(VG_ARCH_PRI)
sewardj01262142006-01-04 01:20:28 +0000335
sewardje95d94f2008-09-19 09:02:19 +0000336# By default, the primary arch is the same as the "max" arch, as
337# commented above (at the definition of VG_ARCH_MAX). We may choose
338# to downgrade it in the big case statement just below here, in the
339# case where we're building on a 64 bit machine but have been
340# requested only to do a 32 bit build.
341VG_ARCH_PRI=$VG_ARCH_MAX
342
343case "$VG_ARCH_MAX-$VG_OS" in
sewardj01262142006-01-04 01:20:28 +0000344 x86-linux)
345 VG_PLATFORM_PRI="X86_LINUX"
346 VG_PLATFORM_SEC=""
sewardj3e38ce02004-11-23 01:17:29 +0000347 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
sewardj01262142006-01-04 01:20:28 +0000348 ;;
349 amd64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000350 if test x$vg_cv_only64bit = xyes; then
351 VG_PLATFORM_PRI="AMD64_LINUX"
352 VG_PLATFORM_SEC=""
353 elif test x$vg_cv_only32bit = xyes; then
354 VG_PLATFORM_PRI="X86_LINUX"
355 VG_PLATFORM_SEC=""
sewardje95d94f2008-09-19 09:02:19 +0000356 VG_ARCH_PRI="x86"
sewardj86e992f2006-01-28 18:39:09 +0000357 else
358 VG_PLATFORM_PRI="AMD64_LINUX"
359 VG_PLATFORM_SEC="X86_LINUX"
360 fi
sewardj01262142006-01-04 01:20:28 +0000361 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
362 ;;
363 ppc32-linux)
364 VG_PLATFORM_PRI="PPC32_LINUX"
365 VG_PLATFORM_SEC=""
366 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
367 ;;
sewardj03d86f22006-10-17 00:57:24 +0000368 ppc64-aix5)
369 if test x$vg_cv_only64bit = xyes; then
370 VG_PLATFORM_PRI="PPC64_AIX5"
371 VG_PLATFORM_SEC=""
372 elif test x$vg_cv_only32bit = xyes; then
373 VG_PLATFORM_PRI="PPC32_AIX5"
374 VG_PLATFORM_SEC=""
sewardje95d94f2008-09-19 09:02:19 +0000375 VG_ARCH_PRI="ppc32"
sewardj03d86f22006-10-17 00:57:24 +0000376 else
377 VG_PLATFORM_PRI="PPC64_AIX5"
378 VG_PLATFORM_SEC="PPC32_AIX5"
379 fi
380 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
381 ;;
sewardj01262142006-01-04 01:20:28 +0000382 ppc64-linux)
sewardj86e992f2006-01-28 18:39:09 +0000383 if test x$vg_cv_only64bit = xyes; then
384 VG_PLATFORM_PRI="PPC64_LINUX"
385 VG_PLATFORM_SEC=""
386 elif test x$vg_cv_only32bit = xyes; then
387 VG_PLATFORM_PRI="PPC32_LINUX"
388 VG_PLATFORM_SEC=""
sewardje95d94f2008-09-19 09:02:19 +0000389 VG_ARCH_PRI="ppc32"
sewardj86e992f2006-01-28 18:39:09 +0000390 else
391 VG_PLATFORM_PRI="PPC64_LINUX"
392 VG_PLATFORM_SEC="PPC32_LINUX"
393 fi
sewardj01262142006-01-04 01:20:28 +0000394 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
395 ;;
nethercote888ecb72004-08-23 14:54:40 +0000396 *)
sewardj01262142006-01-04 01:20:28 +0000397 VG_PLATFORM_PRI="unknown"
398 VG_PLATFORM_SEC="unknown"
nethercote888ecb72004-08-23 14:54:40 +0000399 AC_MSG_RESULT([no (${host_cpu}-${host_os})])
sewardj3e38ce02004-11-23 01:17:29 +0000400 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
nethercote888ecb72004-08-23 14:54:40 +0000401 ;;
402esac
sewardjde4a1d02002-03-22 01:27:54 +0000403
sewardj03d86f22006-10-17 00:57:24 +0000404# Set up VGP_<platform>. Either one or two of these become defined.
sewardj01262142006-01-04 01:20:28 +0000405#
sewardj03d86f22006-10-17 00:57:24 +0000406AM_CONDITIONAL(VGP_X86_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000407 test x$VG_PLATFORM_PRI = xX86_LINUX \
408 -o x$VG_PLATFORM_SEC = xX86_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000409AM_CONDITIONAL(VGP_AMD64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000410 test x$VG_PLATFORM_PRI = xAMD64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000411AM_CONDITIONAL(VGP_PPC32_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000412 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
413 -o x$VG_PLATFORM_SEC = xPPC32_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000414AM_CONDITIONAL(VGP_PPC64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000415 test x$VG_PLATFORM_PRI = xPPC64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000416AM_CONDITIONAL(VGP_PPC32_AIX5,
417 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
418 -o x$VG_PLATFORM_SEC = xPPC32_AIX5)
419AM_CONDITIONAL(VGP_PPC64_AIX5,
420 test x$VG_PLATFORM_PRI = xPPC64_AIX5)
421
422# Similarly, set up VGO_<os>. Exactly one of these becomes defined.
423# Relies on the assumption that the primary and secondary targets are
424# for the same OS, so therefore only necessary to test the primary.
425#
426AM_CONDITIONAL(VGO_LINUX,
427 test x$VG_PLATFORM_PRI = xX86_LINUX \
428 -o x$VG_PLATFORM_PRI = xAMD64_LINUX \
429 -o x$VG_PLATFORM_PRI = xPPC32_LINUX \
430 -o x$VG_PLATFORM_PRI = xPPC64_LINUX)
431AM_CONDITIONAL(VGO_AIX5,
432 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
433 -o x$VG_PLATFORM_PRI = xPPC64_AIX5)
434
435
436# Sometimes, in the Makefile.am-s, it's useful to know
437# whether or not there is a secondary target.
438#
439AM_CONDITIONAL(VGP_HAVE_SECONDARY,
440 test x$VG_PLATFORM_SEC != x)
tomfb7bcde2005-11-07 15:24:38 +0000441
tomb637bad2005-11-08 12:28:35 +0000442
sewardj01262142006-01-04 01:20:28 +0000443# This variable will collect the individual suppression files
444# depending on the results of autoconf
445DEFAULT_SUPP=""
sewardjde4a1d02002-03-22 01:27:54 +0000446AC_SUBST(DEFAULT_SUPP)
447
sewardj01262142006-01-04 01:20:28 +0000448
dirk07596a22008-04-25 11:33:30 +0000449GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000450
sewardjde4a1d02002-03-22 01:27:54 +0000451AC_EGREP_CPP([GLIBC_22], [
452#include <features.h>
453#ifdef __GNU_LIBRARY__
454 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
455 GLIBC_22
456 #endif
457#endif
458],
dirk07596a22008-04-25 11:33:30 +0000459GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000460
sewardj08c7f012002-10-07 23:56:55 +0000461AC_EGREP_CPP([GLIBC_23], [
462#include <features.h>
463#ifdef __GNU_LIBRARY__
464 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
465 GLIBC_23
466 #endif
467#endif
468],
dirk07596a22008-04-25 11:33:30 +0000469GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000470
njn781dba52005-06-30 04:06:38 +0000471AC_EGREP_CPP([GLIBC_24], [
472#include <features.h>
473#ifdef __GNU_LIBRARY__
474 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
475 GLIBC_24
476 #endif
477#endif
478],
dirk07596a22008-04-25 11:33:30 +0000479GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000480
dirkaece45c2006-10-12 08:17:49 +0000481AC_EGREP_CPP([GLIBC_25], [
482#include <features.h>
483#ifdef __GNU_LIBRARY__
484 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
485 GLIBC_25
486 #endif
487#endif
488],
dirk07596a22008-04-25 11:33:30 +0000489GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000490
dirkc8bd0c52007-05-23 17:39:08 +0000491AC_EGREP_CPP([GLIBC_26], [
492#include <features.h>
493#ifdef __GNU_LIBRARY__
494 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
495 GLIBC_26
496 #endif
497#endif
498],
dirk07596a22008-04-25 11:33:30 +0000499GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000500
sewardj68c80c12007-11-18 14:40:02 +0000501AC_EGREP_CPP([GLIBC_27], [
502#include <features.h>
503#ifdef __GNU_LIBRARY__
504 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
505 GLIBC_27
506 #endif
507#endif
508],
dirk07596a22008-04-25 11:33:30 +0000509GLIBC_VERSION="2.7")
510
511AC_EGREP_CPP([GLIBC_28], [
512#include <features.h>
513#ifdef __GNU_LIBRARY__
514 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
515 GLIBC_28
516 #endif
517#endif
518],
519GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000520
dirkd2e31eb2008-11-19 23:58:36 +0000521AC_EGREP_CPP([GLIBC_29], [
522#include <features.h>
523#ifdef __GNU_LIBRARY__
524 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
525 GLIBC_29
526 #endif
527#endif
528],
529GLIBC_VERSION="2.9")
530
sewardj03d86f22006-10-17 00:57:24 +0000531AC_EGREP_CPP([AIX5_LIBC], [
532#include <standards.h>
533#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
534 AIX5_LIBC
535#endif
536],
dirk07596a22008-04-25 11:33:30 +0000537GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000538
dirk07596a22008-04-25 11:33:30 +0000539AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000540
dirk07596a22008-04-25 11:33:30 +0000541case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000542 2.2)
543 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000544 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000545 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
546 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000547 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000548 ;;
549
sewardj08c7f012002-10-07 23:56:55 +0000550 2.3)
551 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000552 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000553 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000554 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000555 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj08c7f012002-10-07 23:56:55 +0000556 ;;
557
njn781dba52005-06-30 04:06:38 +0000558 2.4)
559 AC_MSG_RESULT(2.4 family)
560 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000561 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000562 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000563 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000564 ;;
565
dirkaece45c2006-10-12 08:17:49 +0000566 2.5)
567 AC_MSG_RESULT(2.5 family)
568 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000569 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000570 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000571 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000572 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000573 2.6)
574 AC_MSG_RESULT(2.6 family)
575 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000576 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000577 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000578 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000579 ;;
580 2.7)
581 AC_MSG_RESULT(2.7 family)
582 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000583 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000584 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000585 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000586 ;;
dirk07596a22008-04-25 11:33:30 +0000587 2.8)
588 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000589 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000590 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
591 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
592 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
593 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000594 2.9)
595 AC_MSG_RESULT(2.9 family)
596 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
597 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
598 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
599 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
600 ;;
sewardj03d86f22006-10-17 00:57:24 +0000601 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000602 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
603 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 +0000604 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
605 ;;
dirkaece45c2006-10-12 08:17:49 +0000606
sewardjde4a1d02002-03-22 01:27:54 +0000607 *)
608 AC_MSG_RESULT(unsupported version)
dirkd2e31eb2008-11-19 23:58:36 +0000609 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.9])
dirk07596a22008-04-25 11:33:30 +0000610 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
sewardjde4a1d02002-03-22 01:27:54 +0000611 ;;
612esac
613
dirk07596a22008-04-25 11:33:30 +0000614AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000615
sewardj414f3582008-07-18 20:46:00 +0000616
617# Add default suppressions for the X client libraries. Make no
618# attempt to detect whether such libraries are installed on the
619# build machine (or even if any X facilities are present); just
620# add the suppressions antidisirregardless.
621DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
622DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000623
sewardj5744c022008-10-19 18:58:13 +0000624# Add glibc and X11 suppressions for exp-ptrcheck
625DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
626
sewardj2e10a682003-04-07 19:36:41 +0000627
bart59e2f182008-04-28 16:22:53 +0000628# Check for CLOCK_MONOTONIC
629
630AC_MSG_CHECKING([for CLOCK_MONOTONIC])
631
632AC_TRY_COMPILE(
633[
634#include <time.h>
635], [
636 struct timespec t;
637 clock_gettime(CLOCK_MONOTONIC, &t);
638 return 0;
639],
640[
641AC_MSG_RESULT([yes])
642AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
643 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
644], [
645AC_MSG_RESULT([no])
646])
647
bartfea06922008-05-03 09:12:15 +0000648
649# Check for PTHREAD_MUTEX_ADAPTIVE_NP
650
651AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
652
653AC_TRY_COMPILE(
654[
655#define _GNU_SOURCE
656#include <pthread.h>
657], [
658 return (PTHREAD_MUTEX_ADAPTIVE_NP);
659],
660[
661AC_MSG_RESULT([yes])
662AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
663 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
664], [
665AC_MSG_RESULT([no])
666])
667
668
669# Check for PTHREAD_MUTEX_ERRORCHECK_NP
670
671AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
672
673AC_TRY_COMPILE(
674[
675#define _GNU_SOURCE
676#include <pthread.h>
677], [
678 return (PTHREAD_MUTEX_ERRORCHECK_NP);
679],
680[
681AC_MSG_RESULT([yes])
682AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
683 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
684], [
685AC_MSG_RESULT([no])
686])
687
688
689# Check for PTHREAD_MUTEX_RECURSIVE_NP
690
691AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
692
693AC_TRY_COMPILE(
694[
695#define _GNU_SOURCE
696#include <pthread.h>
697], [
698 return (PTHREAD_MUTEX_RECURSIVE_NP);
699],
700[
701AC_MSG_RESULT([yes])
702AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
703 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
704], [
705AC_MSG_RESULT([no])
706])
707
708
709# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
710
711AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
712
713AC_TRY_COMPILE(
714[
715#define _GNU_SOURCE
716#include <pthread.h>
717], [
718 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
719 return 0;
720],
721[
722AC_MSG_RESULT([yes])
723AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
724 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
725], [
726AC_MSG_RESULT([no])
727])
728
729
barte8900ff2008-10-13 19:22:35 +0000730# Check whether FILE has a member called _lock and whether it's a pointer.
731
732AC_MSG_CHECKING([for FILE::_lock])
733
734AC_TRY_COMPILE(
735[
736 #include <stdio.h>
737], [
738 void *p;
739 p = stdout->_lock;
740 return 0;
741], [
742AC_MSG_RESULT([yes])
743AC_DEFINE([HAVE_LIBC_FILE_LOCK], 1,
744 [Define to 1 if FILE has a member called _lock.])
745], [
746AC_MSG_RESULT([no])
747])
748
749
bart5e389f12008-04-05 12:53:15 +0000750# Check whether pthread_mutex_t has a member called __m_kind.
751
752AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
753
bart56730cd2008-05-11 06:41:46 +0000754AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000755[
bart56730cd2008-05-11 06:41:46 +0000756 #include <pthread.h>
757], [
bart5e389f12008-04-05 12:53:15 +0000758 pthread_mutex_t m;
759 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000760], [
bart5e389f12008-04-05 12:53:15 +0000761AC_MSG_RESULT([yes])
762AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
763 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
764], [
765AC_MSG_RESULT([no])
766])
767
768
769# Check whether pthread_mutex_t has a member called __data.__kind.
770
771AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
772
bart56730cd2008-05-11 06:41:46 +0000773AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000774[
bart56730cd2008-05-11 06:41:46 +0000775#include <pthread.h>
776], [
bart5e389f12008-04-05 12:53:15 +0000777 pthread_mutex_t m;
778 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000779], [
bart5e389f12008-04-05 12:53:15 +0000780AC_MSG_RESULT([yes])
781AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
782 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
783], [
784AC_MSG_RESULT([no])
785])
786
787
bart62c370e2008-05-12 18:50:51 +0000788# does this compiler support -maltivec and does it have the include file
789# <altivec.h> ?
790
791AC_MSG_CHECKING([for Altivec])
792
793safe_CFLAGS=$CFLAGS
794CFLAGS="-maltivec"
795
796AC_TRY_COMPILE(
797[
798#include <altivec.h>
799], [
800 vector unsigned int v;
801],
802[
803ac_have_altivec=yes
804AC_MSG_RESULT([yes])
805], [
806ac_have_altivec=no
807AC_MSG_RESULT([no])
808])
809CFLAGS=$safe_CFLAGS
810
811AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
812AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
813
814
barta50aa8a2008-04-27 06:06:57 +0000815# Check for eventfd_t, eventfd() and eventfd_read()
816AC_MSG_CHECKING([for eventfd()])
817
818AC_TRY_LINK(
819[
820#include <sys/eventfd.h>
821], [
822 eventfd_t ev;
823 int fd;
824
825 fd = eventfd(5, 0);
826 eventfd_read(fd, &ev);
827 return 0;
828],
829[
830AC_MSG_RESULT([yes])
831AC_DEFINE([HAVE_EVENTFD], 1,
832 [Define to 1 if you have the `eventfd' function.])
833AC_DEFINE([HAVE_EVENTFD_READ], 1,
834 [Define to 1 if you have the `eventfd_read' function.])
835], [
836AC_MSG_RESULT([no])
837])
838
839
sewardj535c50f2005-06-04 23:14:53 +0000840# does this compiler support -m32 ?
841AC_MSG_CHECKING([if gcc accepts -m32])
842
843safe_CFLAGS=$CFLAGS
844CFLAGS="-m32"
845
846AC_TRY_COMPILE(, [
847int main () { return 0 ; }
848],
849[
850FLAG_M32="-m32"
851AC_MSG_RESULT([yes])
852], [
853FLAG_M32=""
854AC_MSG_RESULT([no])
855])
856CFLAGS=$safe_CFLAGS
857
858AC_SUBST(FLAG_M32)
859
860
sewardj03d86f22006-10-17 00:57:24 +0000861# does this compiler support -maix32 ?
862AC_MSG_CHECKING([if gcc accepts -maix32])
863
864safe_CFLAGS=$CFLAGS
865CFLAGS="-maix32"
866
867AC_TRY_COMPILE(, [
868int main () { return 0 ; }
869],
870[
871FLAG_MAIX32="-maix32"
872AC_MSG_RESULT([yes])
873], [
874FLAG_MAIX32=""
875AC_MSG_RESULT([no])
876])
877CFLAGS=$safe_CFLAGS
878
879AC_SUBST(FLAG_MAIX32)
880
881
sewardj01262142006-01-04 01:20:28 +0000882# does this compiler support -m64 ?
883AC_MSG_CHECKING([if gcc accepts -m64])
884
885safe_CFLAGS=$CFLAGS
886CFLAGS="-m64"
887
888AC_TRY_COMPILE(, [
889int main () { return 0 ; }
890],
891[
892FLAG_M64="-m64"
893AC_MSG_RESULT([yes])
894], [
895FLAG_M64=""
896AC_MSG_RESULT([no])
897])
898CFLAGS=$safe_CFLAGS
899
900AC_SUBST(FLAG_M64)
901
902
sewardj03d86f22006-10-17 00:57:24 +0000903# does this compiler support -maix64 ?
904AC_MSG_CHECKING([if gcc accepts -maix64])
905
906safe_CFLAGS=$CFLAGS
907CFLAGS="-maix64"
908
909AC_TRY_COMPILE(, [
910int main () { return 0 ; }
911],
912[
913FLAG_MAIX64="-maix64"
914AC_MSG_RESULT([yes])
915], [
916FLAG_MAIX64=""
917AC_MSG_RESULT([no])
918])
919CFLAGS=$safe_CFLAGS
920
921AC_SUBST(FLAG_MAIX64)
922
923
sewardj67f1fcc2005-07-03 10:41:02 +0000924# does this compiler support -mmmx ?
925AC_MSG_CHECKING([if gcc accepts -mmmx])
926
927safe_CFLAGS=$CFLAGS
928CFLAGS="-mmmx"
929
930AC_TRY_COMPILE(, [
931int main () { return 0 ; }
932],
933[
934FLAG_MMMX="-mmmx"
935AC_MSG_RESULT([yes])
936], [
937FLAG_MMMX=""
938AC_MSG_RESULT([no])
939])
940CFLAGS=$safe_CFLAGS
941
942AC_SUBST(FLAG_MMMX)
943
944
945# does this compiler support -msse ?
946AC_MSG_CHECKING([if gcc accepts -msse])
947
948safe_CFLAGS=$CFLAGS
949CFLAGS="-msse"
950
951AC_TRY_COMPILE(, [
952int main () { return 0 ; }
953],
954[
955FLAG_MSSE="-msse"
956AC_MSG_RESULT([yes])
957], [
958FLAG_MSSE=""
959AC_MSG_RESULT([no])
960])
961CFLAGS=$safe_CFLAGS
962
963AC_SUBST(FLAG_MSSE)
964
965
sewardj5b754b42002-06-03 22:53:35 +0000966# does this compiler support -mpreferred-stack-boundary=2 ?
967AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
968
daywalker3664f562003-10-17 13:43:46 +0000969safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000970CFLAGS="-mpreferred-stack-boundary=2"
971
972AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000973int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000974],
975[
976PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000977AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000978], [
979PREFERRED_STACK_BOUNDARY=""
980AC_MSG_RESULT([no])
981])
daywalker3664f562003-10-17 13:43:46 +0000982CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000983
984AC_SUBST(PREFERRED_STACK_BOUNDARY)
985
sewardj535c50f2005-06-04 23:14:53 +0000986
sewardjb5f6f512005-03-10 23:59:00 +0000987# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +0000988AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +0000989
990safe_CFLAGS=$CFLAGS
991CFLAGS="-Wno-pointer-sign"
992
993AC_TRY_COMPILE(, [
994int main () { return 0 ; }
995],
996[
997no_pointer_sign=yes
998AC_MSG_RESULT([yes])
999], [
1000no_pointer_sign=no
1001AC_MSG_RESULT([no])
1002])
1003CFLAGS=$safe_CFLAGS
1004
1005if test x$no_pointer_sign = xyes; then
1006 CFLAGS="$CFLAGS -Wno-pointer-sign"
1007fi
1008
sewardj535c50f2005-06-04 23:14:53 +00001009
tom1e946682005-10-12 11:27:33 +00001010# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001011AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001012
1013safe_CFLAGS=$CFLAGS
1014CFLAGS="-Wdeclaration-after-statement"
1015
1016AC_TRY_COMPILE(, [
1017int main () { return 0 ; }
1018],
1019[
tome9814c32005-10-12 11:30:43 +00001020declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001021FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001022AC_MSG_RESULT([yes])
1023], [
tome9814c32005-10-12 11:30:43 +00001024declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001025FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001026AC_MSG_RESULT([no])
1027])
1028CFLAGS=$safe_CFLAGS
1029
sewardj72a547e2006-01-25 02:58:28 +00001030AC_SUBST(FLAG_WDECL_AFTER_STMT)
1031
tome9814c32005-10-12 11:30:43 +00001032if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001033 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1034fi
1035
sewardj00f1e622006-03-12 16:47:10 +00001036
bart9d865fa2008-06-23 12:11:49 +00001037# does this compiler support -Wno-format-zero-length ?
1038
1039AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1040
1041safe_CFLAGS=$CFLAGS
1042CFLAGS="-Wno-format-zero-length"
1043
1044AC_TRY_COMPILE(
1045[ ],
1046[
1047 return 0;
1048],
1049[
1050AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1051AC_MSG_RESULT([yes])
1052],
1053[
1054AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1055AC_MSG_RESULT([no])
1056])
1057CFLAGS=$safe_CFLAGS
1058
1059
bart56730cd2008-05-11 06:41:46 +00001060# does this compiler support -Wextra or the older -W ?
1061
1062AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1063
1064safe_CFLAGS=$CFLAGS
1065CFLAGS="-Wextra"
1066
1067AC_TRY_COMPILE(
1068[ ],
1069[
1070 return 0;
1071],
1072[
1073AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1074AC_MSG_RESULT([-Wextra])
1075], [
1076 CFLAGS="-W"
1077 AC_TRY_COMPILE(
1078 [ ],
1079 [
1080 return 0;
1081 ],
1082 [
1083 AC_SUBST([FLAG_W_EXTRA], [-W])
1084 AC_MSG_RESULT([-W])
1085 ], [
1086 AC_SUBST([FLAG_W_EXTRA], [])
1087 AC_MSG_RESULT([not supported])
1088 ])
1089])
1090CFLAGS=$safe_CFLAGS
1091
1092
sewardja72c26d2007-05-01 13:44:08 +00001093# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001094AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001095
1096safe_CFLAGS=$CFLAGS
1097CFLAGS="-fno-stack-protector"
1098
1099AC_TRY_COMPILE(, [
1100int main () { return 0 ; }
1101],
1102[
1103no_stack_protector=yes
1104FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1105AC_MSG_RESULT([yes])
1106], [
1107no_stack_protector=no
1108FLAG_FNO_STACK_PROTECTOR=""
1109AC_MSG_RESULT([no])
1110])
1111CFLAGS=$safe_CFLAGS
1112
1113AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1114
1115if test x$no_stack_protector = xyes; then
1116 CFLAGS="$CFLAGS -fno-stack-protector"
1117fi
1118
1119
bart56730cd2008-05-11 06:41:46 +00001120# does this compiler support --param inline-unit-growth=... ?
1121
1122AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1123
1124safe_CFLAGS=$CFLAGS
1125CFLAGS="--param inline-unit-growth=900"
1126
1127AC_TRY_COMPILE(
1128[ ],
1129[
1130 return 0;
1131],
1132[
1133AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1134 ["--param inline-unit-growth=900"])
1135AC_MSG_RESULT([yes])
1136], [
1137AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1138AC_MSG_RESULT([no])
1139])
1140CFLAGS=$safe_CFLAGS
1141
1142
tomd55121e2005-12-19 12:40:13 +00001143# does this compiler support __builtin_expect?
1144AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001145
tomd55121e2005-12-19 12:40:13 +00001146AC_TRY_LINK(, [
1147return __builtin_expect(1, 1) ? 1 : 0
1148],
1149[
1150ac_have_builtin_expect=yes
1151AC_MSG_RESULT([yes])
1152], [
1153ac_have_builtin_expect=no
1154AC_MSG_RESULT([no])
1155])
1156if test x$ac_have_builtin_expect = xyes ; then
1157 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1158fi
1159
tom1e946682005-10-12 11:27:33 +00001160
bartcd529dc2008-06-26 08:43:12 +00001161# does this compiler have built-in functions for atomic memory access ?
1162AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1163
1164AC_TRY_LINK(,
1165[
1166 int variable = 1;
bart99ae6102008-09-21 11:24:00 +00001167 return (__sync_bool_compare_and_swap(&variable, 1, 2)
bartd5a131f2008-12-21 16:09:03 +00001168 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bartcd529dc2008-06-26 08:43:12 +00001169],
1170[
1171 AC_MSG_RESULT([yes])
1172 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1173],
1174[
1175 AC_MSG_RESULT([no])
1176])
1177
1178
sewardj00f1e622006-03-12 16:47:10 +00001179# does the ppc assembler support "mtocrf" et al?
1180AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1181
1182AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001183__asm__ __volatile__("mtocrf 4,0");
1184__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001185],
1186[
1187ac_have_as_ppc_mftocrf=yes
1188AC_MSG_RESULT([yes])
1189], [
1190ac_have_as_ppc_mftocrf=no
1191AC_MSG_RESULT([no])
1192])
1193if test x$ac_have_as_ppc_mftocrf = xyes ; then
1194 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1195fi
1196
1197
sewardjf0aabf82007-03-22 00:24:21 +00001198# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001199# Note, this doesn't generate a C-level symbol. It generates a
1200# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001201AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1202
1203AC_TRY_COMPILE(, [
1204 do { long long int x;
1205 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1206 while (0)
1207],
1208[
1209ac_have_as_sse3=yes
1210AC_MSG_RESULT([yes])
1211], [
1212ac_have_as_sse3=no
1213AC_MSG_RESULT([no])
1214])
sewardjfa18a262007-03-22 12:13:13 +00001215
1216AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001217
1218
sewardj6d6da5b2008-02-09 12:07:40 +00001219# Ditto for SSSE3 instructions (note extra S)
1220# Note, this doesn't generate a C-level symbol. It generates a
1221# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1222AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1223
1224AC_TRY_COMPILE(, [
1225 do { long long int x;
1226 __asm__ __volatile__(
1227 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1228 while (0)
1229],
1230[
1231ac_have_as_ssse3=yes
1232AC_MSG_RESULT([yes])
1233], [
1234ac_have_as_ssse3=no
1235AC_MSG_RESULT([no])
1236])
1237
1238AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1239
1240
sewardjb5f6f512005-03-10 23:59:00 +00001241# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001242if test "x${cross_compiling}" = "xno"; then
1243# Native compilation: check whether running a program using TLS succeeds.
1244# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1245# succeeds but running programs using TLS fails.
1246AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1247 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1248 [vg_cv_tls=$enableval],
1249 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1250 [[return foo;]])],
1251 [vg_cv_tls=yes],
1252 [vg_cv_tls=no])])])
1253else
1254# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001255AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1256 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1257 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001258 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001259 [[return foo;]])],
1260 [vg_cv_tls=yes],
1261 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001262fi
sewardjb5f6f512005-03-10 23:59:00 +00001263
1264if test "$vg_cv_tls" = yes; then
1265AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1266fi
sewardj5b754b42002-06-03 22:53:35 +00001267
sewardj535c50f2005-06-04 23:14:53 +00001268
bart62f54e42008-07-28 11:35:10 +00001269# Checks for C header files.
sewardjde4a1d02002-03-22 01:27:54 +00001270AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001271AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001272 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001273 endian.h \
1274 mqueue.h \
1275 sys/endian.h \
1276 sys/epoll.h \
1277 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001278 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001279 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001280 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001281 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001282 sys/syscall.h \
1283 sys/time.h \
1284 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001285 ])
sewardjde4a1d02002-03-22 01:27:54 +00001286
1287# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +00001288AC_TYPE_UID_T
1289AC_TYPE_OFF_T
1290AC_TYPE_SIZE_T
1291AC_HEADER_TIME
1292
sewardj535c50f2005-06-04 23:14:53 +00001293
sewardjde4a1d02002-03-22 01:27:54 +00001294# Checks for library functions.
1295AC_FUNC_MEMCMP
1296AC_FUNC_MMAP
1297AC_TYPE_SIGNAL
1298
bart71bad292008-04-27 11:43:23 +00001299AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001300
bartf5ceec82008-04-26 07:45:10 +00001301AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001302 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001303 epoll_create \
1304 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001305 floor \
bartce48fa92008-04-26 10:59:46 +00001306 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001307 mallinfo \
1308 memchr \
1309 memset \
1310 mkdir \
1311 ppoll \
bart05347a92008-10-06 06:33:16 +00001312 pthread_condattr_setclock \
bartf5ceec82008-04-26 07:45:10 +00001313 semtimedop \
1314 signalfd \
bart71bad292008-04-27 11:43:23 +00001315 syscall \
bartf5ceec82008-04-26 07:45:10 +00001316 strchr \
1317 strdup \
1318 strpbrk \
1319 strrchr \
1320 strstr \
1321 timerfd \
1322 utimensat \
1323 ])
sewardjde4a1d02002-03-22 01:27:54 +00001324
bart623eec32008-07-29 17:54:49 +00001325# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1326# libraries with any shared object and/or executable. This is NOT what we
1327# want for e.g. vgpreload_core-x86-linux.so
1328LIBS=""
sewardj80637752006-03-02 13:48:21 +00001329
sewardj03d86f22006-10-17 00:57:24 +00001330# Do we have a useable MPI setup on the primary and/or secondary targets?
1331# On Linux, by default, assumes mpicc and -m32/-m64
1332# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001333# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001334# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1335# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001336MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +00001337if test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
1338 -o x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
1339 MPI_CC="mpxlc"
1340fi
1341
sewardje9fa5062006-03-12 18:29:18 +00001342mflag_primary=
1343if test x$VG_PLATFORM_PRI = xX86_LINUX \
1344 -o x$VG_PLATFORM_PRI = xPPC32_LINUX ; then
1345 mflag_primary=$FLAG_M32
1346elif test x$VG_PLATFORM_PRI = xAMD64_LINUX \
1347 -o x$VG_PLATFORM_PRI = xPPC64_LINUX ; then
1348 mflag_primary=$FLAG_M64
sewardj03d86f22006-10-17 00:57:24 +00001349elif test x$VG_PLATFORM_PRI = xPPC32_AIX5 ; then
1350 mflag_primary=-q32
1351elif test x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
1352 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001353fi
1354
sewardj03d86f22006-10-17 00:57:24 +00001355mflag_secondary=
1356if test x$VG_PLATFORM_SEC = xX86_LINUX \
1357 -o x$VG_PLATFORM_SEC = xPPC32_LINUX ; then
1358 mflag_secondary=$FLAG_M32
1359elif test x$VG_PLATFORM_SEC = xPPC32_AIX5 ; then
1360 mflag_secondary=-q32
1361fi
1362
1363
sewardj0ad46092006-03-02 17:09:16 +00001364AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001365 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001366 MPI_CC=$withval
1367)
sewardj03d86f22006-10-17 00:57:24 +00001368AC_SUBST(MPI_CC)
1369
1370## See if MPI_CC works for the primary target
1371##
1372AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001373saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001374saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001375CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001376CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001377AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001378#include <mpi.h>
1379#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001380],[
1381 int r = MPI_Init(NULL,NULL);
1382 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1383 return r;
1384], [
sewardj03d86f22006-10-17 00:57:24 +00001385ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001386AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001387], [
sewardj03d86f22006-10-17 00:57:24 +00001388ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001389AC_MSG_RESULT([no])
1390])
sewardj0ad46092006-03-02 17:09:16 +00001391CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001392CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001393AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001394
sewardj03d86f22006-10-17 00:57:24 +00001395## See if MPI_CC works for the secondary target. Complication: what if
1396## there is no secondary target? We need this to then fail.
1397## Kludge this by making MPI_CC something which will surely fail in
1398## such a case.
1399##
1400AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1401saved_CC=$CC
1402saved_CFLAGS=$CFLAGS
1403if test x$VG_PLATFORM_SEC = x ; then
1404 CC="$MPI_CC this will surely fail"
1405else
1406 CC=$MPI_CC
1407fi
1408CFLAGS=$mflag_secondary
1409AC_TRY_LINK([
1410#include <mpi.h>
1411#include <stdio.h>
1412],[
1413 int r = MPI_Init(NULL,NULL);
1414 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1415 return r;
1416], [
1417ac_have_mpi2_sec=yes
1418AC_MSG_RESULT([yes, $MPI_CC])
1419], [
1420ac_have_mpi2_sec=no
1421AC_MSG_RESULT([no])
1422])
1423CC=$saved_CC
1424CFLAGS=$saved_CFLAGS
1425AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001426
1427
sewardj493c4ef2008-12-13 16:45:19 +00001428# There now follow some tests for QtCore, Boost, and OpenMP. These
1429# tests are present because Drd has some regression tests that use
1430# these packages. All regression test programs all compiled only
1431# for the primary target. And so it is important that the configure
1432# checks that follow, use the correct -m32 or -m64 flag for the
1433# primary target (called $mflag_primary). Otherwise, we can end up
1434# in a situation (eg) where, on amd64-linux, the test for Boost checks
1435# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1436# only build (meaning, the primary target is x86-linux), the build
1437# of the regtest programs that use Boost fails, because they are
1438# build as 32-bit (IN THIS EXAMPLE).
1439#
1440# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1441# NEEDED BY THE REGRESSION TEST PROGRAMS.
1442
1443
bart21d3cfc2008-08-02 09:08:17 +00001444# The test below verifies whether the QtCore package been installed.
1445# This test works as follows:
1446# - If pkg-config was not installed at the time autogen.sh was run,
1447# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1448# autogen.sh. Augogen.sh will generate a configure script that prints
1449# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1450# - If pkg-config was installed at the time autogen.sh was run,
1451# the generated configure script will try to detect the presence of the
1452# Qt4 QtCore library by looking up compile and linker flags in the file
1453# called QtCore.pc.
1454# - pkg-config settings can be overridden via the configure variables
1455# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1456# configure script -- see also ./configure --help).
1457# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1458# the pkg-config executable is not present on the system on which the
1459# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001460
bart21d3cfc2008-08-02 09:08:17 +00001461ifdef(
1462 [PKG_CHECK_EXISTS],
1463 [PKG_CHECK_EXISTS(
1464 [QtCore],
1465 [
1466 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001467 # Paranoia: don't trust the result reported by pkg-config, but when
1468 # pkg-config reports that QtCore has been found, verify whether linking
1469 # programs with QtCore succeeds.
1470 AC_LANG(C++)
1471 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001472 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001473 AC_TRY_LINK(
1474 [#include <QMutex>],
1475 [QMutex Mutex;],
1476 [ac_have_qtcore=yes],
1477 [
1478 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1479 ac_have_qtcore=no
1480 ]
1481 )
1482 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001483 ],
1484 [
1485 ac_have_qtcore=no
1486 ]
1487 )
1488 ],
1489 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1490 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1491 [ac_have_qtcore=no]
1492)
bart41ac62a2008-07-07 16:58:03 +00001493
1494AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1495
1496
bart62f54e42008-07-28 11:35:10 +00001497# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1498# See also http://doc.trolltech.com/4.3/qmutex.html.
1499if test x$ac_have_qtcore = xyes; then
1500 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1501 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001502 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001503 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001504 AC_TRY_COMPILE([
1505 #include <QtCore/QMutex>
1506 ],
1507 [
1508 QMutex M;
1509 M.tryLock(1);
1510 M.unlock();
1511 return 0;
1512 ],
1513 [
1514 AC_MSG_RESULT([yes])
1515 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1516 ],
1517 [
1518 AC_MSG_RESULT([no])
1519 ])
bart21d3cfc2008-08-02 09:08:17 +00001520 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001521 AC_LANG(C)
1522fi
1523
1524
sewardj493c4ef2008-12-13 16:45:19 +00001525# Check whether the boost library 1.35 or later has been installed.
1526# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1527
1528AC_MSG_CHECKING([for boost])
1529
1530AC_LANG(C++)
1531safe_CXXFLAGS=$CXXFLAGS
1532CXXFLAGS="-lboost_thread-mt $mflag_primary"
1533
1534AC_LINK_IFELSE(
1535[
1536#include <boost/thread.hpp>
1537static void thread_func(void)
1538{ }
1539int main(int argc, char** argv)
1540{
1541 boost::thread t(thread_func);
1542 return 0;
1543}
1544],
1545[
1546ac_have_boost_1_35=yes
1547AC_SUBST([BOOST_CFLAGS], [])
1548AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1549AC_MSG_RESULT([yes])
1550], [
1551ac_have_boost_1_35=no
1552AC_MSG_RESULT([no])
1553])
1554
1555CXXFLAGS=$safe_CXXFLAGS
1556AC_LANG(C)
1557
1558AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1559
1560
1561# does this compiler support -fopenmp, does it have the include file
1562# <omp.h> and does it have libgomp ?
1563
1564AC_MSG_CHECKING([for OpenMP])
1565
1566safe_CFLAGS=$CFLAGS
1567CFLAGS="-fopenmp"
1568
1569AC_LINK_IFELSE(
1570[
1571#include <omp.h>
1572int main(int argc, char** argv)
1573{
1574 omp_set_dynamic(0);
1575 return 0;
1576}
1577],
1578[
1579ac_have_openmp=yes
1580AC_MSG_RESULT([yes])
1581], [
1582ac_have_openmp=no
1583AC_MSG_RESULT([no])
1584])
1585CFLAGS=$safe_CFLAGS
1586
1587AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1588
1589
sewardj80637752006-03-02 13:48:21 +00001590# -------------------- ok. We're done. --------------------
1591
gobrye721a522002-03-22 13:38:30 +00001592AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001593 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001594 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001595 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001596 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001597 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001598 docs/lib/Makefile
1599 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001600 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001601 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001602 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001603 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001604 perf/Makefile
1605 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001606 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001607 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001608 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001609 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001610 memcheck/Makefile
1611 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001612 memcheck/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001613 memcheck/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001614 memcheck/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001615 memcheck/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001616 memcheck/docs/Makefile
1617 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001618 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001619 cachegrind/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001620 cachegrind/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001621 cachegrind/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001622 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001623 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001624 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001625 callgrind/Makefile
1626 callgrind/callgrind_annotate
1627 callgrind/callgrind_control
1628 callgrind/tests/Makefile
1629 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001630 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001631 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001632 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001633 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001634 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001635 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001636 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001637 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001638 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001639 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001640 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001641 none/Makefile
1642 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001643 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001644 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001645 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001646 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +00001647 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001648 exp-omega/Makefile
1649 exp-omega/tests/Makefile
1650 exp-omega/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001651 exp-ptrcheck/Makefile
1652 exp-ptrcheck/tests/Makefile
1653 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001654 drd/Makefile
1655 drd/docs/Makefile
1656 drd/scripts/download-and-build-splash2
1657 drd/tests/Makefile
bart0b2b4622008-06-17 19:19:16 +00001658)
gobry3b777892002-04-04 09:18:39 +00001659
1660cat<<EOF
1661
sewardje95d94f2008-09-19 09:02:19 +00001662 configure.in: VG_ARCH_MAX = ${VG_ARCH_MAX}
1663 configure.in: VG_ARCH_PRI = ${VG_ARCH_PRI}
1664
1665 Primary build target: ${VG_PLATFORM_PRI}
1666 Secondary build target: ${VG_PLATFORM_SEC}
1667 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001668
gobry3b777892002-04-04 09:18:39 +00001669EOF
1670
1671cat<<EOF > default.supp
1672# This is a generated file, composed of the following suppression rules:
1673#
1674# ${DEFAULT_SUPP}
1675#
1676
1677EOF
1678
1679for file in ${DEFAULT_SUPP} ; do
1680 cat ${srcdir}/$file >> default.supp
1681done