On Tue, 2016-08-30 at 23:38 +0200, Julian Ospald wrote: > -dnl Check if we have <linux/bpf.h> for EM_BPF disassembly. > -AC_CHECK_HEADERS(linux/bpf.h) > -AM_CONDITIONAL(HAVE_LINUX_BPF_H, [test "x$ac_cv_header_linux_bpf_h" = > "xyes"]) > +dnl Check if we have <linux/bpf.h> for EM_BPF disassembly and it has the > required defines > +AC_COMPILE_IFELSE( > + [AC_LANG_PROGRAM( > + [#include <linux/bpf.h>], > + [int foo=BPF_PSEUDO_MAP_FD; return 0;] > + )], > + [have_bpf="true"], > + [have_bpf="false"] > +) > + > +if test "$have_bpf" = "true" ; then > + AC_DEFINE([HAVE_LINUX_BPF_H], [1], [if we have <linux/bpf.h> for EM_BPF > disassembly]) > +fi > +AM_CONDITIONAL(HAVE_LINUX_BPF_H, [test "$have_bpf" = "true"])
Thanks, that does look like the correct configure check. But it seems that BPF_PSEUDO_MAP_FD is the only missing constant introduced since 3.18 (when linux/bpf.h was added) that we use. So maybe we could simply define it ourselves when not found. So we can build against any linux/bpf.h out there. What do people think of the following? diff --git a/libcpu/bpf_disasm.c b/libcpu/bpf_disasm.c index 153dba9..e4bbae4 100644 --- a/libcpu/bpf_disasm.c +++ b/libcpu/bpf_disasm.c @@ -40,6 +40,10 @@ #include "../libelf/common.h" #include "../libebl/libeblP.h" +/* BPF_PSEUDO_MAP_FD was only introduced in linux 3.20. */ +#ifndef BPF_PSEUDO_MAP_FD + #define BPF_PSEUDO_MAP_FD 1 +#endif static const char class_string[8][8] = { [BPF_LD] = "ld", Thanks, Mark