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%60.8.0-1_deb10u1+rpi1^2^2~38 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=108062545b1ad5cc0b2bb57657e8a14c15d48033;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 1572e73a67..3dd033f887 100644 --- a/comm/ldap/c-sdk/include/portable.h +++ b/comm/ldap/c-sdk/include/portable.h @@ -122,7 +122,7 @@ * some systems don't have the BSD re_comp and re_exec routines */ #ifndef NEED_BSDREGEX -#if ( defined( SYSV ) || defined( NETBSD ) || defined( FREEBSD ) || defined(__OpenBSD__) || defined( linux ) || defined( DARWIN )) && !defined(sgi) +#if ( defined( SYSV ) || defined( NETBSD ) || defined( FREEBSD ) || defined(__OpenBSD__) || defined( linux ) || defined(__GNU__) || defined(__GLIBC__) || defined( DARWIN )) && !defined(sgi) #define NEED_BSDREGEX #endif #endif @@ -150,10 +150,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 +173,7 @@ * for select() */ #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 @@ -241,15 +245,14 @@ #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); -#endif /* SNI */ -#ifdef LINUX1_2 +#else /* SNI */ int strncasecmp(const char *, const char *, size_t); -#endif /* LINUX1_2 */ -#endif /* SNI || LINUX1_2 */ +#endif +#endif /* SNI || LINUX1_2 || __GNU__ || __GLIBC__ */ #if defined(_WINDOWS) || defined(macintosh) || defined(XP_OS2) || defined(DARWIN) #define GETHOSTBYNAME( n, r, b, l, e ) gethostbyname( n ) @@ -267,7 +270,12 @@ int strncasecmp(const char *, const char *, size_t); #define NSLDAPI_NETDB_BUF_SIZE 1024 #endif -#if defined(sgi) || defined(HPUX9) || defined(SCOOS) || \ +#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) || \ @@ -289,7 +297,7 @@ typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE]; #elif defined(HPUX10) #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(__GNU__) || defined(__GLIBC__) || defined(DRAGONFLY) 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 ) @@ -311,7 +319,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(NTO) || defined(OPENBSD) || defined(__GLIBC__) || defined(DRAGONFLY) #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) @@ -448,7 +456,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 94e58ca7a3..8cc1a71ae2 100644 --- a/comm/ldap/c-sdk/libraries/libldap/compat.c +++ b/comm/ldap/c-sdk/libraries/libldap/compat.c @@ -83,7 +83,7 @@ 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(__GNU__) || defined(__GLIBC__) || defined(AIX) || defined(HPUX) || defined(_WINDOWS) /* * 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 b0cb6ed967..16e9d59b8c 100644 --- a/comm/ldap/c-sdk/libraries/libprldap/ldappr-error.c +++ b/comm/ldap/c-sdk/libraries/libprldap/ldappr-error.c @@ -231,7 +231,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 f1d2cff26d..1b857d9869 100644 --- a/nsprpub/config/nsinstall.c +++ b/nsprpub/config/nsinstall.c @@ -43,6 +43,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