blob: af05dcae6bc2f8d826e68075ecdc9b909966aa27 [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
njna454ec02009-01-19 03:16:59 +0000404# Set up VGA_<arch>. Either one or two of these become defined.
405#
406AM_CONDITIONAL(VGA_X86,
407 test x$VG_PLATFORM_PRI = xX86_LINUX \
408 -o x$VG_PLATFORM_SEC = xX86_LINUX )
409AM_CONDITIONAL(VGA_AMD64,
410 test x$VG_PLATFORM_PRI = xAMD64_LINUX )
411AM_CONDITIONAL(VGA_PPC32,
412 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
413 -o x$VG_PLATFORM_SEC = xPPC32_LINUX \
414 -o x$VG_PLATFORM_PRI = xPPC32_AIX5 \
415 -o x$VG_PLATFORM_SEC = xPPC32_AIX5 )
416AM_CONDITIONAL(VGA_PPC64,
417 test x$VG_PLATFORM_PRI = xPPC64_LINUX \
418 -o x$VG_PLATFORM_PRI = xPPC64_AIX5 )
419
sewardj03d86f22006-10-17 00:57:24 +0000420# Set up VGP_<platform>. Either one or two of these become defined.
sewardj01262142006-01-04 01:20:28 +0000421#
sewardj03d86f22006-10-17 00:57:24 +0000422AM_CONDITIONAL(VGP_X86_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000423 test x$VG_PLATFORM_PRI = xX86_LINUX \
424 -o x$VG_PLATFORM_SEC = xX86_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000425AM_CONDITIONAL(VGP_AMD64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000426 test x$VG_PLATFORM_PRI = xAMD64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000427AM_CONDITIONAL(VGP_PPC32_LINUX,
sewardjbc692db2006-01-04 03:31:07 +0000428 test x$VG_PLATFORM_PRI = xPPC32_LINUX \
429 -o x$VG_PLATFORM_SEC = xPPC32_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000430AM_CONDITIONAL(VGP_PPC64_LINUX,
sewardj01262142006-01-04 01:20:28 +0000431 test x$VG_PLATFORM_PRI = xPPC64_LINUX)
sewardj03d86f22006-10-17 00:57:24 +0000432AM_CONDITIONAL(VGP_PPC32_AIX5,
433 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
434 -o x$VG_PLATFORM_SEC = xPPC32_AIX5)
435AM_CONDITIONAL(VGP_PPC64_AIX5,
436 test x$VG_PLATFORM_PRI = xPPC64_AIX5)
437
438# Similarly, set up VGO_<os>. Exactly one of these becomes defined.
439# Relies on the assumption that the primary and secondary targets are
440# for the same OS, so therefore only necessary to test the primary.
441#
442AM_CONDITIONAL(VGO_LINUX,
443 test x$VG_PLATFORM_PRI = xX86_LINUX \
444 -o x$VG_PLATFORM_PRI = xAMD64_LINUX \
445 -o x$VG_PLATFORM_PRI = xPPC32_LINUX \
446 -o x$VG_PLATFORM_PRI = xPPC64_LINUX)
447AM_CONDITIONAL(VGO_AIX5,
448 test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
449 -o x$VG_PLATFORM_PRI = xPPC64_AIX5)
450
451
452# Sometimes, in the Makefile.am-s, it's useful to know
453# whether or not there is a secondary target.
454#
455AM_CONDITIONAL(VGP_HAVE_SECONDARY,
456 test x$VG_PLATFORM_SEC != x)
tomfb7bcde2005-11-07 15:24:38 +0000457
tomb637bad2005-11-08 12:28:35 +0000458
sewardj01262142006-01-04 01:20:28 +0000459# This variable will collect the individual suppression files
460# depending on the results of autoconf
461DEFAULT_SUPP=""
sewardjde4a1d02002-03-22 01:27:54 +0000462AC_SUBST(DEFAULT_SUPP)
463
sewardj01262142006-01-04 01:20:28 +0000464
dirk07596a22008-04-25 11:33:30 +0000465GLIBC_VERSION=""
sewardjde4a1d02002-03-22 01:27:54 +0000466
sewardjde4a1d02002-03-22 01:27:54 +0000467AC_EGREP_CPP([GLIBC_22], [
468#include <features.h>
469#ifdef __GNU_LIBRARY__
470 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2)
471 GLIBC_22
472 #endif
473#endif
474],
dirk07596a22008-04-25 11:33:30 +0000475GLIBC_VERSION="2.2")
sewardjde4a1d02002-03-22 01:27:54 +0000476
sewardj08c7f012002-10-07 23:56:55 +0000477AC_EGREP_CPP([GLIBC_23], [
478#include <features.h>
479#ifdef __GNU_LIBRARY__
480 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 3)
481 GLIBC_23
482 #endif
483#endif
484],
dirk07596a22008-04-25 11:33:30 +0000485GLIBC_VERSION="2.3")
sewardj08c7f012002-10-07 23:56:55 +0000486
njn781dba52005-06-30 04:06:38 +0000487AC_EGREP_CPP([GLIBC_24], [
488#include <features.h>
489#ifdef __GNU_LIBRARY__
490 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 4)
491 GLIBC_24
492 #endif
493#endif
494],
dirk07596a22008-04-25 11:33:30 +0000495GLIBC_VERSION="2.4")
njn781dba52005-06-30 04:06:38 +0000496
dirkaece45c2006-10-12 08:17:49 +0000497AC_EGREP_CPP([GLIBC_25], [
498#include <features.h>
499#ifdef __GNU_LIBRARY__
500 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 5)
501 GLIBC_25
502 #endif
503#endif
504],
dirk07596a22008-04-25 11:33:30 +0000505GLIBC_VERSION="2.5")
dirkaece45c2006-10-12 08:17:49 +0000506
dirkc8bd0c52007-05-23 17:39:08 +0000507AC_EGREP_CPP([GLIBC_26], [
508#include <features.h>
509#ifdef __GNU_LIBRARY__
510 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 6)
511 GLIBC_26
512 #endif
513#endif
514],
dirk07596a22008-04-25 11:33:30 +0000515GLIBC_VERSION="2.6")
dirkc8bd0c52007-05-23 17:39:08 +0000516
sewardj68c80c12007-11-18 14:40:02 +0000517AC_EGREP_CPP([GLIBC_27], [
518#include <features.h>
519#ifdef __GNU_LIBRARY__
520 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 7)
521 GLIBC_27
522 #endif
523#endif
524],
dirk07596a22008-04-25 11:33:30 +0000525GLIBC_VERSION="2.7")
526
527AC_EGREP_CPP([GLIBC_28], [
528#include <features.h>
529#ifdef __GNU_LIBRARY__
530 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 8)
531 GLIBC_28
532 #endif
533#endif
534],
535GLIBC_VERSION="2.8")
sewardj68c80c12007-11-18 14:40:02 +0000536
dirkd2e31eb2008-11-19 23:58:36 +0000537AC_EGREP_CPP([GLIBC_29], [
538#include <features.h>
539#ifdef __GNU_LIBRARY__
540 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9)
541 GLIBC_29
542 #endif
543#endif
544],
545GLIBC_VERSION="2.9")
546
sewardj03d86f22006-10-17 00:57:24 +0000547AC_EGREP_CPP([AIX5_LIBC], [
548#include <standards.h>
549#if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
550 AIX5_LIBC
551#endif
552],
dirk07596a22008-04-25 11:33:30 +0000553GLIBC_VERSION="aix5")
daywalkere9212b32003-06-15 22:39:15 +0000554
dirk07596a22008-04-25 11:33:30 +0000555AC_MSG_CHECKING([the GLIBC_VERSION version])
sewardj03d86f22006-10-17 00:57:24 +0000556
dirk07596a22008-04-25 11:33:30 +0000557case "${GLIBC_VERSION}" in
sewardjde4a1d02002-03-22 01:27:54 +0000558 2.2)
559 AC_MSG_RESULT(2.2 family)
daywalker418c7482002-10-16 13:09:26 +0000560 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000561 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
562 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000563 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardjde4a1d02002-03-22 01:27:54 +0000564 ;;
565
sewardj08c7f012002-10-07 23:56:55 +0000566 2.3)
567 AC_MSG_RESULT(2.3 family)
daywalker418c7482002-10-16 13:09:26 +0000568 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000569 DEFAULT_SUPP="glibc-2.3.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}"
sewardj08c7f012002-10-07 23:56:55 +0000572 ;;
573
njn781dba52005-06-30 04:06:38 +0000574 2.4)
575 AC_MSG_RESULT(2.4 family)
576 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000577 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000578 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000579 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
njn781dba52005-06-30 04:06:38 +0000580 ;;
581
dirkaece45c2006-10-12 08:17:49 +0000582 2.5)
583 AC_MSG_RESULT(2.5 family)
584 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000585 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000586 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000587 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkaece45c2006-10-12 08:17:49 +0000588 ;;
dirkc8bd0c52007-05-23 17:39:08 +0000589 2.6)
590 AC_MSG_RESULT(2.6 family)
591 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
sewardj2c4f3dd2007-11-11 06:13:01 +0000592 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000593 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000594 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000595 ;;
596 2.7)
597 AC_MSG_RESULT(2.7 family)
598 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
dirk07596a22008-04-25 11:33:30 +0000599 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
sewardj68c80c12007-11-18 14:40:02 +0000600 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
tom0a0fcee2008-01-05 00:12:45 +0000601 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
dirkc8bd0c52007-05-23 17:39:08 +0000602 ;;
dirk07596a22008-04-25 11:33:30 +0000603 2.8)
604 AC_MSG_RESULT(2.8 family)
dirkeb939fc2008-04-27 20:38:47 +0000605 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
dirk07596a22008-04-25 11:33:30 +0000606 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
607 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
608 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
609 ;;
dirkd2e31eb2008-11-19 23:58:36 +0000610 2.9)
611 AC_MSG_RESULT(2.9 family)
612 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
613 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
614 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
615 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
616 ;;
sewardj03d86f22006-10-17 00:57:24 +0000617 aix5)
sewardj2f3bcd22006-12-12 01:38:15 +0000618 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
619 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 +0000620 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
621 ;;
dirkaece45c2006-10-12 08:17:49 +0000622
sewardjde4a1d02002-03-22 01:27:54 +0000623 *)
624 AC_MSG_RESULT(unsupported version)
dirkd2e31eb2008-11-19 23:58:36 +0000625 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.9])
dirk07596a22008-04-25 11:33:30 +0000626 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
sewardjde4a1d02002-03-22 01:27:54 +0000627 ;;
628esac
629
dirk07596a22008-04-25 11:33:30 +0000630AC_SUBST(GLIBC_VERSION)
sewardj535c50f2005-06-04 23:14:53 +0000631
sewardj414f3582008-07-18 20:46:00 +0000632
633# Add default suppressions for the X client libraries. Make no
634# attempt to detect whether such libraries are installed on the
635# build machine (or even if any X facilities are present); just
636# add the suppressions antidisirregardless.
637DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
638DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
gobrye721a522002-03-22 13:38:30 +0000639
sewardj5744c022008-10-19 18:58:13 +0000640# Add glibc and X11 suppressions for exp-ptrcheck
641DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
642
sewardj2e10a682003-04-07 19:36:41 +0000643
bart59e2f182008-04-28 16:22:53 +0000644# Check for CLOCK_MONOTONIC
645
646AC_MSG_CHECKING([for CLOCK_MONOTONIC])
647
648AC_TRY_COMPILE(
649[
650#include <time.h>
651], [
652 struct timespec t;
653 clock_gettime(CLOCK_MONOTONIC, &t);
654 return 0;
655],
656[
657AC_MSG_RESULT([yes])
658AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
659 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
660], [
661AC_MSG_RESULT([no])
662])
663
bartfea06922008-05-03 09:12:15 +0000664
665# Check for PTHREAD_MUTEX_ADAPTIVE_NP
666
667AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
668
669AC_TRY_COMPILE(
670[
671#define _GNU_SOURCE
672#include <pthread.h>
673], [
674 return (PTHREAD_MUTEX_ADAPTIVE_NP);
675],
676[
677AC_MSG_RESULT([yes])
678AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
679 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
680], [
681AC_MSG_RESULT([no])
682])
683
684
685# Check for PTHREAD_MUTEX_ERRORCHECK_NP
686
687AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
688
689AC_TRY_COMPILE(
690[
691#define _GNU_SOURCE
692#include <pthread.h>
693], [
694 return (PTHREAD_MUTEX_ERRORCHECK_NP);
695],
696[
697AC_MSG_RESULT([yes])
698AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
699 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
700], [
701AC_MSG_RESULT([no])
702])
703
704
705# Check for PTHREAD_MUTEX_RECURSIVE_NP
706
707AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
708
709AC_TRY_COMPILE(
710[
711#define _GNU_SOURCE
712#include <pthread.h>
713], [
714 return (PTHREAD_MUTEX_RECURSIVE_NP);
715],
716[
717AC_MSG_RESULT([yes])
718AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
719 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
720], [
721AC_MSG_RESULT([no])
722])
723
724
725# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
726
727AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
728
729AC_TRY_COMPILE(
730[
731#define _GNU_SOURCE
732#include <pthread.h>
733], [
734 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
735 return 0;
736],
737[
738AC_MSG_RESULT([yes])
739AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
740 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
741], [
742AC_MSG_RESULT([no])
743])
744
745
barte8900ff2008-10-13 19:22:35 +0000746# Check whether FILE has a member called _lock and whether it's a pointer.
747
748AC_MSG_CHECKING([for FILE::_lock])
749
750AC_TRY_COMPILE(
751[
752 #include <stdio.h>
753], [
754 void *p;
755 p = stdout->_lock;
756 return 0;
757], [
758AC_MSG_RESULT([yes])
759AC_DEFINE([HAVE_LIBC_FILE_LOCK], 1,
760 [Define to 1 if FILE has a member called _lock.])
761], [
762AC_MSG_RESULT([no])
763])
764
765
bart5e389f12008-04-05 12:53:15 +0000766# Check whether pthread_mutex_t has a member called __m_kind.
767
768AC_MSG_CHECKING([for pthread_mutex_t::__m_kind])
769
bart56730cd2008-05-11 06:41:46 +0000770AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000771[
bart56730cd2008-05-11 06:41:46 +0000772 #include <pthread.h>
773], [
bart5e389f12008-04-05 12:53:15 +0000774 pthread_mutex_t m;
775 return m.__m_kind;
bart56730cd2008-05-11 06:41:46 +0000776], [
bart5e389f12008-04-05 12:53:15 +0000777AC_MSG_RESULT([yes])
778AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND], 1,
779 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
780], [
781AC_MSG_RESULT([no])
782])
783
784
785# Check whether pthread_mutex_t has a member called __data.__kind.
786
787AC_MSG_CHECKING([for pthread_mutex_t::__data.__kind])
788
bart56730cd2008-05-11 06:41:46 +0000789AC_TRY_COMPILE(
bart5e389f12008-04-05 12:53:15 +0000790[
bart56730cd2008-05-11 06:41:46 +0000791#include <pthread.h>
792], [
bart5e389f12008-04-05 12:53:15 +0000793 pthread_mutex_t m;
794 return m.__data.__kind;
bart56730cd2008-05-11 06:41:46 +0000795], [
bart5e389f12008-04-05 12:53:15 +0000796AC_MSG_RESULT([yes])
797AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND], 1,
798 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
799], [
800AC_MSG_RESULT([no])
801])
802
803
bart62c370e2008-05-12 18:50:51 +0000804# does this compiler support -maltivec and does it have the include file
805# <altivec.h> ?
806
807AC_MSG_CHECKING([for Altivec])
808
809safe_CFLAGS=$CFLAGS
810CFLAGS="-maltivec"
811
812AC_TRY_COMPILE(
813[
814#include <altivec.h>
815], [
816 vector unsigned int v;
817],
818[
819ac_have_altivec=yes
820AC_MSG_RESULT([yes])
821], [
822ac_have_altivec=no
823AC_MSG_RESULT([no])
824])
825CFLAGS=$safe_CFLAGS
826
827AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
828AM_CONDITIONAL([HAVE_ALTIVEC_H], [test x$ac_have_altivec = xyes])
829
830
barta50aa8a2008-04-27 06:06:57 +0000831# Check for eventfd_t, eventfd() and eventfd_read()
832AC_MSG_CHECKING([for eventfd()])
833
834AC_TRY_LINK(
835[
836#include <sys/eventfd.h>
837], [
838 eventfd_t ev;
839 int fd;
840
841 fd = eventfd(5, 0);
842 eventfd_read(fd, &ev);
843 return 0;
844],
845[
846AC_MSG_RESULT([yes])
847AC_DEFINE([HAVE_EVENTFD], 1,
848 [Define to 1 if you have the `eventfd' function.])
849AC_DEFINE([HAVE_EVENTFD_READ], 1,
850 [Define to 1 if you have the `eventfd_read' function.])
851], [
852AC_MSG_RESULT([no])
853])
854
855
sewardj535c50f2005-06-04 23:14:53 +0000856# does this compiler support -m32 ?
857AC_MSG_CHECKING([if gcc accepts -m32])
858
859safe_CFLAGS=$CFLAGS
860CFLAGS="-m32"
861
862AC_TRY_COMPILE(, [
863int main () { return 0 ; }
864],
865[
866FLAG_M32="-m32"
867AC_MSG_RESULT([yes])
868], [
869FLAG_M32=""
870AC_MSG_RESULT([no])
871])
872CFLAGS=$safe_CFLAGS
873
874AC_SUBST(FLAG_M32)
875
876
sewardj03d86f22006-10-17 00:57:24 +0000877# does this compiler support -maix32 ?
878AC_MSG_CHECKING([if gcc accepts -maix32])
879
880safe_CFLAGS=$CFLAGS
881CFLAGS="-maix32"
882
883AC_TRY_COMPILE(, [
884int main () { return 0 ; }
885],
886[
887FLAG_MAIX32="-maix32"
888AC_MSG_RESULT([yes])
889], [
890FLAG_MAIX32=""
891AC_MSG_RESULT([no])
892])
893CFLAGS=$safe_CFLAGS
894
895AC_SUBST(FLAG_MAIX32)
896
897
sewardj01262142006-01-04 01:20:28 +0000898# does this compiler support -m64 ?
899AC_MSG_CHECKING([if gcc accepts -m64])
900
901safe_CFLAGS=$CFLAGS
902CFLAGS="-m64"
903
904AC_TRY_COMPILE(, [
905int main () { return 0 ; }
906],
907[
908FLAG_M64="-m64"
909AC_MSG_RESULT([yes])
910], [
911FLAG_M64=""
912AC_MSG_RESULT([no])
913])
914CFLAGS=$safe_CFLAGS
915
916AC_SUBST(FLAG_M64)
917
918
sewardj03d86f22006-10-17 00:57:24 +0000919# does this compiler support -maix64 ?
920AC_MSG_CHECKING([if gcc accepts -maix64])
921
922safe_CFLAGS=$CFLAGS
923CFLAGS="-maix64"
924
925AC_TRY_COMPILE(, [
926int main () { return 0 ; }
927],
928[
929FLAG_MAIX64="-maix64"
930AC_MSG_RESULT([yes])
931], [
932FLAG_MAIX64=""
933AC_MSG_RESULT([no])
934])
935CFLAGS=$safe_CFLAGS
936
937AC_SUBST(FLAG_MAIX64)
938
939
sewardj67f1fcc2005-07-03 10:41:02 +0000940# does this compiler support -mmmx ?
941AC_MSG_CHECKING([if gcc accepts -mmmx])
942
943safe_CFLAGS=$CFLAGS
944CFLAGS="-mmmx"
945
946AC_TRY_COMPILE(, [
947int main () { return 0 ; }
948],
949[
950FLAG_MMMX="-mmmx"
951AC_MSG_RESULT([yes])
952], [
953FLAG_MMMX=""
954AC_MSG_RESULT([no])
955])
956CFLAGS=$safe_CFLAGS
957
958AC_SUBST(FLAG_MMMX)
959
960
961# does this compiler support -msse ?
962AC_MSG_CHECKING([if gcc accepts -msse])
963
964safe_CFLAGS=$CFLAGS
965CFLAGS="-msse"
966
967AC_TRY_COMPILE(, [
968int main () { return 0 ; }
969],
970[
971FLAG_MSSE="-msse"
972AC_MSG_RESULT([yes])
973], [
974FLAG_MSSE=""
975AC_MSG_RESULT([no])
976])
977CFLAGS=$safe_CFLAGS
978
979AC_SUBST(FLAG_MSSE)
980
981
sewardj5b754b42002-06-03 22:53:35 +0000982# does this compiler support -mpreferred-stack-boundary=2 ?
983AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
984
daywalker3664f562003-10-17 13:43:46 +0000985safe_CFLAGS=$CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000986CFLAGS="-mpreferred-stack-boundary=2"
987
988AC_TRY_COMPILE(, [
sewardj5b754b42002-06-03 22:53:35 +0000989int main () { return 0 ; }
sewardj5b754b42002-06-03 22:53:35 +0000990],
991[
992PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
daywalker3664f562003-10-17 13:43:46 +0000993AC_MSG_RESULT([yes])
sewardj5b754b42002-06-03 22:53:35 +0000994], [
995PREFERRED_STACK_BOUNDARY=""
996AC_MSG_RESULT([no])
997])
daywalker3664f562003-10-17 13:43:46 +0000998CFLAGS=$safe_CFLAGS
sewardj5b754b42002-06-03 22:53:35 +0000999
1000AC_SUBST(PREFERRED_STACK_BOUNDARY)
1001
sewardj535c50f2005-06-04 23:14:53 +00001002
sewardjb5f6f512005-03-10 23:59:00 +00001003# does this compiler support -Wno-pointer-sign ?
bart56730cd2008-05-11 06:41:46 +00001004AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
sewardjb5f6f512005-03-10 23:59:00 +00001005
1006safe_CFLAGS=$CFLAGS
1007CFLAGS="-Wno-pointer-sign"
1008
1009AC_TRY_COMPILE(, [
1010int main () { return 0 ; }
1011],
1012[
1013no_pointer_sign=yes
1014AC_MSG_RESULT([yes])
1015], [
1016no_pointer_sign=no
1017AC_MSG_RESULT([no])
1018])
1019CFLAGS=$safe_CFLAGS
1020
1021if test x$no_pointer_sign = xyes; then
1022 CFLAGS="$CFLAGS -Wno-pointer-sign"
1023fi
1024
sewardj535c50f2005-06-04 23:14:53 +00001025
tom1e946682005-10-12 11:27:33 +00001026# does this compiler support -Wdeclaration-after-statement ?
bart56730cd2008-05-11 06:41:46 +00001027AC_MSG_CHECKING([if gcc accepts -Wdeclaration-after-statement])
tom1e946682005-10-12 11:27:33 +00001028
1029safe_CFLAGS=$CFLAGS
1030CFLAGS="-Wdeclaration-after-statement"
1031
1032AC_TRY_COMPILE(, [
1033int main () { return 0 ; }
1034],
1035[
tome9814c32005-10-12 11:30:43 +00001036declaration_after_statement=yes
sewardj72a547e2006-01-25 02:58:28 +00001037FLAG_WDECL_AFTER_STMT="-Wdeclaration-after-statement"
tom1e946682005-10-12 11:27:33 +00001038AC_MSG_RESULT([yes])
1039], [
tome9814c32005-10-12 11:30:43 +00001040declaration_after_statement=no
sewardj72a547e2006-01-25 02:58:28 +00001041FLAG_WDECL_AFTER_STMT=""
tom1e946682005-10-12 11:27:33 +00001042AC_MSG_RESULT([no])
1043])
1044CFLAGS=$safe_CFLAGS
1045
sewardj72a547e2006-01-25 02:58:28 +00001046AC_SUBST(FLAG_WDECL_AFTER_STMT)
1047
tome9814c32005-10-12 11:30:43 +00001048if test x$declaration_after_statement = xyes; then
tom1e946682005-10-12 11:27:33 +00001049 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1050fi
1051
sewardj00f1e622006-03-12 16:47:10 +00001052
bart9d865fa2008-06-23 12:11:49 +00001053# does this compiler support -Wno-format-zero-length ?
1054
1055AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1056
1057safe_CFLAGS=$CFLAGS
1058CFLAGS="-Wno-format-zero-length"
1059
1060AC_TRY_COMPILE(
1061[ ],
1062[
1063 return 0;
1064],
1065[
1066AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1067AC_MSG_RESULT([yes])
1068],
1069[
1070AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1071AC_MSG_RESULT([no])
1072])
1073CFLAGS=$safe_CFLAGS
1074
1075
bart56730cd2008-05-11 06:41:46 +00001076# does this compiler support -Wextra or the older -W ?
1077
1078AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1079
1080safe_CFLAGS=$CFLAGS
1081CFLAGS="-Wextra"
1082
1083AC_TRY_COMPILE(
1084[ ],
1085[
1086 return 0;
1087],
1088[
1089AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1090AC_MSG_RESULT([-Wextra])
1091], [
1092 CFLAGS="-W"
1093 AC_TRY_COMPILE(
1094 [ ],
1095 [
1096 return 0;
1097 ],
1098 [
1099 AC_SUBST([FLAG_W_EXTRA], [-W])
1100 AC_MSG_RESULT([-W])
1101 ], [
1102 AC_SUBST([FLAG_W_EXTRA], [])
1103 AC_MSG_RESULT([not supported])
1104 ])
1105])
1106CFLAGS=$safe_CFLAGS
1107
1108
sewardja72c26d2007-05-01 13:44:08 +00001109# does this compiler support -fno-stack-protector ?
bart56730cd2008-05-11 06:41:46 +00001110AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
sewardja72c26d2007-05-01 13:44:08 +00001111
1112safe_CFLAGS=$CFLAGS
1113CFLAGS="-fno-stack-protector"
1114
1115AC_TRY_COMPILE(, [
1116int main () { return 0 ; }
1117],
1118[
1119no_stack_protector=yes
1120FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1121AC_MSG_RESULT([yes])
1122], [
1123no_stack_protector=no
1124FLAG_FNO_STACK_PROTECTOR=""
1125AC_MSG_RESULT([no])
1126])
1127CFLAGS=$safe_CFLAGS
1128
1129AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1130
1131if test x$no_stack_protector = xyes; then
1132 CFLAGS="$CFLAGS -fno-stack-protector"
1133fi
1134
1135
bart56730cd2008-05-11 06:41:46 +00001136# does this compiler support --param inline-unit-growth=... ?
1137
1138AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1139
1140safe_CFLAGS=$CFLAGS
1141CFLAGS="--param inline-unit-growth=900"
1142
1143AC_TRY_COMPILE(
1144[ ],
1145[
1146 return 0;
1147],
1148[
1149AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1150 ["--param inline-unit-growth=900"])
1151AC_MSG_RESULT([yes])
1152], [
1153AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1154AC_MSG_RESULT([no])
1155])
1156CFLAGS=$safe_CFLAGS
1157
1158
tomd55121e2005-12-19 12:40:13 +00001159# does this compiler support __builtin_expect?
1160AC_MSG_CHECKING([if gcc supports __builtin_expect])
bart56730cd2008-05-11 06:41:46 +00001161
tomd55121e2005-12-19 12:40:13 +00001162AC_TRY_LINK(, [
1163return __builtin_expect(1, 1) ? 1 : 0
1164],
1165[
1166ac_have_builtin_expect=yes
1167AC_MSG_RESULT([yes])
1168], [
1169ac_have_builtin_expect=no
1170AC_MSG_RESULT([no])
1171])
1172if test x$ac_have_builtin_expect = xyes ; then
1173 AC_DEFINE(HAVE_BUILTIN_EXPECT, 1, [Define to 1 if gcc supports __builtin_expect.])
1174fi
1175
tom1e946682005-10-12 11:27:33 +00001176
bartcd529dc2008-06-26 08:43:12 +00001177# does this compiler have built-in functions for atomic memory access ?
1178AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1179
1180AC_TRY_LINK(,
1181[
1182 int variable = 1;
bart99ae6102008-09-21 11:24:00 +00001183 return (__sync_bool_compare_and_swap(&variable, 1, 2)
bartd5a131f2008-12-21 16:09:03 +00001184 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
bartcd529dc2008-06-26 08:43:12 +00001185],
1186[
1187 AC_MSG_RESULT([yes])
1188 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1189],
1190[
1191 AC_MSG_RESULT([no])
1192])
1193
1194
sewardj00f1e622006-03-12 16:47:10 +00001195# does the ppc assembler support "mtocrf" et al?
1196AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1197
1198AC_TRY_COMPILE(, [
sewardjdd4cbe12006-03-12 17:27:44 +00001199__asm__ __volatile__("mtocrf 4,0");
1200__asm__ __volatile__("mfocrf 0,4");
sewardj00f1e622006-03-12 16:47:10 +00001201],
1202[
1203ac_have_as_ppc_mftocrf=yes
1204AC_MSG_RESULT([yes])
1205], [
1206ac_have_as_ppc_mftocrf=no
1207AC_MSG_RESULT([no])
1208])
1209if test x$ac_have_as_ppc_mftocrf = xyes ; then
1210 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1211fi
1212
1213
sewardjf0aabf82007-03-22 00:24:21 +00001214# does the x86/amd64 assembler understand SSE3 instructions?
sewardjfa18a262007-03-22 12:13:13 +00001215# Note, this doesn't generate a C-level symbol. It generates a
1216# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
sewardjf0aabf82007-03-22 00:24:21 +00001217AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1218
1219AC_TRY_COMPILE(, [
1220 do { long long int x;
1221 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1222 while (0)
1223],
1224[
1225ac_have_as_sse3=yes
1226AC_MSG_RESULT([yes])
1227], [
1228ac_have_as_sse3=no
1229AC_MSG_RESULT([no])
1230])
sewardjfa18a262007-03-22 12:13:13 +00001231
1232AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
sewardjf0aabf82007-03-22 00:24:21 +00001233
1234
sewardj6d6da5b2008-02-09 12:07:40 +00001235# Ditto for SSSE3 instructions (note extra S)
1236# Note, this doesn't generate a C-level symbol. It generates a
1237# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1238AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1239
1240AC_TRY_COMPILE(, [
1241 do { long long int x;
1242 __asm__ __volatile__(
1243 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1244 while (0)
1245],
1246[
1247ac_have_as_ssse3=yes
1248AC_MSG_RESULT([yes])
1249], [
1250ac_have_as_ssse3=no
1251AC_MSG_RESULT([no])
1252])
1253
1254AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1255
1256
sewardjb5f6f512005-03-10 23:59:00 +00001257# Check for TLS support in the compiler and linker
bartca9f2ad2008-06-02 07:14:20 +00001258if test "x${cross_compiling}" = "xno"; then
1259# Native compilation: check whether running a program using TLS succeeds.
1260# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1261# succeeds but running programs using TLS fails.
1262AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1263 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1264 [vg_cv_tls=$enableval],
1265 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1266 [[return foo;]])],
1267 [vg_cv_tls=yes],
1268 [vg_cv_tls=no])])])
1269else
1270# Cross-compiling: check whether linking a program using TLS succeeds.
sewardjb5f6f512005-03-10 23:59:00 +00001271AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1272 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1273 [vg_cv_tls=$enableval],
bartcddeaf52008-05-25 15:58:11 +00001274 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
sewardjb5f6f512005-03-10 23:59:00 +00001275 [[return foo;]])],
1276 [vg_cv_tls=yes],
1277 [vg_cv_tls=no])])])
bartca9f2ad2008-06-02 07:14:20 +00001278fi
sewardjb5f6f512005-03-10 23:59:00 +00001279
1280if test "$vg_cv_tls" = yes; then
1281AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1282fi
sewardj5b754b42002-06-03 22:53:35 +00001283
sewardj535c50f2005-06-04 23:14:53 +00001284
bart62f54e42008-07-28 11:35:10 +00001285# Checks for C header files.
sewardjde4a1d02002-03-22 01:27:54 +00001286AC_HEADER_STDC
bartf5ceec82008-04-26 07:45:10 +00001287AC_CHECK_HEADERS([ \
bart1f2b1432009-01-16 12:06:54 +00001288 asm/unistd.h \
bartf5ceec82008-04-26 07:45:10 +00001289 endian.h \
1290 mqueue.h \
1291 sys/endian.h \
1292 sys/epoll.h \
1293 sys/eventfd.h \
bartce48fa92008-04-26 10:59:46 +00001294 sys/klog.h \
bartf5ceec82008-04-26 07:45:10 +00001295 sys/poll.h \
bart71bad292008-04-27 11:43:23 +00001296 sys/signal.h \
bartf5ceec82008-04-26 07:45:10 +00001297 sys/signalfd.h \
bart71bad292008-04-27 11:43:23 +00001298 sys/syscall.h \
1299 sys/time.h \
1300 sys/types.h \
bartf5ceec82008-04-26 07:45:10 +00001301 ])
sewardjde4a1d02002-03-22 01:27:54 +00001302
1303# Checks for typedefs, structures, and compiler characteristics.
sewardjde4a1d02002-03-22 01:27:54 +00001304AC_TYPE_UID_T
1305AC_TYPE_OFF_T
1306AC_TYPE_SIZE_T
1307AC_HEADER_TIME
1308
sewardj535c50f2005-06-04 23:14:53 +00001309
sewardjde4a1d02002-03-22 01:27:54 +00001310# Checks for library functions.
1311AC_FUNC_MEMCMP
1312AC_FUNC_MMAP
1313AC_TYPE_SIGNAL
1314
bart71bad292008-04-27 11:43:23 +00001315AC_CHECK_LIB([rt], [clock_gettime])
bart41ac62a2008-07-07 16:58:03 +00001316
bartf5ceec82008-04-26 07:45:10 +00001317AC_CHECK_FUNCS([ \
bart71bad292008-04-27 11:43:23 +00001318 clock_gettime\
bartf5ceec82008-04-26 07:45:10 +00001319 epoll_create \
1320 epoll_pwait \
bartf5ceec82008-04-26 07:45:10 +00001321 floor \
bartce48fa92008-04-26 10:59:46 +00001322 klogctl \
bartf5ceec82008-04-26 07:45:10 +00001323 mallinfo \
1324 memchr \
1325 memset \
1326 mkdir \
1327 ppoll \
bart05347a92008-10-06 06:33:16 +00001328 pthread_condattr_setclock \
bartf5ceec82008-04-26 07:45:10 +00001329 semtimedop \
1330 signalfd \
bart71bad292008-04-27 11:43:23 +00001331 syscall \
bartf5ceec82008-04-26 07:45:10 +00001332 strchr \
1333 strdup \
1334 strpbrk \
1335 strrchr \
1336 strstr \
1337 timerfd \
1338 utimensat \
1339 ])
sewardjde4a1d02002-03-22 01:27:54 +00001340
bart623eec32008-07-29 17:54:49 +00001341# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1342# libraries with any shared object and/or executable. This is NOT what we
1343# want for e.g. vgpreload_core-x86-linux.so
1344LIBS=""
sewardj80637752006-03-02 13:48:21 +00001345
sewardj03d86f22006-10-17 00:57:24 +00001346# Do we have a useable MPI setup on the primary and/or secondary targets?
1347# On Linux, by default, assumes mpicc and -m32/-m64
1348# On AIX, by default, assumes mpxlc and -q32/-q64
sewardje9fa5062006-03-12 18:29:18 +00001349# Note: this is a kludge in that it assumes the specified mpicc
sewardj03d86f22006-10-17 00:57:24 +00001350# understands -m32/-m64/-q32/-q64 regardless of what is specified using
1351# --with-mpicc=.
sewardj0ad46092006-03-02 17:09:16 +00001352MPI_CC="mpicc"
sewardj03d86f22006-10-17 00:57:24 +00001353if test x$VG_PLATFORM_PRI = xPPC32_AIX5 \
1354 -o x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
1355 MPI_CC="mpxlc"
1356fi
1357
sewardje9fa5062006-03-12 18:29:18 +00001358mflag_primary=
1359if test x$VG_PLATFORM_PRI = xX86_LINUX \
1360 -o x$VG_PLATFORM_PRI = xPPC32_LINUX ; then
1361 mflag_primary=$FLAG_M32
1362elif test x$VG_PLATFORM_PRI = xAMD64_LINUX \
1363 -o x$VG_PLATFORM_PRI = xPPC64_LINUX ; then
1364 mflag_primary=$FLAG_M64
sewardj03d86f22006-10-17 00:57:24 +00001365elif test x$VG_PLATFORM_PRI = xPPC32_AIX5 ; then
1366 mflag_primary=-q32
1367elif test x$VG_PLATFORM_PRI = xPPC64_AIX5 ; then
1368 mflag_primary=-q64
sewardje9fa5062006-03-12 18:29:18 +00001369fi
1370
sewardj03d86f22006-10-17 00:57:24 +00001371mflag_secondary=
1372if test x$VG_PLATFORM_SEC = xX86_LINUX \
1373 -o x$VG_PLATFORM_SEC = xPPC32_LINUX ; then
1374 mflag_secondary=$FLAG_M32
1375elif test x$VG_PLATFORM_SEC = xPPC32_AIX5 ; then
1376 mflag_secondary=-q32
1377fi
1378
1379
sewardj0ad46092006-03-02 17:09:16 +00001380AC_ARG_WITH(mpicc,
sewardjb70a6132006-05-27 21:14:09 +00001381 [ --with-mpicc= Specify name of MPI2-ised C compiler],
sewardj0ad46092006-03-02 17:09:16 +00001382 MPI_CC=$withval
1383)
sewardj03d86f22006-10-17 00:57:24 +00001384AC_SUBST(MPI_CC)
1385
1386## See if MPI_CC works for the primary target
1387##
1388AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
sewardj0ad46092006-03-02 17:09:16 +00001389saved_CC=$CC
sewardjde4f3842006-03-09 02:41:41 +00001390saved_CFLAGS=$CFLAGS
sewardj0ad46092006-03-02 17:09:16 +00001391CC=$MPI_CC
sewardje9fa5062006-03-12 18:29:18 +00001392CFLAGS=$mflag_primary
sewardjd3fcc642006-03-09 02:49:56 +00001393AC_TRY_LINK([
sewardj1a85e602006-03-08 15:26:10 +00001394#include <mpi.h>
1395#include <stdio.h>
sewardjde4f3842006-03-09 02:41:41 +00001396],[
1397 int r = MPI_Init(NULL,NULL);
1398 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1399 return r;
1400], [
sewardj03d86f22006-10-17 00:57:24 +00001401ac_have_mpi2_pri=yes
sewardj1a85e602006-03-08 15:26:10 +00001402AC_MSG_RESULT([yes, $MPI_CC])
sewardj80637752006-03-02 13:48:21 +00001403], [
sewardj03d86f22006-10-17 00:57:24 +00001404ac_have_mpi2_pri=no
sewardj80637752006-03-02 13:48:21 +00001405AC_MSG_RESULT([no])
1406])
sewardj0ad46092006-03-02 17:09:16 +00001407CC=$saved_CC
sewardjde4f3842006-03-09 02:41:41 +00001408CFLAGS=$saved_CFLAGS
sewardj03d86f22006-10-17 00:57:24 +00001409AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
sewardj80637752006-03-02 13:48:21 +00001410
sewardj03d86f22006-10-17 00:57:24 +00001411## See if MPI_CC works for the secondary target. Complication: what if
1412## there is no secondary target? We need this to then fail.
1413## Kludge this by making MPI_CC something which will surely fail in
1414## such a case.
1415##
1416AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1417saved_CC=$CC
1418saved_CFLAGS=$CFLAGS
1419if test x$VG_PLATFORM_SEC = x ; then
1420 CC="$MPI_CC this will surely fail"
1421else
1422 CC=$MPI_CC
1423fi
1424CFLAGS=$mflag_secondary
1425AC_TRY_LINK([
1426#include <mpi.h>
1427#include <stdio.h>
1428],[
1429 int r = MPI_Init(NULL,NULL);
1430 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1431 return r;
1432], [
1433ac_have_mpi2_sec=yes
1434AC_MSG_RESULT([yes, $MPI_CC])
1435], [
1436ac_have_mpi2_sec=no
1437AC_MSG_RESULT([no])
1438])
1439CC=$saved_CC
1440CFLAGS=$saved_CFLAGS
1441AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
sewardj80637752006-03-02 13:48:21 +00001442
1443
sewardj493c4ef2008-12-13 16:45:19 +00001444# There now follow some tests for QtCore, Boost, and OpenMP. These
1445# tests are present because Drd has some regression tests that use
1446# these packages. All regression test programs all compiled only
1447# for the primary target. And so it is important that the configure
1448# checks that follow, use the correct -m32 or -m64 flag for the
1449# primary target (called $mflag_primary). Otherwise, we can end up
1450# in a situation (eg) where, on amd64-linux, the test for Boost checks
1451# for usable 64-bit Boost facilities, but because we are doing a 32-bit
1452# only build (meaning, the primary target is x86-linux), the build
1453# of the regtest programs that use Boost fails, because they are
1454# build as 32-bit (IN THIS EXAMPLE).
1455#
1456# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1457# NEEDED BY THE REGRESSION TEST PROGRAMS.
1458
1459
bart21d3cfc2008-08-02 09:08:17 +00001460# The test below verifies whether the QtCore package been installed.
1461# This test works as follows:
1462# - If pkg-config was not installed at the time autogen.sh was run,
1463# the definition of the PKG_CHECK_EXISTS() macro will not be found by
1464# autogen.sh. Augogen.sh will generate a configure script that prints
1465# a warning about pkg-config and proceeds as if Qt4 has not been installed.
1466# - If pkg-config was installed at the time autogen.sh was run,
1467# the generated configure script will try to detect the presence of the
1468# Qt4 QtCore library by looking up compile and linker flags in the file
1469# called QtCore.pc.
1470# - pkg-config settings can be overridden via the configure variables
1471# QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1472# configure script -- see also ./configure --help).
1473# - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1474# the pkg-config executable is not present on the system on which the
1475# configure script is run.
bart41ac62a2008-07-07 16:58:03 +00001476
bart21d3cfc2008-08-02 09:08:17 +00001477ifdef(
1478 [PKG_CHECK_EXISTS],
1479 [PKG_CHECK_EXISTS(
1480 [QtCore],
1481 [
1482 PKG_CHECK_MODULES([QTCORE], [QtCore])
bart11fbd892008-09-21 15:00:58 +00001483 # Paranoia: don't trust the result reported by pkg-config, but when
1484 # pkg-config reports that QtCore has been found, verify whether linking
1485 # programs with QtCore succeeds.
1486 AC_LANG(C++)
1487 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001488 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
bart11fbd892008-09-21 15:00:58 +00001489 AC_TRY_LINK(
1490 [#include <QMutex>],
1491 [QMutex Mutex;],
1492 [ac_have_qtcore=yes],
1493 [
1494 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1495 ac_have_qtcore=no
1496 ]
1497 )
1498 CXXFLAGS="${safe_CXXFLAGS}"
bart21d3cfc2008-08-02 09:08:17 +00001499 ],
1500 [
1501 ac_have_qtcore=no
1502 ]
1503 )
1504 ],
1505 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1506 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1507 [ac_have_qtcore=no]
1508)
bart41ac62a2008-07-07 16:58:03 +00001509
1510AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1511
1512
bart62f54e42008-07-28 11:35:10 +00001513# Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1514# See also http://doc.trolltech.com/4.3/qmutex.html.
1515if test x$ac_have_qtcore = xyes; then
1516 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1517 AC_LANG(C++)
bart21d3cfc2008-08-02 09:08:17 +00001518 safe_CXXFLAGS="${CXXFLAGS}"
sewardj493c4ef2008-12-13 16:45:19 +00001519 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
bart62f54e42008-07-28 11:35:10 +00001520 AC_TRY_COMPILE([
1521 #include <QtCore/QMutex>
1522 ],
1523 [
1524 QMutex M;
1525 M.tryLock(1);
1526 M.unlock();
1527 return 0;
1528 ],
1529 [
1530 AC_MSG_RESULT([yes])
1531 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1532 ],
1533 [
1534 AC_MSG_RESULT([no])
1535 ])
bart21d3cfc2008-08-02 09:08:17 +00001536 CXXFLAGS="${safe_CXXFLAGS}"
bart62f54e42008-07-28 11:35:10 +00001537 AC_LANG(C)
1538fi
1539
1540
sewardj493c4ef2008-12-13 16:45:19 +00001541# Check whether the boost library 1.35 or later has been installed.
1542# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1543
1544AC_MSG_CHECKING([for boost])
1545
1546AC_LANG(C++)
1547safe_CXXFLAGS=$CXXFLAGS
1548CXXFLAGS="-lboost_thread-mt $mflag_primary"
1549
1550AC_LINK_IFELSE(
1551[
1552#include <boost/thread.hpp>
1553static void thread_func(void)
1554{ }
1555int main(int argc, char** argv)
1556{
1557 boost::thread t(thread_func);
1558 return 0;
1559}
1560],
1561[
1562ac_have_boost_1_35=yes
1563AC_SUBST([BOOST_CFLAGS], [])
1564AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1565AC_MSG_RESULT([yes])
1566], [
1567ac_have_boost_1_35=no
1568AC_MSG_RESULT([no])
1569])
1570
1571CXXFLAGS=$safe_CXXFLAGS
1572AC_LANG(C)
1573
1574AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1575
1576
1577# does this compiler support -fopenmp, does it have the include file
1578# <omp.h> and does it have libgomp ?
1579
1580AC_MSG_CHECKING([for OpenMP])
1581
1582safe_CFLAGS=$CFLAGS
1583CFLAGS="-fopenmp"
1584
1585AC_LINK_IFELSE(
1586[
1587#include <omp.h>
1588int main(int argc, char** argv)
1589{
1590 omp_set_dynamic(0);
1591 return 0;
1592}
1593],
1594[
1595ac_have_openmp=yes
1596AC_MSG_RESULT([yes])
1597], [
1598ac_have_openmp=no
1599AC_MSG_RESULT([no])
1600])
1601CFLAGS=$safe_CFLAGS
1602
1603AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1604
1605
sewardj80637752006-03-02 13:48:21 +00001606# -------------------- ok. We're done. --------------------
1607
gobrye721a522002-03-22 13:38:30 +00001608AC_OUTPUT(
sewardjde4a1d02002-03-22 01:27:54 +00001609 Makefile
njn25cac76cb2002-09-23 11:21:57 +00001610 valgrind.spec
muellerbddd6072003-11-19 21:50:07 +00001611 valgrind.pc
dirk07596a22008-04-25 11:33:30 +00001612 glibc-2.X.supp
njn254d542432002-09-23 16:09:39 +00001613 docs/Makefile
njn3e986b22004-11-30 10:43:45 +00001614 docs/lib/Makefile
1615 docs/images/Makefile
njnf7c00b12005-07-19 21:46:19 +00001616 docs/internals/Makefile
njn3e986b22004-11-30 10:43:45 +00001617 docs/xml/Makefile
njn254d542432002-09-23 16:09:39 +00001618 tests/Makefile
njnc2e7f482002-09-27 08:44:17 +00001619 tests/vg_regtest
njnec0c27a2005-12-10 23:11:28 +00001620 perf/Makefile
1621 perf/vg_perf
njn254d542432002-09-23 16:09:39 +00001622 include/Makefile
sewardj0f8881b2006-10-18 01:16:57 +00001623 include/vki/Makefile
njn7a6e7462002-11-09 17:53:30 +00001624 auxprogs/Makefile
njn25ab726032002-09-23 16:24:41 +00001625 coregrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001626 memcheck/Makefile
1627 memcheck/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001628 memcheck/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001629 memcheck/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001630 memcheck/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001631 memcheck/tests/x86/Makefile
njna454ec02009-01-19 03:16:59 +00001632 memcheck/tests/x86-linux/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001633 memcheck/docs/Makefile
1634 cachegrind/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001635 cachegrind/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001636 cachegrind/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001637 cachegrind/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001638 cachegrind/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001639 cachegrind/tests/x86/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001640 cachegrind/docs/Makefile
njnf2df9b52002-10-04 11:35:47 +00001641 cachegrind/cg_annotate
weidendoa17f2a32006-03-20 10:27:30 +00001642 callgrind/Makefile
1643 callgrind/callgrind_annotate
1644 callgrind/callgrind_control
1645 callgrind/tests/Makefile
1646 callgrind/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001647 helgrind/Makefile
njnf2df9b52002-10-04 11:35:47 +00001648 helgrind/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001649 helgrind/docs/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001650 massif/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001651 massif/tests/Makefile
njn734b8052007-11-01 04:40:37 +00001652 massif/perf/Makefile
nethercotec9f36922004-02-14 16:40:02 +00001653 massif/docs/Makefile
njnd5a8d242007-11-02 20:44:57 +00001654 massif/ms_print
njn25cac76cb2002-09-23 11:21:57 +00001655 lackey/Makefile
njnf2df9b52002-10-04 11:35:47 +00001656 lackey/tests/Makefile
njn83157fc2002-10-03 10:07:34 +00001657 lackey/docs/Makefile
njn25cac76cb2002-09-23 11:21:57 +00001658 none/Makefile
1659 none/tests/Makefile
njnc6168192004-11-29 13:54:10 +00001660 none/tests/amd64/Makefile
cerion85665ca2005-06-20 15:51:07 +00001661 none/tests/ppc32/Makefile
sewardj2c48c7b2005-11-29 13:05:56 +00001662 none/tests/ppc64/Makefile
njnc6168192004-11-29 13:54:10 +00001663 none/tests/x86/Makefile
njn9bc8c002002-10-02 13:49:13 +00001664 none/docs/Makefile
sewardj99a2ceb2007-11-09 12:30:36 +00001665 exp-omega/Makefile
1666 exp-omega/tests/Makefile
1667 exp-omega/docs/Makefile
sewardj9c606bd2008-09-18 18:12:50 +00001668 exp-ptrcheck/Makefile
1669 exp-ptrcheck/tests/Makefile
1670 exp-ptrcheck/docs/Makefile
bartccf17de2008-07-04 15:14:35 +00001671 drd/Makefile
1672 drd/docs/Makefile
1673 drd/scripts/download-and-build-splash2
1674 drd/tests/Makefile
bart0b2b4622008-06-17 19:19:16 +00001675)
gobry3b777892002-04-04 09:18:39 +00001676
1677cat<<EOF
1678
sewardje95d94f2008-09-19 09:02:19 +00001679 configure.in: VG_ARCH_MAX = ${VG_ARCH_MAX}
1680 configure.in: VG_ARCH_PRI = ${VG_ARCH_PRI}
1681
1682 Primary build target: ${VG_PLATFORM_PRI}
1683 Secondary build target: ${VG_PLATFORM_SEC}
1684 Default supp files: ${DEFAULT_SUPP}
gobry3b777892002-04-04 09:18:39 +00001685
gobry3b777892002-04-04 09:18:39 +00001686EOF
1687
1688cat<<EOF > default.supp
1689# This is a generated file, composed of the following suppression rules:
1690#
1691# ${DEFAULT_SUPP}
1692#
1693
1694EOF
1695
1696for file in ${DEFAULT_SUPP} ; do
1697 cat ${srcdir}/$file >> default.supp
1698done