]> git.sur5r.net Git - openldap/blob - configure.in
Original test failed under FreeBSD. Reworked LN_H detection
[openldap] / configure.in
1 dnl
2 dnl Copyright 1998,1999 The OpenLDAP Foundation.  All Rights Reserved.
3 dnl 
4 dnl Redistribution and use in source and binary forms are permitted only
5 dnl as authorized by the OpenLDAP Public License.  A copy of this
6 dnl license is available at http://www.OpenLDAP.org/license.html or
7 dnl in file LICENSE in the top-level directory of the distribution.
8 dnl
9
10 dnl Configure.in for OpenLDAP
11 AC_INIT(include/ldap.h)dnl
12 AC_CONFIG_AUX_DIR(build)dnl
13 AM_INIT_AUTOMAKE(OpenLDAP,[2.0-devel], [no ac_define])dnl
14
15 dnl We use autoconf features new to 2.13.
16 dnl     aclocal.m4 should be built using aclocal from automake 1.4
17 AC_PREREQ(2.13)dnl Required Autoconf version
18
19 AC_CONFIG_HEADER(include/portable.h include/ldap_features.h)dnl
20
21 dnl
22 dnl Start Args
23 AC_MSG_CHECKING(configure arguments)
24 AC_PREFIX_DEFAULT(/usr/local)
25
26 top_builddir=`pwd`
27 AC_SUBST(top_builddir)dnl
28
29 ldap_subdir="openldap"
30
31 AC_ARG_WITH(subdir, [  --with-subdir=DIR change default subdirectory used for installs], [
32         if test "$withval" = "no"; then
33                 ldap_subdir=""
34         elif test "$withval" != "yes"; then
35                 ldap_subdir="$withval"
36         fi
37 ])dnl
38
39 AC_SUBST(ldap_subdir)dnl
40
41 OL_ARG_ENABLE(debug,[  --enable-debug   enable debugging], yes)dnl
42 ol_enable_syslog=no
43 dnl OL_ARG_ENABLE(syslog,[  --enable-syslog     enable syslog support], auto)dnl
44 OL_ARG_ENABLE(proctitle,[  --enable-proctitle   enable proctitle support], yes)dnl
45 OL_ARG_ENABLE(cache,[  --enable-cache   enable caching], yes)dnl
46 OL_ARG_ENABLE(dns,[  --enable-dns               enable V2 DNS  extension], no)dnl
47 OL_ARG_ENABLE(referrals,[  --enable-referrals   enable V2 Referrals extension], yes)dnl
48 OL_ARG_ENABLE(cldap,[  --enable-cldap   enable connectionless ldap], no)dnl
49 OL_ARG_ENABLE(x_compile,[  --enable-x-compile   enable cross compiling],
50         no, [yes no])dnl
51
52 dnl General "with" options
53 OL_ARG_ENABLE(dmalloc,[  --enable-dmalloc       enable debug malloc support], no)dnl
54
55 OL_ARG_WITH(kerberos,[  --with-kerberos with Kerberos support],
56         auto, [auto k5 k4 afs yes no])
57 OL_ARG_WITH(readline,[  --with-readline  with readline support],
58         auto, [auto yes no] )
59 OL_ARG_WITH(threads,[  --with-threads   use threads],
60         auto, [auto posix mach lwp yes no manual] )
61 OL_ARG_WITH(tls,[  --with-tls  with TLS/SSL support],
62         auto, [auto ssleay openssl yes no] )
63 OL_ARG_WITH(yielding_select,[  --with-yielding-select   with implicitly yielding select],
64         auto, [auto yes no manual] )
65
66 dnl Server options
67
68 dnl LDAPD OPTIONS
69 AC_ARG_WITH(xxldapdoptions,[LDAPD Options:])
70 OL_ARG_ENABLE(ldapd,[  --enable-ldapd   enable building ldapd], no)dnl
71
72 dnl SLAPD OPTIONS
73 AC_ARG_WITH(xxslapdoptions,[SLAPD Options:])
74 OL_ARG_ENABLE(slapd,[  --enable-slapd   enable building slapd], yes)dnl
75 OL_ARG_ENABLE(aclgroups,[    --enable-aclgroups enable ACL group support], auto)dnl
76 OL_ARG_ENABLE(cleartext,[    --enable-cleartext enable cleartext passwords], yes)dnl
77 OL_ARG_ENABLE(crypt,[    --enable-crypt enable crypt(3) passwords], auto)dnl
78 OL_ARG_ENABLE(wrappers,[    --enable-wrappers   enable tcp wrapper support], no)dnl
79 OL_ARG_ENABLE(phonetic,[    --enable-phonetic   enable phonetic/soundex], no)dnl
80 OL_ARG_ENABLE(rlookups,[    --enable-rlookups   enable reverse lookups], auto)dnl
81
82 dnl SLAPD Backend options
83 OL_ARG_ENABLE(bdb2,[    --enable-bdb2   enable bdb2 backend], no)dnl
84 OL_ARG_ENABLE(ldbm,[    --enable-ldbm   enable ldbm backend], yes)dnl
85 OL_ARG_WITH(ldbm_api,[      --with-ldbm-api     use LDBM API], auto,
86         [auto db2 db gdbm ndbm manual])
87 OL_ARG_WITH(ldbm_type,[      --with-ldbm-type   use LDBM type], auto,
88         [auto btree hash])
89
90 OL_ARG_ENABLE(passwd,[    --enable-passwd       enable passwd backend], no)dnl
91 OL_ARG_ENABLE(perl,[    --enable-perl   enable perl backend], no)dnl
92 OL_ARG_ENABLE(shell,[    --enable-shell enable shell backend], no)dnl
93 OL_ARG_ENABLE(tcl,[    --enable-tcl     enable tcl backend], no)dnl
94
95 dnl SLURPD OPTIONS
96 AC_ARG_WITH(xxslurpdoptions,[SLURPD Options:])
97 OL_ARG_ENABLE(slurpd,[  --enable-slurpd enable building slurpd], auto)dnl
98
99 AC_ARG_WITH(xxliboptions,[Library Generation & Linking Options])
100 AM_ENABLE_STATIC
101 dnl AM_DISABLE_SHARED
102 AM_ENABLE_SHARED
103
104 dnl General "enable" options
105 # validate options
106 if test $ol_enable_dns = yes ; then
107         if test $ol_enable_referrals = no ; then
108                 AC_MSG_ERROR([DNS requires --enable-referrals])
109         fi
110         if test $ol_enable_referrals = auto ; then
111                 AC_MSG_WARN([DNS requires referrals, adding --enable-referrals])
112                 ol_enable_referrals=yes
113         fi
114 fi
115
116 if test $ol_enable_slapd = no ; then
117         dnl SLAPD was specificallly disabled
118         if test $ol_enable_bdb2 = yes ; then
119                 AC_MSG_WARN([slapd disabled, ignoring --enable_bdb2 argument])
120         fi
121         if test $ol_enable_ldbm = yes ; then
122                 AC_MSG_WARN([slapd disabled, ignoring --enable_ldbm argument])
123         fi
124         if test $ol_enable_passwd = yes ; then
125                 AC_MSG_WARN([slapd disabled, ignoring --enable_passwd argument])
126         fi
127         if test $ol_enable_perl = yes ; then
128                 AC_MSG_WARN([slapd disabled, ignoring --enable_perl argument])
129         fi
130         if test $ol_enable_shell = yes ; then
131                 AC_MSG_WARN([slapd disabled, ignoring --enable_shell argument])
132         fi
133         if test $ol_enable_tcl = yes ; then
134                 AC_MSG_WARN([slapd disabled, ignoring --enable_tcl argument])
135         fi
136         if test $ol_enable_aclgroups = yes ; then
137                 AC_MSG_WARN([slapd disabled, ignoring --enable_aclgroups argument])
138         fi
139         if test $ol_enable_wrappers = yes ; then
140                 AC_MSG_WARN([slapd disabled, ignoring --enable_wrappers argument])
141         fi
142         if test $ol_enable_phonetic = yes ; then
143                 AC_MSG_WARN([slapd disabled, ignoring --enable_phonetic argument])
144         fi
145         if test $ol_enable_rlookups = yes ; then
146                 AC_MSG_WARN([slapd disabled, ignoring --enable_rlookups argument])
147         fi
148         if test $ol_with_ldbm_api != auto ; then
149                 AC_MSG_WARN([slapd disabled, ignoring --with_ldbm_api argument])
150         fi
151         if test $ol_with_ldbm_type != auto ; then
152                 AC_MSG_WARN([slapd disabled, ignoring --with_ldbm_type argument])
153         fi
154         if test $ol_enable_slurpd = yes ; then
155                 AC_MSG_ERROR([slurpd requires slapd])
156         fi
157
158         # force settings to no
159         ol_enable_bdb2=no
160         ol_enable_ldbm=no
161         ol_enable_passwd=no
162         ol_enable_perl=no
163         ol_enable_shell=no
164         ol_enable_tcl=no
165         ol_enable_aclgroups=no
166         ol_enable_wrappers=no
167         ol_enable_phonetic=no
168         ol_enable_rlookups=no
169         ol_with_ldbm_api=no
170         ol_with_ldbm_type=no
171         ol_enable_slurpd=no
172
173 elif test $ol_enable_ldbm = no ; then
174         dnl SLAPD without LDBM
175
176         if test $ol_with_ldbm_api != auto ; then
177                 AC_MSG_WARN([LDBM disabled, ignoring --with_ldbm_api argument])
178         fi
179
180         if test $ol_with_ldbm_type != auto ; then
181                 AC_MSG_WARN([LDBM disabled, ignoring --with_ldbm_type argument])
182         fi
183
184         if test $ol_enable_bdb2 = yes ; then
185                 AC_MSG_ERROR([BDB2 requires --enable-ldbm])
186         fi
187
188         if test $ol_enable_passwd = no -a \
189                 $ol_enable_perl = no -a \
190                 $ol_enable_shell = no -a \
191                 $ol_enable_tcl = no ; then
192                 AC_MSG_ERROR([slapd requires a backend])
193         fi
194
195         ol_with_ldbm_api=no
196         ol_with_ldbm_type=no
197
198 elif test $ol_enable_bdb2 = yes ; then
199         dnl SLAPD with BDB2
200
201         if test $ol_with_ldbm_api != auto -a \
202                 $ol_with_ldbm_api != db2 ; then
203                 AC_MSG_ERROR([BDB2 requires LDBM API DB2])
204         fi
205
206         ol_with_ldbm_api=db2
207
208 else
209         dnl SLAPD with LDBM
210
211         if test $ol_enable_bdb2 != no ; then
212                 if test $ol_with_ldbm_api != auto -a \
213                         $ol_with_ldbm_api != db2 ; then
214                         AC_MSG_WARN([BDB2 requires LDBM api db2 or auto])
215                         ol_enable_bdb2=no
216                 fi
217         fi
218
219         if test $ol_with_ldbm_api = gdbm -a \
220                 $ol_with_ldbm_type = btree ; then
221                 AC_MSG_ERROR([GDBM only supports LDBM type hash])
222         fi
223         if test $ol_with_ldbm_api = ndbm -a \
224                 $ol_with_ldbm_type = btree ; then
225                 AC_MSG_ERROR([NDBM only supports LDBM type hash])
226         fi
227 fi
228
229 if test $ol_enable_slurpd = yes ; then
230         dnl SLURPD was specifically enabled
231         if test $ol_with_threads = no ; then
232                 AC_MSG_ERROR([slurpd requires threads])
233         fi
234 fi
235
236 AC_MSG_RESULT(done)
237
238 AC_CANONICAL_HOST
239
240 ## Initialize vars
241 LDAP_LIBS=
242 LDBM_LIBS=
243 LTHREAD_LIBS=
244 LUTIL_LIBS=
245
246 LDAPD_LIBS=
247 SLAPD_LIBS=
248 SLURPD_LIBS=
249
250 BUILD_LDAPD=no
251 BUILD_SLAPD=no
252 BUILD_SLURPD=no
253
254 BUILD_BDB2=no
255 BUILD_LDBM=no
256 BUILD_PASSWD=no
257 BUILD_PERL=no
258 BUILD_SHELL=no
259 BUILD_TCL=no
260 BUILD_THREAD=no
261
262 SLAPD_PERL_LDFLAGS=
263 SLAPD_PERL_CPPFLAGS=
264
265 KRB_LIBS=
266 READLINE_LIBS=
267 TERMCAP_LIBS=
268 TLS_LIBS=
269
270 dnl ----------------------------------------------------------------
271 dnl Checks for programs
272
273 AC_PROG_INSTALL
274
275 dnl The default compiler is cc (NOT gcc)
276 CC=${CC-"cc"}
277 dnl The default CFLAGS is empty NOT whatever AC_PROG_CC sets.
278 dnl CFLAGS=${CFLAGS-""}
279
280 AM_PROG_LIBTOOL
281 dnl AC_PROG_MAKE_SET
282
283 AC_PROG_AWK
284 OL_PROG_LN_H
285 AC_PROG_LN_S
286
287 AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail,
288         $PATH:/usr/libexec:/usr/lib:/usr/sbin:/usr/etc:/etc)
289 AC_PATH_PROG(EDITOR, vi, /usr/ucb/vi, $PATH:/usr/ucb)
290 AC_PATH_PROG(FINGER, finger, /usr/ucb/finger, $PATH:/usr/ucb)
291
292 if test $ol_enable_perl = yes ; then
293         AC_PATH_PROG(PERLBIN, perl, /usr/bin/perl)
294
295         if test "no$PERLBIN" = "no" ; then
296                 ol_enable_perl=no
297         fi
298
299         SLAPD_PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e s/-lc//`"
300         SLAPD_PERL_CPPFLAGS="`$PERLBIN -MExtUtils::Embed -e perl_inc`"
301 fi
302
303 AC_PROG_CPP
304
305 if test $cross_compiling = yes -a $ol_enable_x_compile = yes; then
306         AC_MSG_WARN([cross compiling....  some functionality will be removed.])
307
308 elif test $cross_compiling = no -a $ol_enable_x_compile = yes; then
309         AC_MSG_WARN([programs compiled here do run here...])
310         AC_MSG_ERROR([  if not cross compiling, use --disable-x-compile.])
311
312 elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
313         AC_MSG_WARN([programs compiled here do not run here...])
314         AC_MSG_ERROR([  if cross compiling,  add --enable-x-compile.])
315 fi
316
317 dnl Checks for UNIX Variants
318 AC_AIX
319 AC_ISC_POSIX
320 AC_MINIX
321
322 dnl BeOS requires -lbe -lroot
323 AC_CHECK_LIB(be, be_app,[LIBS="$LIBS -lbe -lroot"])
324
325 dnl Checks for system services
326 AC_CYGWIN
327 AC_MINGW32
328 AC_EXEEXT
329 AC_OBJEXT
330
331 dnl OpenLDAP requires STDC features
332 AM_PROG_CC_STDC
333 if test "X${am_cv_prog_cc_stdc}" = "Xno" ; then
334         AC_MSG_ERROR([OpenLDAP requires compiler to support STDC prototypes.])
335 fi
336
337 dnl AM_C_PROTOTYPES
338
339 dnl Checks for libraries
340
341 dnl Find socket()
342 dnl Likely combinations:
343 dnl             -lsocket [ -lnsl_s | -lnsl ]
344 dnl             -linet
345
346 AC_CHECK_FUNC(socket, [have_socket=yes], [      
347 dnl
348 dnl hopefully we won't include too many libraries
349 dnl
350         AC_CHECK_LIB(socket, main)
351         AC_CHECK_LIB(net, main)
352         AC_CHECK_LIB(nsl_s, main)
353         AC_CHECK_LIB(nsl, main)
354         AC_CHECK_LIB(inet, socket)
355         AC_CHECK_LIB(gen, main)
356 ])
357
358 dnl Check for resolver routines
359 AC_CHECK_FUNCS(res_search)
360 if test $ac_cv_func_res_search = "no" ; then 
361         AC_CHECK_LIB(bind, res_search)
362         if test "$ac_cv_lib_bind_res_search" = "yes" ; then
363                 AC_DEFINE(HAVE_RES_SEARCH,1)
364         else
365                 AC_CHECK_LIB(resolv, res_search)
366                 if test "$ac_cv_lib_resolv_res_search" = "yes" ; then
367                         AC_DEFINE(HAVE_RES_SEARCH,1)
368                 fi
369         fi
370 fi
371
372 dnl HP-UX requires -lV3
373 AC_CHECK_LIB(V3, sigset)
374
375 # ISODE tests
376 ol_link_isode=no
377 if test $ol_enable_ldapd != no ; then
378         dnl look for ISODE libraries
379         AC_CHECK_LIB(xtpp, main, [
380                 ol_link_isode=yes
381                 AC_DEFINE(HAVE_XTPP,1, [define if you have -lxttp])
382                 LDAPD_LIBS="$LDAPD_LIBS -lxtpp -lxtdsap -lxtisode -losi"
383                 ],:,[-lxtdsap -lxtisode -losi])
384         AC_CHECK_LIB(dsap, main, [
385                 ol_link_isode=yes
386                 AC_DEFINE(HAVE_DSAP,1, [define if you have -ldsap])
387                 LDAPD_LIBS="$LDAPD_LIBS -ldsap"
388                 ],:,[-lisode])
389         AC_CHECK_LIB(isode, main, [
390                 ol_link_isode=yes
391                 AC_DEFINE(HAVE_ISODE,1, [define if you have -lisode])
392                 LDAPD_LIBS="$LDAPD_LIBS -lisode"
393                 ],:)
394 fi
395
396 if test $ol_link_isode != no; then
397         AC_CHECK_LIB(pp, main, [
398                 AC_DEFINE(HAVE_PP,1, [define if you have -lpp])
399                 LDAPD_LIBS="-lpp $LDAPD_LIBS"
400                 ],:)
401
402         AC_PATH_PROG(PEPSY, pepsy)
403 fi
404
405 dnl
406 dnl check for kerberos
407 dnl
408 ol_link_kerberos=no
409
410 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k5 ; then
411         AC_CHECK_HEADERS(kerberosIV/krb.h kerberosIV/des.h)
412
413         if test $ac_cv_header_kerberosIV_krb_h = yes ; then
414                 AC_CHECK_LIB(krb4, main, [have_k5=yes], [have_k5=no],
415                         [-lkrb5 -ldes425])
416
417                 if test $have_k5 = yes ; then
418                         ol_with_kerberos=found
419                         ol_link_kerberos=yes
420
421                         KRB_LIBS="-lkrb4 -lkrb5 -ldes425"
422
423                         LIBS="$KRB_LIBS $LIBS"
424
425                         AC_CACHE_CHECK([for des_debug in Kerberos libraries],
426                                 [ol_cv_var_des_debug], [
427                                 dnl save the flags
428                                 save_LIBS="$LIBS"
429                                 LIBS="$KRB_LIBS $LIBS"
430                                 AC_TRY_LINK([
431 #include <kerberosIV/krb.h>
432 #include <kerberosIV/des.h>
433 extern int des_debug;
434 ],[
435 des_debug = 1;
436 ],                              ol_cv_var_des_debug=yes, ol_cv_var_des_debug=no)
437                                 dnl restore the LIBS
438                                 LIBS="$save_LIBS"
439                         ])
440
441                         if test $ol_cv_var_des_debug = yes ; then
442                                 AC_DEFINE(HAVE_DES_DEBUG,1,
443                                         [define if you have Kerberos des_debug])
444                         fi
445
446                         LIBS="$save_LIBS"
447                 fi
448         fi
449 fi
450
451 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k4 ; then
452         AC_CHECK_HEADERS(krb.h des.h)
453
454         if test $ac_cv_header_krb_h = yes ; then
455                 AC_CHECK_LIB(krb, main, [have_k4=yes], [have_k4=no], [-ldes])
456
457                 if test $have_k4 = yes ; then
458                         ol_with_kerberos=found
459                         ol_link_kerberos=yes
460
461                         KRB_LIBS="-lkrb -ldes"
462                 fi
463         fi
464 fi
465
466 if test $ol_link_kerberos = yes ; then
467         AC_DEFINE(HAVE_KERBEROS, 1, [define if you have Kerberos])
468 fi
469
470 dnl
471 dnl Check for SSL/TLS
472 dnl
473 ol_link_tls=no
474 if test $ol_with_tls != no ; then
475         
476         AC_CHECK_HEADERS(ssl.h)
477         
478         if test $ac_cv_header_ssl_h = yes ; then
479                 AC_CHECK_LIB(ssl, SSLeay_add_ssl_algorithms, 
480                         [have_ssleay=yes
481                         need_rsaref=no],
482                         [have_ssleay=no],
483                         [-lcrypto])
484                         
485                 if test $have_ssleay = no ; then
486                         AC_CHECK_LIB(ssl, ssl3_accept, 
487                                 [have_ssleay=yes
488                                 need_rsaref=yes], [have_ssleay=no],
489                                 [-lcrypto -lRSAglue -lrsaref])
490                 fi
491
492                 if test $have_ssleay = yes ; then
493                         ol_with_tls=found
494                         ol_link_tls=yes
495
496                         AC_DEFINE(HAVE_SSLEAY, 1, 
497                                 [define if you have SSLeay or OpenSSL])
498
499                         if test $need_rsaref = yes; then
500                                 AC_DEFINE(HAVE_RSAREF, 1, 
501                                         [define if you have RSAref])
502
503                                 TLS_LIBS="-lssl -lcrypto -lRSAglue -lrsaref"
504                         else
505                                 TLS_LIBS="-lssl -lcrypto"
506                         fi
507                 fi
508         fi
509 fi
510
511 if test $ol_link_tls = yes ; then
512         AC_DEFINE(HAVE_TLS, 1, [define if you have TLS])
513 fi      
514
515 dnl Tests for reentrant functions necessary to build a
516 dnl thread_safe -lldap.
517 AC_CHECK_FUNCS(         \
518         ctime_r                 \
519         gethostbyname_r gethostbyaddr_r \
520 )
521
522 if test "$ac_cv_func_ctime_r" = no ; then
523         ol_cv_func_ctime_r_nargs=0
524 else
525         OL_FUNC_CTIME_R_NARGS
526 dnl     OL_FUNC_CTIME_R_TYPE
527 fi
528
529 if test "$ac_cv_func_gethostbyname_r" = yes ; then
530         OL_FUNC_GETHOSTBYNAME_R_NARGS
531 else
532         ol_cv_func_gethostbyname_r_nargs=0
533 fi
534  
535 if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
536         OL_FUNC_GETHOSTBYADDR_R_NARGS
537 else
538         ol_cv_func_gethostbyaddr_r_nargs=0
539 fi
540
541 if test "$ac_cv_func_ctime_r" = yes \
542         -a "$ol_cv_func_ctime_r_nargs" -ge 2 \
543         -a "$ol_cv_func_ctime_r_nargs" -le 3 \
544         -a "$ac_cv_func_gethostbyname_r" = yes \
545         -a "$ol_cv_func_gethostbyname_r_nargs" -ge 5 \
546         -a "$ol_cv_func_gethostbyname_r_nargs" -le 6 \
547         -a "$ac_cv_func_gethostbyaddr_r" = yes \
548         -a "$ol_cv_func_gethostbyaddr_r_nargs" -ge 5 \
549         -a "$ol_cv_func_gethostbyaddr_r_nargs" -le 6 \
550         ; then
551  
552         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT,1)
553 fi
554
555 ol_link_threads=no
556 if test $ol_with_threads = auto -o $ol_with_threads = yes \
557         -o $ol_with_threads = posix ; then
558
559         AC_CHECK_HEADERS(pthread.h sched.h)
560
561         if test $ac_cv_header_pthread_h = yes ; then
562                 OL_POSIX_THREAD_VERSION
563
564                 if test $ol_cv_pthread_version = final ; then
565                         AC_DEFINE(HAVE_PTHREADS_FINAL,1,
566                                 [define if pthreads API compatible with final spec])
567                 elif test $ol_cv_pthread_version = draft4 ; then
568                         AC_DEFINE(HAVE_PTHREADS_D4,1,
569                                 [define if pthreads API compatible with draft4 spec])
570                 else
571                         AC_MSG_ERROR([unknown pthread version])
572                 fi
573
574                 # consider threads found
575                 ol_with_threads=found
576
577                 OL_LINUX_THREADS
578
579                 if test $ol_cv_linux_threads = yes ; then
580                         AC_DEFINE(HAVE_LINUX_THREADS,1,
581                                 [define if you have LinuxThreads])
582                 fi
583
584                 dnl Now the hard part, how to link?
585                 dnl
586                 dnl currently supported checks:
587                 dnl
588                 dnl Check for no flags 
589                 dnl     pthread_create() in $LIBS
590                 dnl
591                 dnl Check special pthread (final) flags
592                 dnl     pthread_create() with -mt (Solaris)
593                 dnl     pthread_create() with -kthread (FreeBSD)
594                 dnl     pthread_create() with -pthread (FreeBSD/Digital Unix)
595                 dnl     pthread_create() with -pthreads (?)
596                 dnl     pthread_create() with -thread (?)
597                 dnl
598                 dnl Check pthread (final) libraries
599                 dnl     pthread_mutex_unlock() in -lpthread -lmach -lexc -lc_r (OSF/1)
600                 dnl     pthread_mutex_lock() in -lpthread -lmach -lexc (OSF/1)
601                 dnl     pthread_mutex_trylock() in -lpthread -lexc (OSF/1)
602                 dnl     pthread_create() in -lpthread (many)
603                 dnl     pthread_create() in -lc_r (FreeBSD)
604                 dnl     pthread_create() in -lpthreads (many)
605                 dnl     pthread_join() -Wl,-woff,85 -lpthreads (IRIX)
606                 dnl
607                 dnl Check pthread (draft4) flags (depreciated)
608                 dnl     pthread_create() with -threads (OSF/1)
609                 dnl
610                 dnl Check pthread (final) libraries (depreciated)
611                 dnl     pthread_mutex_unlock() in -lpthreads -lmach -lexc -lc_r (OSF/1)
612                 dnl     pthread_mutex_lock() in -lpthreads -lmach -lexc (OSF/1)
613                 dnl     pthread_mutex_trylock() in -lpthreads -lexc (OSF/1)
614                 dnl
615
616                 dnl pthread_create in $LIBS
617                 AC_CHECK_FUNC(pthread_create,[ol_link_threads=yes])
618
619                 if test $ol_link_threads = no ; then
620                         dnl try -mt
621                         AC_CACHE_CHECK([for pthread_create with -mt],
622                                 [ol_cv_thread_flag], [
623                                 dnl save the flags
624                                 save_LIBS="$LIBS"
625                                 LIBS="-mt $LIBS"
626                                 AC_TRY_LINK([char pthread_create();],
627                                         [pthread_create();],
628                                         [ol_cv_thread_flag=yes], [ol_cv_thread_flag=no])
629                                 dnl restore the LIBS
630                                 LIBS="$save_LIBS"
631                         ])
632
633                         if test $ol_cv_thread_flag = yes ; then
634                                 LTHREAD_LIBS="$LTHREAD_LIBS -mt"
635                                 ol_link_threads=posix
636                         fi
637                 fi
638
639                 if test $ol_link_threads = no ; then
640                         dnl try -kthread
641                         AC_CACHE_CHECK([for pthread_create with -kthread],
642                                 [ol_cv_kthread_flag], [
643                                 dnl save the flags
644                                 save_LIBS="$LIBS"
645                                 LIBS="-kthread $LIBS"
646                                 AC_TRY_LINK([#include <pthread.h>],[
647 #if HAVE_PTHREADS_D4
648         pthread_create(NULL,pthread_attr_default,NULL,NULL);
649 #else
650         pthread_create(NULL,NULL,NULL,NULL);
651 #endif
652 ],
653                                         [ol_cv_kthread_flag=yes], [ol_cv_kthread_flag=no])
654                                 dnl restore the LIBS
655                                 LIBS="$save_LIBS"
656                         ])
657
658                         if test $ol_cv_kthread_flag = yes ; then
659                                 LTHREAD_LIBS="$LTHREAD_LIBS -kthread"
660                                 ol_link_threads=posix
661                         fi
662                 fi
663
664                 if test $ol_link_threads = no ; then
665                         dnl try -pthread
666                         AC_CACHE_CHECK([for pthread_create with -pthread],
667                                 [ol_cv_pthread_flag], [
668                                 dnl save the flags
669                                 save_LIBS="$LIBS"
670                                 LIBS="-pthread $LIBS"
671                                 AC_TRY_LINK([#include <pthread.h>],[
672 #if HAVE_PTHREADS_D4
673         pthread_create(NULL,pthread_attr_default,NULL,NULL);
674 #else
675         pthread_create(NULL,NULL,NULL,NULL);
676 #endif
677 ],
678                                         [ol_cv_pthread_flag=yes], [ol_cv_pthread_flag=no])
679                                 dnl restore the LIBS
680                                 LIBS="$save_LIBS"
681                         ])
682
683                         if test $ol_cv_pthread_flag = yes ; then
684                                 LTHREAD_LIBS="$LTHREAD_LIBS -pthread"
685                                 ol_link_threads=posix
686                         fi
687                 fi
688
689                 if test $ol_link_threads = no ; then
690                         dnl try -pthreads
691                         AC_CACHE_CHECK([for pthread_create with -pthreads],
692                                 [ol_cv_pthreads_flag], [
693                                 dnl save the flags
694                                 save_LIBS="$LIBS"
695                                 LIBS="-pthreads $LIBS"
696                                 AC_TRY_LINK([#include <pthread.h>],[
697 #if HAVE_PTHREADS_D4
698         pthread_create(NULL,pthread_attr_default,NULL,NULL);
699 #else
700         pthread_create(NULL,NULL,NULL,NULL);
701 #endif
702 ],
703                                         [ol_cv_pthreads_flag=yes], [ol_cv_pthreads_flag=no])
704                                 dnl restore the LIBS
705                                 LIBS="$save_LIBS"
706                         ])
707
708                         if test $ol_cv_pthreads_flag = yes ; then
709                                 LTHREAD_LIBS="$LTHREAD_LIBS -pthreads"
710                                 ol_link_threads=posix
711                         fi
712                 fi
713
714                 if test $ol_link_threads = no ; then
715                         dnl try -thread
716                         AC_CACHE_CHECK([for pthread_create with -thread],
717                                 [ol_cv_thread_flag], [
718                                 dnl save the flags
719                                 save_LIBS="$LIBS"
720                                 LIBS="-thread $LIBS"
721                                 AC_TRY_LINK([char pthread_create();],
722                                         [pthread_create();],
723                                         [ol_cv_thread_flag=yes], [ol_cv_thread_flag=no])
724                                 dnl restore the LIBS
725                                 LIBS="$save_LIBS"
726                         ])
727
728                         if test $ol_cv_thread_flag = yes ; then
729                                 LTHREAD_LIBS="$LTHREAD_LIBS -thread"
730                                 ol_link_threads=posix
731                         fi
732                 fi
733
734                 if test $ol_link_threads = no ; then
735                         dnl try DEC Threads -lpthread -lmach -lexc -lc_r
736                         save_LIBS="$LIBS"
737                         AC_CHECK_LIB(pthread, pthread_mutex_unlock, [
738                                 ol_link_threads=posix
739                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc_r"
740                                 if test $ol_with_yielding_select = auto ; then
741                                         ol_with_yielding_select=yes
742                                 fi
743                                 ],:,[-lmach -lexc -lc_r])
744                         LIBS="$save_LIBS"
745                 fi
746
747                 if test $ol_link_threads = no ; then
748                         dnl try DEC Threads -lpthread -lmach -lexc
749                         save_LIBS="$LIBS"
750                         AC_CHECK_LIB(pthread, pthread_mutex_lock, [
751                                 ol_link_threads=posix
752                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc"
753                                 if test $ol_with_yielding_select = auto ; then
754                                         ol_with_yielding_select=yes
755                                 fi
756                                 ],:,[-lmach -lexc])
757                         LIBS="$save_LIBS"
758                 fi
759
760                 if test $ol_link_threads = no ; then
761                         dnl try DEC Threads -lpthread -lexc
762                         save_LIBS="$LIBS"
763                         AC_CHECK_LIB(pthread, pthread_mutex_trylock, [
764                                 ol_link_threads=posix
765                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lexc"
766                                 if test $ol_with_yielding_select = auto ; then
767                                         ol_with_yielding_select=yes
768                                 fi
769                                 ],:,[-lexc])
770                         LIBS="$save_LIBS"
771                 fi
772
773                 if test $ol_link_threads = no ; then
774                         dnl try -lpthread
775                         save_LIBS="$LIBS"
776                         AC_CHECK_LIB(pthread, pthread_create, [
777                                 ol_link_threads=posix
778                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"],:)
779                         LIBS="$save_LIBS"
780                 fi
781
782                 if test $ol_link_threads = no ; then
783                         dnl try -lc_r
784                         save_LIBS="$LIBS"
785                         AC_CHECK_LIB(c_r, pthread_create, [
786                                 ol_link_threads=posix
787                                 LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"],:)
788                         LIBS="$save_LIBS"
789                 fi
790
791                 if test $ol_link_threads = no ; then
792                         dnl try -lpthreads
793                         save_LIBS="$LIBS"
794                         AC_CHECK_LIB(pthreads, pthread_create, [
795                                 ol_link_threads=posix
796                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"],:)
797                         LIBS="$save_LIBS"
798                 fi
799
800                 dnl IRIX Pthread check
801                 if test $ol_link_threads = no ; then
802                         dnl try IRIX Pthreads -Wl,-woff,85 -lpthreads
803                         save_LIBS="$LIBS"
804                         AC_CHECK_LIB(pthreads, pthread_join, [
805                                 ol_link_threads=posix
806                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"
807                                 ],:,[-Wl,-woff,85])
808                         LIBS="$save_LIBS"
809                 fi
810
811                 if test $ol_link_threads = no ; then
812                         dnl try -threads
813                         AC_CACHE_CHECK([for pthread_create with -threads],
814                                 [ol_cv_thread_flag], [
815                                 dnl save the flags
816                                 save_LIBS="$LIBS"
817                                 LIBS="-threads $LIBS"
818                                 AC_TRY_LINK([char pthread_create();],[
819                                         pthread_create();
820                                         ], ol_cv_thread_flag=yes, ol_cv_thread_flag=no)
821                                 dnl restore the LIBS
822                                 LIBS="$save_LIBS"
823                         ])
824
825                         if test $ol_cv_thread_flag = yes ; then
826                                 LTHREAD_LIBS="$LTHREAD_LIBS -threads"
827                                 ol_link_threads=posix
828                         fi
829                 fi
830
831                 if test $ol_link_threads = no ; then
832                         dnl try DEC Threads -lpthreads -lmach -lexc -lc_r
833                         save_LIBS="$LIBS"
834                         AC_CHECK_LIB(pthreads, pthread_mutex_unlock, [
835                                 ol_link_threads=posix
836                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r"
837                                 if test $ol_with_yielding_select = auto ; then
838                                         ol_with_yielding_select=yes
839                                 fi
840                                 ],:,[-lmach -lexc -lc_r])
841                         LIBS="$save_LIBS"
842                 fi
843
844                 if test $ol_link_threads = no ; then
845                         dnl try DEC Threads -lpthreads -lmach -lexc
846                         save_LIBS="$LIBS"
847                         AC_CHECK_LIB(pthreads, pthread_mutex_lock, [
848                                 ol_link_threads=posix
849                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc"
850                                 if test $ol_with_yielding_select = auto ; then
851                                         ol_with_yielding_select=yes
852                                 fi
853                                 ],:,[-lmach -lexc])
854                         LIBS="$save_LIBS"
855                 fi
856
857                 if test $ol_link_threads = no ; then
858                         dnl try DEC Threads -lpthreads -lexc
859                         save_LIBS="$LIBS"
860                         AC_CHECK_LIB(pthreads, pthread_mutex_trylock, [
861                                 ol_link_threads=posix
862                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lexc"
863                                 if test $ol_with_yielding_select = auto ; then
864                                         ol_with_yielding_select=yes
865                                 fi
866                                 ],:,[-lexc])
867                         LIBS="$save_LIBS"
868                 fi
869
870                 if test $ol_link_threads != no ; then
871                         AC_DEFINE(HAVE_PTHREADS,1,
872                                 [define if you have POSIX Threads])
873
874                         dnl save flags
875                         save_CPPFLAGS="$CPPFLAGS"
876                         save_LIBS="$LIBS"
877                         LIBS="$LTHREAD_LIBS $LIBS"
878
879                         dnl All POSIX Thread (final) implementations should have
880                         dnl sched_yield instead of pthread yield.
881                         dnl check for both
882                         AC_CHECK_FUNCS(sched_yield pthread_yield)
883
884                         if test $ac_cv_func_sched_yield = no -a \
885                                 $ac_cv_func_pthread_yield = no ; then
886                                 dnl Digital UNIX has sched_yield() in -lrt
887                                 AC_CHECK_LIB(rt, sched_yield,
888                                         [LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
889                                         AC_DEFINE(HAVE_SCHED_YIELD,1)
890                                         ac_cv_func_sched_yield=yes],
891                                         [ac_cv_func_sched_yield=no])
892                         fi
893                         if test $ac_cv_func_sched_yield = no -a \
894                                 $ac_cv_func_pthread_yield = no ; then
895                                 dnl Solaris has sched_yield() in -lposix4
896                                 dnl but we'll use thr_yield instead.
897                                 AC_CHECK_FUNCS(thr_yield)
898                         fi
899                         if test $ac_cv_func_sched_yield = no -a \
900                                 $ac_cv_func_pthread_yield = no -a \
901                                 "$ac_cv_func_thr_yield" = no ; then
902                                 AC_MSG_WARN([could not locate sched_yield() or pthread_yield()])
903                         fi
904
905                         dnl Check functions for compatibility
906                         AC_CHECK_FUNCS(pthread_kill)
907
908                         dnl Check for pthread_detach with <pthread.h> inclusion
909                         dnl as it's symbol may have been mangled.
910                         AC_CACHE_CHECK([for pthread_detach with <pthread.h>],
911                                 [ol_cv_func_pthread_detach], [
912                                 dnl save the flags
913                                 AC_TRY_LINK([#include <pthread.h>],
914                                         [pthread_detach(NULL);],
915                                         [ol_cv_func_pthread_detach=yes],
916                                         [ol_cv_func_pthread_detach=no])
917                         ])
918
919                         if test $ol_cv_func_pthread_detach = no ; then
920                                 AC_MSG_ERROR([could not locate pthread_detach()])
921                         fi
922
923                         AC_DEFINE(HAVE_PTHREAD_DETACH,1,
924                                 [define if you have pthread_detach function])
925
926                         dnl Check for setconcurreny functions
927                         AC_CHECK_FUNCS( \
928                                 pthread_setconcurrency \
929                                 pthread_getconcurrency \
930                                 thr_setconcurrency \
931                                 thr_getconcurrency \
932                         )
933
934                         AC_MSG_CHECKING([if pthread_create() works])
935                         AC_CACHE_VAL(ol_cv_pthread_create_works,[
936                         AC_TRY_RUN([
937 #include <pthread.h>
938 #ifndef NULL
939 #define NULL (void*)0
940 #endif
941
942 static void *task(p)
943         void *p;
944 {
945         return (void *) (p == NULL);
946 }
947
948 int main(argc, argv)
949         int argc;
950         char **argv;
951 {
952         pthread_t t;
953 #if HAVE_PTHREADS_D4
954         exit(pthread_create(&t, pthread_attr_default, task, NULL));
955 #else
956         exit(pthread_create(&t, NULL, task, NULL));
957 #endif
958 }
959 ],
960                                 [ol_cv_pthread_create_works=yes],
961                                 [ol_cv_pthread_create_works=no],
962                                 [dnl assume yes
963                                 ol_cv_pthread_create_works=yes])])
964                         AC_MSG_RESULT($ol_cv_pthread_create_works)
965
966                         if test $ol_cv_pthread_create_works = no ; then
967                                 AC_MSG_ERROR([pthread_create is not usable, check environment settings])
968                         fi
969
970                         dnl Check if select causes an yield
971                         if test $ol_with_yielding_select = auto ; then
972                                 AC_MSG_CHECKING([if select yields when using pthreads])
973                                 AC_CACHE_VAL(ol_cv_pthread_select_yields,[
974                                 AC_TRY_RUN([
975 #include <sys/types.h>
976 #include <sys/time.h>
977 #include <unistd.h>
978 #include <pthread.h>
979 #ifndef NULL
980 #define NULL (void*) 0
981 #endif
982
983 static int fildes[2];
984
985 static void *task(p)
986         void *p;
987 {
988         int i;
989         struct timeval tv;
990
991         fd_set rfds;
992
993         tv.tv_sec=10;
994         tv.tv_usec=0;
995
996         FD_ZERO(&rfds);
997         FD_SET(fildes[0], &rfds);
998
999         /* we're not interested in any fds */
1000         i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
1001
1002         if(i < 0) {
1003                 perror("select");
1004                 exit(10);
1005         }
1006
1007         exit(0); /* if we exit here, the select blocked the whole process */
1008 }
1009
1010 int main(argc, argv)
1011         int argc;
1012         char **argv;
1013 {
1014         pthread_t t;
1015
1016         /* create a pipe to select */
1017         if(pipe(&fildes[0])) {
1018                 perror("select");
1019                 exit(1);
1020         }
1021
1022 #ifdef HAVE_PTHREAD_SETCONCURRENCY
1023         (void) pthread_setconcurrency(2);
1024 #else
1025 #ifdef HAVE_THR_SETCONCURRENCY
1026         /* Set Solaris LWP concurrency to 2 */
1027         thr_setconcurrency(2);
1028 #endif
1029 #endif
1030
1031 #if HAVE_PTHREADS_D4
1032         pthread_create(&t, pthread_attr_default, task, NULL);
1033 #else
1034         pthread_create(&t, NULL, task, NULL);
1035 #endif
1036
1037 #if HAVE_SCHED_YIELD
1038         sched_yield();  /* make sure task runs first */
1039 #else
1040 #ifdef HAVE_PTHREAD_YIELD
1041         pthread_yield();        /* make sure task runs first */
1042 #endif
1043 #endif
1044
1045         exit(2);
1046 }],
1047                                 [ol_cv_pthread_select_yields=no],
1048                                 [ol_cv_pthread_select_yields=yes], [
1049                                 AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])])])
1050                                 AC_MSG_RESULT($ol_cv_pthread_select_yields)
1051
1052                                 if test $ol_cv_pthread_select_yields = yes ; then
1053                                         ol_with_yielding_select=yes
1054                                 fi
1055                         fi
1056
1057                         dnl restore flags
1058                         CPPFLAGS="$save_CPPFLAGS"
1059                         LIBS="$save_LIBS"
1060                 else
1061                         AC_MSG_ERROR([could not link with POSIX Threads])
1062                 fi
1063         fi
1064
1065         if test $ol_with_threads = posix ; then
1066                 AC_MSG_ERROR([could not locate POSIX Threads])
1067         fi
1068 fi
1069
1070 if test $ol_with_threads = auto -o $ol_with_threads = yes \
1071         -o $ol_with_threads = mach ; then
1072
1073         dnl check for Mach CThreads
1074         AC_CHECK_HEADERS(mach/cthreads.h)
1075         if test $ac_cv_header_mach_cthreads_h = yes ; then
1076                 ol_with_threads=found
1077
1078                 dnl check for cthread support in current $LIBS
1079                 AC_CHECK_FUNC(cthread_fork,[ol_link_threads=yes])
1080
1081                 if test $ol_link_threads = no ; then
1082                         dnl try -all_load
1083                         dnl this test needs work
1084                         AC_CACHE_CHECK([for cthread_fork with -all_load],
1085                                 [ol_cv_cthread_all_load], [
1086                                 dnl save the flags
1087                                 save_LIBS="$LIBS"
1088                                 LIBS="-all_load $LIBS"
1089                                 AC_TRY_LINK([#include <mach/cthreads.h>],[
1090                                         cthread_fork((void *)0, (void *)0);
1091                                         ], ol_cv_cthread_all_load=yes, ol_cv_cthread_all_load=no)
1092                                 dnl restore the LIBS
1093                                 LIBS="$save_LIBS"
1094                         ])
1095
1096                         if test $ol_cv_cthread_all_load = yes ; then
1097                                 LTHREAD_LIBS="$LTHREAD_LIBS -all_load"
1098                                 ol_link_threads=mach
1099                         fi
1100                 fi
1101
1102                 if test $ol_link_threads != no ; then
1103                         : check for cthread specific functionality here
1104                         AC_DEFINE(HAVE_MACH_CTHREADS,1,
1105                                 [define if you have Mach Cthreads])
1106                 else
1107                         AC_MSG_ERROR([could not link with Mach CThreads])
1108                 fi
1109         fi
1110
1111         if test $ol_with_threads = mach ; then
1112                 AC_MSG_ERROR([could not locate Mach CThreads])
1113         fi
1114 fi
1115
1116 if test $ol_with_threads = auto -o $ol_with_threads = yes \
1117         -o $ol_with_threads = lwp ; then
1118
1119         dnl check for SunOS5 LWP
1120         AC_CHECK_HEADERS(thread.h synch.h)
1121         if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
1122                 AC_CHECK_LIB(thread, thr_create, [have_thr=yes], [have_thr=no])
1123
1124                 if test $have_thr = yes ; then
1125                         AC_DEFINE(HAVE_THR,1,
1126                                 [if you have Solaris LWP (thr) package])
1127                         LTHREAD_LIBS="$LTHREAD_LIBS -lthread"
1128                         ol_link_threads=thr
1129
1130                         if test $ol_with_yielding_select = auto ; then
1131                                 ol_with_yielding_select=yes
1132                         fi
1133
1134                         dnl Check for setconcurreny functions
1135                         AC_CHECK_FUNCS( \
1136                                 thr_setconcurrency \
1137                                 thr_getconcurrency \
1138                         )
1139                 fi
1140         fi
1141
1142         dnl check for SunOS4 LWP
1143         AC_CHECK_HEADERS(lwp/lwp.h)
1144         if test $ac_cv_header_lwp_lwp_h = yes ; then
1145                 AC_CHECK_LIB(lwp, lwp_create, [have_lwp=yes], [have_lwp=no])
1146
1147                 if test $have_lwp = yes ; then
1148                         AC_DEFINE(HAVE_LWP,1,
1149                                 [if you have SunOS LWP package])
1150                         LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
1151                         ol_link_threads=lwp
1152
1153                         if test $ol_with_yielding_select = auto ; then
1154                                 ol_with_yielding_select=no
1155                         fi
1156                 fi
1157         fi
1158 fi
1159
1160 if test $ol_with_yielding_select = yes ; then
1161         AC_DEFINE(HAVE_YIELDING_SELECT,1,
1162                 [define if select implicitly yields])
1163 fi
1164
1165 if test $ol_with_threads = manual ; then
1166         dnl User thinks he can manually configure threads.
1167         ol_link_threads=yes
1168
1169         AC_MSG_WARN([thread defines and link options must be set manually])
1170
1171         AC_CHECK_HEADERS(pthread.h sched.h)
1172         AC_CHECK_FUNCS(sched_yield pthread_yield)
1173         OL_LINUX_THREADS
1174
1175         AC_CHECK_HEADERS(mach/cthreads.h)
1176         AC_CHECK_HEADERS(lwp/lwp.h)
1177         AC_CHECK_HEADERS(thread.h synch.h)
1178 fi
1179
1180 if test $ol_link_threads != no ; then  
1181         dnl needed to get reentrant/threadsafe versions
1182         dnl
1183         AC_DEFINE(REENTRANT,1)
1184         AC_DEFINE(_REENTRANT,1)
1185         AC_DEFINE(THREAD_SAFE,1)
1186         AC_DEFINE(_THREAD_SAFE,1)
1187         AC_DEFINE(THREADSAFE,1)
1188         AC_DEFINE(_THREADSAFE,1)
1189
1190         dnl this might cause the errno symbol to be
1191         dnl replaced with a function to get a thread specific errno.
1192         dnl check to see if everything needs to be compiled
1193         dnl with the thread libraries
1194         AC_CACHE_CHECK([for thread specific errno],
1195                 [ol_cv_errno_thread_specific], [
1196                 AC_TRY_LINK([#include <errno.h>], [int x = errno;],
1197                         [ol_cv_errno_thread_specific=yes],
1198                         [ol_cv_errno_thread_specific=no])
1199         ])
1200
1201         if test $ol_cv_errno_thread_specific != yes ; then
1202                 LIBS="$LTHREAD_LIBS $LIBS"
1203                 LTHREAD_LIBS=""
1204         fi
1205
1206 dnl When in thread environment, use 
1207 dnl             #if defined( HAVE_REENTRANT_FUNCTIONS ) \ 
1208 dnl                     || defined( HAVE_FUNC_R )
1209 dnl                     func_r(...);
1210 dnl             #else
1211 dnl             #       if defined( HAVE_THREADS ) 
1212 dnl                             /* lock */
1213 dnl             #       endif
1214 dnl                             func(...);
1215 dnl             #       if defined( HAVE_THREADS ) 
1216 dnl                             /* unlock */
1217 dnl             #       endif
1218 dnl             #endif
1219 dnl
1220 dnl HAVE_REENTRANT_FUNCTIONS is derived from:
1221 dnl             _POSIX_REENTRANT_FUNCTIONS
1222 dnl             _POSIX_THREAD_SAFE_FUNCTIONS
1223 dnl             _POSIX_THREADSAFE_FUNCTIONS
1224 dnl
1225 dnl             and is currently defined in lthread.h
1226 dnl
1227 dnl HAVE_THREADS is defined by lthread.h iff -UNO_THREADS
1228 dnl 
1229 dnl libldap/*.c should only include <lthread.h> iff
1230 dnl LDAP_R_COMPILE is defined.  ie:
1231 dnl             #ifdef LDAP_R_COMPILE
1232 dnl             #       include LDAP_R_COMPILE
1233 dnl             #endif
1234 dnl
1235 dnl LDAP_R_COMIPLE is defined by libldap_r/Makefile.in
1236 dnl specifically for compiling the threadsafe version of
1237 dnl     the ldap library (-lldap_r).
1238 dnl             
1239 dnl     dnl check for reentrant/threadsafe functions
1240 dnl     dnl
1241 dnl     dnl note: these should only be used when linking
1242 dnl     dnl       with $LTHREAD_LIBS
1243 dnl     dnl
1244 dnl     save_CPPFLAGS="$CPPFLAGS"
1245 dnl     save_LIBS="$LIBS"
1246 dnl     LIBS="$LTHREAD_LIBS $LIBS"
1247 dnl     AC_CHECK_FUNCS( \
1248 dnl             gmtime_r \
1249 dnl             gethostbyaddr_r gethostbyname_r \
1250 dnl             feof_unlocked unlocked_feof \
1251 dnl             putc_unlocked unlocked_putc \
1252 dnl             flockfile ftrylockfile \
1253 dnl     )
1254 dnl     CPPFLAGS="$save_CPPFLAGS"
1255 dnl     LIBS="$save_LIBS"
1256 fi  
1257
1258 if test $ol_link_threads = no ; then
1259         if test $ol_with_threads = yes ; then
1260                 AC_MSG_ERROR([no suitable thread support])
1261         fi
1262
1263         if test $ol_with_threads = auto ; then
1264                 AC_MSG_WARN([no suitable thread support, disabling threads])
1265                 ol_with_threads=no
1266         fi
1267
1268         AC_DEFINE(NO_THREADS,1,
1269                 [define if you have (or want) no threads])
1270         LTHREAD_LIBS=""
1271 fi
1272
1273 if test $ol_link_threads != no ; then
1274         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE,1)
1275 fi
1276
1277 dnl ----------------------------------------------------------------
1278
1279 ol_link_ldbm=no 
1280 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then
1281         OL_BERKELEY_DB2
1282
1283         if test $ol_cv_berkeley_db2 = yes ; then
1284                 ol_link_ldbm=db2
1285                 ol_with_ldbm_api=db2
1286
1287                 if test $ol_with_ldbm_type = hash ; then
1288                         AC_DEFINE(LDBM_USE_DBHASH,1)
1289                 else
1290                         AC_DEFINE(LDBM_USE_DBBTREE,1)
1291                 fi
1292
1293                 dnl $ol_cv_lib_db2 should be yes or -ldb
1294                 dnl (it could be no, but that would be an error
1295                 if test $ol_cv_lib_db2 != yes ; then
1296                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db2"
1297                 fi
1298         fi
1299 fi
1300
1301 ol_link_bdb2=no
1302 if test $ol_link_ldbm = db2 -a $ol_enable_bdb2 != no ; then
1303         ol_link_bdb2=yes
1304 fi
1305
1306 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then
1307         OL_BERKELEY_DB
1308
1309         if test $ol_cv_berkeley_db = yes ; then
1310                 ol_link_ldbm=db
1311                 ol_with_ldbm_api=db
1312
1313                 if test $ol_with_ldbm_type = hash ; then
1314                         AC_DEFINE(LDBM_USE_DBHASH,1)
1315                 else
1316                         AC_DEFINE(LDBM_USE_DBBTREE,1)
1317                 fi
1318
1319                 dnl $ol_cv_lib_db should be yes or -ldb
1320                 dnl (it could be no, but that would be an error
1321                 if test $ol_cv_lib_db != yes ; then
1322                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db"
1323                 fi
1324         fi
1325 fi
1326
1327 if test $ol_with_ldbm_api = manual ; then
1328         dnl User thinks he can manually configure LDBM api.
1329         ol_link_ldbm=yes
1330
1331         AC_MSG_WARN([LDBM defines and link options must be set manually])
1332
1333         AC_CHECK_HEADERS(db.h db_185.h gdbm.h ndbm.h)
1334 fi
1335
1336 if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
1337         AC_MSG_WARN(Could not find LDBM with BTREE support)
1338         ol_with_ldbm_api=none
1339 fi
1340
1341 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
1342         OL_GDBM
1343
1344         if test $ol_cv_gdbm = yes ; then
1345                 ol_link_ldbm=gdbm
1346                 ol_with_ldbm_api=gdbm
1347
1348                 if test $ol_cv_lib_gdbm != yes ; then
1349                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_gdbm"
1350                 fi
1351         fi
1352 fi
1353
1354 if test $ol_with_ldbm_api = auto ; then
1355         AC_MSG_WARN([skipping automatic checking for NDBM, must be manually enabled.])
1356 elif test $ol_with_ldbm_api = ndbm ; then
1357         OL_NDBM
1358
1359         if test $ol_cv_ndbm = yes ; then
1360                 ol_link_ldbm=ndbm
1361                 ol_with_ldbm_api=ndbm
1362
1363                 if test $ol_cv_lib_ndbm != yes ; then
1364                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_ndbm"
1365                 fi
1366         fi
1367 fi
1368
1369 if test $ol_link_ldbm = no -a $ol_enable_ldbm != no ; then
1370         AC_MSG_WARN(could not find suitable LDBM backend)
1371         if test $ol_enable_ldbm = yes ; then
1372                 AC_MSG_ERROR(select appropriate LDBM options or disable)
1373         fi
1374
1375         AC_MSG_WARN(disabling LDBM)
1376         ol_enable_ldbm=no
1377 fi
1378
1379 if test $ol_enable_wrappers != no ; then
1380         AC_CHECK_HEADERS(tcpd.h)
1381
1382         if test $ac_cv_header_tcpd_h != yes ; then
1383                 have_wrappers=no
1384         else
1385                 AC_CHECK_LIB(wrap, main,
1386                         [have_wrappers=yes], [have_wrappers=no])
1387         fi
1388
1389         if test $have_wrappers = yes ; then
1390                 AC_DEFINE(HAVE_TCPD,1, [define if you have -lwrap])
1391                 SLAPD_LIBS="$SLAPD_LIBS -lwrap"
1392         else
1393                 AC_MSG_WARN(could not find -lwrap)
1394                 if test $ol_enable_wrappers = yes ; then
1395                         AC_MSG_ERROR(could not find wrappers, select appropriate options or disable)
1396                 fi
1397
1398                 AC_MSG_WARN(disabling wrappers support)
1399                 ol_enable_wrappers=no
1400         fi
1401 fi
1402
1403 if test $ol_enable_syslog != no ; then
1404         AC_CHECK_FUNC(openlog)
1405         if test $ac_cv_func_openlog = no -a $ol_enable_syslog = yes; then
1406                 AC_MSG_ERROR(could not find syslog, select appropriate options or disable)
1407         fi
1408         ol_enable_syslog=$ac_cv_func_openlog
1409 fi
1410
1411 if test $ol_enable_dmalloc != no ; then
1412         AC_CHECK_HEADERS(dmalloc.h)
1413         AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
1414 fi
1415
1416 if test $ol_enable_tcl != no ; then
1417         AC_CHECK_HEADERS(tcl.h)
1418
1419         if test $ac_cv_header_tcl_h != yes ; then
1420                 have_tcl=no
1421         else
1422                 AC_CHECK_LIB(tcl,main,
1423                         [have_tcl=yes; SLAPD_LIBS="$SLAPD_LIBS -ltcl"],
1424                         [have_tcl=no])
1425
1426                 if test $have_tcl != yes; then
1427                         AC_CHECK_LIB(tcl7.6,main,
1428                                 [have_tcl=yes; SLAPD_LIBS="$SLAPD_LIBS -ltcl7.6"],
1429                                 [have_tcl=no])
1430                 fi
1431
1432                 if test $have_tcl != yes; then
1433                         AC_CHECK_LIB(tcl8.0,main,
1434                                 [have_tcl=yes; SLAPD_LIBS="$SLAPD_LIBS -ltcl8.0"],
1435                                 [have_tcl=no])
1436                 fi
1437         fi
1438
1439         if test $have_tcl != yes ; then
1440                 AC_MSG_WARN([could not find -ltcl])
1441                 if test $ol_enable_tcl = yes ; then
1442                         AC_MSG_ERROR([could not find tcl, select appropriate options or disable])
1443                 fi
1444
1445                 ol_enable_tcl=no
1446         fi
1447 fi
1448
1449 # ud needs termcap (should insert check here)
1450 ol_link_termcap=no
1451 AC_CHECK_HEADERS(termcap.h ncurses.h)
1452
1453 if test $ol_link_termcap = no ; then
1454         AC_CHECK_LIB(termcap, tputs, [have_termcap=yes], [have_termcap=no])
1455         if test $have_termcap = yes ; then
1456                 AC_DEFINE(HAVE_TERMCAP, 1, [define if you have -ltermcap])
1457                 ol_link_termcap=yes
1458                 TERMCAP_LIBS=-ltermcap
1459         fi
1460 fi
1461
1462 if test $ol_link_termcap = no ; then
1463         AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
1464         if test $have_ncurses = yes ; then
1465                 AC_DEFINE(HAVE_NCURSES, 1, [define if you have -lncurses])
1466                 ol_link_termcap=yes
1467                 TERMCAP_LIBS=-lncurses
1468         fi
1469 fi
1470
1471 if test $ol_link_termcap = no ; then
1472         AC_DEFINE(NO_TERMCAP,1, [define if you have no termcap support])
1473         TERMCAP_LIBS=
1474 fi
1475
1476 dnl
1477 dnl Check for GNU readline
1478 dnl
1479 ol_link_readline=no
1480 if test $ol_with_readline != no ; then
1481         AC_CHECK_HEADERS(readline/readline.h readline/history.h)
1482
1483         if test $ac_cv_header_readline_readline_h = yes ; then
1484                 save_LIBS="$LIBS"
1485                 LIBS="$TERMCAP_LIBS $LIBS"
1486                 AC_CHECK_LIB(readline, readline, 
1487                         [have_readline=yes], [have_readline=no])
1488                 LIBS="$save_LIBS"
1489                         
1490                 if test $have_readline = yes ; then
1491                         ol_with_readline=found
1492                         ol_link_readline=yes
1493
1494                         READLINE_LIBS="-lreadline"
1495                 fi
1496         fi
1497 fi
1498
1499 if test $ol_link_readline = yes ; then
1500         AC_DEFINE(HAVE_READLINE, 1, [define if you have -lreadline])
1501 fi
1502
1503
1504 # FreeBSD (and others) have crypt(3) in -lcrypt
1505 if test $ol_enable_crypt != no ; then
1506         AC_CHECK_FUNC(crypt, [have_crypt=yes], [
1507                 AC_CHECK_LIB(crypt, crypt, [LUTIL_LIBS="$LUTIL_LIBS -lcrypt"
1508                         have_crypt=yes], [have_crypt=no])])
1509
1510         if test $have_crypt = yes ; then
1511                 AC_DEFINE(HAVE_CRYPT,1)
1512         else
1513                 AC_MSG_WARN(could not find crypt)
1514                 if test $ol_enable_crypt = yes ; then
1515                         AC_MSG_ERROR(could not find crypt, select appropriate options or disable)
1516                 fi
1517
1518                 AC_MSG_WARN(disabling crypt support)
1519                 ol_enable_crypt=no
1520         fi
1521 fi
1522
1523 # FreeBSD (and others) have setproctitle(3) in -lutil
1524 if test $ol_enable_proctitle != no ; then
1525         AC_CHECK_FUNC(setproctitle,     [have_setproctitle=yes], [
1526                 AC_CHECK_LIB(util, setproctitle,
1527                         [have_setproctitle=yes
1528                         LUTIL_LIBS="$LUTIL_LIBS -lutil"],
1529                         [have_setproctitle=no
1530                         LIBOBJS="$LIBOBJS setproctitle.o"])])
1531
1532         if test $have_setproctitle = yes ; then
1533                 AC_DEFINE(HAVE_SETPROCTITLE,1)
1534         fi
1535 fi
1536
1537 dnl ----------------------------------------------------------------
1538 dnl Checks for header files.
1539 AC_HEADER_STDC
1540
1541 if test $ac_cv_header_stdc != yes; then
1542         AC_MSG_WARN([could not Standard C compliant headers])
1543 fi
1544
1545 AC_HEADER_DIRENT
1546 AC_HEADER_SYS_WAIT
1547 AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
1548 if test $am_cv_sys_posix_termios = yes ; then
1549         AC_DEFINE(HAVE_POSIX_TERMIOS,1,
1550                 [define if you have POSIX termios])
1551 fi
1552
1553 AC_CHECK_HEADERS(               \
1554         arpa/inet.h             \
1555         arpa/nameser.h          \
1556         crypt.h                 \
1557         errno.h                 \
1558         fcntl.h                 \
1559         filio.h                 \
1560         getopt.h                \
1561         libutil.h               \
1562         limits.h                \
1563         locale.h                \
1564         malloc.h                \
1565         memory.h                \
1566         regex.h                 \
1567         psap.h                  \
1568         pwd.h                   \
1569         resolv.h                \
1570         sgtty.h                 \
1571         stdarg.h                \
1572         stddef.h                \
1573         string.h                \
1574         strings.h               \
1575         sysexits.h              \
1576         sys/file.h              \
1577         sys/filio.h             \
1578         sys/errno.h             \
1579         sys/ioctl.h             \
1580         sys/param.h             \
1581         sys/resource.h          \
1582         sys/socket.h            \
1583         sys/syslog.h            \
1584         sys/time.h              \
1585         sys/types.h             \
1586         syslog.h                \
1587         termios.h               \
1588         unistd.h                \
1589 )
1590
1591 dnl ----------------------------------------------------------------
1592 dnl Checks for typedefs, structures, and compiler characteristics.
1593 AC_TYPE_GETGROUPS dnl requires AC_TYPE_UID_T
1594 AC_TYPE_MODE_T
1595 AC_TYPE_OFF_T
1596 AC_TYPE_PID_T
1597 AM_TYPE_PTRDIFF_T
1598 AC_TYPE_SIGNAL
1599 OL_TYPE_SIG_ATOMIC_T
1600 AC_TYPE_SIZE_T
1601 AC_STRUCT_ST_BLKSIZE
1602 AC_HEADER_TIME
1603 AC_STRUCT_TM
1604
1605 OL_C_UPPER_LOWER
1606 AC_C_CONST
1607 OL_C_VOLATILE
1608
1609 if test $cross_compiling = yes ; then
1610         AC_DEFINE(CROSS_COMPILING, 1, [define if cross compiling])
1611 else
1612         AC_C_BIGENDIAN
1613         AC_CHECK_SIZEOF(short) 
1614         AC_CHECK_SIZEOF(int) 
1615         AC_CHECK_SIZEOF(long)
1616 fi
1617
1618 dnl ----------------------------------------------------------------
1619 dnl Checks for library functions.
1620 AC_FUNC_MEMCMP
1621 dnl AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h
1622 AC_FUNC_STRFTIME
1623 dnl AM_FUNC_STRTOD
1624 AC_FUNC_VPRINTF
1625
1626 if test $ac_cv_func_vprintf = yes ; then
1627         dnl check for vsnprintf
1628         AC_CHECK_FUNCS(vsnprintf vsprintf)
1629 fi
1630
1631 AC_CHECK_FUNCS(         \
1632         bcopy                   \
1633         flock                   \
1634         getdtablesize           \
1635         gethostname             \
1636         getpass                 \
1637         getpwuid                \
1638         gettimeofday            \
1639         lockf                   \
1640         memcpy                  \
1641         memmove                 \
1642         mkstemp                 \
1643         select                  \
1644         setpwfile               \
1645         setsid                  \
1646         signal                  \
1647         sigset                  \
1648         snprintf                \
1649         socket                  \
1650         strdup                  \
1651         strerror                \
1652         strpbrk                 \
1653         strrchr                 \
1654         strsep                  \
1655         strstr                  \
1656         strtol                  \
1657         strtoul                 \
1658         strspn                  \
1659         sysconf                 \
1660         waitpid                 \
1661 )
1662
1663 dnl We actually may need to replace more than this.
1664 AC_REPLACE_FUNCS(getopt tempnam)
1665
1666 dnl ----------------------------------------------------------------
1667 # Check Configuration
1668 OL_SYS_ERRLIST
1669
1670 dnl ----------------------------------------------------------------
1671 dnl Sort out defines
1672
1673 if test "$ol_enable_debug" != no ; then
1674         AC_DEFINE(LDAP_DEBUG,1)
1675 fi
1676 if test "$ol_enable_syslog" = yes ; then
1677         AC_DEFINE(LDAP_SYSLOG,1)
1678 fi
1679 if test "$ol_enable_libui" = yes ; then
1680         AC_DEFINE(LDAP_LIBUI,1)
1681 fi
1682 if test "$ol_enable_cache" = no ; then
1683         AC_DEFINE(LDAP_NOCACHE,1)
1684 fi
1685 if test "$ol_enable_dns" != no ; then
1686         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_DNS,LDAP_VENDOR_VERSION)
1687 fi
1688 if test "$ol_enable_proctitle" != no ; then
1689         AC_DEFINE(LDAP_PROCTITLE,1)
1690 fi
1691 if test "$ol_enable_referrals" != no ; then
1692         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS,LDAP_VENDOR_VERSION)
1693 fi
1694 if test "$ol_enable_cldap" != no ; then
1695         AC_DEFINE(LDAP_CONNECTIONLESS,1)
1696 fi
1697
1698 if test "$ol_enable_aclgroups" != no ; then
1699         AC_DEFINE(SLAPD_ACLGROUPS,1)
1700 fi
1701 if test "$ol_enable_crypt" != no ; then
1702         AC_DEFINE(SLAPD_CRYPT,1)
1703 fi
1704 if test "$ol_enable_cleartext" != no ; then
1705         AC_DEFINE(SLAPD_CLEARTEXT,1)
1706 fi
1707 if test "$ol_enable_phonetic" != no ; then
1708         AC_DEFINE(SLAPD_PHONETIC,1)
1709 fi
1710 if test "$ol_enable_rlookups" != no ; then
1711         AC_DEFINE(SLAPD_RLOOKUPS,1)
1712 fi
1713
1714 if test "$ol_link_bdb2" != no ; then
1715         AC_DEFINE(SLAPD_BDB2,1)
1716         BUILD_SLAPD=yes
1717         BUILD_BDB2=yes
1718 fi
1719
1720 if test "$ol_link_ldbm" != no ; then
1721         AC_DEFINE(SLAPD_LDBM,1)
1722         BUILD_SLAPD=yes
1723         BUILD_LDBM=yes
1724 fi
1725
1726 if test "$ol_enable_passwd" != no ; then
1727         AC_DEFINE(SLAPD_PASSWD,1)
1728         BUILD_SLAPD=yes
1729         BUILD_PASSWD=yes
1730 fi
1731
1732 if test "$ol_enable_perl" != no ; then
1733         AC_DEFINE(SLAPD_PERL,1)
1734         BUILD_SLAPD=yes
1735         BUILD_PERL=yes
1736 fi
1737
1738 if test "$ol_enable_shell" != no ; then
1739         AC_DEFINE(SLAPD_SHELL,1)
1740         BUILD_SLAPD=yes
1741         BUILD_SHELL=yes
1742 fi
1743
1744 if test "$ol_enable_tcl" != no ; then
1745         AC_DEFINE(SLAPD_TCL,1)
1746         BUILD_SLAPD=yes
1747         BUILD_TCL=yes
1748 fi
1749
1750 if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
1751         $BUILD_SLAPD = yes ; then
1752         BUILD_SLURPD=yes
1753 fi
1754
1755 if test "$ol_link_isode" != no ; then
1756         BUILD_LDAPD=yes
1757 fi
1758
1759 dnl ----------------------------------------------------------------
1760
1761 AC_SUBST(BUILD_LDAPD)
1762 AC_SUBST(BUILD_SLAPD)
1763   AC_SUBST(BUILD_BDB2)
1764   AC_SUBST(BUILD_LDBM)
1765   AC_SUBST(BUILD_PASSWD)
1766   AC_SUBST(BUILD_PERL)
1767   AC_SUBST(BUILD_SHELL)
1768   AC_SUBST(BUILD_TCL)
1769 AC_SUBST(BUILD_SLURPD)
1770
1771 AC_SUBST(LDAP_LIBS)
1772 AC_SUBST(LDAPD_LIBS)
1773 AC_SUBST(SLAPD_LIBS)
1774 AC_SUBST(SLURPD_LIBS)
1775 AC_SUBST(LDBM_LIBS)
1776 AC_SUBST(LTHREAD_LIBS)
1777 AC_SUBST(LUTIL_LIBS)
1778
1779 AC_SUBST(SLAPD_PERL_CPPFLAGS)
1780 AC_SUBST(SLAPD_PERL_LDFLAGS)
1781
1782 AC_SUBST(KRB_LIBS)
1783 AC_SUBST(READLINE_LIBS)
1784 AC_SUBST(TERMCAP_LIBS)
1785 AC_SUBST(TLS_LIBS)
1786
1787 dnl ----------------------------------------------------------------
1788 dnl final output
1789 dnl
1790
1791 AC_OUTPUT( \
1792 Makefile:build/top.mk:Makefile.in:build/dir.mk \
1793 doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \
1794 doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk \
1795 doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk \
1796 doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk \
1797 doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk \
1798 doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk \
1799 clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
1800 clients/finger/Makefile:build/top.mk:clients/finger/Makefile.in:build/rules.mk \
1801 clients/fax500/Makefile:build/top.mk:clients/fax500/Makefile.in:build/rules.mk \
1802 clients/gopher/Makefile:build/top.mk:clients/gopher/Makefile.in:build/rules.mk \
1803 clients/mail500/Makefile:build/top.mk:clients/mail500/Makefile.in:build/rules.mk \
1804 clients/rcpt500/Makefile:build/top.mk:clients/rcpt500/Makefile.in:build/rules.mk \
1805 clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
1806 clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk \
1807 include/Makefile:build/top.mk:include/Makefile.in \
1808 libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk      \
1809 libraries/libavl/Makefile:build/top.mk:libraries/libavl/Makefile.in:build/lib.mk:build/lib-static.mk    \
1810 libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk  \
1811 libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk  \
1812 libraries/libldap_r/Makefile:build/top.mk:libraries/libldap_r/Makefile.in:build/lib.mk:build/lib-shared.mk      \
1813 libraries/libldbm/Makefile:build/top.mk:libraries/libldbm/Makefile.in:build/lib.mk:build/lib-static.mk  \
1814 libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.mk:build/lib-static.mk  \
1815 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk        \
1816 servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk \
1817 servers/ldapd/Makefile:build/top.mk:servers/ldapd/Makefile.in:build/srv.mk \
1818 servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk \
1819 servers/slapd/back-bdb2/Makefile:build/top.mk:servers/slapd/back-bdb2/Makefile.in:build/srv.mk \
1820 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/srv.mk \
1821 servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/srv.mk \
1822 servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/srv.mk \
1823 servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/srv.mk \
1824 servers/slapd/back-tcl/Makefile:build/top.mk:servers/slapd/back-tcl/Makefile.in:build/srv.mk \
1825 servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
1826 servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
1827 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
1828 tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk \
1829 tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk \
1830 contrib/Makefile:build/top.mk:contrib/Makefile.in:build/dir.mk \
1831 contrib/saucer/Makefile:build/top.mk:contrib/saucer/Makefile.in:build/rules.mk \
1832 ,[
1833 date > stamp-h
1834 echo Please \"make depend\" to build dependencies
1835 ])