From d24e63eea4f4d234f313145e40668a5e2f64e49c Mon Sep 17 00:00:00 2001 From: "Arnout Vandecappelle (Essensium/Mind)" Date: Wed, 9 Mar 2016 23:20:11 +0100 Subject: [PATCH] compat.h: only include compat_netdb.h if needed compat_netdb.h is added for only one reason: to provide the definitions for getaddrinfo, in case it is not provided by the system. compat_netdb.h is just a copy from an old glibc version, but that makes it incompatible with other standard C libraries. For example, uClibc without RPC support doesn't have the rpc/netdb.h header. This leads to build errors. To work around this, only include compat_netdb.h when needed, i.e. when getaddrinfo isn't provided natively. Note that this getaddrinfo compat was introduced in commit bc54c431 to support Solaris 7. Starting from Solaris 8, however, getaddrinfo is available natively, and it's available on MacOS, Windows and any other POSIX-2001 compliant system as well. So it may be worhtwhile to remove it altogether. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- module/owlib/src/include/compat.h | 2 ++ module/ownet/c/src/include/compat.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/module/owlib/src/include/compat.h b/module/owlib/src/include/compat.h index c55bc96..e95e16f 100644 --- a/module/owlib/src/include/compat.h +++ b/module/owlib/src/include/compat.h @@ -57,7 +57,9 @@ #include #endif +#ifndef HAVE_GETADDRINFO #include "compat_netdb.h" +#endif #include "compat_getopt.h" #ifndef HAVE_STRSEP diff --git a/module/ownet/c/src/include/compat.h b/module/ownet/c/src/include/compat.h index c45d852..f8ae759 100644 --- a/module/ownet/c/src/include/compat.h +++ b/module/ownet/c/src/include/compat.h @@ -58,7 +58,9 @@ $Id$ #include #endif +#ifndef HAVE_GETADDRINFO #include "compat_netdb.h" +#endif #include "compat_getopt.h" #ifndef HAVE_STRSEP -- 2.7.0