From: ng0 Date: Tue, 19 Nov 2019 17:30:32 +0000 (+0000) Subject: On *BSD the header file sys/param.h defines BSD. Drop unnecessary X-Git-Tag: v0.12.0~120 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7c14b80a011e9e99b1cef0bfd96bae364edd5663;p=oweals%2Fgnunet.git On *BSD the header file sys/param.h defines BSD. Drop unnecessary BSD defines in the build-system. Furthermore add detection for FreeBSD using the additional defines by FreeBSD. Use !Linux where previously a list of BSDs was. --- diff --git a/configure.ac b/configure.ac index 25a558902..c5c6586e5 100644 --- a/configure.ac +++ b/configure.ac @@ -132,8 +132,6 @@ AS_CASE(["$host_os"], AC_PATH_XTRA ], [*freebsd*],[ - AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) - AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system]) CFLAGS="-D_THREAD_SAFE $CFLAGS" build_target="freebsd" LIBPREFIX= @@ -141,8 +139,6 @@ AS_CASE(["$host_os"], UNIXONLY="#" ], [*openbsd*],[ - AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) - AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system]) LIBS=`echo $LIBS | sed -e "s/-ldl//"` build_target="openbsd" LIBPREFIX= @@ -150,8 +146,6 @@ AS_CASE(["$host_os"], UNIXONLY="#" ], [*netbsd*],[ - AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) - AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system]) build_target="netbsd" LIBPREFIX= DLLDIR=lib diff --git a/src/include/platform.h b/src/include/platform.h index 0dddd9741..976c9eac7 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -115,11 +115,10 @@ #include #endif #endif - -#ifdef SOMEBSD +#ifdef BSD #include #endif -#ifdef FREEBSD +#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__) #include #endif #ifdef DARWIN @@ -188,7 +187,8 @@ #include -#ifdef FREEBSD +/* FreeBSD_kernel is not defined on the now discontinued kFreeBSD */ +#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__) #define __BYTE_ORDER BYTE_ORDER #define __BIG_ENDIAN BIG_ENDIAN #endif diff --git a/src/nat/gnunet-helper-nat-client.c b/src/nat/gnunet-helper-nat-client.c index 12abfd2df..0271d6e0f 100644 --- a/src/nat/gnunet-helper-nat-client.c +++ b/src/nat/gnunet-helper-nat-client.c @@ -249,7 +249,8 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other) off = 0; ip_pkt.vers_ihl = 0x45; ip_pkt.tos = 0; -#ifdef FREEBSD + /* should this be BSD only? */ +#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__) ip_pkt.pkt_len = sizeof(packet); /* Workaround PR kern/21737 */ #else ip_pkt.pkt_len = htons (sizeof(packet)); @@ -360,7 +361,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other) off = 0; ip_pkt.vers_ihl = 0x45; ip_pkt.tos = 0; -#ifdef FREEBSD +#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__) ip_pkt.pkt_len = sizeof(packet); /* Workaround PR kern/21737 */ #else ip_pkt.pkt_len = htons (sizeof(packet)); diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index e31b07d14..d16abed71 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -75,7 +75,7 @@ (GNUNET_MQ_PRIO_BACKGROUND | GNUNET_MQ_PREF_UNRELIABLE \ | GNUNET_MQ_PREF_CORK_ALLOWED) -#if FREEBSD +#if BSD #define log2(a) (log (a) / log (2)) #endif diff --git a/src/testbed/gnunet-service-testbed_cpustatus.c b/src/testbed/gnunet-service-testbed_cpustatus.c index f38b9aee6..5eaeaf952 100644 --- a/src/testbed/gnunet-service-testbed_cpustatus.c +++ b/src/testbed/gnunet-service-testbed_cpustatus.c @@ -43,7 +43,7 @@ #include #endif #endif -#if SOMEBSD +#if BSD #if HAVE_KVM_H #include #endif diff --git a/src/util/disk.c b/src/util/disk.c index 47a0ed5c9..866dbc301 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -1505,7 +1505,7 @@ GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h) return GNUNET_SYSERR; } -#if defined(FREEBSD) || defined(OPENBSD) || defined(DARWIN) +#if ! defined(LINUX) || ! defined(GNU) return fsync (h->fd) == -1 ? GNUNET_SYSERR : GNUNET_OK; #else return fdatasync (h->fd) == -1 ? GNUNET_SYSERR : GNUNET_OK;