Module: xenomai-forge
Branch: next
Commit: e3745af185e4d3ae5bf690c18d4f61a686d9e9b7
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=e3745af185e4d3ae5bf690c18d4f61a686d9e9b7

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Apr 30 10:54:11 2014 +0200

build: automate Valgrind API detection

When the Valgrind API is available to the application process, the
configuration symbol CONFIG_XENO_VALGRIND_API is defined at build
time, and may be tested for existence by the application code. See the
tool documentation at this address:
http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq/

The autoconf script will detect the Valgrind core header on the build
system automatically, and define this symbol accordingly
(i.e. /usr/include/valgrind/valgrind.h).

---

 configure                             |    9 +++++++++
 configure.ac                          |    2 ++
 doc/asciidoc/README.APPLICATIONS.adoc |   20 ++++++++++++++++++++
 include/xeno_config.h.in              |    3 +++
 4 files changed, 34 insertions(+)

diff --git a/configure b/configure
index 8cb3f17..cfd9c60 100755
--- a/configure
+++ b/configure
@@ -13882,6 +13882,15 @@ fi
 
 done
 
+ac_fn_c_check_header_mongrel "$LINENO" "valgrind/valgrind.h" 
"ac_cv_header_valgrind_valgrind_h" "$ac_includes_default"
+if test "x$ac_cv_header_valgrind_valgrind_h" = xyes; then :
+  CONFIG_XENO_VALGRIND_API=y
+fi
+
+
+test x$CONFIG_XENO_VALGRIND_API = xy &&
+$as_echo "#define CONFIG_XENO_VALGRIND_API 1" >>confdefs.h
+
 
 save_LIBS="$LIBS"
 LIBS="$LIBS -lrt -lpthread"
diff --git a/configure.ac b/configure.ac
index 837477f..73b9542 100644
--- a/configure.ac
+++ b/configure.ac
@@ -499,6 +499,8 @@ fi
 
 dnl Determine whether some specific headers are present on this system.
 AC_CHECK_HEADERS(mqueue.h)
+AC_CHECK_HEADER(valgrind/valgrind.h,CONFIG_XENO_VALGRIND_API=y)
+test x$CONFIG_XENO_VALGRIND_API = xy && 
AC_DEFINE(CONFIG_XENO_VALGRIND_API,1,[config])
 
 dnl Check for presence of some routines we need
 save_LIBS="$LIBS"
diff --git a/doc/asciidoc/README.APPLICATIONS.adoc 
b/doc/asciidoc/README.APPLICATIONS.adoc
index b9ebea1..e665745 100644
--- a/doc/asciidoc/README.APPLICATIONS.adoc
+++ b/doc/asciidoc/README.APPLICATIONS.adoc
@@ -162,6 +162,26 @@ switch]).
        defined as a result of running the configure script. The
        program immediately exits with a success code afterwards.
 
+Valgrind support
+----------------
+
+Running Xenomai applications over _Valgrind_ is currently available to
+the _Mercury_ core only.
+
+When the Valgrind API is available to the application process, the
+configuration symbol CONFIG_XENO_VALGRIND_API is defined at build
+time, and may be tested for existence by the application code. See the
+tool documentation at
+http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq/[this
 address].
+
+The Xenomai autoconf script will detect the Valgrind core header on
+the build system automatically, and define this symbol accordingly
+(i.e. /usr/include/valgrind/valgrind.h).
+
+NOTE: You may need to install the Valgrind development package on your
+build system to provide for the core header files. For instance, such
+package is called _valgrind-devel_ on Fedora.
+
 Available real-time APIs
 ------------------------
 
diff --git a/include/xeno_config.h.in b/include/xeno_config.h.in
index fe9e02c..b712cc8 100644
--- a/include/xeno_config.h.in
+++ b/include/xeno_config.h.in
@@ -76,6 +76,9 @@
 #undef CONFIG_XENO_UAPI_LEVEL
 
 /* config */
+#undef CONFIG_XENO_VALGRIND_API
+
+/* config */
 #undef CONFIG_XENO_VERSION_MAJOR
 
 /* config */


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to