initial support for static userspace probes via systemtap

This adds a --enable-systemtap configure option, which will then
add static tracepoints to the generated libosmocore binary.

At this point, only two tracepoints are supported: log_start
and log_done.  They can be used to trace the amount of time
a libosmocore-using application spends in potentiall blocking calls to
log to stderr or to files.

Related: OS#4311
Change-Id: I7e1ab664241deb524c9582cbd1bec31af46c747e
diff --git a/configure.ac b/configure.ac
index 2077570..2a6a180 100644
--- a/configure.ac
+++ b/configure.ac
@@ -433,6 +433,38 @@
 AC_MSG_RESULT([$neon])
 AM_CONDITIONAL(HAVE_NEON, [test "x$neon" != "xno"])
 
+#
+# SystemTap support
+#
+AC_MSG_CHECKING([whether to include systemtap tracing support])
+AC_ARG_ENABLE([systemtap],
+	      [AS_HELP_STRING([--enable-systemtap],
+			      [Enable inclusion of systemtap trace support])],
+	      [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no'])
+AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes])
+AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
+
+if test "x${ENABLE_SYSTEMTAP}" = xyes; then
+  # Additional configuration for --enable-systemtap is HERE
+  AC_CHECK_PROGS(DTRACE, dtrace)
+  if test -z "$DTRACE"; then
+    AC_MSG_ERROR([dtrace not found])
+  fi
+  AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'],
+                [SDT_H_FOUND='no';
+                   AC_MSG_ERROR([systemtap support needs sys/sdt.h header])])
+  AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using SystemTap probes.])
+  AC_ARG_WITH([tapset-install-dir],
+	      [AS_HELP_STRING([--with-tapset-install-dir],
+	         [The absolute path where the tapset dir will be installed])],
+	      [if test "x${withval}" = x; then
+		 ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"
+	       else
+		 ABS_TAPSET_DIR="${withval}"
+	       fi], [ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"])
+  AC_SUBST(ABS_TAPSET_DIR)
+fi
+
 
 OSMO_AC_CODE_COVERAGE
 
@@ -487,6 +519,7 @@
 	src/gb/Makefile
 	src/ctrl/Makefile
 	src/pseudotalloc/Makefile
+	tapset/Makefile
 	tests/Makefile
 	tests/atlocal
 	utils/Makefile