2 dnl Copyright 1998,1999 The OpenLDAP Foundation. All Rights Reserved.
4 dnl Redistribution and use in source and binary forms are permitted only
5 dnl as authorized by the OpenLDAP Public License. A copy of this
6 dnl license is available at http://www.OpenLDAP.org/license.html or
7 dnl in file LICENSE in the top-level directory of the distribution.
10 dnl Configure.in for OpenLDAP
11 AC_INIT(include/ldap.h)dnl
12 AC_CONFIG_AUX_DIR(build)dnl
13 AM_INIT_AUTOMAKE(OpenLDAP,[2.0-devel], [no ac_define])dnl
15 dnl Do not use AutoConf 2.12; it produces a configuration script
16 dnl that causes an "internal 2K buffer" error on HPUX when run
17 dnl with /bin/sh. Autoconf 2.10 seems to be okay.
18 AC_PREREQ(2.13)dnl Required Autoconf version
20 AC_CONFIG_HEADER(include/portable.h include/ldap_features.h)dnl
24 AC_MSG_CHECKING(configure arguments)
25 AC_PREFIX_DEFAULT(/usr/local)
28 AC_SUBST(top_builddir)dnl
30 ldap_subdir="openldap"
32 AC_ARG_WITH(subdir, [ --with-subdir=DIR change default subdirectory used for installs], [
33 if test "$withval" = "no"; then
35 elif test "$withval" != "yes"; then
36 ldap_subdir="$withval"
40 AC_SUBST(ldap_subdir)dnl
42 OL_ARG_ENABLE(debug,[ --enable-debug enable debugging], yes)dnl
44 dnl OL_ARG_ENABLE(syslog,[ --enable-syslog enable syslog support], auto)dnl
45 OL_ARG_ENABLE(proctitle,[ --enable-proctitle enable proctitle support], yes)dnl
46 OL_ARG_ENABLE(cache,[ --enable-cache enable caching], yes)dnl
47 OL_ARG_ENABLE(dns,[ --enable-dns enable V2 DNS extension], no)dnl
48 OL_ARG_ENABLE(referrals,[ --enable-referrals enable V2 Referrals extension], yes)dnl
49 OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
50 OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling],
54 dnl General "with" options
55 OL_ARG_ENABLE(dmalloc,[ --enable-dmalloc enable debug malloc support], no)dnl
57 OL_ARG_WITH(kerberos,[ --with-kerberos use Kerberos],
58 auto, [auto k5 k4 afs yes no])
59 OL_ARG_WITH(threads,[ --with-threads use threads],
60 auto, [auto posix mach lwp yes no manual] )
61 OL_ARG_WITH(yielding_select,[ --with-yielding-select with implicitly yielding select],
62 auto, [auto yes no manual] )
67 AC_ARG_WITH(xxldapdoptions,[LDAPD Options:])
68 OL_ARG_ENABLE(ldapd,[ --enable-ldapd enable building ldapd], no)dnl
71 AC_ARG_WITH(xxslapdoptions,[SLAPD Options:])
72 OL_ARG_ENABLE(slapd,[ --enable-slapd enable building slapd], yes)dnl
73 OL_ARG_ENABLE(aclgroups,[ --enable-aclgroups enable ACL group support], auto)dnl
74 OL_ARG_ENABLE(cleartext,[ --enable-cleartext enable cleartext passwords], yes)dnl
75 OL_ARG_ENABLE(crypt,[ --enable-crypt enable crypt(3) passwords], auto)dnl
76 OL_ARG_ENABLE(wrappers,[ --enable-wrappers enable tcp wrapper support], no)dnl
77 OL_ARG_ENABLE(phonetic,[ --enable-phonetic enable phonetic/soundex], no)dnl
78 OL_ARG_ENABLE(rlookups,[ --enable-rlookups enable reverse lookups], auto)dnl
80 dnl SLAPD Backend options
81 OL_ARG_ENABLE(bdb2,[ --enable-bdb2 enable bdb2 backend], no)dnl
82 OL_ARG_ENABLE(ldbm,[ --enable-ldbm enable ldbm backend], yes)dnl
83 OL_ARG_WITH(ldbm_api,[ --with-ldbm-api use LDBM API], auto,
84 [auto db2 db gdbm ndbm manual])
85 OL_ARG_WITH(ldbm_type,[ --with-ldbm-type use LDBM type], auto,
88 OL_ARG_ENABLE(passwd,[ --enable-passwd enable passwd backend], no)dnl
89 OL_ARG_ENABLE(perl,[ --enable-perl enable perl backend], no)dnl
90 OL_ARG_ENABLE(shell,[ --enable-shell enable shell backend], no)dnl
93 AC_ARG_WITH(xxslurpdoptions,[SLURPD Options:])
94 OL_ARG_ENABLE(slurpd,[ --enable-slurpd enable building slurpd], auto)dnl
96 AC_ARG_WITH(xxliboptions,[Library Generation & Linking Options])
101 dnl General "enable" options
103 if test $ol_enable_dns = yes ; then
104 if test $ol_enable_referrals = no ; then
105 AC_MSG_ERROR([DNS requires --enable-referrals])
107 if test $ol_enable_referrals = auto ; then
108 AC_MSG_WARN([DNS requires referrals, adding --enable-referrals])
109 ol_enable_referrals=yes
113 if test $ol_enable_slapd = no ; then
114 dnl SLAPD was specificallly disabled
115 if test $ol_enable_bdb2 = yes ; then
116 AC_MSG_WARN([slapd disabled, ignoring --enable_bdb2 argument])
118 if test $ol_enable_ldbm = yes ; then
119 AC_MSG_WARN([slapd disabled, ignoring --enable_ldbm argument])
121 if test $ol_enable_passwd = yes ; then
122 AC_MSG_WARN([slapd disabled, ignoring --enable_passwd argument])
124 if test $ol_enable_perl = yes ; then
125 AC_MSG_WARN([slapd disabled, ignoring --enable_perl argument])
127 if test $ol_enable_shell = yes ; then
128 AC_MSG_WARN([slapd disabled, ignoring --enable_shell argument])
130 if test $ol_enable_aclgroups = yes ; then
131 AC_MSG_WARN([slapd disabled, ignoring --enable_aclgroups argument])
133 if test $ol_enable_wrappers = yes ; then
134 AC_MSG_WARN([slapd disabled, ignoring --enable_wrappers argument])
136 if test $ol_enable_phonetic = yes ; then
137 AC_MSG_WARN([slapd disabled, ignoring --enable_phonetic argument])
139 if test $ol_enable_rlookups = yes ; then
140 AC_MSG_WARN([slapd disabled, ignoring --enable_rlookups argument])
142 if test $ol_with_ldbm_api != auto ; then
143 AC_MSG_WARN([slapd disabled, ignoring --with_ldbm_api argument])
145 if test $ol_with_ldbm_type != auto ; then
146 AC_MSG_WARN([slapd disabled, ignoring --with_ldbm_type argument])
148 if test $ol_enable_slurpd = yes ; then
149 AC_MSG_ERROR([slurpd requires slapd])
152 # force settings to no
158 ol_enable_aclgroups=no
159 ol_enable_wrappers=no
160 ol_enable_phonetic=no
161 ol_enable_rlookups=no
166 elif test $ol_enable_ldbm = no ; then
167 dnl SLAPD without LDBM
169 if test $ol_with_ldbm_api != auto ; then
170 AC_MSG_WARN([LDBM disabled, ignoring --with_ldbm_api argument])
173 if test $ol_with_ldbm_type != auto ; then
174 AC_MSG_WARN([LDBM disabled, ignoring --with_ldbm_type argument])
177 if test $ol_enable_ldbm = yes ; then
178 AC_MSG_ERROR([BDB2 requires --enable-ldbm])
181 if test $ol_enable_passwd = no -a \
182 $ol_enable_perl = no -a
183 $ol_enable_shell = no ; then
184 AC_MSG_ERROR([slapd requires a backend])
190 elif test $ol_enable_bdb2 = yes ; then
193 if test $ol_with_ldbm_api != auto -a \
194 $ol_with_ldbm_api != db2 ; then
195 AC_MSG_ERROR([BDB2 requires LDBM API DB2])
203 if test $ol_enable_bdb2 != no ; then
204 if test $ol_with_ldbm_api != auto -a \
205 $ol_with_ldbm_api != db2 ; then
206 AC_MSG_WARN([BDB2 requires LDBM api db2 or auto])
211 if test $ol_with_ldbm_api = gdbm -a \
212 $ol_with_ldbm_type = btree ; then
213 AC_MSG_ERROR([GDBM only supports LDBM type hash])
215 if test $ol_with_ldbm_api = ndbm -a \
216 $ol_with_ldbm_type = btree ; then
217 AC_MSG_ERROR([NDBM only supports LDBM type hash])
221 if test $ol_enable_slurpd = yes ; then
222 dnl SLURPD was specifically enabled
223 if test $ol_with_threads = no ; then
224 AC_MSG_ERROR([slurpd requires threads])
259 dnl ----------------------------------------------------------------
260 dnl Checks for programs
269 AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail,
270 $PATH:/usr/libexec:/usr/lib:/usr/sbin:/usr/etc:/etc)
271 AC_PATH_PROG(EDITOR, vi, /usr/ucb/vi, $PATH:/usr/ucb)
272 AC_PATH_PROG(FINGER, finger, /usr/ucb/finger, $PATH:/usr/ucb)
274 if test $ol_enable_perl = yes ; then
275 AC_PATH_PROG(PERLBIN, perl, /usr/bin/perl)
277 if test "no$PERLBIN" = "no" ; then
281 SLAPD_PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e s/-lc//`"
282 SLAPD_PERL_CPPFLAGS="`$PERLBIN -MExtUtils::Embed -e perl_inc`"
287 if test $cross_compiling = yes -a $ol_enable_x_compile = yes; then
288 AC_MSG_WARN([cross compiling.... some functionality will be removed.])
290 elif test $cross_compiling = no -a $ol_enable_x_compile = yes; then
291 AC_MSG_WARN([programs compiled here do run here...])
292 AC_MSG_ERROR([ if not cross compiling, use --disable-x-compile.])
294 elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
295 AC_MSG_WARN([programs compiled here do not run here...])
296 AC_MSG_ERROR([ if cross compiling, add --enable-x-compile.])
299 dnl Checks for UNIX Variants
304 dnl Checks for system services
310 dnl OpenLDAP requires STDC features
312 if test "X${am_cv_prog_cc_stdc}" = "Xno" ; then
313 AC_MSG_ERROR([OpenLDAP requires compiler to support STDC prototypes.])
318 dnl Checks for libraries
321 dnl Likely combinations:
322 dnl -lsocket [ -lnsl_s | -lnsl ]
325 AC_CHECK_FUNC(socket, [have_socket=yes], [
327 dnl hopefully we won't include too many libraries
329 AC_CHECK_LIB(socket, main)
330 AC_CHECK_LIB(net, main)
331 AC_CHECK_LIB(nsl_s, main)
332 AC_CHECK_LIB(nsl, main)
333 AC_CHECK_LIB(inet, socket)
334 AC_CHECK_LIB(gen, main)
337 dnl Check for resolver routines
338 AC_CHECK_FUNCS(res_search)
339 if test $ac_cv_func_res_search = "no" ; then
340 AC_CHECK_LIB(bind, res_search)
341 if test "$ac_cv_lib_bind_res_search" = "yes" ; then
342 AC_DEFINE(HAVE_RES_SEARCH,1)
344 AC_CHECK_LIB(resolv, res_search)
345 if test "$ac_cv_lib_resolv_res_search" = "yes" ; then
346 AC_DEFINE(HAVE_RES_SEARCH,1)
351 dnl HP-UX requires -lV3
352 AC_CHECK_LIB(V3, sigset)
356 if test $ol_enable_ldapd != no ; then
357 dnl look for ISODE libraries
358 AC_CHECK_LIB(xtpp, main, [
360 AC_DEFINE(HAVE_XTPP,1)
361 LDAPD_LIBS="$LDAPD_LIBS -lxtpp -lxtdsap -lxtisode -losi"
362 ],:,[-lxtdsap -lxtisode -losi])
363 AC_CHECK_LIB(dsap, main, [
365 AC_DEFINE(HAVE_DSAP,1)
366 LDAPD_LIBS="$LDAPD_LIBS -ldsap"
368 AC_CHECK_LIB(isode, main, [
370 AC_DEFINE(HAVE_ISODE,1)
371 LDAPD_LIBS="$LDAPD_LIBS -lisode"
375 if test $ol_link_isode != no; then
376 AC_CHECK_LIB(pp, main, [
378 LDAPD_LIBS="-lpp $LDAPD_LIBS"
381 AC_PATH_PROG(PEPSY, pepsy)
385 dnl check for kerberos
389 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k5 ; then
390 AC_CHECK_HEADERS(kerberosIV/krb.h kerberosIV/des.h)
392 if test $ac_cv_header_kerberosIV_krb_h = yes ; then
393 AC_CHECK_LIB(krb4, main, [have_k5=yes], [have_k5=no],
396 if test $have_k5 = yes ; then
397 ol_with_kerberos=found
400 AC_DEFINE(HAVE_KERBEROS)
401 KRB_LIBS="-lkrb4 -lkrb5 -ldes425"
406 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k4 ; then
407 AC_CHECK_HEADERS(krb.h des.h)
409 if test $ac_cv_header_krb_h = yes ; then
410 AC_CHECK_LIB(krb, main, [have_k4=yes], [have_k4=no], [-ldes])
412 if test $have_k4 = yes ; then
413 ol_with_kerberos=found
416 AC_DEFINE(HAVE_KERBEROS)
417 KRB_LIBS="-lkrb -ldes"
422 dnl if test $ol_link_kerberos = yes ; then
424 dnl LIBS="$KRB_LIBS $LIBS"
425 dnl AC_CHECK_FUNCS(des_string_to_key)
430 if test $ol_with_threads = auto -o $ol_with_threads = yes \
431 -o $ol_with_threads = posix ; then
433 AC_CHECK_HEADERS(pthread.h sched.h)
435 if test $ac_cv_header_pthread_h = yes ; then
436 OL_POSIX_THREAD_VERSION
438 if test $ol_cv_pthread_version = final ; then
439 AC_DEFINE(HAVE_PTHREADS_FINAL)
440 elif test $ol_cv_pthread_version = draft4 ; then
441 AC_DEFINE(HAVE_PTHREADS_D4)
443 AC_MSG_ERROR([unknown pthread version])
446 # consider threads found
447 ol_with_threads=found
451 if test $ol_cv_linux_threads = yes ; then
452 AC_DEFINE(HAVE_LINUX_THREADS,1)
455 dnl Now the hard part, how to link
457 dnl Check for pthread support in current $LIBS
458 AC_CHECK_FUNC(pthread_create,[ol_link_threads=yes])
460 if test $ol_link_threads = no ; then
462 AC_CACHE_CHECK([for pthread_create with -kthread],
463 [ol_cv_kthread_flag], [
466 LIBS="-kthread $LIBS"
467 AC_TRY_LINK([char pthread();],[
469 ], ol_cv_kthread_flag=yes, ol_cv_kthread_flag=no)
474 if test $ol_cv_kthread_flag = yes ; then
475 LTHREAD_LIBS="$LTHREAD_LIBS -kthread"
476 ol_link_threads=posix
480 if test $ol_link_threads = no ; then
482 AC_CACHE_CHECK([for pthread_create with -pthread],
483 [ol_cv_pthread_flag], [
486 LIBS="-pthread $LIBS"
487 AC_TRY_LINK([char pthread();],[
489 ], ol_cv_pthread_flag=yes, ol_cv_pthread_flag=no)
494 if test $ol_cv_pthread_flag = yes ; then
495 LTHREAD_LIBS="$LTHREAD_LIBS -pthread"
496 ol_link_threads=posix
500 if test $ol_link_threads = no ; then
502 AC_CACHE_CHECK([for pthread_create with -pthreads],
503 [ol_cv_pthreads_flag], [
506 LIBS="-pthreads $LIBS"
507 AC_TRY_LINK([char pthread();],[
509 ], ol_cv_pthreads_flag=yes, ol_cv_pthreads_flag=no)
514 if test $ol_cv_pthreads_flag = yes ; then
515 LTHREAD_LIBS="$LTHREAD_LIBS -pthreads"
516 ol_link_threads=posix
520 if test $ol_link_threads = no ; then
522 AC_CACHE_CHECK([for pthread_create with -thread],
523 [ol_cv_thread_flag], [
527 AC_TRY_LINK([char pthread();],[
529 ], ol_cv_thread_flag=yes, ol_cv_thread_flag=no)
534 if test $ol_cv_thread_flag = yes ; then
535 LTHREAD_LIBS="$LTHREAD_LIBS -thread"
536 ol_link_threads=posix
540 if test $ol_link_threads = no ; then
541 dnl try DEC Threads -lpthread -lexc
543 AC_CHECK_LIB(pthread, pthread_mutex_lock, [
544 ol_link_threads=posix
545 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lexc"
546 if test $ol_with_yielding_select = auto ; then
547 ol_with_yielding_select=yes
553 if test $ol_link_threads = no ; then
554 dnl try DEC Threads -lpthreads -lmach -lexc -lc_r
556 AC_CHECK_LIB(pthreads, pthread_mutex_unlock, [
557 ol_link_threads=posix
558 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r"
559 if test $ol_with_yielding_select = auto ; then
560 ol_with_yielding_select=yes
562 ],:,[-lmach -lexc -lc_r])
566 if test $ol_link_threads = no ; then
569 AC_CHECK_LIB(pthread, pthread_create, [
570 ol_link_threads=posix
571 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"],:)
575 if test $ol_link_threads = no ; then
578 AC_CHECK_LIB(c_r, pthread_create, [
579 ol_link_threads=posix
580 LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"],:)
584 if test $ol_link_threads = no ; then
587 AC_CHECK_LIB(pthreads, pthread_create, [
588 ol_link_threads=posix
589 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"],:)
593 dnl IRIX Pthread check
594 if test $ol_link_threads = no ; then
595 dnl try IRIX Pthreads -Wl,-woff,85 -lpthreads
597 AC_CHECK_LIB(pthreads, pthread_join, [
598 ol_link_threads=posix
599 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"
604 dnl HP-UX 11 Pthread check
605 if test $ol_link_threads = no; then
607 LIBS="$LIBS -lpthread"
608 AC_MSG_CHECKING([for pthread_create() in HP-UX -lpthread])
609 ol_try_pthread_hpux_11=no
610 AC_CACHE_VAL(ol_cv_pthread_hpux_11,[
614 #ifndef ELFABI_HPUX_REL11
617 ], [pthread_create(NULL, NULL, NULL, NULL);],
618 ol_try_pthread_hpux_11=yes
619 ol_cv_pthread_hpux_11=yes,
620 ol_cv_pthread_hpux_11=no)])
624 if test $ol_cv_pthread_hpux_11=yes ; then
625 ol_link_threads=posix
626 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"
627 if test $ol_try_pthread_hpux_11=yes ; then
628 dnl Some tests below may fail, cause we aint including
629 dnl pthread.h. Force appropriate ones to yes
630 ac_cv_func_pthread_attr_init=yes
635 if test $ol_link_threads != no ; then
636 AC_DEFINE(HAVE_PTHREADS)
639 save_CPPFLAGS="$CPPFLAGS"
641 LIBS="$LTHREAD_LIBS $LIBS"
643 dnl All POSIX Thread (final) implementations should have
644 dnl sched_yield instead of pthread yield.
646 AC_CHECK_FUNCS(sched_yield pthread_yield)
648 if test $ac_cv_func_sched_yield = no -a \
649 $ac_cv_func_pthread_yield = no ; then
650 dnl Digital UNIX has sched_yield() in -lrt
651 AC_CHECK_LIB(rt, sched_yield,
652 [LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
653 AC_DEFINE(HAVE_SCHED_YIELD,1)
654 ac_cv_func_sched_yield=yes],
655 [ac_cv_func_sched_yield=no])
657 if test $ac_cv_func_sched_yield = no -a \
658 $ac_cv_func_pthread_yield = no ; then
659 dnl Solaris has sched_yield() in -lposix4
660 dnl but we'll use thr_yield instead.
661 AC_CHECK_FUNCS(thr_yield)
663 if test $ac_cv_func_sched_yield = no -a \
664 $ac_cv_func_pthread_yield = no -a \
665 "$ac_cv_func_thr_yield" = no ; then
666 AC_MSG_WARN([could not locate sched_yield() or pthread_yield()])
669 dnl Check functions for compatibility
670 AC_CHECK_FUNCS(pthread_kill pthread_detach)
672 if test $ac_cv_func_pthread_detach = no ; then
673 AC_MSG_ERROR([could not locate pthread_detach()])
676 dnl Check for setconcurreny functions
678 pthread_setconcurrency \
679 pthread_getconcurrency \
684 AC_MSG_CHECKING([if pthread_create() works])
685 AC_CACHE_VAL(ol_cv_pthread_create_works,[
689 #define NULL (void*)0
695 return (void *) (p == NULL);
703 exit(pthread_create(&t, NULL, task, NULL));
706 [ol_cv_pthread_create_works=yes],
707 [ol_cv_pthread_create_works=no],
709 ol_cv_pthread_create_works=yes])])
710 AC_MSG_RESULT($ol_cv_pthread_create_works)
712 if test $ol_cv_pthread_create_works = no ; then
713 AC_MSG_ERROR([pthread.h and pthread_create are not compatible])
716 dnl Check if select causes an yield
717 if test $ol_with_yielding_select = auto ; then
718 AC_MSG_CHECKING([if select yields when using pthreads])
719 AC_CACHE_VAL(ol_cv_pthread_select_yields,[
721 #include <sys/types.h>
722 #include <sys/time.h>
726 #define NULL (void*) 0
729 static int fildes[2];
743 FD_SET(fildes[0], &rfds);
745 /* we're not interested in any fds */
746 i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
753 exit(0); /* if we exit here, the select blocked the whole process */
762 /* create a pipe to select */
763 if(pipe(&fildes[0])) {
768 #ifdef HAVE_PTHREAD_SETCONCURRENCY
769 (void) pthread_setconcurrency(2);
771 #ifdef HAVE_THR_SETCONCURRENCY
772 /* Set Solaris LWP concurrency to 2 */
773 thr_setconcurrency(2);
777 pthread_create(&t, NULL, task, NULL);
780 sched_yield(); /* make sure task runs first */
782 #ifdef HAVE_PTHREAD_YIELD
783 pthread_yield(); /* make sure task runs first */
789 [ol_cv_pthread_select_yields=no],
790 [ol_cv_pthread_select_yields=yes], [
791 AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])])])
792 AC_MSG_RESULT($ol_cv_pthread_select_yields)
794 if test $ol_cv_pthread_select_yields = yes ; then
795 ol_with_yielding_select=yes
800 CPPFLAGS="$save_CPPFLAGS"
803 AC_MSG_ERROR([could not link with POSIX Threads])
807 if test $ol_with_threads = posix ; then
808 AC_MSG_ERROR([could not locate POSIX Threads])
812 if test $ol_with_threads = auto -o $ol_with_threads = yes \
813 -o $ol_with_threads = mach ; then
815 dnl check for Mach CThreads
816 AC_CHECK_HEADERS(mach/cthreads.h)
817 if test $ac_cv_header_mach_cthreads_h = yes ; then
818 ol_with_threads=found
820 dnl check for cthread support in current $LIBS
821 AC_CHECK_FUNC(cthread_fork,[ol_link_threads=yes])
823 if test $ol_link_threads = no ; then
825 dnl this test needs work
826 AC_CACHE_CHECK([for cthread_fork with -all_load],
827 [ol_cv_cthread_all_load], [
830 LIBS="-all_load $LIBS"
831 AC_TRY_LINK([#include <mach/cthreads.h>],[
832 cthread_fork((void *)0, (void *)0);
833 ], ol_cv_cthread_all_load=yes, ol_cv_cthread_all_load=no)
838 if test $ol_cv_cthread_all_load = yes ; then
839 LTHREAD_LIBS="$LTHREAD_LIBS -all_load"
844 if test $ol_link_threads != no ; then
845 : check for cthread specific functionality here
846 AC_DEFINE(HAVE_MACH_CTHREADS,1)
848 AC_MSG_ERROR([could not link with Mach CThreads])
852 if test $ol_with_threads = mach ; then
853 AC_MSG_ERROR([could not locate Mach CThreads])
857 if test $ol_with_threads = auto -o $ol_with_threads = yes \
858 -o $ol_with_threads = lwp ; then
860 dnl check for SunOS5 LWP
861 AC_CHECK_HEADERS(thread.h synch.h)
862 if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
863 AC_CHECK_LIB(thread, thr_create, [have_thr=yes], [have_thr=no])
865 if test $have_thr = yes ; then
867 LTHREAD_LIBS="$LTHREAD_LIBS -lthread"
870 if test $ol_with_yielding_select = auto ; then
871 ol_with_yielding_select=yes
874 dnl Check for setconcurreny functions
882 dnl check for SunOS4 LWP
883 AC_CHECK_HEADERS(lwp/lwp.h)
884 if test $ac_cv_header_lwp_lwp_h = yes ; then
885 AC_CHECK_LIB(lwp, lwp_create, [have_lwp=yes], [have_lwp=no])
887 if test $have_lwp = yes ; then
889 LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
892 if test $ol_with_yielding_select = auto ; then
893 ol_with_yielding_select=no
899 if test $ol_with_yielding_select = yes ; then
900 AC_DEFINE(HAVE_YIELDING_SELECT,1)
903 if test $ol_with_threads = manual ; then
904 dnl User thinks he can manually configure threads.
907 AC_MSG_WARN([thread defines and link options must be set manually])
909 AC_CHECK_HEADERS(pthread.h sched.h)
910 AC_CHECK_FUNCS(sched_yield pthread_yield)
913 AC_CHECK_HEADERS(mach/cthreads.h)
914 AC_CHECK_HEADERS(lwp/lwp.h)
915 AC_CHECK_HEADERS(thread.h synch.h)
918 if test $ol_link_threads != no ; then
919 dnl needed to get reentrant/threadsafe versions
921 AC_DEFINE(REENTRANT,1)
922 AC_DEFINE(_REENTRANT,1)
923 AC_DEFINE(THREAD_SAFE,1)
924 AC_DEFINE(_THREAD_SAFE,1)
925 AC_DEFINE(THREADSAFE,1)
926 AC_DEFINE(_THREADSAFE,1)
928 dnl this might cause the errno symbol to be
929 dnl replaced with a function to get a thread specific errno.
930 dnl check to see if everything needs to be compiled
931 dnl with the thread libraries
932 AC_CACHE_CHECK([for thread specific errno],
933 [ol_cv_errno_thread_specific], [
939 [ol_cv_errno_thread_specific=yes],
940 [ol_cv_errno_thread_specific=no])
943 if test $ol_cv_errno_thread_specific != yes ; then
944 LIBS="$LTHREAD_LIBS $LIBS"
948 dnl When in thread environment, use
949 dnl #if defined( HAVE_REENTRANT_FUNCTIONS ) \
950 dnl || defined( HAVE_FUNC_R )
953 dnl # if defined( HAVE_THREADS )
957 dnl # if defined( HAVE_THREADS )
962 dnl HAVE_REENTRANT_FUNCTIONS is derived from:
963 dnl _POSIX_REENTRANT_FUNCTIONS
964 dnl _POSIX_THREAD_SAFE_FUNCTIONS
965 dnl _POSIX_THREADSAFE_FUNCTIONS
967 dnl and is currently defined in lthread.h
969 dnl HAVE_THREADS is defined by lthread.h iff -UNO_THREADS
971 dnl libldap/*.c should only include <lthread.h> iff
972 dnl LDAP_R_COMPILE is defined. ie:
973 dnl #ifdef LDAP_R_COMPILE
974 dnl # include LDAP_R_COMPILE
977 dnl LDAP_R_COMIPLE is defined by libldap_r/Makefile.in
978 dnl specifically for compiling the threadsafe version of
979 dnl the ldap library (-lldap_r).
981 dnl dnl check for reentrant/threadsafe functions
983 dnl dnl note: these should only be used when linking
984 dnl dnl with $LTHREAD_LIBS
986 dnl save_CPPFLAGS="$CPPFLAGS"
987 dnl save_LIBS="$LIBS"
988 dnl LIBS="$LTHREAD_LIBS $LIBS"
989 dnl AC_CHECK_FUNCS( \
992 dnl gethostbyaddr_r gethostbyname_r \
993 dnl feof_unlocked unlocked_feof \
994 dnl putc_unlocked unlocked_putc \
995 dnl flockfile ftrylockfile \
997 dnl CPPFLAGS="$save_CPPFLAGS"
998 dnl LIBS="$save_LIBS"
1001 dnl ----------------------------------------------------------------
1003 if test $ol_link_threads = no ; then
1004 if test $ol_with_threads = yes ; then
1005 AC_MSG_ERROR([no suitable thread support])
1008 if test $ol_with_threads = auto ; then
1009 AC_MSG_WARN([no suitable thread support, disabling threads])
1013 AC_DEFINE(NO_THREADS,1)
1018 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then
1021 if test $ol_cv_berkeley_db2 = yes ; then
1023 ol_with_ldbm_api=db2
1025 if test $ol_with_ldbm_type = hash ; then
1026 AC_DEFINE(LDBM_USE_DBHASH,1)
1028 AC_DEFINE(LDBM_USE_DBBTREE,1)
1031 dnl $ol_cv_lib_db2 should be yes or -ldb
1032 dnl (it could be no, but that would be an error
1033 if test $ol_cv_lib_db2 != yes ; then
1034 LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db2"
1040 if test $ol_link_ldbm = db2 -a $ol_enable_bdb2 != no ; then
1044 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then
1047 if test $ol_cv_berkeley_db = yes ; then
1051 if test $ol_with_ldbm_type = hash ; then
1052 AC_DEFINE(LDBM_USE_DBHASH,1)
1054 AC_DEFINE(LDBM_USE_DBBTREE,1)
1057 dnl $ol_cv_lib_db should be yes or -ldb
1058 dnl (it could be no, but that would be an error
1059 if test $ol_cv_lib_db != yes ; then
1060 LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db"
1065 if test $ol_with_ldbm_api = manual ; then
1066 dnl User thinks he can manually configure LDBM api.
1069 AC_MSG_WARN([LDBM defines and link options must be set manually])
1071 AC_CHECK_HEADERS(db.h db_185.h gdbm.h ndbm.h)
1074 if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
1075 AC_MSG_WARN(Could not find LDBM with BTREE support)
1076 ol_with_ldbm_api=none
1079 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
1082 if test $ol_cv_gdbm = yes ; then
1084 ol_with_ldbm_api=gdbm
1086 if test $ol_cv_lib_gdbm != yes ; then
1087 LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_gdbm"
1092 if test $ol_with_ldbm_api = auto ; then
1093 AC_MSG_WARN([skipping automatic checking for NDBM, must be manually enabled.])
1094 elif test $ol_with_ldbm_api = ndbm ; then
1097 if test $ol_cv_ndbm = yes ; then
1099 ol_with_ldbm_api=ndbm
1101 if test $ol_cv_lib_ndbm != yes ; then
1102 LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_ndbm"
1107 if test $ol_link_ldbm = no -a $ol_enable_ldbm != no ; then
1108 AC_MSG_WARN(could not find suitable LDBM backend)
1109 if test $ol_enable_ldbm = yes ; then
1110 AC_MSG_ERROR(select appropriate LDBM options or disable)
1113 AC_MSG_WARN(disabling LDBM)
1117 if test $ol_enable_wrappers != no ; then
1118 AC_CHECK_HEADERS(tcpd.h)
1120 if test $ac_cv_header_tcpd_h != yes ; then
1123 AC_CHECK_LIB(wrap, main,
1124 [have_wrappers=yes], [have_wrappers=no])
1127 if test $have_wrappers = yes ; then
1128 AC_DEFINE(HAVE_TCPD)
1129 SLAPD_LIBS="$SLAPD_LIBS -lwrap"
1131 AC_MSG_WARN(could not find -lwrap)
1132 if test $ol_enable_wrappers = yes ; then
1133 AC_MSG_ERROR(could not find wrappers, select appropriate options or disable)
1136 AC_MSG_WARN(disabling wrappers support)
1137 ol_enable_wrappers=no
1141 if test $ol_enable_syslog != no ; then
1142 AC_CHECK_FUNC(openlog)
1143 if test $ac_cv_func_openlog = no -a $ol_enable_syslog = yes; then
1144 AC_MSG_ERROR(could not find syslog, select appropriate options or disable)
1146 ol_enable_syslog=$ac_cv_func_openlog
1149 if test $ol_enable_dmalloc != no ; then
1150 AC_CHECK_HEADERS(dmalloc.h)
1151 AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
1154 # ud needs termcap (should insert check here)
1156 AC_CHECK_HEADERS(termcap.h ncurses.h)
1158 if test $ol_link_termcap = no ; then
1159 AC_CHECK_LIB(termcap, tputs, [have_termcap=yes], [have_termcap=no])
1160 if test $have_termcap = yes ; then
1161 AC_DEFINE(HAVE_TERMCAP)
1163 TERMCAP_LIBS=-ltermcap
1167 if test $ol_link_termcap = no ; then
1168 AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
1169 if test $have_ncurses = yes ; then
1170 AC_DEFINE(HAVE_NCURSES)
1172 TERMCAP_LIBS=-lncurses
1176 if test $ol_link_termcap = no ; then
1177 AC_DEFINE(NO_TERMCAP,1)
1181 # FreeBSD (and others) have crypt(3) in -lcrypt
1182 if test $ol_enable_crypt != no ; then
1183 AC_CHECK_FUNC(crypt, [have_crypt=yes], [
1184 AC_CHECK_LIB(crypt, crypt, [LUTIL_LIBS="$LUTIL_LIBS -lcrypt"
1185 have_crypt=yes], [have_crypt=no])])
1187 if test $have_crypt = yes ; then
1188 AC_DEFINE(HAVE_CRYPT,1)
1190 AC_MSG_WARN(could not find crypt)
1191 if test $ol_enable_crypt = yes ; then
1192 AC_MSG_ERROR(could not find crypt, select appropriate options or disable)
1195 AC_MSG_WARN(disabling crypt support)
1200 # FreeBSD (and others) have setproctitle(3) in -lutil
1201 if test $ol_enable_proctitle != no ; then
1202 AC_CHECK_FUNC(setproctitle, [have_setproctitle=yes], [
1203 AC_CHECK_LIB(util, setproctitle,
1204 [have_setproctitle=yes
1205 LUTIL_LIBS="$LUTIL_LIBS -lutil"],
1206 [have_setproctitle=no
1207 LIBOBJS="$LIBOBJS setproctitle.o"])])
1209 if test $have_setproctitle = yes ; then
1210 AC_DEFINE(HAVE_SETPROCTITLE,1)
1214 dnl ----------------------------------------------------------------
1215 dnl Checks for header files.
1218 if test $ac_cv_header_stdc != yes; then
1219 AC_MSG_WARN([could not Standard C compliant headers])
1224 AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
1225 if test $am_cv_sys_posix_termios = yes ; then
1226 AC_DEFINE(HAVE_POSIX_TERMIOS,1)
1263 dnl ----------------------------------------------------------------
1264 dnl Checks for typedefs, structures, and compiler characteristics.
1265 AC_TYPE_GETGROUPS dnl requires AC_TYPE_UID_T
1271 OL_TYPE_SIG_ATOMIC_T
1273 AC_STRUCT_ST_BLKSIZE
1281 if test $cross_compiling = yes ; then
1282 AC_DEFINE(CROSS_COMPILING, 1)
1285 AC_CHECK_SIZEOF(short)
1286 AC_CHECK_SIZEOF(int)
1287 AC_CHECK_SIZEOF(long)
1290 dnl ----------------------------------------------------------------
1291 dnl Checks for library functions.
1293 dnl AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h
1298 if test $ac_cv_func_vprintf = yes ; then
1299 dnl check for vsnprintf
1300 AC_CHECK_FUNCS(vsnprintf vsprintf)
1335 # these functions are required to build a thread_safe -lldap
1343 if test "$ac_cv_func_ctime_r" = yes ; then
1344 OL_FUNC_CTIME_R_NARGS
1346 ol_cv_func_ctime_r=0
1349 if test "$ac_cv_func_strtok_r" = yes \
1350 -a "$ac_cv_func_ctime_r" = yes \
1351 -a "$ol_cv_func_ctime_r_nargs" -ge 2 -a "$ol_cv_func_ctime_r_nargs" -le 3 \
1352 -a "$ac_cv_func_gethostbyaddr_r" = yes \
1353 -a "$ac_cv_func_gethostbyname_r" = yes \
1356 AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT, 1)
1359 if test $ol_link_threads != no ; then
1360 AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE, 1)
1363 dnl We actually may need to replace more than this.
1364 AC_REPLACE_FUNCS(getopt tempnam)
1366 dnl ----------------------------------------------------------------
1367 # Check Configuration
1370 dnl ----------------------------------------------------------------
1371 dnl Sort out defines
1373 if test "$ol_enable_debug" != no ; then
1374 AC_DEFINE(LDAP_DEBUG,1)
1376 if test "$ol_enable_syslog" = yes ; then
1377 AC_DEFINE(LDAP_SYSLOG,1)
1379 if test "$ol_enable_libui" = yes ; then
1380 AC_DEFINE(LDAP_LIBUI,1)
1382 if test "$ol_enable_cache" = no ; then
1383 AC_DEFINE(LDAP_NOCACHE,1)
1385 if test "$ol_enable_dns" != no ; then
1386 AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_DNS,LDAP_VENDOR_VERSION,1)
1388 if test "$ol_enable_proctitle" != no ; then
1389 AC_DEFINE(LDAP_PROCTITLE,1)
1391 if test "$ol_enable_referrals" != no ; then
1392 AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS,LDAP_VENDOR_VERSION,1)
1394 if test "$ol_enable_cldap" != no ; then
1395 AC_DEFINE(LDAP_CONNECTIONLESS,1)
1398 if test "$ol_enable_aclgroups" != no ; then
1399 AC_DEFINE(SLAPD_ACLGROUPS,1)
1401 if test "$ol_enable_crypt" != no ; then
1402 AC_DEFINE(SLAPD_CRYPT,1)
1404 if test "$ol_enable_cleartext" != no ; then
1405 AC_DEFINE(SLAPD_CLEARTEXT,1)
1407 if test "$ol_enable_phonetic" != no ; then
1408 AC_DEFINE(SLAPD_PHONETIC,1)
1410 if test "$ol_enable_rlookups" != no ; then
1411 AC_DEFINE(SLAPD_RLOOKUPS,1)
1414 if test "$ol_link_bdb2" != no ; then
1415 AC_DEFINE(SLAPD_BDB2,1)
1420 if test "$ol_link_ldbm" != no ; then
1421 AC_DEFINE(SLAPD_LDBM,1)
1426 if test "$ol_enable_passwd" != no ; then
1427 AC_DEFINE(SLAPD_PASSWD,1)
1432 if test "$ol_enable_perl" != no ; then
1433 AC_DEFINE(SLAPD_PERL,1)
1438 if test "$ol_enable_shell" != no ; then
1439 AC_DEFINE(SLAPD_SHELL,1)
1444 if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
1445 $BUILD_SLAPD = yes ; then
1449 if test "$ol_link_isode" != no ; then
1453 dnl ----------------------------------------------------------------
1455 AC_SUBST(BUILD_LDAPD)
1456 AC_SUBST(BUILD_SLAPD)
1457 AC_SUBST(BUILD_BDB2)
1458 AC_SUBST(BUILD_LDBM)
1459 AC_SUBST(BUILD_PASSWD)
1460 AC_SUBST(BUILD_PERL)
1461 AC_SUBST(BUILD_SHELL)
1462 AC_SUBST(BUILD_SLURPD)
1465 AC_SUBST(LDAPD_LIBS)
1466 AC_SUBST(SLAPD_LIBS)
1467 AC_SUBST(SLURPD_LIBS)
1469 AC_SUBST(LTHREAD_LIBS)
1470 AC_SUBST(LUTIL_LIBS)
1472 AC_SUBST(SLAPD_PERL_CPPFLAGS)
1473 AC_SUBST(SLAPD_PERL_LDFLAGS)
1476 AC_SUBST(TERMCAP_LIBS)
1478 dnl ----------------------------------------------------------------
1483 Makefile:build/top.mk:Makefile.in:build/dir.mk \
1484 doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \
1485 doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk \
1486 doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk \
1487 doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk \
1488 doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk \
1489 doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk \
1490 clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
1491 clients/finger/Makefile:build/top.mk:clients/finger/Makefile.in:build/rules.mk \
1492 clients/fax500/Makefile:build/top.mk:clients/fax500/Makefile.in:build/rules.mk \
1493 clients/gopher/Makefile:build/top.mk:clients/gopher/Makefile.in:build/rules.mk \
1494 clients/mail500/Makefile:build/top.mk:clients/mail500/Makefile.in:build/rules.mk \
1495 clients/rcpt500/Makefile:build/top.mk:clients/rcpt500/Makefile.in:build/rules.mk \
1496 clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
1497 clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk \
1498 include/Makefile:build/top.mk:include/Makefile.in \
1499 libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk \
1500 libraries/libavl/Makefile:build/top.mk:libraries/libavl/Makefile.in:build/lib.mk:build/lib-static.mk \
1501 libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk \
1502 libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk \
1503 libraries/libldap_r/Makefile:build/top.mk:libraries/libldap_r/Makefile.in:build/lib.mk:build/lib-shared.mk \
1504 libraries/libldbm/Makefile:build/top.mk:libraries/libldbm/Makefile.in:build/lib.mk:build/lib-static.mk \
1505 libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.mk:build/lib-static.mk \
1506 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk \
1507 servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk \
1508 servers/ldapd/Makefile:build/top.mk:servers/ldapd/Makefile.in:build/srv.mk \
1509 servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk \
1510 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/srv.mk \
1511 servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/srv.mk \
1512 servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/srv.mk \
1513 servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/srv.mk \
1514 servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
1515 servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
1516 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
1517 tests/Makefile:build/top.mk:tests/Makefile.in \
1520 echo Please \"make depend\" to build dependencies