configure: move libnl check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-12-12 10:07:24 +01:00
parent 994fe998b7
commit 21b3f33978
2 changed files with 83 additions and 58 deletions

View File

@ -112,7 +112,6 @@ fi
dnl Required minimum versions of all libs we depend on
PARTED_REQUIRED="1.8.0"
DEVMAPPER_REQUIRED=1.0.0
LIBNL_REQUIRED="1.1"
PARALLELS_SDK_REQUIRED="7.0.22"
dnl Where we look for daemons and admin binaries during configure
LIBVIRT_SBIN_PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
@ -1808,58 +1807,7 @@ AC_CHECK_DECLS([GET_VLAN_VID_CMD], [], [], [[#include <linux/if_vlan.h>]])
dnl netlink library
have_libnl=no
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], [
have_libnl=yes
AC_DEFINE([HAVE_LIBNL3], [1], [Use libnl-3.0])
AC_DEFINE([HAVE_LIBNL], [1], [whether the netlink library is available])
PKG_CHECK_MODULES([LIBNL_ROUTE3], [libnl-route-3.0])
LIBNL_CFLAGS="$LIBNL_CFLAGS $LIBNL_ROUTE3_CFLAGS"
LIBNL_LIBS="$LIBNL_LIBS $LIBNL_ROUTE3_LIBS"
], [:]) ;;
esac
if test "$have_libnl" = no; then
PKG_CHECK_MODULES([LIBNL], [libnl-1 >= $LIBNL_REQUIRED], [
have_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 "$LIBNL_REQUIRED" = "3.0";then
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
AM_CONDITIONAL([HAVE_LIBNL], [test "$have_libnl" = "yes"])
AC_SUBST([LIBNL_CFLAGS])
AC_SUBST([LIBNL_LIBS])
LIBVIRT_CHECK_LIBNL
# Check for Linux vs. BSD ifreq members
AC_CHECK_MEMBERS([struct ifreq.ifr_newname,
@ -2067,6 +2015,7 @@ LIBVIRT_RESULT_FUSE
LIBVIRT_RESULT_GLUSTER
LIBVIRT_RESULT_GNUTLS
LIBVIRT_RESULT_HAL
LIBVIRT_RESULT_LIBNL
LIBVIRT_RESULT_LIBPCAP
LIBVIRT_RESULT_LIBSSH
LIBVIRT_RESULT_LIBXML
@ -2101,11 +2050,6 @@ AC_MSG_NOTICE([xenlight: $LIBXL_CFLAGS $LIBXL_LIBS])
else
AC_MSG_NOTICE([xenlight: no])
fi
if test "$have_libnl" = "yes" ; then
AC_MSG_NOTICE([ nl: $LIBNL_CFLAGS $LIBNL_LIBS])
else
AC_MSG_NOTICE([ nl: no])
fi
if test "$with_vbox" = "yes" && test -n "$MSCOM_LIBS" ; then
AC_MSG_NOTICE([ mscom: $MSCOM_LIBS])
else

81
m4/virt-libnl.m4 Normal file
View File

@ -0,0 +1,81 @@
dnl The libnl library
dnl
dnl Copyright (C) 2012-2013 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
dnl
AC_DEFUN([LIBVIRT_CHECK_LIBNL], [
AC_REQUIRE([LIBVIRT_CHECK_NETCF])
AC_REQUIRE([LIBVIRT_CHECK_MACVTAP])
LIBNL_REQUIRED="1.1"
with_libnl=no
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], [
with_libnl=yes
AC_DEFINE([HAVE_LIBNL3], [1], [Use libnl-3.0])
AC_DEFINE([HAVE_LIBNL], [1], [whether the netlink library is available])
PKG_CHECK_MODULES([LIBNL_ROUTE3], [libnl-route-3.0])
LIBNL_CFLAGS="$LIBNL_CFLAGS $LIBNL_ROUTE3_CFLAGS"
LIBNL_LIBS="$LIBNL_LIBS $LIBNL_ROUTE3_LIBS"
], [:]) ;;
esac
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 "$LIBNL_REQUIRED" = "3.0";then
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
AM_CONDITIONAL([HAVE_LIBNL], [test "$with_libnl" = "yes"])
AC_SUBST([LIBNL_CFLAGS])
AC_SUBST([LIBNL_LIBS])
])
AC_DEFUN([LIBVIRT_RESULT_LIBNL], [
LIBVIRT_RESULT_LIB([LIBNL])
])