2 ##------------------------------------------------------------##
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.
8 ##------------------------------------------------------------##
10 # Process this file with autoconf to produce a configure script.
11 AC_INIT(Valgrind, 3.6.0.SVN, valgrind-users@lists.sourceforge.net)
12 AC_CONFIG_SRCDIR(coregrind/m_main.c)
13 AM_CONFIG_HEADER(config.h)
14 AM_INIT_AUTOMAKE([foreign])
18 #----------------------------------------------------------------------------
19 # Checks for various programs.
20 #----------------------------------------------------------------------------
21 CFLAGS="-Wno-long-long $CFLAGS"
28 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
29 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
30 # base (eg. most likely as Darwin-specific tests) we'll need one of the
32 # - put AC_PROG_OBJC in a Darwin-specific part of this file
33 # - Use AC_PROG_OBJC here and up the minimum autoconf version
34 # - Use the following, which is apparently equivalent:
35 # m4_ifdef([AC_PROG_OBJC],
37 # [AC_CHECK_TOOL([OBJC], [gcc])
39 # AC_SUBST([OBJCFLAGS])
42 # provide a very basic definition for AC_PROG_SED if it's not provided by
43 # autoconf (as e.g. in autoconf 2.59).
44 m4_ifndef([AC_PROG_SED],
45 [AC_DEFUN([AC_PROG_SED],
47 AC_CHECK_PROGS([SED],[gsed sed])])])
50 # If no AR variable was specified, look up the name of the archiver. Otherwise
51 # do not touch the AR variable.
52 if test "x$AR" = "x"; then
53 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
55 AC_ARG_VAR([AR],[Archiver command])
57 # Check for the compiler support
58 if test "${GCC}" != "yes" ; then
59 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
62 # figure out where perl lives
63 AC_PATH_PROG(PERL, perl)
65 # figure out where gdb lives
66 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
67 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
69 # some older automake's don't have it so try something on our own
70 ifdef([AM_PROG_AS],[AM_PROG_AS],
80 # Check if 'diff' supports -u (universal diffs) and use it if possible.
82 AC_MSG_CHECKING([for diff -u])
85 # Comparing two identical files results in 0, unless -u isn't supported (as
87 tmpfile="tmp-xxx-yyy-zzz"
89 if diff -u $tmpfile $tmpfile ; then
99 # We don't want gcc < 3.0
100 AC_MSG_CHECKING([for a supported version of gcc])
102 [gcc_version=`${CC} --version | head -n 1 | $SED 's/^[^0-9]*\([0-9.]*\).*$/\1/'`]
104 case "${gcc_version}" in
106 AC_MSG_RESULT([no (${gcc_version})])
107 AC_MSG_ERROR([please use a recent (>= gcc-3.0) version of gcc])
110 AC_MSG_RESULT([ok (${gcc_version})])
114 #----------------------------------------------------------------------------
115 # Arch/OS/platform tests.
116 #----------------------------------------------------------------------------
117 # We create a number of arch/OS/platform-related variables. We prefix them
118 # all with "VGCONF_" which indicates that they are defined at
119 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
120 # variables used when compiling C files.
124 AC_MSG_CHECKING([for a supported CPU])
126 # ARCH_MAX reflects the most that this CPU can do: for example if it
127 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
128 # Ditto for amd64. It is used for more configuration below, but is not used
130 case "${host_cpu}" in
132 AC_MSG_RESULT([ok (${host_cpu})])
137 AC_MSG_RESULT([ok (${host_cpu})])
142 # This value can only happen on Linux, not on AIX
143 AC_MSG_RESULT([ok (${host_cpu})])
148 # Complexity. 'powerpc' on AIX implies a 64-bit capable CPU.
149 # Whereas in Linux that means only a 32-bit capable CPU.
150 AC_MSG_RESULT([ok (${host_cpu})])
162 AC_MSG_RESULT([ok (${host_cpu})])
167 AC_MSG_RESULT([no (${host_cpu})])
168 AC_MSG_ERROR([Unsupported host architecture. Sorry])
172 #----------------------------------------------------------------------------
174 # Sometimes it's convenient to subvert the bi-arch build system and
175 # just have a single build even though the underlying platform is
176 # capable of both. Hence handle --enable-only64bit and
177 # --enable-only32bit. Complain if both are issued :-)
178 # [Actually, if either of these options are used, I think both get built,
179 # but only one gets installed. So if you use an in-place build, both can be
182 # Check if a 64-bit only build has been requested
183 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
184 [AC_ARG_ENABLE(only64bit,
185 [ --enable-only64bit do a 64-bit only build],
186 [vg_cv_only64bit=$enableval],
187 [vg_cv_only64bit=no])])
189 # Check if a 32-bit only build has been requested
190 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
191 [AC_ARG_ENABLE(only32bit,
192 [ --enable-only32bit do a 32-bit only build],
193 [vg_cv_only32bit=$enableval],
194 [vg_cv_only32bit=no])])
197 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
199 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
202 #----------------------------------------------------------------------------
204 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
205 # compilation of many C files via -VGO_$(VGCONF_OS) and
206 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
207 AC_MSG_CHECKING([for a supported OS])
214 AC_MSG_RESULT([ok (${host_os})])
217 # Ok, this is linux. Check the kernel version
218 AC_MSG_CHECKING([for the kernel version])
224 AC_MSG_RESULT([2.6 family (${kernel})])
225 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x])
229 AC_MSG_RESULT([2.4 family (${kernel})])
230 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
234 AC_MSG_RESULT([unsupported (${kernel})])
235 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
242 AC_MSG_RESULT([ok (${host_os})])
246 AC_MSG_RESULT([ok (${host_os})])
250 AC_MSG_RESULT([ok (${host_os})])
255 AC_MSG_RESULT([ok (${host_os})])
257 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
258 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
259 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
261 AC_MSG_CHECKING([for the kernel version])
264 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
265 # has only one relevant version, the OS version. The `uname` check
266 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
267 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard),
268 # and we don't know of an macros similar to __GLIBC__ to get that info.
270 # XXX: `uname -r` won't do the right thing for cross-compiles, but
271 # that's not a problem yet.
274 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
275 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
276 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
277 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
280 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
281 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
282 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
283 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
286 AC_MSG_RESULT([unsupported (${kernel})])
287 AC_MSG_ERROR([Valgrind works on Darwin 9.x and 10.x (Mac OS X 10.5 and 10.6)])
293 AC_MSG_RESULT([no (${host_os})])
294 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
298 #----------------------------------------------------------------------------
300 # If we are building on a 64 bit platform test to see if the system
301 # supports building 32 bit programs and disable 32 bit support if it
302 # does not support building 32 bit programs
304 case "$ARCH_MAX-$VGCONF_OS" in
305 amd64-linux|ppc64-linux)
306 AC_MSG_CHECKING([for 32 bit build support])
315 vg_cv_only64bit="yes"
318 CFLAGS=$safe_CFLAGS;;
321 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
323 [--enable-only32bit was specified but system does not support 32 bit builds])
326 #----------------------------------------------------------------------------
328 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
329 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
330 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
331 # above) will be "amd64" since that reflects the most that this cpu can do,
332 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
333 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
334 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
335 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
336 AC_SUBST(VGCONF_ARCH_PRI)
338 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
339 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
340 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
341 # It is empty if there is no secondary target.
342 AC_SUBST(VGCONF_ARCH_SEC)
344 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
345 # The entire system, including regression and performance tests, will be
346 # built for this target. The "_CAPS" indicates that the name is in capital
347 # letters, and it also uses '_' rather than '-' as a separator, because it's
348 # used to create various Makefile variables, which are all in caps by
349 # convention and cannot contain '-' characters. This is in contrast to
350 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
351 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
353 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
354 # Valgrind and tools will also be built for this target, but not the
355 # regression or performance tests.
357 # By default, the primary arch is the same as the "max" arch, as commented
358 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
359 # the big case statement just below here, in the case where we're building
360 # on a 64 bit machine but have been requested only to do a 32 bit build.
361 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
363 AC_MSG_CHECKING([for a supported CPU/OS combination])
365 # NB. The load address for a given platform may be specified in more
366 # than one place, in some cases, depending on whether we're doing a biarch,
367 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
368 # Be careful to give consistent values in all subcases. Also, all four
369 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
370 # even if it is to "0xUNSET".
372 case "$ARCH_MAX-$VGCONF_OS" in
374 VGCONF_ARCH_PRI="x86"
376 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
377 VGCONF_PLATFORM_SEC_CAPS=""
378 valt_load_address_pri_norml="0x38000000"
379 valt_load_address_pri_inner="0x28000000"
380 valt_load_address_sec_norml="0xUNSET"
381 valt_load_address_sec_inner="0xUNSET"
382 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
385 valt_load_address_sec_norml="0xUNSET"
386 valt_load_address_sec_inner="0xUNSET"
387 if test x$vg_cv_only64bit = xyes; then
388 VGCONF_ARCH_PRI="amd64"
390 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
391 VGCONF_PLATFORM_SEC_CAPS=""
392 valt_load_address_pri_norml="0x38000000"
393 valt_load_address_pri_inner="0x28000000"
394 elif test x$vg_cv_only32bit = xyes; then
395 VGCONF_ARCH_PRI="x86"
397 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
398 VGCONF_PLATFORM_SEC_CAPS=""
399 valt_load_address_pri_norml="0x38000000"
400 valt_load_address_pri_inner="0x28000000"
402 VGCONF_ARCH_PRI="amd64"
403 VGCONF_ARCH_SEC="x86"
404 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
405 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
406 valt_load_address_pri_norml="0x38000000"
407 valt_load_address_pri_inner="0x28000000"
408 valt_load_address_sec_norml="0x38000000"
409 valt_load_address_sec_inner="0x28000000"
411 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
414 VGCONF_ARCH_PRI="ppc32"
416 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
417 VGCONF_PLATFORM_SEC_CAPS=""
418 valt_load_address_pri_norml="0x38000000"
419 valt_load_address_pri_inner="0x28000000"
420 valt_load_address_sec_norml="0xUNSET"
421 valt_load_address_sec_inner="0xUNSET"
422 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
425 valt_load_address_pri_norml="0xUNSET"
426 valt_load_address_pri_inner="0xUNSET"
427 valt_load_address_sec_norml="0xUNSET"
428 valt_load_address_sec_inner="0xUNSET"
429 if test x$vg_cv_only64bit = xyes; then
430 VGCONF_ARCH_PRI="ppc64"
432 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
433 VGCONF_PLATFORM_SEC_CAPS=""
434 elif test x$vg_cv_only32bit = xyes; then
435 VGCONF_ARCH_PRI="ppc32"
437 VGCONF_PLATFORM_PRI_CAPS="PPC32_AIX5"
438 VGCONF_PLATFORM_SEC_CAPS=""
440 VGCONF_ARCH_PRI="ppc64"
441 VGCONF_ARCH_SEC="ppc32"
442 VGCONF_PLATFORM_PRI_CAPS="PPC64_AIX5"
443 VGCONF_PLATFORM_SEC_CAPS="PPC32_AIX5"
445 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
448 valt_load_address_sec_norml="0xUNSET"
449 valt_load_address_sec_inner="0xUNSET"
450 if test x$vg_cv_only64bit = xyes; then
451 VGCONF_ARCH_PRI="ppc64"
453 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
454 VGCONF_PLATFORM_SEC_CAPS=""
455 valt_load_address_pri_norml="0x38000000"
456 valt_load_address_pri_inner="0x28000000"
457 elif test x$vg_cv_only32bit = xyes; then
458 VGCONF_ARCH_PRI="ppc32"
460 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
461 VGCONF_PLATFORM_SEC_CAPS=""
462 valt_load_address_pri_norml="0x38000000"
463 valt_load_address_pri_inner="0x28000000"
465 VGCONF_ARCH_PRI="ppc64"
466 VGCONF_ARCH_SEC="ppc32"
467 VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
468 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
469 valt_load_address_pri_norml="0x38000000"
470 valt_load_address_pri_inner="0x28000000"
471 valt_load_address_sec_norml="0x38000000"
472 valt_load_address_sec_inner="0x28000000"
474 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
476 # Darwin gets identified as 32-bit even when it supports 64-bit.
477 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
478 # all Macs support both 32-bit and 64-bit, so we just build both. If
479 # someone has a really old 32-bit only machine they can (hopefully?)
480 # build with --enable-only32bit. See bug 243362.
481 x86-darwin|amd64-darwin)
483 valt_load_address_sec_norml="0xUNSET"
484 valt_load_address_sec_inner="0xUNSET"
485 if test x$vg_cv_only64bit = xyes; then
486 VGCONF_ARCH_PRI="amd64"
488 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
489 VGCONF_PLATFORM_SEC_CAPS=""
490 valt_load_address_pri_norml="0x138000000"
491 valt_load_address_pri_inner="0x128000000"
492 elif test x$vg_cv_only32bit = xyes; then
493 VGCONF_ARCH_PRI="x86"
495 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
496 VGCONF_PLATFORM_SEC_CAPS=""
497 VGCONF_ARCH_PRI_CAPS="x86"
498 valt_load_address_pri_norml="0x38000000"
499 valt_load_address_pri_inner="0x28000000"
501 VGCONF_ARCH_PRI="amd64"
502 VGCONF_ARCH_SEC="x86"
503 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
504 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
505 valt_load_address_pri_norml="0x138000000"
506 valt_load_address_pri_inner="0x128000000"
507 valt_load_address_sec_norml="0x38000000"
508 valt_load_address_sec_inner="0x28000000"
510 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
513 VGCONF_ARCH_PRI="arm"
514 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
515 VGCONF_PLATFORM_SEC_CAPS=""
516 valt_load_address_pri_norml="0x38000000"
517 valt_load_address_pri_inner="0x28000000"
518 valt_load_address_sec_norml="0xUNSET"
519 valt_load_address_sec_inner="0xUNSET"
520 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
523 VGCONF_ARCH_PRI="unknown"
524 VGCONF_ARCH_SEC="unknown"
525 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
526 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
527 valt_load_address_pri_norml="0xUNSET"
528 valt_load_address_pri_inner="0xUNSET"
529 valt_load_address_sec_norml="0xUNSET"
530 valt_load_address_sec_inner="0xUNSET"
531 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
532 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
536 #----------------------------------------------------------------------------
538 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
540 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
541 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
542 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
543 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
544 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
545 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
546 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
547 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
548 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
549 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
550 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX \
551 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
552 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 )
553 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
554 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
555 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 )
556 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
557 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
559 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
561 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
562 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
563 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
564 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
565 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
566 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
567 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
568 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
569 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
570 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
571 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
572 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
574 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5,
575 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
576 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5)
577 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5,
578 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
580 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
581 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
582 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
583 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
584 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
587 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
588 # Relies on the assumption that the primary and secondary targets are
589 # for the same OS, so therefore only necessary to test the primary.
590 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
591 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
592 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
593 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
594 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
595 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
596 AM_CONDITIONAL(VGCONF_OS_IS_AIX5,
597 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
598 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5)
599 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
600 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
601 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
604 # Sometimes, in the Makefile.am files, it's useful to know whether or not
605 # there is a secondary target.
606 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
607 test x$VGCONF_PLATFORM_SEC_CAPS != x)
610 #----------------------------------------------------------------------------
612 #----------------------------------------------------------------------------
614 # Check if this should be built as an inner Valgrind, to be run within
615 # another Valgrind. Choose the load address accordingly.
616 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
617 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
618 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
619 [AC_ARG_ENABLE(inner,
620 [ --enable-inner enables self-hosting],
621 [vg_cv_inner=$enableval],
623 if test "$vg_cv_inner" = yes; then
624 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
625 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
626 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
628 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
629 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
633 #----------------------------------------------------------------------------
634 # Libc and suppressions
635 #----------------------------------------------------------------------------
636 # This variable will collect the suppression files to be used.
637 AC_SUBST(DEFAULT_SUPP)
639 AC_CHECK_HEADER([features.h])
641 if test x$ac_cv_header_features_h = xyes; then
642 rm -f conftest.$ac_ext
643 cat <<_ACEOF >conftest.$ac_ext
644 #include <features.h>
645 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
646 glibc version is: __GLIBC__ __GLIBC_MINOR__
649 GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
652 AC_EGREP_CPP([AIX5_LIBC], [
653 #include <standards.h>
654 #if defined(_AIXVERSION_510) || defined(_AIXVERSION_520) || defined(_AIXVERSION_530)
658 GLIBC_VERSION="aix5")
660 # not really a version check
661 AC_EGREP_CPP([DARWIN_LIBC], [
662 #include <sys/cdefs.h>
663 #if defined(__DARWIN_VERS_1050)
667 GLIBC_VERSION="darwin")
669 AC_MSG_CHECKING([the GLIBC_VERSION version])
671 case "${GLIBC_VERSION}" in
673 AC_MSG_RESULT(2.2 family)
674 AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
675 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
676 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
677 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
681 AC_MSG_RESULT(2.3 family)
682 AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
683 DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
684 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
685 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
689 AC_MSG_RESULT(2.4 family)
690 AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
691 DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
692 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
693 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
697 AC_MSG_RESULT(2.5 family)
698 AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
699 DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
700 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
701 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
704 AC_MSG_RESULT(2.6 family)
705 AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
706 DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
707 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
708 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
711 AC_MSG_RESULT(2.7 family)
712 AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
713 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
714 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
715 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
718 AC_MSG_RESULT(2.8 family)
719 AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
720 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
721 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
722 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
725 AC_MSG_RESULT(2.9 family)
726 AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
727 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
728 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
729 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
732 AC_MSG_RESULT(2.10 family)
733 AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
734 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
735 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
736 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
739 AC_MSG_RESULT(2.11 family)
740 AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
741 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
742 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
743 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
746 AC_MSG_RESULT(2.12 family)
747 AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
748 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
749 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
750 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
753 AC_MSG_RESULT(AIX 5.1 or 5.2 or 5.3)
754 AC_DEFINE([AIX5_LIBC], 1, [Define to 1 if you're using AIX 5.1 or 5.2 or 5.3])
755 DEFAULT_SUPP="aix5libc.supp ${DEFAULT_SUPP}"
758 AC_MSG_RESULT(Darwin)
759 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
760 # DEFAULT_SUPP set by kernel version check above.
764 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
765 AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.12])
766 AC_MSG_ERROR([or AIX 5.1 or 5.2 or 5.3 GLIBC_VERSION])
767 AC_MSG_ERROR([or Darwin libc])
771 AC_SUBST(GLIBC_VERSION)
774 # Add default suppressions for the X client libraries. Make no
775 # attempt to detect whether such libraries are installed on the
776 # build machine (or even if any X facilities are present); just
777 # add the suppressions antidisirregardless.
778 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
779 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
781 # Add glibc and X11 suppressions for exp-ptrcheck
782 DEFAULT_SUPP="exp-ptrcheck.supp ${DEFAULT_SUPP}"
785 #----------------------------------------------------------------------------
786 # Checking for various library functions and other definitions
787 #----------------------------------------------------------------------------
789 # Check for CLOCK_MONOTONIC
791 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
798 clock_gettime(CLOCK_MONOTONIC, &t);
803 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
804 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
810 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
812 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
819 return (PTHREAD_MUTEX_ADAPTIVE_NP);
823 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
824 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
830 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
832 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
839 return (PTHREAD_MUTEX_ERRORCHECK_NP);
843 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
844 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
850 # Check for PTHREAD_MUTEX_RECURSIVE_NP
852 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
859 return (PTHREAD_MUTEX_RECURSIVE_NP);
863 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
864 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
870 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
872 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
879 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
884 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
885 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
891 # Check whether pthread_mutex_t has a member called __m_kind.
893 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
894 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
896 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
899 [#include <pthread.h>])
902 # Check whether pthread_mutex_t has a member called __data.__kind.
904 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
905 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
907 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
910 [#include <pthread.h>])
913 # does this compiler support -maltivec and does it have the include file
916 AC_MSG_CHECKING([for Altivec])
925 vector unsigned int v;
930 AC_DEFINE([HAS_ALTIVEC], 1,
931 [Define to 1 if gcc/as can do Altivec.])
938 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
941 # Check for pthread_create@GLIBC2.0
942 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
948 extern int pthread_create_glibc_2_0(void*, const void*,
949 void *(*)(void*), void*);
950 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
954 * Apparently on PowerPC linking this program succeeds and generates an
955 * executable with the undefined symbol pthread_create@GLIBC_2.0.
957 #error This test does not work properly on PowerPC.
959 pthread_create_glibc_2_0(0, 0, 0, 0);
964 ac_have_pthread_create_glibc_2_0=yes
966 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
967 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
969 ac_have_pthread_create_glibc_2_0=no
974 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
975 test x$ac_have_pthread_create_glibc_2_0 = xyes)
978 # Check for eventfd_t, eventfd() and eventfd_read()
979 AC_MSG_CHECKING([for eventfd()])
983 #include <sys/eventfd.h>
989 eventfd_read(fd, &ev);
994 AC_DEFINE([HAVE_EVENTFD], 1,
995 [Define to 1 if you have the `eventfd' function.])
996 AC_DEFINE([HAVE_EVENTFD_READ], 1,
997 [Define to 1 if you have the `eventfd_read' function.])
1003 #----------------------------------------------------------------------------
1004 # Checking for supported compiler flags.
1005 #----------------------------------------------------------------------------
1007 # does this compiler support -m32 ?
1008 AC_MSG_CHECKING([if gcc accepts -m32])
1018 AC_MSG_RESULT([yes])
1028 # does this compiler support -maix32 ?
1029 AC_MSG_CHECKING([if gcc accepts -maix32])
1038 FLAG_MAIX32="-maix32"
1039 AC_MSG_RESULT([yes])
1046 AC_SUBST(FLAG_MAIX32)
1049 # does this compiler support -m64 ?
1050 AC_MSG_CHECKING([if gcc accepts -m64])
1060 AC_MSG_RESULT([yes])
1070 # does this compiler support -maix64 ?
1071 AC_MSG_CHECKING([if gcc accepts -maix64])
1080 FLAG_MAIX64="-maix64"
1081 AC_MSG_RESULT([yes])
1088 AC_SUBST(FLAG_MAIX64)
1091 # does this compiler support -mmmx ?
1092 AC_MSG_CHECKING([if gcc accepts -mmmx])
1102 AC_MSG_RESULT([yes])
1112 # does this compiler support -msse ?
1113 AC_MSG_CHECKING([if gcc accepts -msse])
1123 AC_MSG_RESULT([yes])
1133 # does this compiler support -mpreferred-stack-boundary=2 ?
1134 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
1137 CFLAGS="-mpreferred-stack-boundary=2"
1143 PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
1144 AC_MSG_RESULT([yes])
1146 PREFERRED_STACK_BOUNDARY=""
1151 AC_SUBST(PREFERRED_STACK_BOUNDARY)
1154 # does this compiler support -Wno-pointer-sign ?
1155 AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
1158 CFLAGS="-Wno-pointer-sign"
1165 AC_MSG_RESULT([yes])
1172 if test x$no_pointer_sign = xyes; then
1173 CFLAGS="$CFLAGS -Wno-pointer-sign"
1177 # does this compiler support -Wno-empty-body ?
1179 AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
1182 CFLAGS="-Wno-empty-body"
1190 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
1191 AC_MSG_RESULT([yes])
1194 AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
1200 # does this compiler support -Wno-format-zero-length ?
1202 AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
1205 CFLAGS="-Wno-format-zero-length"
1213 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
1214 AC_MSG_RESULT([yes])
1217 AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
1223 # does this compiler support -Wno-uninitialized ?
1225 AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
1228 CFLAGS="-Wno-uninitialized"
1236 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
1237 AC_MSG_RESULT([yes])
1240 AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
1246 # does this compiler support -Wextra or the older -W ?
1248 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1259 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1260 AC_MSG_RESULT([-Wextra])
1269 AC_SUBST([FLAG_W_EXTRA], [-W])
1272 AC_SUBST([FLAG_W_EXTRA], [])
1273 AC_MSG_RESULT([not supported])
1279 # does this compiler support -fno-stack-protector ?
1280 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1283 CFLAGS="-fno-stack-protector"
1289 no_stack_protector=yes
1290 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1291 AC_MSG_RESULT([yes])
1293 no_stack_protector=no
1294 FLAG_FNO_STACK_PROTECTOR=""
1299 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1301 if test x$no_stack_protector = xyes; then
1302 CFLAGS="$CFLAGS -fno-stack-protector"
1306 # does this compiler support --param inline-unit-growth=... ?
1308 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1311 CFLAGS="--param inline-unit-growth=900"
1319 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1320 ["--param inline-unit-growth=900"])
1321 AC_MSG_RESULT([yes])
1323 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1329 # does the linker support -Wl,--build-id=none ? Note, it's
1330 # important that we test indirectly via whichever C compiler
1331 # is selected, rather than testing /usr/bin/ld or whatever
1334 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
1337 CFLAGS="-Wl,--build-id=none"
1340 [AC_LANG_PROGRAM([ ], [return 0;])],
1342 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1343 AC_MSG_RESULT([yes])
1345 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1351 # does the ppc assembler support "mtocrf" et al?
1352 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1355 __asm__ __volatile__("mtocrf 4,0");
1356 __asm__ __volatile__("mfocrf 0,4");
1359 ac_have_as_ppc_mftocrf=yes
1360 AC_MSG_RESULT([yes])
1362 ac_have_as_ppc_mftocrf=no
1365 if test x$ac_have_as_ppc_mftocrf = xyes ; then
1366 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1370 # does the x86/amd64 assembler understand SSE3 instructions?
1371 # Note, this doesn't generate a C-level symbol. It generates a
1372 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
1373 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1376 do { long long int x;
1377 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1382 AC_MSG_RESULT([yes])
1388 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
1391 # Ditto for SSSE3 instructions (note extra S)
1392 # Note, this doesn't generate a C-level symbol. It generates a
1393 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1394 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1397 do { long long int x;
1398 __asm__ __volatile__(
1399 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1403 ac_have_as_ssse3=yes
1404 AC_MSG_RESULT([yes])
1410 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1413 # Note: we're really checking the assembler-level support, not gcc's ;
1414 # C-level code might require the flag -mpclmul be passed to gcc (e.g. to
1415 # compile code which uses wmmintrin.h). Doesn't matter since tests also
1416 # use inline assembly directly
1417 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
1420 __asm__ __volatile__(
1421 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1425 ac_have_as_pclmulqdq=yes
1426 AC_MSG_RESULT([yes])
1428 ac_have_as_pclmulqdq=no
1432 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
1435 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
1437 AC_TRY_COMPILE([], [
1439 __asm__ __volatile__("lzcnt %rax,%rax");
1443 ac_have_as_lzcnt=yes
1444 AC_MSG_RESULT([yes])
1450 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
1453 # Check for TLS support in the compiler and linker
1454 if test "x${cross_compiling}" = "xno"; then
1455 # Native compilation: check whether running a program using TLS succeeds.
1456 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
1457 # succeeds but running programs using TLS fails.
1458 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1459 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1460 [vg_cv_tls=$enableval],
1461 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1466 # Cross-compiling: check whether linking a program using TLS succeeds.
1467 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
1468 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
1469 [vg_cv_tls=$enableval],
1470 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
1476 if test "$vg_cv_tls" = yes; then
1477 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
1481 #----------------------------------------------------------------------------
1482 # Checks for C header files.
1483 #----------------------------------------------------------------------------
1486 AC_CHECK_HEADERS([ \
1502 #----------------------------------------------------------------------------
1503 # Checks for typedefs, structures, and compiler characteristics.
1504 #----------------------------------------------------------------------------
1511 #----------------------------------------------------------------------------
1512 # Checks for library functions.
1513 #----------------------------------------------------------------------------
1518 AC_CHECK_LIB([rt], [clock_gettime])
1532 pthread_barrier_init \
1533 pthread_condattr_setclock \
1534 pthread_mutex_timedlock \
1535 pthread_rwlock_timedrdlock \
1536 pthread_rwlock_timedwrlock \
1553 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
1554 # libraries with any shared object and/or executable. This is NOT what we
1555 # want for e.g. vgpreload_core-x86-linux.so
1558 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
1559 [test x$ac_cv_func_pthread_barrier_init = xyes])
1560 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
1561 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
1562 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
1563 [test x$ac_cv_func_pthread_spin_lock = xyes])
1566 #----------------------------------------------------------------------------
1568 #----------------------------------------------------------------------------
1569 # Do we have a useable MPI setup on the primary and/or secondary targets?
1570 # On Linux, by default, assumes mpicc and -m32/-m64
1571 # On AIX, by default, assumes mpxlc and -q32/-q64
1572 # Note: this is a kludge in that it assumes the specified mpicc
1573 # understands -m32/-m64/-q32/-q64 regardless of what is specified using
1576 if test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 \
1577 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1582 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
1583 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX ; then
1584 mflag_primary=$FLAG_M32
1585 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
1586 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX ; then
1587 mflag_primary=$FLAG_M64
1588 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_AIX5 ; then
1590 elif test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_AIX5 ; then
1595 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
1596 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
1597 mflag_secondary=$FLAG_M32
1598 elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then
1599 mflag_secondary=-q32
1604 [ --with-mpicc= Specify name of MPI2-ised C compiler],
1609 ## See if MPI_CC works for the primary target
1611 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
1613 saved_CFLAGS=$CFLAGS
1615 CFLAGS=$mflag_primary
1620 int r = MPI_Init(NULL,NULL);
1621 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1624 ac_have_mpi2_pri=yes
1625 AC_MSG_RESULT([yes, $MPI_CC])
1631 CFLAGS=$saved_CFLAGS
1632 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
1634 ## See if MPI_CC works for the secondary target. Complication: what if
1635 ## there is no secondary target? We need this to then fail.
1636 ## Kludge this by making MPI_CC something which will surely fail in
1639 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
1641 saved_CFLAGS=$CFLAGS
1642 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
1643 CC="$MPI_CC this will surely fail"
1647 CFLAGS=$mflag_secondary
1652 int r = MPI_Init(NULL,NULL);
1653 r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
1656 ac_have_mpi2_sec=yes
1657 AC_MSG_RESULT([yes, $MPI_CC])
1663 CFLAGS=$saved_CFLAGS
1664 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
1667 #----------------------------------------------------------------------------
1668 # Other library checks
1669 #----------------------------------------------------------------------------
1670 # There now follow some tests for QtCore, Boost, and OpenMP. These
1671 # tests are present because Drd has some regression tests that use
1672 # these packages. All regression test programs all compiled only
1673 # for the primary target. And so it is important that the configure
1674 # checks that follow, use the correct -m32 or -m64 flag for the
1675 # primary target (called $mflag_primary). Otherwise, we can end up
1676 # in a situation (eg) where, on amd64-linux, the test for Boost checks
1677 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
1678 # only build (meaning, the primary target is x86-linux), the build
1679 # of the regtest programs that use Boost fails, because they are
1680 # build as 32-bit (IN THIS EXAMPLE).
1682 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
1683 # NEEDED BY THE REGRESSION TEST PROGRAMS.
1686 # The test below verifies whether the QtCore package been installed.
1687 # This test works as follows:
1688 # - If pkg-config was not installed at the time autogen.sh was run,
1689 # the definition of the PKG_CHECK_EXISTS() macro will not be found by
1690 # autogen.sh. Augogen.sh will generate a configure script that prints
1691 # a warning about pkg-config and proceeds as if Qt4 has not been installed.
1692 # - If pkg-config was installed at the time autogen.sh was run,
1693 # the generated configure script will try to detect the presence of the
1694 # Qt4 QtCore library by looking up compile and linker flags in the file
1696 # - pkg-config settings can be overridden via the configure variables
1697 # QTCORE_CFLAGS and QTCORE_LIBS (added by the pkg-config m4 macro's to the
1698 # configure script -- see also ./configure --help).
1699 # - The QTCORE_CFLAGS and QTCORE_LIBS configure variables can be used even if
1700 # the pkg-config executable is not present on the system on which the
1701 # configure script is run.
1708 PKG_CHECK_MODULES([QTCORE], [QtCore])
1709 # Paranoia: don't trust the result reported by pkg-config, but when
1710 # pkg-config reports that QtCore has been found, verify whether linking
1711 # programs with QtCore succeeds.
1713 safe_CXXFLAGS="${CXXFLAGS}"
1714 CXXFLAGS="${QTCORE_CFLAGS} ${QTCORE_LIBS} $mflag_primary"
1716 [#include <QMutex>],
1718 [ac_have_qtcore=yes],
1720 AC_MSG_WARN([Although pkg-config detected Qt4, linking Qt4 programs fails. Skipping Qt4.])
1724 CXXFLAGS="${safe_CXXFLAGS}"
1731 AC_MSG_WARN([pkg-config has not been installed or is too old.])
1732 AC_MSG_WARN([Detection of Qt4 will be skipped.])
1736 AM_CONDITIONAL([HAVE_QTCORE], [test x$ac_have_qtcore = xyes])
1739 # Test for QMutex::tryLock(int), which has been introduced in Qt 4.3.
1740 # See also http://doc.trolltech.com/4.3/qmutex.html.
1741 if test x$ac_have_qtcore = xyes; then
1742 AC_MSG_CHECKING([for Qt4 QMutex::tryLock(int)])
1744 safe_CXXFLAGS="${CXXFLAGS}"
1745 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1747 #include <QtCore/QMutex>
1756 AC_MSG_RESULT([yes])
1757 AC_DEFINE([HAVE_QTCORE_QMUTEX_TRYLOCK_INT], [1], [Define to 1 if the installed version of Qt4 provides QMutex::tryLock(int).])
1762 CXXFLAGS="${safe_CXXFLAGS}"
1767 # Test for QAtomicInt, which has been introduced in Qt 4.4.
1768 # See also http://doc.trolltech.com/4.4/qatomicint.html.
1769 if test x$ac_have_qtcore = xyes; then
1770 AC_MSG_CHECKING([for Qt4 QAtomicInt])
1772 safe_CXXFLAGS="${CXXFLAGS}"
1773 CXXFLAGS="${QTCORE_CFLAGS} $mflag_primary"
1775 #include <QtCore/QAtomicInt>
1779 I.testAndSetOrdered(0, 1);
1783 ac_have_qtcore_qatomicint=yes
1784 AC_MSG_RESULT([yes])
1785 AC_DEFINE([HAVE_QTCORE_QATOMICINT], [1], [Define to 1 if the installed version of Qt4 provides QAtomicInt.])
1788 ac_have_qtcore_qatomicint=no
1791 CXXFLAGS="${safe_CXXFLAGS}"
1795 AM_CONDITIONAL([HAVE_QTCORE_QATOMICINT], [test x$ac_have_qtcore_qatomicint = xyes])
1799 # Check whether the boost library 1.35 or later has been installed.
1800 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
1802 AC_MSG_CHECKING([for boost])
1805 safe_CXXFLAGS=$CXXFLAGS
1806 CXXFLAGS="-lboost_thread-mt $mflag_primary"
1810 #include <boost/thread.hpp>
1811 static void thread_func(void)
1813 int main(int argc, char** argv)
1815 boost::thread t(thread_func);
1820 ac_have_boost_1_35=yes
1821 AC_SUBST([BOOST_CFLAGS], [])
1822 AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
1823 AC_MSG_RESULT([yes])
1825 ac_have_boost_1_35=no
1829 CXXFLAGS=$safe_CXXFLAGS
1832 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
1835 # does this compiler support -fopenmp, does it have the include file
1836 # <omp.h> and does it have libgomp ?
1838 AC_MSG_CHECKING([for OpenMP])
1841 CFLAGS="-fopenmp $mflag_primary"
1846 int main(int argc, char** argv)
1854 AC_MSG_RESULT([yes])
1861 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
1864 # does this compiler have built-in functions for atomic memory access ?
1865 AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
1868 CFLAGS="$mflag_primary"
1873 return (__sync_bool_compare_and_swap(&variable, 1, 2)
1874 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
1877 ac_have_builtin_atomic=yes
1878 AC_MSG_RESULT([yes])
1879 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
1882 ac_have_builtin_atomic=no
1888 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
1891 #----------------------------------------------------------------------------
1892 # Ok. We're done checking.
1893 #----------------------------------------------------------------------------
1895 # Nb: VEX/Makefile is generated from Makefile.vex.in.
1898 VEX/Makefile:Makefile.vex.in
1912 memcheck/tests/Makefile
1913 memcheck/tests/amd64/Makefile
1914 memcheck/tests/x86/Makefile
1915 memcheck/tests/linux/Makefile
1916 memcheck/tests/darwin/Makefile
1917 memcheck/tests/amd64-linux/Makefile
1918 memcheck/tests/x86-linux/Makefile
1919 memcheck/tests/ppc32/Makefile
1920 memcheck/tests/ppc64/Makefile
1921 memcheck/perf/Makefile
1923 cachegrind/tests/Makefile
1924 cachegrind/tests/x86/Makefile
1925 cachegrind/cg_annotate
1928 callgrind/callgrind_annotate
1929 callgrind/callgrind_control
1930 callgrind/tests/Makefile
1932 helgrind/tests/Makefile
1934 massif/tests/Makefile
1935 massif/perf/Makefile
1938 lackey/tests/Makefile
1941 none/tests/amd64/Makefile
1942 none/tests/ppc32/Makefile
1943 none/tests/ppc64/Makefile
1944 none/tests/x86/Makefile
1945 none/tests/arm/Makefile
1946 none/tests/linux/Makefile
1947 none/tests/darwin/Makefile
1948 none/tests/x86-linux/Makefile
1949 exp-ptrcheck/Makefile
1950 exp-ptrcheck/tests/Makefile
1952 drd/scripts/download-and-build-splash2
1955 exp-bbv/tests/Makefile
1956 exp-bbv/tests/x86/Makefile
1957 exp-bbv/tests/x86-linux/Makefile
1958 exp-bbv/tests/amd64-linux/Makefile
1959 exp-bbv/tests/ppc32-linux/Makefile
1960 exp-bbv/tests/arm-linux/Makefile
1962 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
1963 [chmod +x coregrind/link_tool_exe_linux])
1964 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
1965 [chmod +x coregrind/link_tool_exe_darwin])
1966 AC_CONFIG_FILES([coregrind/link_tool_exe_aix5],
1967 [chmod +x coregrind/link_tool_exe_aix5])
1972 Maximum build arch: ${ARCH_MAX}
1973 Primary build arch: ${VGCONF_ARCH_PRI}
1974 Secondary build arch: ${VGCONF_ARCH_SEC}
1975 Build OS: ${VGCONF_OS}
1976 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
1977 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
1978 Default supp files: ${DEFAULT_SUPP}