1 dnl Copyright 1998 The OpenLDAP Foundation. All Rights Reserved.
3 dnl Redistribution and use in source and binary forms are permitted only
4 dnl as authorized by the OpenLDAP Public License. A copy of this
5 dnl license is available at http://www.OpenLDAP.org/license.html or
6 dnl in file LICENSE in the top-level directory of the distribution.
8 dnl Configure.in for OpenLDAP
10 AC_INIT(include/ldap.h)
13 AC_PREREQ(2.10)dnl Required Autoconf version
14 dnl Do not use AutoConf 2.12; it produces a configuration script
15 dnl that causes an "internal 2K buffer" error on HPUX when run
16 dnl with /bin/sh. Autoconf 2.10 seems to be okay.
17 AC_CONFIG_AUX_DIR(build)
18 AC_CONFIG_HEADER(include/portable.h)dnl
21 AC_MSG_CHECKING(arguments)
22 AC_PREFIX_DEFAULT(/usr/local)
24 dnl General "enable" options
25 CF_ARG_OPTION(debug,[ --enable-debug enable debugging (yes)],[
26 LDAP_DEBUG=no],[LDAP_DEBUG=yes],yes)dnl
27 CF_ARG_OPTION(libui,[ --enable-libui enable library user interface (yes)],[
28 LDAP_LIBUI=no],[LDAP_LIBUI=yes],yes)dnl
29 CF_ARG_OPTION(cache,[ --enable-cache enable caching (yes)],[
30 LDAP_CACHE=no],[LDAP_CACHE=yes],yes)dnl
31 CF_ARG_OPTION(referrals,[ --enable-referrals enable referrals (yes)],[
32 LDAP_REFERRALS=no],[LDAP_REFERRALS=yes],yes)dnl
34 CF_ARG_OPTION(cldap,[ --enable-clapd enable connectionless ldap (no)],[
35 LDAP_CLDAP=yes],[LDAP_CLDAP=no],no)dnl
37 dnl General "with" options
38 AC_ARG_WITH(kerberos,[ --with-kerberos use Kerberos (no)],[
39 opt_kerberos=yes],[opt_kerberos=no])
40 AC_ARG_WITH(kerberos-afs,[ --with-kerberos-afs use AFS Kerberos (no)],[
41 opt_kerberos_afs=yes],[opt_kerberos_afs=no])
42 AC_ARG_WITH(threads,[ --with-threads use threads (yes)],[
43 opt_threads=yes],[opt_threads=no])
48 CF_ARG_OPTION(ldapd,[ --enable-ldapd enable building ldapd (no)],[
49 BUILD_LDAPD=yes],[BUILD_LDAPD=no],no)dnl
52 CF_ARG_OPTION(slapd,[ --enable-slapd enable building slapd (yes)],[
53 BUILD_SLAPD=no],[BUILD_SLAPD=yes],yes)dnl
54 CF_ARG_OPTION(aclgroup,[ --enable-aclgroup enable ACL group support (yes)],[
55 SLAPD_ACLGROUP=no],[SLAPD_ALCGROUP=yes],yes)dnl
56 CF_ARG_OPTION(crypt,[ --enable-crypt enable crypt(3) passwords (yes)],[
57 SLAPD_CRYPT=no],[SLAPD_CRYPT=yes],yes)dnl
58 CF_ARG_OPTION(md5,[ --enable-md5 enable MD5 passwords (yes)],[
59 SLAPD_MD5=no],[SLAPD_MD5=yes],yes)dnl
60 CF_ARG_OPTION(sha1,[ --enable-sha1 enable SHA1 passwords (yes)],[
61 SLAPD_SHA1=no],[SLAPD_SHA1=yes],yes)dnl
62 CF_ARG_OPTION(wrappers,[ --enable-wrappers enable tcp wrapper support (no)],[
63 SLAPD_TCP_WRAPPERS=yes],[SLAPD_TCP_WRAPPERS=no],no)dnl
64 CF_ARG_OPTION(phonetic,[ --enable-phonetic enable phonetic/soundex (no)],[
65 SLAPD_PHONETIC=yes],[SLAPD_PHONETIC=no],no)dnl
66 CF_ARG_OPTION(rlookups,[ --enable-rlookups enable reverse lookups (yes)],[
67 SLAPD_RLOOKUP=no],[SLAPD_RLOOKUP=yes],yes)dnl
69 dnl SLAPD Backend options
70 CF_ARG_OPTION(ldbm,[ --enable-ldbm enable ldbm backend (yes)],[
71 SLAPD_LDBM=no],[SLAPD_LDBM=yes],yes)dnl
72 CF_ARG_OPTION(passwd,[ --enable-passwd enable passwd backend (yes)],[
73 SLAPD_PASSWD=no],[SLAPD_PASSWD=yes],yes)dnl
74 CF_ARG_OPTION(shell,[ --enable-shell enable shell backend (yes)],[
75 SLAPD_SHELL=no],[SLAPD_SHELL=yes],yes)dnl
77 AC_ARG_WITH(ndbm,[ --with-ndbm use NDB for LDBM backend (any)],[
78 opt_ndbm=yes],[opt_ndbm=no])
79 AC_ARG_WITH(gdbm,[ --with-gdbm use GDBM for LDBM backend (any)],[
80 opt_gdbm=yes],[opt_gdbm=no])
81 AC_ARG_WITH(dbhash,[ --with-dbhash use Berkeley DB Hash for LDBM backend (any)],[
82 opt_dbhash=yes],[opt_dbhash=no])
83 AC_ARG_WITH(dbbtree,[ --with-dbbtree use Berkeley DB Btrees for LDBM backend (any)],[
84 opt_dbbtree=yes],[opt_dbbtree=no])
85 AC_ARG_WITH(db2,[ --with-db2 use Berkeley DB2 API (any)],[
86 opt_db2=yes],[opt_db2=no])
89 CF_ARG_OPTION(slurpd,[ --enable-slurpd enable building slurpd (yes)],[
90 BUILD_SLURPD=no],[BUILD_SLURPD=yes],yes)dnl
94 AC_MSG_CHECKING(LDBM preferences)
97 if test "$opt_ndbm" = yes ; then
100 if test "$opt_gdbm" = yes ; then
103 if test "$opt_dbhash" = yes ; then
106 if test "$opt_dbbtree" = yes ; then
109 AC_MSG_RESULT($ldbm_prefer)
111 if test "$BUILD_SLAPD" != "yes" ; then
119 ## general LDAP arguments
123 if test "$LDAP_DEBUG" = "yes" ; then
124 LDAP_DEFS="$LDAP_DEFS -DLDAP_DEBUG"
126 if test "$LDAP_REFERRALS" = "yes" ; then
127 AC_DEFINE(LDAP_REFERRALS,1)
128 LDAP_DEFS="$LDAP_DEFS -DLDAP_REFERRALS"
130 if test "$LDAP_CACHE" = "no" ; then
131 AC_DEFINE(LDAP_NOCACHE,1)
132 LDAP_DEFS="$LDAP_DEFS -DNO_CACHE"
134 if test "$LDAP_CLDAP" = "yes" ; then
135 AC_DEFINE(LDAP_CONNECTIONLESS,1)
136 LDAP_DEFS="$LDAP_DEFS -DCLDAP"
147 if test "$SLAPD_PHONETIC" = "yes" ; then
148 AC_DEFINE(SLAPD_PHONETIC,1)
149 SLAPD_DEFS="$SLAPD_DEFS -DSOUNDEX"
152 if test "$SLAPD_MD5" = "yes" ; then
153 dnl AC_DEFINE(SLAPD_MD5,1)
154 LUTIL_DEFS="$LUTIL_DEFS -DLDAP_MD5"
157 if test "$SLAPD_SHA1" = "yes" ; then
158 dnl AC_DEFINE(SLAPD_SHA1,1)
159 LUTIL_DEFS="$LUTIL_DEFS -DLDAP_SHA1"
162 if test "$SLAPD_LDBM" = "yes" ; then
163 dnl AC_DEFINE(SLAPD_LDBM,1)
164 SLAPD_DEFS="$SLAPD_DEFS -DLDAP_LDBM"
166 if test "$SLAPD_PASSWD" = "yes" ; then
167 dnl AC_DEFINE(SLAPD_PASSWD,1)
168 SLAPD_DEFS="$SLAPD_DEFS -DLDAP_PASSWD"
170 if test "$SLAPD_SHELL" = "yes" ; then
171 dnl AC_DEFINE(SLAPD_SHELL,1)
172 SLAPD_DEFS="$SLAPD_DEFS -DLDAP_SHELL"
181 dnl ----------------------------------------------------------------
182 dnl Checks for programs
184 AC_PROG_GCC_TRADITIONAL
191 AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail,
192 $PATH:/usr/libexec:/usr/lib:/usr/sbin:/usr/etc:/etc)
193 AC_PATH_PROG(EDITOR, vi, /usr/ucb/vi, $PATH:/usr/ucb)
194 AC_PATH_PROG(FINGER, finger, /usr/ucb/finger, $PATH:/usr/ucb)
196 dnl ----------------------------------------------------------------
197 dnl Checks for libraries
200 if test "$opt_thread" = "no" ; then
201 LTHREAD_DEFS="-DNO_THREADS"
204 AC_CHECK_HEADERS(pthread.h sched.h)
206 if test "$ac_cv_header_pthread_h" = yes ; then
207 dnl We have some form of pthreads
208 AC_MSG_CHECKING(POSIX thread version)
209 AC_CACHE_VAL(cf_cv_pthread_version,[
212 /* this check could be improved */
213 #ifdef PTHREAD_ONCE_INIT
216 ], pthread_final=yes, pthread_final=no)
218 AC_EGREP_CPP(draft4,[
220 /* this check could be improved */
221 #ifdef pthread_once_init
224 ], pthread_draft4=yes, pthread_draft4=no)
226 if test $pthread_final = yes -a $pthread_draft4 = no; then
227 cf_cv_pthread_version=final
228 elif test $pthread_final = no -a $pthread_draft4 = yes; then
229 cf_cv_pthread_version=draft4
231 cf_cv_pthread_version=unknown
234 AC_MSG_RESULT($cf_cv_pthread_version)
236 if test $cf_cv_pthread_version = final ; then
237 LTHREAD_DEFS="$LTHREAD_DEFS -DPOSIX_THREADS"
238 elif test $cf_cv_pthread_version = draft4 ; then
239 LTHREAD_DEFS="$LTHREAD_DEFS -DTHREAD_MIT_PTHREADS"
241 AC_MSG_ERROR(unknown pthread version)
244 LTHREAD_DEFS="-DNO_THREADS"
253 if test "$SLAPD_LDBM" = "yes" ; then
254 if test $ldbm_prefer = any -o $ldbm_prefer = dbbtree \
255 -o $ldbm_prefer = dbhash ; then
256 AC_CHECK_FUNC(dbopen,[
257 ldbm_use=$ldbm_prefer
259 AC_CHECK_LIB(db,dbopen,[
260 ldbm_use=$ldbm_prefer
262 LDBM_LIBS="$LDBM_LIBS -ldb"
266 if test $ldbm_prefer = found ; then
267 if test $ldbm_use = dbhash ; then
268 dnl AC_DEFINE(LDBM_USE_DBHASH,1)
269 LDBM_DEFS="$LDBM_DEFS -DLDBM_USE_DBHASH"
271 dnl AC_DEFINE(LDBM_USE_DBBTREE,1)
272 LDBM_DEFS="$LDBM_DEFS -DLDBM_USE_DBBTREE"
276 AC_MSG_CHECKING(for db2)
277 AC_CACHE_VAL(cf_cv_db2,[
278 AC_EGREP_CPP(__db_version_2,[
280 /* this check could be improved */
281 #ifdef DB_VERSION_MAJOR
282 #if DB_VERSION_MAJOR == 2
286 ], cf_cv_db2=yes, cf_cv_db2=no)])
287 AC_MSG_RESULT($cf_cv_db2)
289 if test $cf_cv_db2 = yes ; then
290 if test $opt_db2 = yes ; then
291 LDBM_DEFS="$LDBM_DEFS -DLDBM_USE_DB2"
293 AC_CHECK_HEADERS(db_185.h)
294 if test $ac_cv_header_db_185_h = no ; then
295 AC_MSG_ERROR([select --with-db2 or install db2 with 1.85 compatibility])
298 LDBM_DEFS="$LDBM_DEFS -DLDBM_USE_DB2_COMPAT185"
301 if test $opt_db2 = yes ; then
302 AC_MSG_ERROR(could not local DB2)
307 if test $ldbm_prefer = any -o $ldbm_prefer = gdbm ; then
308 AC_CHECK_LIB(gdbm, gdbm_open,[
309 ldbm_use=$ldbm_prefer
311 LDBM_LIBS="$LDBM_LIBS -lgdbm"
312 dnl AC_DEFINE(LDBM_USE_GDBM,1)
313 LDBM_DEFS="$LDBM_DEFS -DLDBM_USE_GDBM"
316 if test $ldbm_prefer = any -o $ldbm_prefer = ndbm ; then
317 AC_CHECK_LIB(dbm,dbm_open,[
320 LDBM_LIBS="$LDBM_LIBS -ldbm"
321 dnl AC_DEFINE(LDBM_USE_NDBM,1)
322 LDBM_DEFS="$LDBM_DEFS -DLDBM_USE_NDBM"
326 if test $ldbm_prefer != found ; then
327 AC_MSG_ERROR(could not find suitable db for $ldbm_prefer backend)
330 if test $ldbm_use = ndbm ; then
331 AC_MSG_WARN(LDBM using NDBM, functionality will be limited)
335 if test "$SLAPD_TCP_WRAPPERS" = "yes" ; then
336 AC_CHECK_LIB(wrap, hosts_access, [
338 dnl AC_DEFINE(HAVE_TCPD)
339 SLAPD_DEFS="$SLAPD_DEFS -DTCP_WRAPPERS"
340 SLAPD_LIBS="$SLAPD_LIBS -lwrap"
344 # ud needs termcap (should insert check here)
345 LIBTERMCAP="-ltermcap"
348 # FreeBSD (and others) have crypt(3) in -lcrypt
349 if test "$SLAPD_CRYPT" = "yes" ; then
350 AC_CHECK_FUNC(crypt, have_crypt=yes, [
351 AC_CHECK_LIB(crypt, crypt, [LUTIL_LIBS="$LUTIL_LIBS -lcrypt"
352 have_crypt=yes], [have_crypt=no])])
354 if test $have_crypt = yes ; then
355 dnl AC_DEFINE(SLAPD_CRYPT,1)
356 LUTIL_DEFS="$LUTIL_DEFS -DLDAP_CRYPT"
358 AC_MSG_WARN(could not find crypt, disabling crypt support)
362 dnl ----------------------------------------------------------------
363 dnl Checks for header files.
381 dnl ----------------------------------------------------------------
382 dnl Checks for typedefs, structures, and compiler characteristics.
397 dnl ----------------------------------------------------------------
398 dnl Checks for library functions.
421 AC_REPLACE_FUNCS(strdup)
423 dnl ----------------------------------------------------------------
424 # Check Configuration
427 AC_SUBST(BUILD_LDAPD)
429 AC_SUBST(BUILD_SLAPD)
431 AC_SUBST(SLAPD_PASSWD)
432 AC_SUBST(SLAPD_SHELL)
434 AC_SUBST(BUILD_SLURPD)
442 AC_SUBST(SLURPD_DEFS)
443 AC_SUBST(SLURPD_LIBS)
446 AC_SUBST(LTHREAD_DEFS)
447 AC_SUBST(LTHREAD_LIBS)
452 dnl contrib/Makefile:build/top.mk:contrib/Makefile.in:build/dir.mk \
453 dnl contrib/saucer/Makefile:build/top.mk:contrib/saucer/Makefile.in:build/rules.mk \
454 dnl contrib/whois++/Makefile:build/top.mk:contrib/whois++/Makefile.in:build/rules.mk \
455 dnl [date > stamp-h])
458 Makefile:build/top.mk:Makefile.in:build/dir.mk \
459 doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \
460 doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk \
461 doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk \
462 doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk \
463 doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk \
464 doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk \
465 clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
466 clients/finger/Makefile:build/top.mk:clients/finger/Makefile.in:build/rules.mk \
467 clients/fax500/Makefile:build/top.mk:clients/fax500/Makefile.in:build/rules.mk \
468 clients/gopher/Makefile:build/top.mk:clients/gopher/Makefile.in:build/rules.mk \
469 clients/mail500/Makefile:build/top.mk:clients/mail500/Makefile.in:build/rules.mk \
470 clients/rcpt500/Makefile:build/top.mk:clients/rcpt500/Makefile.in:build/rules.mk \
471 clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
472 clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk \
473 include/Makefile:build/top.mk:include/Makefile.in \
474 libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk \
475 libraries/libavl/Makefile:build/top.mk:libraries/libavl/Makefile.in:build/lib.mk \
476 libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk \
477 libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk \
478 libraries/libldbm/Makefile:build/top.mk:libraries/libldbm/Makefile.in:build/lib.mk \
479 libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.mk \
480 libraries/liblthread/Makefile:build/top.mk:libraries/liblthread/Makefile.in:build/lib.mk \
481 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk \
482 servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk \
483 servers/ldapd/Makefile:build/top.mk:servers/ldapd/Makefile.in:build/srv.mk \
484 servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk \
485 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/srv.mk \
486 servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/srv.mk \
487 servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/srv.mk \
488 servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
489 servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
490 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
491 tests/Makefile:build/top.mk:tests/Makefile.in \