]> git.sur5r.net Git - openldap/blobdiff - configure.in
Allow using real db1 on glibc 2.1 instead of the db1 compatiblity in db2.
[openldap] / configure.in
index 160aca2e92cad4e38d960d50ab990b507c9d6c4c..ad02027c7bba6771c139e7940ab2d09fd5e85e71 100644 (file)
@@ -7,15 +7,18 @@ dnl license is available at http://www.OpenLDAP.org/license.html or
 dnl in file LICENSE in the top-level directory of the distribution.
 dnl
 
+dnl Disable config.cache!
+define([AC_CACHE_LOAD], )dnl
+define([AC_CACHE_SAVE], )dnl
+
 dnl Configure.in for OpenLDAP
 AC_INIT(include/ldap.h)dnl
 AC_CONFIG_AUX_DIR(build)dnl
 AM_INIT_AUTOMAKE(openldap,[1.2], [no ac_define])dnl
 
-dnl Do not use AutoConf 2.12; it produces a configuration script
-dnl that causes an "internal 2K buffer" error on HPUX when run
-dnl with /bin/sh.  Autoconf 2.10 seems to be okay.
-AC_PREREQ(2.13)dnl Required Autoconf version
+dnl We use autoconf features new to 2.13.1
+dnl    aclocal.m4 should be built using aclocal from automake 1.4
+AC_PREREQ(2.13.1)dnl Required Autoconf version
 
 AC_CONFIG_HEADER(include/portable.h)dnl
 
@@ -78,7 +81,7 @@ OL_ARG_ENABLE(rlookups,[    --enable-rlookups enable reverse lookups], auto)dnl
 dnl SLAPD Backend options
 OL_ARG_ENABLE(ldbm,[    --enable-ldbm  enable ldbm backend], yes)dnl
 OL_ARG_WITH(ldbm_api,[      --with-ldbm-api    use LDBM API], auto,
-       [auto db2 db gdbm ndbm manual])
+       [auto db2 db mdbm gdbm ndbm manual])
 OL_ARG_WITH(ldbm_type,[      --with-ldbm-type  use LDBM type], auto,
        [auto btree hash])
 
@@ -176,6 +179,10 @@ else
                $ol_with_ldbm_type = btree ; then
                AC_MSG_ERROR([GDBM only supports LDBM type hash])
        fi
+       if test $ol_with_ldbm_api = mdbm -a \
+               $ol_with_ldbm_type = btree ; then
+               AC_MSG_ERROR([MDBM only supports LDBM type hash])
+       fi
        if test $ol_with_ldbm_api = ndbm -a \
                $ol_with_ldbm_type = btree ; then
                AC_MSG_ERROR([NDBM only supports LDBM type hash])
@@ -247,6 +254,11 @@ AC_AIX
 AC_ISC_POSIX
 AC_MINIX
 
+dnl BeOS requires -lbe -lroot -lnet
+AC_CHECK_LIB(be, be_app,
+       [LIBS="$LIBS -lbe -lroot -lnet"], :,
+       [-lroot -lnet])
+
 dnl OpenLDAP requires STDC features
 AM_PROG_CC_STDC
 if test "X${am_cv_prog_cc_stdc}" = "Xno" ; then
@@ -294,27 +306,28 @@ AC_CHECK_LIB(V3, sigset)
 # ISODE tests
 ol_link_isode=no
 if test $ol_enable_ldapd != no ; then
+       AC_MSG_WARN([ldapd support deprecated.  Manual intervention required.])
        dnl look for ISODE libraries
        AC_CHECK_LIB(xtpp, main, [
                ol_link_isode=yes
-               AC_DEFINE(HAVE_XTPP,1)
+               AC_DEFINE(HAVE_XTPP,1, [define if you have -lxttp])
                LDAPD_LIBS="$LDAPD_LIBS -lxtpp -lxtdsap -lxtisode -losi"
                ],:,[-lxtdsap -lxtisode -losi])
        AC_CHECK_LIB(dsap, main, [
                ol_link_isode=yes
-               AC_DEFINE(HAVE_DSAP,1)
+               AC_DEFINE(HAVE_DSAP,1, [define if you have -ldsap])
                LDAPD_LIBS="$LDAPD_LIBS -ldsap"
                ],:,[-lisode])
        AC_CHECK_LIB(isode, main, [
                ol_link_isode=yes
-               AC_DEFINE(HAVE_ISODE,1)
+               AC_DEFINE(HAVE_ISODE,1, [define if you have -lisode])
                LDAPD_LIBS="$LDAPD_LIBS -lisode"
                ],:)
 fi
 
 if test $ol_link_isode != no; then
        AC_CHECK_LIB(pp, main, [
-               AC_DEFINE(HAVE_PP,1)
+               AC_DEFINE(HAVE_PP,1, [define if you have -lpp])
                LDAPD_LIBS="-lpp $LDAPD_LIBS"
                ],:)
 
@@ -337,8 +350,32 @@ 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_LIBS="-lkrb4 -lkrb5 -ldes425"
+
+                       LIBS="$KRB_LIBS $LIBS"
+
+                       AC_CACHE_CHECK([for des_debug in Kerberos libraries],
+                               [ol_cv_var_des_debug], [
+                               dnl save the flags
+                               save_LIBS="$LIBS"
+                               LIBS="$KRB_LIBS $LIBS"
+                               AC_TRY_LINK([
+#include <kerberosIV/krb.h>
+#include <kerberosIV/des.h>
+extern int des_debug;
+],[
+des_debug = 1;
+],                             ol_cv_var_des_debug=yes, ol_cv_var_des_debug=no)
+                               dnl restore the LIBS
+                               LIBS="$save_LIBS"
+                       ])
+
+                       if test $ol_cv_var_des_debug = yes ; then
+                               AC_DEFINE(HAVE_DES_DEBUG,1,
+                                       [define if you have Kerberos des_debug])
+                       fi
+
+                       LIBS="$save_LIBS"
                fi
        fi
 fi
@@ -353,18 +390,14 @@ 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_LIBS="-lkrb -ldes"
                fi
        fi
 fi
 
-dnl    if test $ol_link_kerberos = yes ; then
-dnl            save_LIBS=$LIBS
-dnl            LIBS="$KRB_LIBS $LIBS"
-dnl            AC_CHECK_FUNCS(des_string_to_key)
-dnl            LIBS=$save_LIBS
-dnl fi
+if test $ol_link_kerberos = yes ; then
+       AC_DEFINE(HAVE_KERBEROS, 1, [define if you have Kerberos])
+fi
 
 ol_link_threads=no
 if test $ol_with_threads = auto -o $ol_with_threads = yes \
@@ -376,9 +409,11 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                OL_POSIX_THREAD_VERSION
 
                if test $ol_cv_pthread_version = final ; then
-                       AC_DEFINE(HAVE_PTHREADS_FINAL)
+                       AC_DEFINE(HAVE_PTHREADS_FINAL,1,
+                               [define if pthreads API compatible with final spec])
                elif test $ol_cv_pthread_version = draft4 ; then
-                       AC_DEFINE(HAVE_PTHREADS_D4)
+                       AC_DEFINE(HAVE_PTHREADS_D4,1,
+                               [define if pthreads API compatible with draft4 spec])
                else
                        AC_MSG_ERROR([unknown pthread version])
                fi
@@ -389,7 +424,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                OL_LINUX_THREADS
 
                if test $ol_cv_linux_threads = yes ; then
-                       AC_DEFINE(HAVE_LINUX_THREADS,1)
+                       AC_DEFINE(HAVE_LINUX_THREADS,1,
+                               [define if you have LinuxThreads])
                fi
 
                dnl Now the hard part, how to link?
@@ -401,9 +437,10 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                dnl
                dnl Check special pthread (final) flags
                dnl     pthread_create() with -kthread (FreeBSD)
-               dnl     pthread_create() with -pthread (FreeBSD)
-               dnl     pthread_create() with -pthreads (OSF/1)
+               dnl     pthread_create() with -pthread (FreeBSD/Digital Unix)
+               dnl     pthread_create() with -pthreads (?)
                dnl     pthread_create() with -thread (?)
+               dnl     pthread_create() with -mt (Solaris)
                dnl
                dnl Check pthread (final) libraries
                dnl     pthread_mutex_unlock() in -lpthread -lmach -lexc -lc_r (OSF/1)
@@ -434,9 +471,9 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                                dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-kthread $LIBS"
-                               AC_TRY_LINK([char pthread();],[
-                                       pthread_create();
-                                       ], ol_cv_kthread_flag=yes, ol_cv_kthread_flag=no)
+                               AC_TRY_LINK([#include <pthread.h>],
+                                       [pthread_create(NULL,NULL,NULL,NULL);],
+                                       [ol_cv_kthread_flag=yes], [ol_cv_kthread_flag=no])
                                dnl restore the LIBS
                                LIBS="$save_LIBS"
                        ])
@@ -454,9 +491,9 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                                dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-pthread $LIBS"
-                               AC_TRY_LINK([char pthread();],[
-                                       pthread_create();
-                                       ], ol_cv_pthread_flag=yes, ol_cv_pthread_flag=no)
+                               AC_TRY_LINK([#include <pthread.h>],
+                                       [pthread_create(NULL,NULL,NULL,NULL);],
+                                       [ol_cv_pthread_flag=yes], [ol_cv_pthread_flag=no])
                                dnl restore the LIBS
                                LIBS="$save_LIBS"
                        ])
@@ -474,9 +511,9 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                                dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-pthreads $LIBS"
-                               AC_TRY_LINK([char pthread();],[
-                                       pthread_create();
-                                       ], ol_cv_pthreads_flag=yes, ol_cv_pthreads_flag=no)
+                               AC_TRY_LINK([#include <pthread.h>],
+                                       [pthread_create(NULL,NULL,NULL,NULL);],
+                                       [ol_cv_pthreads_flag=yes], [ol_cv_pthreads_flag=no])
                                dnl restore the LIBS
                                LIBS="$save_LIBS"
                        ])
@@ -494,9 +531,9 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                                dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-thread $LIBS"
-                               AC_TRY_LINK([char pthread();],[
-                                       pthread_create();
-                                       ], ol_cv_thread_flag=yes, ol_cv_thread_flag=no)
+                               AC_TRY_LINK([char pthread_create();],
+                                       [pthread_create();],
+                                       [ol_cv_thread_flag=yes], [ol_cv_thread_flag=no])
                                dnl restore the LIBS
                                LIBS="$save_LIBS"
                        ])
@@ -507,6 +544,26 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                        fi
                fi
 
+               if test $ol_link_threads = no ; then
+                       dnl try -mt
+                       AC_CACHE_CHECK([for pthread_create with -mt],
+                               [ol_cv_thread_flag], [
+                               dnl save the flags
+                               save_LIBS="$LIBS"
+                               LIBS="-mt $LIBS"
+                               AC_TRY_LINK([char pthread_create();],
+                                       [pthread_create();],
+                                       [ol_cv_thread_flag=yes], [ol_cv_thread_flag=no])
+                               dnl restore the LIBS
+                               LIBS="$save_LIBS"
+                       ])
+
+                       if test $ol_cv_thread_flag = yes ; then
+                               LTHREAD_LIBS="$LTHREAD_LIBS -mt"
+                               ol_link_threads=posix
+                       fi
+               fi
+
                if test $ol_link_threads = no ; then
                        dnl try DEC Threads -lpthread -lmach -lexc -lc_r
                        save_LIBS="$LIBS"
@@ -622,7 +679,7 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                                dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-threads $LIBS"
-                               AC_TRY_LINK([char pthread();],[
+                               AC_TRY_LINK([char pthread_create();],[
                                        pthread_create();
                                        ], ol_cv_thread_flag=yes, ol_cv_thread_flag=no)
                                dnl restore the LIBS
@@ -675,7 +732,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                fi
 
                if test $ol_link_threads != no ; then
-                       AC_DEFINE(HAVE_PTHREADS)
+                       AC_DEFINE(HAVE_PTHREADS,1,
+                               [define if you have POSIX Threads])
 
                        dnl save flags
                        save_CPPFLAGS="$CPPFLAGS"
@@ -709,12 +767,26 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                        fi
 
                        dnl Check functions for compatibility
-                       AC_CHECK_FUNCS(pthread_kill pthread_detach)
+                       AC_CHECK_FUNCS(pthread_kill)
 
-                       if test $ac_cv_func_pthread_detach = no ; then
+                       dnl Check for pthread_detach with <pthread.h> inclusion
+                       dnl as it's symbol may have been mangled.
+                       AC_CACHE_CHECK([for pthread_detach with <pthread.h>],
+                               [ol_cv_func_pthread_detach], [
+                               dnl save the flags
+                               AC_TRY_LINK([#include <pthread.h>],
+                                       [pthread_detach(NULL);],
+                                       [ol_cv_func_pthread_detach=yes],
+                                       [ol_cv_func_pthread_detach=no])
+                       ])
+
+                       if test $ol_cv_func_pthread_detach = no ; then
                                AC_MSG_ERROR([could not locate pthread_detach()])
                        fi
 
+                       AC_DEFINE(HAVE_PTHREAD_DETACH,1,
+                               [define if you have pthread_detach function])
+
                        dnl Check for setconcurreny functions
                        AC_CHECK_FUNCS( \
                                pthread_setconcurrency \
@@ -885,7 +957,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
 
                if test $ol_link_threads != no ; then
                        : check for cthread specific functionality here
-                       AC_DEFINE(HAVE_MACH_CTHREADS,1)
+                       AC_DEFINE(HAVE_MACH_CTHREADS,1,
+                               [define if you have Mach Cthreads])
                else
                        AC_MSG_ERROR([could not link with Mach CThreads])
                fi
@@ -905,7 +978,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                AC_CHECK_LIB(thread, thr_create, [have_thr=yes], [have_thr=no])
 
                if test $have_thr = yes ; then
-                       AC_DEFINE(HAVE_THR)
+                       AC_DEFINE(HAVE_THR,1,
+                               [if you have Solaris LWP (thr) package])
                        LTHREAD_LIBS="$LTHREAD_LIBS -lthread"
                        ol_link_threads=thr
 
@@ -927,7 +1001,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                AC_CHECK_LIB(lwp, lwp_create, [have_lwp=yes], [have_lwp=no])
 
                if test $have_lwp = yes ; then
-                       AC_DEFINE(HAVE_LWP)
+                       AC_DEFINE(HAVE_LWP,1,
+                               [if you have SunOS LWP package])
                        LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
                        ol_link_threads=lwp
 
@@ -939,7 +1014,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
 fi
 
 if test $ol_with_yielding_select = yes ; then
-       AC_DEFINE(HAVE_YIELDING_SELECT,1)
+       AC_DEFINE(HAVE_YIELDING_SELECT,1,
+               [define if select implicitly yields])
 fi
 
 if test $ol_with_threads = manual ; then
@@ -966,6 +1042,7 @@ if test $ol_link_threads != no ; then
        AC_DEFINE(_THREAD_SAFE,1)
        AC_DEFINE(THREADSAFE,1)
        AC_DEFINE(_THREADSAFE,1)
+        AC_DEFINE(_SGI_MP_SOURCE,1)
 
        dnl this might cause the errno symbol to be
        dnl replaced with a function to get a thread specific errno.
@@ -973,11 +1050,7 @@ if test $ol_link_threads != no ; then
        dnl with the thread libraries
        AC_CACHE_CHECK([for thread specific errno],
                [ol_cv_errno_thread_specific], [
-               AC_TRY_LINK([
-#include <errno.h>
-                       ], [
-int x = errno;
-                       ],
+               AC_TRY_LINK([#include <errno.h>], [int x = errno;],
                        [ol_cv_errno_thread_specific=yes],
                        [ol_cv_errno_thread_specific=no])
        ])
@@ -1000,7 +1073,8 @@ if test $ol_link_threads = no ; then
                ol_with_threads=no
        fi
 
-       AC_DEFINE(NO_THREADS,1)
+       AC_DEFINE(NO_THREADS,1,
+               [define if you have (or want) no threads])
        LTHREAD_LIBS=""
 fi
 
@@ -1074,6 +1148,18 @@ if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
        fi
 fi
 
+if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = mdbm ; then
+       OL_MDBM
+
+       if test $ol_cv_mdbm = yes ; then
+               ol_link_ldbm=mdbm
+               ol_with_ldbm_api=mdbm
+               if test $ol_cv_lib_mdbm != yes ; then
+                       LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_mdbm"
+               fi
+       fi
+fi
+
 if test $ol_with_ldbm_api = auto ; then
        AC_MSG_WARN([skipping automatic checking for NDBM, must be manually enabled.])
 elif test $ol_with_ldbm_api = ndbm ; then
@@ -1105,13 +1191,19 @@ if test $ol_enable_wrappers != no ; then
        if test $ac_cv_header_tcpd_h != yes ; then
                have_wrappers=no
        else
-               AC_CHECK_LIB(wrap, main,
-                       [have_wrappers=yes], [have_wrappers=no])
+               AC_TRY_COMPILE([
+int allow_severity = 0;
+int deny_severity  = 0;
+               ],[hosts_access()],[have_wrappers=yes],[have_wrappers=no])
        fi
 
        if test $have_wrappers = yes ; then
-               AC_DEFINE(HAVE_TCPD)
-               SLAPD_LIBS="$SLAPD_LIBS -lwrap"
+               AC_DEFINE(HAVE_TCPD,1, [define if you have -lwrap])
+               WRAP_LIBS="-lwrap"
+
+               dnl We add another check for -lnsl since some libwrap's
+               dnl need it, but it isn't always included from above
+               AC_CHECK_LIB(nsl, main)
        else
                AC_MSG_WARN(could not find -lwrap)
                if test $ol_enable_wrappers = yes ; then
@@ -1120,6 +1212,7 @@ if test $ol_enable_wrappers != no ; then
 
                AC_MSG_WARN(disabling wrappers support)
                ol_enable_wrappers=no
+               WRAP_LIBS=""
        fi
 fi
 
@@ -1135,7 +1228,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
-               AC_DEFINE(HAVE_TERMCAP)
+               AC_DEFINE(HAVE_TERMCAP, 1, [define if you have -ltermcap])
                ol_link_termcap=yes
                TERMCAP_LIBS=-ltermcap
        fi
@@ -1144,14 +1237,14 @@ 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
-               AC_DEFINE(HAVE_NCURSES)
+               AC_DEFINE(HAVE_NCURSES, 1, [define if you have -lncurses])
                ol_link_termcap=yes
                TERMCAP_LIBS=-lncurses
        fi
 fi
 
 if test $ol_link_termcap = no ; then
-       AC_DEFINE(NO_TERMCAP,1)
+       AC_DEFINE(NO_TERMCAP,1, [define if you have no termcap support])
        TERMCAP_LIBS=
 fi
 
@@ -1200,10 +1293,12 @@ AC_HEADER_DIRENT
 AC_HEADER_SYS_WAIT
 AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
 if test $am_cv_sys_posix_termios = yes ; then
-       AC_DEFINE(HAVE_POSIX_TERMIOS,1)
+       AC_DEFINE(HAVE_POSIX_TERMIOS,1,
+               [define if you have POSIX termios])
 fi
 
 AC_CHECK_HEADERS(      \
+       arpa/nameser.h  \
        crypt.h                 \
        errno.h                 \
        fcntl.h                 \
@@ -1213,9 +1308,11 @@ AC_CHECK_HEADERS(        \
        limits.h                \
        malloc.h                \
        memory.h                \
+       netinet/tcp.h   \
        regex.h                 \
        psap.h                  \
        pwd.h                   \
+       resolv.h                \
        sgtty.h                 \
        stdarg.h                \
        stddef.h                \
@@ -1227,6 +1324,7 @@ AC_CHECK_HEADERS( \
        sys/ioctl.h             \
        sys/param.h             \
        sys/resource.h  \
+       sys/select.h    \
        sys/socket.h    \
        sys/syslog.h    \
        sys/time.h              \
@@ -1253,7 +1351,7 @@ OL_C_UPPER_LOWER
 AC_C_CONST
 
 if test $cross_compiling = yes ; then
-       AC_DEFINE(CROSS_COMPILING, 1)
+       AC_DEFINE(CROSS_COMPILING, 1, [define if cross compiling])
 else
        AC_C_BIGENDIAN
        AC_CHECK_SIZEOF(short) 
@@ -1276,6 +1374,7 @@ fi
 
 AC_CHECK_FUNCS(                \
        bcopy                   \
+       closesocket             \
        flock                   \
        getdtablesize   \
        gethostname             \
@@ -1395,7 +1494,7 @@ AC_SUBST(SLURPD_LIBS)
 AC_SUBST(LDBM_LIBS)
 AC_SUBST(LTHREAD_LIBS)
 AC_SUBST(LUTIL_LIBS)
-
+AC_SUBST(WRAP_LIBS)
 AC_SUBST(KRB_LIBS)
 AC_SUBST(TERMCAP_LIBS)