LDAP: support building on GNU/kFreeBSD and GNU/Hurd
authorMike Hommey <glandium@debian.org>
Tue, 11 Mar 2008 07:29:25 +0000 (08:29 +0100)
committerCarsten Schoenert <c.schoenert@t-online.de>
Tue, 19 Apr 2022 18:27:13 +0000 (19:27 +0100)
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

comm/ldap/c-sdk/include/portable.h
comm/ldap/c-sdk/libraries/libldap/compat.c
comm/ldap/c-sdk/libraries/libprldap/ldappr-error.c
nsprpub/config/nsinstall.c

index 9c03cfc2d0511839ebc41ae28ac3030ed3f649f7..f609b4e6efcee89319ea3a0f3b3269e9ddb721b2 100644 (file)
  */
 #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
 /*
  * 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
  */
 #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 <sys/time.h>
 #  else
 #    include <sys/select.h>
 #  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
index 2b919dee5f346bc293065b155fb5915b0f6e3fe2..3f7c0daf96bfe9fc4a31a290147b6931ec1a0c9a 100644 (file)
@@ -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
index 45545480e499cae2d6abcb4a070bd20a8cae1245..52ad5627b2efd3042dfc17f87b1f44f7a750a6ef 100644 (file)
@@ -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
 
index ee6a1115528a6c651114c7082f06bed6fb00f86b..87a90f5b652e81e1ae312c3e61f1b7d722ab56e1 100644 (file)
 #endif
 
 #if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
+#ifdef NEXTSTEP
+#include <bsd/libc.h>
+
+/*
+** 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 <getopt.h>
 #endif