]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Check for link_addr more thoroughly
authorGuido Günther <agx@sigxcpu.org>
Wed, 17 Jul 2013 18:02:17 +0000 (20:02 +0200)
committerGuido Günther <agx@sigxcpu.org>
Thu, 18 Jul 2013 15:10:04 +0000 (17:10 +0200)
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

index b5af0d35c2cdc61c66b73311dfa64cc6504cb166..5d5c8deb7bce58ee7b318b4c845c94009b03aebd 100644 (file)
@@ -2391,13 +2391,19 @@ 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_LINK_IFELSE([AC_LANG_PROGRAM(
+     [[
+        #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],