Allow inclusion of User Statically Defined Trace (USDT) probes
in the OVS binaries using the --enable-usdt-probes option to the
./configure script.

Signed-off-by: Eelco Chaudron <[email protected]>
---
v2:
 - Fixed option name in the commit message
 - Fixed help string (added space)

 configure.ac      |    1 +
 m4/openvswitch.m4 |   28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/configure.ac b/configure.ac
index eaa9bf7ee..3e72e28bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,7 @@ OVS_CHECK_WIN32
 OVS_CHECK_VISUAL_STUDIO_DDK
 OVS_CHECK_COVERAGE
 OVS_CHECK_NDEBUG
+OVS_CHECK_USDT
 OVS_CHECK_NETLINK
 OVS_CHECK_OPENSSL
 OVS_CHECK_LIBCAPNG
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 772825a71..4c3bace6e 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -60,6 +60,34 @@ AC_DEFUN([OVS_CHECK_NDEBUG],
      [ndebug=false])
    AM_CONDITIONAL([NDEBUG], [test x$ndebug = xtrue])])
 
+dnl Checks for --enable-usdt-probes and defines HAVE_USDT if it is specified.
+AC_DEFUN([OVS_CHECK_USDT], [
+  AC_ARG_ENABLE(
+    [usdt-probes],
+    [AC_HELP_STRING([--enable-usdt-probes],
+                    [Enable User Statically Defined Tracing (USDT) probes])],
+    [case "${enableval}" in
+       (yes) usdt=true ;;
+       (no)  usdt=false ;;
+       (*) AC_MSG_ERROR([bad value ${enableval} for --enable-usdt-probes]) ;;
+     esac],
+    [usdt=false])
+
+  AC_MSG_CHECKING([whether USDT probes are enabled])
+  if test "$usdt" != true; then
+    AC_MSG_RESULT([no])
+  else
+    AC_MSG_RESULT([yes])
+
+    AC_CHECK_HEADER([sys/sdt.h], [],
+      [AC_MSG_ERROR([unable to find sys/sdt.h needed for USDT support])])
+
+    AC_DEFINE([HAVE_USDT_PROBES], [1],
+              [Define to 1 if USDT probes are enabled.])
+  fi
+  AM_CONDITIONAL([HAVE_USDT_PROBES], [test $usdt = true])
+])
+
 dnl Checks for MSVC x64 compiler.
 AC_DEFUN([OVS_CHECK_WIN64],
   [AC_CACHE_CHECK(

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to