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