From 6a9e75147c21bef676ff678c3ed0fee8260b7f78 Mon Sep 17 00:00:00 2001 From: Daniel Salzman Date: Sat, 8 Jul 2023 22:30:44 +0200 Subject: configure: add detection of libbpf>=1.0 without libxdp --- configure.ac | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index ec6a3e640..e525c5c25 100644 --- a/configure.ac +++ b/configure.ac @@ -207,10 +207,18 @@ AC_ARG_ENABLE([xdp], AS_HELP_STRING([--enable-xdp=auto|yes|no], [enable eXpress Data Path [default=auto]]), [], [enable_xdp=auto]) +PKG_CHECK_MODULES([libbpf], [libbpf], + [save_LIBS=$LIBS + LIBS="$LIBS $libbpf_LIBS" + AC_CHECK_FUNC([bpf_object__find_map_by_offset], [libbpf1=no], [libbpf1=yes]) + LIBS=$save_LIBS + have_libbpf=yes], + [have_libbpf=no] +) + AS_CASE([$enable_xdp], - [auto], [PKG_CHECK_MODULES([libbpf], [libbpf], [enable_xdp=yes], [enable_xdp=no])], - [yes], [PKG_CHECK_MODULES([libbpf], [libbpf], [enable_xdp=yes], [ - AC_MSG_ERROR([libbpf not available])])], + [auto], [AS_IF([test "$have_libbpf" = "yes"], [enable_xdp=yes], [enable_xdp=no])], + [yes], [AS_IF([test "$have_libbpf" = "yes"], [enable_xdp=yes], [AC_MSG_ERROR([libbpf not available])])], [no], [], [*], [AC_MSG_ERROR([Invalid value of --enable-xdp.])] ) @@ -218,11 +226,12 @@ AM_CONDITIONAL([ENABLE_XDP], [test "$enable_xdp" != "no"]) AS_IF([test "$enable_xdp" = "yes"], [ PKG_CHECK_MODULES([libxdp], [libxdp], [enable_xdp=libxdp], [enable_xdp=yes]) - AS_IF([test "$enable_xdp" = "libxdp"], [ - AC_DEFINE([USE_LIBXDP], [1], [Use libxdp.]) - libbpf_CFLAGS="$libbpf_CFLAGS $libxdp_CFLAGS" - libbpf_LIBS="$libbpf_LIBS $libxdp_LIBS" - ])] + AS_IF([test "$enable_xdp" = "libxdp"], + [AC_DEFINE([USE_LIBXDP], [1], [Use libxdp.]) + libbpf_CFLAGS="$libbpf_CFLAGS $libxdp_CFLAGS" + libbpf_LIBS="$libbpf_LIBS $libxdp_LIBS"], + [AS_IF([test "$libbpf1" = "yes"], [AC_MSG_ERROR([libxdp not available])])] + )] ) AC_SUBST([libbpf_CFLAGS]) AC_SUBST([libbpf_LIBS]) -- cgit v1.2.3