[libvirt] [PATCH] Check for link_addr more thoroughly

Eric Blake eblake at redhat.com
Wed Jul 17 19:28:26 UTC 2013


On 07/17/2013 01:05 PM, Guido Günther wrote:
> 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(-)
> 

> +
>  # 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>

I'd prefer we use AC_LINK_IFELSE here (upstream autoconf has deprecated
AC_TRY_LINK on the grounds that AC_LINK_IFELSE has saner quoting rules
in relation to the rest of the configure.ac file).

> +             #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])])

The concept makes sense, but it's probably worth seeing a v2 just to
make sure the modernized autoconf magic is correct.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130717/b8bb1770/attachment-0001.sig>


More information about the libvir-list mailing list