]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Remove hardcoded defines for linux and add a nasty hackaround for glibc.
authorRoy Marples <roy@marples.name>
Tue, 19 Feb 2008 18:30:16 +0000 (18:30 +0000)
committerRoy Marples <roy@marples.name>
Tue, 19 Feb 2008 18:30:16 +0000 (18:30 +0000)
client.c
common.c
dhcpcd.c
mk/os.mk
socket.c

index 6ab672b57475cbdf3076e4eb0fc8a67c716413ce..90b434ee2c100b5b8bf8949c76df23ca588c6b48 100644 (file)
--- a/client.c
+++ b/client.c
  * SUCH DAMAGE.
  */
 
-#ifdef __linux__
-# define _BSD_SOURCE
-#endif
-
 #include <sys/time.h>
 #include <sys/types.h>
 #include <arpa/inet.h>
index 8860ec69150dee5ac2f83f27712174510da3855e..99471bce22423607ff021c2b08e8be68347206f5 100644 (file)
--- a/common.c
+++ b/common.c
  * SUCH DAMAGE.
  */
 
-#ifdef __linux__
-# define _XOPEN_SOURCE 500 /* needed for pwrite */
-#endif
-
 #include <sys/time.h>
 #include <errno.h>
 #include <fcntl.h>
index fb47417d24bda274e5cfec7f9a259c2f969e7454..6aa14ef2d4eb1bbbe419577769147b4f6252abad 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
 
 const char copyright[] = "Copyright (c) 2006-2008 Roy Marples";
 
-/* We need to define this to get kill on GNU systems */
-#ifdef __linux__
-#define _BSD_SOURCE
-#define _POSIX_SOURCE
-#endif
-
 #include <sys/file.h>
 #include <sys/types.h>
 #include <sys/stat.h>
index 731ff1c3b63297c2de0fac080d5523386bef98ee..af173fcaf014020d0d8048c11e487df50871a004 100644 (file)
--- a/mk/os.mk
+++ b/mk/os.mk
@@ -70,3 +70,8 @@ _RC_SH= if test -n "${HAVE_INIT}"; then \
                 fi
 _RC!= ${_RC_SH}
 RC= ${_RC}$(shell ${_RC_SH})
+
+# glibc requires _BSD_SOURCE and _XOPEN_SOURCE
+_DEF_SH=       case `uname -s` in Linux) echo "-D_BSD_SOURCE -D_XOPEN_SOURCE=600";; *) echo;; esac
+_DEF!=         ${_DEF_SH}
+CFLAGS+=       ${_DEF}$(shell ${_DEF_SH})
index a3ceb8d092ad3ad9597b7b29a68504b0adc779ed..af097431e00d6bda7e5299222df22fefdccb9b7f 100644 (file)
--- a/socket.c
+++ b/socket.c
  * SUCH DAMAGE.
  */
 
-#ifdef __linux__
-# define _BSD_SOURCE
-#endif
-
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/param.h>
@@ -36,7 +32,9 @@
 #include <net/if.h>
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
+#define __FAVOUR_BSD /* Nasty hack so we can use BSD semantics for UDP */
 #include <netinet/udp.h>
+#undef __FAVOUR_BSD
 #include <arpa/inet.h>
 #include <errno.h>
 #include <fcntl.h>