[libvirt] [PATCH] Check for link_addr more thoroughly

Guido Günther agx at sigxcpu.org
Wed Jul 17 19:05:53 UTC 2013


Some versions of kFreeBSD (like 9.0) declare link_addr in a header
but lack an implementation. This makes ./configure pass but breaks
compilation later with a

     undefined reference to `link_addr'

Althought that's a bug in the OS header we can detect it easily by also
trying to link.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=715320
---
 configure.ac | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index b5af0d3..4e8b9b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2391,13 +2391,15 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_newname,
                  [#include <sys/socket.h>
                   #include <net/if.h>
                  ])
+
 # Check for BSD approach for setting MAC addr
-AC_CHECK_DECLS([link_addr],
-               [], [],
-               [#include <sys/types.h>
-                #include <sys/socket.h>
-                #include <net/if_dl.h>
-               ])
+AC_TRY_LINK([#include <sys/types.h>
+             #include <sys/socket.h>
+             #include <net/if_dl.h>],
+            [link_addr(NULL, NULL)],
+            [AC_DEFINE([HAVE_DECL_LINK_ADDR],
+                       [1],
+                       [whether link_addr is available])])
 
 # Check for BSD approach for bridge management
 AC_CHECK_DECLS([BRDGSFD, BRDGADD, BRDGDEL],
-- 
1.8.3.2




More information about the libvir-list mailing list