Re: [PATCH] Check for link_addr more thoroughly

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

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]