From: Kurt Zeilenga Date: Wed, 16 Sep 1998 02:47:02 +0000 (+0000) Subject: Merge in platform updates from main. X-Git-Tag: PHP3_TOOL_0_0~18^2~147 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3e20891263f4d1dc36eb7172ec8ded5abea498ac;p=openldap Merge in platform updates from main. --- diff --git a/Make-common.gmake b/Make-common.gmake new file mode 100644 index 0000000000..fcbbd5fa1c --- /dev/null +++ b/Make-common.gmake @@ -0,0 +1,343 @@ +#----------------------------------------------------------------------------- +# Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted only +# as authorized by the OpenLDAP Public License. A copy of this +# license is available at http://www.OpenLDAP.org/license.html or +# in file LICENSE in the top-level directory of the distribution. +# +# This work is derived from the University of Michigan LDAP v3.3 +# distribution. Information concerning is available at +# http://www.umich.edu/~dirsvcs/ldap/ldap.html. +# +# This work also contains materials derived from public sources. +#----------------------------------------------------------------------------- +# Copyright (c) 1994 Regents of the University of Michigan. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted +# provided that this notice is preserved and that due credit is given +# to the University of Michigan at Ann Arbor. The name of the University +# may not be used to endorse or promote products derived from this +# software without specific prior written permission. This software +# is provided ``as is'' without express or implied warranty. +#----------------------------------------------------------------------------- +# LDAP common Make defines (included in all but top-level Makefile) + +############################################################################# +## Edit the following variables to have appropriate values for your system ## +############################################################################# + +# +# This template should be used by systems with Gnu Make. +# +# If Gnu make is not installed as make, you must uncomment out +# this line. +#MAKE=gmake + +############################################################################# +## LDAP install paths ## +############################################################################# +# by default, everything is installed below INSTROOT +# config files, etc. are put in ETCDIR +# include files get put in INCLUDEDIR +# libraries are put in LIBDIR +# man pages are put under MANDIR +# programs end-users will run are put in BINDIR +# programs sysadmins will run are put in SBINDIR +# servers are put in LIBEXECDIR +# pid/args files are put in RUNDIR +# +# Per platform defaults override these. +# +ifndef LDAP_PREFIX +LDAP_PREFIX= /usr/local +endif +ifndef LDAP_INSTROOT +LDAP_INSTROOT= $(LDAP_PREFIX) +endif +ifndef LDAP_ETCDIR +LDAP_ETCDIR= $(LDAP_INSTROOT)/etc/ldap +endif +ifndef LDAP_INCDIR +LDAP_INCDIR= $(LDAP_INSTROOT)/include +endif +ifndef LDAP_LIBDIR +LDAP_LIBDIR= $(LDAP_INSTROOT)/lib +endif +ifndef LDAP_MANDIR +LDAP_MANDIR= $(LDAP_INSTROOT)/man +endif +ifndef LDAP_BINDIR +LDAP_BINDIR= $(LDAP_INSTROOT)/bin +endif +ifndef LDAP_SBINDIR +LDAP_SBINDIR=$(LDAP_INSTROOT)/sbin +endif +ifndef LDAP_LIBEXECDIR +LDAP_LIBEXECDIR= $(LDAP_INSTROOT)/libexec +endif +ifndef LDAP_RUNDIR +LDAP_RUNDIR= $(LDAP_ETCDIR) +endif + +############################################################################# +## General compiler options ## +############################################################################# +# Passed to every compile (cc or gcc). This is where you put -O or -g, etc. +#EXTRACFLAGS=-O -g +#EXTRACFLAGS=-O +ifndef EXTRACFLAGS +EXTRACFLAGS?=-g +endif +# Passed to every link (ld). Include -g here if you did in EXTRACFLAGS. +ifndef EXTRALDFLAGS +EXTRALDFLAGS=-g +endif + +############################################################################# +## If you are NOT using Kerberos authentication, you can skip this section.## +############################################################################# +# +# Otherwise, to enable kerberos authentication, uncomment KERBEROS (and +# AFSKERBEROS if you are running the AFS version of kerberos). Also +# uncomment and change the various KRB* lines to point to where the +# kerberos libraries and include files are installed at your site. +# +# *** NOTE *** +# If you have an MIT Kerberos V distribution and you compiled it with -krb4 +# flag which enables Kerberos IV compatibility, uncomment KERBEROS_V - +# this will make sure all your includes can be found where they actually are - +# in this case /usr/local/kerberos/include/kerberosIV - simple change of +# KRBINCLUDEFLAG will _not_ work. Also uncomment the correct KRBLIBS define. +# +# For Kerberos V with Kerberos IV compatibility uncomment the following line +#KERBEROS=-DKERBEROS -DKERBEROS_V +# For Kerberos IV uncomment the following line +#KERBEROS=-DKERBEROS +# +#AFSKERBEROS=-DAFSKERBEROS +#KRBINCLUDEFLAG = -I/usr/local/kerberos/include +#KRBLIBFLAG = -L/usr/local/kerberos/lib +# For Kerberos V with Kerberos IV compatibility uncomment the following line +#KRBLIBS = -lkrb4 -lkrb5 -ldes425 +# For Kerberos IV uncomment the following line +#KRBLIBS = -lkrb -ldes + +############################################################################# +## ISODE is required ONLY to build the ldap <-> X.500 server (ldapd) ## +## If you don't want to build it, you can skip this section. ## +############################################################################# +# +# To build the ldap server, uncomment the HAVEISODE line, +# and the section describing build settings for your version of isode. +# +#HAVEISODE = yes +# If you compiled ISODE with TURBO_DISK defined, uncomment this +#ISODETURBOLIBS = -lgdbm +# uncomment these to have ldapd "pretty print" protocol elements w/debugging +#PEPSY_DUMP=-DPEPSY_DUMP +#PEPSY=/usr/local/ic/bin/pepsy +# uncommment this line to have ldapd load PP syntax handlers +# you'll also need to add -lpp to ISODEBASELIBS below +#LDAP_USE_PP=-DLDAP_USE_PP +# uncomment NO_SETPROCTITLE to have ldapd NOT change its title +#NO_SETPROCTITLE=-DNOSETPROCTITLE +# +# ISODE Consortium release build settings +# You should change the next line so that ICRELEASE matches the (integer) +# version number of whatever IC release you have, e.g. 1, 2, or 3 and +# also uncomment the next 5 lines. +#ICRELEASE=-DICRELEASE=1 +#ISODEPACKAGE=-DISODEPACKAGE=IC +#ISODEINCLUDEFLAG= -I/usr/local/ic/include/isode -I/usr/local/ic/include +#ISODELIBFLAG = -L/usr/local/ic/lib +#ISODEBASELIBS = -lisode +# +# Freely available ISODE 8.0 release build settings (uncomment the next 4 lines) +#ISODEPACKAGE=-DISODEPACKAGE +#ISODEINCLUDEFLAG= -I/usr/local/isode/include +#ISODELIBFLAG = -L/usr/local/isode/lib +#ISODEBASELIBS = -ldsap -lisode +# +# NEXOR ISODE release build settings (uncomment the next 4 lines) +#ISODEPACKAGE=-DISODEPACKAGE=XT +#ISODEINCLUDEFLAG= -I/usr/include/isode +#ISODELIBFLAG = -L/usr/local/lib -L/usr/sunlink/osi/lib +#ISODEBASELIBS = -lxtpp -lresolv -lxtdsap -lxtisode -losi + +############################################################################# +## If you don't want to run slapd, skip this section. ## +############################################################################# +# +# To build slapd (the stand-alone ldap daemon), uncomment the MAKESLAPD +# line and select the SLAPD_BACKENDS you want to use. If you enable the +# LDBM backend, also select one of the LDBM backends. +MAKESLAPD= yes +# +# remove the defines for backends you don't want to enable +SLAPD_BACKENDS= -DLDAP_LDBM -DLDAP_SHELL -DLDAP_PASSWD +# +# If you have included -DLDAP_LDBM in the SLAPD_BACKENDS line, +# which low-level database package to use must be specified. You +# may want to overide the platform settings by disabling the lines +# below and hardcoding the desired settings. +# +# The four choices: Berkeley db b-tree, Berkeley db hash, GNU dbm, or ndbm. +# You will also need to edit the include and lib strings appropriately. +# standard unix ndbm + +# Fallback settings, defaults are set in build/*/Make-platform +# The NDBM interface may not work on some (any) platforms. +# You may be happier with Berkeley DB B-trees. +ifndef LDBMBACKEND +LDBMBACKEND=-DLDBM_USE_NDBM +endif +ifndef LDBMINCLUDE +LDBMINCLUDE= +endif +ifndef LDBMLIB +LDBMLIB= +endif + +# LDBM Hardcode Setting Examples (may require editing) +# berkeley db btree package +#LDBMLIB=-ldb +#LDBMBACKEND=-DLDBM_USE_DBBTREE +#LDBMINCLUDE=-I/usr/local/db/include +#LDBMLIB?=-ldb +# berkeley db hash package +#LDBMBACKEND=-DLDBM_USE_DBHASH +#LDBMINCLUDE=-I/usr/local/db/include +#LDBMLIB=-ldb +# gnu dbm (gdbm) +#LDBMBACKEND=-DLDBM_USE_GDBM +#LDBMINCLUDE=-I/usr/local/gdbm/include +#LDBMLIB=-lgdbm + +#undef these if you have SleepyCat DB2 installed the updated DBI +#LDBMBACKEND=-DLDBM_USE_DBBTREE -DLDBM_USE_DB2 +#LDBMINCLUDE=-I/usr/local/include +#LDBMLIB=-L/usr/local/lib -ldb + +#undef these if you have SleepyCat DB2 installed (with compat185) +#LDBMBACKEND=-DLDBM_USE_DBBTREE -DLDBM_USE_DB2_COMPAT185 +#LDBMINCLUDE=-I/usr/local/include +#LDBMLIB=-L/usr/local/lib -ldb + +# if you want to use a non-default threads package change the defines below +# to one of: +# -DPOSIX_THREADS (draft 10 or standard) +# -DTHREAD_MIT_PTHREADS (draft 4) +# -DTHREAD_NEXT_CTHREADS +# -DTHREAD_DCE_PTHREADS +# -DTHREAD_SUNOS4_LWP +# -DTHREAD_SUNOS5_LWP +# and select the appropriate library. + +ifndef THREADS +THREADS=-DNO_THREADS +endif +ifndef THREADSLIB +THREADSLIB= +endif + +# Locations of auxilary programs +# (excepts to below are generally defined in Make-platform) +ifndef LDAP_SENDMAIL +LDAP_SENDMAIL=/usr/lib/sendmail +endif +ifndef LDAP_EDITOR +LDAP_EDITOR=/usr/ucb/vi +endif +ifndef LDAP_FINGER +LDAP_FINGER=/usr/ucb/finger +endif + +# For generation of compressed man pages +# (excepts to below are generally defined in Make-platform) +ifndef MANCOMPRESS +MANCOMPRESS=cat +endif +ifndef MANCOMPRESSSUFFIX +MANCOMPRESSSUFFIX= +endif + +############################################################################# +## The following options are used by the xax500 client. If you haven't ## +## retrieved the xax500 source and dropped it into the "clients" ## +## directory, you can skip this section. ## +############################################################################# +# +# location of your X include files +#XINCLUDES= -I/usr/X11/include +# +# location of your X libraries +#XLIBDIRS=-L/usr/X11/lib +# +# include any extra X libraries you need here +# the following works with sunos 4 and X11R5 +#XLIBS = $(XLIBDIRS) -lXm -lXt -lX11 +# the following has been known to work with Solaris 2.4 and X11R6 +#XLIBS = $(XLIBDIRS) -lXm -lXext -lSM -lICE -lXpm -lXt -lX11 + +############################################################################# +## If you don't want to do auto-translation of character sets, skip this ## +############################################################################# +# +# Otherwise, uncomment this line and set the following options. +#STR_TRANSLATION=-DSTR_TRANSLATION +# +# remove the defines for LDAP client library T.61 character translation +# you do not need. If you use LDAP_CHARSET_8859, replace the '1' in "88591" +# with the number of the particular character set you use. E.g., use "88594" +# if you use the ISO 8859-4 chracter set. +#LIBLDAP_CHARSETS=-DLDAP_CHARSET_8859="88591" +# +# uncomment one these lines to enable automatic T.61 translation by default +#LIBLDAP_DEF_CHARSET=-DLDAP_DEFAULT_CHARSET=LDAP_CHARSET_8859 + +############################################################################# +## General options ## +############################################################################# +# uncomment this line to enable debugging code (a good idea) +LDAP_DEBUG=-DLDAP_DEBUG + +# uncomment this line to turn on a few U of Michigan specific things +#UOFM=-DUOFM + +# uncomment this line to delete a few printfs in the lber and ldap libraries. +#NO_USERINTERFACE=-DNO_USERINTERFACE + +# uncomment this line to include Connectionless LDAP support +#CLDAP=-DCLDAP + +# uncomment this line to eliminate local caching support in the libldap +#NO_CACHE=-DNO_CACHE + +# uncomment this line to do reverse lookups (useful for doing ACLs +# by host/domain names) +LDAP_REVERSE_LOOKUP=-DREVERSE_LOOKUP + +# uncomment this line to enable support for LDAP referrals in libldap +LDAP_REFERRALS=-DLDAP_REFERRALS + +# uncomment this line to enable ACL by groups +# LDAP_ACLGROUP=-DACLGROUP + +# uncomment these lines to enable support for CRYPT, SHA1, and/or MD5 passwords +# in LDBM. Crypt uses platform provided crypt(3). +# LDAP_CRYPT=-DLDAP_CRYPT -DLDAP_SHA1 -DLDAP_MD5 +# LDAP_CRYPT_LIB= +# and comment this line out +LDAP_CRYPT_LIB= + +# uncomment these lines to enable support fro tcp_wrappers in servers. +# Requires tcp_wrappers. +# LDAP_TCP_WRAPPERS=-DTCP_WRAPPERS -I/usr/local/include +# LDAP_TCP_WRAPPERS_LIB=-L/usr/local/lib -lwrap + +# uncomment this line to use soundex for approximate matches in slapd. +# the default is to use the metaphone algorithm. +#PHONETIC=-DSOUNDEX diff --git a/Makefile b/Makefile index a8103f2270..59df0cdc46 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,19 @@ -# # You will usually NOT need to edit this file at all: instead, edit the # Make-common file. See the LDAP INSTALL file for more information. -# +#----------------------------------------------------------------------------- +# Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted only +# as authorized by the OpenLDAP Public License. A copy of this +# license is available at http://www.OpenLDAP.org/license.html or +# in file LICENSE in the top-level directory of the distribution. +# +# This work is derived from the University of Michigan LDAP v3.3 +# distribution. Information concerning is available at +# http://www.umich.edu/~dirsvcs/ldap/ldap.html. +# +# This work also contains materials derived from public sources. #----------------------------------------------------------------------------- # Copyright (c) 1994 Regents of the University of Michigan. # All rights reserved. @@ -12,10 +24,8 @@ # may not be used to endorse or promote products derived from this # software without specific prior written permission. This software # is provided ``as is'' without express or implied warranty. -# -# LDAP lightweight X.500 Directory access top level makefile -# #----------------------------------------------------------------------------- +# LDAP lightweight X.500 Directory access top level makefile # ############################################################################ # # @@ -161,8 +171,8 @@ depend: makeconfig for i in $(SRCDIRS); do \ echo; echo "cd $$i; $(MAKE) $(MFLAGS) depend"; \ ( cd $$i; $(MAKE) $(MFLAGS) depend ); \ - done; \ - $(MAKE) $(MFLAGS) makefiles + done; + @echo " "; echo Remember to \"make depend\" after each \"make makefiles\" # # rules to check out and in Make-template files @@ -202,16 +212,17 @@ checkin: FORCE done tar: veryclean +# $(RM) ./Make-common; \ +# $(CP) ./Make-common.dist ./Make-common; \ +# $(CHMOD) 644 ./Make-common; \ +# $(RM) ./include/ldapconfig.h.edit; \ +# $(CP) ./include/ldapconfig.h.dist ./include/ldapconfig.h.edit; \ +# $(CHMOD) 644 ./include/ldapconfig.h.edit; @PWD=`pwd`; \ - $(RM) ./Make-common; \ - $(CP) ./Make-common.dist ./Make-common; \ - $(CHMOD) 644 ./Make-common; \ - $(RM) ./include/ldapconfig.h.edit; \ - $(CP) ./include/ldapconfig.h.dist ./include/ldapconfig.h.edit; \ - $(CHMOD) 644 ./include/ldapconfig.h.edit; \ BASE=`$(BASENAME) $$PWD`; XFILE=/tmp/ldap-x.$$$$; \ ( cd .. ; $(CAT) $$BASE/exclude >$$XFILE; \ $(FIND) $$BASE -name RCS -print >> $$XFILE ; \ + $(FIND) $$BASE -name CVS -print >> $$XFILE ; \ $(FIND) $$BASE -name obj-\* -print >> $$XFILE ; \ $(FIND) $$BASE -name tags -print >> $$XFILE ; \ $(TAR) cvfX ./$$BASE.tar $$XFILE $$BASE; \ @@ -256,7 +267,12 @@ makeconfig: .makefiles buildtools echo "SunOS release $$OSRELEASE unknown..."; exit 1; \ fi; \ if [ $$OSRELEASE -ge "5" ]; then \ - PLATFORM="sunos5"; \ + MINORVER=`echo $$OSRELEASE|sed 's/^.*\.//'` ; \ + if [ $$MINORVER -ge "6" ]; then \ + PLATFORM="sunos56" ; \ + else \ + PLATFORM="sunos5"; \ + fi; \ else \ PLATFORM="sunos4"; \ fi; \ @@ -279,8 +295,16 @@ makeconfig: .makefiles buildtools NetBSD) \ PLATFORM="netbsd" \ ;; \ + OpenBSD) \ + PLATFORM="openbsd" \ + ;; \ FreeBSD) \ - PLATFORM="freebsd" \ + MAJRELEASE=`echo $$OSRELEASE | sed 's/\..*//'` ; \ + if [ $$MAJRELEASE -lt 3 ]; then \ + PLATFORM="freebsd2" ; \ + else \ + PLATFORM="freebsd3" ; \ + fi; \ ;; \ NeXTSTEP) \ PLATFORM="nextstep" \ @@ -312,6 +336,15 @@ makeconfig: .makefiles buildtools echo "** Set platform to $$PLATFORM with compiler $$CC..."; \ echo "" +Make-common: Make-common.dist + @if [ -f Make-common ]; then \ + echo "Make-common.dist newer than Make-common, check for new options" ;\ + echo "or touch Make-common to ignore."; \ + exit 1; \ + fi; \ + echo "Copy Make-common.dist or Make-common.gmake to Make-common"; \ + echo " Edit as needed before making!" ; \ + exit 1 # # rule to build Makefiles by concatenating Make-template file in each # subdirectory with global Make-common, .make-platform, and @@ -334,7 +367,6 @@ makeconfig: .makefiles buildtools echo " creating $$i/Makefile"; \ $(RM) $$i/Makefile; \ $(CAT) $$HDRFILE $$i/Make-template $$DEFSFILE > $$i/Makefile; \ - $(CHMOD) 444 $$i/Makefile; \ fi; \ done; \ $(RM) .makefiles; \ @@ -347,6 +379,7 @@ makeconfig: .makefiles buildtools makefiles: FORCE $(RM) .makefiles $(MAKE) $(MFLAGS) .makefiles + @echo "Please \"make depend\" before building." # # rule to create any tools we need to build everything else diff --git a/build/platforms/freebsd2-gcc/Make-platform b/build/platforms/freebsd2-gcc/Make-platform new file mode 100644 index 0000000000..037ab3fec0 --- /dev/null +++ b/build/platforms/freebsd2-gcc/Make-platform @@ -0,0 +1,61 @@ +# +# LDAP FreeBSD GNU C Make-platform file +# + + +# +# add any platform-specific overrides below here +# +EXTRACFLAGS=-O -g +LDBMBACKEND=-DLDBM_USE_DBBTREE +LDBMINCLUDE=-I/usr/include + +EDITOR=/usr/bin/vi +FINGER=/usr/bin/finger +SENDMAIL=/usr/sbin/sendmail + +LDAP_RUNDIR=/var/run + +MANCOMPRESS=gzip +MANCOMPRESSSUFFIX=.gz + +# On most (if not all) 2.X versions of FreeBSD, Pthread(3) is not +# installed by default. As such, -DNO_THREADS is used by default +# on FreeBSD 2.X. +# +# FreeBSD 2.2.5 comes with a Chris Provenzano Pthreads +# package, # but it must be manually built. See pthread(3) for details. +# OpenLDAP is compatible with this version, uncomment the following +# options: +# +#THREADS= -DPOSIX_THREADS -D_THREAD_SAFE \ +# -DPTHREAD_PREEMPTIVE -DSCHED_YIELD_MISSING +#THREADSLIB= -lc_r +# +# Some versions of FreeBSD support the gcc option "-pthread" to +# link with -lc_r. On those systems, uncomment the following: +#THREADSLIB= -pthread +# +# +# If the only thread package available is only Draft 4 compliant, +# you can try the following: +#THREADS= -DTHREAD_MIT_PTHREADS -D_THREAD_SAFE -DPTHREAD_PREEMPTIVE +# +# Note: +# LDAP has a problem with the idea of implicit vs. explicit yields +# in call conversion threading packages, like the MIT pthreads +# package. Rather than resolve this globally, I (Terry Lambert) have +# marked the threading as "preeemptive", even though it is +# technically not. +# This means that the implicit-yield threading is topologically +# equivalent to preemptive threading. + +# crypt(3) is in a separate library +LDAP_CRYPT_LIB= -lcrypt + +# +# ------------------------------------------------------------------------- +# you will probably not need to edit anything below this point +# ------------------------------------------------------------------------- +CC = gcc +PLATFORMCFLAGS= -Dfreebsd diff --git a/build/platforms/freebsd3-gcc/Make-platform b/build/platforms/freebsd3-gcc/Make-platform new file mode 100644 index 0000000000..23d0b69e6b --- /dev/null +++ b/build/platforms/freebsd3-gcc/Make-platform @@ -0,0 +1,49 @@ +# +# LDAP FreeBSD GNU C Make-platform file +# + +# +# add any platform-specific overrides below here +# + +LDBMBACKEND=-DLDBM_USE_DBBTREE +LDBMINCLUDE=-I/usr/include + +EDITOR=/usr/bin/vi +FINGER=/usr/bin/finger +SENDMAIL=/usr/sbin/sendmail + +LDAP_RUNDIR=/var/run + +MANCOMPRESS=gzip +MANCOMPRESSSUFFIX=.gz + +# +# LDAP has a problem with the idea of implicit vs. explicit yields +# in call conversion threading packages, like the MIT pthreads +# package. Rather than resolve this globally, I have marked the +# threading as "preeemptive", even though it is technically not. +# +# This means that the implicit-yield threading is topologically +# equivalent to preemptive threading. +# +THREADS= -DPOSIX_THREADS -D_THREAD_SAFE -DPTHREAD_PREEMPTIVE + +# use special gcc flag to include libc_r.a +THREADSLIB= -pthread +#THREADSLIB= -lc_r + +# if you built/installed with -DNOLIBC_R, you'll need uncomment +# out the following +#THREADS= -DNO_THREADS -DPTHREAD_PREEMPTIVE +#THREADSLIB= + +# crypt(3) is in a separate library +LDAP_CRYPT_LIB= -lcrypt + +# +# ------------------------------------------------------------------------- +# you will probably not need to edit anything below this point +# ------------------------------------------------------------------------- +CC = gcc +PLATFORMCFLAGS= -Dfreebsd diff --git a/build/platforms/linux-gcc/Make-platform b/build/platforms/linux-gcc/Make-platform index 45f3823921..17798f5486 100644 --- a/build/platforms/linux-gcc/Make-platform +++ b/build/platforms/linux-gcc/Make-platform @@ -6,12 +6,22 @@ # add any platform-specific overrides below here # - -# -# ------------------------------------------------------------------------- -# you will probably not need to edit anything below this point -# ------------------------------------------------------------------------- +EXTRACFLAGS=-O -g CC = gcc RANLIB = "ranlib" +LDBMBACKEND=-DLDBM_USE_GDBM +LDBMLIB=-lgdbm + PLATFORMCFLAGS= -Dlinux + +# not all versions of Linux support POSIX Threads +#THREADS=-DPOSIX_THREADS -DREENTRANT +#THREADSLIB=-lpthread + +# crypt(3) is in -lcrypt on some versions of Linux +#LDAP_CRYPT_LIB= -lcrypt + +LDAP_SENDMAIL=/usr/sbin/sendmail +LDAP_EDITOR=/bin/vi +LDAP_FINGER=/usr/bin/finger diff --git a/include/lthread.h b/include/lthread.h index d1b34d8ecf..d3fd3d0ec6 100644 --- a/include/lthread.h +++ b/include/lthread.h @@ -3,7 +3,40 @@ #ifndef _LTHREAD_H #define _LTHREAD_H -#if defined( THREAD_SUNOS4_LWP ) +#if defined ( THREAD_NEXT_CTHREADS ) + +#define _THREAD + +#include + +typedef cthread_fn_t VFP; +typedef int pthread_attr_t; +typedef cthread_t pthread_t; + +/* default attr states */ +#define pthread_mutexattr_default NULL +#define pthread_condattr_default NULL + +/* thread state - joinable or not */ +#define PTHREAD_CREATE_JOINABLE 0 +#define PTHREAD_CREATE_DETACHED 1 +/* thread scope - who is in scheduling pool */ +#define PTHREAD_SCOPE_PROCESS 0 +#define PTHREAD_SCOPE_SYSTEM 1 + +/* mutex attributes and mutex type */ +typedef int pthread_mutexattr_t; +typedef struct mutex pthread_mutex_t; + +/* mutex and condition variable scope - process or system */ +#define PTHREAD_SHARE_PRIVATE 0 +#define PTHREAD_SHARE_PROCESS 1 + +/* condition variable attributes and condition variable type */ +typedef int pthread_condattr_t; +typedef struct condition pthread_cond_t; + +#elif defined( THREAD_SUNOS4_LWP ) /*********************************** * * * thread definitions for sunos4 * @@ -66,9 +99,11 @@ typedef void *(*VFP)(); /* sunos5 threads are preemptive */ #define PTHREAD_PREEMPTIVE 1 +#if !defined(__SunOS_5_6) /* thread attributes and thread type */ typedef int pthread_attr_t; typedef thread_t pthread_t; +#endif /* ! sunos56 */ /* default attr states */ #define pthread_mutexattr_default NULL @@ -81,17 +116,21 @@ typedef thread_t pthread_t; #define PTHREAD_SCOPE_PROCESS 0 #define PTHREAD_SCOPE_SYSTEM THR_BOUND +#if !defined(__SunOS_5_6) /* mutex attributes and mutex type */ typedef int pthread_mutexattr_t; typedef mutex_t pthread_mutex_t; +#endif /* ! sunos56 */ /* mutex and condition variable scope - process or system */ #define PTHREAD_SHARE_PRIVATE USYNC_THREAD #define PTHREAD_SHARE_PROCESS USYNC_PROCESS +#if !defined(__SunOS_5_6) /* condition variable attributes and condition variable type */ typedef int pthread_condattr_t; typedef cond_t pthread_cond_t; +#endif /* ! sunos56 */ #else /* end sunos5 */ @@ -127,6 +166,18 @@ typedef cond_t pthread_cond_t; #define pthread_attr_setdetachstate( a, b ) \ pthread_attr_setdetach_np( a, b ) +#else /* end dce pthreads */ + +#if defined( POSIX_THREADS ) + +#define _THREAD + +#include + +#define pthread_mutexattr_default NULL +#define pthread_condattr_default NULL + +#endif /* posix threads */ #endif /* dce pthreads */ #endif /* mit pthreads */ #endif /* sunos5 */ diff --git a/libraries/liblthread/thread.c b/libraries/liblthread/thread.c index 89a85c70b4..12574d0606 100644 --- a/libraries/liblthread/thread.c +++ b/libraries/liblthread/thread.c @@ -2,7 +2,157 @@ #include #include "lthread.h" -#if defined( THREAD_SUNOS4_LWP ) +#if defined( THREAD_NEXT_CTHREADS ) + +/*********************************************************************** + * * + * under NEXTSTEP or OPENSTEP use CThreads * + * lukeh@xedoc.com.au * + * * + ***********************************************************************/ + +int +pthread_attr_init( pthread_attr_t *attr ) +{ + *attr = 0; + return( 0 ); +} + +int +pthread_attr_destroy( pthread_attr_t *attr ) +{ + return( 0 ); +} + +int +pthread_attr_getdetachstate( pthread_attr_t *attr, int *detachstate ) +{ + *detachstate = *attr; + return( 0 ); +} + +int +pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate ) +{ + *attr = detachstate; + return( 0 ); +} + +/* ARGSUSED */ +int +pthread_create( + pthread_t *tid, + pthread_attr_t *attr, + VFP func, + void *arg +) +{ + *tid = cthread_fork(func, arg); + return ( *tid == NULL ? -1 : 0 ); +} + +void +pthread_yield() +{ + cthread_yield(); +} + +void +pthread_exit( any_t a ) +{ + cthread_exit( a ); +} + +void +pthread_join( pthread_t tid, int *pStatus ) +{ + int status; + status = (int) cthread_join ( tid ); + if (pStatus != NULL) + { + *pStatus = status; + } +} + +/* ARGSUSED */ +void +pthread_kill( pthread_t tid, int sig ) +{ + return; +} + +/* ARGSUSED */ +int +pthread_mutex_init( pthread_mutex_t *mp, pthread_mutexattr_t *attr ) +{ + mutex_init( mp ); + mp->name = NULL; + return ( 0 ); +} + +int +pthread_mutex_destroy( pthread_mutex_t *mp ) +{ + mutex_clear( mp ); + return ( 0 ); +} + +int +pthread_mutex_lock( pthread_mutex_t *mp ) +{ + mutex_lock( mp ); + return ( 0 ); +} + +int +pthread_mutex_unlock( pthread_mutex_t *mp ) +{ + mutex_unlock( mp ); + return ( 0 ); +} + +int +pthread_mutex_trylock( pthread_mutex_t *mp ) +{ + return mutex_try_lock( mp ); +} + +int +pthread_cond_init( pthread_cond_t *cv, pthread_condattr_t *attr ) +{ + condition_init( cv ); + return( 0 ); +} + +int +pthread_cond_destroy( pthread_cond_t *cv ) +{ + condition_clear( cv ); + return( 0 ); +} + +int +pthread_cond_wait( pthread_cond_t *cv, pthread_mutex_t *mp ) +{ + condition_wait( cv, mp ); + return( 0 ); +} + +int +pthread_cond_signal( pthread_cond_t *cv ) +{ + condition_signal( cv ); + return( 0 ); +} + +int +pthread_cond_broadcast( pthread_cond_t *cv ) +{ + condition_broadcast( cv ); + return( 0 ); +} + +#elif defined( THREAD_SUNOS4_LWP ) /*********************************************************************** * * @@ -44,7 +194,7 @@ pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate ) int pthread_create( pthread_t *tid, - pthread_attr_t attr, + pthread_attr_t *attr, VFP func, void *arg ) @@ -178,6 +328,7 @@ pthread_cond_broadcast( pthread_cond_t *cv ) * * ***********************************************************************/ +#if !defined(__SunOS_5_6) int pthread_attr_init( pthread_attr_t *attr ) { @@ -210,13 +361,14 @@ pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate ) int pthread_create( pthread_t *tid, - pthread_attr_t attr, + pthread_attr_t *attr, VFP func, void *arg ) { - return( thr_create( NULL, 0, func, arg, attr, tid ) ); + return( thr_create( NULL, 0, func, arg, *attr, tid ) ); } +#endif /* ! sunos56 */ void pthread_yield() @@ -224,6 +376,7 @@ pthread_yield() thr_yield(); } +#if !defined(__SunOS_5_6) void pthread_exit() { @@ -302,6 +455,7 @@ pthread_cond_broadcast( pthread_cond_t *cv ) { return( cond_broadcast( cv ) ); } +#endif /* ! sunos56 */ #else /* end sunos5 threads */ @@ -333,6 +487,20 @@ pthread_kill( pthread_t tid, int sig ) kill( getpid(), sig ); } +#else + +#if defined ( POSIX_THREADS ) + +#ifndef SCHED_YIELD_MISSING +#include + +void pthread_yield( void ) +{ + sched_yield(); +} +#endif + +#endif /* posix threads */ #endif /* dce pthreads */ #endif /* mit pthreads */ #endif /* sunos5 lwp */ @@ -379,7 +547,7 @@ pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate ) int pthread_create( pthread_t *tid, - pthread_attr_t attr, + pthread_attr_t *attr, VFP func, void *arg )