Blame SOURCES/systemtap-without_bpf.patch

ed9d46
commit d882ba5fd50d04c1508e00046c2e875cf4f02b3d
ed9d46
Author: Frank Ch. Eigler <fche@redhat.com>
ed9d46
Date:   Tue Jun 26 12:16:04 2018 -0400
ed9d46
ed9d46
    configury: add --without-bpf configure option
ed9d46
    
ed9d46
    Fully autoconf'ing bpf capabilities is error-prone, so provide a blunt
ed9d46
    instrument.
ed9d46
ed9d46
diff --git a/configure b/configure
ed9d46
index 1864edd..df512e7 100755
ed9d46
--- a/configure
ed9d46
+++ b/configure
ed9d46
@@ -917,6 +917,7 @@ with_dyninst
ed9d46
 enable_virt
ed9d46
 with_python2_probes
ed9d46
 with_python3_probes
ed9d46
+with_bpf
ed9d46
 with_selinux
ed9d46
 with_java
ed9d46
 with_extra_version
ed9d46
@@ -1639,6 +1640,7 @@ Optional Packages:
ed9d46
   --without-python3-probes
ed9d46
                           Disable building python version 3 probe support,
ed9d46
                           even if it is available
ed9d46
+  --without-bpf           Do not try to build BPF components
ed9d46
   --without-selinux       Do not use libselinux even if present
ed9d46
   --with-java=DIRECTORY   Specify JDK directory to compile libHelperSDT.so
ed9d46
                           against (default is /usr/lib/jvm/java)
ed9d46
@@ -12306,9 +12308,16 @@ if test $stap_cv_sectionq = yes; then
ed9d46
 fi
ed9d46
 
ed9d46
 
ed9d46
-$as_echo "#define HAVE_BPF_DECLS 0" >>confdefs.h
ed9d46
 
ed9d46
-ac_fn_c_check_decl "$LINENO" "BPF_PROG_TYPE_PERF_EVENT" "ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" "#include <linux/bpf.h>
ed9d46
+# Check whether --with-bpf was given.
ed9d46
+if test "${with_bpf+set}" = set; then :
ed9d46
+  withval=$with_bpf;
ed9d46
+fi
ed9d46
+
ed9d46
+
ed9d46
+if test "x$with_bpf" != "xno"; then :
ed9d46
+
ed9d46
+    ac_fn_c_check_decl "$LINENO" "BPF_PROG_TYPE_PERF_EVENT" "ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" "#include <linux/bpf.h>
ed9d46
 "
ed9d46
 if test "x$ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" = xyes; then :
ed9d46
   ac_have_decl=1
ed9d46
@@ -12320,10 +12329,13 @@ cat >>confdefs.h <<_ACEOF
ed9d46
 #define HAVE_DECL_BPF_PROG_TYPE_PERF_EVENT $ac_have_decl
ed9d46
 _ACEOF
ed9d46
 if test $ac_have_decl = 1; then :
ed9d46
-  $as_echo "#define HAVE_BPF_DECLS 1" >>confdefs.h
ed9d46
+
ed9d46
+$as_echo "#define HAVE_BPF_DECLS 1" >>confdefs.h
ed9d46
 
ed9d46
 fi
ed9d46
 
ed9d46
+
ed9d46
+fi
ed9d46
  if test "x$ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" == "xyes"; then
ed9d46
   HAVE_BPF_DECLS_TRUE=
ed9d46
   HAVE_BPF_DECLS_FALSE='#'
ed9d46
@@ -12332,7 +12344,6 @@ else
ed9d46
   HAVE_BPF_DECLS_FALSE=
ed9d46
 fi
ed9d46
 
ed9d46
-
ed9d46
 ac_config_files="$ac_config_files includes/sys/sdt-config.h po/Makefile.in"
ed9d46
 
ed9d46
 
ed9d46
diff --git a/configure.ac b/configure.ac
ed9d46
index 9d14db5..f541473 100644
ed9d46
--- a/configure.ac
ed9d46
+++ b/configure.ac
ed9d46
@@ -796,14 +796,20 @@ if test $stap_cv_sectionq = yes; then
ed9d46
   support_section_question=1
ed9d46
 fi
ed9d46
 
ed9d46
-dnl Check if we have <linux/bpf.h> for bpf backend.
ed9d46
-AC_DEFINE([HAVE_BPF_DECLS], [0], [Define to 1 if you have the necessary declarations in bpf.h])
ed9d46
-AC_CHECK_DECLS([BPF_PROG_TYPE_PERF_EVENT],
ed9d46
-               [AC_DEFINE([HAVE_BPF_DECLS], [1])],
ed9d46
+
ed9d46
+AC_ARG_WITH([bpf],
ed9d46
+  AS_HELP_STRING([--without-bpf],[Do not try to build BPF components]))
ed9d46
+
ed9d46
+dnl Allow --without-bpf to disable this autodetection, as some kernels
ed9d46
+dnl have some headers but missing some decls like __NR_bpf.  Too hard
ed9d46
+dnl to detect all the prereqs here.
ed9d46
+AS_IF([test "x$with_bpf" != "xno"], [
ed9d46
+    AC_CHECK_DECLS([BPF_PROG_TYPE_PERF_EVENT],
ed9d46
+               [AC_DEFINE([HAVE_BPF_DECLS], [1], [Define to 1 if you have the necessary declarations in bpf.h])],
ed9d46
                [],
ed9d46
                [#include <linux/bpf.h>])
ed9d46
+    ])
ed9d46
 AM_CONDITIONAL(HAVE_BPF_DECLS, [test "x$ac_cv_have_decl_BPF_PROG_TYPE_PERF_EVENT" == "xyes"])
ed9d46
-
ed9d46
 AC_CONFIG_FILES([includes/sys/sdt-config.h po/Makefile.in])
ed9d46
 
ed9d46
 if test $build_elfutils = yes -a $enable_translator = yes; then