]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Remove FreeBSD specific defines and include the needed headers via config.h.
authorRoy Marples <roy@marples.name>
Thu, 31 Dec 2015 16:27:44 +0000 (16:27 +0000)
committerRoy Marples <roy@marples.name>
Thu, 31 Dec 2015 16:27:44 +0000 (16:27 +0000)
This allows better compile for derivatives such as kFreeBSD.
For kFreeBSD, also define BSD.
Fixes [1987e7b3a3].

configure
dhcpcd.c
if-bsd.c
if-options.c
if.c
if.h
ipv6.c
ipv6.h

index 4989c6a66719e7589d33b27bd265ace31762fdb9..6a03f61fd5d40c18cce9a93657164e58ca32a370 100755 (executable)
--- 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          <net/if.h>" >>$CONFIG_H
+       echo "#include          <net/if_var.h>" >>$CONFIG_H
        ;;
 linux*)
        echo "CPPFLAGS+=        -D_GNU_SOURCE" >>$CONFIG_MK
index 529188ad8f7fac36a7ea880c613e1a449998f0f5..30813e1cdc2b6efff42274dd8fadfd4736604e72 100644 (file)
--- 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 <sys/file.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
index 154a28bac9bd26dbed902f49ea4e353cdc26463a..9607faad32bb7ee1e1f8feccba50919821c55438 100644 (file)
--- a/if-bsd.c
+++ b/if-bsd.c
 #include <sys/uio.h>
 #include <sys/utsname.h>
 
+#include "config.h"
+
 #include <arpa/inet.h>
 #include <net/bpf.h>
 #include <net/if.h>
 #include <net/if_dl.h>
-#ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */
-#  include <net/if_var.h>
-#endif
 #include <net/if_media.h>
 #include <net/route.h>
 #include <netinet/if_ether.h>
@@ -76,7 +75,6 @@
 #undef IPV6CTL_ACCEPT_RTADV
 #endif
 
-#include "config.h"
 #include "common.h"
 #include "dhcp.h"
 #include "if.h"
index 8c6b79b98b6e54b9c8d611b52350f29286222939..8bff82a37189e1c4376e84c2474a11a52f746db4 100644 (file)
@@ -25,8 +25,6 @@
  * SUCH DAMAGE.
  */
 
-#define _WITH_GETLINE /* Stop FreeBSD bitching */
-
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/types.h>
diff --git a/if.c b/if.c
index 791d27e996262588f6d2d0d901962a0ca216997c..997c5e4f82fe046f63a3dab15a9755f2f80e579a 100644 (file)
--- a/if.c
+++ b/if.c
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 
+#include "config.h"
+
 #include <net/if.h>
 #include <net/if_arp.h>
 #include <netinet/in.h>
-#ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */
-#  include <net/if_var.h>
-#endif
 #ifdef AF_LINK
 #  include <net/if_dl.h>
 #  include <net/if_types.h>
@@ -60,7 +59,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "config.h"
 #include "common.h"
 #include "dev.h"
 #include "dhcp.h"
diff --git a/if.h b/if.h
index 7dd526451b42a07b108c95cbb838be1f27a30d0f..379a5a941c257b415cd6d2de1b7dfd2cc4381657 100644 (file)
--- a/if.h
+++ b/if.h
@@ -29,9 +29,6 @@
 #define INTERFACE_H
 
 #include <net/if.h>
-#ifdef __FreeBSD__
-#include <net/if_var.h>
-#endif
 #include <net/route.h>         /* for RTM_ADD et all */
 #include <netinet/in.h>
 #ifdef BSD
diff --git a/ipv6.c b/ipv6.c
index 49e3677315c42603ceef935ea903800620aa9d14..8835f6208fd396c78c5c224881e312ac735af116 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
 #include <netinet/in.h>
 #include <netinet/if_ether.h>
 
+#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 <net/if_var.h>
-#  endif
 #  include <netinet6/in6_var.h>
 #  include <netinet6/nd6.h>
 #endif
diff --git a/ipv6.h b/ipv6.h
index 3171735aef83a291460dda5faef46bc2d2c444eb..cdf525dd8f5d5907fedcb7866a2d9217d3b5bf50 100644 (file)
--- a/ipv6.h
+++ b/ipv6.h
 #include <sys/uio.h>
 #include <netinet/in.h>
 
+#include "config.h"
+
 #ifndef __linux__
 #  ifndef __QNX__
 #    include <sys/endian.h>
 #  endif
 #  include <net/if.h>
-#  ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */
-#    include <net/if_var.h>
-#  endif
 #  ifndef __sun
 #    include <netinet6/in6_var.h>
 #  endif
 #endif
 
-#include "config.h"
-#include "dhcpcd.h"
-
 #define ALLROUTERS "ff02::2"
 
 #define ROUNDUP8(a)  (1 + (((a) - 1) |  7))