(Answer) (Category) OpenLDAP Faq-O-Matic : (Category) OpenLDAP Developer's FAQ : (Category) Porting OpenLDAP : (Category) Porting to IBM OS/390 : (Answer) Building Berkeley DB 4
Berkeley DB will work pretty much out of the box, but some patches are needed to provide fast shared/interprocess mutexes. The patches for Berkeley DB 4.0.14 are in the answer below. After you patch mutex.ac you will need to run autoconf to recreate the configure script, and then you can follow the regular BDB Unix build instructions for running configure and actually building the code.
hyc@openldap.org
--- include/mutex.h     2002/08/31 05:16:36     1.1
+++ include/mutex.h     2002/08/31 05:17:26
@@ -501,6 +501,23 @@
 })
 
 #define        MUTEX_UNSET(tsl)        (*(tsl) = 0)
+#define        MUTEX_INIT(tsl)         MUTEX_UNSET(tsl)
+#endif
+#endif
+
+/* OS/390 C
+ * cs() is declared in <stdlib.h> but is built in to the compiler.
+ * Must use LANGLVL(EXTENDED) to get its declaration.
+ */
+#ifdef HAVE_MUTEX_S390_CC_ASSEMBLY
+typedef int tsl_t;
+
+#define        MUTEX_ALIGN      sizeof(int)
+
+#ifdef LOAD_ACTUAL_MUTEX_CODE
+#define MUTEX_SET(tsl) (!cs(&zero, (tsl), 1))
+
+#define MUTEX_UNSET(tsl)       (*(tsl) = 0)
 #define        MUTEX_INIT(tsl)         MUTEX_UNSET(tsl)
 #endif
 #endif
--- dist/aclocal/mutex.ac       2002/08/31 05:18:49     1.1
+++ dist/aclocal/mutex.ac       2002/08/31 05:22:05
@@ -316,6 +316,17 @@
 }], [db_cv_mutex="x86/gcc-assembly"])
 fi
 
+# S390/cc: IBM OS/390 Unix
+if test "$db_cv_mutex" = no; then
+AC_TRY_COMPILE(,[
+#if defined(__MVS__) && defined(__IBMC__)
+       exit(0);
+#else
+       FAIL TO COMPILE/LINK
+#endif
+], [db_cv_mutex="S390/cc-assembly"])
+fi
+
 # ia86/gcc: Linux
 if test "$db_cv_mutex" = no; then
 AC_TRY_RUN([main(){
@@ -391,6 +402,10 @@
                        AC_DEFINE(HAVE_MUTEX_RELIANTUNIX_INITSPIN)
                        AH_TEMPLATE(HAVE_MUTEX_RELIANTUNIX_INITSPIN, [
                            Define to use Reliant UNIX initspin mutexes.]);;
+S390/cc-assembly)      ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
+                       AC_DEFINE(HAVE_MUTEX_S390_CC_ASSEMBLY)
+                       AH_TEMPLATE(HAVE_MUTEX_S390_CC_ASSEMBLY,
+                           [Define to use the IBM C compiler and S/390 assembly language mutexes.]);;
 SCO/x86/cc-assembly)   ADDITIONAL_OBJS="mut_tas${o} $ADDITIONAL_OBJS"
                        AC_DEFINE(HAVE_MUTEX_SCO_X86_CC_ASSEMBLY)
                        AH_TEMPLATE(HAVE_MUTEX_SCO_X86_CC_ASSEMBLY, [
--- mutex/mut_tas.c     2002/08/31 05:23:47     1.1
+++ mutex/mut_tas.c     2002/08/31 05:24:17
@@ -106,6 +106,9 @@
 #ifdef HAVE_MUTEX_HPPA_MSEM_INIT
 relock:
 #endif
+#ifdef HAVE_MUTEX_S390_CC_ASSEMBLY
+               tsl_t zero = 0;
+#endif
                if (!MUTEX_SET(&mutexp->tas))
                        continue;
 #ifdef HAVE_MUTEX_HPPA_MSEM_INIT

hyc@openldap.org
The above changes have been integrated in BDB 4.2 so no patching should be required any more.
hyc@openldap.org
[Append to This Answer]
Next: (Answer) Building OpenSSL
This document is: http://www.openldap.org/faq/index.cgi?file=744
[Search] [Appearance]
This is a Faq-O-Matic 2.721.test.
© Copyright 1998-2013, OpenLDAP Foundation, info@OpenLDAP.org