m4: virt-libnl: drop libnl-1.0 support

All supported OSes have libnl-3.0 and netcf uses it so there is no need
to keep libnl-1.0 compatibility code.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Pavel Hrdina 2019-10-09 14:36:32 +02:00
parent 18981877d2
commit c7f8a66b22
3 changed files with 14 additions and 63 deletions

View File

@ -18,56 +18,22 @@ dnl <http://www.gnu.org/licenses/>.
dnl dnl
AC_DEFUN([LIBVIRT_CHECK_LIBNL], [ AC_DEFUN([LIBVIRT_CHECK_LIBNL], [
AC_REQUIRE([LIBVIRT_CHECK_NETCF])
AC_REQUIRE([LIBVIRT_CHECK_MACVTAP]) AC_REQUIRE([LIBVIRT_CHECK_MACVTAP])
LIBNL_REQUIRED="1.1"
with_libnl=no with_libnl=no
if test "$with_linux" = "yes"; then if test "$with_linux" = "yes"; then
# When linking with netcf, we must ensure that we pick the same version
# of libnl that netcf picked. Prefer libnl-3 unless we can prove
# netcf linked against libnl-1, or unless the user set LIBNL_CFLAGS.
# (Setting LIBNL_CFLAGS is already used by PKG_CHECK_MODULES to
# override any probing, so if it set, you know which libnl is in use.)
libnl_ldd=
for dir in /usr/lib64 /usr/lib /usr/lib/*-linux-gnu*; do
if test -f $dir/libnetcf.so; then
libnl_ldd=`(ldd $dir/libnetcf.so) 2>&1`
break
fi
done
case $libnl_ldd:${LIBNL_CFLAGS+set} in
*libnl-3.so.*:) LIBNL_REQUIRED=3.0 ;;
esac
case $libnl_ldd:${LIBNL_CFLAGS+set} in
*libnl.so.1*:) ;;
*)
PKG_CHECK_MODULES([LIBNL], [libnl-3.0], [ PKG_CHECK_MODULES([LIBNL], [libnl-3.0], [
with_libnl=yes with_libnl=yes
AC_DEFINE([HAVE_LIBNL3], [1], [Use libnl-3.0])
AC_DEFINE([HAVE_LIBNL], [1], [whether the netlink library is available]) AC_DEFINE([HAVE_LIBNL], [1], [whether the netlink library is available])
PKG_CHECK_MODULES([LIBNL_ROUTE3], [libnl-route-3.0]) PKG_CHECK_MODULES([LIBNL_ROUTE], [libnl-route-3.0])
LIBNL_CFLAGS="$LIBNL_CFLAGS $LIBNL_ROUTE3_CFLAGS" LIBNL_CFLAGS="$LIBNL_CFLAGS $LIBNL_ROUTE_CFLAGS"
LIBNL_LIBS="$LIBNL_LIBS $LIBNL_ROUTE3_LIBS" LIBNL_LIBS="$LIBNL_LIBS $LIBNL_ROUTE_LIBS"
], [:]) ;; ], [:])
esac fi
if test "$with_libnl" = no; then if test "$with_libnl" = no; then
PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [
with_libnl=yes
AC_DEFINE_UNQUOTED([HAVE_LIBNL], [1],
[whether the netlink library is available])
AC_DEFINE_UNQUOTED([HAVE_LIBNL1], [1],
[whether the netlink v1 library is available])
], [
if test "$with_macvtap" = "yes"; then if test "$with_macvtap" = "yes"; then
if test "$LIBNL_REQUIRED" = "3.0";then AC_MSG_ERROR([libnl3-devel is required for macvtap support])
AC_MSG_ERROR([libnl3-devel >= $LIBNL_REQUIRED is required for macvtap support])
else
AC_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required for macvtap support])
fi
fi
])
fi fi
fi fi
AM_CONDITIONAL([HAVE_LIBNL], [test "$with_libnl" = "yes"]) AM_CONDITIONAL([HAVE_LIBNL], [test "$with_libnl" = "yes"])

View File

@ -52,17 +52,10 @@ struct virNetlinkEventHandle {
int deleted; int deleted;
}; };
# ifdef HAVE_LIBNL1
# define virNetlinkAlloc nl_handle_alloc
# define virNetlinkSetBufferSize nl_set_buffer_size
# define virNetlinkFree nl_handle_destroy
typedef struct nl_handle virNetlinkHandle;
# else
# define virNetlinkAlloc nl_socket_alloc # define virNetlinkAlloc nl_socket_alloc
# define virNetlinkSetBufferSize nl_socket_set_buffer_size # define virNetlinkSetBufferSize nl_socket_set_buffer_size
# define virNetlinkFree nl_socket_free # define virNetlinkFree nl_socket_free
typedef struct nl_sock virNetlinkHandle; typedef struct nl_sock virNetlinkHandle;
# endif
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetlinkHandle, virNetlinkFree); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetlinkHandle, virNetlinkFree);

View File

@ -24,15 +24,7 @@
#if defined(__linux__) && defined(HAVE_LIBNL) #if defined(__linux__) && defined(HAVE_LIBNL)
/* Work around a bug where older libnl-1 headers expected older gcc
* semantics of 'extern inline' that conflict with C99 semantics. */
# ifdef HAVE_LIBNL1
# define inline
# endif
# include <netlink/msg.h> # include <netlink/msg.h>
# ifdef HAVE_LIBNL1
# undef inline
# endif
typedef struct nl_msg virNetlinkMsg; typedef struct nl_msg virNetlinkMsg;
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetlinkMsg, nlmsg_free); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetlinkMsg, nlmsg_free);