Commit 84864e55 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Added acconfig.h defines. started to clean up -llber.

parent aee4d490
......@@ -20,7 +20,9 @@ these steps:
2. Type:
% ./configure --help
to list available configuration options.
to list available configuration options. A description of
these options is provided in the 'CONFIGURE OPTIONS' section
below.
The configure script will also use your environmental
variables for determining compiler/linker options.
......@@ -31,6 +33,9 @@ these steps:
CPPFLAGS CPP Flags (-I/path/include -Ddef)
LDFLAGS LDFLAGS (-L/path/lib -llib)
A list of defines and other options are noted in the
'DEFINES and FLAGS' comments below.
3. edit the file include/ldapconfig.h.edit to configure
the software for your site (the files are well-commented):
......@@ -101,4 +106,23 @@ Follow these steps for each different platform:
Note: make depend in VPATH environment is not yet supported.
CONFIGURE OPTIONS
Regrettably, this section has not been written (yet). See
"./configure --help" for current list of options.
DEFINES and FLAGS
The configure script will also use your environmental
variables for determining compiler/linker options. This can
be used to manual specify features and compilation options.
Supported Environmental Variables
CC C Compiler (cc, ecgs)
CFLAGS C Flags (-ansi)
CPPFLAGS CPP Flags (-I/path/include -Ddef)
LDFLAGS LDFLAGS (-L/path/lib -llib)
End of OpenLDAP INSTALL file.
......@@ -8,9 +8,48 @@
/* define this if sys_errlist is not defined in stdio.h or errno.h */
#undef DECL_SYS_ERRLIST
/* define this you have crypt */
/* define if you have berkeley db */
#undef HAVE_BERKELEY_DB2
/* define if you have berkeley db2 */
#undef HAVE_BERKELEY_DB2
/* define if you have Mach CThreads */
#undef HAVE_CTHREADS
/* define if you have crypt */
#undef HAVE_CRYPT
/* define if you have DCE */
#undef HAVE_DCE
/* define if you have GDBM */
#undef HAVE_GDBM
/* define if you have Kerberos */
#undef HAVE_KERBEROS
/* define if you have LinuxThreads */
#undef HAVE_LINUX_THREADS
/* define if you have Sun LWP (SunOS style) */
#undef HAVE_LWP
/* define if you have Sun LWP (Solaris style) */
#undef HAVE_LWP_THR
/* define if you have NDBM */
#undef HAVE_NDBM
/* define if you have a preemptive POSIX Threads implementation */
#undef HAVE_PREEMPTIVE_PTHREADS
/* define if you have POSIX Threads */
#undef HAVE_PTHREADS
/* define if your POSIX Threads implementatin is circa Draft 4 */
#undef HAVE_PTHREADS_D4
/* define this for connectionless LDAP support */
#undef LDAP_CONNECTIONLESS
......
......@@ -112,6 +112,9 @@ AC_DEFUN([OL_BERKELEY_DB2],
ol_cv_berkeley_db2=yes
fi
])
if test $ol_cv_berkeley_db2 = yes ; then
AC_DEFINE(HAVE_BERKELEY_DB2)
fi
])dnl
dnl
dnl ====================================================================
......@@ -175,6 +178,9 @@ AC_DEFUN([OL_BERKELEY_DB],
ol_cv_berkeley_db=yes
fi
])
if test $ol_cv_berkeley_db = yes ; then
AC_DEFINE(HAVE_BERKELEY_DB)
fi
])dnl
dnl
dnl ====================================================================
......@@ -217,6 +223,9 @@ AC_DEFUN([OL_GDBM],
ol_cv_gdbm=yes
fi
])
if test $ol_cv_gdbm = yes ; then
AC_DEFINE(HAVE_GDBM)
fi
])dnl
dnl
dnl ====================================================================
......@@ -270,6 +279,9 @@ AC_DEFUN([OL_NDBM],
ol_cv_ndbm=yes
fi
])
if test $ol_cv_ndbm = yes ; then
AC_DEFINE(HAVE_NDBM)
fi
])dnl
dnl
dnl ====================================================================
......
This diff is collapsed.
......@@ -35,6 +35,8 @@ OL_ARG_WITH(kerberos,[ --with-kerberos use Kerberos],
auto, [auto k5 k4 afs yes no])
OL_ARG_WITH(threads,[ --with-threads use threads],
auto, [auto posix mach lwp yes no manual] )
OL_ARG_WITH(preemptive,[ --with-preemptive thread implementation is preemptive],
auto, [auto yes no manual] )
dnl Server options
......@@ -241,6 +243,8 @@ if test $ol_with_kerberos = auto -o $ol_with_kerberos = k5 ; then
ol_with_kerberos=found
ol_link_kerberos=yes
AC_DEFINE(HAVE_KERBEROS)
KRB_DEFS="-DKERBEROS"
KRB_LIBS="-lkrb4 -lkrb5 -ldes425"
fi
......@@ -256,6 +260,8 @@ if test $ol_with_kerberos = auto -o $ol_with_kerberos = k4 ; then
ol_with_kerberos=found
ol_link_kerberos=yes
AC_DEFINE(HAVE_KERBEROS)
KRB_DEFS="-DKERBEROS"
KRB_LIBS="-lkrb -ldes"
fi
......@@ -273,6 +279,7 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
if test $ol_cv_pthread_version = final ; then
LTHREAD_DEFS="$LTHREAD_DEFS -DPOSIX_THREADS"
elif test $ol_cv_pthread_version = draft4 ; then
AC_DEFINE(HAVE_PTHREADS_D4)
LTHREAD_DEFS="$LTHREAD_DEFS -DTHREAD_MIT_PTHREADS"
else
AC_MSG_ERROR([unknown pthread version])
......@@ -284,8 +291,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
OL_LINUX_THREADS
if test $ol_cv_linux_threads = yes ; then
dnl AC_DEFINE(HAVE_LINUX_THREADS,1)
LTHREAD_DEFS="$LTHREAD_DEFS -DHAVE_LINUX_THREADS"
AC_DEFINE(HAVE_LINUX_THREADS,1)
LTHREAD_DEFS="$LTHREAD_DEFS -DLINUX_THREADS"
fi
dnl Now the hard part, how to link
......@@ -336,15 +343,24 @@ dnl AC_DEFINE(HAVE_LINUX_THREADS,1)
dnl try DEC Threads
save_LIBS="$LIBS"
AC_CHECK_LIB(pthread, pthread_create, [
AC_DEFINE(HAVE_DCE)
ol_link_threads=posix
LTHREAD_DEFS="$LTHREAD_DEFS -DDEC_THREADS"
LTHREAD_DEFS="$LTHREAD_DEFS -DTHREAD_DCE_THREADS"
LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc"],,
if test $with_preemptive = auto ; then
ol_with_preemptive=yes
fi
[-lmach -lexc -lc])
LIBS="$save_LIBS"
fi
if test $ol_link_threads != no ; then
AC_DEFINE(HAVE_PTHREADS)
dnl save DEFS/LIBS
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
CPPFLAGS="$LTHREAD_DEFS $CPPFLAGS"
LIBS="$LTHREAD_LIBS $LIBS"
dnl All POSIX Thread (final) implementations should have
......@@ -360,12 +376,68 @@ dnl AC_DEFINE(HAVE_LINUX_THREADS,1)
fi
dnl Check functions for compatibility
AC_CHECK_FUNCS(pthread_kill \
pthread_attr_init pthread_attr_create \
pthread_attr_destroy pthread_attr_delete \
pthread_attr_setdetachstate pthread_attr_setdetach_np \
)
AC_CHECK_FUNCS(pthread_kill)
dnl AC_CHECK_FUNCS(
dnl pthread_attr_create pthread_attr_init \
dnl pthread_attr_destroy pthread_attr_delete \
dnl pthread_attr_setdetachstate pthread_attr_setdetach_np \
dnl )
dnl Check PREEMPTIVE Implementation
if test $ol_with_preemptive = auto ; then
AC_MSG_CHECKING([for preemptive Pthread implementation])
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <pthread.h>
#ifndef NULL
#define NULL 0
#endif
int task(arg)
int *arg;
{
struct timeval tv;
tv.tv_sec=4;
tv.tv_usec=0;
select(0, NULL, NULL, NULL, &tv);
tv.tv_sec=6;
tv.tv_usec=0;
select(0, NULL, NULL, NULL, &tv);
exit(1); /* if we exit here, the select blocked the whole process */
}
main(argc, argv)
int argc; char **argv;
{
pthread_t t;
pthread_create(&t, NULL, (void *) task, NULL);
#if HAVE_SCHED_YIELD
sched_yield(); /* make sure task runs first */
#else
#if defined(HAVE_PTHREAD_YIELD)
pthread_yield(); /* make sure task runs first */
#endif
#endif
exit(0);
}
], [ol_pthread_preemptive=yes], [ol_pthread_preemptive=no], [
AC_MSG_ERROR([crossing compiling: use --with-preemptive=yes|no|manual])])
AC_MSG_RESULT($ol_pthread_preemptive)
if test $ol_pthread_preemptive = yes ; then
AC_DEFINE(HAVE_PREEMPTIVE_PTHREADS)
ol_with_preemptive=yes
fi
fi
dnl restore DEFS/LIBS
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
else
AC_MSG_ERROR([could not link with POSIX Threads])
......@@ -384,6 +456,7 @@ if test $ol_with_threads = auto -o $ol_with_threads = cthreads ; then
AC_CHECK_LIB(lwp, cthread_fork, [have_cthreads=yes], [have_cthreads=no])
if test $have_cthreads = yes ; then
AC_DEFINE(HAVE_CTHREADS)
LTHREAD_DEFS="$LTHREAD_DEFS -DTHREAD_NEXT_CTHREADS"
LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
fi
......@@ -392,28 +465,39 @@ fi
if test $ol_with_threads = auto -o $ol_with_threads = lwp ; then
dnl check for SunOS5 LWP
AC_CHECK_HEADERS(lwp/lwp.h)
AC_CHECK_HEADERS(thread.h synch.h)
if test $ac_cv_header_lwp_lwp_h = yes ; then
AC_CHECK_LIB(thread, thr_create, [have_lwp=yes], [have_lwp=no])
if test $have_lwp = yes ; then
AC_DEFINE(HAVE_LWP)
AC_DEFINE(HAVE_LWP_THR)
LTHREAD_DEFS="$LTHREAD_DEFS -DTHREAD_SUNOS5_LWP"
LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
fi
fi
dnl check for SunOS4 LWP
AC_CHECK_HEADERS(thread.h synch.h)
AC_CHECK_HEADERS(lwp/lwp.h)
if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
AC_CHECK_LIB(lwp, lwp_create, [have_lwp=yes], [have_lwp=no])
if test $have_lwp = yes ; then
AC_DEFINE(HAVE_LWP)
LTHREAD_DEFS="$LTHREAD_DEFS -DTHREAD_SUNOS4_LWP"
LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
if test $with_preemptive = auto ; then
with_preemptive=yes
fi
fi
fi
fi
if test $ol_with_preemptive = yes ; then
LTHREAD_DEFS="$LTHREAD_DEFS -DTHREAD_PREEMPTIVE"
fi
if test $ol_with_threads = manual ; then
dnl User thinks he can manually configure threads.
$ol_link_threads=yes
......@@ -423,6 +507,10 @@ if test $ol_with_threads = manual ; then
AC_CHECK_HEADERS(pthread.h sched.h)
AC_CHECK_FUNCS(sched_yield pthread_yield)
OL_LINUX_THREADS
AC_CHECK_HEADERS(mach/cthreads.h)
AC_CHECK_HEADERS(lwp/lwp.h)
AC_CHECK_HEADERS(thread.h synch.h)
fi
if test $ol_link_threads = no ; then
......@@ -551,7 +639,6 @@ if test $ol_enable_wrappers = yes ; then
[have_wrappers=yes], [have_wrappers=no])
if test $have_wrappers = yes ; then
dnl LIBTCPD="-lwrap"
dnl AC_DEFINE(HAVE_TCPD)
SLAPD_DEFS="$SLAPD_DEFS -DTCP_WRAPPERS"
SLAPD_LIBS="$SLAPD_LIBS -lwrap"
......@@ -575,6 +662,7 @@ AC_CHECK_HEADERS(termcap.h ncurses.h)
if test $ol_link_termcap = no ; then
AC_CHECK_LIB(termcap, tputs, [have_termcap=yes], [have_termcap=no])
if test $have_termcap = yes ; then
dnl AC_DEFINE(HAVE_TERMCAP)
ol_link_termcap=yes
TERMCAP_LIBS=-ltermcap
fi
......@@ -583,6 +671,7 @@ fi
if test $ol_link_termcap = no ; then
AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
if test $have_ncurses = yes ; then
dnl AC_DEFINE(HAVE_NCURSES)
ol_link_termcap=yes
TERMCAP_LIBS=-lncurses
fi
......@@ -600,7 +689,7 @@ if test $ol_enable_crypt != no ; then
have_crypt=yes], [have_crypt=no])])
if test $have_crypt = yes ; then
dnl AC_DEFINE(SLAPD_CRYPT,1)
dnl AC_DEFINE(HAVE_CRYPT)
LUTIL_DEFS="$LUTIL_DEFS -DLDAP_CRYPT"
else
AC_MSG_WARN(could not find crypt)
......@@ -695,8 +784,8 @@ fi
dnl if test $ol_enable_syslog != no ; then
dnl LDAP_DEFS="$LDAP_DEFS -DLDAP_SYSLOG"
dnl fi
if test $ol_enable_libui = no ; then
LDAP_DEFS="$LDAP_DEFS -DNO_USERINTERFACE"
if test $ol_enable_libui = yes ; then
LDAP_DEFS="$LDAP_DEFS -DLDAP_LIBUI"
fi
if test $ol_enable_cache = no ; then
LDAP_DEFS="$LDAP_DEFS -DNO_CACHE"
......
......@@ -23,6 +23,11 @@
* edit this file.
*/
#ifndef LDAP_LIBUI
#ifndef NO_USERINTERFACE
#define NO_USERINTERFACE
#endif
#endif
#ifndef SYSV
#if defined( hpux ) || defined( sunos5 ) || defined ( sgi ) || defined( SVR4 )
......
......@@ -4,5 +4,6 @@
#endif
#include "bridge.h"
#include "ldap_cdefs.h"
#endif /* _LDAP_PORTABLE_H */
......@@ -73,6 +73,45 @@
/* define this if sys_errlist is not defined in stdio.h or errno.h */
#undef DECL_SYS_ERRLIST
/* define if you have berkeley db */
#undef HAVE_BERKELEY_DB2
/* define if you have berkeley db2 */
#undef HAVE_BERKELEY_DB2
/* define if you have Mach CThreads */
#undef HAVE_CTHREADS
/* define if you have DCE */
#undef HAVE_DCE
/* define if you have GDBM */
#undef HAVE_GDBM
/* define if you have Kerberos */
#undef HAVE_KERBEROS
/* define if you have LinuxThreads */
#undef HAVE_LINUX_THREADS
/* define if you have Sun LWP (SunOS style) */
#undef HAVE_LWP
/* define if you have Sun LWP (Solaris style) */
#undef HAVE_LWP_THR
/* define if you have NDBM */
#undef HAVE_NDBM
/* define if you have a preemptive POSIX Threads implementation */
#undef HAVE_PREEMPTIVE_PTHREADS
/* define if you have POSIX Threads */
#undef HAVE_PTHREADS
/* define if your POSIX Threads implementatin is circa Draft 4 */
#undef HAVE_PTHREADS_D4
/* define this for ACL Group support */
#undef SLAPD_ACLGROUPS
......@@ -103,24 +142,6 @@
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
/* Define if you have the pthread_attr_create function. */
#undef HAVE_PTHREAD_ATTR_CREATE
/* Define if you have the pthread_attr_delete function. */
#undef HAVE_PTHREAD_ATTR_DELETE
/* Define if you have the pthread_attr_destroy function. */
#undef HAVE_PTHREAD_ATTR_DESTROY
/* Define if you have the pthread_attr_init function. */
#undef HAVE_PTHREAD_ATTR_INIT
/* Define if you have the pthread_attr_setdetach_np function. */
#undef HAVE_PTHREAD_ATTR_SETDETACH_NP
/* Define if you have the pthread_attr_setdetachstate function. */
#undef HAVE_PTHREAD_ATTR_SETDETACHSTATE
/* Define if you have the pthread_kill function. */
#undef HAVE_PTHREAD_KILL
......
#define LDAP_BRIDGE /* disable LDAP_BRIDGE code */
#include "portable.h"
#if defined( LDAP_DEBUG ) && defined( LDAP_LIBUI )
#include <stdio.h>
#include <string.h>
#include <ac/string.h>
#include <ctype.h>
#endif /* LDAP_DEBUG && LDAP_LIBUI */
#include "lber.h"
/*
* Print arbitrary stuff, for debugging.
*/
#ifdef LDAP_DEBUG
#ifndef NO_USERINTERFACE
#define BPLEN 48
void
lber_bprint( char *data, int len )
{
#if defined( LDAP_DEBUG ) && defined( LDAP_LIBUI )
#define BPLEN 48
static char hexdig[] = "0123456789abcdef";
char out[ BPLEN ];
int i = 0;
......@@ -49,12 +55,7 @@ lber_bprint( char *data, int len )
}
out[ i++ ] = ' ';
}
#endif /* LDAP_DEBUG && LDAP_LIBUI */
}
#else /* NO_USERINTERFACE */
void
lber_bprint( char *data, int len )
{
}
#endif /* NO_USERINTERFACE */
#endif
......@@ -11,17 +11,22 @@
* is provided ``as is'' without express or implied warranty.
*/
#define LDAP_BRIDGE /* disable LDAP_BRIDGE code */
#include "portable.h"
#include <stdio.h>
#ifdef MACOS
#include <stdlib.h>
#include <stdarg.h>
#include "macos.h"
#else /* MACOS */
#if defined(NeXT) || defined(VMS)
#if defined(NeXT) || defined(VMS) || defined(__FreeBSD__)
#include <stdlib.h>
#else /* next || vms */
#else /* next || vms || freebsd */
#include <malloc.h>
#endif /* next || vms */
#endif /* next || vms || freebsd */
#if defined(BC31) || defined(_WIN32)
#include <stdarg.h>
#else /* BC31 || _WIN32 */
......@@ -40,16 +45,14 @@
#endif /* DOS */
#include <string.h>
#include "lber.h"
#ifdef LDAP_DEBUG
int lber_debug;
#endif
#ifdef NEEDPROTOS
static int ber_getnint( BerElement *ber, long *num, int len );
#endif /* NEEDPROTOS */
static int ber_getnint LDAP_P(( BerElement *ber, long *num, int len ));
/* return the tag - LBER_DEFAULT returned means trouble */
unsigned long
......@@ -155,6 +158,7 @@ ber_getnint( BerElement *ber, long *num, int len )
{
int diff, sign, i;
long netnum;
char *p;
/*
* The tag and length have already been stripped off. We should
......@@ -172,11 +176,12 @@ ber_getnint( BerElement *ber, long *num, int len )
if ( ber_read( ber, ((char *) &netnum) + diff, len ) != len )
return( -1 );
/* sign extend if necessary */
sign = ((0x80 << ((len - 1) * 8)) & netnum);
if ( sign && len < sizeof(long) ) {
for ( i = sizeof(long) - 1; i > len - 1; i-- ) {
netnum |= (0xffL << (i * 8));
/* sign extend if necessary */
p = (char *) &netnum;
sign = (0x80 & *(p+diff) );
if ( sign && len < sizeof(long) ) {
for ( i = 0; i < diff; i++ ) {
*(p+i) = 0xff;
}
}
*num = LBER_NTOHL( netnum );
......
......@@ -11,8 +11,11 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <ac/string.h>
#ifdef MACOS
#include <stdlib.h>
#include <console.h>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment