]> git.sur5r.net Git - openldap/blobdiff - configure.in
Defined LDAPMODRDN in preparation to add tests for LDAP v2 modrdn.
[openldap] / configure.in
index 95f79d2982ce6f1a9bda0b3a43e2e98aca7092b8..87fd04add3fe3740cd2b7f66e3a52953dd37067f 100644 (file)
@@ -49,14 +49,17 @@ OL_ARG_ENABLE(cldap,[  --enable-cldap       enable connectionless ldap], no)dnl
 OL_ARG_ENABLE(x_compile,[  --enable-x-compile  enable cross compiling],
        no, [yes no])dnl
 
-
 dnl General "with" options
 OL_ARG_ENABLE(dmalloc,[  --enable-dmalloc      enable debug malloc support], no)dnl
 
-OL_ARG_WITH(kerberos,[  --with-kerberos        use Kerberos],
+OL_ARG_WITH(kerberos,[  --with-kerberos        with Kerberos support],
        auto, [auto k5 k4 afs yes no])
+OL_ARG_WITH(readline,[  --with-readline  with readline support],
+       auto, [auto yes no] )
 OL_ARG_WITH(threads,[  --with-threads  use threads],
        auto, [auto posix mach lwp yes no manual] )
+OL_ARG_WITH(tls,[  --with-tls  with TLS/SSL support],
+       auto, [auto ssleay openssl yes no] )
 OL_ARG_WITH(yielding_select,[  --with-yielding-select  with implicitly yielding select],
        auto, [auto yes no manual] )
 
@@ -260,12 +263,20 @@ SLAPD_PERL_LDFLAGS=
 SLAPD_PERL_CPPFLAGS=
 
 KRB_LIBS=
+READLINE_LIBS=
 TERMCAP_LIBS=
+TLS_LIBS=
 
 dnl ----------------------------------------------------------------
 dnl Checks for programs
 
 AC_PROG_INSTALL
+
+dnl The default compiler is cc (NOT gcc)
+CC=${CC-"cc"}
+dnl The default CFLAGS is empty NOT whatever AC_PROG_CC sets.
+CFLAGS=${CFLAGS-""}
+
 AM_PROG_LIBTOOL
 dnl AC_PROG_MAKE_SET
 
@@ -452,6 +463,91 @@ if test $ol_link_kerberos = yes ; then
        AC_DEFINE(HAVE_KERBEROS, 1, [define if you have Kerberos])
 fi
 
+dnl
+dnl Check for SSL/TLS
+dnl
+ol_link_tls=no
+if test $ol_with_tls != no ; then
+       
+       AC_CHECK_HEADERS(ssl.h)
+       
+       if test $ac_cv_header_ssl_h = yes ; then
+               AC_CHECK_LIB(ssl, SSLeay_add_ssl_algorithms, 
+                       [have_ssleay=yes
+                       need_rsaref=no],
+                       [have_ssleay=no],
+                       [-lcrypto])
+                       
+               if test $have_ssleay = no ; then
+                       AC_CHECK_LIB(ssl, ssl3_accept, 
+                               [have_ssleay=yes
+                               need_rsaref=yes], [have_ssleay=no],
+                               [-lcrypto -lRSAglue -lrsaref])
+               fi
+
+               if test $have_ssleay = yes ; then
+                       ol_with_tls=found
+                       ol_link_tls=yes
+
+                       AC_DEFINE(HAVE_SSLEAY, 1, 
+                               [define if you have SSLeay or OpenSSL])
+
+                       if test $need_rsaref = yes; then
+                               AC_DEFINE(HAVE_RSAREF, 1, 
+                                       [define if you have RSAref])
+
+                               TLS_LIBS="-lssl -lcrypto -lRSAglue -lrsaref"
+                       else
+                               TLS_LIBS="-lssl -lcrypto"
+                       fi
+               fi
+       fi
+fi
+
+if test $ol_link_tls = yes ; then
+       AC_DEFINE(HAVE_TLS, 1, [define if you have TLS])
+fi     
+
+dnl Tests for reentrant functions necessary to build a
+dnl thread_safe -lldap.
+AC_CHECK_FUNCS(                \
+       ctime_r                 \
+       gethostbyname_r gethostbyaddr_r \
+)
+
+if test "$ac_cv_func_ctime_r" = no ; then
+       ol_cv_func_ctime_r_nargs=0
+else
+       OL_FUNC_CTIME_R_NARGS
+dnl    OL_FUNC_CTIME_R_TYPE
+fi
+
+if test "$ac_cv_func_gethostbyname_r" = yes ; then
+       OL_FUNC_GETHOSTBYNAME_R_NARGS
+else
+       ol_cv_func_gethostbyname_r_nargs=0
+fi
+if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
+       OL_FUNC_GETHOSTBYADDR_R_NARGS
+else
+       ol_cv_func_gethostbyaddr_r_nargs=0
+fi
+
+if test "$ac_cv_func_ctime_r" = yes \
+       -a "$ol_cv_func_ctime_r_nargs" -ge 2 \
+       -a "$ol_cv_func_ctime_r_nargs" -le 3 \
+       -a "$ac_cv_func_gethostbyname_r" = yes \
+       -a "$ol_cv_func_gethostbyname_r_nargs" -ge 5 \
+       -a "$ol_cv_func_gethostbyname_r_nargs" -le 6 \
+       -a "$ac_cv_func_gethostbyaddr_r" = yes \
+       -a "$ol_cv_func_gethostbyaddr_r_nargs" -ge 5 \
+       -a "$ol_cv_func_gethostbyaddr_r_nargs" -le 6 \
+       ; then
+       AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT,1)
+fi
+
 ol_link_threads=no
 if test $ol_with_threads = auto -o $ol_with_threads = yes \
        -o $ol_with_threads = posix ; then
@@ -523,8 +619,13 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                                dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-kthread $LIBS"
-                               AC_TRY_LINK([#include <pthread.h>],
-                                       [pthread_create(NULL,NULL,NULL,NULL);],
+                               AC_TRY_LINK([#include <pthread.h>],[
+#if HAVE_PTHREADS_D4
+       pthread_create(NULL,pthread_attr_default,NULL,NULL);
+#else
+       pthread_create(NULL,NULL,NULL,NULL);
+#endif
+],
                                        [ol_cv_kthread_flag=yes], [ol_cv_kthread_flag=no])
                                dnl restore the LIBS
                                LIBS="$save_LIBS"
@@ -543,8 +644,13 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                                dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-pthread $LIBS"
-                               AC_TRY_LINK([#include <pthread.h>],
-                                       [pthread_create(NULL,NULL,NULL,NULL);],
+                               AC_TRY_LINK([#include <pthread.h>],[
+#if HAVE_PTHREADS_D4
+       pthread_create(NULL,pthread_attr_default,NULL,NULL);
+#else
+       pthread_create(NULL,NULL,NULL,NULL);
+#endif
+],
                                        [ol_cv_pthread_flag=yes], [ol_cv_pthread_flag=no])
                                dnl restore the LIBS
                                LIBS="$save_LIBS"
@@ -563,8 +669,13 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                                dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-pthreads $LIBS"
-                               AC_TRY_LINK([#include <pthread.h>],
-                                       [pthread_create(NULL,NULL,NULL,NULL);],
+                               AC_TRY_LINK([#include <pthread.h>],[
+#if HAVE_PTHREADS_D4
+       pthread_create(NULL,pthread_attr_default,NULL,NULL);
+#else
+       pthread_create(NULL,NULL,NULL,NULL);
+#endif
+],
                                        [ol_cv_pthreads_flag=yes], [ol_cv_pthreads_flag=no])
                                dnl restore the LIBS
                                LIBS="$save_LIBS"
@@ -835,7 +946,11 @@ int main(argc, argv)
        char **argv;
 {
        pthread_t t;
+#if HAVE_PTHREADS_D4
+       exit(pthread_create(&t, pthread_attr_default, task, NULL));
+#else
        exit(pthread_create(&t, NULL, task, NULL));
+#endif
 }
 ],
                                [ol_cv_pthread_create_works=yes],
@@ -845,7 +960,7 @@ int main(argc, argv)
                        AC_MSG_RESULT($ol_cv_pthread_create_works)
 
                        if test $ol_cv_pthread_create_works = no ; then
-                               AC_MSG_ERROR([pthread.h and pthread_create are not compatible])
+                               AC_MSG_ERROR([pthread_create is not usable, check environment settings])
                        fi
 
                        dnl Check if select causes an yield
@@ -909,7 +1024,11 @@ int main(argc, argv)
 #endif
 #endif
 
+#if HAVE_PTHREADS_D4
+       pthread_create(&t, pthread_attr_default, task, NULL);
+#else
        pthread_create(&t, NULL, task, NULL);
+#endif
 
 #if HAVE_SCHED_YIELD
        sched_yield();  /* make sure task runs first */
@@ -1132,8 +1251,6 @@ dnl       CPPFLAGS="$save_CPPFLAGS"
 dnl    LIBS="$save_LIBS"
 fi  
 
-dnl ----------------------------------------------------------------
-
 if test $ol_link_threads = no ; then
        if test $ol_with_threads = yes ; then
                AC_MSG_ERROR([no suitable thread support])
@@ -1149,6 +1266,12 @@ if test $ol_link_threads = no ; then
        LTHREAD_LIBS=""
 fi
 
+if test $ol_link_threads != no ; then
+       AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE,1)
+fi
+
+dnl ----------------------------------------------------------------
+
 ol_link_ldbm=no 
 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then
        OL_BERKELEY_DB2
@@ -1346,6 +1469,34 @@ if test $ol_link_termcap = no ; then
        TERMCAP_LIBS=
 fi
 
+dnl
+dnl Check for GNU readline
+dnl
+ol_link_readline=no
+if test $ol_with_readline != no ; then
+       AC_CHECK_HEADERS(readline/readline.h readline/history.h)
+
+       if test $ac_cv_header_readline_readline_h = yes ; then
+               save_LIBS="$LIBS"
+               LIBS="$TERMCAP_LIBS $LIBS"
+               AC_CHECK_LIB(readline, readline, 
+                       [have_readline=yes], [have_readline=no])
+               LIBS="$save_LIBS"
+                       
+               if test $have_readline = yes ; then
+                       ol_with_readline=found
+                       ol_link_readline=yes
+
+                       READLINE_LIBS="-lreadline"
+               fi
+       fi
+fi
+
+if test $ol_link_readline = yes ; then
+       AC_DEFINE(HAVE_READLINE, 1, [define if you have -lreadline])
+fi
+
+
 # FreeBSD (and others) have crypt(3) in -lcrypt
 if test $ol_enable_crypt != no ; then
        AC_CHECK_FUNC(crypt, [have_crypt=yes], [
@@ -1404,6 +1555,7 @@ AC_CHECK_HEADERS( \
        getopt.h                \
        libutil.h               \
        limits.h                \
+       locale.h                \
        malloc.h                \
        memory.h                \
        regex.h                 \
@@ -1502,32 +1654,6 @@ AC_CHECK_FUNCS(          \
        waitpid                 \
 )
 
-# these functions are required to build a thread_safe -lldap
-AC_CHECK_FUNCS(                \
-       ctime_r                 \
-       gethostbyaddr_r \
-       gethostbyname_r \
-)
-
-if test "$ac_cv_func_ctime_r" = yes ; then
-       OL_FUNC_CTIME_R_NARGS
-else
-       ol_cv_func_ctime_r=0
-fi
-
-if test "$ac_cv_func_ctime_r" = yes \
-       -a "$ol_cv_func_ctime_r_nargs" -ge 2 -a "$ol_cv_func_ctime_r_nargs" -le 3 \
-       -a "$ac_cv_func_gethostbyaddr_r" = yes \
-       -a "$ac_cv_func_gethostbyname_r" = yes \
-       ; then
-
-       AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT, 1)
-fi
-
-if test $ol_link_threads != no ; then
-       AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE, 1)
-fi
-
 dnl We actually may need to replace more than this.
 AC_REPLACE_FUNCS(getopt tempnam)
 
@@ -1648,7 +1774,9 @@ AC_SUBST(SLAPD_PERL_CPPFLAGS)
 AC_SUBST(SLAPD_PERL_LDFLAGS)
 
 AC_SUBST(KRB_LIBS)
+AC_SUBST(READLINE_LIBS)
 AC_SUBST(TERMCAP_LIBS)
+AC_SUBST(TLS_LIBS)
 
 dnl ----------------------------------------------------------------
 dnl final output
@@ -1693,6 +1821,7 @@ servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
 tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \
 tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk \
+contrib/saucer/Makefile:build/top.mk:contrib/saucer/Makefile.in:build/rules.mk \
 ,[
 date > stamp-h
 echo Please \"make depend\" to build dependencies