From: Mike Hommey Date: Tue, 11 Mar 2008 07:29:25 +0000 (+0100) Subject: LDAP: support building on GNU/kFreeBSD and GNU/Hurd X-Git-Tag: archive/raspbian/1%91.6.1-1_deb10u1+rpi1^2^2~27 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=971fb9c33d29600faf47847640a4db74e4e2ebb1;p=thunderbird.git LDAP: support building on GNU/kFreeBSD and GNU/Hurd https://bugzilla.mozilla.org/show_bug.cgi?id=356011 Squashed kFreeBSD/Hurd related fixes: - Fix FTBFS on Hurd-i386 - Build fixes for GNU/kFreeBSD in directory/ - Missing bits for Hurd support Gbp-Pq: Topic porting-kfreebsd-hurd Gbp-Pq: Name LDAP-support-building-on-GNU-kFreeBSD-and-GNU-Hurd.patch --- diff --git a/comm/ldap/c-sdk/include/portable.h b/comm/ldap/c-sdk/include/portable.h index 9c03cfc2d0..f609b4e6ef 100644 --- a/comm/ldap/c-sdk/include/portable.h +++ b/comm/ldap/c-sdk/include/portable.h @@ -124,7 +124,8 @@ */ #ifndef NEED_BSDREGEX # if (defined(SYSV) || defined(NETBSD) || defined(FREEBSD) || \ - defined(__OpenBSD__) || defined(linux) || defined(DARWIN)) && \ + defined(__OpenBSD__) || defined(linux) || defined(DARWIN) || \ + defined(__GNU__) || defined(__GLIBC__)) && \ !defined(sgi) # define NEED_BSDREGEX # endif @@ -152,9 +153,14 @@ /* * Is snprintf() part of the standard C runtime library? */ +#if !defined(HAVE_SNPRINTF) +#if defined(SOLARIS) || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) || defined(HPUX) || defined(AIX) +#define HAVE_SNPRINTF +#endif #if defined(_WINDOWS) # define snprintf _snprintf #endif +#endif /* * Async IO. Use a non blocking implementation of connect() and @@ -169,7 +175,7 @@ */ #if !defined(WINSOCK) && !defined(_WINDOWS) && !defined(macintosh) && \ !defined(XP_OS2) -# if defined(hpux) || defined(LINUX) || defined(SUNOS4) || defined(XP_BEOS) +# if defined(hpux) || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) || defined(SUNOS4) || defined(XP_BEOS) # include # else # include @@ -243,7 +249,7 @@ # define HAVE_TIME_R #endif -#if defined(SNI) || defined(LINUX1_2) +#if defined(SNI) || defined(LINUX1_2) || defined(__GNU__) || defined(__GLIBC__) int strcasecmp(const char*, const char*); # ifdef SNI int strncasecmp(const char*, const char*, int); @@ -270,7 +276,12 @@ int strncasecmp(const char*, const char*, size_t); # define NSLDAPI_NETDB_BUF_SIZE 1024 # endif -# if defined(sgi) || defined(HPUX9) || defined(SCOOS) || defined(UNIXWARE) || \ +#if defined(__GLIBC__) && __GLIBC__ >= 2 +typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE]; +# define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t +# define GETHOSTBYNAME( n, r, b, l, rp, e ) gethostbyname_r( n, r, b, l, rp, e ) +# define GETHOSTBYNAME_R_RETURNS_INT +#elif defined(sgi) || defined(HPUX9) || defined(SCOOS) || defined(UNIXWARE) || \ defined(SUNOS4) || defined(SNI) || defined(BSDI) || defined(NCR) || \ defined(OSF1) || defined(NEC) || defined(VMS) || \ (defined(HPUX10) && !defined(_REENTRANT)) || defined(HPUX11) || \ @@ -292,7 +303,7 @@ typedef char GETHOSTBYNAME_buf_t[NSLDAPI_NETDB_BUF_SIZE]; # define GETHOSTBYNAME_BUF_T struct hostent_data # define GETHOSTBYNAME(n, r, b, l, e) \ nsldapi_compat_gethostbyname_r(n, r, (char*)&b, l, e) -# elif defined(LINUX) || defined(DRAGONFLY) +# elif defined(LINUX) || defined(DRAGONFLY) || defined(__GNU__) || defined(__GLIBC__) typedef char GETHOSTBYNAME_buf_t[NSLDAPI_NETDB_BUF_SIZE]; # define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t # define GETHOSTBYNAME(n, r, b, l, rp, e) gethostbyname_r(n, r, b, l, rp, e) @@ -314,7 +325,7 @@ typedef char GETHOSTBYNAME_buf_t[NSLDAPI_NETDB_BUF_SIZE]; defined(OSF1V4) || defined(AIX) || defined(UnixWare) || defined(hpux) || \ defined(HPUX11) || defined(NETBSD) || defined(IRIX6) || \ defined(FREEBSD) || defined(VMS) || defined(NTO) || defined(OPENBSD) || \ - defined(DRAGONFLY) + defined(DRAGONFLY || defined(__GLIBC__)) # define NSLDAPI_CTIME(c, b, l) ctime_r(c, b) # elif defined(OSF1V3) # define NSLDAPI_CTIME(c, b, l) (ctime_r(c, b, l) ? NULL : b) @@ -450,7 +461,7 @@ int select(int, fd_set*, fd_set*, fd_set*, struct timeval*); # define NSLDAPI_FOPEN(filename, mode) fopen(filename, mode) #endif -#if defined(LINUX) || defined(AIX) || defined(HPUX) || defined(_WINDOWS) +#if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) || defined(AIX) || defined(HPUX) || defined(_WINDOWS) size_t nsldapi_compat_strlcpy(char* dst, const char* src, size_t len); # define STRLCPY nsldapi_compat_strlcpy #else diff --git a/comm/ldap/c-sdk/libraries/libldap/compat.c b/comm/ldap/c-sdk/libraries/libldap/compat.c index 2b919dee5f..3f7c0daf96 100644 --- a/comm/ldap/c-sdk/libraries/libldap/compat.c +++ b/comm/ldap/c-sdk/libraries/libldap/compat.c @@ -81,7 +81,7 @@ char* nsldapi_compat_ctime_r(const time_t* clock, char* buf, int buflen) { } #endif /* HPUX10 && _REENTRANT && !HPUX11 */ -#if defined(LINUX) || defined(AIX) || defined(HPUX) || defined(_WINDOWS) +#if defined(LINUX) || defined(AIX) || defined(HPUX) || defined(_WINDOWS) || defined(__GNU__) || defined(__GLIBC__) /* * Copies src to the dstsize buffer at dst. The copy will never * overflow the destination buffer and the buffer will always be null diff --git a/comm/ldap/c-sdk/libraries/libprldap/ldappr-error.c b/comm/ldap/c-sdk/libraries/libprldap/ldappr-error.c index 45545480e4..52ad5627b2 100644 --- a/comm/ldap/c-sdk/libraries/libprldap/ldappr-error.c +++ b/comm/ldap/c-sdk/libraries/libprldap/ldappr-error.c @@ -218,7 +218,7 @@ struct prldap_errormap_entry { #if defined(__hpux) || defined(_AIX) || defined(OSF1) || defined(DARWIN) || \ defined(BEOS) || defined(FREEBSD) || defined(BSDI) || defined(VMS) || \ - defined(OPENBSD) || defined(NETBSD) + defined(OPENBSD) || defined(NETBSD) || defined(__FreeBSD_kernel__) # define EDEADLOCK -1 #endif diff --git a/nsprpub/config/nsinstall.c b/nsprpub/config/nsinstall.c index ee6a111552..87a90f5b65 100644 --- a/nsprpub/config/nsinstall.c +++ b/nsprpub/config/nsinstall.c @@ -40,6 +40,31 @@ #endif #if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) +#ifdef NEXTSTEP +#include + +/* +** balazs.pataki@sztaki.hu: The getcwd is broken in NEXTSTEP (returns 0), +** when called on a mounted fs. Did anyone notice this? Here's an ugly +** workaround ... +*/ +#define getcwd(b,s) my_getcwd(b,s) + +static char * +my_getcwd (char *buf, size_t size) +{ + FILE *pwd = popen("pwd", "r"); + char *result = fgets(buf, size, pwd); + + if (result) { + buf[strlen(buf)-1] = '\0'; + } + pclose (pwd); + return buf; +} +#endif /* NEXTSTEP */ + +#if defined(LINUX) || defined(__GLIBC__) || defined(__GNU__) #include #endif