Re: [PATCH 1/2] set HAVE_LIBNL in config.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/6/23 Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>:
> On 06/23/2011 08:41 AM, Matthias Bolte wrote:
>>
>> 2011/6/23 Stefan Berger<stefanb@xxxxxxxxxxxxxxxxxx>:
>>>
>>> Set HAVE_LIBNL to be able to conditionally compile libnl code.
>>>
>>> Signed-off-by: Stefan Berger<stefanb@xxxxxxxxxxxxxxxxxx>
>>>
>>> ---
>>>  configure.ac |    3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> Index: libvirt-acl/configure.ac
>>> ===================================================================
>>> --- libvirt-acl.orig/configure.ac
>>> +++ libvirt-acl/configure.ac
>>> @@ -2377,7 +2377,10 @@ if test "$with_macvtap" = "yes"; then
>>>     ], [
>>>         AC_MSG_ERROR([libnl-devel>= $LIBNL_REQUIRED is required for
>>> macvtap support])
>>>     ])
>>> +    have_libnl=yes
>>> +    AC_DEFINE_UNQUOTED([HAVE_LIBNL], 1, [whether the netlink library is
>>> available])
>>>  fi
>>> +AM_CONDITIONAL([HAVE_LIBNL], [test "$have_libnl" = "yes"])
>>>
>>>  AC_SUBST([LIBNL_CFLAGS])
>>>  AC_SUBST([LIBNL_LIBS])
>>>
>>>
>> HAVE_LIBNL is just an alias for WITH_MACVTAP by this construct. So you
>> could just use WITH_MACVTAP in the code instead of HAVE_LIBNL. Or do
>> you plan to use libnl also for non-macvtap related code.
>>
> Initially I was using WITH_MACVTAP for the conditional compilation in the
> 2nd patch, but this seems wrong since code dependent on -lnl should have a
> corresponding HAVE_LIBNL. I did obviously not go as far as making the above
> check for libnl independent of macvtap. I'd probably get it wrong. So really
> what should be done is
>
> check for libnl on a linux system and set HAVE_LIBNL if found
> if 'with_macvtap' is yes, check whether previously libnl was found. I guess
> one could check the 'have_libnl' for that.
>
>   Stefan
>

Okay, I just did that, here's a patch for that.

-- 
Matthias Bolte
http://photron.blogspot.com
From cd625b92ae046d103eae61c0dcadf8df32fb740c Mon Sep 17 00:00:00 2001
From: Matthias Bolte <matthias.bolte@xxxxxxxxxxxxxx>
Date: Thu, 23 Jun 2011 16:28:54 +0200
Subject: [PATCH] configure: Make libnl optional unless macvtap is required

If macvtap is required then libnl has to be available, otherwise
libnl is optional.
---
 configure.ac |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index f816696..8b9e604 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2371,13 +2371,19 @@ dnl netlink library
 
 LIBNL_CFLAGS=""
 LIBNL_LIBS=""
+have_libnl=no
 
-if test "$with_macvtap" = "yes"; then
+if test "$with_linux" = "yes"; 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_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required for macvtap support])
+        if test "$with_macvtap" = "yes"; then
+            AC_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required for macvtap support])
+        fi
     ])
 fi
+AM_CONDITIONAL([HAVE_LIBNL], [test "$have_libnl" = "yes"])
 
 AC_SUBST([LIBNL_CFLAGS])
 AC_SUBST([LIBNL_LIBS])
@@ -2574,7 +2580,7 @@ AC_MSG_NOTICE([    pcap: $LIBPCAP_CFLAGS $LIBPCAP_LIBS])
 else
 AC_MSG_NOTICE([    pcap: no])
 fi
-if test "$with_macvtap" = "yes" ; then
+if test "$have_libnl" = "yes" ; then
 AC_MSG_NOTICE([      nl: $LIBNL_CFLAGS $LIBNL_LIBS])
 else
 AC_MSG_NOTICE([      nl: no])
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]