2008-02-12 08:46:27 +00:00
|
|
|
# -*- shell-script -*-
|
|
|
|
#
|
2008-04-23 11:50:42 +00:00
|
|
|
# Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
2008-02-12 08:46:27 +00:00
|
|
|
# University of Stuttgart. All rights reserved.
|
2014-10-07 09:55:54 -07:00
|
|
|
# Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
|
2008-02-12 08:46:27 +00:00
|
|
|
# $COPYRIGHT$
|
|
|
|
#
|
|
|
|
# Additional copyrights may follow
|
|
|
|
#
|
|
|
|
# $HEADER$
|
|
|
|
#
|
2010-09-18 07:14:58 +00:00
|
|
|
|
2010-09-17 23:04:06 +00:00
|
|
|
AC_DEFUN([MCA_opal_memchecker_valgrind_PRIORITY], [10])
|
2008-02-12 08:46:27 +00:00
|
|
|
|
2010-09-17 23:04:06 +00:00
|
|
|
AC_DEFUN([MCA_opal_memchecker_valgrind_COMPILE_MODE], [
|
2008-02-12 08:46:27 +00:00
|
|
|
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])
|
|
|
|
$4="static"
|
|
|
|
AC_MSG_RESULT([$$4])
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# MCA_memchecker_valgrind_CONFIG([action-if-found], [action-if-not-found])
|
|
|
|
# -----------------------------------------------------------
|
2010-09-17 23:04:06 +00:00
|
|
|
AC_DEFUN([MCA_opal_memchecker_valgrind_CONFIG],[
|
|
|
|
AC_CONFIG_FILES([opal/mca/memchecker/valgrind/Makefile])
|
|
|
|
|
2010-11-12 23:22:11 +00:00
|
|
|
OPAL_VAR_SCOPE_PUSH([opal_memchecker_valgrind_save_CPPFLAGS opal_memchecker_valgrind_happy opal_memchecker_valgrind_CPPFLAGS])
|
2008-02-12 08:46:27 +00:00
|
|
|
|
2008-05-19 23:13:31 +00:00
|
|
|
AC_ARG_WITH([valgrind],
|
|
|
|
[AC_HELP_STRING([--with-valgrind(=DIR)],
|
|
|
|
[Directory where the valgrind software is installed])])
|
2014-05-01 15:38:07 +00:00
|
|
|
OPAL_CHECK_WITHDIR([valgrind], [$with_valgrind], [include/valgrind/valgrind.h])
|
2008-02-12 08:46:27 +00:00
|
|
|
|
2008-10-21 03:27:43 +00:00
|
|
|
opal_memchecker_valgrind_CPPFLAGS=
|
|
|
|
opal_memchecker_valgrind_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
opal_memchecker_valgrind_happy=no
|
2008-06-04 11:46:50 +00:00
|
|
|
AS_IF([test "$with_valgrind" != "no"],
|
|
|
|
[AS_IF([test ! -z "$with_valgrind" -a "$with_valgrind" != "yes"],
|
2010-08-27 22:45:02 +00:00
|
|
|
[opal_memchecker_valgrind_CPPFLAGS="-I$with_valgrind/include"
|
|
|
|
# We need this -I to stay in CPPFLAGS when we're done
|
|
|
|
CPPFLAGS="$CPPFLAGS -I$with_valgrind/include"
|
|
|
|
opal_memchecker_valgrind_save_CPPFLAGS=$CPPFLAGS])
|
2008-06-04 11:46:50 +00:00
|
|
|
AC_CHECK_HEADERS([valgrind/valgrind.h],
|
|
|
|
[AC_MSG_CHECKING([for VALGRIND_CHECK_MEM_IS_ADDRESSABLE])
|
2010-09-23 22:37:52 +00:00
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
2008-06-04 11:46:50 +00:00
|
|
|
#include "valgrind/memcheck.h"
|
|
|
|
]],
|
2014-10-07 09:55:54 -07:00
|
|
|
[[char buffer = 0x0f;
|
2010-09-23 22:37:52 +00:00
|
|
|
VALGRIND_CHECK_MEM_IS_ADDRESSABLE(&buffer, sizeof(buffer));]])],
|
2008-06-04 11:46:50 +00:00
|
|
|
[AC_MSG_RESULT([yes])
|
2008-10-21 03:27:43 +00:00
|
|
|
opal_memchecker_valgrind_happy=yes],
|
2008-06-04 11:58:41 +00:00
|
|
|
[AC_MSG_RESULT([no])
|
2010-09-18 07:14:58 +00:00
|
|
|
AC_MSG_WARN([Need Valgrind version 3.2.0 or later. Can not build component.])]
|
2008-06-04 11:58:41 +00:00
|
|
|
[AC_MSG_RESULT([cross-compiling; assume yes...?])
|
2008-10-17 23:04:39 +00:00
|
|
|
AC_MSG_WARN([OMPI will fail to compile if you do not have Valgrind version 3.2.0 or later])
|
2008-10-21 03:27:43 +00:00
|
|
|
opal_memchecker_valgrind_happy=yes]),
|
2008-06-04 11:46:50 +00:00
|
|
|
],
|
|
|
|
[AC_MSG_WARN([valgrind.h not found])
|
|
|
|
AC_MSG_WARN([Cannot compile this component])])])
|
2008-10-21 03:27:43 +00:00
|
|
|
CPPFLAGS="$opal_memchecker_valgrind_save_CPPFLAGS"
|
2008-02-12 08:46:27 +00:00
|
|
|
|
2010-09-18 07:14:58 +00:00
|
|
|
# If we specifically requested this component and can't build it, error
|
2010-10-07 22:39:08 +00:00
|
|
|
AS_IF([test "$with_valgrind" != "no" -a "$with_valgrind" != "" -a "$opal_memchecker_valgrind_happy" != "yes"],
|
2010-09-18 07:14:58 +00:00
|
|
|
[AC_MSG_ERROR([Cannot continue])])
|
|
|
|
|
2008-10-21 03:27:43 +00:00
|
|
|
AS_IF([test "$opal_memchecker_valgrind_happy" = "yes"],
|
2010-08-27 22:45:02 +00:00
|
|
|
[$1],[$2])
|
2008-10-17 23:04:39 +00:00
|
|
|
|
2010-08-27 22:45:02 +00:00
|
|
|
AC_SUBST([opal_memchecker_valgrind_CPPFLAGS])
|
2008-10-17 23:04:39 +00:00
|
|
|
|
2010-11-12 23:22:11 +00:00
|
|
|
OPAL_VAR_SCOPE_POP
|
2008-02-12 08:46:27 +00:00
|
|
|
])dnl
|