]> git.sur5r.net Git - openldap/blobdiff - configure.in
Patch to support to determine the number of args of the
[openldap] / configure.in
index 5bb19b95eccfffb4672565897ec5b85420fecadc..0e1bc7649f4a61e32e8bd0363a68449a5ba47ffd 100644 (file)
@@ -49,7 +49,6 @@ 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
 
@@ -59,6 +58,8 @@ OL_ARG_WITH(threads,[  --with-threads use threads],
        auto, [auto posix mach lwp yes no manual] )
 OL_ARG_WITH(yielding_select,[  --with-yielding-select  with implicitly yielding select],
        auto, [auto yes no manual] )
+OL_ARG_WITH(tls,[  --with-tls  use tls/ssl],
+       auto, [auto ssleay openssl yes no] )
 
 dnl Server options
 
@@ -87,6 +88,7 @@ OL_ARG_WITH(ldbm_type,[      --with-ldbm-type use LDBM type], auto,
 OL_ARG_ENABLE(passwd,[    --enable-passwd      enable passwd backend], no)dnl
 OL_ARG_ENABLE(perl,[    --enable-perl  enable perl backend], no)dnl
 OL_ARG_ENABLE(shell,[    --enable-shell        enable shell backend], no)dnl
+OL_ARG_ENABLE(tcl,[    --enable-tcl    enable tcl backend], no)dnl
 
 dnl SLURPD OPTIONS
 AC_ARG_WITH(xxslurpdoptions,[SLURPD Options:])
@@ -126,6 +128,9 @@ if test $ol_enable_slapd = no ; then
        if test $ol_enable_shell = yes ; then
                AC_MSG_WARN([slapd disabled, ignoring --enable_shell argument])
        fi
+       if test $ol_enable_tcl = yes ; then
+               AC_MSG_WARN([slapd disabled, ignoring --enable_tcl argument])
+       fi
        if test $ol_enable_aclgroups = yes ; then
                AC_MSG_WARN([slapd disabled, ignoring --enable_aclgroups argument])
        fi
@@ -154,6 +159,7 @@ if test $ol_enable_slapd = no ; then
        ol_enable_passwd=no
        ol_enable_perl=no
        ol_enable_shell=no
+       ol_enable_tcl=no
        ol_enable_aclgroups=no
        ol_enable_wrappers=no
        ol_enable_phonetic=no
@@ -179,7 +185,8 @@ elif test $ol_enable_ldbm = no ; then
 
        if test $ol_enable_passwd = no -a \
                $ol_enable_perl = no -a \
-               $ol_enable_shell = no ; then
+               $ol_enable_shell = no -a \
+               $ol_enable_tcl = no ; then
                AC_MSG_ERROR([slapd requires a backend])
        fi
 
@@ -247,6 +254,7 @@ BUILD_LDBM=no
 BUILD_PASSWD=no
 BUILD_PERL=no
 BUILD_SHELL=no
+BUILD_TCL=no
 BUILD_THREAD=no
 
 SLAPD_PERL_LDFLAGS=
@@ -254,6 +262,7 @@ SLAPD_PERL_CPPFLAGS=
 
 KRB_LIBS=
 TERMCAP_LIBS=
+TLS_LIBS=
 
 dnl ----------------------------------------------------------------
 dnl Checks for programs
@@ -445,6 +454,35 @@ 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 = auto -o $ol_with_tls = ssleay \
+       -o $ol_with_tls = openssl ; 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], [have_ssleay=no], [-lcrypto])
+                       
+               if test $have_ssleay = yes ; then
+                       ol_with_tls=found
+                       ol_link_tls=yes
+
+                       AC_DEFINE( HAVE_SSLEAY, 1, 
+                               [define if you have SSLeay] )
+
+                       TLS_LIBS="-lssl -lcrypto"
+               fi
+       fi
+fi
+
+if test $ol_link_tls = yes ; then
+       AC_DEFINE( HAVE_TLS, 1, [define if you have TLS] )
+fi     
+
 ol_link_threads=no
 if test $ol_with_threads = auto -o $ol_with_threads = yes \
        -o $ol_with_threads = posix ; then
@@ -486,6 +524,7 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                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)
@@ -495,12 +534,11 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                dnl     pthread_create() in -lc_r (FreeBSD)
                dnl     pthread_create() in -lpthreads (many)
                dnl     pthread_join() -Wl,-woff,85 -lpthreads (IRIX)
-               dnl     pthread_create() in HP-UX -lpthread (HP-UX 11)
                dnl
-               dnl Check pthread (draft4) flags (to be depreciated)
+               dnl Check pthread (draft4) flags (depreciated)
                dnl     pthread_create() with -threads (OSF/1)
                dnl
-               dnl Check pthread (final) libraries (to be depreciated)
+               dnl Check pthread (final) libraries (depreciated)
                dnl     pthread_mutex_unlock() in -lpthreads -lmach -lexc -lc_r (OSF/1)
                dnl     pthread_mutex_lock() in -lpthreads -lmach -lexc (OSF/1)
                dnl     pthread_mutex_trylock() in -lpthreads -lexc (OSF/1)
@@ -589,6 +627,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"
@@ -666,37 +724,6 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
                        LIBS="$save_LIBS"
                fi
 
-               dnl HP-UX 11 Pthread check
-               if test $ol_link_threads = no; then
-                       save_LIBS="$LIBS"
-                       LIBS="$LIBS -lpthread"
-                       AC_MSG_CHECKING([for pthread_create() in HP-UX -lpthread])
-                       ol_try_pthread_hpux_11=no
-                       AC_CACHE_VAL(ol_cv_pthread_hpux_11,[
-                               AC_TRY_LINK([
-#include <pthread.h>
-#include <elf.h>
-#ifndef ELFABI_HPUX_REL11
-       die horribly
-#endif
-                               ], [pthread_create(NULL, NULL, NULL, NULL);],
-                                       ol_try_pthread_hpux_11=yes
-                                       ol_cv_pthread_hpux_11=yes,
-                                       ol_cv_pthread_hpux_11=no)])
-                       AC_MSG_RESULT(yes)
-                       LIBS="$save_LIBS"
-
-                       if test $ol_cv_pthread_hpux_11=yes ; then
-                               ol_link_threads=posix
-                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"
-                               if test $ol_try_pthread_hpux_11=yes ; then
-                                       dnl Some tests below may fail, cause we aint including
-                                       dnl pthread.h. Force appropriate ones to yes
-                                       ac_cv_func_pthread_attr_init=yes
-                               fi
-                       fi
-               fi
-
                if test $ol_link_threads = no ; then
                        dnl try -threads
                        AC_CACHE_CHECK([for pthread_create with -threads],
@@ -792,12 +819,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 \
@@ -1112,7 +1153,6 @@ dnl       save_CPPFLAGS="$CPPFLAGS"
 dnl    save_LIBS="$LIBS"
 dnl    LIBS="$LTHREAD_LIBS $LIBS"
 dnl    AC_CHECK_FUNCS( \
-dnl            strtok_r \
 dnl            gmtime_r \
 dnl            gethostbyaddr_r gethostbyname_r \
 dnl            feof_unlocked unlocked_feof \
@@ -1277,6 +1317,39 @@ if test $ol_enable_dmalloc != no ; then
        AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
 fi
 
+if test $ol_enable_tcl != no ; then
+       AC_CHECK_HEADERS(tcl.h)
+
+       if test $ac_cv_header_tcl_h != yes ; then
+               have_tcl=no
+       else
+               AC_CHECK_LIB(tcl,main,
+                       [have_tcl=yes; SLAPD_LIBS="$SLAPD_LIBS -ltcl"],
+                       [have_tcl=no])
+
+               if test $have_tcl != yes; then
+                       AC_CHECK_LIB(tcl7.6,main,
+                               [have_tcl=yes; SLAPD_LIBS="$SLAPD_LIBS -ltcl7.6"],
+                               [have_tcl=no])
+               fi
+
+               if test $have_tcl != yes; then
+                       AC_CHECK_LIB(tcl8.0,main,
+                               [have_tcl=yes; SLAPD_LIBS="$SLAPD_LIBS -ltcl8.0"],
+                               [have_tcl=no])
+               fi
+       fi
+
+       if test $have_tcl != yes ; then
+               AC_MSG_WARN([could not find -ltcl])
+               if test $ol_enable_tcl = yes ; then
+                       AC_MSG_ERROR([could not find tcl, select appropriate options or disable])
+               fi
+
+               ol_enable_tcl=no
+       fi
+fi
+
 # ud needs termcap (should insert check here)
 ol_link_termcap=no
 AC_CHECK_HEADERS(termcap.h ncurses.h)
@@ -1362,6 +1435,7 @@ AC_CHECK_HEADERS( \
        getopt.h                \
        libutil.h               \
        limits.h                \
+       locale.h                \
        malloc.h                \
        memory.h                \
        regex.h                 \
@@ -1453,7 +1527,6 @@ AC_CHECK_FUNCS(           \
        strrchr                 \
        strsep                  \
        strstr                  \
-       strtok                  \
        strtol                  \
        strtoul                 \
        strspn                  \
@@ -1463,7 +1536,6 @@ AC_CHECK_FUNCS(           \
 
 # these functions are required to build a thread_safe -lldap
 AC_CHECK_FUNCS(                \
-       strtok_r                \
        ctime_r                 \
        gethostbyaddr_r \
        gethostbyname_r \
@@ -1475,9 +1547,22 @@ else
        ol_cv_func_ctime_r=0
 fi
 
-if test "$ac_cv_func_strtok_r" = yes \
-       -a "$ac_cv_func_ctime_r" = yes \
+if test "$ac_cv_func_gethostbyname_r" = yes ; then
+       OL_FUNC_GETHOSTBYNAME_R_NARGS
+else
+       ol_cv_func_gethostbyname_r=0
+fi
+if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
+       OL_FUNC_GETHOSTBYADDR_R_NARGS
+else
+       ol_cv_func_gethostbyaddr_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 "$ol_cv_func_gethostbyname_r_nargs" -ge 5 -a "$ol_cv_func_gethostbyname_r_nargs" -le 6 \
+       -a "$ol_cv_func_gethostbyaddr_r_nargs" -ge 5 -a "$ol_cv_func_gethostbyaddr_r_nargs" -le 6 \
        -a "$ac_cv_func_gethostbyaddr_r" = yes \
        -a "$ac_cv_func_gethostbyname_r" = yes \
        ; then
@@ -1570,6 +1655,12 @@ if test "$ol_enable_shell" != no ; then
        BUILD_SHELL=yes
 fi
 
+if test "$ol_enable_tcl" != no ; then
+       AC_DEFINE(SLAPD_TCL,1)
+       BUILD_SLAPD=yes
+       BUILD_TCL=yes
+fi
+
 if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
        $BUILD_SLAPD = yes ; then
        BUILD_SLURPD=yes
@@ -1588,6 +1679,7 @@ AC_SUBST(BUILD_SLAPD)
   AC_SUBST(BUILD_PASSWD)
   AC_SUBST(BUILD_PERL)
   AC_SUBST(BUILD_SHELL)
+  AC_SUBST(BUILD_TCL)
 AC_SUBST(BUILD_SLURPD)
 
 AC_SUBST(LDAP_LIBS)
@@ -1603,6 +1695,7 @@ AC_SUBST(SLAPD_PERL_LDFLAGS)
 
 AC_SUBST(KRB_LIBS)
 AC_SUBST(TERMCAP_LIBS)
+AC_SUBST(TLS_LIBS)
 
 dnl ----------------------------------------------------------------
 dnl final output
@@ -1641,10 +1734,12 @@ servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.i
 servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/srv.mk \
 servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/srv.mk \
 servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/srv.mk \
+servers/slapd/back-tcl/Makefile:build/top.mk:servers/slapd/back-tcl/Makefile.in:build/srv.mk \
 servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
 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 \
+tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \
+tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk \
 ,[
 date > stamp-h
 echo Please \"make depend\" to build dependencies