]> git.sur5r.net Git - openldap/blob - configure.in
4a3013fad1132ba863f6a0b8904f22558af911cb
[openldap] / configure.in
1 dnl $OpenLDAP$
2 dnl
3 dnl Copyright 1998-2002 The OpenLDAP Foundation.  All Rights Reserved.
4 dnl 
5 dnl Redistribution and use in source and binary forms, with or without
6 dnl modification, are permitted only as authorized by the OpenLDAP
7 dnl Public License.  A copy of this license is available at
8 dnl http://www.OpenLDAP.org/license.html or in file LICENSE in the
9 dnl top-level directory of the distribution.
10 dnl
11 dnl ----------------------------------------------------------------
12 dnl Redefine AC_INIT_BINSH to provide RCS IDs and copyright notice
13 dnl at top of generated configure script.  Prints simple copyright.
14 define([AC_INIT_BINSH],
15 [[#! /bin/sh
16 # $]OpenLDAP[$
17 # from] translit([$OpenLDAP$], $")] [
18
19 # Copyright 1998-2002 The OpenLDAP Foundation.  All Rights Reserved.
20
21 # Redistribution and use in source and binary forms, with or without
22 # modification, are permitted only as authorized by the OpenLDAP
23 # Public License.  A copy of this license is available at
24 # http://www.OpenLDAP.org/license.html or in file LICENSE in the
25 # top-level directory of the distribution.
26
27 echo "Copyright 1998-2002 The OpenLDAP Foundation,  All Rights Reserved."
28 echo "Restrictions apply, see COPYRIGHT and LICENSE files."
29 ])dnl
30 dnl ----------------------------------------------------------------
31 dnl Disable config.cache!
32 define([AC_CACHE_LOAD], )dnl
33 define([AC_CACHE_SAVE], )dnl
34 dnl ================================================================
35 dnl Configure.in for OpenLDAP
36 AC_INIT(build/version.sh)dnl
37
38 # set unset (borrowed from autoconf 2.49c)
39 if (OL_FOO=OL_FOO; unset OL_FOO) >/dev/null 2>&1; then
40   ol_unset=unset
41 else
42   ol_unset=false
43 fi
44 # unset CDPATH
45 $ol_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
46
47 AC_CONFIG_AUX_DIR(build)dnl
48
49 eval `$ac_aux_dir/version.sh`
50 if test -z "$OL_STRING"; then
51         AC_MSG_ERROR([could not determine version])
52 fi
53
54 if test -f "$ac_aux_dir/shtool" -a ! -d $ac_aux_dir/shtool; then
55         ac_cv_shtool="$ac_aux_dir/shtool"
56 else
57         AC_MSG_ERROR([no shtool found in $ac_aux_dir])
58 fi
59
60 SHTOOL="$ac_cv_shtool"
61 AC_SUBST(SHTOOL)
62
63 TB=`$SHTOOL echo -e %B`
64 TN=`$SHTOOL echo -e %b`
65
66 echo "Configuring $TB$OL_STRING$TN ..."
67
68 dnl Determine host platform
69 dnl             we try not to use this for much
70 AC_CANONICAL_SYSTEM
71
72 AM_INIT_AUTOMAKE([$OL_PACKAGE],[$OL_VERSION], [no defines])dnl
73 AC_SUBST(PACKAGE)dnl
74 AC_SUBST(VERSION)dnl
75 AC_DEFINE_UNQUOTED(OPENLDAP_PACKAGE,"$PACKAGE",Package)
76 AC_DEFINE_UNQUOTED(OPENLDAP_VERSION,"$VERSION",Version)
77
78 AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION,$OL_API_INC,Version)
79 AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION_MAJOR,$OL_MAJOR,Major)
80 AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION_MINOR,$OL_MINOR,Minor)
81 AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION_PATCH,$OL_PATCH,Patch)
82
83 OPENLDAP_LIBVERSION=$OL_API_LIB
84 AC_SUBST(OPENLDAP_LIBVERSION)dnl
85
86 dnl We use autoconf features new to 2.13.
87 dnl aclocal.m4 should be built using aclocal from automake 1.4
88 dnl libtool 1.4.2 should be installed.
89 AC_PREREQ(2.13)dnl Required Autoconf version
90
91 AC_CONFIG_HEADER(include/portable.h include/ldap_features.h include/lber_types.h)dnl
92
93 dnl ================================================================
94 dnl Start Args
95 AC_MSG_CHECKING(configure arguments)
96 AC_PREFIX_DEFAULT(/usr/local)
97
98 top_builddir=`pwd`
99 AC_SUBST(top_builddir)dnl
100
101 dnl ----------------------------------------------------------------
102 dnl --with-subdir
103 ldap_subdir="/openldap"
104
105 AC_ARG_WITH(subdir,
106 [  --with-subdir=DIR       change default subdirectory used for installs],
107 [case "$withval" in
108         no) ldap_subdir=""
109                 ;;
110         yes)
111                 ;;
112         /*|\\*)
113                 ldap_subdir="$withval"
114                 ;;
115         *)
116                 ldap_subdir="/$withval"
117                 ;;
118 esac
119 ])dnl
120
121 AC_SUBST(ldap_subdir)dnl
122
123 dnl ----------------------------------------------------------------
124 dnl General "enable" options
125 OL_ARG_ENABLE(debug,[  --enable-debug     enable debugging], yes)dnl
126 OL_ARG_ENABLE(syslog,[  --enable-syslog   enable syslog support], auto)dnl
127 OL_ARG_ENABLE(proctitle,[  --enable-proctitle     enable proctitle support], yes)dnl
128 OL_ARG_ENABLE(cache,[  --enable-cache     enable caching (experimental)], no)dnl
129 OL_ARG_ENABLE(referrals,[  --enable-referrals     enable LDAPv2+ Referrals (experimental)], no)dnl
130 OL_ARG_ENABLE(kbind,[  --enable-kbind     enable LDAPv2+ Kerberos IV bind (deprecated)], no)dnl
131 OL_ARG_ENABLE(ipv6,[  --enable-ipv6       enable IPv6 support], auto)dnl
132 OL_ARG_ENABLE(local,[  --enable-local     enable AF_LOCAL (AF_UNIX) socket support], auto)dnl
133 OL_ARG_ENABLE(rewrite,[  --enable-rewrite         enable rewrite], no)dnl
134 OL_ARG_ENABLE(x_compile,[  --enable-x-compile     enable cross compiling],
135         no, [yes no])dnl
136
137 dnl ----------------------------------------------------------------
138 dnl General "with" options
139 dnl OL_ARG_ENABLE(dmalloc,[  --enable-dmalloc     enable debug malloc support], no)dnl
140
141 OL_ARG_WITH(cyrus_sasl,[  --with-cyrus-sasl       with Cyrus SASL support],
142         auto, [auto yes no] )
143 OL_ARG_WITH(fetch,[  --with-fetch                 with fetch URL support],
144         auto, [auto yes no] )
145 OL_ARG_WITH(kerberos,[  --with-kerberos   with Kerberos support],
146         auto, [auto k5 k5only k425 kth k4 afs yes no])
147 OL_ARG_WITH(readline,[  --with-readline   with readline support],
148         auto, [auto yes no] )
149 OL_ARG_WITH(threads,[  --with-threads     with threads],
150         auto, [auto nt posix mach pth lwp yes no manual] )
151 OL_ARG_WITH(tls,[  --with-tls             with TLS/SSL support],
152         auto, [auto ssleay openssl yes no] )
153 OL_ARG_WITH(yielding_select,[  --with-yielding-select  with implicitly yielding select],
154         auto, [auto yes no manual] )
155
156 dnl ----------------------------------------------------------------
157 dnl Server options
158 dnl ----------------------------------------------------------------
159
160 dnl ----------------------------------------------------------------
161 dnl SLAPD OPTIONS
162 AC_ARG_WITH(xxslapdoptions,[SLAPD (Standalone LDAP Daemon) Options:])
163 OL_ARG_ENABLE(slapd,[  --enable-slapd     enable building slapd], yes)dnl
164 OL_ARG_ENABLE(aci,[    --enable-aci       enable per-object ACIs (experimental)], no)dnl
165 OL_ARG_ENABLE(cleartext,[    --enable-cleartext   enable cleartext passwords], yes)dnl
166 OL_ARG_ENABLE(crypt,[    --enable-crypt   enable crypt(3) passwords], no)dnl
167 OL_ARG_ENABLE(dynamic,[    --enable-dynamic       enable linking built binaries with dynamic libs], no)dnl
168 OL_ARG_ENABLE(kpasswd,[    --enable-kpasswd       enable Kerberos password verification], no)dnl
169 OL_ARG_ENABLE(lmpasswd,[    --enable-lmpasswd     enable LAN Manager passwords], no)dnl
170 OL_ARG_ENABLE(spasswd,[    --enable-spasswd       enable (Cyrus) SASL password verification], no)dnl
171 OL_ARG_ENABLE(modules,[    --enable-modules       enable dynamic module support], no)dnl
172 dnl OL_ARG_ENABLE(multimaster,[    --enable-multimaster  enable multimaster replication], no)dnl
173 OL_ARG_ENABLE(phonetic,[    --enable-phonetic     enable phonetic/soundex], no)dnl
174 OL_ARG_ENABLE(rlookups,[    --enable-rlookups     enable reverse lookups], no)dnl
175 OL_ARG_ENABLE(slp, [    --enable-slp          enable SLPv2 support], no)dnl     
176 OL_ARG_ENABLE(wrappers,[    --enable-wrappers     enable tcp wrapper support], no)dnl
177
178 dnl SLAPD Backend options
179 OL_ARG_ENABLE(bdb,[    --enable-bdb       enable Berkeley DB backend], yes)dnl
180 OL_ARG_WITH(bdb_module,[    --with-bdb-module     module type], static,
181         [static dynamic])
182 OL_ARG_ENABLE(dnssrv,[    --enable-dnssrv         enable dnssrv backend], no)dnl
183 OL_ARG_WITH(dnssrv_module,[    --with-dnssrv-module  module type], static,
184         [static dynamic])
185 OL_ARG_ENABLE(ldap,[    --enable-ldap     enable ldap backend], no)dnl
186 OL_ARG_WITH(ldap_module,[    --with-ldap-module   module type], static,
187         [static dynamic])
188 OL_ARG_ENABLE(ldbm,[    --enable-ldbm     enable ldbm backend], no)dnl
189 OL_ARG_WITH(ldbm_api,[    --with-ldbm-api       with LDBM API], auto,
190         [auto berkeley bcompat mdbm gdbm])
191 OL_ARG_WITH(ldbm_module,[    --with-ldbm-module   module type], static,
192         [static dynamic])
193 OL_ARG_WITH(ldbm_type,[    --with-ldbm-type       use LDBM type], auto,
194         [auto btree hash])
195 OL_ARG_ENABLE(meta,[    --enable-meta     enable metadirectory backend], no)dnl
196 OL_ARG_WITH(meta_module,[    --with-meta-module   module type], static,
197         [static dynamic])
198 OL_ARG_ENABLE(monitor,[    --enable-monitor       enable monitor backend], no)dnl
199 OL_ARG_WITH(monitor_module,[    --with-monitor-module module type], static,
200         [static dynamic])
201 OL_ARG_ENABLE(passwd,[    --enable-passwd         enable passwd backend], no)dnl
202 OL_ARG_WITH(passwd_module,[    --with-passwd-module  module type], static,
203         [static dynamic])
204 OL_ARG_ENABLE(perl,[    --enable-perl     enable perl backend], no)dnl
205 OL_ARG_WITH(perl_module,[    --with-perl-module   module type], static,
206         [static dynamic])
207 OL_ARG_ENABLE(shell,[    --enable-shell   enable shell backend], no)dnl
208 OL_ARG_WITH(shell_module,[    --with-shell-module         module type], static,
209         [static dynamic])
210 OL_ARG_ENABLE(sql,[    --enable-sql       enable sql backend], no)dnl
211 OL_ARG_WITH(sql_module,[    --with-sql-module     module type], static,
212         [static dynamic])
213 OL_ARG_ENABLE(tcl,[    --enable-tcl       enable tcl backend], no)dnl
214 OL_ARG_WITH(tcl_module,[    --with-tcl-module     module type], static,
215         [static dynamic])
216
217 dnl ----------------------------------------------------------------
218 dnl SLURPD OPTIONS
219 AC_ARG_WITH(xxslurpdoptions,[SLURPD (Replication Daemon) Options:])
220 OL_ARG_ENABLE(slurpd,[  --enable-slurpd   enable building slurpd], auto)dnl
221
222 dnl ----------------------------------------------------------------
223 AC_ARG_WITH(xxliboptions,[Library Generation & Linking Options])
224 AC_ENABLE_STATIC
225 dnl AC_DISABLE_SHARED
226 AC_ENABLE_SHARED
227
228 dnl ----------------------------------------------------------------
229
230 dnl General "enable" options
231 # validate options
232 if test $ol_enable_slapd = no ; then
233         dnl SLAPD was specificallly disabled
234         if test $ol_enable_bdb = yes ; then
235                 AC_MSG_WARN([slapd disabled, ignoring --enable-bdb argument])
236         fi
237         if test $ol_enable_dnssrv = yes ; then
238                 AC_MSG_WARN([slapd disabled, ignoring --enable-dnssrv argument])
239         fi
240         if test $ol_enable_ldap = yes ; then
241                 AC_MSG_WARN([slapd disabled, ignoring --enable-ldap argument])
242         fi
243         if test $ol_enable_ldbm = yes ; then
244                 AC_MSG_WARN([slapd disabled, ignoring --enable-ldbm argument])
245         fi
246         if test $ol_enable_meta = yes ; then
247                 AC_MSG_WARN([slapd disabled, ignoring --enable-meta argument])
248         fi
249         if test $ol_enable_monitor = yes ; then
250                 AC_MSG_WARN([slapd disabled, ignoring --enable-monitor argument])
251         fi
252         if test $ol_enable_passwd = yes ; then
253                 AC_MSG_WARN([slapd disabled, ignoring --enable-passwd argument])
254         fi
255         if test $ol_enable_perl = yes ; then
256                 AC_MSG_WARN([slapd disabled, ignoring --enable-perl argument])
257         fi
258         if test $ol_enable_shell = yes ; then
259                 AC_MSG_WARN([slapd disabled, ignoring --enable-shell argument])
260         fi
261         if test $ol_enable_tcl = yes ; then
262                 AC_MSG_WARN([slapd disabled, ignoring --enable-tcl argument])
263         fi
264         if test $ol_enable_sql = yes ; then
265                 AC_MSG_WARN([slapd disabled, ignoring --enable-sql argument])
266         fi
267         if test $ol_enable_modules = yes ; then
268                 AC_MSG_WARN([slapd disabled, ignoring --enable-modules argument])
269         fi
270 dnl     if test $ol_enable_multimaster = yes ; then
271 dnl             AC_MSG_WARN([slapd disabled, ignoring --enable-multimaster argument])
272 dnl     fi
273         if test $ol_enable_wrappers = yes ; then
274                 AC_MSG_WARN([slapd disabled, ignoring --enable-wrappers argument])
275         fi
276         if test $ol_enable_phonetic = yes ; then
277                 AC_MSG_WARN([slapd disabled, ignoring --enable-phonetic argument])
278         fi
279         if test $ol_enable_rlookups = yes ; then
280                 AC_MSG_WARN([slapd disabled, ignoring --enable-rlookups argument])
281         fi
282         if test $ol_enable_aci = yes ; then
283                 AC_MSG_WARN([slapd disabled, ignoring --enable-aci argument])
284         fi
285         if test $ol_with_ldbm_api != auto ; then
286                 AC_MSG_WARN([slapd disabled, ignoring --with-ldbm-api argument])
287         fi
288         if test $ol_with_ldbm_type != auto ; then
289                 AC_MSG_WARN([slapd disabled, ignoring --with-ldbm-type argument])
290         fi
291         if test $ol_with_bdb_module != static ; then
292                 AC_MSG_WARN([slapd disabled, ignoring --with-bdb-module argument])
293         fi
294         if test $ol_with_dnssrv_module != static ; then
295                 AC_MSG_WARN([slapd disabled, ignoring --with-dnssrv-module argument])
296         fi
297         if test $ol_with_ldap_module != static ; then
298                 AC_MSG_WARN([slapd disabled, ignoring --with-ldap-module argument])
299         fi
300         if test $ol_with_ldbm_module != static ; then
301                 AC_MSG_WARN([slapd disabled, ignoring --with-ldbm-module argument])
302         fi
303         if test $ol_with_meta_module != static ; then
304                 AC_MSG_WARN([slapd disabled, ignoring --with-meta-module argument])
305         fi
306         if test $ol_with_monitor_module != static ; then
307                 AC_MSG_WARN([slapd disabled, ignoring --with-monitor-module argument])
308         fi
309         if test $ol_with_passwd_module != static ; then
310                 AC_MSG_WARN([slapd disabled, ignoring --with-passwd-module argument])
311         fi
312         if test $ol_with_perl_module != static ; then
313                 AC_MSG_WARN([slapd disabled, ignoring --with-perl-module argument])
314         fi
315         if test $ol_with_shell_module != static ; then
316                 AC_MSG_WARN([slapd disabled, ignoring --with-shell-module argument])
317         fi
318         if test $ol_with_tcl_module != static ; then
319                 AC_MSG_WARN([slapd disabled, ignoring --with-tcl-module argument])
320         fi
321         if test $ol_with_sql_module != static ; then
322                 AC_MSG_WARN([slapd disabled, ignoring --with-sql-module argument])
323         fi
324         if test $ol_enable_slurpd = yes ; then
325                 AC_MSG_ERROR([slurpd requires slapd])
326         fi
327         if test $ol_enable_rewrite = yes ; then
328                 AC_MSG_WARN([slapd disabled, ignoring --enable-rewrite argument])
329         fi
330
331         # force settings to no
332         ol_enable_bdb=no
333         ol_enable_dnssrv=no
334         ol_enable_ldap=no
335         ol_enable_ldbm=no
336         ol_enable_meta=no
337         ol_enable_monitor=no
338         ol_enable_passwd=no
339         ol_enable_perl=no
340         ol_enable_shell=no
341         ol_enable_tcl=no
342         ol_enable_sql=no
343
344         ol_enable_modules=no
345 dnl     ol_enable_multimaster=no
346         ol_enable_phonetic=no
347         ol_enable_rlookups=no
348         ol_enable_aci=no
349         ol_enable_wrappers=no
350         ol_enable_dynamic=no
351
352         ol_with_ldbm_api=no
353         ol_with_ldbm_type=no
354
355         ol_with_bdb_module=static
356         ol_with_dnssrv_module=static
357         ol_with_ldap_module=static
358         ol_with_ldbm_module=static
359         ol_with_meta_module=static
360         ol_with_monitor_module=static
361         ol_with_passwd_module=static
362         ol_with_perl_module=static
363         ol_with_shell_module=static
364         ol_with_tcl_module=static
365         ol_with_sql_module=static
366
367         ol_enable_slurpd=no
368
369         ol_enable_rewrite=no
370
371 elif test $ol_enable_ldbm = no ; then
372         dnl SLAPD without LDBM
373
374         if test $ol_with_ldbm_api != auto ; then
375                 AC_MSG_WARN([LDBM disabled, ignoring --with-ldbm-api argument])
376         fi
377
378         if test $ol_with_ldbm_type != auto ; then
379                 AC_MSG_WARN([LDBM disabled, ignoring --with-ldbm-type argument])
380         fi
381
382         if test $ol_with_ldbm_module != static ; then
383                 AC_MSG_WARN([LDBM disabled, ignoring --with-ldbm-module argument])
384         fi
385
386         if test $ol_enable_modules != yes -a \
387                 $ol_enable_bdb = no -a \
388                 $ol_enable_dnssrv = no -a \
389                 $ol_enable_ldap = no -a \
390                 $ol_enable_meta = no -a \
391                 $ol_enable_monitor = no -a \
392                 $ol_enable_passwd = no -a \
393                 $ol_enable_perl = no -a \
394                 $ol_enable_shell = no -a \
395                 $ol_enable_sql = no -a \
396                 $ol_enable_tcl = no ; then
397
398                 if test $ol_enable_slapd = yes ; then
399                         AC_MSG_ERROR([slapd requires a backend])
400                 else
401                         AC_MSG_WARN([skipping slapd, no backend specified])
402                         ol_enable_slapd=no
403                 fi
404         fi
405
406         ol_with_ldbm_api=no
407         ol_with_ldbm_type=no
408         ol_with_ldbm_module=static
409
410         if test $ol_enable_bdb != no ; then
411                 ol_with_ldbm_api=berkeley
412         fi
413
414 else
415         dnl SLAPD with LDBM
416         if test $ol_with_ldbm_api = gdbm -a \
417                 $ol_with_ldbm_type = btree ; then
418                 AC_MSG_ERROR([GDBM only supports LDBM type hash])
419         fi
420         if test $ol_with_ldbm_api = mdbm -a \
421                 $ol_with_ldbm_type = btree ; then
422                 AC_MSG_ERROR([MDBM only supports LDBM type hash])
423         fi
424         if test $ol_with_ldbm_api = ndbm -a \
425                 $ol_with_ldbm_type = btree ; then
426                 AC_MSG_ERROR([NDBM only supports LDBM type hash])
427         fi
428
429         if test $ol_enable_bdb = yes ; then
430                 if test $ol_with_ldbm_api = auto ; then
431                         ol_with_ldbm_api=berkeley
432                 elif test $ol_with_ldbm_api != berkeley ; then
433                         AC_MSG_ERROR([LDBM API not compatible with BDB])
434                 fi
435
436         elif test $ol_enable_bdb = auto ; then
437                 if test $ol_with_ldbm_api != berkeley \
438                         -o $ol_with_ldbm_api != auto ; then
439                         AC_MSG_WARN([LDBM API not compatible with BDB, disabling BDB])
440                         ol_enable_bdb=no
441                 fi
442         fi
443 fi
444
445 if test $ol_enable_slurpd = yes ; then
446         dnl SLURPD was specifically enabled
447         if test $ol_with_threads = no ; then
448                 AC_MSG_ERROR([slurpd requires threads])
449         fi
450 fi
451
452 if test $ol_enable_lmpasswd = yes ; then
453         if test $ol_with_tls = no ; then
454                 AC_MSG_ERROR([LAN Manager passwords require OpenSSL])
455         fi
456 fi
457
458 if test $ol_enable_kbind = yes -o $ol_enable_kpasswd = yes ; then
459         if test $ol_with_kerberos = no ; then
460                 AC_MSG_ERROR([options require --with-kerberos])
461         elif test $ol_with_kerberos = auto ; then
462                 ol_with_kerberos=yes
463         fi
464
465 elif test $ol_enable_kbind = no -o $ol_enable_kpasswd = no ; then
466         if test $ol_with_kerberos = auto ; then
467                 ol_with_kerberos=no
468         elif test $ol_with_kerberos != no ; then
469                 AC_MSG_WARN([Kerberos detection enabled unnecessarily]);
470                 ol_with_kerberos=no
471         fi
472 fi
473
474 if test $ol_enable_spasswd = yes ; then
475         if test $ol_with_cyrus_sasl = no ; then
476                 AC_MSG_ERROR([options require --with-cyrus-sasl])
477         fi
478         ol_with_cyrus_sasl=yes
479 fi
480
481 AC_MSG_RESULT(done)
482
483 dnl ----------------------------------------------------------------
484 dnl Initialize vars
485 LDAP_LIBS=
486 LDIF_LIBS=
487 LDBM_LIB=
488 LDBM_LIBS=
489 LTHREAD_LIBS=
490 LUTIL_LIBS=
491
492 SLAPD_LIBS=
493 SLURPD_LIBS=
494
495 BUILD_SLAPD=no
496 BUILD_SLURPD=no
497
498 BUILD_THREAD=no
499
500 BUILD_BDB=no
501 BUILD_DNSSRV=no
502 BUILD_LDAP=no
503 BUILD_LDBM=no
504 BUILD_META=no
505 BUILD_MONITOR=no
506 BUILD_PASSWD=no
507 BUILD_PERL=no
508 BUILD_SHELL=no
509 BUILD_SQL=no
510 BUILD_TCL=no
511
512 BUILD_BDB_DYNAMIC=static
513 BUILD_DNSSRV_DYNAMIC=static
514 BUILD_LDAP_DYNAMIC=static
515 BUILD_LDBM_DYNAMIC=static
516 BUILD_META_DYNAMIC=static
517 BUILD_MONITOR_DYNAMIC=static
518 BUILD_PASSWD_DYNAMIC=static
519 BUILD_PERL_DYNAMIC=static
520 BUILD_SHELL_DYNAMIC=static
521 BUILD_TCL_DYNAMIC=static
522 BUILD_SQL_DYNAMIC=static
523
524 SLAPD_MODULES_LDFLAGS=
525 SLAPD_MODULES_CPPFLAGS=
526 SLAPD_MODULES_LIST=
527
528 SLAPD_STATIC_BACKENDS=
529 SLAPD_DYNAMIC_BACKENDS=
530
531 SLAPD_PERL_LDFLAGS=
532 MOD_PERL_LDFLAGS=
533 PERL_CPPFLAGS=
534
535 SLAPD_SQL_LDFLAGS=
536 SLAPD_SQL_LIBS=
537 SLAPD_SQL_INCLUDES=
538
539 MOD_TCL_LIB=
540 KRB4_LIBS=
541 KRB5_LIBS=
542 READLINE_LIBS=
543 SASL_LIBS=
544 TERMCAP_LIBS=
545 TLS_LIBS=
546 MODULES_LIBS=
547 AUTH_LIBS=
548
549 SLAPD_SLP_LIBS=
550
551 dnl ================================================================
552 dnl Checks for programs
553
554 AC_PROG_INSTALL
555
556 AC_DEFINE(HAVE_MKVERSION, 1, [define this if you have mkversion])
557
558 dnl ----------------------------------------------------------------
559 dnl
560 dnl Determine which C translator to use
561 dnl
562
563 dnl AIX Thread requires we use cc_r or xlc_r.
564 dnl But only do this IF AIX and CC is not set
565 dnl and threads are auto|yes|posix.
566 dnl
567 dnl If we find cc_r|xlc_r, force pthreads and assume
568 dnl             pthread_create is in $LIBS (ie: don't bring in
569 dnl             any additional thread libraries)
570 dnl If we do not find cc_r|xlc_r, disable threads
571
572 ol_aix_threads=no
573 case "$target" in
574 *-*-aix*) dnl all AIX is not a good idea.
575         if test -z "$CC" ; then
576                 case "$ol_with_threads" in
577                 auto | yes |  posix) ol_aix_threads=yes ;;
578                 esac
579         fi
580 ;;
581 esac
582
583 if test $ol_aix_threads = yes ; then
584         if test -z "${CC}" ; then
585                 AC_CHECK_PROGS(CC,cc_r xlc_r cc)
586
587                 if test "$CC" = cc ; then
588                         dnl no CC! don't allow --with-threads
589                         if test $ol_with_threads != auto ; then
590                                 AC_MSG_ERROR([--with-threads requires cc_r (or other suitable compiler) on AIX])
591                         else
592                                 AC_MSG_WARN([disabling threads, no cc_r on AIX])
593                         fi
594                         ol_with_threads=no
595                 fi
596         fi
597
598         if test "${CC}" = "cc_r" -o "${CC}" = "xlc_r" ; then
599                 ol_with_threads=posix
600                 ol_cv_pthread_create=yes
601         fi
602 fi
603
604 if test -z "${CC}"; then
605         AC_CHECK_PROGS(CC,cc)
606 fi
607
608 dnl The default CFLAGS is empty NOT whatever AC_PROG_CC sets.
609 dnl (for now, let autoconf sort this out)
610 dnl CFLAGS=${CFLAGS-""}
611
612 AC_CHECK_PROGS(AR,ar gar,ar)
613
614 AC_LIBTOOL_WIN32_DLL
615 AC_LIBTOOL_DLOPEN
616 AC_PROG_LIBTOOL
617
618 AC_PROG_AWK
619
620 AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail,
621         $PATH:/usr/libexec:/usr/lib:/usr/sbin:/usr/etc:/etc)
622 AC_PATH_PROG(EDITOR, vi, /usr/ucb/vi, $PATH:/usr/ucb)
623 AC_PATH_PROG(FINGER, finger, /usr/ucb/finger, $PATH:/usr/ucb)
624
625 dnl ----------------------------------------------------------------
626 dnl Perl
627 ol_link_perl=no
628 if test $ol_enable_perl != no ; then
629         AC_PATH_PROG(PERLBIN, perl, /usr/bin/perl)
630
631         if test "no$PERLBIN" = "no" ; then
632                 if test $ol_enable_perl = yes ; then
633                         AC_MSG_ERROR([could not locate perl])
634                 fi
635
636         else
637                 PERL_CPPFLAGS="`$PERLBIN -MExtUtils::Embed -e ccopts`"
638                 if test x"$ol_with_perl_module" = "xstatic" ; then
639                         SLAPD_PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e s/-lc//`"
640                 else
641                         MOD_PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e s/-lc//`"
642                 fi
643                 dnl should check perl version
644                 ol_link_perl=yes
645         fi
646 fi
647
648 AC_PROG_CPP
649
650 dnl ----------------------------------------------------------------
651 dnl Cross compiling checks
652 if test $cross_compiling = yes -a $ol_enable_x_compile = yes; then
653         AC_MSG_WARN([cross compiling....  some functionality will be removed.])
654
655 elif test $cross_compiling = no -a $ol_enable_x_compile = yes; then
656         AC_MSG_WARN([programs compiled here do run here...])
657         AC_MSG_ERROR([  if not cross compiling, use --disable-x-compile.])
658
659 elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
660         AC_MSG_WARN([programs compiled here do not run here...])
661         AC_MSG_ERROR([  if cross compiling,  add --enable-x-compile.])
662 fi
663
664 dnl ----------------------------------------------------------------
665 dnl Checks for UNIX Variants
666 dnl AC_AIX
667 dnl AC_ISC_POSIX
668 dnl AC_MINIX
669
670 dnl ----------------------------------------------------------------
671 dnl Checks for system services
672 AC_CYGWIN
673 AC_MINGW32
674 AC_EXEEXT
675 AC_OBJEXT
676
677 AC_DEFINE_UNQUOTED( EXEEXT, "${EXEEXT}", [defined to be the EXE extension])
678
679 dnl ----------------------------------------------------------------
680 dnl BeOS requires -lbe -lroot -lnet
681 AC_CHECK_LIB(be, be_app, [LIBS="$LIBS -lbe -lroot -lnet"], :, [-lroot -lnet])
682
683 dnl ----------------------------------------------------------------
684 dnl OpenLDAP requires STDC features
685 AM_PROG_CC_STDC
686 if test "X${am_cv_prog_cc_stdc}" = "Xno" ; then
687         AC_MSG_ERROR([OpenLDAP requires compiler to support STDC constructs.])
688 fi
689
690 dnl ----------------------------------------------------------------
691 dnl Check cc depend flags
692 OL_MKDEPEND
693 if test "${ol_cv_mkdep}" = no ; then
694         # this will soon become an error
695         AC_MSG_WARN([do not know how to generate dependencies])
696 fi
697
698 dnl ----------------------------------------------------------------
699 dnl Check for AIX security library
700 AC_CHECK_LIB(s, afopen, [
701         AUTH_LIBS=-ls
702         AC_DEFINE(HAVE_AIX_SECURITY,1,[define if you have AIX security lib])
703 ])
704
705
706 dnl ----------------------------------------------------------------
707 dnl Check for module support
708 ol_link_modules=no
709 if test $ol_enable_modules != no ; then
710         AC_CHECK_HEADERS(ltdl.h)
711
712         if test $ac_cv_header_ltdl_h = no ; then
713                 AC_MSG_ERROR([could not locate libtool ltdl.h])
714         fi
715
716         AC_CHECK_LIB(ltdl, lt_dlinit, [
717                 MODULES_LIBS=-lltdl
718                 AC_DEFINE(HAVE_LIBLTDL,1,[define if you have libtool -ltdl])
719         ])
720
721         if test "$ac_cv_lib_ltdl_lt_dlinit" = no ; then
722                 AC_MSG_ERROR([could not locate libtool -lltdl])
723         fi
724         ol_link_modules=yes
725 else
726         ol_with_bdb_module=static
727         ol_with_dnssrv_module=static
728         ol_with_ldap_module=static
729         ol_with_ldbm_module=static
730         ol_with_meta_module=static
731         ol_with_monitor_module=static
732         ol_with_passwd_module=static
733         ol_with_perl_module=static
734         ol_with_shell_module=static
735         ol_with_tcl_module=static
736         ol_with_sql_module=static
737 fi
738
739 dnl ----------------------------------------------------------------
740 dnl Checks for header files.
741 OL_HEADER_STDC
742
743 if test $ol_cv_header_stdc != yes; then
744         AC_MSG_WARN([could not locate Standard C compliant headers])
745 fi
746
747 AC_HEADER_DIRENT
748 AC_HEADER_SYS_WAIT
749 AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
750 if test $am_cv_sys_posix_termios = yes ; then
751         AC_DEFINE(HAVE_POSIX_TERMIOS,1,
752                 [define if you have POSIX termios])
753 fi
754
755 AC_CHECK_HEADERS(       \
756         arpa/inet.h             \
757         arpa/nameser.h  \
758         assert.h                \
759         conio.h                 \
760         crypt.h                 \
761         direct.h                \
762         errno.h                 \
763         fcntl.h                 \
764         filio.h                 \
765         getopt.h                \
766         grp.h                   \
767         io.h                    \
768         libutil.h               \
769         limits.h                \
770         locale.h                \
771         netinet/tcp.h   \
772         malloc.h                \
773         memory.h                \
774         psap.h                  \
775         pwd.h                   \
776         process.h               \
777         resolv.h                \
778         sgtty.h                 \
779         shadow.h                \
780         stddef.h                \
781         string.h                \
782         strings.h               \
783         sysexits.h              \
784         sys/file.h              \
785         sys/filio.h             \
786         sys/errno.h             \
787         sys/ioctl.h             \
788         sys/param.h             \
789         sys/resource.h  \
790         sys/select.h    \
791         sys/socket.h    \
792         sys/syslog.h    \
793         sys/time.h              \
794         sys/types.h             \
795         syslog.h                \
796         termios.h               \
797         unistd.h                \
798         winsock.h               \
799         winsock2.h              \
800 )
801
802
803 dnl ----------------------------------------------------------------
804 dnl Checks for libraries
805
806 AC_CHECK_FUNC(dlopen, :, [AC_CHECK_LIB(dl, dlopen)])
807
808 dnl HP-UX requires -lV3
809 dnl this is not needed on newer versions of HP-UX
810 AC_CHECK_LIB(V3, sigset)
811
812 dnl The following is INTENTIONALLY scripted out because shell does not
813 dnl support variable names with the '@' character, which is what
814 dnl autoconf would try to generate if one merely used AC_SEARCH_LIBS
815 AC_MSG_CHECKING(for winsock)
816 save_LIBS="$LIBS"
817 for curlib in ws2_32 wsock32; do
818         LIBS="$LIBS -l$curlib"
819         AC_TRY_LINK([
820                         char socket@12();
821                         char select@20();
822                         char closesocket@4();
823                         char gethostname@8();
824                         ],
825                         [
826                         socket@12();
827                         select@20();
828                         closesocket@4();
829                         gethostname@8();
830                         ],
831                         have_winsock=yes, have_winsock=no)
832
833         if test $have_winsock = yes; then
834                 AC_DEFINE(HAVE_WINSOCK, 1, [define if you have winsock])
835                 ac_cv_func_socket=yes
836                 ac_cv_func_select=yes
837                 ac_cv_func_closesocket=yes
838                 ac_cv_func_gethostname=yes
839                 if test $curlib = ws2_32; then
840                         have_winsock=winsock2
841                         AC_DEFINE(HAVE_WINSOCK2, 1,
842                                   [define if you have winsock2])
843                 fi
844                 break
845         fi
846         LIBS="$save_LIBS"
847 done
848 AC_MSG_RESULT($have_winsock)
849
850 dnl Find socket()
851 dnl Likely combinations:
852 dnl             -lsocket [ -lnsl_s | -lnsl ]
853 dnl             -linet
854
855 AC_CHECK_FUNC(socket, :, [      
856 dnl hopefully we won't include too many libraries
857         AC_CHECK_LIB(socket, main)
858         AC_CHECK_LIB(net, main)
859         AC_CHECK_LIB(nsl_s, main)
860         AC_CHECK_LIB(nsl, main)
861         AC_CHECK_LIB(inet, socket)
862         AC_CHECK_LIB(gen, main)
863 ])
864
865 dnl require select
866 AC_CHECK_FUNC(select, :, AC_MSG_ERROR([select() required.]))
867
868 if test "${ac_cv_header_winsock_h}" != yes; then
869         dnl Select arg types
870         dnl (if this detection becomes permenent, it and the select() detection
871         dnl should be done before the yielding select test) 
872         AC_FUNC_SELECT_ARGTYPES
873 fi
874
875 dnl check to see if system call automatically restart
876 dnl AC_SYS_RESTARTABLE_SYSCALLS
877
878 dnl ----------------------------------------------------------------
879 dnl require POSIX regex
880 AC_CHECK_HEADERS( regex.h )
881 if test "$ac_cv_header_regex_h" != yes ; then
882         AC_MSG_ERROR([POSIX regex.h required.])
883 fi
884 AC_SEARCH_LIBS(regfree, [regex gnuregex],
885         :, AC_MSG_ERROR([POSIX regex required.]))
886
887 OL_POSIX_REGEX
888 if test "$ol_cv_c_posix_regex" = no ; then
889         AC_MSG_ERROR([broken POSIX regex!])
890 fi
891
892 dnl ----------------------------------------------------------------
893 dnl For windows, check for the need of RPCRT for UUID function support
894 AC_MSG_CHECKING(to see if -lrpcrt4 is needed for win32 UUID support)
895 save_LIBS="$LIBS"
896 LIBS="$LIBS -lrpcrt4"
897 AC_TRY_LINK([
898                 char UuidCreate@4();
899                 char UuidToStringA@8();
900                 ],
901                 [
902                 UuidCreate@4();
903                 UuidToStringA@8();
904                 ],
905                 need_rpcrt=yes, need_rpcrt=no)
906 if test $need_rpcrt = yes; then
907         SLAPD_LIBS="$SLAPD_LIBS -lrpcrt4"
908 fi
909 LIBS="$save_LIBS"
910 AC_MSG_RESULT($need_rpcrt)
911
912 dnl ----------------------------------------------------------------
913 dnl Check for resolver routines
914 dnl       need to check for both res_query and __res_query
915 dnl   need to check -lc, -lbind, and -lresolv
916 ol_link_dnssrv=no
917 AC_CHECK_FUNC(res_query,:)
918 if test $ac_cv_func_res_query = no ; then 
919         AC_CHECK_FUNC(__res_query,:)
920         ac_cv_func_res_query=$ac_cv_func___res_query
921 fi
922
923 if test $ac_cv_func_res_query = no ; then 
924         AC_CHECK_LIB(bind, res_query)
925         ac_cv_func_res_query=$ac_cv_lib_bind_res_query
926 fi
927
928 if test $ac_cv_func_res_query = no ; then 
929         AC_CHECK_LIB(bind, __res_query)
930         ac_cv_func_res_query=$ac_cv_lib_bind___res_query
931 fi
932
933 if test $ac_cv_func_res_query = no ; then 
934         AC_CHECK_LIB(resolv, res_query)
935         ac_cv_func_res_query=$ac_cv_lib_resolv_res_query
936 fi
937
938 if test $ac_cv_func_res_query = no ; then 
939         AC_CHECK_LIB(resolv, __res_query)
940         ac_cv_func_res_query=$ac_cv_lib_resolv___res_query
941 fi
942
943 if test "$ac_cv_func_res_query" = yes ; then
944         AC_DEFINE(HAVE_RES_QUERY,1,
945                 [define if you have res_query()])
946
947         if test $ol_enable_dnssrv != no ; then
948                 ol_link_dnssrv=yes
949         fi
950 fi
951
952 if test "$ol_enable_dnssrv" = yes -a "$ol_link_dnssrv" = no ; then
953         AC_MSG_ERROR([DNSSRV requires res_query()])
954 fi
955
956 dnl ----------------------------------------------------------------
957 dnl PF_INET6 support requires getaddrinfo and INET6_ADDRSTRLEN
958 dnl PF_LOCAL may use getaddrinfo in available
959 AC_CHECK_FUNCS( getaddrinfo gai_strerror inet_ntop )
960
961 ol_link_ipv6=no
962 if test $ac_cv_func_getaddrinfo = no -o $ac_cv_func_inet_ntop = no ; then
963         if test $ol_enable_ipv6 = yes ; then
964                 AC_MSG_ERROR([IPv6 support requires getaddrinfo() and inet_ntop()])
965         fi
966 elif test $ol_enable_ipv6 != no ; then
967         AC_CACHE_CHECK([INET6_ADDRSTRLEN],[ol_cv_inet6_addrstrlen],[
968                 AC_EGREP_CPP(__has_inet6_addrstrlen__,[
969 #                       include <netinet/in.h>
970 #                       ifdef INET6_ADDRSTRLEN
971                                 __has_inet6_addrstrlen__;
972 #                       endif
973                 ], [ol_cv_inet6_addrstrlen=yes], [ol_cv_inet6_addrstrlen=no])])
974
975         if test $ol_cv_inet6_addrstrlen = yes ; then
976                 ol_link_ipv6=yes
977         elif test $ol_enable_ipv6 = yes ; then
978                 AC_MSG_ERROR([IPv6 support requires INET6_ADDRSTRLEN])
979         fi
980 fi
981
982 if test $ol_enable_local != no ; then
983         AC_CHECK_HEADERS( sys/un.h )
984
985         if test $ol_enable_local = auto ; then
986                 ol_enable_local=$ac_cv_header_sys_un_h
987         elif test $ac_cv_header_sys_un_h = no ; then
988                 AC_MSG_ERROR([AF_LOCAL domain support requires sys/un.h])
989         fi
990 fi
991
992 dnl ----------------------------------------------------------------
993 dnl Kerberos
994 ol_link_kbind=no
995 ol_link_kpasswd=no
996 ol_link_krb5=no
997 ol_link_krb4=no
998
999 if test $ol_with_kerberos = yes -o $ol_with_kerberos = auto \
1000         -o $ol_with_kerberos = k5 -o $ol_with_kerberos = k5only \
1001         -o $ol_with_kerberos = k425 ; then
1002
1003         AC_CHECK_HEADERS(krb5.h)
1004
1005         if test $ac_cv_header_krb5_h = yes ; then
1006                 dnl lazy check for Heimdal Kerberos
1007                 AC_CHECK_HEADERS(heim_err.h)
1008                 if test $ac_cv_header_heim_err_h = yes ; then
1009                         krb5_impl=heimdal
1010                 else
1011                         krb5_impl=mit
1012                 fi
1013
1014                 if test $krb5_impl = mit; then
1015                         AC_CHECK_LIB(k5crypto, main,
1016                                 [krb5crypto=k5crypto],
1017                                 [krb5crypto=crypto])
1018
1019                         AC_CHECK_LIB(krb5, main,
1020                                 [have_krb5=yes
1021                                 KRB5_LIBS="-lkrb5 -l$krb5crypto -lcom_err"],
1022                                 [have_krb5=no],
1023                                 [-l$krb5crypto -lcom_err])
1024
1025                 elif test $krb5_impl = heimdal; then
1026                         AC_CHECK_LIB(krb5, main,
1027                                 [have_krb5=yes
1028                                 KRB5_LIBS="-lkrb5 -ldes -lasn1 -lroken -lcom_err"],
1029                                 [have_krb5=no],
1030                                 [-ldes -lasn1 -lroken -lcom_err])
1031
1032                         AC_DEFINE(HAVE_HEIMDAL_KERBEROS, 1,
1033                                 [define if you have HEIMDAL Kerberos])
1034
1035                 else
1036                         have_krb5=no
1037                         AC_MSG_WARN([Unrecongized Kerberos5 Implementation])
1038                 fi
1039
1040                 if test $have_krb5 = yes ; then
1041                         ol_link_krb5=yes
1042
1043                         AC_DEFINE(HAVE_KRB5, 1,
1044                                 [define if you have Kerberos V])
1045
1046                         if test $ol_enable_kpasswd != no ; then
1047                                 ol_link_kpasswd=yes;
1048                         fi
1049
1050                         if test $ol_with_kerberos = k5only ; then
1051                                 ol_with_kerberos=found
1052                         fi
1053
1054                 elif test $ol_with_kerberos != auto ; then
1055                         AC_MSG_ERROR([Required Kerberos 5 support not available])
1056                 fi
1057
1058         fi
1059 fi
1060
1061 if test $ol_link_krb5 = yes -a \( $ol_with_kerberos = yes -o \
1062         $ol_with_kerberos = auto -o $ol_with_kerberos = k425 \) ; then
1063
1064         AC_CHECK_HEADERS(kerberosIV/krb.h kerberosIV/des.h)
1065
1066         if test $ac_cv_header_kerberosIV_krb_h = yes ; then
1067                 if test $krb5_impl = mit; then
1068                         AC_CHECK_LIB(krb4, main, [have_k425=yes
1069                                 KRB4_LIBS="-lkrb4 -ldes425"], [have_k425=no],
1070                                 [-ldes425 -lkrb5 -l$krb5crypto -lcom_err])
1071
1072                 elif test $krb5_impl = heimdal; then
1073                         AC_CHECK_LIB(krb4, main, [have_k425=yes
1074                                 KRB4_LIBS="-lkrb4"], [have_k425=no],
1075                                 [-lkrb5 -ldes -lasn1 -lroken -lcom_err])
1076
1077                 else
1078                         have_425=no
1079                         AC_MSG_WARN([Unrecongized Kerberos V Implementation])
1080                 fi
1081
1082                 if test $have_k425 = yes ; then
1083                         ol_with_kerberos=found
1084                         ol_link_krb4=yes
1085
1086                         AC_DEFINE(HAVE_KRB425, 1,
1087                                 [define if you have Kerberos V with IV support])
1088                         AC_DEFINE(HAVE_KRB4, 1,
1089                                 [define if you have Kerberos IV])
1090
1091                         AC_CACHE_CHECK([for des_debug in Kerberos libraries],
1092                                 [ol_cv_var_des_debug], [
1093                                 dnl save the flags
1094                                 save_LIBS="$LIBS"
1095                                 LIBS="$KRB4_LIBS $KRB5_LIBS $LIBS"
1096                                 AC_TRY_LINK([
1097 #include <kerberosIV/krb.h>
1098 #include <kerberosIV/des.h>
1099 extern int des_debug;
1100 ],[
1101 des_debug = 1;
1102 ],                              ol_cv_var_des_debug=yes, ol_cv_var_des_debug=no)
1103                                 dnl restore the LIBS
1104                                 LIBS="$save_LIBS"
1105                         ])
1106
1107                         if test $ol_cv_var_des_debug = yes ; then
1108                                 AC_DEFINE(HAVE_DES_DEBUG,1,
1109                                         [define if you have Kerberos des_debug])
1110                         fi
1111
1112                         LIBS="$save_LIBS"
1113                 fi
1114         fi
1115 fi
1116
1117 if test $ol_link_krb5 = yes ; then
1118         ol_with_kerberos=found
1119 fi
1120
1121 if test $ol_with_kerberos = yes -o $ol_with_kerberos = auto \
1122         -o $ol_with_kerberos = k4 -o $ol_with_kerberos = kth ; then
1123
1124         AC_CHECK_HEADERS(krb.h des.h krb-archaeology.h )
1125
1126         if test $ac_cv_header_krb_h = yes ; then
1127                 AC_CHECK_LIB(krb, main, [have_k4=yes], [have_k4=no], [-ldes])
1128
1129                 if test $have_k4 = yes ; then
1130                         ol_with_kerberos=found
1131                         ol_link_krb4=yes
1132
1133                         AC_DEFINE(HAVE_KRB4, 1,
1134                                 [define if you have Kerberos IV])
1135
1136                         KRB4_LIBS="-lkrb -ldes"
1137
1138                         if test $ac_cv_header_krb_archaeology_h = yes ; then
1139                                 AC_DEFINE(HAVE_KTH_KERBEROS, 1,
1140                                         [define if you have Kth Kerberos])
1141                         fi
1142                 fi
1143         fi
1144 fi
1145
1146 if test $ol_link_krb4 = yes -a $ol_enable_kpasswd != no ; then
1147         ol_link_kpasswd=yes
1148 fi
1149
1150 if test $ol_link_krb4 = yes -a $ol_enable_kbind != no ; then
1151         ol_link_kbind=yes
1152
1153 elif test $ol_enable_kbind = yes ; then
1154         AC_MSG_ERROR([Kerberos IV detection failed])
1155 fi
1156
1157 if test $ol_link_krb4 = yes -o $ol_link_krb5 = yes ; then
1158         AC_DEFINE(HAVE_KERBEROS, 1, [define if you have Kerberos])
1159
1160 elif test $ol_with_kerberos != auto -a $ol_with_kerberos != no ; then
1161         AC_MSG_ERROR([Kerberos detection failed])
1162 fi
1163
1164 dnl ----------------------------------------------------------------
1165 dnl TLS/SSL
1166 ol_link_tls=no
1167 if test $ol_with_tls != no ; then
1168         AC_CHECK_HEADERS(openssl/ssl.h ssl.h)
1169         
1170         if test $ac_cv_header_openssl_ssl_h = yes -o $ac_cv_header_ssl_h = yes ; then
1171                 AC_CHECK_LIB(ssl, SSLeay_add_ssl_algorithms, 
1172                         [have_ssleay=yes
1173                         need_rsaref=no],
1174                         [have_ssleay=no],
1175                         [-lcrypto])
1176                         
1177                 if test $have_ssleay = no ; then
1178                         AC_CHECK_LIB(ssl, SSL_library_init,
1179                                 [have_ssleay=yes
1180                                 need_rsaref=no], [have_ssleay=no],
1181                                 [-lcrypto])
1182                 fi
1183
1184                 if test $have_ssleay = no ; then
1185                         AC_CHECK_LIB(ssl, ssl3_accept, 
1186                                 [have_ssleay=yes
1187                                 need_rsaref=yes], [have_ssleay=no],
1188                                 [-lcrypto -lRSAglue -lrsaref])
1189                 fi
1190
1191                 if test $have_ssleay = yes ; then
1192                         ol_with_tls=found
1193                         ol_link_tls=yes
1194
1195                         AC_DEFINE(HAVE_SSLEAY, 1, 
1196                                 [define if you have SSLeay or OpenSSL])
1197
1198                         if test $need_rsaref = yes; then
1199                                 AC_DEFINE(HAVE_RSAREF, 1, 
1200                                         [define if you have RSAref])
1201
1202                                 TLS_LIBS="-lssl -lcrypto -lRSAglue -lrsaref"
1203                         else
1204                                 TLS_LIBS="-lssl -lcrypto"
1205                         fi
1206                 fi
1207         fi
1208
1209 else
1210         AC_WARN([TLS privacy protection not supported!])
1211 fi
1212
1213 if test $ol_link_tls = yes ; then
1214         AC_DEFINE(HAVE_TLS, 1, [define if you have TLS])
1215
1216 elif test $ol_with_tls = auto ; then
1217         AC_WARN([Could not locate TLS/SSL package])
1218         AC_WARN([TLS privacy protection not supported!])
1219
1220 elif test $ol_with_tls != no ; then
1221         AC_ERROR([Could not locate TLS/SSL package])
1222 fi
1223
1224 dnl ----------------------------------------------------------------
1225 dnl LAN Manger password checking requires DES from OpenSSL
1226 if test $ol_enable_lmpasswd != no; then
1227         if test $ol_link_tls != yes ; then
1228                 AC_ERROR([LAN Manager passwords require OpenSSL])
1229         fi
1230
1231         AC_DEFINE(SLAPD_LMHASH, 1, [define to support LAN Manager passwords])
1232 fi
1233
1234 dnl ----------------------------------------------------------------
1235 dnl Tests for reentrant functions necessary to build a
1236 dnl thread_safe -lldap.
1237 AC_CHECK_FUNCS(         \
1238         ctime_r                 \
1239         gethostbyname_r gethostbyaddr_r \
1240 )
1241
1242 if test "$ac_cv_func_ctime_r" = no ; then
1243         ol_cv_func_ctime_r_nargs=0
1244 else
1245         OL_FUNC_CTIME_R_NARGS
1246 dnl     OL_FUNC_CTIME_R_TYPE
1247 fi
1248
1249 if test "$ac_cv_func_gethostbyname_r" = yes ; then
1250         OL_FUNC_GETHOSTBYNAME_R_NARGS
1251 else
1252         ol_cv_func_gethostbyname_r_nargs=0
1253 fi
1254  
1255 if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
1256         OL_FUNC_GETHOSTBYADDR_R_NARGS
1257 else
1258         ol_cv_func_gethostbyaddr_r_nargs=0
1259 fi
1260
1261 if test "$ac_cv_func_ctime_r" = yes \
1262         -a "$ol_cv_func_ctime_r_nargs" -ge 2 \
1263         -a "$ol_cv_func_ctime_r_nargs" -le 3 \
1264         -a "$ac_cv_func_gethostbyname_r" = yes \
1265         -a "$ol_cv_func_gethostbyname_r_nargs" -ge 5 \
1266         -a "$ol_cv_func_gethostbyname_r_nargs" -le 6 \
1267         -a "$ac_cv_func_gethostbyaddr_r" = yes \
1268         -a "$ol_cv_func_gethostbyaddr_r_nargs" -ge 5 \
1269         -a "$ol_cv_func_gethostbyaddr_r_nargs" -le 6 \
1270         ; then
1271  
1272         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT,1)
1273 fi
1274
1275 dnl ----------------------------------------------------------------
1276 dnl Threads?
1277 ol_link_threads=no
1278
1279 if test $ol_with_threads = auto -o $ol_with_threads = yes \
1280         -o $ol_with_threads = nt ; then
1281
1282         OL_NT_THREADS
1283
1284         if test "$ol_cv_nt_threads" = yes ; then
1285                 ol_link_threads=nt
1286                 ol_with_threads=found
1287                 ol_with_yielding_select=yes
1288
1289                 AC_DEFINE(HAVE_NT_SERVICE_MANAGER,1,[if you have NT Service Manager])
1290                 AC_DEFINE(HAVE_NT_EVENT_LOG,1,[if you have NT Event Log])
1291         fi
1292
1293         if test $ol_with_threads = nt ; then
1294                 AC_MSG_ERROR([could not locate NT Threads])
1295         fi
1296 fi
1297
1298 if test $ol_with_threads = auto -o $ol_with_threads = yes \
1299         -o $ol_with_threads = posix ; then
1300
1301         AC_CHECK_HEADERS(pthread.h)
1302
1303         if test $ac_cv_header_pthread_h = yes ; then
1304                 OL_POSIX_THREAD_VERSION
1305
1306                 if test $ol_cv_pthread_version = final ; then
1307                         AC_DEFINE(HAVE_PTHREADS_FINAL,1,
1308                                 [define if pthreads API compatible with final spec])
1309                 elif test $ol_cv_pthread_version = draft4 ; then
1310                         AC_DEFINE(HAVE_PTHREADS_D4,1,
1311                                 [define if pthreads API compatible with draft4 spec])
1312                 else
1313                         AC_MSG_ERROR([unknown pthread version])
1314                 fi
1315
1316                 # consider threads found
1317                 ol_with_threads=found
1318
1319                 OL_HEADER_LINUX_THREADS
1320                 OL_HEADER_GNU_PTH_PTHREAD_H
1321
1322                 if test $ol_cv_header_gnu_pth_pthread_h = no ; then
1323                         AC_CHECK_HEADERS(sched.h)
1324                 fi
1325
1326                 dnl Now the hard part, how to link?
1327                 dnl
1328                 dnl currently supported checks:
1329                 dnl
1330                 dnl Check for no flags 
1331                 dnl     pthread_create() in $LIBS
1332                 dnl
1333                 dnl Check special pthread (final) flags
1334                 dnl     [skipped] pthread_create() with -mt (Solaris) [disabled]
1335                 dnl     pthread_create() with -kthread (FreeBSD)
1336                 dnl     pthread_create() with -pthread (FreeBSD/Digital Unix)
1337                 dnl     pthread_create() with -pthreads (?)
1338                 dnl     pthread_create() with -mthreads (AIX)
1339                 dnl     pthread_create() with -thread (?)
1340                 dnl
1341                 dnl Check pthread (final) libraries
1342                 dnl     pthread_mutex_unlock() in -lpthread -lmach -lexc -lc_r (OSF/1)
1343                 dnl     pthread_mutex_lock() in -lpthread -lmach -lexc (OSF/1)
1344                 dnl     [skipped] pthread_mutex_trylock() in -lpthread -lexc (OSF/1)
1345                 dnl     pthread_join() -Wl,-woff,85 -lpthread (IRIX)
1346                 dnl     pthread_create() in -lpthread (many)
1347                 dnl     pthread_create() in -lc_r (FreeBSD)
1348                 dnl
1349                 dnl Check pthread (draft4) flags (depreciated)
1350                 dnl     pthread_create() with -threads (OSF/1)
1351                 dnl
1352                 dnl Check pthread (draft4) libraries (depreciated)
1353                 dnl     pthread_mutex_unlock() in -lpthreads -lmach -lexc -lc_r (OSF/1)
1354                 dnl     pthread_mutex_lock() in -lpthreads -lmach -lexc (OSF/1)
1355                 dnl     pthread_mutex_trylock() in -lpthreads -lexc (OSF/1)
1356                 dnl     pthread_create() in -lpthreads (many)
1357                 dnl
1358
1359                 dnl pthread_create in $LIBS
1360                 AC_CACHE_CHECK([for pthread_create in default libraries],
1361                         ol_cv_pthread_create,[
1362                 AC_TRY_RUN(OL_PTHREAD_TEST_PROGRAM,
1363                         [ol_cv_pthread_create=yes],
1364                         [ol_cv_pthread_create=no],
1365                         [AC_TRY_LINK(OL_PTHREAD_TEST_INCLUDES,OL_PTHREAD_TEST_FUNCTION,
1366                                 [ol_cv_pthread_create=yes],
1367                                 [ol_cv_pthread_create=no])])])
1368
1369                 if test $ol_cv_pthread_create != no ; then
1370                         ol_link_threads=posix
1371                         ol_link_pthreads=""
1372                 fi
1373                 
1374 dnl             OL_PTHREAD_TRY([-mt],           [ol_cv_pthread_mt])
1375                 OL_PTHREAD_TRY([-kthread],      [ol_cv_pthread_kthread])
1376                 OL_PTHREAD_TRY([-pthread],      [ol_cv_pthread_pthread])
1377                 OL_PTHREAD_TRY([-pthreads],     [ol_cv_pthread_pthreads])
1378                 OL_PTHREAD_TRY([-mthreads],     [ol_cv_pthread_mthreads])
1379                 OL_PTHREAD_TRY([-thread],       [ol_cv_pthread_thread])
1380
1381                 OL_PTHREAD_TRY([-lpthread -lmach -lexc -lc_r],
1382                         [ol_cv_pthread_lpthread_lmach_lexc_lc_r])
1383                 OL_PTHREAD_TRY([-lpthread -lmach -lexc],
1384                         [ol_cv_pthread_lpthread_lmach_lexc])
1385 dnl             OL_PTHREAD_TRY([-lpthread -lexc],
1386 dnl                     [ol_cv_pthread_lpthread_lexc])
1387
1388                 OL_PTHREAD_TRY([-lpthread -Wl,-woff,85],
1389                         [ol_cv_pthread_lib_lpthread_woff])
1390
1391                 OL_PTHREAD_TRY([-lpthread],     [ol_cv_pthread_lpthread])
1392                 OL_PTHREAD_TRY([-lc_r],         [ol_cv_pthread_lc_r])
1393
1394                 OL_PTHREAD_TRY([-threads],      [ol_cv_pthread_threads])
1395
1396                 OL_PTHREAD_TRY([-lpthreads -lmach -lexc -lc_r],
1397                         [ol_cv_pthread_lpthreads_lmach_lexc_lc_r])
1398                 OL_PTHREAD_TRY([-lpthreads -lmach -lexc],
1399                         [ol_cv_pthread_lpthreads_lmach_lexc])
1400                 OL_PTHREAD_TRY([-lpthreads -lexc],
1401                         [ol_cv_pthread_lpthreads_lexc])
1402
1403                 OL_PTHREAD_TRY([-lpthreads],[ol_cv_pthread_lib_lpthreads])
1404
1405                 if test $ol_link_threads != no ; then
1406                         AC_DEFINE(HAVE_PTHREADS,1,
1407                                 [define if you have POSIX Threads])
1408
1409                         LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads"
1410
1411                         dnl save flags
1412                         save_CPPFLAGS="$CPPFLAGS"
1413                         save_LIBS="$LIBS"
1414                         LIBS="$LTHREAD_LIBS $LIBS"
1415
1416                         dnl All POSIX Thread (final) implementations should have
1417                         dnl sched_yield instead of pthread yield.
1418                         dnl check for both
1419                         AC_CHECK_FUNCS(sched_yield pthread_yield)
1420
1421                         if test $ac_cv_func_sched_yield = no -a \
1422                                 $ac_cv_func_pthread_yield = no ; then
1423                                 dnl Digital UNIX has sched_yield() in -lrt
1424                                 AC_CHECK_LIB(rt, sched_yield,
1425                                         [LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
1426                                         AC_DEFINE(HAVE_SCHED_YIELD,1,
1427                                                 [Define if you have the sched_yield function.])
1428                                         ac_cv_func_sched_yield=yes],
1429                                         [ac_cv_func_sched_yield=no])
1430                         fi
1431                         if test $ac_cv_func_sched_yield = no -a \
1432                                 $ac_cv_func_pthread_yield = no ; then
1433                                 dnl Solaris has sched_yield() stub in -lposix4
1434                                 dnl but we'll use thr_yield instead.
1435                                 AC_CHECK_FUNCS(thr_yield)
1436                         fi
1437                         if test $ac_cv_func_sched_yield = no -a \
1438                                 $ac_cv_func_pthread_yield = no -a \
1439                                 "$ac_cv_func_thr_yield" = no ; then
1440                                 AC_MSG_WARN([could not locate sched_yield() or pthread_yield()])
1441                         fi
1442
1443                         dnl Check functions for compatibility
1444                         AC_CHECK_FUNCS(pthread_kill pthread_rwlock_destroy)
1445
1446                         dnl Check for pthread_detach with <pthread.h> inclusion
1447                         dnl as it's symbol may have been mangled.
1448                         AC_CACHE_CHECK([for pthread_detach with <pthread.h>],
1449                                 [ol_cv_func_pthread_detach], [
1450                                 dnl save the flags
1451                                 AC_TRY_LINK([
1452 #include <pthread.h>
1453 #ifndef NULL
1454 #define NULL (void*)0
1455 #endif
1456 ],
1457                                         [pthread_detach(NULL);],
1458                                         [ol_cv_func_pthread_detach=yes],
1459                                         [ol_cv_func_pthread_detach=no])
1460                         ])
1461
1462                         if test $ol_cv_func_pthread_detach = no ; then
1463                                 AC_MSG_ERROR([could not locate pthread_detach()])
1464                         fi
1465
1466                         AC_DEFINE(HAVE_PTHREAD_DETACH,1,
1467                                 [define if you have pthread_detach function])
1468
1469                         dnl Check for setconcurreny functions
1470                         AC_CHECK_FUNCS( \
1471                                 pthread_setconcurrency \
1472                                 pthread_getconcurrency \
1473                                 thr_setconcurrency \
1474                                 thr_getconcurrency \
1475                         )
1476
1477                         OL_SYS_LINUX_THREADS
1478                         OL_LINUX_THREADS
1479
1480                         if test $ol_cv_linux_threads = error; then
1481                                 AC_MSG_ERROR([LinuxThreads header/library mismatch]);
1482                         fi
1483
1484                         AC_CACHE_CHECK([if pthread_create() works],
1485                                 ol_cv_pthread_create_works,[
1486                         AC_TRY_RUN(OL_PTHREAD_TEST_PROGRAM,
1487                                 [ol_cv_pthread_create_works=yes],
1488                                 [ol_cv_pthread_create_works=no],
1489                                 [dnl assume yes
1490                                 ol_cv_pthread_create_works=yes])])
1491
1492                         if test $ol_cv_pthread_create_works = no ; then
1493                                 AC_MSG_ERROR([pthread_create is not usable, check environment settings])
1494                         fi
1495
1496                         dnl Check if select causes an yield
1497                         if test $ol_with_yielding_select = auto ; then
1498                                 AC_CACHE_CHECK([if select yields when using pthreads],
1499                                         ol_cv_pthread_select_yields,[
1500                                 AC_TRY_RUN([
1501 #include <sys/types.h>
1502 #include <sys/time.h>
1503 #include <unistd.h>
1504 #include <pthread.h>
1505 #ifndef NULL
1506 #define NULL (void*) 0
1507 #endif
1508
1509 static int fildes[2];
1510
1511 static void *task(p)
1512         void *p;
1513 {
1514         int i;
1515         struct timeval tv;
1516
1517         fd_set rfds;
1518
1519         tv.tv_sec=10;
1520         tv.tv_usec=0;
1521
1522         FD_ZERO(&rfds);
1523         FD_SET(fildes[0], &rfds);
1524
1525         /* we're not interested in any fds */
1526         i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
1527
1528         if(i < 0) {
1529                 perror("select");
1530                 exit(10);
1531         }
1532
1533         exit(0); /* if we exit here, the select blocked the whole process */
1534 }
1535
1536 int main(argc, argv)
1537         int argc;
1538         char **argv;
1539 {
1540         pthread_t t;
1541
1542         /* create a pipe to select */
1543         if(pipe(&fildes[0])) {
1544                 perror("select");
1545                 exit(1);
1546         }
1547
1548 #ifdef HAVE_PTHREAD_SETCONCURRENCY
1549         (void) pthread_setconcurrency(2);
1550 #else
1551 #ifdef HAVE_THR_SETCONCURRENCY
1552         /* Set Solaris LWP concurrency to 2 */
1553         thr_setconcurrency(2);
1554 #endif
1555 #endif
1556
1557 #if HAVE_PTHREADS_D4
1558         pthread_create(&t, pthread_attr_default, task, NULL);
1559 #else
1560         pthread_create(&t, NULL, task, NULL);
1561 #endif
1562
1563 #if HAVE_SCHED_YIELD
1564         sched_yield();  /* make sure task runs first */
1565 #else
1566 #ifdef HAVE_PTHREAD_YIELD
1567         pthread_yield();        /* make sure task runs first */
1568 #endif
1569 #endif
1570
1571         exit(2);
1572 }],
1573                                 [ol_cv_pthread_select_yields=no],
1574                                 [ol_cv_pthread_select_yields=yes],
1575                                 [ol_cv_pthread_select_yields=cross])])
1576
1577                                 if test $ol_cv_pthread_select_yields = cross ; then
1578                                         AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])
1579                                 fi
1580
1581                                 if test $ol_cv_pthread_select_yields = yes ; then
1582                                         ol_with_yielding_select=yes
1583                                 fi
1584                         fi
1585
1586                         dnl restore flags
1587                         CPPFLAGS="$save_CPPFLAGS"
1588                         LIBS="$save_LIBS"
1589                 else
1590                         AC_MSG_ERROR([could not locate usable POSIX Threads])
1591                 fi
1592         fi
1593
1594         if test $ol_with_threads = posix ; then
1595                 AC_MSG_ERROR([could not locate POSIX Threads])
1596         fi
1597 fi
1598
1599 if test $ol_with_threads = auto -o $ol_with_threads = yes \
1600         -o $ol_with_threads = mach ; then
1601
1602         dnl check for Mach CThreads
1603         AC_CHECK_HEADERS(mach/cthreads.h cthreads.h)
1604         if test $ac_cv_header_mach_cthreads_h = yes ; then
1605                 ol_with_threads=found
1606
1607                 dnl check for cthreads support in current $LIBS
1608                 AC_CHECK_FUNC(cthread_fork,[ol_link_threads=yes])
1609
1610                 if test $ol_link_threads = no ; then
1611                         dnl try -all_load
1612                         dnl this test needs work
1613                         AC_CACHE_CHECK([for cthread_fork with -all_load],
1614                                 [ol_cv_cthread_all_load], [
1615                                 dnl save the flags
1616                                 save_LIBS="$LIBS"
1617                                 LIBS="-all_load $LIBS"
1618                                 AC_TRY_LINK([#include <mach/cthreads.h>],[
1619                                         cthread_fork((void *)0, (void *)0);
1620                                         ], ol_cv_cthread_all_load=yes, ol_cv_cthread_all_load=no)
1621                                 dnl restore the LIBS
1622                                 LIBS="$save_LIBS"
1623                         ])
1624
1625                         if test $ol_cv_cthread_all_load = yes ; then
1626                                 LTHREAD_LIBS="$LTHREAD_LIBS -all_load"
1627                                 ol_link_threads=mach
1628                                 ol_with_threads=found
1629                         fi
1630                 fi
1631
1632         elif test $ac_cv_header_cthreads_h = yes ; then
1633                 dnl Hurd variant of Mach Cthreads
1634                 dnl uses <cthreads.h> and -lthreads
1635
1636                 ol_with_threads=found
1637  
1638                 dnl save the flags
1639                 save_LIBS="$LIBS"
1640                 LIBS="$LIBS -lthreads"
1641                 AC_CHECK_FUNC(cthread_fork,[ol_link_threads=yes])
1642                 LIBS="$save_LIBS"
1643
1644                 if test $ol_link_threads = yes ; then
1645                         LTHREAD_LIBS="-lthreads"
1646                         ol_link_threads=mach
1647                         ol_with_threads=found
1648                 else
1649                         AC_MSG_ERROR([could not link with Mach CThreads])
1650                 fi
1651
1652         elif test $ol_with_threads = mach ; then
1653                 AC_MSG_ERROR([could not locate Mach CThreads])
1654         fi
1655
1656         if test $ol_link_threads = mach ; then
1657                 AC_DEFINE(HAVE_MACH_CTHREADS,1,
1658                         [define if you have Mach Cthreads])
1659         elif test $ol_with_threads = found ; then
1660                 AC_MSG_ERROR([could not link with Mach CThreads])
1661         fi
1662 fi
1663
1664 if test $ol_with_threads = auto -o $ol_with_threads = yes \
1665         -o $ol_with_threads = pth ; then
1666
1667         AC_CHECK_HEADERS(pth.h)
1668
1669         if test $ac_cv_header_pth_h = yes ; then
1670                 AC_CHECK_LIB(pth, pth_version, [have_pth=yes], [have_pth=no])
1671
1672                 if test $have_pth = yes ; then
1673                         AC_DEFINE(HAVE_GNU_PTH,1,[if you have GNU Pth])
1674                         LTHREAD_LIBS="$LTHREAD_LIBS -lpth"
1675                         ol_link_threads=pth
1676                         ol_with_threads=found
1677
1678                         if test $ol_with_yielding_select = auto ; then
1679                                 ol_with_yielding_select=yes
1680                         fi
1681                 fi
1682         fi
1683 fi
1684
1685 if test $ol_with_threads = auto -o $ol_with_threads = yes \
1686         -o $ol_with_threads = lwp ; then
1687
1688         dnl check for SunOS5 LWP
1689         AC_CHECK_HEADERS(thread.h synch.h)
1690         if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
1691                 AC_CHECK_LIB(thread, thr_create, [have_thr=yes], [have_thr=no])
1692
1693                 if test $have_thr = yes ; then
1694                         AC_DEFINE(HAVE_THR,1,
1695                                 [if you have Solaris LWP (thr) package])
1696                         LTHREAD_LIBS="$LTHREAD_LIBS -lthread"
1697                         ol_link_threads=thr
1698
1699                         if test $ol_with_yielding_select = auto ; then
1700                                 ol_with_yielding_select=yes
1701                         fi
1702
1703                         dnl Check for setconcurreny functions
1704                         AC_CHECK_FUNCS( \
1705                                 thr_setconcurrency \
1706                                 thr_getconcurrency \
1707                         )
1708                 fi
1709         fi
1710
1711         dnl check for SunOS4 LWP
1712         AC_CHECK_HEADERS(lwp/lwp.h)
1713         if test $ac_cv_header_lwp_lwp_h = yes ; then
1714                 AC_CHECK_LIB(lwp, lwp_create, [have_lwp=yes], [have_lwp=no])
1715
1716                 if test $have_lwp = yes ; then
1717                         AC_DEFINE(HAVE_LWP,1,
1718                                 [if you have SunOS LWP package])
1719                         LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
1720                         ol_link_threads=lwp
1721
1722                         if test $ol_with_yielding_select = auto ; then
1723                                 ol_with_yielding_select=no
1724                         fi
1725                 fi
1726         fi
1727 fi
1728
1729 if test $ol_with_yielding_select = yes ; then
1730         AC_DEFINE(HAVE_YIELDING_SELECT,1,
1731                 [define if select implicitly yields])
1732 fi
1733
1734 if test $ol_with_threads = manual ; then
1735         dnl User thinks he can manually configure threads.
1736         ol_link_threads=yes
1737
1738         AC_MSG_WARN([thread defines and link options must be set manually])
1739
1740         AC_CHECK_HEADERS(pthread.h sched.h)
1741         AC_CHECK_FUNCS(sched_yield pthread_yield)
1742         OL_HEADER_LINUX_THREADS
1743
1744         AC_CHECK_HEADERS(mach/cthreads.h)
1745         AC_CHECK_HEADERS(lwp/lwp.h)
1746         AC_CHECK_HEADERS(thread.h synch.h)
1747 fi
1748
1749 if test $ol_link_threads != no -a $ol_link_threads != nt ; then  
1750         dnl needed to get reentrant/threadsafe versions
1751         dnl
1752         AC_DEFINE(REENTRANT,1)
1753         AC_DEFINE(_REENTRANT,1)
1754         AC_DEFINE(THREAD_SAFE,1)
1755         AC_DEFINE(_THREAD_SAFE,1)
1756         AC_DEFINE(THREADSAFE,1)
1757         AC_DEFINE(_THREADSAFE,1)
1758         AC_DEFINE(_SGI_MP_SOURCE,1)
1759
1760         dnl The errno declaration may dependent upon _REENTRANT.
1761         dnl If it does, we must link with thread support.
1762         AC_CACHE_CHECK([for thread specific errno],
1763                 [ol_cv_errno_thread_specific], [
1764                 AC_TRY_LINK([#include <errno.h>], [errno = 0;],
1765                         [ol_cv_errno_thread_specific=yes],
1766                         [ol_cv_errno_thread_specific=no])
1767         ])
1768
1769         dnl The h_errno declaration may dependent upon _REENTRANT.
1770         dnl If it does, we must link with thread support.
1771         AC_CACHE_CHECK([for thread specific h_errno],
1772                 [ol_cv_h_errno_thread_specific], [
1773                 AC_TRY_LINK([#include <netdb.h>], [h_errno = 0;],
1774                         [ol_cv_h_errno_thread_specific=yes],
1775                         [ol_cv_h_errno_thread_specific=no])
1776         ])
1777
1778         if test $ol_cv_errno_thread_specific != yes \
1779                 -o $ol_cv_h_errno_thread_specific != yes ; then
1780                 LIBS="$LTHREAD_LIBS $LIBS"
1781                 LTHREAD_LIBS=""
1782         fi
1783
1784 dnl When in thread environment, use 
1785 dnl             #if defined( HAVE_REENTRANT_FUNCTIONS ) \ 
1786 dnl                     || defined( HAVE_FUNC_R )
1787 dnl                     func_r(...);
1788 dnl             #else
1789 dnl             #       if defined( HAVE_THREADS ) 
1790 dnl                             /* lock */
1791 dnl             #       endif
1792 dnl                             func(...);
1793 dnl             #       if defined( HAVE_THREADS ) 
1794 dnl                             /* unlock */
1795 dnl             #       endif
1796 dnl             #endif
1797 dnl
1798 dnl HAVE_REENTRANT_FUNCTIONS is derived from:
1799 dnl             _POSIX_REENTRANT_FUNCTIONS
1800 dnl             _POSIX_THREAD_SAFE_FUNCTIONS
1801 dnl             _POSIX_THREADSAFE_FUNCTIONS
1802 dnl
1803 dnl             and is currently defined in lthread.h
1804 dnl
1805 dnl HAVE_THREADS is defined by lthread.h iff -UNO_THREADS
1806 dnl 
1807 dnl libldap/*.c should only include <lthread.h> iff
1808 dnl LDAP_R_COMPILE is defined.  ie:
1809 dnl             #ifdef LDAP_R_COMPILE
1810 dnl             #       include LDAP_R_COMPILE
1811 dnl             #endif
1812 dnl
1813 dnl LDAP_R_COMPILE is defined by libldap_r/Makefile.in
1814 dnl specifically for compiling the threadsafe version of
1815 dnl     the ldap library (-lldap_r).
1816 dnl             
1817 dnl     dnl check for reentrant/threadsafe functions
1818 dnl     dnl
1819 dnl     dnl note: these should only be used when linking
1820 dnl     dnl             with $LTHREAD_LIBS
1821 dnl     dnl
1822 dnl     save_CPPFLAGS="$CPPFLAGS"
1823 dnl     save_LIBS="$LIBS"
1824 dnl     LIBS="$LTHREAD_LIBS $LIBS"
1825 dnl     AC_CHECK_FUNCS( \
1826 dnl             gmtime_r \
1827 dnl             gethostbyaddr_r gethostbyname_r \
1828 dnl             feof_unlocked unlocked_feof \
1829 dnl             putc_unlocked unlocked_putc \
1830 dnl             flockfile ftrylockfile \
1831 dnl     )
1832 dnl     CPPFLAGS="$save_CPPFLAGS"
1833 dnl     LIBS="$save_LIBS"
1834 fi  
1835
1836 if test $ol_link_threads = no ; then
1837         if test $ol_with_threads = yes ; then
1838                 AC_MSG_ERROR([no suitable thread support])
1839         fi
1840
1841         if test $ol_with_threads = auto ; then
1842                 AC_MSG_WARN([no suitable thread support, disabling threads])
1843                 ol_with_threads=no
1844         fi
1845
1846         AC_DEFINE(NO_THREADS,1,
1847                 [define if you have (or want) no threads])
1848         LTHREAD_LIBS=""
1849 fi
1850
1851 if test $ol_link_threads != no ; then
1852         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE,1)
1853 fi
1854
1855 dnl ----------------------------------------------------------------
1856 ol_link_ldbm=no 
1857
1858 if test $ol_with_ldbm_api = auto \
1859         -o $ol_with_ldbm_api = berkeley \
1860         -o $ol_with_ldbm_api = bcompat ; then
1861
1862         if test $ol_with_ldbm_api = bcompat; then \
1863                 OL_BERKELEY_COMPAT_DB
1864         else
1865                 OL_BERKELEY_DB
1866         fi
1867
1868         if test $ol_cv_berkeley_db != no ; then
1869                 AC_DEFINE(HAVE_BERKELEY_DB,1,
1870                         [define this if Berkeley DB is available])
1871
1872                 ol_link_ldbm=berkeley
1873                 ol_with_ldbm_api=berkeley
1874
1875                 if test $ol_with_ldbm_type = hash ; then
1876                         AC_DEFINE(LDBM_USE_DBHASH,1,
1877                                 [define this to use DBHASH w/ LDBM backend])
1878                 else
1879                         AC_DEFINE(LDBM_USE_DBBTREE,1,
1880                                 [define this to use DBBTREE w/ LDBM backend])
1881                 fi
1882
1883                 dnl $ol_cv_lib_db should be yes or -ldb
1884                 dnl (it could be no, but that would be an error
1885                 if test $ol_cv_lib_db != yes ; then
1886                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db"
1887                 fi
1888         fi
1889 fi
1890
1891 if test $ol_enable_bdb = yes -a $ol_link_ldbm != berkeley ; then
1892         AC_MSG_ERROR(BDB: BerkeleyDB not available)
1893 elif test $ol_enable_bdb != no -a $ol_link_ldbm = berkeley ; then
1894         OL_BDB_COMPAT
1895
1896         if test $ol_cv_bdb_compat = yes ; then
1897                 ol_enable_bdb=yes
1898         elif test $ol_enable_bdb = yes ; then
1899                 AC_MSG_ERROR(BDB: BerkeleyDB version incompatible)
1900         else
1901                 ol_enable_bdb=no
1902         fi
1903 fi
1904
1905 if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
1906         AC_MSG_WARN(Could not find LDBM with BTREE support)
1907         ol_with_ldbm_api=none
1908 fi
1909
1910 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = mdbm ; then
1911         OL_MDBM
1912
1913         if test $ol_cv_mdbm = yes ; then
1914                 ol_link_ldbm=mdbm
1915                 ol_with_ldbm_api=mdbm
1916                 if test $ol_cv_lib_mdbm != yes ; then
1917                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_mdbm"
1918                 fi
1919         fi
1920 fi
1921
1922 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
1923         OL_GDBM
1924
1925         if test $ol_cv_gdbm = yes ; then
1926                 ol_link_ldbm=gdbm
1927                 ol_with_ldbm_api=gdbm
1928
1929                 if test $ol_cv_lib_gdbm != yes ; then
1930                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_gdbm"
1931                 fi
1932         fi
1933 fi
1934
1935 if test $ol_with_ldbm_api = ndbm ; then
1936         OL_NDBM
1937
1938         if test $ol_cv_ndbm = yes ; then
1939                 ol_link_ldbm=ndbm
1940                 ol_with_ldbm_api=ndbm
1941
1942                 if test $ol_cv_lib_ndbm != yes ; then
1943                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_ndbm"
1944                 fi
1945         fi
1946 fi
1947
1948 if test $ol_link_ldbm = no -a $ol_enable_ldbm != no ; then
1949         AC_MSG_WARN(could not find suitable LDBM backend)
1950         if test $ol_enable_ldbm = yes ; then
1951                 AC_MSG_ERROR(select appropriate LDBM options or disable)
1952         fi
1953
1954         AC_MSG_WARN(disabling LDBM)
1955         ol_enable_ldbm=no
1956 fi
1957
1958 dnl ----------------------------------------------------------------
1959 if test $ol_enable_dynamic = yes -a $enable_shared = yes ; then
1960         BUILD_LIBS_DYNAMIC=shared
1961         AC_DEFINE(LDAP_LIBS_DYNAMIC, 1, [define if LDAP libs are dynamic])
1962 else
1963         BUILD_LIBS_DYNAMIC=static
1964 fi
1965
1966 dnl ----------------------------------------------------------------
1967 if test $ol_enable_wrappers != no ; then
1968         AC_CHECK_HEADERS(tcpd.h,[
1969                 AC_MSG_CHECKING([for TCP wrappers library])
1970                 save_LIBS="$LIBS"
1971                 LIBS="$LIBS -lwrap"
1972                 AC_TRY_LINK([
1973 #include <tcpd.h>
1974 int allow_severity = 0;
1975 int deny_severity  = 0;
1976
1977 struct request_info *req;
1978                 ],[
1979 hosts_access(req)
1980                 ],[AC_MSG_RESULT([-lwrap])
1981                 have_wrappers=yes
1982                 LIBS="$save_LIBS"],[
1983                 dnl try with -lnsl
1984                 LIBS="$LIBS -lnsl"
1985                 AC_TRY_LINK([
1986 #include <tcpd.h>
1987 int allow_severity = 0;
1988 int deny_severity  = 0;
1989
1990 struct request_info *req;
1991                 ],[
1992 hosts_access(req)
1993                 ],[AC_MSG_RESULT([-lwrap -lnsl])
1994                 have_wrappers=yes
1995                 LIBS="$save_LIBS -lnsl"],[
1996                 AC_MSG_RESULT(no)
1997                 have_wrappers=no
1998                 LIBS=$save_LIBS])],[
1999                 have_wrappers=no])],[have_wrappers=no])
2000
2001         if test $have_wrappers = yes ; then
2002                 AC_DEFINE(HAVE_TCPD,1, [define if you have -lwrap])
2003                 WRAP_LIBS="-lwrap"
2004         elif test $ol_enable_wrappers = yes ; then
2005                 AC_MSG_ERROR([could not find TCP wrappers, select apppropriate options ore disable])
2006         else
2007                 AC_MSG_WARN([could not find TCP wrappers, support disabled])
2008                 WRAP_LIBS=""
2009         fi
2010 fi
2011
2012 dnl ----------------------------------------------------------------
2013 if test $ol_enable_syslog != no ; then
2014         AC_CHECK_FUNC(openlog)
2015         if test $ac_cv_func_openlog = no -a $ol_enable_syslog = yes; then
2016                 AC_MSG_ERROR(could not find syslog, select appropriate options or disable)
2017         fi
2018         ol_enable_syslog=$ac_cv_func_openlog
2019 fi
2020
2021 dnl ----------------------------------------------------------------
2022 dnl dmalloc support (deprecated in favor of -DCSRIMALLOC support)
2023 dnl if test $ol_enable_dmalloc != no ; then
2024 dnl     AC_CHECK_HEADERS(dmalloc.h)
2025 dnl     AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
2026 dnl fi
2027
2028 dnl ----------------------------------------------------------------
2029 dnl SQL
2030 ol_link_sql=no
2031 if test $ol_enable_sql != no ; then
2032         AC_CHECK_LIB(iodbc,SQLDriverConnect,[have_iodbc=yes],[have_iodbc=no])
2033         if test $have_iodbc = yes ; then
2034                 ol_link_sql="-liodbc"
2035         else
2036                 AC_CHECK_LIB(odbc,SQLDriverConnect,[have_odbc=yes],[have_odbc=no])
2037                 if test $have_odbc = yes ; then
2038                         ol_link_sql="-lodbc"
2039                 fi
2040         fi
2041
2042         if test $ol_link_sql != no ; then
2043                 SLAPD_SQL_LIBS="$ol_link_sql"
2044
2045         elif test $ol_enable_sql != auto ; then
2046                 AC_MSG_ERROR([could not locate suitable ODBC library])
2047         fi
2048 fi
2049
2050 dnl ----------------------------------------------------------------
2051 dnl TCL
2052 if test $ol_enable_tcl != no ; then
2053         AC_CHECK_HEADERS(tcl.h)
2054
2055         if test $ac_cv_header_tcl_h != yes ; then
2056                 have_tcl=no
2057         else
2058                 for lib in tcl tcl7.6 tcl8.0 tcl8.2 ; do
2059                         AC_CHECK_LIB($lib,main,
2060                           [have_tcl=yes
2061                            if test x"$ol_with_tcl_module" = "xstatic" ; then
2062                                         SLAPD_LIBS="$SLAPD_LIBS -l${lib}"
2063                            else
2064                                         MOD_TCL_LIB="-l${lib}"
2065                            fi;break],[have_tcl=no])
2066                 done
2067         fi
2068
2069         if test $have_tcl != yes ; then
2070                 AC_MSG_WARN([could not find -ltcl])
2071                 if test $ol_enable_tcl = yes ; then
2072                         AC_MSG_ERROR([could not find tcl, select appropriate options or disable])
2073                 fi
2074
2075                 ol_enable_tcl=no
2076         fi
2077 fi
2078
2079 dnl ----------------------------------------------------------------
2080 dnl ud needs termcap (should insert check here)
2081 ol_link_termcap=no
2082 AC_CHECK_HEADERS(termcap.h ncurses.h)
2083
2084 if test $ol_link_termcap = no ; then
2085         AC_CHECK_LIB(termcap, tputs, [have_termcap=yes], [have_termcap=no])
2086         if test $have_termcap = yes ; then
2087                 AC_DEFINE(HAVE_TERMCAP, 1, [define if you have -ltermcap])
2088                 ol_link_termcap=yes
2089                 TERMCAP_LIBS=-ltermcap
2090         fi
2091 fi
2092
2093 if test $ol_link_termcap = no ; then
2094         AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
2095         if test $have_ncurses = yes ; then
2096                 AC_DEFINE(HAVE_NCURSES, 1, [define if you have -lncurses])
2097                 ol_link_termcap=yes
2098                 TERMCAP_LIBS=-lncurses
2099         fi
2100 fi
2101
2102 if test $ol_link_termcap = no ; then
2103         AC_DEFINE(NO_TERMCAP,1, [define if you have no termcap support])
2104         TERMCAP_LIBS=
2105 fi
2106
2107 dnl ----------------------------------------------------------------
2108 dnl
2109 dnl Check for Cyrus SASL
2110 dnl
2111 ol_link_sasl=no
2112 ol_link_spasswd=no
2113 if test $ol_with_cyrus_sasl != no ; then
2114         AC_CHECK_HEADERS(sasl.h)
2115
2116         if test $ac_cv_header_sasl_h ; then
2117                 AC_CHECK_LIB(sasl2, sasl_client_init,
2118                         [ol_link_sasl="-lsasl2"],
2119                         [AC_CHECK_LIB(sasl, sasl_client_init,
2120                                 [ol_link_sasl="-lsasl"])])
2121         fi
2122
2123         if test $ol_link_sasl = no ; then
2124                 if test $ol_with_cyrus_sasl != auto ; then
2125                         AC_MSG_ERROR([Could not locate Cyrus SASL])
2126                 else
2127                         AC_MSG_WARN([Could not locate Cyrus SASL])
2128                         AC_MSG_WARN([SASL authentication not supported!])
2129                         if test $ol_link_tls = no ; then
2130                                 AC_MSG_WARN([Strong authentication not supported!])
2131                         fi
2132                 fi
2133         else
2134                 AC_DEFINE(HAVE_CYRUS_SASL,1,[define if you have Cyrus SASL])
2135                 SASL_LIBS="$ol_link_sasl"
2136                 if test $ol_enable_spasswd != no ; then
2137                         ol_link_spasswd=yes
2138                 fi
2139         fi
2140
2141 else
2142         AC_MSG_WARN([SASL authentication not supported!])
2143         if test $ol_link_tls = no ; then
2144                 AC_MSG_WARN([Strong authentication not supported!])
2145         fi
2146 fi
2147
2148 dnl ----------------------------------------------------------------
2149 dnl Check for entropy sources
2150 if test $cross_compiling != yes -a "$ac_cv_mingw32" != yes ; then
2151         dev=no
2152         if test -r /dev/urandom ; then
2153                 dev="/dev/urandom";
2154         elif test -r /idev/urandom ; then
2155                 dev="/idev/urandom";
2156         elif test -r /dev/srandom ; then
2157                 dev="/dev/srandom";
2158         elif test -r /dev/random ; then
2159                 dev="/dev/random";
2160         elif test -r /idev/random ; then
2161                 dev="/idev/random";
2162         fi
2163
2164         if test $dev != no ; then
2165                 AC_DEFINE_UNQUOTED(URANDOM_DEVICE,"$dev",[set to urandom device])
2166         fi
2167 fi
2168
2169 dnl ----------------------------------------------------------------
2170 dnl
2171 dnl Check for fetch URL support
2172 dnl             should be extended to support other fetch URL APIs
2173 dnl
2174 ol_link_fetch=no
2175 if test $ol_with_fetch != no ; then
2176         OL_LIB_FETCH
2177
2178         if test $ol_cv_lib_fetch != no ; then
2179                 LDIF_LIBS="$LDIF_LIBS $ol_link_fetch"
2180                 ol_link_fetch=freebsd
2181
2182         elif test $ol_with_fetch != auto ; then
2183                 AC_MSG_ERROR(no suitable API for --with-fetch=$ol_with_fetch)
2184         fi 
2185 fi
2186
2187 dnl ----------------------------------------------------------------
2188 dnl
2189 dnl Check for GNU readline
2190 dnl
2191 ol_link_readline=no
2192 if test $ol_with_readline != no ; then
2193         AC_CHECK_HEADERS(readline/readline.h readline/history.h)
2194
2195         if test $ac_cv_header_readline_readline_h = yes ; then
2196                 save_LIBS="$LIBS"
2197                 LIBS="$TERMCAP_LIBS $LIBS"
2198                 AC_CHECK_LIB(readline, readline, 
2199                         [have_readline=yes], [have_readline=no])
2200                 LIBS="$save_LIBS"
2201                         
2202                 if test $have_readline = yes ; then
2203                         ol_with_readline=found
2204                         ol_link_readline=yes
2205
2206                         READLINE_LIBS="-lreadline"
2207                 fi
2208         fi
2209 fi
2210
2211 if test $ol_link_readline = yes ; then
2212         AC_DEFINE(HAVE_READLINE, 1, [define if you have -lreadline])
2213 fi
2214
2215
2216 dnl ----------------------------------------------------------------
2217 dnl FreeBSD (and others) have crypt(3) in -lcrypt
2218 if test $ol_enable_crypt != no ; then
2219         AC_CHECK_FUNC(crypt, [have_crypt=yes], [
2220                 AC_CHECK_LIB(crypt, crypt, [LUTIL_LIBS="$LUTIL_LIBS -lcrypt"
2221                         have_crypt=yes], [have_crypt=no])])
2222
2223         if test $have_crypt = yes ; then
2224                 AC_DEFINE(HAVE_CRYPT,1, [define if crypt(3) is available])
2225         else
2226                 AC_MSG_WARN(could not find crypt)
2227                 if test $ol_enable_crypt = yes ; then
2228                         AC_MSG_ERROR(could not find crypt, select appropriate options or disable)
2229                 fi
2230
2231                 AC_MSG_WARN(disabling crypt support)
2232                 ol_enable_crypt=no
2233         fi
2234 fi
2235
2236 dnl ----------------------------------------------------------------
2237 dnl FreeBSD (and others) have setproctitle(3) in -lutil
2238 if test $ol_enable_proctitle != no ; then
2239         AC_CHECK_FUNC(setproctitle,     [have_setproctitle=yes], [
2240                 AC_CHECK_LIB(util, setproctitle,
2241                         [have_setproctitle=yes
2242                         LUTIL_LIBS="$LUTIL_LIBS -lutil"],
2243                         [have_setproctitle=no
2244                         LIBOBJS="$LIBOBJS setproctitle.o"
2245                         LIBSRCS="$LIBSRCS setproctitle.c"])])
2246
2247         if test $have_setproctitle = yes ; then
2248                 AC_DEFINE(HAVE_SETPROCTITLE,1,
2249                         [define if setproctitle(3) is available])
2250         fi
2251 fi
2252
2253 dnl ----------------------------------------------------------------
2254 dnl Check for SLPv2 Compliant API Library
2255 if test $ol_enable_slp != no ; then
2256         AC_CHECK_HEADERS( slp.h )
2257
2258         if test $ac_cv_header_slp_h = yes ; then
2259                 AC_CHECK_LIB(slp, SLPOpen, [have_slp=yes], [have_slp=no])
2260                 if test $have_slp = yes ; then
2261                         AC_DEFINE(HAVE_SLP, 1, [define if you have -lslp])
2262                         SLAPD_SLP_LIBS=-lslp
2263                 fi
2264
2265         elif test $ol_enable_slp = yes ; then
2266                 AC_MSG_ERROR([SLP not found])
2267         fi
2268 fi
2269
2270 dnl ----------------------------------------------------------------
2271 dnl Checks for typedefs, structures, and compiler characteristics.
2272 AC_TYPE_MODE_T
2273 AC_TYPE_OFF_T
2274 AC_TYPE_PID_T
2275 AM_TYPE_PTRDIFF_T
2276 AC_TYPE_SIGNAL
2277 AC_TYPE_SIZE_T
2278
2279 AC_CHECK_TYPE(ssize_t, [signed int])
2280 AC_CHECK_TYPE(caddr_t,  [char *])
2281
2282 OL_TYPE_SOCKLEN_T
2283 AC_STRUCT_ST_BLKSIZE
2284 AC_HEADER_TIME
2285 AC_STRUCT_TM
2286 AC_TYPE_UID_T
2287 OL_TYPE_SIG_ATOMIC_T
2288
2289 dnl AC_TYPE_GETGROUPS
2290
2291 OL_STRUCT_PASSWD_PW_GECOS
2292 OL_STRUCT_PASSWD_PW_PASSWD
2293
2294 OL_C_UPPER_LOWER
2295 AC_C_CONST
2296 OL_C_VOLATILE
2297
2298 if test $cross_compiling = yes ; then
2299         AC_DEFINE(CROSS_COMPILING, 1, [define if cross compiling])
2300 else
2301         AC_C_BIGENDIAN
2302 fi
2303
2304 AC_COMPILE_CHECK_SIZEOF(short) 
2305 AC_COMPILE_CHECK_SIZEOF(int) 
2306 AC_COMPILE_CHECK_SIZEOF(long)
2307
2308 if test "$ac_cv_sizeof_int" -lt 4 ; then
2309         AC_MSG_WARN([OpenLDAP requires 'int' to be 32 bits or greater.])
2310
2311         AC_DEFINE(LBER_INT_T,long)
2312 else
2313         AC_DEFINE(LBER_INT_T,int)
2314 fi
2315
2316 AC_DEFINE(LBER_LEN_T,long)
2317 AC_DEFINE(LBER_SOCKET_T,int)
2318 AC_DEFINE(LBER_TAG_T,long)
2319
2320 dnl ----------------------------------------------------------------
2321 dnl Checks for library functions.
2322 AC_FUNC_MEMCMP
2323 dnl AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h
2324 AC_FUNC_STRFTIME
2325 dnl AM_FUNC_STRTOD
2326
2327 OL_FUNC_INET_ATON
2328
2329 dnl Check for NT specific routines
2330 AC_CHECK_FUNC(_spawnlp, AC_DEFINE(HAVE_SPAWNLP,1,[if you have spawnlp()]))
2331
2332 AC_CHECK_FUNC(_snprintf, [ac_cv_func_snprintf=yes
2333         AC_DEFINE(snprintf, _snprintf, [define to snprintf routine])
2334 ])
2335
2336 AC_CHECK_FUNC(_vsnprintf, [ac_cv_func_vsnprintf=yes
2337         AC_DEFINE(vsnprintf, _vsnprintf, [define to vsnprintf routine])
2338 ])
2339
2340 AC_FUNC_VPRINTF
2341
2342 if test $ac_cv_func_vprintf = yes ; then
2343         dnl check for vsnprintf
2344         AC_CHECK_FUNCS(vsnprintf vsprintf)
2345 fi
2346
2347 AC_CHECK_FUNCS(         \
2348         bcopy                   \
2349         closesocket             \
2350         chroot                  \
2351         endgrent                \
2352         endpwent                \
2353         fcntl                   \
2354         flock                   \
2355         getdtablesize   \
2356         getgrgid                \
2357         gethostname             \
2358         getpass                 \
2359         getpassphrase   \
2360         getpwuid                \
2361         getpwnam                \
2362         getspnam                \
2363         gettimeofday    \
2364         initgroups              \
2365         lockf                   \
2366         memcpy                  \
2367         memmove                 \
2368         mkstemp                 \
2369         mktemp                  \
2370         pipe                    \
2371         read                    \
2372         recv                    \
2373         recvfrom                \
2374         setpwfile               \
2375         setgid                  \
2376         setegid                 \
2377         setsid                  \
2378         setuid                  \
2379         seteuid                 \
2380         sigaction               \
2381         signal                  \
2382         sigset                  \
2383         strdup                  \
2384         strerror                \
2385         strpbrk                 \
2386         strrchr                 \
2387         strsep                  \
2388         strstr                  \
2389         strtol                  \
2390         strtoul                 \
2391         strspn                  \
2392         sysconf                 \
2393         usleep                  \
2394         waitpid                 \
2395         wait4                   \
2396         write                   \
2397         send                    \
2398         sendto                  \
2399 )
2400
2401 dnl We actually may need to replace more than this.
2402 AC_REPLACE_FUNCS(getopt)
2403
2404 if test "$ac_cv_func_getopt" != yes; then
2405         LIBSRCS="$LIBSRCS getopt.c"
2406 fi
2407
2408 dnl ----------------------------------------------------------------
2409 # Check Configuration
2410 OL_SYS_ERRLIST
2411
2412 dnl ----------------------------------------------------------------
2413 dnl Sort out defines
2414
2415 if test "$ol_enable_debug" != no ; then
2416         AC_DEFINE(LDAP_DEBUG,1,
2417                 [define this to add debugging code])
2418 fi
2419 if test "$ol_enable_syslog" = yes ; then
2420         AC_DEFINE(LDAP_SYSLOG,1,
2421                 [define this to add syslog code])
2422 fi
2423 if test "$ol_enable_cache" = no ; then
2424         AC_DEFINE(LDAP_NOCACHE,1,
2425                 [define this to remove -lldap cache support])
2426 fi
2427 if test "$ol_link_kbind" != no ; then
2428         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND,LDAP_VENDOR_VERSION)
2429 fi
2430 if test "$ol_enable_proctitle" != no ; then
2431         AC_DEFINE(LDAP_PROCTITLE,1,
2432                 [define this for LDAP process title support])
2433 fi
2434 if test "$ol_enable_referrals" != no ; then
2435         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS,LDAP_VENDOR_VERSION)
2436 fi
2437 if test "$ol_enable_local" != no; then
2438         AC_DEFINE(LDAP_PF_LOCAL,1,[define to support PF_LOCAL])
2439 fi
2440 if test "$ol_link_ipv6" != no; then
2441         AC_DEFINE(LDAP_PF_INET6,1,[define to support PF_INET6])
2442 fi
2443 if test "$ol_enable_cleartext" != no ; then
2444         AC_DEFINE(SLAPD_CLEARTEXT,1,[define to support cleartext passwords])
2445 fi
2446 if test "$ol_enable_crypt" != no ; then
2447         AC_DEFINE(SLAPD_CRYPT,1,[define to support crypt(3) passwords])
2448 fi
2449 if test "$ol_link_kpasswd" != no ; then
2450         AC_DEFINE(SLAPD_KPASSWD,1,[define to support Kerberos passwords])
2451 fi
2452 if test "$ol_link_spasswd" != no ; then
2453         AC_DEFINE(SLAPD_SPASSWD,1,[define to support SASL passwords])
2454 fi
2455 dnl if test "$ol_enable_multimaster" != no ; then
2456 dnl     AC_DEFINE(SLAPD_MULTIMASTER,1,[define to support multimaster replication])
2457 dnl fi
2458 if test "$ol_enable_phonetic" != no ; then
2459         AC_DEFINE(SLAPD_PHONETIC,1,[define to support phonetic])
2460 fi
2461 if test "$ol_enable_rlookups" != no ; then
2462         AC_DEFINE(SLAPD_RLOOKUPS,1,[define to support reverse lookups])
2463 fi
2464 if test "$ol_enable_aci" != no ; then
2465         AC_DEFINE(SLAPD_ACI_ENABLED,1,[define to support per-object ACIs])
2466 fi
2467
2468 if test "$ol_link_modules" != no ; then
2469         AC_DEFINE(SLAPD_MODULES,1,[define to support modules])
2470         BUILD_SLAPD=yes
2471         SLAPD_MODULES_LDFLAGS="-dlopen self"
2472 fi
2473
2474 if test "$ol_enable_bdb" != no ; then
2475         AC_DEFINE(SLAPD_BDB,1,[define to support BDB backend])
2476         BUILD_SLAPD=yes
2477         BUILD_BDB=yes
2478         if test "$ol_with_bdb_module" != static ; then
2479                 AC_DEFINE(SLAPD_BDB_DYNAMIC,1,
2480                         [define to support dynamic BDB backend])
2481                 BUILD_BDB=mod
2482                 BUILD_BDB_DYNAMIC=shared
2483                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-bdb/back_bdb.la"
2484                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-bdb"
2485         else
2486                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-bdb"
2487         fi
2488 fi
2489
2490 if test "$ol_link_dnssrv" != no ; then
2491         AC_DEFINE(SLAPD_DNSSRV,1,[define to support DNS SRV backend])
2492         BUILD_SLAPD=yes
2493         BUILD_DNSSRV=yes
2494         if test "$ol_with_dnssrv_module" != static ; then
2495                 AC_DEFINE(SLAPD_DNSSRV_DYNAMIC,1,
2496                         [define to support dynamic DNS SRV backend])
2497                 BUILD_DNSSRV=mod
2498                 BUILD_DNSSRV_DYNAMIC=shared
2499                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-dnssrv/back_dnssrv.la"
2500                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-dnssrv"
2501         else
2502                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-dnssrv"
2503         fi
2504 fi
2505
2506 if test "$ol_enable_ldap" != no ; then
2507         AC_DEFINE(SLAPD_LDAP,1,[define to support LDAP backend])
2508         BUILD_SLAPD=yes
2509         BUILD_LDAP=yes
2510         if test "$ol_with_ldap_module" != static ; then
2511                 AC_DEFINE(SLAPD_LDAP_DYNAMIC,1,
2512                         [define to support dynamic LDAP backend])
2513                 BUILD_LDAP=mod
2514                 BUILD_LDAP_DYNAMIC=shared
2515                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-ldap/back_ldap.la"
2516                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-ldap"
2517         else
2518                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-ldap"
2519         fi
2520 fi
2521
2522 if test "$ol_link_ldbm" != no -a $ol_enable_ldbm != no; then
2523         AC_DEFINE(SLAPD_LDBM,1,[define to support LDBM backend])
2524         BUILD_SLAPD=yes
2525         BUILD_LDBM=yes
2526         LDBM_LIB="-lldbm"
2527         if test "$ol_with_ldbm_module" != static ; then
2528                 AC_DEFINE(SLAPD_LDBM_DYNAMIC,1,
2529                         [define to support dynamic LDBM backend])
2530                 BUILD_LDBM=mod
2531                 BUILD_LDBM_DYNAMIC=shared
2532                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-ldbm/back_ldbm.la"
2533                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-ldbm"
2534         else
2535                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-ldbm"
2536         fi
2537 fi
2538
2539 if test "$ol_enable_meta" != no ; then
2540         if test "$ol_enable_ldap" = no ; then
2541                 AC_MSG_ERROR([need --enable-ldap to use --enable-meta])
2542         fi
2543         if test "$ol_enable_rewrite" = no ; then
2544                 AC_MSG_ERROR([need --enable-rewrite to use --enable-meta])
2545         fi
2546         AC_DEFINE(SLAPD_META,1,[define to support LDAP Metadirectory backend])
2547         BUILD_SLAPD=yes
2548         BUILD_META=yes
2549         if test "$ol_with_meta_module" != static ; then
2550                 AC_DEFINE(SLAPD_META_DYNAMIC,1,
2551                         [define to support dynamic LDAP Metadirectory backend])
2552                 BUILD_META=mod
2553                 BUILD_META_DYNAMIC=shared
2554                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-meta/back_meta.la"
2555                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-meta"
2556         else
2557                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-meta"
2558         fi
2559 fi
2560
2561 if test "$ol_enable_monitor" != no ; then
2562         AC_DEFINE(SLAPD_MONITOR,1,[define to support cn=Monitor backend])
2563         BUILD_SLAPD=yes
2564         BUILD_MONITOR=yes
2565         if test "$ol_with_monitor_module" != static ; then
2566                 AC_DEFINE(SLAPD_MONITOR_DYNAMIC,1,
2567                         [define to support dynamic cn=Monitor backend])
2568                 BUILD_MONITOR=mod
2569                 BUILD_MONITOR_DYNAMIC=shared
2570                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-monitor/back_monitor.la"
2571                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-monitor"
2572         else
2573                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-monitor"
2574         fi
2575 fi
2576
2577 if test "$ol_enable_passwd" != no ; then
2578         AC_DEFINE(SLAPD_PASSWD,1,[define to support PASSWD backend])
2579         BUILD_SLAPD=yes
2580         BUILD_PASSWD=yes
2581         if test "$ol_with_passwd_module" != static ; then
2582                 AC_DEFINE(SLAPD_PASSWD_DYNAMIC,1,
2583                         [define to support dynamic PASSWD backend])
2584                 BUILD_PASSWD=mod
2585                 BUILD_PASSWD_DYNAMIC=shared
2586                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-passwd/back_passwd.la"
2587                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-passwd"
2588         else
2589                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-passwd"
2590         fi
2591 fi
2592
2593 if test "$ol_link_perl" != no ; then
2594         AC_DEFINE(SLAPD_PERL,1,[define to support PERL backend])
2595         BUILD_SLAPD=yes
2596         BUILD_PERL=yes
2597         if test "$ol_with_perl_module" != static ; then
2598                 AC_DEFINE(SLAPD_PERL_DYNAMIC,1,
2599                         [define to support dynamic PERL backend])
2600                 BUILD_PERL=mod
2601                 BUILD_PERL_DYNAMIC=shared
2602                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-perl/back_perl.la"
2603                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-perl"
2604         else
2605                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-perl"
2606         fi
2607 fi
2608
2609 if test "$ol_enable_shell" != no ; then
2610         AC_DEFINE(SLAPD_SHELL,1,[define to support SHELL backend])
2611         BUILD_SLAPD=yes
2612         BUILD_SHELL=yes
2613         if test "$ol_with_shell_module" != static ; then
2614                 AC_DEFINE(SLAPD_SHELL_DYNAMIC,1,
2615                         [define to support dynamic SHELL backend])
2616                 BUILD_SHELL=mod
2617                 BUILD_SHELL_DYNAMIC=shared
2618                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-shell/back_shell.la"
2619                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-shell"
2620         else
2621                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-shell"
2622         fi
2623 fi
2624
2625 if test "$ol_enable_tcl" != no ; then
2626         AC_DEFINE(SLAPD_TCL,1,[define to support TCL backend])
2627         BUILD_SLAPD=yes
2628         BUILD_TCL=yes
2629         if test "$ol_with_tcl_module" != static; then
2630                 AC_DEFINE(SLAPD_TCL_DYNAMIC,1,
2631                         [define to support dynamic TCL backend])
2632                 BUILD_TCL=mod
2633                 BUILD_TCL_DYNAMIC=shared
2634                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-tcl/back_tcl.la"
2635                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-tcl"
2636         else
2637                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-tcl"
2638         fi
2639 fi
2640
2641 if test "$ol_link_sql" != no ; then
2642         AC_DEFINE(SLAPD_SQL,1,[define to support SQL backend])
2643         BUILD_SLAPD=yes
2644         BUILD_SQL=yes
2645         if test "$ol_with_sql_module" != static; then
2646                 AC_DEFINE(SLAPD_SQL_DYNAMIC,1,
2647                         [define to support dynamic SQL backend])
2648                 BUILD_SQL=mod
2649                 BUILD_SQL_DYNAMIC=shared
2650                 SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-sql/back_sql.la"
2651                 SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-sql"
2652         else
2653                 SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-sql"
2654         fi
2655 fi
2656
2657 if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
2658         $BUILD_SLAPD = yes ; then
2659         BUILD_SLURPD=yes
2660 fi
2661
2662 if test "$ol_enable_rewrite" != no ; then
2663         AC_DEFINE(ENABLE_REWRITE,1,[define to enable rewriting in back-ldap and back-meta])
2664         BUILD_REWRITE=yes
2665         SLAPD_LIBS="$SLAPD_LIBS -lrewrite"
2666 fi
2667
2668 dnl ----------------------------------------------------------------
2669
2670 dnl
2671 dnl For Windows build, we don't want to include -dlopen flags.
2672 dnl They hurt more than they help.
2673 dnl
2674
2675 if test "$ac_cv_mingw32" = yes ; then
2676         PLAT=NT
2677         SLAPD_MODULES_LDFLAGS=
2678         SLAPD_MODULES_LIST=
2679 else
2680         PLAT=UNIX
2681 fi
2682
2683 AC_SUBST(LIBSRCS)
2684 AC_SUBST(PLAT)
2685 AC_SUBST(BUILD_LIBS_DYNAMIC)
2686
2687 AC_SUBST(BUILD_SLAPD)
2688   AC_SUBST(BUILD_BDB)
2689   AC_SUBST(BUILD_DNSSRV)
2690   AC_SUBST(BUILD_LDAP)
2691   AC_SUBST(BUILD_LDBM)
2692   AC_SUBST(BUILD_META)
2693   AC_SUBST(BUILD_MONITOR)
2694   AC_SUBST(BUILD_PASSWD)
2695   AC_SUBST(BUILD_PERL)
2696   AC_SUBST(BUILD_SHELL)
2697   AC_SUBST(BUILD_SQL)
2698   AC_SUBST(BUILD_TCL)
2699   AC_SUBST(BUILD_BDB_DYNAMIC)
2700   AC_SUBST(BUILD_DNSSRV_DYNAMIC)
2701   AC_SUBST(BUILD_LDAP_DYNAMIC)
2702   AC_SUBST(BUILD_LDBM_DYNAMIC)
2703   AC_SUBST(BUILD_META_DYNAMIC)
2704   AC_SUBST(BUILD_MONITOR_DYNAMIC)
2705   AC_SUBST(BUILD_PASSWD_DYNAMIC)
2706   AC_SUBST(BUILD_PERL_DYNAMIC)
2707   AC_SUBST(BUILD_SHELL_DYNAMIC)
2708   AC_SUBST(BUILD_SQL_DYNAMIC)
2709   AC_SUBST(BUILD_TCL_DYNAMIC)
2710 AC_SUBST(BUILD_SLURPD)
2711
2712 AC_SUBST(LDBM_LIB)
2713
2714 AC_SUBST(LDAP_LIBS)
2715 AC_SUBST(LDIF_LIBS)
2716 AC_SUBST(SLAPD_LIBS)
2717 AC_SUBST(SLURPD_LIBS)
2718 AC_SUBST(LDBM_LIBS)
2719 AC_SUBST(LTHREAD_LIBS)
2720 AC_SUBST(LUTIL_LIBS)
2721 AC_SUBST(WRAP_LIBS)
2722 AC_SUBST(MOD_TCL_LIB)
2723
2724 AC_SUBST(SLAPD_MODULES_CPPFLAGS)
2725 AC_SUBST(SLAPD_MODULES_LDFLAGS)
2726 AC_SUBST(SLAPD_MODULES_LIST)
2727
2728 AC_SUBST(SLAPD_STATIC_BACKENDS)
2729 AC_SUBST(SLAPD_DYNAMIC_BACKENDS)
2730
2731 AC_SUBST(PERL_CPPFLAGS)
2732 AC_SUBST(SLAPD_PERL_LDFLAGS)
2733 AC_SUBST(MOD_PERL_LDFLAGS)
2734
2735 AC_SUBST(KRB4_LIBS)
2736 AC_SUBST(KRB5_LIBS)
2737 AC_SUBST(READLINE_LIBS)
2738 AC_SUBST(SASL_LIBS)
2739 AC_SUBST(TERMCAP_LIBS)
2740 AC_SUBST(TLS_LIBS)
2741 AC_SUBST(MODULES_LIBS)
2742 AC_SUBST(AUTH_LIBS)
2743
2744 AC_SUBST(SLAPD_SLP_LIBS)
2745
2746 AC_SUBST(SLAPD_SQL_LDFLAGS)
2747 AC_SUBST(SLAPD_SQL_LIBS)
2748 AC_SUBST(SLAPD_SQL_INCLUDES)
2749
2750 dnl ----------------------------------------------------------------
2751 dnl final output
2752 dnl
2753
2754 AC_OUTPUT( \
2755 Makefile:build/top.mk:Makefile.in:build/dir.mk \
2756 doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \
2757 doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk \
2758 doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk \
2759 doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk \
2760 doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk \
2761 doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk \
2762 clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
2763 clients/finger/Makefile:build/top.mk:clients/finger/Makefile.in:build/rules.mk \
2764 clients/mail500/Makefile:build/top.mk:clients/mail500/Makefile.in:build/rules.mk \
2765 clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
2766 clients/maildap/Makefile:build/top.mk:clients/maildap/Makefile.in:build/rules.mk \
2767 clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk \
2768 include/Makefile:build/top.mk:include/Makefile.in \
2769 libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk      \
2770 libraries/libavl/Makefile:build/top.mk:libraries/libavl/Makefile.in:build/lib.mk:build/lib-static.mk    \
2771 libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk  \
2772 libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk  \
2773 libraries/libldap_r/Makefile:build/top.mk:libraries/libldap_r/Makefile.in:build/lib.mk:build/lib-shared.mk      \
2774 libraries/libldbm/Makefile:build/top.mk:libraries/libldbm/Makefile.in:build/lib.mk:build/lib-static.mk  \
2775 libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.mk:build/lib-static.mk  \
2776 libraries/liblunicode/Makefile:build/top.mk:libraries/liblunicode/Makefile.in:build/lib.mk:build/lib-static.mk  \
2777 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk        \
2778 libraries/librewrite/Makefile:build/top.mk:libraries/librewrite/Makefile.in:build/lib.mk:build/lib-static.mk \
2779 servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk \
2780 servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk \
2781 servers/slapd/back-bdb/Makefile:build/top.mk:servers/slapd/back-bdb/Makefile.in:build/mod.mk \
2782 servers/slapd/back-dnssrv/Makefile:build/top.mk:servers/slapd/back-dnssrv/Makefile.in:build/mod.mk \
2783 servers/slapd/back-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.in:build/mod.mk \
2784 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/mod.mk \
2785 servers/slapd/back-meta/Makefile:build/top.mk:servers/slapd/back-meta/Makefile.in:build/mod.mk \
2786 servers/slapd/back-monitor/Makefile:build/top.mk:servers/slapd/back-monitor/Makefile.in:build/mod.mk \
2787 servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/mod.mk \
2788 servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/mod.mk \
2789 servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/mod.mk \
2790 servers/slapd/back-sql/Makefile:build/top.mk:servers/slapd/back-sql/Makefile.in:build/mod.mk \
2791 servers/slapd/back-tcl/Makefile:build/top.mk:servers/slapd/back-tcl/Makefile.in:build/mod.mk \
2792 servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
2793 servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
2794 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
2795 tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \
2796 tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk \
2797 ,[
2798 date > stamp-h
2799 echo Please \"make depend\" to build dependencies
2800 ])