fix if.h problems when compiling with newer libnl3
When netcf first include support for libnl3, the author of that patch
(Serge Hallyn, commit 0310cd505) found that
/usr/include/libnl3/netlink/route/link.h #included <linux/if.h>, which
conflicts with <net/if.h> (but for our purposes at least defines all the
same things). So he put the #include <net/if.h> in dutil_linux.c inside
an #ifndef HAVE_LIBNL3.
That worked fine until libnl3 finally removed the offending (and
unnecessary) #include <linux/if.h> from its link.h. That fix to libnl3
broke the netcf build.
This patch fixes the build by using autotools magic to attempt
compiling essentially this short program:
#include <netlink/route/link.h>
int main()
{
struct ifreq ifr;
return ifr.ifr_ifru.ifru_ivalue = IFF_UP;
}
If this can compile successfully without any other includes, then
link.h is already including linux/if.h and we should avoid including
net/if.h, so we #define AVOID_NET_IF_H. If the compile fails, then we
do need to include net/if.h, so we *don't* #define
AVOID_NET_IF_H. Then we enclose dutil_linux.c's #include <net/if.h>
within #ifndef AVOID_NET_IF_H and we're done.
Although this check would probably be safe on a libnl1 system, we know
from past experience that we should always include net/if.h in those
cases anyway, so we don't even try - we only do the configure-time
check if we're using libnl3.