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