Fix preprocessor logic for ethernet header choice.

Checking for netinet/if_ether.h and netinet/ip6.h depended
on including other headers first; observed when trying to
build on FreeBSD.

ARP.h was changed to conform to CMake style config.h generation.
Definitions are not set to 1 like with autotools, so we have
to check for definition, not just that the value is true.
This commit is contained in:
Jon Siwek 2010-11-01 10:05:23 -05:00
parent 43cbe2a9fc
commit bea41f5c73
2 changed files with 7 additions and 5 deletions

View file

@ -4,9 +4,11 @@ include(CheckStructHasMember)
check_include_files(getopt.h HAVE_GETOPT_H) check_include_files(getopt.h HAVE_GETOPT_H)
check_include_files(magic.h HAVE_MAGIC_H) check_include_files(magic.h HAVE_MAGIC_H)
check_include_files(memory.h HAVE_MEMORY_H) check_include_files(memory.h HAVE_MEMORY_H)
check_include_files(netinet/if_ether.h HAVE_NETINET_IF_ETHER_H) check_include_files("sys/socket.h;netinet/in.h;net/if.h;netinet/if_ether.h"
check_include_files(netinet/ip6.h HAVE_NETINET_IP6_H) HAVE_NETINET_IF_ETHER_H)
check_include_files(net/ethernet.h HAVE_NET_ETHERNET_H) check_include_files("sys/socket.h;netinet/in.h;net/if.h;netinet/ip6.h"
HAVE_NETINET_IP6_H)
check_include_files("sys/socket.h;net/if.h;net/ethernet.h" HAVE_NET_ETHERNET_H)
check_include_files(sys/ethernet.h HAVE_SYS_ETHERNET_H) check_include_files(sys/ethernet.h HAVE_SYS_ETHERNET_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files("time.h;sys/time.h" TIME_WITH_SYS_TIME) check_include_files("time.h;sys/time.h" TIME_WITH_SYS_TIME)

View file

@ -13,9 +13,9 @@
#include <net/if_arp.h> #include <net/if_arp.h>
#ifdef HAVE_NET_ETHERNET_H #ifdef HAVE_NET_ETHERNET_H
#include <net/ethernet.h> #include <net/ethernet.h>
#elif HAVE_SYS_ETHERNET_H #elif defined(HAVE_SYS_ETHERNET_H)
#include <sys/ethernet.h> #include <sys/ethernet.h>
#elif HAVE_NETINET_IF_ETHER_H #elif defined(HAVE_NETINET_IF_ETHER_H)
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#endif #endif