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 Disable config.cache!
11 define([AC_CACHE_LOAD], )dnl
12 define([AC_CACHE_SAVE], )dnl
14 dnl Configure.in for OpenLDAP
15 AC_INIT(include/ldap.h)dnl
16 AC_CONFIG_AUX_DIR(build)dnl
17 AM_INIT_AUTOMAKE(openldap,[1.2], [no ac_define])dnl
19 dnl We use autoconf features new to 2.13.1
20 dnl aclocal.m4 should be built using aclocal from automake 1.4
21 AC_PREREQ(2.13.1)dnl Required Autoconf version
23 AC_CONFIG_HEADER(include/portable.h)dnl
27 AC_MSG_CHECKING(configure arguments)
28 AC_PREFIX_DEFAULT(/usr/local)
31 AC_SUBST(top_builddir)dnl
33 ldap_subdir="openldap"
35 AC_ARG_WITH(subdir, [ --with-subdir=DIR change default subdirectory used for installs], [
36 if test "$withval" = "no"; then
38 elif test "$withval" != "yes"; then
39 ldap_subdir="$withval"
43 AC_SUBST(ldap_subdir)dnl
45 OL_ARG_ENABLE(debug,[ --enable-debug enable debugging], yes)dnl
46 OL_ARG_ENABLE(proctitle,[ --enable-proctitle enable proctitle support], yes)dnl
47 OL_ARG_ENABLE(libui,[ --enable-libui enable library user interface], yes)dnl
48 OL_ARG_ENABLE(cache,[ --enable-cache enable caching], yes)dnl
49 OL_ARG_ENABLE(dns,[ --enable-dns enable dns support], no)dnl
50 OL_ARG_ENABLE(referrals,[ --enable-referrals enable referrals], yes)dnl
51 OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
52 OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling],
55 dnl General "with" options
56 OL_ARG_ENABLE(dmalloc,[ --enable-dmalloc enable debug malloc support], no)dnl
58 OL_ARG_WITH(kerberos,[ --with-kerberos use Kerberos],
59 auto, [auto k5 k4 afs yes no])
60 OL_ARG_WITH(threads,[ --with-threads use threads],
61 auto, [auto posix mach lwp yes no manual] )
62 OL_ARG_WITH(yielding_select,[ --with-yielding-select with implicitly yielding select],
63 auto, [auto yes no manual] )
68 AC_ARG_WITH(xxldapdoptions,[LDAPD Options:])
69 OL_ARG_ENABLE(ldapd,[ --enable-ldapd enable building ldapd], no)dnl
72 AC_ARG_WITH(xxslapdoptions,[SLAPD Options:])
73 OL_ARG_ENABLE(slapd,[ --enable-slapd enable building slapd], yes)dnl
74 OL_ARG_ENABLE(aclgroups,[ --enable-aclgroups enable ACL group support], auto)dnl
75 OL_ARG_ENABLE(cleartext,[ --enable-cleartext enable cleartext passwords], yes)dnl
76 OL_ARG_ENABLE(crypt,[ --enable-crypt enable crypt(3) passwords], auto)dnl
77 OL_ARG_ENABLE(wrappers,[ --enable-wrappers enable tcp wrapper support], no)dnl
78 OL_ARG_ENABLE(phonetic,[ --enable-phonetic enable phonetic/soundex], no)dnl
79 OL_ARG_ENABLE(rlookups,[ --enable-rlookups enable reverse lookups], auto)dnl
81 dnl SLAPD Backend options
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 mdbm 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(shell,[ --enable-shell enable shell backend], no)dnl
92 AC_ARG_WITH(xxslurpdoptions,[SLURPD Options:])
93 OL_ARG_ENABLE(slurpd,[ --enable-slurpd enable building slurpd], auto)dnl
95 AC_ARG_WITH(xxliboptions,[Library Generation & Linking Options])
100 dnl General "enable" options
102 if test $ol_enable_dns = yes ; then
103 if test $ol_enable_referrals = no ; then
104 AC_MSG_ERROR([DNS requires --enable-referrals])
106 if test $ol_enable_referrals = auto ; then
107 AC_MSG_WARN([DNS requires referrals, adding --enable-referrals])
108 ol_enable_referrals=yes
112 if test $ol_enable_slapd = no ; then
113 dnl SLAPD was specificallly disabled
114 if test $ol_enable_ldbm = yes ; then
115 AC_MSG_WARN([slapd disabled, ignoring --enable_ldbm argument])
117 if test $ol_enable_passwd = yes ; then
118 AC_MSG_WARN([slapd disabled, ignoring --enable_passwd argument])
120 if test $ol_enable_shell = yes ; then
121 AC_MSG_WARN([slapd disabled, ignoring --enable_shell argument])
123 if test $ol_enable_aclgroups = yes ; then
124 AC_MSG_WARN([slapd disabled, ignoring --enable_aclgroups argument])
126 if test $ol_enable_wrappers = yes ; then
127 AC_MSG_WARN([slapd disabled, ignoring --enable_wrappers argument])
129 if test $ol_enable_phonetic = yes ; then
130 AC_MSG_WARN([slapd disabled, ignoring --enable_phonetic argument])
132 if test $ol_enable_rlookups = yes ; then
133 AC_MSG_WARN([slapd disabled, ignoring --enable_rlookups argument])
135 if test $ol_with_ldbm_api != auto ; then
136 AC_MSG_WARN([slapd disabled, ignoring --with_ldbm_api argument])
138 if test $ol_with_ldbm_type != auto ; then
139 AC_MSG_WARN([slapd disabled, ignoring --with_ldbm_type argument])
141 if test $ol_enable_slurpd = yes ; then
142 AC_MSG_ERROR([slurpd requires slapd])
145 # force settings to no
149 ol_enable_aclgroups=no
150 ol_enable_wrappers=no
151 ol_enable_phonetic=no
152 ol_enable_rlookups=no
157 elif test $ol_enable_ldbm = no ; then
158 dnl SLAPD without LDBM
160 if test $ol_with_ldbm_api != auto ; then
161 AC_MSG_WARN([LDBM disabled, ignoring --with_ldbm_api argument])
164 if test $ol_with_ldbm_type != auto ; then
165 AC_MSG_WARN([LDBM disabled, ignoring --with_ldbm_type argument])
168 if test $ol_enable_passwd = no -a $ol_enable_shell = no ; then
169 AC_MSG_ERROR([slapd requires a backend])
178 if test $ol_with_ldbm_api = gdbm -a \
179 $ol_with_ldbm_type = btree ; then
180 AC_MSG_ERROR([GDBM only supports LDBM type hash])
182 if test $ol_with_ldbm_api = mdbm -a \
183 $ol_with_ldbm_type = btree ; then
184 AC_MSG_ERROR([MDBM only supports LDBM type hash])
186 if test $ol_with_ldbm_api = ndbm -a \
187 $ol_with_ldbm_type = btree ; then
188 AC_MSG_ERROR([NDBM only supports LDBM type hash])
192 if test $ol_enable_slurpd = yes ; then
193 dnl SLURPD was specifically enabled
194 if test $ol_with_threads = no ; then
195 AC_MSG_ERROR([slurpd requires threads])
225 dnl ----------------------------------------------------------------
226 dnl Checks for programs
232 AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail,
233 $PATH:/usr/libexec:/usr/lib:/usr/sbin:/usr/etc:/etc)
234 AC_PATH_PROG(EDITOR, vi, /usr/ucb/vi, $PATH:/usr/ucb)
235 AC_PATH_PROG(FINGER, finger, /usr/ucb/finger, $PATH:/usr/ucb)
237 dnl Checks the compiler and UNIX Variants
239 if test $cross_compiling = yes -a $ol_enable_x_compile = yes; then
240 AC_MSG_WARN([cross compiling.... some functionality will be removed.])
242 elif test $cross_compiling = no -a $ol_enable_x_compile = yes; then
243 AC_MSG_WARN([programs compiled here do run here...])
244 AC_MSG_ERROR([ if not cross compiling, use --disable-x-compile.])
246 elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
247 AC_MSG_WARN([programs compiled here do not run here...])
248 AC_MSG_ERROR([ if cross compiling, add --enable-x-compile.])
257 dnl BeOS requires -lbe -lroot -lnet
258 AC_CHECK_LIB(be, be_app,
259 [LIBS="$LIBS -lbe -lroot -lnet"], :,
262 dnl OpenLDAP requires STDC features
264 if test "X${am_cv_prog_cc_stdc}" = "Xno" ; then
265 AC_MSG_ERROR([OpenLDAP requires compiler to support STDC prototypes.])
270 dnl Checks for libraries
273 dnl Likely combinations:
274 dnl -lsocket [ -lnsl_s | -lnsl ]
277 AC_CHECK_FUNC(socket, [have_socket=yes], [
279 dnl hopefully we won't include too many libraries
281 AC_CHECK_LIB(socket, main)
282 AC_CHECK_LIB(net, main)
283 AC_CHECK_LIB(nsl_s, main)
284 AC_CHECK_LIB(nsl, main)
285 AC_CHECK_LIB(inet, socket)
286 AC_CHECK_LIB(gen, main)
289 dnl Check for resolver routines
290 AC_CHECK_FUNCS(res_search)
291 if test $ac_cv_func_res_search = "no" ; then
292 AC_CHECK_LIB(bind, res_search)
293 if test "$ac_cv_lib_bind_res_search" = "yes" ; then
294 AC_DEFINE(HAVE_RES_SEARCH,1)
296 AC_CHECK_LIB(resolv, res_search)
297 if test "$ac_cv_lib_resolv_res_search" = "yes" ; then
298 AC_DEFINE(HAVE_RES_SEARCH,1)
303 dnl HP-UX requires -lV3
304 AC_CHECK_LIB(V3, sigset)
308 if test $ol_enable_ldapd != no ; then
309 AC_MSG_WARN([ldapd support deprecated. Manual intervention required.])
310 dnl look for ISODE libraries
311 AC_CHECK_LIB(xtpp, main, [
313 AC_DEFINE(HAVE_XTPP,1, [define if you have -lxttp])
314 LDAPD_LIBS="$LDAPD_LIBS -lxtpp -lxtdsap -lxtisode -losi"
315 ],:,[-lxtdsap -lxtisode -losi])
316 AC_CHECK_LIB(dsap, main, [
318 AC_DEFINE(HAVE_DSAP,1, [define if you have -ldsap])
319 LDAPD_LIBS="$LDAPD_LIBS -ldsap"
321 AC_CHECK_LIB(isode, main, [
323 AC_DEFINE(HAVE_ISODE,1, [define if you have -lisode])
324 LDAPD_LIBS="$LDAPD_LIBS -lisode"
328 if test $ol_link_isode != no; then
329 AC_CHECK_LIB(pp, main, [
330 AC_DEFINE(HAVE_PP,1, [define if you have -lpp])
331 LDAPD_LIBS="-lpp $LDAPD_LIBS"
334 AC_PATH_PROG(PEPSY, pepsy)
338 dnl check for kerberos
342 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k5 ; then
343 AC_CHECK_HEADERS(kerberosIV/krb.h kerberosIV/des.h)
345 if test $ac_cv_header_kerberosIV_krb_h = yes ; then
346 AC_CHECK_LIB(krb4, main, [have_k5=yes], [have_k5=no],
349 if test $have_k5 = yes ; then
350 ol_with_kerberos=found
353 KRB_LIBS="-lkrb4 -lkrb5 -ldes425"
355 LIBS="$KRB_LIBS $LIBS"
357 AC_CACHE_CHECK([for des_debug in Kerberos libraries],
358 [ol_cv_var_des_debug], [
361 LIBS="$KRB_LIBS $LIBS"
363 #include <kerberosIV/krb.h>
364 #include <kerberosIV/des.h>
365 extern int des_debug;
368 ], ol_cv_var_des_debug=yes, ol_cv_var_des_debug=no)
373 if test $ol_cv_var_des_debug = yes ; then
374 AC_DEFINE(HAVE_DES_DEBUG,1,
375 [define if you have Kerberos des_debug])
383 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k4 ; then
384 AC_CHECK_HEADERS(krb.h des.h)
386 if test $ac_cv_header_krb_h = yes ; then
387 AC_CHECK_LIB(krb, main, [have_k4=yes], [have_k4=no], [-ldes])
389 if test $have_k4 = yes ; then
390 ol_with_kerberos=found
393 KRB_LIBS="-lkrb -ldes"
398 if test $ol_link_kerberos = yes ; then
399 AC_DEFINE(HAVE_KERBEROS, 1, [define if you have Kerberos])
403 if test $ol_with_threads = auto -o $ol_with_threads = yes \
404 -o $ol_with_threads = posix ; then
406 AC_CHECK_HEADERS(pthread.h sched.h)
408 if test $ac_cv_header_pthread_h = yes ; then
409 OL_POSIX_THREAD_VERSION
411 if test $ol_cv_pthread_version = final ; then
412 AC_DEFINE(HAVE_PTHREADS_FINAL,1,
413 [define if pthreads API compatible with final spec])
414 elif test $ol_cv_pthread_version = draft4 ; then
415 AC_DEFINE(HAVE_PTHREADS_D4,1,
416 [define if pthreads API compatible with draft4 spec])
418 AC_MSG_ERROR([unknown pthread version])
421 # consider threads found
422 ol_with_threads=found
426 if test $ol_cv_linux_threads = yes ; then
427 AC_DEFINE(HAVE_LINUX_THREADS,1,
428 [define if you have LinuxThreads])
431 dnl Now the hard part, how to link?
433 dnl currently supported checks:
435 dnl Check for no flags
436 dnl pthread_create() in $LIBS
438 dnl Check special pthread (final) flags
439 dnl pthread_create() with -kthread (FreeBSD)
440 dnl pthread_create() with -pthread (FreeBSD/Digital Unix)
441 dnl pthread_create() with -pthreads (?)
442 dnl pthread_create() with -thread (?)
443 dnl pthread_create() with -mt (Solaris)
445 dnl Check pthread (final) libraries
446 dnl pthread_mutex_unlock() in -lpthread -lmach -lexc -lc_r (OSF/1)
447 dnl pthread_mutex_lock() in -lpthread -lmach -lexc (OSF/1)
448 dnl pthread_mutex_trylock() in -lpthread -lexc (OSF/1)
449 dnl pthread_create() in -lpthread (many)
450 dnl pthread_create() in -lc_r (FreeBSD)
451 dnl pthread_create() in -lpthreads (many)
452 dnl pthread_join() -Wl,-woff,85 -lpthreads (IRIX)
453 dnl pthread_create() in HP-UX -lpthread (HP-UX 11)
455 dnl Check pthread (draft4) flags (to be depreciated)
456 dnl pthread_create() with -threads (OSF/1)
458 dnl Check pthread (final) libraries (to be depreciated)
459 dnl pthread_mutex_unlock() in -lpthreads -lmach -lexc -lc_r (OSF/1)
460 dnl pthread_mutex_lock() in -lpthreads -lmach -lexc (OSF/1)
461 dnl pthread_mutex_trylock() in -lpthreads -lexc (OSF/1)
464 dnl pthread_create in $LIBS
465 AC_CHECK_FUNC(pthread_create,[ol_link_threads=yes])
467 if test $ol_link_threads = no ; then
469 AC_CACHE_CHECK([for pthread_create with -kthread],
470 [ol_cv_kthread_flag], [
473 LIBS="-kthread $LIBS"
474 AC_TRY_LINK([#include <pthread.h>],
475 [pthread_create(NULL,NULL,NULL,NULL);],
476 [ol_cv_kthread_flag=yes], [ol_cv_kthread_flag=no])
481 if test $ol_cv_kthread_flag = yes ; then
482 LTHREAD_LIBS="$LTHREAD_LIBS -kthread"
483 ol_link_threads=posix
487 if test $ol_link_threads = no ; then
489 AC_CACHE_CHECK([for pthread_create with -pthread],
490 [ol_cv_pthread_flag], [
493 LIBS="-pthread $LIBS"
494 AC_TRY_LINK([#include <pthread.h>],
495 [pthread_create(NULL,NULL,NULL,NULL);],
496 [ol_cv_pthread_flag=yes], [ol_cv_pthread_flag=no])
501 if test $ol_cv_pthread_flag = yes ; then
502 LTHREAD_LIBS="$LTHREAD_LIBS -pthread"
503 ol_link_threads=posix
507 if test $ol_link_threads = no ; then
509 AC_CACHE_CHECK([for pthread_create with -pthreads],
510 [ol_cv_pthreads_flag], [
513 LIBS="-pthreads $LIBS"
514 AC_TRY_LINK([#include <pthread.h>],
515 [pthread_create(NULL,NULL,NULL,NULL);],
516 [ol_cv_pthreads_flag=yes], [ol_cv_pthreads_flag=no])
521 if test $ol_cv_pthreads_flag = yes ; then
522 LTHREAD_LIBS="$LTHREAD_LIBS -pthreads"
523 ol_link_threads=posix
527 if test $ol_link_threads = no ; then
529 AC_CACHE_CHECK([for pthread_create with -thread],
530 [ol_cv_thread_flag], [
534 AC_TRY_LINK([char pthread_create();],
536 [ol_cv_thread_flag=yes], [ol_cv_thread_flag=no])
541 if test $ol_cv_thread_flag = yes ; then
542 LTHREAD_LIBS="$LTHREAD_LIBS -thread"
543 ol_link_threads=posix
547 if test $ol_link_threads = no ; then
549 AC_CACHE_CHECK([for pthread_create with -mt],
550 [ol_cv_thread_flag], [
554 AC_TRY_LINK([char pthread_create();],
556 [ol_cv_thread_flag=yes], [ol_cv_thread_flag=no])
561 if test $ol_cv_thread_flag = yes ; then
562 LTHREAD_LIBS="$LTHREAD_LIBS -mt"
563 ol_link_threads=posix
567 if test $ol_link_threads = no ; then
568 dnl try DEC Threads -lpthread -lmach -lexc -lc_r
570 AC_CHECK_LIB(pthread, pthread_mutex_unlock, [
571 ol_link_threads=posix
572 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc_r"
573 if test $ol_with_yielding_select = auto ; then
574 ol_with_yielding_select=yes
576 ],:,[-lmach -lexc -lc_r])
580 if test $ol_link_threads = no ; then
581 dnl try DEC Threads -lpthread -lmach -lexc
583 AC_CHECK_LIB(pthread, pthread_mutex_lock, [
584 ol_link_threads=posix
585 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc"
586 if test $ol_with_yielding_select = auto ; then
587 ol_with_yielding_select=yes
593 if test $ol_link_threads = no ; then
594 dnl try DEC Threads -lpthread -lexc
596 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [
597 ol_link_threads=posix
598 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lexc"
599 if test $ol_with_yielding_select = auto ; then
600 ol_with_yielding_select=yes
606 if test $ol_link_threads = no ; then
609 AC_CHECK_LIB(pthread, pthread_create, [
610 ol_link_threads=posix
611 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"],:)
615 if test $ol_link_threads = no ; then
618 AC_CHECK_LIB(c_r, pthread_create, [
619 ol_link_threads=posix
620 LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"],:)
624 if test $ol_link_threads = no ; then
627 AC_CHECK_LIB(pthreads, pthread_create, [
628 ol_link_threads=posix
629 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"],:)
633 dnl IRIX Pthread check
634 if test $ol_link_threads = no ; then
635 dnl try IRIX Pthreads -Wl,-woff,85 -lpthreads
637 AC_CHECK_LIB(pthreads, pthread_join, [
638 ol_link_threads=posix
639 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"
644 dnl HP-UX 11 Pthread check
645 if test $ol_link_threads = no; then
647 LIBS="$LIBS -lpthread"
648 AC_MSG_CHECKING([for pthread_create() in HP-UX -lpthread])
649 ol_try_pthread_hpux_11=no
650 AC_CACHE_VAL(ol_cv_pthread_hpux_11,[
654 #ifndef ELFABI_HPUX_REL11
657 ], [pthread_create(NULL, NULL, NULL, NULL);],
658 ol_try_pthread_hpux_11=yes
659 ol_cv_pthread_hpux_11=yes,
660 ol_cv_pthread_hpux_11=no)])
664 if test $ol_cv_pthread_hpux_11=yes ; then
665 ol_link_threads=posix
666 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"
667 if test $ol_try_pthread_hpux_11=yes ; then
668 dnl Some tests below may fail, cause we aint including
669 dnl pthread.h. Force appropriate ones to yes
670 ac_cv_func_pthread_attr_init=yes
675 if test $ol_link_threads = no ; then
677 AC_CACHE_CHECK([for pthread_create with -threads],
678 [ol_cv_thread_flag], [
681 LIBS="-threads $LIBS"
682 AC_TRY_LINK([char pthread_create();],[
684 ], ol_cv_thread_flag=yes, ol_cv_thread_flag=no)
689 if test $ol_cv_thread_flag = yes ; then
690 LTHREAD_LIBS="$LTHREAD_LIBS -threads"
691 ol_link_threads=posix
695 if test $ol_link_threads = no ; then
696 dnl try DEC Threads -lpthreads -lmach -lexc -lc_r
698 AC_CHECK_LIB(pthreads, pthread_mutex_unlock, [
699 ol_link_threads=posix
700 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r"
701 if test $ol_with_yielding_select = auto ; then
702 ol_with_yielding_select=yes
704 ],:,[-lmach -lexc -lc_r])
708 if test $ol_link_threads = no ; then
709 dnl try DEC Threads -lpthreads -lmach -lexc
711 AC_CHECK_LIB(pthreads, pthread_mutex_lock, [
712 ol_link_threads=posix
713 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc"
714 if test $ol_with_yielding_select = auto ; then
715 ol_with_yielding_select=yes
721 if test $ol_link_threads = no ; then
722 dnl try DEC Threads -lpthreads -lexc
724 AC_CHECK_LIB(pthreads, pthread_mutex_trylock, [
725 ol_link_threads=posix
726 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lexc"
727 if test $ol_with_yielding_select = auto ; then
728 ol_with_yielding_select=yes
734 if test $ol_link_threads != no ; then
735 AC_DEFINE(HAVE_PTHREADS,1,
736 [define if you have POSIX Threads])
739 save_CPPFLAGS="$CPPFLAGS"
741 LIBS="$LTHREAD_LIBS $LIBS"
743 dnl All POSIX Thread (final) implementations should have
744 dnl sched_yield instead of pthread yield.
746 AC_CHECK_FUNCS(sched_yield pthread_yield)
748 if test $ac_cv_func_sched_yield = no -a \
749 $ac_cv_func_pthread_yield = no ; then
750 dnl Digital UNIX has sched_yield() in -lrt
751 AC_CHECK_LIB(rt, sched_yield,
752 [LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
753 AC_DEFINE(HAVE_SCHED_YIELD,1)
754 ac_cv_func_sched_yield=yes],
755 [ac_cv_func_sched_yield=no])
757 if test $ac_cv_func_sched_yield = no -a \
758 $ac_cv_func_pthread_yield = no ; then
759 dnl Solaris has sched_yield() in -lposix4
760 dnl but we'll use thr_yield instead.
761 AC_CHECK_FUNCS(thr_yield)
763 if test $ac_cv_func_sched_yield = no -a \
764 $ac_cv_func_pthread_yield = no -a \
765 "$ac_cv_func_thr_yield" = no ; then
766 AC_MSG_WARN([could not locate sched_yield() or pthread_yield()])
769 dnl Check functions for compatibility
770 AC_CHECK_FUNCS(pthread_kill)
772 dnl Check for pthread_detach with <pthread.h> inclusion
773 dnl as it's symbol may have been mangled.
774 AC_CACHE_CHECK([for pthread_detach with <pthread.h>],
775 [ol_cv_func_pthread_detach], [
777 AC_TRY_LINK([#include <pthread.h>],
778 [pthread_detach(NULL);],
779 [ol_cv_func_pthread_detach=yes],
780 [ol_cv_func_pthread_detach=no])
783 if test $ol_cv_func_pthread_detach = no ; then
784 AC_MSG_ERROR([could not locate pthread_detach()])
787 AC_DEFINE(HAVE_PTHREAD_DETACH,1,
788 [define if you have pthread_detach function])
790 dnl Check for setconcurreny functions
792 pthread_setconcurrency \
793 pthread_getconcurrency \
798 AC_MSG_CHECKING([if pthread_create() works])
799 AC_CACHE_VAL(ol_cv_pthread_create_works,[
803 #define NULL (void*)0
809 return (void *) (p == NULL);
817 exit(pthread_create(&t, NULL, task, NULL));
820 [ol_cv_pthread_create_works=yes],
821 [ol_cv_pthread_create_works=no],
823 ol_cv_pthread_create_works=yes])])
824 AC_MSG_RESULT($ol_cv_pthread_create_works)
826 if test $ol_cv_pthread_create_works = no ; then
827 AC_MSG_ERROR([pthread.h and pthread_create are not compatible])
830 dnl Check if select causes an yield
831 if test $ol_with_yielding_select = auto ; then
832 AC_MSG_CHECKING([if select yields when using pthreads])
833 AC_CACHE_VAL(ol_cv_pthread_select_yields,[
835 #include <sys/types.h>
836 #include <sys/time.h>
840 #define NULL (void*) 0
843 static int fildes[2];
857 FD_SET(fildes[0], &rfds);
859 /* we're not interested in any fds */
860 i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
867 exit(0); /* if we exit here, the select blocked the whole process */
876 /* create a pipe to select */
877 if(pipe(&fildes[0])) {
882 #ifdef HAVE_PTHREAD_SETCONCURRENCY
883 (void) pthread_setconcurrency(2);
885 #ifdef HAVE_THR_SETCONCURRENCY
886 /* Set Solaris LWP concurrency to 2 */
887 thr_setconcurrency(2);
891 pthread_create(&t, NULL, task, NULL);
894 sched_yield(); /* make sure task runs first */
896 #ifdef HAVE_PTHREAD_YIELD
897 pthread_yield(); /* make sure task runs first */
903 [ol_cv_pthread_select_yields=no],
904 [ol_cv_pthread_select_yields=yes], [
905 AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])])])
906 AC_MSG_RESULT($ol_cv_pthread_select_yields)
908 if test $ol_cv_pthread_select_yields = yes ; then
909 ol_with_yielding_select=yes
914 CPPFLAGS="$save_CPPFLAGS"
917 AC_MSG_ERROR([could not link with POSIX Threads])
921 if test $ol_with_threads = posix ; then
922 AC_MSG_ERROR([could not locate POSIX Threads])
926 if test $ol_with_threads = auto -o $ol_with_threads = yes \
927 -o $ol_with_threads = mach ; then
929 dnl check for Mach CThreads
930 AC_CHECK_HEADERS(mach/cthreads.h)
931 if test $ac_cv_header_mach_cthreads_h = yes ; then
932 ol_with_threads=found
934 dnl check for cthread support in current $LIBS
935 AC_CHECK_FUNC(cthread_fork,[ol_link_threads=yes])
937 if test $ol_link_threads = no ; then
939 dnl this test needs work
940 AC_CACHE_CHECK([for cthread_fork with -all_load],
941 [ol_cv_cthread_all_load], [
944 LIBS="-all_load $LIBS"
945 AC_TRY_LINK([#include <mach/cthreads.h>],[
946 cthread_fork((void *)0, (void *)0);
947 ], ol_cv_cthread_all_load=yes, ol_cv_cthread_all_load=no)
952 if test $ol_cv_cthread_all_load = yes ; then
953 LTHREAD_LIBS="$LTHREAD_LIBS -all_load"
958 if test $ol_link_threads != no ; then
959 : check for cthread specific functionality here
960 AC_DEFINE(HAVE_MACH_CTHREADS,1,
961 [define if you have Mach Cthreads])
963 AC_MSG_ERROR([could not link with Mach CThreads])
967 if test $ol_with_threads = mach ; then
968 AC_MSG_ERROR([could not locate Mach CThreads])
972 if test $ol_with_threads = auto -o $ol_with_threads = yes \
973 -o $ol_with_threads = lwp ; then
975 dnl check for SunOS5 LWP
976 AC_CHECK_HEADERS(thread.h synch.h)
977 if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
978 AC_CHECK_LIB(thread, thr_create, [have_thr=yes], [have_thr=no])
980 if test $have_thr = yes ; then
981 AC_DEFINE(HAVE_THR,1,
982 [if you have Solaris LWP (thr) package])
983 LTHREAD_LIBS="$LTHREAD_LIBS -lthread"
986 if test $ol_with_yielding_select = auto ; then
987 ol_with_yielding_select=yes
990 dnl Check for setconcurreny functions
998 dnl check for SunOS4 LWP
999 AC_CHECK_HEADERS(lwp/lwp.h)
1000 if test $ac_cv_header_lwp_lwp_h = yes ; then
1001 AC_CHECK_LIB(lwp, lwp_create, [have_lwp=yes], [have_lwp=no])
1003 if test $have_lwp = yes ; then
1004 AC_DEFINE(HAVE_LWP,1,
1005 [if you have SunOS LWP package])
1006 LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
1009 if test $ol_with_yielding_select = auto ; then
1010 ol_with_yielding_select=no
1016 if test $ol_with_yielding_select = yes ; then
1017 AC_DEFINE(HAVE_YIELDING_SELECT,1,
1018 [define if select implicitly yields])
1021 if test $ol_with_threads = manual ; then
1022 dnl User thinks he can manually configure threads.
1025 AC_MSG_WARN([thread defines and link options must be set manually])
1027 AC_CHECK_HEADERS(pthread.h sched.h)
1028 AC_CHECK_FUNCS(sched_yield pthread_yield)
1031 AC_CHECK_HEADERS(mach/cthreads.h)
1032 AC_CHECK_HEADERS(lwp/lwp.h)
1033 AC_CHECK_HEADERS(thread.h synch.h)
1036 if test $ol_link_threads != no ; then
1037 dnl needed to get reentrant/threadsafe versions
1039 AC_DEFINE(REENTRANT,1)
1040 AC_DEFINE(_REENTRANT,1)
1041 AC_DEFINE(THREAD_SAFE,1)
1042 AC_DEFINE(_THREAD_SAFE,1)
1043 AC_DEFINE(THREADSAFE,1)
1044 AC_DEFINE(_THREADSAFE,1)
1045 AC_DEFINE(_SGI_MP_SOURCE,1)
1047 dnl this might cause the errno symbol to be
1048 dnl replaced with a function to get a thread specific errno.
1049 dnl check to see if everything needs to be compiled
1050 dnl with the thread libraries
1051 AC_CACHE_CHECK([for thread specific errno],
1052 [ol_cv_errno_thread_specific], [
1053 AC_TRY_LINK([#include <errno.h>], [int x = errno;],
1054 [ol_cv_errno_thread_specific=yes],
1055 [ol_cv_errno_thread_specific=no])
1058 if test $ol_cv_errno_thread_specific != yes ; then
1059 LIBS="$LTHREAD_LIBS $LIBS"
1064 dnl ----------------------------------------------------------------
1066 if test $ol_link_threads = no ; then
1067 if test $ol_with_threads = yes ; then
1068 AC_MSG_ERROR([no suitable thread support])
1071 if test $ol_with_threads = auto ; then
1072 AC_MSG_WARN([no suitable thread support, disabling threads])
1076 AC_DEFINE(NO_THREADS,1,
1077 [define if you have (or want) no threads])
1082 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then
1085 if test $ol_cv_berkeley_db2 = yes ; then
1087 ol_with_ldbm_api=db2
1089 if test $ol_with_ldbm_type = hash ; then
1090 AC_DEFINE(LDBM_USE_DBHASH,1)
1092 AC_DEFINE(LDBM_USE_DBBTREE,1)
1095 dnl $ol_cv_lib_db2 should be yes or -ldb
1096 dnl (it could be no, but that would be an error
1097 if test $ol_cv_lib_db2 != yes ; then
1098 LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db2"
1103 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then
1106 if test $ol_cv_berkeley_db = yes ; then
1110 if test $ol_with_ldbm_type = hash ; then
1111 AC_DEFINE(LDBM_USE_DBHASH,1)
1113 AC_DEFINE(LDBM_USE_DBBTREE,1)
1116 dnl $ol_cv_lib_db should be yes or -ldb
1117 dnl (it could be no, but that would be an error
1118 if test $ol_cv_lib_db != yes ; then
1119 LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db"
1124 if test $ol_with_ldbm_api = manual ; then
1125 dnl User thinks he can manually configure LDBM api.
1128 AC_MSG_WARN([LDBM defines and link options must be set manually])
1130 AC_CHECK_HEADERS(db.h db_185.h gdbm.h ndbm.h)
1133 if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
1134 AC_MSG_WARN(Could not find LDBM with BTREE support)
1135 ol_with_ldbm_api=none
1138 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
1141 if test $ol_cv_gdbm = yes ; then
1143 ol_with_ldbm_api=gdbm
1145 if test $ol_cv_lib_gdbm != yes ; then
1146 LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_gdbm"
1151 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = mdbm ; then
1154 if test $ol_cv_mdbm = yes ; then
1156 ol_with_ldbm_api=mdbm
1157 if test $ol_cv_lib_mdbm != yes ; then
1158 LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_mdbm"
1163 if test $ol_with_ldbm_api = auto ; then
1164 AC_MSG_WARN([skipping automatic checking for NDBM, must be manually enabled.])
1165 elif test $ol_with_ldbm_api = ndbm ; then
1168 if test $ol_cv_ndbm = yes ; then
1170 ol_with_ldbm_api=ndbm
1172 if test $ol_cv_lib_ndbm != yes ; then
1173 LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_ndbm"
1178 if test $ol_link_ldbm = no -a $ol_enable_ldbm != no ; then
1179 AC_MSG_WARN(could not find suitable LDBM backend)
1180 if test $ol_enable_ldbm = yes ; then
1181 AC_MSG_ERROR(select appropriate LDBM options or disable)
1184 AC_MSG_WARN(disabling LDBM)
1188 if test $ol_enable_wrappers != no ; then
1189 AC_CHECK_HEADERS(tcpd.h)
1191 if test $ac_cv_header_tcpd_h != yes ; then
1195 int allow_severity = 0;
1196 int deny_severity = 0;
1197 ],[hosts_access()],[have_wrappers=yes],[have_wrappers=no])
1200 if test $have_wrappers = yes ; then
1201 AC_DEFINE(HAVE_TCPD,1, [define if you have -lwrap])
1204 dnl We add another check for -lnsl since some libwrap's
1205 dnl need it, but it isn't always included from above
1206 AC_CHECK_LIB(nsl, main)
1208 AC_MSG_WARN(could not find -lwrap)
1209 if test $ol_enable_wrappers = yes ; then
1210 AC_MSG_ERROR(could not find wrappers, select appropriate options or disable)
1213 AC_MSG_WARN(disabling wrappers support)
1214 ol_enable_wrappers=no
1219 if test $ol_enable_dmalloc != no ; then
1220 AC_CHECK_HEADERS(dmalloc.h)
1221 AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
1224 # ud needs termcap (should insert check here)
1226 AC_CHECK_HEADERS(termcap.h ncurses.h)
1228 if test $ol_link_termcap = no ; then
1229 AC_CHECK_LIB(termcap, tputs, [have_termcap=yes], [have_termcap=no])
1230 if test $have_termcap = yes ; then
1231 AC_DEFINE(HAVE_TERMCAP, 1, [define if you have -ltermcap])
1233 TERMCAP_LIBS=-ltermcap
1237 if test $ol_link_termcap = no ; then
1238 AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
1239 if test $have_ncurses = yes ; then
1240 AC_DEFINE(HAVE_NCURSES, 1, [define if you have -lncurses])
1242 TERMCAP_LIBS=-lncurses
1246 if test $ol_link_termcap = no ; then
1247 AC_DEFINE(NO_TERMCAP,1, [define if you have no termcap support])
1251 # FreeBSD (and others) have crypt(3) in -lcrypt
1252 if test $ol_enable_crypt != no ; then
1253 AC_CHECK_FUNC(crypt, [have_crypt=yes], [
1254 AC_CHECK_LIB(crypt, crypt, [LUTIL_LIBS="$LUTIL_LIBS -lcrypt"
1255 have_crypt=yes], [have_crypt=no])])
1257 if test $have_crypt = yes ; then
1258 AC_DEFINE(HAVE_CRYPT,1)
1260 AC_MSG_WARN(could not find crypt)
1261 if test $ol_enable_crypt = yes ; then
1262 AC_MSG_ERROR(could not find crypt, select appropriate options or disable)
1265 AC_MSG_WARN(disabling crypt support)
1270 # FreeBSD (and others) have setproctitle(3) in -lutil
1271 if test $ol_enable_proctitle != no ; then
1272 AC_CHECK_FUNC(setproctitle, [have_setproctitle=yes], [
1273 AC_CHECK_LIB(util, setproctitle,
1274 [have_setproctitle=yes
1275 LUTIL_LIBS="$LUTIL_LIBS -lutil"],
1276 [have_setproctitle=no
1277 LIBOBJS="$LIBOBJS setproctitle.o"])])
1279 if test $have_setproctitle = yes ; then
1280 AC_DEFINE(HAVE_SETPROCTITLE,1)
1284 dnl ----------------------------------------------------------------
1285 dnl Checks for header files.
1288 if test $ac_cv_header_stdc != yes; then
1289 AC_MSG_WARN([could not Standard C compliant headers])
1294 AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
1295 if test $am_cv_sys_posix_termios = yes ; then
1296 AC_DEFINE(HAVE_POSIX_TERMIOS,1,
1297 [define if you have POSIX termios])
1337 dnl ----------------------------------------------------------------
1338 dnl Checks for typedefs, structures, and compiler characteristics.
1339 AC_TYPE_GETGROUPS dnl requires AC_TYPE_UID_T
1346 AC_STRUCT_ST_BLKSIZE
1353 if test $cross_compiling = yes ; then
1354 AC_DEFINE(CROSS_COMPILING, 1, [define if cross compiling])
1357 AC_CHECK_SIZEOF(short)
1358 AC_CHECK_SIZEOF(int)
1359 AC_CHECK_SIZEOF(long)
1362 dnl ----------------------------------------------------------------
1363 dnl Checks for library functions.
1365 dnl AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h
1370 if test $ac_cv_func_vprintf = yes ; then
1371 dnl check for vsnprintf
1372 AC_CHECK_FUNCS(vsnprintf vsprintf)
1406 dnl We actually may need to replace more than this.
1407 AC_REPLACE_FUNCS(getopt strdup tempnam)
1409 dnl ----------------------------------------------------------------
1410 # Check Configuration
1413 dnl ----------------------------------------------------------------
1414 dnl Sort out defines
1416 if test "$ol_enable_debug" != no ; then
1417 AC_DEFINE(LDAP_DEBUG,1)
1419 if test "$ol_enable_libui" = yes ; then
1420 AC_DEFINE(LDAP_LIBUI,1)
1422 if test "$ol_enable_cache" = no ; then
1423 AC_DEFINE(LDAP_NOCACHE,1)
1425 if test "$ol_enable_dns" != no ; then
1426 AC_DEFINE(LDAP_DNS,1)
1428 if test "$ol_enable_proctitle" != no ; then
1429 AC_DEFINE(LDAP_PROCTITLE,1)
1431 if test "$ol_enable_referrals" != no ; then
1432 AC_DEFINE(LDAP_REFERRALS,1)
1434 if test "$ol_enable_cldap" != no ; then
1435 AC_DEFINE(LDAP_CONNECTIONLESS,1)
1438 if test "$ol_enable_aclgroups" != no ; then
1439 AC_DEFINE(SLAPD_ACLGROUPS,1)
1441 if test "$ol_enable_crypt" != no ; then
1442 AC_DEFINE(SLAPD_CRYPT,1)
1444 if test "$ol_enable_cleartext" != no ; then
1445 AC_DEFINE(SLAPD_CLEARTEXT,1)
1447 if test "$ol_enable_phonetic" != no ; then
1448 AC_DEFINE(SLAPD_PHONETIC,1)
1450 if test "$ol_enable_rlookups" != no ; then
1451 AC_DEFINE(SLAPD_RLOOKUPS,1)
1454 if test "$ol_link_ldbm" != no ; then
1455 AC_DEFINE(SLAPD_LDBM,1)
1460 if test "$ol_enable_passwd" != no ; then
1461 AC_DEFINE(SLAPD_PASSWD,1)
1466 if test "$ol_enable_shell" != no ; then
1467 AC_DEFINE(SLAPD_SHELL,1)
1472 if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
1473 $BUILD_SLAPD = yes ; then
1477 if test "$ol_link_isode" != no ; then
1481 dnl ----------------------------------------------------------------
1483 AC_SUBST(BUILD_LDAPD)
1484 AC_SUBST(BUILD_SLAPD)
1485 AC_SUBST(BUILD_LDBM)
1486 AC_SUBST(BUILD_PASSWD)
1487 AC_SUBST(BUILD_SHELL)
1488 AC_SUBST(BUILD_SLURPD)
1491 AC_SUBST(LDAPD_LIBS)
1492 AC_SUBST(SLAPD_LIBS)
1493 AC_SUBST(SLURPD_LIBS)
1495 AC_SUBST(LTHREAD_LIBS)
1496 AC_SUBST(LUTIL_LIBS)
1499 AC_SUBST(TERMCAP_LIBS)
1501 dnl ----------------------------------------------------------------
1506 Makefile:build/top.mk:Makefile.in:build/dir.mk \
1507 doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \
1508 doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk \
1509 doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk \
1510 doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk \
1511 doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk \
1512 doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk \
1513 clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
1514 clients/finger/Makefile:build/top.mk:clients/finger/Makefile.in:build/rules.mk \
1515 clients/fax500/Makefile:build/top.mk:clients/fax500/Makefile.in:build/rules.mk \
1516 clients/gopher/Makefile:build/top.mk:clients/gopher/Makefile.in:build/rules.mk \
1517 clients/mail500/Makefile:build/top.mk:clients/mail500/Makefile.in:build/rules.mk \
1518 clients/rcpt500/Makefile:build/top.mk:clients/rcpt500/Makefile.in:build/rules.mk \
1519 clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
1520 clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk \
1521 include/Makefile:build/top.mk:include/Makefile.in \
1522 libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk \
1523 libraries/libavl/Makefile:build/top.mk:libraries/libavl/Makefile.in:build/lib.mk:build/lib-static.mk \
1524 libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk \
1525 libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk \
1526 libraries/libldbm/Makefile:build/top.mk:libraries/libldbm/Makefile.in:build/lib.mk:build/lib-static.mk \
1527 libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.mk:build/lib-static.mk \
1528 libraries/liblthread/Makefile:build/top.mk:libraries/liblthread/Makefile.in:build/lib.mk:build/lib-static.mk \
1529 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk \
1530 servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk \
1531 servers/ldapd/Makefile:build/top.mk:servers/ldapd/Makefile.in:build/srv.mk \
1532 servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk \
1533 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/srv.mk \
1534 servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/srv.mk \
1535 servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/srv.mk \
1536 servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
1537 servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
1538 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
1539 tests/Makefile:build/top.mk:tests/Makefile.in \
1542 echo Please \"make depend\" to build dependencies