From: Roy Marples Date: Thu, 31 Dec 2015 16:27:44 +0000 (+0000) Subject: Remove FreeBSD specific defines and include the needed headers via config.h. X-Git-Tag: v6.10.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3eeb66d7bde9cff68cc0561bb5ba748cba84cc3d;p=thirdparty%2Fdhcpcd.git Remove FreeBSD specific defines and include the needed headers via config.h. This allows better compile for derivatives such as kFreeBSD. For kFreeBSD, also define BSD. Fixes [1987e7b3a3]. --- diff --git a/configure b/configure index 4989c6a6..6a03f61f 100755 --- a/configure +++ b/configure @@ -368,8 +368,15 @@ fi case "$OS" in freebsd*|kfreebsd*) + # FreeBSD hide some newer POSIX APIs behind _GNU_SOURCE ... echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK + case "$OS" in + kfreebsd*) echo "CPPFLAGS+= -DBSD" >>$CONFIG_MK;; + esac echo "DHCPCD_SRCS+= if-bsd.c" >>$CONFIG_MK + # Whacky includes needed to buck the trend + echo "#include " >>$CONFIG_H + echo "#include " >>$CONFIG_H ;; linux*) echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK diff --git a/dhcpcd.c b/dhcpcd.c index 529188ad..30813e1c 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -27,8 +27,6 @@ const char dhcpcd_copyright[] = "Copyright (c) 2006-2015 Roy Marples"; -#define _WITH_DPRINTF /* Stop FreeBSD bitching */ - #include #include #include diff --git a/if-bsd.c b/if-bsd.c index 154a28ba..9607faad 100644 --- a/if-bsd.c +++ b/if-bsd.c @@ -35,13 +35,12 @@ #include #include +#include "config.h" + #include #include #include #include -#ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */ -# include -#endif #include #include #include @@ -76,7 +75,6 @@ #undef IPV6CTL_ACCEPT_RTADV #endif -#include "config.h" #include "common.h" #include "dhcp.h" #include "if.h" diff --git a/if-options.c b/if-options.c index 8c6b79b9..8bff82a3 100644 --- a/if-options.c +++ b/if-options.c @@ -25,8 +25,6 @@ * SUCH DAMAGE. */ -#define _WITH_GETLINE /* Stop FreeBSD bitching */ - #include #include #include diff --git a/if.c b/if.c index 791d27e9..997c5e4f 100644 --- a/if.c +++ b/if.c @@ -30,12 +30,11 @@ #include #include +#include "config.h" + #include #include #include -#ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */ -# include -#endif #ifdef AF_LINK # include # include @@ -60,7 +59,6 @@ #include #include -#include "config.h" #include "common.h" #include "dev.h" #include "dhcp.h" diff --git a/if.h b/if.h index 7dd52645..379a5a94 100644 --- a/if.h +++ b/if.h @@ -29,9 +29,6 @@ #define INTERFACE_H #include -#ifdef __FreeBSD__ -#include -#endif #include /* for RTM_ADD et all */ #include #ifdef BSD diff --git a/ipv6.c b/ipv6.c index 49e36773..8835f620 100644 --- a/ipv6.c +++ b/ipv6.c @@ -35,12 +35,11 @@ #include #include +#include "config.h" + #ifdef BSD /* Purely for the ND6_IFF_AUTO_LINKLOCAL #define which is solely used * to generate our CAN_ADD_LLADDR #define. */ -# ifdef __FreeBSD__ -# include -# endif # include # include #endif diff --git a/ipv6.h b/ipv6.h index 3171735a..cdf525dd 100644 --- a/ipv6.h +++ b/ipv6.h @@ -31,22 +31,18 @@ #include #include +#include "config.h" + #ifndef __linux__ # ifndef __QNX__ # include # endif # include -# ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */ -# include -# endif # ifndef __sun # include # endif #endif -#include "config.h" -#include "dhcpcd.h" - #define ALLROUTERS "ff02::2" #define ROUNDUP8(a) (1 + (((a) - 1) | 7))