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.11.0.SVN],[valgrind-users@lists.sourceforge.net])
12 AC_CONFIG_SRCDIR(coregrind/m_main.c)
13 AC_CONFIG_HEADERS([config.h])
14 AM_INIT_AUTOMAKE([foreign subdir-objects])
18 #----------------------------------------------------------------------------
19 # Checks for various programs.
20 #----------------------------------------------------------------------------
21 CFLAGS="-Wno-long-long $CFLAGS"
22 CXXFLAGS="-Wno-long-long $CXXFLAGS"
29 # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
30 # autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
31 # base (eg. most likely as Darwin-specific tests) we'll need one of the
33 # - put AC_PROG_OBJC in a Darwin-specific part of this file
34 # - Use AC_PROG_OBJC here and up the minimum autoconf version
35 # - Use the following, which is apparently equivalent:
36 # m4_ifdef([AC_PROG_OBJC],
38 # [AC_CHECK_TOOL([OBJC], [gcc])
40 # AC_SUBST([OBJCFLAGS])
43 # provide a very basic definition for AC_PROG_SED if it's not provided by
44 # autoconf (as e.g. in autoconf 2.59).
45 m4_ifndef([AC_PROG_SED],
46 [AC_DEFUN([AC_PROG_SED],
48 AC_CHECK_PROGS([SED],[gsed sed])])])
51 # If no AR variable was specified, look up the name of the archiver. Otherwise
52 # do not touch the AR variable.
53 if test "x$AR" = "x"; then
54 AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
56 AC_ARG_VAR([AR],[Archiver command])
58 # Check for the compiler support
59 if test "${GCC}" != "yes" ; then
60 AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
63 # figure out where perl lives
64 AC_PATH_PROG(PERL, perl)
66 # figure out where gdb lives
67 AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
68 AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
70 # some older automake's don't have it so try something on our own
71 ifdef([AM_PROG_AS],[AM_PROG_AS],
81 # Check if 'diff' supports -u (universal diffs) and use it if possible.
83 AC_MSG_CHECKING([for diff -u])
86 # Comparing two identical files results in 0.
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 # Obtain the compiler version.
104 # A few examples of how the ${CC} --version output looks like:
106 # Arch Linux: i686-pc-linux-gnu-gcc (GCC) 4.6.2
107 # Debian Linux: gcc (Debian 4.3.2-1.1) 4.3.2
108 # openSUSE: gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585]
109 # Exherbo Linux: x86_64-pc-linux-gnu-gcc (Exherbo gcc-4.6.2) 4.6.2
110 # MontaVista Linux for ARM: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
111 # OS/X 10.6: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
112 # OS/X 10.7: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
113 # Clang: clang version 2.9 (tags/RELEASE_29/final)
114 # Apple clang: Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
115 # FreeBSD clang: FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
118 if test "x`${CC} --version | $SED -n -e 's/.*\(clang\) version.*/\1/p'`" = "xclang" ; then
120 # Don't use -dumpversion with clang: it will always produce "4.2.1".
121 gcc_version=`${CC} --version | $SED -n -e 's/.*clang version \([0-9.]*\).*$/\1/p'`
122 CFLAGS="$CFLAGS -Wno-tautological-compare -Wno-cast-align -Wno-self-assign"
123 CXXFLAGS="$CXXFLAGS -Wno-tautological-compare -Wno-cast-align -Wno-self-assign"
126 gcc_version=`${CC} -dumpversion 2>/dev/null`
127 if test "x$gcc_version" = x; then
128 gcc_version=`${CC} --version | $SED -n -e 's/[^ ]*gcc[^ ]* ([^)]*) \([0-9.]*\).*$/\1/p'`
132 AM_CONDITIONAL(COMPILER_IS_CLANG, test $is_clang = clang)
134 # Note: m4 arguments are quoted with [ and ] so square brackets in shell
135 # statements have to be quoted.
136 case "${is_clang}-${gcc_version}" in
137 notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
138 AC_MSG_RESULT([ok (${gcc_version})])
140 clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
141 AC_MSG_RESULT([ok (clang-${gcc_version})])
144 AC_MSG_RESULT([no (${gcc_version})])
145 AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9])
149 #----------------------------------------------------------------------------
150 # Arch/OS/platform tests.
151 #----------------------------------------------------------------------------
152 # We create a number of arch/OS/platform-related variables. We prefix them
153 # all with "VGCONF_" which indicates that they are defined at
154 # configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
155 # variables used when compiling C files.
159 AC_MSG_CHECKING([for a supported CPU])
161 # ARCH_MAX reflects the most that this CPU can do: for example if it
162 # is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
163 # Ditto for amd64. It is used for more configuration below, but is not used
166 # Power PC returns powerpc for Big Endian. This was not changed when Little
167 # Endian support was added to the 64-bit architecture. The 64-bit Little
168 # Endian systems explicitly state le in the host_cpu. For clarity in the
169 # Valgrind code, the ARCH_MAX name will state LE or BE for the endianess of
170 # the 64-bit system. Big Endian is the only mode supported on 32-bit Power PC.
171 # The abreviation PPC or ppc refers to 32-bit and 64-bit systems with either
172 # Endianess. The name PPC64 or ppc64 to 64-bit systems of either Endianess.
173 # The names ppc64be or PPC64BE refer to only 64-bit systems that are Big
174 # Endian. Similarly, ppc64le or PPC64LE refer to only 64-bit systems that are
177 case "${host_cpu}" in
179 AC_MSG_RESULT([ok (${host_cpu})])
184 AC_MSG_RESULT([ok (${host_cpu})])
189 # this only referrs to 64-bit Big Endian
190 AC_MSG_RESULT([ok (${host_cpu})])
195 # this only referrs to 64-bit Little Endian
196 AC_MSG_RESULT([ok (${host_cpu})])
201 # On Linux this means only a 32-bit capable CPU.
202 AC_MSG_RESULT([ok (${host_cpu})])
207 AC_MSG_RESULT([ok (${host_cpu})])
212 AC_MSG_RESULT([ok (${host_cpu})])
217 AC_MSG_RESULT([ok (${host_cpu})])
222 AC_MSG_RESULT([ok (${host_cpu})])
227 AC_MSG_RESULT([ok (${host_cpu})])
232 AC_MSG_RESULT([ok (${host_cpu})])
237 AC_MSG_RESULT([ok (${host_cpu})])
242 AC_MSG_RESULT([ok (${host_cpu})])
246 AC_MSG_RESULT([no (${host_cpu})])
247 AC_MSG_ERROR([Unsupported host architecture. Sorry])
251 #----------------------------------------------------------------------------
253 # Sometimes it's convenient to subvert the bi-arch build system and
254 # just have a single build even though the underlying platform is
255 # capable of both. Hence handle --enable-only64bit and
256 # --enable-only32bit. Complain if both are issued :-)
257 # [Actually, if either of these options are used, I think both get built,
258 # but only one gets installed. So if you use an in-place build, both can be
261 # Check if a 64-bit only build has been requested
262 AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
263 [AC_ARG_ENABLE(only64bit,
264 [ --enable-only64bit do a 64-bit only build],
265 [vg_cv_only64bit=$enableval],
266 [vg_cv_only64bit=no])])
268 # Check if a 32-bit only build has been requested
269 AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
270 [AC_ARG_ENABLE(only32bit,
271 [ --enable-only32bit do a 32-bit only build],
272 [vg_cv_only32bit=$enableval],
273 [vg_cv_only32bit=no])])
276 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
278 [Nonsensical: both --enable-only64bit and --enable-only32bit.])
281 #----------------------------------------------------------------------------
283 # VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
284 # compilation of many C files via -VGO_$(VGCONF_OS) and
285 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
286 AC_MSG_CHECKING([for a supported OS])
293 AC_MSG_RESULT([ok (${host_os})])
296 # Ok, this is linux. Check the kernel version
297 AC_MSG_CHECKING([for the kernel version])
303 AC_MSG_RESULT([2.6.x/3.x family (${kernel})])
304 AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x or Linux 3.x])
308 AC_MSG_RESULT([2.4 family (${kernel})])
309 AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
313 AC_MSG_RESULT([unsupported (${kernel})])
314 AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
321 AC_MSG_RESULT([ok (${host_os})])
323 AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
324 AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
325 AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
326 AC_DEFINE([DARWIN_10_8], 100800, [DARWIN_VERS value for Mac OS X 10.8])
327 AC_DEFINE([DARWIN_10_9], 100900, [DARWIN_VERS value for Mac OS X 10.9])
329 AC_MSG_CHECKING([for the kernel version])
332 # Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
333 # has only one relevant version, the OS version. The `uname` check
334 # is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
335 # X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
336 # and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
337 # and we don't know of an macros similar to __GLIBC__ to get that info.
339 # XXX: `uname -r` won't do the right thing for cross-compiles, but
340 # that's not a problem yet.
342 # jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
343 # on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
344 # on 10.6.8 and 10.7.1. Although tempted to delete the configure
345 # time support for 10.5 (the 9.* pattern just below), I'll leave it
346 # in for now, just in case anybody wants to give it a try. But I'm
347 # assuming that 3.7.0 is a Snow Leopard and Lion-only release.
350 AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
351 AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
352 DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
353 DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
356 AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
357 AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
358 DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
359 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
362 AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
363 AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
364 DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
365 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
368 AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion])
369 AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version])
370 DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}"
371 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
374 AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks])
375 AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version])
376 DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}"
377 DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
380 AC_MSG_RESULT([unsupported (${kernel})])
381 AC_MSG_ERROR([Valgrind works on Darwin 10.x, 11.x, 12.x and 13.x (Mac OS X 10.6/7/8/9)])
387 AC_MSG_RESULT([no (${host_os})])
388 AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
392 #----------------------------------------------------------------------------
394 # If we are building on a 64 bit platform test to see if the system
395 # supports building 32 bit programs and disable 32 bit support if it
396 # does not support building 32 bit programs
398 case "$ARCH_MAX-$VGCONF_OS" in
399 amd64-linux|ppc64be-linux|arm64-linux)
400 AC_MSG_CHECKING([for 32 bit build support])
403 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
408 vg_cv_only64bit="yes"
411 CFLAGS=$safe_CFLAGS;;
414 if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
416 [--enable-only32bit was specified but system does not support 32 bit builds])
419 #----------------------------------------------------------------------------
421 # VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
422 # default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
423 # machine, but --enable-only32bit has been requested, then ARCH_MAX (see
424 # above) will be "amd64" since that reflects the most that this cpu can do,
425 # but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
426 # arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
427 # passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
428 # -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
429 AC_SUBST(VGCONF_ARCH_PRI)
431 # VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
432 # It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
433 # and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
434 # It is empty if there is no secondary target.
435 AC_SUBST(VGCONF_ARCH_SEC)
437 # VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
438 # The entire system, including regression and performance tests, will be
439 # built for this target. The "_CAPS" indicates that the name is in capital
440 # letters, and it also uses '_' rather than '-' as a separator, because it's
441 # used to create various Makefile variables, which are all in caps by
442 # convention and cannot contain '-' characters. This is in contrast to
443 # VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
444 AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
446 # VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
447 # Valgrind and tools will also be built for this target, but not the
448 # regression or performance tests.
450 # By default, the primary arch is the same as the "max" arch, as commented
451 # above (at the definition of ARCH_MAX). We may choose to downgrade it in
452 # the big case statement just below here, in the case where we're building
453 # on a 64 bit machine but have been requested only to do a 32 bit build.
454 AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
456 AC_MSG_CHECKING([for a supported CPU/OS combination])
458 # NB. The load address for a given platform may be specified in more
459 # than one place, in some cases, depending on whether we're doing a biarch,
460 # 32-bit only or 64-bit only build. eg see case for amd64-linux below.
461 # Be careful to give consistent values in all subcases. Also, all four
462 # valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
463 # even if it is to "0xUNSET".
465 case "$ARCH_MAX-$VGCONF_OS" in
467 VGCONF_ARCH_PRI="x86"
469 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
470 VGCONF_PLATFORM_SEC_CAPS=""
471 valt_load_address_pri_norml="0x38000000"
472 valt_load_address_pri_inner="0x28000000"
473 valt_load_address_sec_norml="0xUNSET"
474 valt_load_address_sec_inner="0xUNSET"
475 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
478 valt_load_address_sec_norml="0xUNSET"
479 valt_load_address_sec_inner="0xUNSET"
480 if test x$vg_cv_only64bit = xyes; then
481 VGCONF_ARCH_PRI="amd64"
483 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
484 VGCONF_PLATFORM_SEC_CAPS=""
485 valt_load_address_pri_norml="0x38000000"
486 valt_load_address_pri_inner="0x28000000"
487 elif test x$vg_cv_only32bit = xyes; then
488 VGCONF_ARCH_PRI="x86"
490 VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
491 VGCONF_PLATFORM_SEC_CAPS=""
492 valt_load_address_pri_norml="0x38000000"
493 valt_load_address_pri_inner="0x28000000"
495 VGCONF_ARCH_PRI="amd64"
496 VGCONF_ARCH_SEC="x86"
497 VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
498 VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
499 valt_load_address_pri_norml="0x38000000"
500 valt_load_address_pri_inner="0x28000000"
501 valt_load_address_sec_norml="0x38000000"
502 valt_load_address_sec_inner="0x28000000"
504 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
507 VGCONF_ARCH_PRI="ppc32"
509 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
510 VGCONF_PLATFORM_SEC_CAPS=""
511 valt_load_address_pri_norml="0x38000000"
512 valt_load_address_pri_inner="0x28000000"
513 valt_load_address_sec_norml="0xUNSET"
514 valt_load_address_sec_inner="0xUNSET"
515 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
518 valt_load_address_sec_norml="0xUNSET"
519 valt_load_address_sec_inner="0xUNSET"
520 if test x$vg_cv_only64bit = xyes; then
521 VGCONF_ARCH_PRI="ppc64be"
523 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
524 VGCONF_PLATFORM_SEC_CAPS=""
525 valt_load_address_pri_norml="0x38000000"
526 valt_load_address_pri_inner="0x28000000"
527 elif test x$vg_cv_only32bit = xyes; then
528 VGCONF_ARCH_PRI="ppc32"
530 VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
531 VGCONF_PLATFORM_SEC_CAPS=""
532 valt_load_address_pri_norml="0x38000000"
533 valt_load_address_pri_inner="0x28000000"
535 VGCONF_ARCH_PRI="ppc64be"
536 VGCONF_ARCH_SEC="ppc32"
537 VGCONF_PLATFORM_PRI_CAPS="PPC64BE_LINUX"
538 VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
539 valt_load_address_pri_norml="0x38000000"
540 valt_load_address_pri_inner="0x28000000"
541 valt_load_address_sec_norml="0x38000000"
542 valt_load_address_sec_inner="0x28000000"
544 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
547 # Little Endian is only supported on PPC64
548 valt_load_address_sec_norml="0xUNSET"
549 valt_load_address_sec_inner="0xUNSET"
550 VGCONF_ARCH_PRI="ppc64le"
552 VGCONF_PLATFORM_PRI_CAPS="PPC64LE_LINUX"
553 VGCONF_PLATFORM_SEC_CAPS=""
554 valt_load_address_pri_norml="0x38000000"
555 valt_load_address_pri_inner="0x28000000"
556 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
558 # Darwin gets identified as 32-bit even when it supports 64-bit.
559 # (Not sure why, possibly because 'uname' returns "i386"?) Just about
560 # all Macs support both 32-bit and 64-bit, so we just build both. If
561 # someone has a really old 32-bit only machine they can (hopefully?)
562 # build with --enable-only32bit. See bug 243362.
563 x86-darwin|amd64-darwin)
565 valt_load_address_sec_norml="0xUNSET"
566 valt_load_address_sec_inner="0xUNSET"
567 if test x$vg_cv_only64bit = xyes; then
568 VGCONF_ARCH_PRI="amd64"
570 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
571 VGCONF_PLATFORM_SEC_CAPS=""
572 valt_load_address_pri_norml="0x138000000"
573 valt_load_address_pri_inner="0x128000000"
574 elif test x$vg_cv_only32bit = xyes; then
575 VGCONF_ARCH_PRI="x86"
577 VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
578 VGCONF_PLATFORM_SEC_CAPS=""
579 VGCONF_ARCH_PRI_CAPS="x86"
580 valt_load_address_pri_norml="0x38000000"
581 valt_load_address_pri_inner="0x28000000"
583 VGCONF_ARCH_PRI="amd64"
584 VGCONF_ARCH_SEC="x86"
585 VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
586 VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
587 valt_load_address_pri_norml="0x138000000"
588 valt_load_address_pri_inner="0x128000000"
589 valt_load_address_sec_norml="0x38000000"
590 valt_load_address_sec_inner="0x28000000"
592 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
595 VGCONF_ARCH_PRI="arm"
596 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
597 VGCONF_PLATFORM_SEC_CAPS=""
598 valt_load_address_pri_norml="0x38000000"
599 valt_load_address_pri_inner="0x28000000"
600 valt_load_address_sec_norml="0xUNSET"
601 valt_load_address_sec_inner="0xUNSET"
602 AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
605 valt_load_address_sec_norml="0xUNSET"
606 valt_load_address_sec_inner="0xUNSET"
607 if test x$vg_cv_only64bit = xyes; then
608 VGCONF_ARCH_PRI="arm64"
610 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
611 VGCONF_PLATFORM_SEC_CAPS=""
612 valt_load_address_pri_norml="0x38000000"
613 valt_load_address_pri_inner="0x28000000"
614 elif test x$vg_cv_only32bit = xyes; then
615 VGCONF_ARCH_PRI="arm"
617 VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
618 VGCONF_PLATFORM_SEC_CAPS=""
619 valt_load_address_pri_norml="0x38000000"
620 valt_load_address_pri_inner="0x28000000"
622 VGCONF_ARCH_PRI="arm64"
623 VGCONF_ARCH_SEC="arm"
624 VGCONF_PLATFORM_PRI_CAPS="ARM64_LINUX"
625 VGCONF_PLATFORM_SEC_CAPS="ARM_LINUX"
626 valt_load_address_pri_norml="0x38000000"
627 valt_load_address_pri_inner="0x28000000"
628 valt_load_address_sec_norml="0x38000000"
629 valt_load_address_sec_inner="0x28000000"
631 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
634 VGCONF_ARCH_PRI="s390x"
636 VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
637 VGCONF_PLATFORM_SEC_CAPS=""
638 # To improve branch prediction hit rate we want to have
639 # the generated code close to valgrind (host) code
640 valt_load_address_pri_norml="0x800000000"
641 valt_load_address_pri_inner="0x810000000"
642 valt_load_address_sec_norml="0xUNSET"
643 valt_load_address_sec_inner="0xUNSET"
644 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
647 VGCONF_ARCH_PRI="mips32"
648 VGCONF_PLATFORM_PRI_CAPS="MIPS32_LINUX"
649 VGCONF_PLATFORM_SEC_CAPS=""
650 valt_load_address_pri_norml="0x38000000"
651 valt_load_address_pri_inner="0x28000000"
652 valt_load_address_sec_norml="0xUNSET"
653 valt_load_address_sec_inner="0xUNSET"
654 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
657 VGCONF_ARCH_PRI="mips64"
658 VGCONF_PLATFORM_PRI_CAPS="MIPS64_LINUX"
659 VGCONF_PLATFORM_SEC_CAPS=""
660 valt_load_address_pri_norml="0x38000000"
661 valt_load_address_pri_inner="0x28000000"
662 valt_load_address_sec_norml="0xUNSET"
663 valt_load_address_sec_inner="0xUNSET"
664 AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
667 VGCONF_ARCH_PRI="unknown"
668 VGCONF_ARCH_SEC="unknown"
669 VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
670 VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
671 valt_load_address_pri_norml="0xUNSET"
672 valt_load_address_pri_inner="0xUNSET"
673 valt_load_address_sec_norml="0xUNSET"
674 valt_load_address_sec_inner="0xUNSET"
675 AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
676 AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
680 #----------------------------------------------------------------------------
682 # Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
684 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
685 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
686 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
687 -o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
688 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
689 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
690 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
691 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
692 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
693 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
694 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
695 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
696 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
697 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX )
698 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
699 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
700 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX )
701 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM64,
702 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX )
703 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
704 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
705 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS32,
706 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX )
707 AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_MIPS64,
708 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX )
710 # Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
712 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
713 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
714 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
715 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
716 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
717 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
718 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
719 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
720 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64BE_LINUX,
721 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX)
722 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64LE_LINUX,
723 test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX)
724 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
725 test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
726 -o x$VGCONF_PLATFORM_SEC_CAPS = xARM_LINUX)
727 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM64_LINUX,
728 test x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX)
729 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
730 test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
731 -o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
732 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX,
733 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX)
734 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_MIPS64_LINUX,
735 test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
736 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
737 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
738 -o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
739 AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
740 test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
743 # Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
744 # Relies on the assumption that the primary and secondary targets are
745 # for the same OS, so therefore only necessary to test the primary.
746 AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
747 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
748 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
749 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
750 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64BE_LINUX \
751 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64LE_LINUX \
752 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
753 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
754 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
755 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
756 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX)
757 AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
758 test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
759 -o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
762 # Sometimes, in the Makefile.am files, it's useful to know whether or not
763 # there is a secondary target.
764 AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
765 test x$VGCONF_PLATFORM_SEC_CAPS != x)
767 dnl automake-1.10 does not have AM_COND_IF (added in 1.11), so we supply a
768 dnl fallback definition
769 dnl The macro is courtesy of Dave Hart:
770 dnl https://lists.gnu.org/archive/html/automake/2010-12/msg00045.html
771 m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
772 if test -z "$$1_TRUE"; then :
781 #----------------------------------------------------------------------------
783 #----------------------------------------------------------------------------
785 # Check if this should be built as an inner Valgrind, to be run within
786 # another Valgrind. Choose the load address accordingly.
787 AC_SUBST(VALT_LOAD_ADDRESS_PRI)
788 AC_SUBST(VALT_LOAD_ADDRESS_SEC)
789 AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
790 [AC_ARG_ENABLE(inner,
791 [ --enable-inner enables self-hosting],
792 [vg_cv_inner=$enableval],
794 if test "$vg_cv_inner" = yes; then
795 AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
796 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
797 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
799 VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
800 VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
804 #----------------------------------------------------------------------------
805 # Define MIPS_PAGE_SHIFT (--with-pagesize)
806 #----------------------------------------------------------------------------
807 AC_ARG_WITH(pagesize,
808 [ --with-pagesize= override detected page size (4, 16 or 64)],
813 if test "$psize" = "0"; then
814 psizer=`getconf PAGESIZE`
815 psize=$((${psizer}/1024))
818 if test "$psize" = "4"; then
819 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured page size 4k])
820 elif test "$psize" = "16"; then
821 AC_DEFINE([MIPS_PAGE_SHIFT], 14, [configured page size 16k])
822 elif test "$psize" = "64"; then
823 AC_DEFINE([MIPS_PAGE_SHIFT], 16, [configured page size 64k])
825 AC_DEFINE([MIPS_PAGE_SHIFT], 12, [configured default page size 4k])
827 AC_MSG_RESULT([checking for Pagesize... ${psize}k])
830 #----------------------------------------------------------------------------
831 # Extra fine-tuning of installation directories
832 #----------------------------------------------------------------------------
834 [ --with-tmpdir=PATH Specify path for temporary files],
837 AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
838 AC_SUBST(VG_TMPDIR, [$tmpdir])
841 #----------------------------------------------------------------------------
842 # Libc and suppressions
843 #----------------------------------------------------------------------------
844 # This variable will collect the suppression files to be used.
845 AC_SUBST(DEFAULT_SUPP)
847 AC_CHECK_HEADER([features.h])
849 if test x$ac_cv_header_features_h = xyes; then
850 rm -f conftest.$ac_ext
851 cat <<_ACEOF >conftest.$ac_ext
852 #include <features.h>
853 #if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
854 glibc version is: __GLIBC__ __GLIBC_MINOR__
857 GLIBC_VERSION="`$CPP -P conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
860 # not really a version check
861 AC_EGREP_CPP([DARWIN_LIBC], [
862 #include <sys/cdefs.h>
863 #if defined(__DARWIN_VERS_1050)
867 GLIBC_VERSION="darwin")
869 # not really a version check
870 AC_EGREP_CPP([BIONIC_LIBC], [
871 #if defined(__ANDROID__)
875 GLIBC_VERSION="bionic")
878 AC_MSG_CHECKING([the glibc version])
880 case "${GLIBC_VERSION}" in
882 AC_MSG_RESULT(${GLIBC_VERSION} family)
883 DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
884 DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
885 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
888 AC_MSG_RESULT(${GLIBC_VERSION} family)
889 DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}"
890 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
891 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
894 AC_MSG_RESULT(${GLIBC_VERSION} family)
895 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
896 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
897 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
900 AC_MSG_RESULT(${GLIBC_VERSION} family)
901 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
902 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
903 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
904 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
905 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
908 AC_MSG_RESULT(${GLIBC_VERSION} family)
909 AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1,
910 [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)])
911 AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1,
912 [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)])
913 DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
914 DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
915 DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
918 AC_MSG_RESULT(Darwin)
919 AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
920 # DEFAULT_SUPP set by kernel version check above.
923 AC_MSG_RESULT(Bionic)
924 AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
925 DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
928 AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
929 AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later])
930 AC_MSG_ERROR([or Darwin or Bionic libc])
934 AC_SUBST(GLIBC_VERSION)
937 # Add default suppressions for the X client libraries. Make no
938 # attempt to detect whether such libraries are installed on the
939 # build machine (or even if any X facilities are present); just
940 # add the suppressions antidisirregardless.
941 DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
942 DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
944 # Add glibc and X11 suppressions for exp-sgcheck
945 DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
948 #----------------------------------------------------------------------------
950 #----------------------------------------------------------------------------
952 # Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
953 # But there are times where we need a bit more control. The motivating
954 # and currently only case is Android: this is almost identical to
955 # {x86,arm,mips}-linux, but not quite. So this introduces the concept of
956 # platform variant tags, which get passed in the compile as
957 # -DVGPV_<arch>_<os>_<variant> along with the main -DVGP_<arch>_<os> definition.
959 # In almost all cases, the <variant> bit is "vanilla". But for Android
960 # it is "android" instead.
962 # Consequently (eg), plain arm-linux would build with
964 # -DVGP_arm_linux -DVGPV_arm_linux_vanilla
966 # whilst an Android build would have
968 # -DVGP_arm_linux -DVGPV_arm_linux_android
970 # Same for x86. The setup of the platform variant is pushed relatively far
971 # down this file in order that we can inspect any of the variables set above.
973 # In the normal case ..
974 VGCONF_PLATVARIANT="vanilla"
977 if test "$GLIBC_VERSION" = "bionic";
979 VGCONF_PLATVARIANT="android"
982 AC_SUBST(VGCONF_PLATVARIANT)
985 # FIXME: do we also want to define automake variables
986 # VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
987 # VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
988 # VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
989 # do that. Problem is that we can't do and-ing in Makefile.am's, but
990 # that's what we'd need to do to use this, since what we'd want to write
993 # VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
995 # Hmm. Can't think of a nice clean solution to this.
997 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
998 test x$VGCONF_PLATVARIANT = xvanilla)
999 AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
1000 test x$VGCONF_PLATVARIANT = xandroid)
1003 #----------------------------------------------------------------------------
1004 # Checking for various library functions and other definitions
1005 #----------------------------------------------------------------------------
1007 # Check for AT_FDCWD
1009 AC_MSG_CHECKING([for AT_FDCWD])
1010 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1017 ac_have_at_fdcwd=yes
1018 AC_MSG_RESULT([yes])
1024 AM_CONDITIONAL([HAVE_AT_FDCWD], [test x$ac_have_at_fdcwd = xyes])
1026 # Check for stpncpy function definition in string.h
1027 # This explicitly checks with _GNU_SOURCE defined since that is also
1028 # used in the test case (some systems might define it without anyway
1029 # since stpncpy is part of The Open Group Base Specifications Issue 7
1030 # IEEE Std 1003.1-2008.
1031 AC_MSG_CHECKING([for stpncpy])
1032 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1039 char *r = stpncpy(d, s, n);
1041 ac_have_gnu_stpncpy=yes
1042 AC_MSG_RESULT([yes])
1044 ac_have_gnu_stpncpy=no
1048 AM_CONDITIONAL([HAVE_GNU_STPNCPY], [test x$ac_have_gnu_stpncpy = xyes])
1050 # Check for PTRACE_GETREGS
1052 AC_MSG_CHECKING([for PTRACE_GETREGS])
1053 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1055 #include <sys/ptrace.h>
1056 #include <sys/user.h>
1059 long res = ptrace (PTRACE_GETREGS, 0, p, p);
1061 AC_MSG_RESULT([yes])
1062 AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
1063 [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
1069 # Check for CLOCK_MONOTONIC
1071 AC_MSG_CHECKING([for CLOCK_MONOTONIC])
1073 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1077 clock_gettime(CLOCK_MONOTONIC, &t);
1080 AC_MSG_RESULT([yes])
1081 AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
1082 [Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
1088 # Check for PTHREAD_RWLOCK_T
1090 AC_MSG_CHECKING([for pthread_rwlock_t])
1092 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1094 #include <pthread.h>
1096 pthread_rwlock_t rwl;
1098 AC_MSG_RESULT([yes])
1099 AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
1100 [Define to 1 if you have the `pthread_rwlock_t' type.])
1106 # Check for PTHREAD_MUTEX_ADAPTIVE_NP
1108 AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
1110 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1112 #include <pthread.h>
1114 return (PTHREAD_MUTEX_ADAPTIVE_NP);
1116 AC_MSG_RESULT([yes])
1117 AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
1118 [Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
1124 # Check for PTHREAD_MUTEX_ERRORCHECK_NP
1126 AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
1128 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1130 #include <pthread.h>
1132 return (PTHREAD_MUTEX_ERRORCHECK_NP);
1134 AC_MSG_RESULT([yes])
1135 AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
1136 [Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
1142 # Check for PTHREAD_MUTEX_RECURSIVE_NP
1144 AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
1146 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1148 #include <pthread.h>
1150 return (PTHREAD_MUTEX_RECURSIVE_NP);
1152 AC_MSG_RESULT([yes])
1153 AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
1154 [Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
1160 # Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
1162 AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
1164 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1166 #include <pthread.h>
1168 pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
1171 AC_MSG_RESULT([yes])
1172 AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
1173 [Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
1179 # Check whether pthread_mutex_t has a member called __m_kind.
1181 AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
1182 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1184 [Define to 1 if pthread_mutex_t has a member called __m_kind.])
1187 [#include <pthread.h>])
1190 # Check whether pthread_mutex_t has a member called __data.__kind.
1192 AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
1193 [AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1195 [Define to 1 if pthread_mutex_t has a member __data.__kind.])
1198 [#include <pthread.h>])
1201 # does this compiler support -maltivec and does it have the include file
1204 AC_MSG_CHECKING([for Altivec])
1209 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1210 #include <altivec.h>
1212 vector unsigned int v;
1215 AC_MSG_RESULT([yes])
1216 AC_DEFINE([HAS_ALTIVEC], 1,
1217 [Define to 1 if gcc/as can do Altivec.])
1224 AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
1227 # Check that both: the compiler supports -mvsx and that the assembler
1228 # understands VSX instructions. If either of those doesn't work,
1229 # conclude that we can't do VSX. NOTE: basically this is a kludge
1230 # in that it conflates two things that should be separate -- whether
1231 # the compiler understands the flag vs whether the assembler
1232 # understands the opcodes. This really ought to be cleaned up
1233 # and done properly, like it is for x86/x86_64.
1235 AC_MSG_CHECKING([for VSX])
1240 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1241 #include <altivec.h>
1243 vector unsigned int v;
1244 __asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
1247 AC_MSG_RESULT([yes])
1254 AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
1257 AC_MSG_CHECKING([that assembler knows DFP])
1259 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1261 __asm__ __volatile__("dadd 1, 2, 3");
1262 __asm__ __volatile__("dcffix 1, 2");
1265 AC_MSG_RESULT([yes])
1272 AC_MSG_CHECKING([that compiler knows -mhard-dfp switch])
1275 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1277 __asm__ __volatile__("dadd 1, 2, 3");
1278 __asm__ __volatile__("dcffix 1, 2");
1281 AC_MSG_RESULT([yes])
1289 AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes -a x$ac_gcc_have_dfp = xyes)
1292 AC_MSG_CHECKING([that compiler knows DFP datatypes])
1293 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1295 _Decimal64 x = 0.0DD;
1297 ac_gcc_have_dfp_type=yes
1298 AC_MSG_RESULT([yes])
1300 ac_gcc_have_dfp_type=no
1304 AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_gcc_have_dfp_type = xyes)
1307 AC_MSG_CHECKING([that assembler knows ISA 2.07 ])
1309 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1311 __asm__ __volatile__("mtvsrd 1,2 ");
1313 ac_asm_have_isa_2_07=yes
1314 AC_MSG_RESULT([yes])
1316 ac_asm_have_isa_2_07=no
1320 AM_CONDITIONAL(HAS_ISA_2_07, test x$ac_asm_have_isa_2_07 = xyes)
1322 # Check for pthread_create@GLIBC2.0
1323 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
1327 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1328 extern int pthread_create_glibc_2_0(void*, const void*,
1329 void *(*)(void*), void*);
1330 __asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
1334 * Apparently on PowerPC linking this program succeeds and generates an
1335 * executable with the undefined symbol pthread_create@GLIBC_2.0.
1337 #error This test does not work properly on PowerPC.
1339 pthread_create_glibc_2_0(0, 0, 0, 0);
1343 ac_have_pthread_create_glibc_2_0=yes
1344 AC_MSG_RESULT([yes])
1345 AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
1346 [Define to 1 if you have the `pthread_create@glibc2.0' function.])
1348 ac_have_pthread_create_glibc_2_0=no
1353 AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
1354 test x$ac_have_pthread_create_glibc_2_0 = xyes)
1357 # Check for dlinfo RTLD_DI_TLS_MODID
1358 AC_MSG_CHECKING([for dlinfo RTLD_DI_TLS_MODID])
1362 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1369 size_t sizes[10000];
1370 size_t modid_offset;
1371 (void) dlinfo ((void*)sizes, RTLD_DI_TLS_MODID, &modid_offset);
1374 ac_have_dlinfo_rtld_di_tls_modid=yes
1375 AC_MSG_RESULT([yes])
1376 AC_DEFINE([HAVE_DLINFO_RTLD_DI_TLS_MODID], 1,
1377 [Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID.])
1379 ac_have_dlinfo_rtld_di_tls_modid=no
1384 AM_CONDITIONAL(HAVE_DLINFO_RTLD_DI_TLS_MODID,
1385 test x$ac_have_dlinfo_rtld_di_tls_modid = xyes)
1388 # Check for eventfd_t, eventfd() and eventfd_read()
1389 AC_MSG_CHECKING([for eventfd()])
1391 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1392 #include <sys/eventfd.h>
1398 eventfd_read(fd, &ev);
1401 AC_MSG_RESULT([yes])
1402 AC_DEFINE([HAVE_EVENTFD], 1,
1403 [Define to 1 if you have the `eventfd' function.])
1404 AC_DEFINE([HAVE_EVENTFD_READ], 1,
1405 [Define to 1 if you have the `eventfd_read' function.])
1411 # Check whether compiler can process #include <thread> without errors
1412 # clang 3.3 cannot process <thread> from e.g.
1413 # gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
1415 AC_MSG_CHECKING([that C++ compiler can include <thread> header file])
1417 safe_CXXFLAGS=$CXXFLAGS
1420 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1424 ac_cxx_can_include_thread_header=yes
1425 AC_MSG_RESULT([yes])
1427 ac_cxx_can_include_thread_header=no
1430 CXXFLAGS=$safe_CXXFLAGS
1433 AM_CONDITIONAL(CXX_CAN_INCLUDE_THREAD_HEADER, test x$ac_cxx_can_include_thread_header = xyes)
1436 # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
1437 # of the user_regs_struct from sys/user.h. They are structurally the same
1438 # but we get either one or the other.
1440 AC_CHECK_TYPE([struct user_regs_struct],
1441 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
1442 [[#include <sys/ptrace.h>]
1443 [#include <sys/time.h>]
1444 [#include <sys/user.h>]])
1445 if test "$sys_user_has_user_regs" = "yes"; then
1446 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
1447 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
1451 #----------------------------------------------------------------------------
1452 # Checking for supported compiler flags.
1453 #----------------------------------------------------------------------------
1455 # does this compiler support -m32 ?
1456 AC_MSG_CHECKING([if gcc accepts -m32])
1461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1465 AC_MSG_RESULT([yes])
1475 # does this compiler support -m64 ?
1476 AC_MSG_CHECKING([if gcc accepts -m64])
1481 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1485 AC_MSG_RESULT([yes])
1495 # does this compiler support -march=mips32 (mips32 default) ?
1496 AC_MSG_CHECKING([if gcc accepts -march=mips32])
1499 CFLAGS="$CFLAGS -march=mips32"
1501 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1504 FLAG_MIPS32="-march=mips32"
1505 AC_MSG_RESULT([yes])
1512 AC_SUBST(FLAG_MIPS32)
1515 # does this compiler support -march=mips64 (mips64 default) ?
1516 AC_MSG_CHECKING([if gcc accepts -march=mips64])
1519 CFLAGS="$CFLAGS -march=mips64"
1521 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1524 FLAG_MIPS64="-march=mips64"
1525 AC_MSG_RESULT([yes])
1532 AC_SUBST(FLAG_MIPS64)
1535 # does this compiler support -march=octeon (Cavium OCTEON I Specific) ?
1536 AC_MSG_CHECKING([if gcc accepts -march=octeon])
1539 CFLAGS="$CFLAGS -march=octeon"
1541 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1544 FLAG_OCTEON="-march=octeon"
1545 AC_MSG_RESULT([yes])
1552 AC_SUBST(FLAG_OCTEON)
1555 # does this compiler support -march=octeon2 (Cavium OCTEON II Specific) ?
1556 AC_MSG_CHECKING([if gcc accepts -march=octeon2])
1559 CFLAGS="$CFLAGS -march=octeon2"
1561 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1564 FLAG_OCTEON2="-march=octeon2"
1565 AC_MSG_RESULT([yes])
1572 AC_SUBST(FLAG_OCTEON2)
1575 # does this compiler support -mmmx ?
1576 AC_MSG_CHECKING([if gcc accepts -mmmx])
1581 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1585 AC_MSG_RESULT([yes])
1595 # does this compiler support -msse ?
1596 AC_MSG_CHECKING([if gcc accepts -msse])
1601 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1605 AC_MSG_RESULT([yes])
1615 # does this compiler support -mpreferred-stack-boundary=2 when
1616 # generating code for a 32-bit target? Note that we only care about
1617 # this when generating code for (32-bit) x86, so if the compiler
1618 # doesn't recognise -m32 it's no big deal. We'll just get code for
1619 # the Memcheck and other helper functions, that is a bit slower than
1620 # it could be, on x86; and no difference at all on any other platform.
1621 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary=2 -m32])
1624 CFLAGS="-mpreferred-stack-boundary=2 -m32"
1626 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1629 PREFERRED_STACK_BOUNDARY_2="-mpreferred-stack-boundary=2"
1630 AC_MSG_RESULT([yes])
1632 PREFERRED_STACK_BOUNDARY_2=""
1637 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
1640 # Convenience function to check whether GCC supports a particular
1641 # warning option. Takes two arguments, first the warning flag name
1642 # to check (without -W), then the conditional name to set if that
1643 # warning flag is supported.
1644 AC_DEFUN([AC_GCC_WARNING_COND],[
1645 AC_MSG_CHECKING([if gcc accepts -W$1])
1648 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1649 has_warning_flag=yes
1650 AC_MSG_RESULT([yes])], [
1652 AC_MSG_RESULT([no])])
1654 AM_CONDITIONAL([$2], test x$has_warning_flag = xyes)
1657 AC_GCC_WARNING_COND([pointer-sign], [HAS_POINTER_SIGN_WARNING])
1658 AC_GCC_WARNING_COND([write-strings], [HAS_WRITE_STRINGS_WARNING])
1660 # Convenience function to check whether GCC supports a particular
1661 # warning option. Similar to AC_GCC_WARNING_COND, but does a
1662 # substitution instead of setting an conditional. Takes two arguments,
1663 # first the warning flag name to check (without -W), then the
1664 # substitution name to set with -Wno-warning-flag if the flag exists,
1665 # or the empty string if the compiler doesn't accept the flag. Note
1666 # that checking is done against the warning flag itself, but the
1667 # substitution is then done to cancel the warning flag.
1668 AC_DEFUN([AC_GCC_WARNING_SUBST_NO],[
1669 AC_MSG_CHECKING([if gcc accepts -W$1])
1672 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[;]])], [
1673 AC_SUBST([$2], [-Wno-$1])
1674 AC_MSG_RESULT([yes])], [
1676 AC_MSG_RESULT([no])])
1680 AC_GCC_WARNING_SUBST_NO([empty-body], [FLAG_W_NO_EMPTY_BODY])
1681 AC_GCC_WARNING_SUBST_NO([format-zero-length], [FLAG_W_NO_FORMAT_ZERO_LENGTH])
1682 AC_GCC_WARNING_SUBST_NO([tautological-compare], [FLAG_W_NO_TAUTOLOGICAL_COMPARE])
1683 AC_GCC_WARNING_SUBST_NO([nonnull], [FLAG_W_NO_NONNULL])
1684 AC_GCC_WARNING_SUBST_NO([overflow], [FLAG_W_NO_OVERFLOW])
1685 AC_GCC_WARNING_SUBST_NO([uninitialized], [FLAG_W_NO_UNINITIALIZED])
1686 AC_GCC_WARNING_SUBST_NO([unused-function], [FLAG_W_NO_UNUSED_FUNCTION])
1687 AC_GCC_WARNING_SUBST_NO([static-local-in-inline], [FLAG_W_NO_STATIC_LOCAL_IN_INLINE])
1690 # does this compiler support -Wextra or the older -W ?
1692 AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
1697 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1700 AC_SUBST([FLAG_W_EXTRA], [-Wextra])
1701 AC_MSG_RESULT([-Wextra])
1704 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1707 AC_SUBST([FLAG_W_EXTRA], [-W])
1710 AC_SUBST([FLAG_W_EXTRA], [])
1711 AC_MSG_RESULT([not supported])
1717 # does this compiler support -fno-stack-protector ?
1718 AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
1721 CFLAGS="-fno-stack-protector"
1723 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1726 no_stack_protector=yes
1727 FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
1728 AC_MSG_RESULT([yes])
1730 no_stack_protector=no
1731 FLAG_FNO_STACK_PROTECTOR=""
1736 AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
1738 if test x$no_stack_protector = xyes; then
1739 CFLAGS="$CFLAGS -fno-stack-protector"
1740 CXXFLAGS="$CXXFLAGS -fno-stack-protector"
1744 # does this compiler support --param inline-unit-growth=... ?
1746 AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
1749 CFLAGS="--param inline-unit-growth=900"
1751 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1754 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
1755 ["--param inline-unit-growth=900"])
1756 AC_MSG_RESULT([yes])
1758 AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
1764 # does this compiler support -gdwarf-4 -fdebug-types-section ?
1766 AC_MSG_CHECKING([if gcc accepts -gdwarf-4 -fdebug-types-section])
1769 CFLAGS="-gdwarf-4 -fdebug-types-section"
1771 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
1775 AC_MSG_RESULT([yes])
1780 AM_CONDITIONAL(DWARF4, test x$ac_have_dwarf4 = xyes)
1784 # does this compiler support -gstabs ?
1786 AC_MSG_CHECKING([if gcc accepts -gstabs])
1790 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1794 AC_MSG_RESULT([yes])
1800 AM_CONDITIONAL([HAVE_GSTABS], [test x$ac_have_gstabs = xyes])
1803 # does this compiler support nested functions ?
1805 AC_MSG_CHECKING([if gcc accepts nested functions])
1807 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1808 int foo() { return 1; }
1811 ac_have_nested_functions=yes
1812 AC_MSG_RESULT([yes])
1814 ac_have_nested_functions=no
1817 AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
1820 # does this compiler support the 'p' constraint in ASM statements ?
1822 AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
1824 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1826 __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
1828 ac_have_asm_constraint_p=yes
1829 AC_MSG_RESULT([yes])
1831 ac_have_asm_constraint_p=no
1834 AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
1837 # We want to use use the -Ttext-segment option to the linker.
1838 # GNU (bfd) ld supports this directly. Newer GNU gold linkers
1839 # support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
1840 # semantics are NOT what we want (GNU gold -Ttext is fine).
1842 # For GNU (bfd) ld -Ttext-segment chooses the base at which ELF headers
1843 # will reside. -Ttext aligns just the .text section start (but not any
1846 # So test for -Ttext-segment which is supported by all bfd ld versions
1847 # and use that if it exists. If it doesn't exist it must be an older
1848 # version of gold and we can fall back to using -Ttext which has the
1851 AC_MSG_CHECKING([if the linker accepts -Wl,-Ttext-segment])
1854 CFLAGS="-static -nodefaultlibs -nostartfiles -Wl,-Ttext-segment=$valt_load_address_pri_norml"
1857 [AC_LANG_SOURCE([int _start () { return 0; }])],
1859 linker_using_t_text="no"
1860 AC_SUBST([FLAG_T_TEXT], ["-Ttext-segment"])
1861 AC_MSG_RESULT([yes])
1863 linker_using_t_text="yes"
1864 AC_SUBST([FLAG_T_TEXT], ["-Ttext"])
1869 # If the linker only supports -Ttext (not -Ttext-segment) then we will
1870 # have to strip any build-id ELF NOTEs from the staticly linked tools.
1871 # Otherwise the build-id NOTE might end up at the default load address.
1872 # (Pedantically if the linker is gold then -Ttext is fine, but newer
1873 # gold versions also support -Ttext-segment. So just assume that unless
1874 # we can use -Ttext-segment we need to strip the build-id NOTEs.
1875 if test "x${linker_using_t_text}" = "xyes"; then
1876 AC_MSG_NOTICE([ld -Ttext used, need to strip build-id NOTEs.])
1877 # does the linker support -Wl,--build-id=none ? Note, it's
1878 # important that we test indirectly via whichever C compiler
1879 # is selected, rather than testing /usr/bin/ld or whatever
1881 AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
1883 CFLAGS="-Wl,--build-id=none"
1886 [AC_LANG_PROGRAM([ ], [return 0;])],
1888 AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
1889 AC_MSG_RESULT([yes])
1891 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1895 AC_MSG_NOTICE([ld -Ttext-segment used, no need to strip build-id NOTEs.])
1896 AC_SUBST([FLAG_NO_BUILD_ID], [""])
1900 # does the ppc assembler support "mtocrf" et al?
1901 AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
1903 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1904 __asm__ __volatile__("mtocrf 4,0");
1905 __asm__ __volatile__("mfocrf 0,4");
1907 ac_have_as_ppc_mftocrf=yes
1908 AC_MSG_RESULT([yes])
1910 ac_have_as_ppc_mftocrf=no
1913 if test x$ac_have_as_ppc_mftocrf = xyes ; then
1914 AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
1918 # does the ppc assembler support "lfdp" and other phased out floating point insns?
1919 AC_MSG_CHECKING([if ppc32/64 asm supports phased out floating point instructions])
1921 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1922 do { typedef struct {
1926 dbl_pair_t dbl_pair[3];
1927 __asm__ volatile ("lfdp 10, %0"::"m" (dbl_pair[0]));
1930 ac_have_as_ppc_fpPO=yes
1931 AC_MSG_RESULT([yes])
1933 ac_have_as_ppc_fpPO=no
1936 if test x$ac_have_as_ppc_fpPO = xyes ; then
1937 AC_DEFINE(HAVE_AS_PPC_FPPO, 1, [Define to 1 if as supports floating point phased out category.])
1941 # does the x86/amd64 assembler understand SSE3 instructions?
1942 # Note, this doesn't generate a C-level symbol. It generates a
1943 # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
1944 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
1946 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1947 do { long long int x;
1948 __asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
1952 AC_MSG_RESULT([yes])
1958 AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
1961 # Ditto for SSSE3 instructions (note extra S)
1962 # Note, this doesn't generate a C-level symbol. It generates a
1963 # automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
1964 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
1966 save_CFLAGS="$CFLAGS"
1967 CFLAGS="$CFLAGS -msse"
1968 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1969 do { long long int x;
1970 __asm__ __volatile__(
1971 "pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
1974 ac_have_as_ssse3=yes
1975 AC_MSG_RESULT([yes])
1980 CFLAGS="$save_CFLAGS"
1982 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
1985 # does the x86/amd64 assembler understand the PCLMULQDQ instruction?
1986 # Note, this doesn't generate a C-level symbol. It generates a
1987 # automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
1988 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
1989 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1991 __asm__ __volatile__(
1992 "pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
1995 ac_have_as_pclmulqdq=yes
1996 AC_MSG_RESULT([yes])
1998 ac_have_as_pclmulqdq=no
2002 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
2005 # does the x86/amd64 assembler understand the VPCLMULQDQ instruction?
2006 # Note, this doesn't generate a C-level symbol. It generates a
2007 # automake-level symbol (BUILD_VPCLMULQDQ_TESTS), used in test Makefile.am's
2008 AC_MSG_CHECKING([if x86/amd64 assembler supports 'vpclmulqdq'])
2009 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2012 * Carry-less multiplication of xmm1 with xmm2 and store the result in
2013 * xmm3. The immediate is used to determine which quadwords of xmm1 and
2014 * xmm2 should be used.
2016 __asm__ __volatile__(
2017 "vpclmulqdq \$0,%%xmm1,%%xmm2,%%xmm3" : : : );
2020 ac_have_as_vpclmulqdq=yes
2021 AC_MSG_RESULT([yes])
2023 ac_have_as_vpclmulqdq=no
2027 AM_CONDITIONAL(BUILD_VPCLMULQDQ_TESTS, test x$ac_have_as_vpclmulqdq = xyes)
2030 # does the x86/amd64 assembler understand the LZCNT instruction?
2031 # Note, this doesn't generate a C-level symbol. It generates a
2032 # automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
2033 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
2035 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2037 __asm__ __volatile__("lzcnt %%rax,%%rax" : : : "rax");
2040 ac_have_as_lzcnt=yes
2041 AC_MSG_RESULT([yes])
2047 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
2050 # does the x86/amd64 assembler understand the LOOPNEL instruction?
2051 # Note, this doesn't generate a C-level symbol. It generates a
2052 # automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
2053 AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
2055 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2057 __asm__ __volatile__("1: loopnel 1b\n");
2060 ac_have_as_loopnel=yes
2061 AC_MSG_RESULT([yes])
2063 ac_have_as_loopnel=no
2067 AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
2070 # does the x86/amd64 assembler understand ADDR32 ?
2071 # Note, this doesn't generate a C-level symbol. It generates a
2072 # automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
2073 AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
2075 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2077 asm volatile ("addr32 rep movsb");
2080 ac_have_as_addr32=yes
2081 AC_MSG_RESULT([yes])
2083 ac_have_as_addr32=no
2087 AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
2090 # does the x86/amd64 assembler understand SSE 4.2 instructions?
2091 # Note, this doesn't generate a C-level symbol. It generates a
2092 # automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
2093 AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
2095 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2096 do { long long int x;
2097 __asm__ __volatile__(
2098 "crc32q %%r15,%%r15" : : : "r15" );
2099 __asm__ __volatile__(
2100 "pblendvb (%%rcx), %%xmm11" : : : "memory", "xmm11");
2101 __asm__ __volatile__(
2102 "aesdec %%xmm2, %%xmm1" : : : "xmm2", "xmm1"); }
2105 ac_have_as_sse42=yes
2106 AC_MSG_RESULT([yes])
2112 AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
2115 # does the x86/amd64 assembler understand AVX instructions?
2116 # Note, this doesn't generate a C-level symbol. It generates a
2117 # automake-level symbol (BUILD_AVX_TESTS), used in test Makefile.am's
2118 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX])
2120 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2121 do { long long int x;
2122 __asm__ __volatile__(
2123 "vmovupd (%%rsp), %%ymm7" : : : "xmm7" );
2124 __asm__ __volatile__(
2125 "vaddpd %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2129 AC_MSG_RESULT([yes])
2135 AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
2138 # does the x86/amd64 assembler understand AVX2 instructions?
2139 # Note, this doesn't generate a C-level symbol. It generates a
2140 # automake-level symbol (BUILD_AVX2_TESTS), used in test Makefile.am's
2141 AC_MSG_CHECKING([if x86/amd64 assembler speaks AVX2])
2143 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2144 do { long long int x;
2145 __asm__ __volatile__(
2146 "vpsravd (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2147 __asm__ __volatile__(
2148 "vpaddb %%ymm6,%%ymm7,%%ymm8" : : : "xmm6","xmm7","xmm8"); }
2152 AC_MSG_RESULT([yes])
2158 AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes)
2161 # does the x86/amd64 assembler understand TSX instructions and
2162 # the XACQUIRE/XRELEASE prefixes?
2163 # Note, this doesn't generate a C-level symbol. It generates a
2164 # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's
2165 AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX])
2167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2169 __asm__ __volatile__(
2172 " xacquire lock incq 0(%rsp) \n\t"
2173 " xrelease lock incq 0(%rsp) \n"
2178 AC_MSG_RESULT([yes])
2184 AM_CONDITIONAL(BUILD_TSX_TESTS, test x$ac_have_as_tsx = xyes)
2187 # does the x86/amd64 assembler understand BMI1 and BMI2 instructions?
2188 # Note, this doesn't generate a C-level symbol. It generates a
2189 # automake-level symbol (BUILD_BMI_TESTS), used in test Makefile.am's
2190 AC_MSG_CHECKING([if x86/amd64 assembler speaks BMI1 and BMI2])
2192 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2193 do { unsigned int h, l;
2194 __asm__ __volatile__(
2195 "andn %2, %1, %0" : "=r" (h) : "r" (0x1234567), "r" (0x7654321) );
2196 __asm__ __volatile__(
2197 "movl %2, %%edx; mulx %3, %1, %0" : "=r" (h), "=r" (l) : "g" (0x1234567), "rm" (0x7654321) : "edx" ); }
2201 AC_MSG_RESULT([yes])
2207 AM_CONDITIONAL(BUILD_BMI_TESTS, test x$ac_have_as_bmi = xyes)
2210 # does the x86/amd64 assembler understand FMA instructions?
2211 # Note, this doesn't generate a C-level symbol. It generates a
2212 # automake-level symbol (BUILD_FMA_TESTS), used in test Makefile.am's
2213 AC_MSG_CHECKING([if x86/amd64 assembler speaks FMA])
2215 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2216 do { unsigned int h, l;
2217 __asm__ __volatile__(
2218 "vfmadd132ps (%%rsp), %%ymm8, %%ymm7" : : : "xmm7", "xmm8" );
2219 __asm__ __volatile__(
2220 "vfnmsub231sd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" );
2221 __asm__ __volatile__(
2222 "vfmsubadd213pd (%%rsp), %%xmm8, %%xmm7" : : : "xmm7", "xmm8" ); }
2226 AC_MSG_RESULT([yes])
2232 AM_CONDITIONAL(BUILD_FMA_TESTS, test x$ac_have_as_fma = xyes)
2235 # does the amd64 assembler understand MPX instructions?
2236 # Note, this doesn't generate a C-level symbol. It generates a
2237 # automake-level symbol (BUILD_MPX_TESTS), used in test Makefile.am's
2238 AC_MSG_CHECKING([if amd64 assembler knows the MPX instructions])
2240 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2241 asm ("bndmov %bnd0,(%rsp)")
2244 AC_MSG_RESULT([yes])
2250 AM_CONDITIONAL(BUILD_MPX_TESTS, test x$ac_have_as_mpx = xyes)
2253 # Does the C compiler support the "ifunc" attribute
2254 # Note, this doesn't generate a C-level symbol. It generates a
2255 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2256 # does the x86/amd64 assembler understand MOVBE?
2257 # Note, this doesn't generate a C-level symbol. It generates a
2258 # automake-level symbol (BUILD_MOVBE_TESTS), used in test Makefile.am's
2259 AC_MSG_CHECKING([if x86/amd64 assembler knows the MOVBE insn])
2261 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
2262 do { long long int x;
2263 __asm__ __volatile__(
2264 "movbe (%%rsp), %%r15" : : : "memory", "r15" ); }
2267 ac_have_as_movbe=yes
2268 AC_MSG_RESULT([yes])
2274 AM_CONDITIONAL(BUILD_MOVBE_TESTS, test x$ac_have_as_movbe = xyes)
2277 # Does the C compiler support the "ifunc" attribute
2278 # Note, this doesn't generate a C-level symbol. It generates a
2279 # automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
2280 AC_MSG_CHECKING([if gcc supports the ifunc attribute])
2282 AC_LINK_IFELSE([AC_LANG_SOURCE([[
2283 static void mytest(void) {}
2285 static void (*resolve_test(void))(void)
2287 return (void (*)(void))&mytest;
2290 void test(void) __attribute__((ifunc("resolve_test")));
2298 ac_have_ifunc_attr=yes
2299 AC_MSG_RESULT([yes])
2301 ac_have_ifunc_attr=no
2305 AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
2308 # XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
2309 # when building the tool executables. I think we should get rid of it.
2311 # Check for TLS support in the compiler and linker
2312 AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2314 [vg_cv_linktime_tls=yes],
2315 [vg_cv_linktime_tls=no])
2316 # Native compilation: check whether running a program using TLS succeeds.
2317 # Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
2318 # succeeds but running programs using TLS fails.
2319 # Cross-compiling: check whether linking a program using TLS succeeds.
2320 AC_CACHE_CHECK([for TLS support], vg_cv_tls,
2321 [AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
2322 [vg_cv_tls=$enableval],
2323 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
2327 [vg_cv_tls=$vg_cv_linktime_tls])])])
2329 if test "$vg_cv_tls" = yes; then
2330 AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
2334 #----------------------------------------------------------------------------
2335 # Checks for C header files.
2336 #----------------------------------------------------------------------------
2339 AC_CHECK_HEADERS([ \
2355 # Verify whether the <linux/futex.h> header is usable.
2356 AC_MSG_CHECKING([if <linux/futex.h> is usable])
2358 save_CFLAGS="$CFLAGS"
2359 CFLAGS="$CFLAGS -D__user="
2360 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2361 #include <linux/futex.h>
2365 ac_have_usable_linux_futex_h=yes
2366 AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
2367 [Define to 1 if you have a usable <linux/futex.h> header file.])
2368 AC_MSG_RESULT([yes])
2370 ac_have_usable_linux_futex_h=no
2373 CFLAGS="$save_CFLAGS"
2376 #----------------------------------------------------------------------------
2377 # Checks for typedefs, structures, and compiler characteristics.
2378 #----------------------------------------------------------------------------
2385 #----------------------------------------------------------------------------
2386 # Checks for library functions.
2387 #----------------------------------------------------------------------------
2391 AC_CHECK_LIB([pthread], [pthread_create])
2392 AC_CHECK_LIB([rt], [clock_gettime])
2405 pthread_barrier_init \
2406 pthread_condattr_setclock \
2407 pthread_mutex_timedlock \
2408 pthread_rwlock_timedrdlock \
2409 pthread_rwlock_timedwrlock \
2412 pthread_setname_np \
2428 # AC_CHECK_LIB adds any library found to the variable LIBS, and links these
2429 # libraries with any shared object and/or executable. This is NOT what we
2430 # want for e.g. vgpreload_core-x86-linux.so
2433 AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
2434 [test x$ac_cv_func_pthread_barrier_init = xyes])
2435 AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
2436 [test x$ac_cv_func_pthread_mutex_timedlock = xyes])
2437 AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
2438 [test x$ac_cv_func_pthread_spin_lock = xyes])
2439 AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP],
2440 [test x$ac_cv_func_pthread_setname_np = xyes])
2442 if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2443 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
2444 AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
2445 [Disable intercept pthread_spin_lock() on MIPS32 and MIPS64.])
2448 #----------------------------------------------------------------------------
2450 #----------------------------------------------------------------------------
2451 # Do we have a useable MPI setup on the primary and/or secondary targets?
2452 # On Linux, by default, assumes mpicc and -m32/-m64
2453 # Note: this is a kludge in that it assumes the specified mpicc
2454 # understands -m32/-m64 regardless of what is specified using
2456 AC_PATH_PROG([MPI_CC], [mpicc], [mpicc],
2457 [$PATH:/usr/lib/openmpi/bin:/usr/lib64/openmpi/bin])
2460 if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
2461 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
2462 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
2463 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
2464 -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then
2465 mflag_primary=$FLAG_M32
2466 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
2467 -o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
2468 -o x$VGCONF_PLATFORM_PRI_CAPS = xARM64_LINUX \
2469 -o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
2470 mflag_primary=$FLAG_M64
2471 elif test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN ; then
2472 mflag_primary="$FLAG_M32 -arch i386"
2473 elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN ; then
2474 mflag_primary="$FLAG_M64 -arch x86_64"
2478 if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
2479 -o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
2480 mflag_secondary=$FLAG_M32
2481 elif test x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN ; then
2482 mflag_secondary="$FLAG_M32 -arch i386"
2487 [ --with-mpicc= Specify name of MPI2-ised C compiler],
2492 ## We AM_COND_IF here instead of automake "if" in mpi/Makefile.am so that we can
2493 ## use these values in the check for a functioning mpicc.
2495 ## We leave the MPI_FLAG_M3264_ logic in mpi/Makefile.am and assume that
2496 ## mflag_primary/mflag_secondary are sufficient approximations of that behavior
2497 AM_COND_IF([VGCONF_OS_IS_LINUX],
2498 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
2499 LDFLAGS_MPI="-fpic -shared"])
2500 AM_COND_IF([VGCONF_OS_IS_DARWIN],
2501 [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -dynamic"
2502 LDFLAGS_MPI="-dynamic -dynamiclib -all_load"])
2504 AC_SUBST([CFLAGS_MPI])
2505 AC_SUBST([LDFLAGS_MPI])
2508 ## See if MPI_CC works for the primary target
2510 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
2512 saved_CFLAGS=$CFLAGS
2514 CFLAGS="$CFLAGS_MPI $mflag_primary"
2515 saved_LDFLAGS="$LDFLAGS"
2516 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
2517 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2521 int ni, na, nd, comb;
2522 int r = MPI_Init(NULL,NULL);
2523 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2524 r |= MPI_Finalize();
2527 ac_have_mpi2_pri=yes
2528 AC_MSG_RESULT([yes, $MPI_CC])
2534 CFLAGS=$saved_CFLAGS
2535 LDFLAGS="$saved_LDFLAGS"
2536 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
2538 ## See if MPI_CC works for the secondary target. Complication: what if
2539 ## there is no secondary target? We need this to then fail.
2540 ## Kludge this by making MPI_CC something which will surely fail in
2543 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
2545 saved_CFLAGS=$CFLAGS
2546 saved_LDFLAGS="$LDFLAGS"
2547 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
2548 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
2549 CC="$MPI_CC this will surely fail"
2553 CFLAGS="$CFLAGS_MPI $mflag_secondary"
2554 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2558 int ni, na, nd, comb;
2559 int r = MPI_Init(NULL,NULL);
2560 r |= MPI_Type_get_envelope( MPI_INT, &ni, &na, &nd, &comb );
2561 r |= MPI_Finalize();
2564 ac_have_mpi2_sec=yes
2565 AC_MSG_RESULT([yes, $MPI_CC])
2571 CFLAGS=$saved_CFLAGS
2572 LDFLAGS="$saved_LDFLAGS"
2573 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
2576 #----------------------------------------------------------------------------
2577 # Other library checks
2578 #----------------------------------------------------------------------------
2579 # There now follow some tests for Boost, and OpenMP. These
2580 # tests are present because Drd has some regression tests that use
2581 # these packages. All regression test programs all compiled only
2582 # for the primary target. And so it is important that the configure
2583 # checks that follow, use the correct -m32 or -m64 flag for the
2584 # primary target (called $mflag_primary). Otherwise, we can end up
2585 # in a situation (eg) where, on amd64-linux, the test for Boost checks
2586 # for usable 64-bit Boost facilities, but because we are doing a 32-bit
2587 # only build (meaning, the primary target is x86-linux), the build
2588 # of the regtest programs that use Boost fails, because they are
2589 # build as 32-bit (IN THIS EXAMPLE).
2591 # Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
2592 # NEEDED BY THE REGRESSION TEST PROGRAMS.
2595 # Check whether the boost library 1.35 or later has been installed.
2596 # The Boost.Threads library has undergone a major rewrite in version 1.35.0.
2598 AC_MSG_CHECKING([for boost])
2601 safe_CXXFLAGS=$CXXFLAGS
2602 CXXFLAGS="$mflag_primary"
2604 LIBS="-lboost_thread-mt -lboost_system-mt $LIBS"
2606 AC_LINK_IFELSE([AC_LANG_SOURCE([
2607 #include <boost/thread.hpp>
2608 static void thread_func(void)
2610 int main(int argc, char** argv)
2612 boost::thread t(thread_func);
2617 ac_have_boost_1_35=yes
2618 AC_SUBST([BOOST_CFLAGS], [])
2619 AC_SUBST([BOOST_LIBS], ["-lboost_thread-mt -lboost_system-mt"])
2620 AC_MSG_RESULT([yes])
2622 ac_have_boost_1_35=no
2627 CXXFLAGS=$safe_CXXFLAGS
2630 AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
2633 # does this compiler support -fopenmp, does it have the include file
2634 # <omp.h> and does it have libgomp ?
2636 AC_MSG_CHECKING([for OpenMP])
2639 CFLAGS="-fopenmp $mflag_primary"
2641 AC_LINK_IFELSE([AC_LANG_SOURCE([
2643 int main(int argc, char** argv)
2651 AC_MSG_RESULT([yes])
2658 AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
2661 # does this compiler have built-in functions for atomic memory access for the
2663 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the primary target])
2666 CFLAGS="$mflag_primary"
2668 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2670 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2671 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
2673 ac_have_builtin_atomic_primary=yes
2674 AC_MSG_RESULT([yes])
2675 AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() and __sync_add_and_fetch() for the primary target])
2677 ac_have_builtin_atomic_primary=no
2683 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC],
2684 [test x$ac_have_builtin_atomic_primary = xyes])
2687 # does this compiler have built-in functions for atomic memory access for the
2688 # secondary target ?
2690 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2692 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch for the secondary target])
2695 CFLAGS="$mflag_secondary"
2697 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2699 return (__sync_add_and_fetch(&variable, 1) ? 1 : 0)
2701 ac_have_builtin_atomic_secondary=yes
2702 AC_MSG_RESULT([yes])
2704 ac_have_builtin_atomic_secondary=no
2712 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_SECONDARY],
2713 [test x$ac_have_builtin_atomic_secondary = xyes])
2715 # does this compiler have built-in functions for atomic memory access on
2716 # 64-bit integers for all targets ?
2718 AC_MSG_CHECKING([if gcc supports __sync_add_and_fetch on uint64_t for all targets])
2720 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2723 uint64_t variable = 1;
2724 return __sync_add_and_fetch(&variable, 1)
2726 ac_have_builtin_atomic64_primary=yes
2728 ac_have_builtin_atomic64_primary=no
2731 if test x$VGCONF_PLATFORM_SEC_CAPS != x; then
2734 CFLAGS="$mflag_secondary"
2736 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2739 uint64_t variable = 1;
2740 return __sync_add_and_fetch(&variable, 1)
2742 ac_have_builtin_atomic64_secondary=yes
2744 ac_have_builtin_atomic64_secondary=no
2751 if test x$ac_have_builtin_atomic64_primary = xyes && \
2752 test x$VGCONF_PLATFORM_SEC_CAPS = x \
2753 -o x$ac_have_builtin_atomic64_secondary = xyes; then
2754 AC_MSG_RESULT([yes])
2755 ac_have_builtin_atomic64=yes
2758 ac_have_builtin_atomic64=no
2761 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC64],
2762 [test x$ac_have_builtin_atomic64 = xyes])
2765 # does g++ have built-in functions for atomic memory access ?
2766 AC_MSG_CHECKING([if g++ supports __sync_add_and_fetch])
2768 safe_CXXFLAGS=$CXXFLAGS
2769 CXXFLAGS="$mflag_primary"
2772 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
2774 return (__sync_bool_compare_and_swap(&variable, 1, 2)
2775 && __sync_add_and_fetch(&variable, 1) ? 1 : 0)
2777 ac_have_builtin_atomic_cxx=yes
2778 AC_MSG_RESULT([yes])
2779 AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
2781 ac_have_builtin_atomic_cxx=no
2786 CXXFLAGS=$safe_CXXFLAGS
2788 AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
2791 if test x$ac_have_usable_linux_futex_h = xyes \
2792 -a x$ac_have_builtin_atomic_primary = xyes; then
2793 ac_enable_linux_ticket_lock_primary=yes
2795 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_PRIMARY],
2796 [test x$ac_enable_linux_ticket_lock_primary = xyes])
2798 if test x$VGCONF_PLATFORM_SEC_CAPS != x \
2799 -a x$ac_have_usable_linux_futex_h = xyes \
2800 -a x$ac_have_builtin_atomic_secondary = xyes; then
2801 ac_enable_linux_ticket_lock_secondary=yes
2803 AM_CONDITIONAL([ENABLE_LINUX_TICKET_LOCK_SECONDARY],
2804 [test x$ac_enable_linux_ticket_lock_secondary = xyes])
2807 # does libstdc++ support annotating shared pointers ?
2808 AC_MSG_CHECKING([if libstdc++ supports annotating shared pointers])
2810 safe_CXXFLAGS=$CXXFLAGS
2811 CXXFLAGS="-std=c++0x"
2814 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2817 std::shared_ptr<int> p
2819 ac_have_shared_ptr=yes
2821 ac_have_shared_ptr=no
2823 if test x$ac_have_shared_ptr = xyes; then
2824 # If compilation of the program below fails because of a syntax error
2825 # triggered by substituting one of the annotation macros then that
2826 # means that libstdc++ supports these macros.
2827 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2828 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(a) (a)----
2829 #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(a) (a)----
2832 std::shared_ptr<int> p
2834 ac_have_shared_pointer_annotation=no
2837 ac_have_shared_pointer_annotation=yes
2838 AC_MSG_RESULT([yes])
2839 AC_DEFINE(HAVE_SHARED_POINTER_ANNOTATION, 1,
2840 [Define to 1 if libstd++ supports annotating shared pointers])
2843 ac_have_shared_pointer_annotation=no
2848 CXXFLAGS=$safe_CXXFLAGS
2850 AM_CONDITIONAL([HAVE_SHARED_POINTER_ANNOTATION],
2851 [test x$ac_have_shared_pointer_annotation = xyes])
2854 #----------------------------------------------------------------------------
2855 # Ok. We're done checking.
2856 #----------------------------------------------------------------------------
2858 # Nb: VEX/Makefile is generated from Makefile.vex.in.
2861 VEX/Makefile:Makefile.vex.in
2870 gdbserver_tests/Makefile
2876 memcheck/tests/Makefile
2877 memcheck/tests/common/Makefile
2878 memcheck/tests/amd64/Makefile
2879 memcheck/tests/x86/Makefile
2880 memcheck/tests/linux/Makefile
2881 memcheck/tests/darwin/Makefile
2882 memcheck/tests/amd64-linux/Makefile
2883 memcheck/tests/x86-linux/Makefile
2884 memcheck/tests/ppc32/Makefile
2885 memcheck/tests/ppc64/Makefile
2886 memcheck/tests/s390x/Makefile
2887 memcheck/tests/vbit-test/Makefile
2889 cachegrind/tests/Makefile
2890 cachegrind/tests/x86/Makefile
2891 cachegrind/cg_annotate
2894 callgrind/callgrind_annotate
2895 callgrind/callgrind_control
2896 callgrind/tests/Makefile
2898 helgrind/tests/Makefile
2900 massif/tests/Makefile
2903 lackey/tests/Makefile
2906 none/tests/amd64/Makefile
2907 none/tests/ppc32/Makefile
2908 none/tests/ppc64/Makefile
2909 none/tests/x86/Makefile
2910 none/tests/arm/Makefile
2911 none/tests/arm64/Makefile
2912 none/tests/s390x/Makefile
2913 none/tests/mips32/Makefile
2914 none/tests/mips64/Makefile
2915 none/tests/linux/Makefile
2916 none/tests/darwin/Makefile
2917 none/tests/x86-linux/Makefile
2918 exp-sgcheck/Makefile
2919 exp-sgcheck/tests/Makefile
2921 drd/scripts/download-and-build-splash2
2924 exp-bbv/tests/Makefile
2925 exp-bbv/tests/x86/Makefile
2926 exp-bbv/tests/x86-linux/Makefile
2927 exp-bbv/tests/amd64-linux/Makefile
2928 exp-bbv/tests/ppc32-linux/Makefile
2929 exp-bbv/tests/arm-linux/Makefile
2931 exp-dhat/tests/Makefile
2934 AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
2935 [chmod +x coregrind/link_tool_exe_linux])
2936 AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
2937 [chmod +x coregrind/link_tool_exe_darwin])
2942 Maximum build arch: ${ARCH_MAX}
2943 Primary build arch: ${VGCONF_ARCH_PRI}
2944 Secondary build arch: ${VGCONF_ARCH_SEC}
2945 Build OS: ${VGCONF_OS}
2946 Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
2947 Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
2948 Platform variant: ${VGCONF_PLATVARIANT}
2949 Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
2950 Default supp files: ${DEFAULT_SUPP}