configure: build without BPF support in ir-keytable
PATCH v2 1/1 configure: build without BPF support in ir-keytable
It currently does not build on mips and some platforms do not have BPF support yet (risc-v, for example).
Signed-off-by Sean Young <[email protected]>
--- configure.ac | 17 +++++++++++++---- utils/keytable/Makefile.am | 7 ++++--- utils/keytable/keytable.c | 5 ++++- 3 files changed, 21 insertions(+), 8 deletions(-)
configure.ac +13 -4
@@ -173,16 +173,12 @@ AM_CONDITIONAL([HAVE_X11], [test x$x11_pkgconfig = xyes]) PKG_CHECK_MODULES([LIBELF], [libelf], [libelf_pkgconfig=yes], [libelf_pkgconfig=no]) AC_SUBST([LIBELF_CFLAGS]) AC_SUBST([LIBELF_LIBS]) -AM_CONDITIONAL([HAVE_LIBELF], [test x$libelf_pkgconfig = xyes]) if test "x$libelf_pkgconfig" = "xyes"; then AC_CHECK_PROG([CLANG], clang, clang) - AC_DEFINE([HAVE_LIBELF], [1], [libelf library is present]) else AC_MSG_WARN(libelf library not available) fi -AM_CONDITIONAL([BPF_PROTOCOLS], [test x$CLANG = xclang]) - AS_IF([test "x$x11_pkgconfig" = xyes], [PKG_CHECK_MODULES(GL, [gl], [gl_pkgconfig=yes], [gl_pkgconfig=no])], [gl_pkgconfig=no]) AC_SUBST([GL_CFLAGS])
@@ -453,6 +449,14 @@ AC_ARG_ENABLE(gconv, esac] ) +AC_ARG_ENABLE(bpf, + AS_HELP_STRING([--disable-bpf], [disable IR BPF decoders]), + [case "${enableval}" in + yes | no ) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-bpf) ;; + esac] +) + PKG_CHECK_MODULES([SDL2], [sdl2 SDL2_image], [sdl_pc=yes], [sdl_pc=no]) AM_CONDITIONAL([HAVE_SDL], [test x$sdl_pc = xyes])
@@ -475,6 +479,7 @@ AM_CONDITIONAL([WITH_GCONV], [test x$enable_gconv = xyes -a x$enable_shar AM_CONDITIONAL([WITH_V4L2_CTL_LIBV4L], [test x${enable_v4l2_ctl_libv4l} != xno]) AM_CONDITIONAL([WITH_V4L2_CTL_STREAM_TO], [test x${enable_v4l2_ctl_stream_to} != xno]) AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x${enable_v4l2_compliance_libv4l} != xno]) +AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$CLANG = xclang]) # append -static to libtool compile and link command to enforce static libs AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])])
@@ -505,6 +510,9 @@ AM_COND_IF([WITH_V4L_WRAPPERS], [USE_V4L_WRAPPERS="yes"], [USE_V4L_WRAPPERS="no" AM_COND_IF([WITH_GCONV], [USE_GCONV="yes"], [USE_GCONV="no"]) AM_COND_IF([WITH_V4L2_CTL_LIBV4L], [USE_V4L2_CTL_LIBV4L="yes"], [USE_V4L2_CTL_LIBV4L="no"]) AM_COND_IF([WITH_V4L2_COMPLIANCE_LIBV4L], [USE_V4L2_COMPLIANCE_LIBV4L="yes"], [USE_V4L2_COMPLIANCE_LIBV4L="no"]) +AM_COND_IF([WITH_BPF], [USE_BPF="yes" + AC_DEFINE([HAVE_BPF], [1], [BPF IR decoder support enabled])], + [USE_BPF="no"]) AS_IF([test "x$alsa_pkgconfig" = "xtrue"], [USE_ALSA="yes"], [USE_ALSA="no"]) AC_OUTPUT
@@ -549,4 +557,5 @@ compile time options summary qvidcap : $USE_QVIDCAP v4l2-ctl uses libv4l : $USE_V4L2_CTL_LIBV4L v4l2-compliance uses libv4l: $USE_V4L2_COMPLIANCE_LIBV4L + BPF IR Decoders: : $USE_BPF EOF
utils/keytable/Makefile.am +4 -3
@@ -6,14 +6,15 @@ udevrules_DATA = 70-infrared.rules ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h -if HAVE_LIBELF +if WITH_BPF ir_keytable_SOURCES += bpf.c bpf_load.c bpf.h bpf_load.h endif ir_keytable_LDADD = @LIBINTL@ -ir_keytable_LDFLAGS = $(ARGP_LIBS) $(LIBELF_LIBS) +ir_keytable_LDFLAGS = $(ARGP_LIBS) -if BPF_PROTOCOLS +if WITH_BPF +ir_keytable_LDFLAGS += $(LIBELF_LIBS) SUBDIRS = bpf_protocols endif
utils/keytable/keytable.c +4 -1
@@ -34,8 +34,11 @@#include "ir-encode.h" #include "parse.h" #include "toml.h" + +#ifdef HAVE_BPF #include "bpf.h" #include "bpf_load.h" +#endif #ifdef ENABLE_NLS # define _ (string) gettext(string)
@@ -1847,7 +1850,7 @@ static void device_info(int fd, char *prepend)perror ("EVIOCGID" ); } -#ifdef HAVE_LIBELF +#ifdef HAVE_BPF #define MAX_PROGS 64static void attach_bpf (const char *lirc_name,const char *bpf_prog,struct toml_table_t *toml) {
Signature · 1 line
2.17.2
Hello Sean,
Quoted 3 lines · Sean Young
It currently does not build on mips and some platforms do not have BPF support yet (risc-v, for example).
Thanks for the patch, works for the buildroot use case (disabling bpf support unconditionally), see [1]...
Regards,
Peter
[1] http://lists.busybox.net/pipermail/buildroot/2018-November/235268.html
Quoted 115 lines
Signed-off-by Sean Young <[email protected]>--- configure.ac | 17 +++++++++++++---- utils/keytable/Makefile.am | 7 ++++--- utils/keytable/keytable.c | 5 ++++- 3 files changed, 21 insertions(+), 8 deletions(-)configure.ac +13
-4@@ -173,16 +173,12 @@ AM_CONDITIONAL([HAVE_X11], [test x$x11_pkgconfig = xyes]) PKG_CHECK_MODULES([LIBELF], [libelf], [libelf_pkgconfig=yes], [libelf_pkgconfig=no]) AC_SUBST([LIBELF_CFLAGS]) AC_SUBST([LIBELF_LIBS]) -AM_CONDITIONAL([HAVE_LIBELF], [test x$libelf_pkgconfig = xyes]) if test "x$libelf_pkgconfig" = "xyes"; then AC_CHECK_PROG([CLANG], clang, clang) - AC_DEFINE([HAVE_LIBELF], [1], [libelf library is present]) else AC_MSG_WARN(libelf library not available) fi -AM_CONDITIONAL([BPF_PROTOCOLS], [test x$CLANG = xclang]) - AS_IF([test "x$x11_pkgconfig" = xyes], [PKG_CHECK_MODULES(GL, [gl], [gl_pkgconfig=yes], [gl_pkgconfig=no])], [gl_pkgconfig=no]) AC_SUBST([GL_CFLAGS])@@ -453,6 +449,14 @@ AC_ARG_ENABLE(gconv, esac] ) +AC_ARG_ENABLE(bpf, + AS_HELP_STRING([--disable-bpf], [disable IR BPF decoders]), + [case "${enableval}" in + yes | no ) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-bpf) ;; + esac] +) + PKG_CHECK_MODULES([SDL2], [sdl2 SDL2_image], [sdl_pc=yes], [sdl_pc=no]) AM_CONDITIONAL([HAVE_SDL], [test x$sdl_pc = xyes])@@ -475,6 +479,7 @@ AM_CONDITIONAL([WITH_GCONV], [test x$enable_gconv = xyes -a x$enable_shar AM_CONDITIONAL([WITH_V4L2_CTL_LIBV4L], [test x${enable_v4l2_ctl_libv4l} != xno]) AM_CONDITIONAL([WITH_V4L2_CTL_STREAM_TO], [test x${enable_v4l2_ctl_stream_to} != xno]) AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x${enable_v4l2_compliance_libv4l} != xno]) +AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$CLANG = xclang]) # append -static to libtool compile and link command to enforce static libs AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])])@@ -505,6 +510,9 @@ AM_COND_IF([WITH_V4L_WRAPPERS], [USE_V4L_WRAPPERS="yes"], [USE_V4L_WRAPPERS="no" AM_COND_IF([WITH_GCONV], [USE_GCONV="yes"], [USE_GCONV="no"]) AM_COND_IF([WITH_V4L2_CTL_LIBV4L], [USE_V4L2_CTL_LIBV4L="yes"], [USE_V4L2_CTL_LIBV4L="no"]) AM_COND_IF([WITH_V4L2_COMPLIANCE_LIBV4L], [USE_V4L2_COMPLIANCE_LIBV4L="yes"], [USE_V4L2_COMPLIANCE_LIBV4L="no"]) +AM_COND_IF([WITH_BPF], [USE_BPF="yes" + AC_DEFINE([HAVE_BPF], [1], [BPF IR decoder support enabled])], + [USE_BPF="no"]) AS_IF([test "x$alsa_pkgconfig" = "xtrue"], [USE_ALSA="yes"], [USE_ALSA="no"]) bpf.h AC_OUTPUT@@ -549,4 +557,5 @@ compile time options summary qvidcap : $USE_QVIDCAP v4l2-ctl uses libv4l : $USE_V4L2_CTL_LIBV4L v4l2-compliance uses libv4l: $USE_V4L2_COMPLIANCE_LIBV4L + BPF IR Decoders: : $USE_BPF EOFutils/keytable/Makefile.am +4
-3@@ -6,14 +6,15 @@ udevrules_DATA = 70-infrared.rules ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h -if HAVE_LIBELF +if WITH_BPF ir_keytable_SOURCES += bpf.c bpf_load.c bpf.h bpf_load.h endif ir_keytable_LDADD = @LIBINTL@ -ir_keytable_LDFLAGS = $(ARGP_LIBS) $(LIBELF_LIBS) +ir_keytable_LDFLAGS = $(ARGP_LIBS) -if BPF_PROTOCOLS +if WITH_BPF +ir_keytable_LDFLAGS += $(LIBELF_LIBS) SUBDIRS = bpf_protocols endifutils/keytable/keytable.c +4
-1@@ -34,8 +34,11 @@#include "ir-encode.h" #include "parse.h" #include "toml.h" + +#ifdef HAVE_BPF #include "bpf.h" #include "bpf_load.h" +#endif #ifdef ENABLE_NLS # define _ (string) gettext(string)@@ -1847,7 +1850,7 @@ static void device_info(int fd, char *prepend)perror ("EVIOCGID" ); } -#ifdef HAVE_LIBELF +#ifdef HAVE_BPF #define MAX_PROGS 64static void attach_bpf (const char *lirc_name,const char *bpf_prog,struct toml_table_t *toml) {