support-kfreebsd
authorDebian 389ds Team <pkg-fedora-ds-maintainers@lists.alioth.debian.org>
Wed, 10 May 2017 06:25:03 +0000 (07:25 +0100)
committerTimo Aaltonen <tjaalton@debian.org>
Wed, 10 May 2017 06:25:03 +0000 (07:25 +0100)
Gbp-Pq: Name support-kfreebsd.patch

configure.ac
include/base/systems.h
include/public/base/systems.h
ldap/include/portable.h
ldap/servers/slapd/daemon.c
ldap/servers/slapd/tools/pwenc.c
ldap/systools/idsktune.c
lib/base/dnsdmain.cpp
lib/base/file.cpp

index 846e3b4f877496a293c941d2f9ea104555c93cc9..64aab5e956ecc7e843cdf15b5ab9abed8436be0a 100644 (file)
@@ -549,6 +549,46 @@ case $host in
     AC_SUBST([LIBCRYPT], [$LIBCRYPT])
     AC_DEFINE([USE_POSIX_RWLOCKS], [1], [POSIX rwlocks])
     ;;
+  *-*-kfreebsd*)
+    dnl Assume that BSD has the getpeereid() function.
+    dnl TODO: Check for the existance of the getpeereid() function!
+    AC_DEFINE([HAVE_GETPEEREID], [1], [have getpeereid])
+    dnl Check if we need to link against the bsd library for the getpeereid() function.
+    AC_SEARCH_LIBS([getpeereid], [bsd])
+    dnl Copied stuff from Linux section above
+    dnl TODO: Check for features instead of setting flags based on the host!
+    AC_DEFINE([XP_UNIX], [1], [UNIX])
+    AC_DEFINE([freebsd], [1], [freebsd])
+    AC_DEFINE([_GNU_SOURCE], [1], [GNU Source])
+    initdir='$(sysconfdir)/rc.d/init.d'
+    # do arch specific kfreebsd stuff here
+    case $host in
+      i*86-*-linux*)
+        AC_DEFINE([CPU_x86], [], [cpu type x86])
+        AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
+        ;;
+      x86_64-*-linux*)
+        AC_DEFINE([CPU_x86_64], [], [cpu type x86_64])
+        AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
+        ;;
+    esac
+    AC_MSG_CHECKING([for GCC provided 64-bit atomic bool cas function ...])
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
+                                    [[long long ptrval = 0, val = 0, newval = 1; (void)__sync_bool_compare_and_swap_8(&ptrval, val, newval);]])],
+                   [AC_DEFINE([HAVE_64BIT_ATOMIC_CAS_FUNC], [1], [have 64-bit atomic bool compare and swap function provided by gcc])AC_MSG_RESULT([yes])],
+                   [AC_MSG_RESULT([no])])
+    AC_MSG_CHECKING([for GCC provided 64-bit atomic ops functions ...])
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
+                                    [[long long ptrval = 0, val = 0; (void)__sync_add_and_fetch_8(&ptrval, val);]])],
+                   [AC_DEFINE([HAVE_64BIT_ATOMIC_OP_FUNCS], [1], [have 64-bit atomic operation functions provided by gcc])AC_MSG_RESULT([yes])],
+                   [AC_MSG_RESULT([no])])
+    # some programs use the native thread library directly
+    THREADLIB=-lpthread
+    AC_SUBST([THREADLIB], [$THREADLIB])
+    LIBCRYPT=-lcrypt
+    AC_SUBST([LIBCRYPT], [$LIBCRYPT])
+    AC_DEFINE([USE_POSIX_RWLOCKS], [1], [POSIX rwlocks])
+    ;;
   ia64-hp-hpux*)
     AC_DEFINE([hpux], [1], [HP-UX])
     AC_DEFINE([HPUX], [1], [HP-UX])
index 5f14969e65eaa074ca0ea76a2cc19bbf43c39229..72401a5014a81e01b26bcd0121b8d7eaa273bde9 100644 (file)
@@ -62,7 +62,7 @@
 /* warning: mmap doesn't work under 9.04 */
 #define SHMEM_MMAP_FLAGS MAP_FILE | MAP_VARIABLE | MAP_SHARED
 
-#elif defined(Linux)
+#elif defined(Linux) || defined(freebsd)
 
 #define ACCELERATOR_CACHE
 #define DNS_CACHE
index 535a35c79a5b3c7012cf68eaa90b234c1dea9205..3949f2b16bd3c8761278524d82cb3984fa76c283 100644 (file)
@@ -56,7 +56,7 @@
 #define SHMEM_UNIX_MMAP
 #define ZERO(ptr,len) memset(ptr,0,len)
 
-#elif defined(Linux)
+#elif defined(Linux) || defined(freebsd)
 
 #define FILE_UNIX
 #define FILE_UNIX_MMAP
index ea164c04965469063ce8a0d74aabe71d139aa2ef..d6a260bdd76c6a115c1998d12aec69c460b32791 100644 (file)
@@ -250,7 +250,7 @@ int strncasecmp(const char *, const char *, size_t);
     defined(UNIXWARE) || defined(SUNOS4) || defined(SNI) || defined(BSDI) || \
     defined(NCR) || defined(OSF1) || defined(NEC) || \
     ( defined(HPUX10) && !defined(_REENTRANT)) || defined(HPUX11) || \
-    defined(UnixWare) || defined(LINUX2_0)
+    defined(UnixWare) || defined(LINUX2_0) || defined(freebsd)
 #define GETHOSTBYNAME( n, r, b, l, e )  gethostbyname( n )
 #elif defined(AIX)
 #define GETHOSTBYNAME_BUF_T struct hostent_data
@@ -288,7 +288,7 @@ typedef char GETHOSTBYADDR_buf_t [BUFSIZ];
 #elif defined( hpux10 )
 #define CTIME( c, b, l )               nsldapi_compat_ctime_r( c, b, l )
 #elif defined( IRIX ) || defined(UNIXWARE) || defined(LINUX) \
-       || defined(OSF1V4) || defined(AIX) || defined(UnixWare) || defined (HPUX11)
+       || defined(OSF1V4) || defined(AIX) || defined(UnixWare) || defined (HPUX11) || defined(freebsd)
 #define CTIME( c, b, l )                ctime_r( c, b )
 #elif defined( OSF1V3 )
 #define CTIME( c, b, l )               (ctime_r( c, b, l ) ? NULL : b)
@@ -297,7 +297,7 @@ typedef char GETHOSTBYADDR_buf_t [BUFSIZ];
 #endif
 #if defined(hpux9) || defined(LINUX1_2) || defined(SUNOS4) || defined(SNI) || \
     defined(SCOOS) || defined(BSDI) || defined(NCR) || \
-    defined(NEC) || defined(LINUX2_0)
+    defined(NEC) || defined(LINUX2_0) || defined(freebsd)
 /* strtok() is not MT safe, but it is okay to call here because used in mmt_protocol.xs which 
    has been moved in the tetframewrok */
 #define STRTOK( s1, s2, l )            strtok( s1, s2 )
index 23c30c384cb5880dcde61e42bc5127a8e940f9d1..74164beb2a7d95f4675fab5700520bf17fda8558 100644 (file)
@@ -38,7 +38,7 @@
 #endif /* NEED_FILIO */
 /* for some reason, linux tty stuff defines CTIME */
 #include <stdio.h>
-#ifdef LINUX
+#if defined(LINUX) || defined(freebsd)
 #undef CTIME
 #include <sys/statfs.h>
 #else
@@ -442,7 +442,7 @@ disk_mon_get_dirs(char ***list, int logs_critical){
 char *
 disk_mon_check_diskspace(char **dirs, PRUint64 threshold, PRUint64 *disk_space)
 {
-#ifdef LINUX
+#if defined(LINUX) || defined(freebsd)
     struct statfs buf;
 #else
     struct statvfs buf;
@@ -455,7 +455,7 @@ disk_mon_check_diskspace(char **dirs, PRUint64 threshold, PRUint64 *disk_space)
     int i = 0;
 
     for(i = 0; dirs && dirs[i]; i++){
-#ifndef LINUX
+#if !defined(LINUX) && !defined(freebsd)
         if (statvfs(dirs[i], &buf) != -1)
 #else
         if (statfs(dirs[i], &buf) != -1)
index f92136c406ce19d3ab2a3a4b0f22b5caea627b22..1b01e51c905aba43fd20facc8db6bfa39e4c1c49 100644 (file)
@@ -16,7 +16,7 @@
 #include <sys/errno.h>
 #include <sys/param.h>
 #include <sys/types.h>
-#if defined(LINUX) /* I bet other Unix would like
+#if defined(LINUX) || defined(freebsd) /* I bet other Unix would like
                                        * this flag. But don't want to
                                        * break other builds so far */
 #include <unistd.h>
index e56245d48773bfc7da10612278df2d4384398734..82efb33692cf45ab52cc1dac2eea7087f9f63426 100644 (file)
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
 static char *build_date = "14-JULY-2016";
 
+#if defined(freebsd)
+#define IDDS_BSD_INCLUDE 1
+#define IDDS_BSD_SYSCTL 1
+#endif
+
 #if defined(linux) || defined(__linux) || defined(__linux__)
 #define IDDS_LINUX_INCLUDE 1
 #define IDDS_LINUX_SYSCTL 1
index 545f617a637a7fc196bc1153d41f4dbaa1440288..5750dfc8b768c51b47afd13b21a8f0b86c670b6e 100644 (file)
@@ -35,12 +35,12 @@ extern "C" {
 #define _PATH_RESCONF "/etc/resolv.conf"
 
 NSPR_BEGIN_EXTERN_C
-#ifdef Linux
+#if defined Linux || defined(freebsd)
 extern int getdomainname(char *, size_t);
 #else 
 extern int getdomainname(char *, int);
 #endif /* Linux */
-#if defined(HPUX) || defined(Linux) || defined(SOLARIS_GCC)
+#if defined(HPUX) || defined(Linux) || defined(SOLARIS_GCC) || defined(freebsd)
 extern int gethostname (char *name, size_t namelen);
 #else
 extern int gethostname (char *name, int namelen);
index ad4333e6b10ac0ba66444a0a7d64a706e43274dc..37ec14aa2a64e4c84d56a2194e873abb31ffe405 100644 (file)
@@ -213,7 +213,7 @@ NSAPI_PUBLIC int file_notfound(void)
     return (errno == ENOENT);
 }
 
-#if !defined(LINUX)
+#if !defined(LINUX) && !defined(freebsd)
 extern char *sys_errlist[];
 #endif