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
---
Changes from v1:
Use AC_LINK_IFELSE instead of AC_TRY_LINK
I used AC_TRY_LINK since it's used in other places in configure.ac.
Should these be converted too?
Cheers,
-- Guido
configure.ac | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index b5af0d3..5d5c8de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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],
--
1.8.3.2