From: Roy Marples Date: Tue, 19 Feb 2008 18:30:16 +0000 (+0000) Subject: Remove hardcoded defines for linux and add a nasty hackaround for glibc. X-Git-Tag: v3.2.3~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d13f8f2808c4d17dd1ad348322b26ebc6bd0f9c4;p=thirdparty%2Fdhcpcd.git Remove hardcoded defines for linux and add a nasty hackaround for glibc. --- diff --git a/client.c b/client.c index 6ab672b5..90b434ee 100644 --- a/client.c +++ b/client.c @@ -25,10 +25,6 @@ * SUCH DAMAGE. */ -#ifdef __linux__ -# define _BSD_SOURCE -#endif - #include #include #include diff --git a/common.c b/common.c index 8860ec69..99471bce 100644 --- a/common.c +++ b/common.c @@ -25,10 +25,6 @@ * SUCH DAMAGE. */ -#ifdef __linux__ -# define _XOPEN_SOURCE 500 /* needed for pwrite */ -#endif - #include #include #include diff --git a/dhcpcd.c b/dhcpcd.c index fb47417d..6aa14ef2 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -27,12 +27,6 @@ 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 #include #include diff --git a/mk/os.mk b/mk/os.mk index 731ff1c3..af173fca 100644 --- 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}) diff --git a/socket.c b/socket.c index a3ceb8d0..af097431 100644 --- a/socket.c +++ b/socket.c @@ -24,10 +24,6 @@ * SUCH DAMAGE. */ -#ifdef __linux__ -# define _BSD_SOURCE -#endif - #include #include #include @@ -36,7 +32,9 @@ #include #include #include +#define __FAVOUR_BSD /* Nasty hack so we can use BSD semantics for UDP */ #include +#undef __FAVOUR_BSD #include #include #include