]> git.sur5r.net Git - openldap/blob - configure.in
34500753cad7017b4a45d7b7c665efe5c4e10ce0
[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 Do not use AutoConf 2.12; it produces a configuration script
16 dnl that causes an "internal 2K buffer" error on HPUX when run
17 dnl with /bin/sh.  Autoconf 2.10 seems to be okay.
18 AC_PREREQ(2.10)dnl Required Autoconf version
19
20 AC_CONFIG_HEADER(include/portable.h include/ldap_features.h)dnl
21
22 dnl
23 dnl Start Args
24 AC_MSG_CHECKING(configure arguments)
25 AC_PREFIX_DEFAULT(/usr/local)
26
27 top_builddir=`pwd`
28 AC_SUBST(top_builddir)dnl
29
30 ldap_subdir="openldap"
31
32 AC_ARG_WITH(subdir, [  --with-subdir=DIR change default subdirectory used for installs], [
33         if test "$withval" = "no"; then
34                 ldap_subdir=""
35         elif test "$withval" != "yes"; then
36                 ldap_subdir="$withval"
37         fi
38 ])dnl
39
40 AC_SUBST(ldap_subdir)dnl
41
42 OL_ARG_ENABLE(debug,[  --enable-debug   enable debugging], yes)dnl
43 ol_enable_syslog=no
44 dnl OL_ARG_ENABLE(syslog,[  --enable-syslog     enable syslog support], auto)dnl
45 OL_ARG_ENABLE(proctitle,[  --enable-proctitle   enable proctitle support], yes)dnl
46 OL_ARG_ENABLE(cache,[  --enable-cache   enable caching], yes)dnl
47 OL_ARG_ENABLE(dns,[  --enable-dns               enable V2 DNS  extension], no)dnl
48 OL_ARG_ENABLE(referrals,[  --enable-referrals   enable V2 Referrals extension], yes)dnl
49 OL_ARG_ENABLE(cldap,[  --enable-cldap   enable connectionless ldap], no)dnl
50 OL_ARG_ENABLE(x_compile,[  --enable-x-compile   enable cross compiling],
51         no, [yes no])dnl
52
53
54 dnl General "with" options
55 OL_ARG_ENABLE(dmalloc,[  --enable-dmalloc       enable debug malloc support], no)dnl
56
57 OL_ARG_WITH(kerberos,[  --with-kerberos use Kerberos],
58         auto, [auto k5 k4 afs yes no])
59 OL_ARG_WITH(threads,[  --with-threads   use threads],
60         auto, [auto posix mach lwp yes no manual] )
61 OL_ARG_WITH(yielding_select,[  --with-yielding-select   with implicitly yielding select],
62         auto, [auto yes no manual] )
63
64 dnl Server options
65
66 dnl LDAPD OPTIONS
67 AC_ARG_WITH(xxldapdoptions,[LDAPD Options:])
68 OL_ARG_ENABLE(ldapd,[  --enable-ldapd   enable building ldapd], no)dnl
69
70 dnl SLAPD OPTIONS
71 AC_ARG_WITH(xxslapdoptions,[SLAPD Options:])
72 OL_ARG_ENABLE(slapd,[  --enable-slapd   enable building slapd], yes)dnl
73 OL_ARG_ENABLE(aclgroups,[    --enable-aclgroups enable ACL group support], auto)dnl
74 OL_ARG_ENABLE(cleartext,[    --enable-cleartext enable cleartext passwords], yes)dnl
75 OL_ARG_ENABLE(crypt,[    --enable-crypt enable crypt(3) passwords], auto)dnl
76 OL_ARG_ENABLE(wrappers,[    --enable-wrappers   enable tcp wrapper support], no)dnl
77 OL_ARG_ENABLE(phonetic,[    --enable-phonetic   enable phonetic/soundex], no)dnl
78 OL_ARG_ENABLE(rlookups,[    --enable-rlookups   enable reverse lookups], auto)dnl
79
80 dnl SLAPD Backend options
81 OL_ARG_ENABLE(ldbm,[    --enable-ldbm   enable ldbm backend], yes)dnl
82 OL_ARG_WITH(ldbm_api,[      --with-ldbm-api     use LDBM API], auto,
83         [auto db2 db gdbm ndbm manual])
84 OL_ARG_WITH(ldbm_type,[      --with-ldbm-type   use LDBM type], auto,
85         [auto btree hash])
86
87 OL_ARG_ENABLE(passwd,[    --enable-passwd       enable passwd backend], no)dnl
88 OL_ARG_ENABLE(shell,[    --enable-shell enable shell backend], no)dnl
89
90 dnl SLURPD OPTIONS
91 AC_ARG_WITH(xxslurpdoptions,[SLURPD Options:])
92 OL_ARG_ENABLE(slurpd,[  --enable-slurpd enable building slurpd], auto)dnl
93
94 AC_ARG_WITH(xxliboptions,[Library Generation & Linking Options])
95 AM_ENABLE_STATIC
96 dnl AM_DISABLE_SHARED
97 AM_ENABLE_SHARED
98
99 dnl General "enable" options
100 # validate options
101 if test $ol_enable_referrals = no ; then
102         if test $ol_enable_dns = yes ; then
103                 AC_MSG_WARN([dns disabled, ignoring --enable-dns argument])
104         fi
105         ol_enable_dns=no
106 fi
107
108 if test $ol_enable_slapd = no ; then
109         dnl SLAPD was specificallly disabled
110         if test $ol_enable_ldbm = yes ; then
111                 AC_MSG_WARN([slapd disabled, ignoring --enable_ldbm argument])
112         fi
113         if test $ol_enable_passwd = yes ; then
114                 AC_MSG_WARN([slapd disabled, ignoring --enable_passwd argument])
115         fi
116         if test $ol_enable_shell = yes ; then
117                 AC_MSG_WARN([slapd disabled, ignoring --enable_shell argument])
118         fi
119         if test $ol_enable_aclgroups = yes ; then
120                 AC_MSG_WARN([slapd disabled, ignoring --enable_aclgroups argument])
121         fi
122         if test $ol_enable_wrappers = yes ; then
123                 AC_MSG_WARN([slapd disabled, ignoring --enable_wrappers argument])
124         fi
125         if test $ol_enable_phonetic = yes ; then
126                 AC_MSG_WARN([slapd disabled, ignoring --enable_phonetic argument])
127         fi
128         if test $ol_enable_rlookups = yes ; then
129                 AC_MSG_WARN([slapd disabled, ignoring --enable_rlookups argument])
130         fi
131         if test $ol_with_ldbm_api != auto ; then
132                 AC_MSG_WARN([slapd disabled, ignoring --with_ldbm_api argument])
133         fi
134         if test $ol_with_ldbm_type != auto ; then
135                 AC_MSG_WARN([slapd disabled, ignoring --with_ldbm_type argument])
136         fi
137         if test $ol_enable_slurpd = yes ; then
138                 AC_MSG_ERROR([slurpd requires slapd])
139         fi
140
141         # force settings to no
142         ol_enable_ldbm=no
143         ol_enable_shell=no
144         ol_enable_passwd=no
145         ol_enable_aclgroups=no
146         ol_enable_wrappers=no
147         ol_enable_phonetic=no
148         ol_enable_rlookups=no
149         ol_with_ldbm_api=no
150         ol_with_ldbm_type=no
151         ol_enable_slurpd=no
152
153 elif test $ol_enable_ldbm = no ; then
154         dnl SLAPD without LDBM
155
156         if test $ol_with_ldbm_api != auto ; then
157                 AC_MSG_WARN([LDBM disabled, ignoring --with_ldbm_api argument])
158         fi
159
160         if test $ol_with_ldbm_type != auto ; then
161                 AC_MSG_WARN([LDBM disabled, ignoring --with_ldbm_type argument])
162         fi
163
164         if test $ol_enable_passwd = no -a $ol_enable_shell = no ; then
165                 AC_MSG_ERROR([slapd requires a backend])
166         fi
167
168         ol_with_ldbm_api=no
169         ol_with_ldbm_type=no
170
171 else
172         dnl SLAPD with LDBM
173
174         if test $ol_with_ldbm_api = gdbm -a \
175                 $ol_with_ldbm_type = btree ; then
176                 AC_MSG_ERROR([GDBM only supports LDBM type hash])
177         fi
178         if test $ol_with_ldbm_api = ndbm -a \
179                 $ol_with_ldbm_type = btree ; then
180                 AC_MSG_ERROR([NDBM only supports LDBM type hash])
181         fi
182 fi
183
184 if test $ol_enable_slurpd = yes ; then
185         dnl SLURPD was specifically enabled
186         if test $ol_with_threads = no ; then
187                 AC_MSG_ERROR([slurpd requires threads])
188         fi
189 fi
190
191 AC_MSG_RESULT(done)
192
193 AC_CANONICAL_HOST
194
195 ## Initialize vars
196 LDAP_LIBS=
197 LDBM_LIBS=
198 LTHREAD_LIBS=
199 LUTIL_LIBS=
200
201 LDAPD_LIBS=
202 SLAPD_LIBS=
203 SLURPD_LIBS=
204
205 BUILD_LDAPD=no
206 BUILD_SLAPD=no
207 BUILD_SLURPD=no
208
209 BUILD_LDBM=no
210 BUILD_PASSWD=no
211 BUILD_SHELL=no
212 BUILD_THREAD=no
213
214 KRB_LIBS=
215 TERMCAP_LIBS=
216
217 dnl ----------------------------------------------------------------
218 dnl Checks for programs
219
220 AC_PROG_INSTALL
221 AM_PROG_LIBTOOL
222 dnl AC_PROG_MAKE_SET
223
224 AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail,
225         $PATH:/usr/libexec:/usr/lib:/usr/sbin:/usr/etc:/etc)
226 AC_PATH_PROG(EDITOR, vi, /usr/ucb/vi, $PATH:/usr/ucb)
227 AC_PATH_PROG(FINGER, finger, /usr/ucb/finger, $PATH:/usr/ucb)
228
229 dnl Checks the compiler and UNIX Variants
230
231 if test $cross_compiling = yes -a $ol_enable_x_compile = yes; then
232         AC_MSG_WARN([cross compiling....  some functionality will be removed.])
233
234 elif test $cross_compiling = no -a $ol_enable_x_compile = yes; then
235         AC_MSG_WARN([programs compiled here do run here...])
236         AC_MSG_ERROR([  if not cross compiling, use --disable-x-compile.])
237
238 elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
239         AC_MSG_WARN([programs compiled here do not run here...])
240         AC_MSG_ERROR([  if cross compiling,  add --enable-x-compile.])
241 fi
242
243 AC_PROG_CPP
244
245 AC_AIX
246 AC_ISC_POSIX
247 AC_MINIX
248
249 dnl OpenLDAP requires STDC features
250 AM_PROG_CC_STDC
251 if test "X${am_cv_prog_cc_stdc}" = "Xno" ; then
252         AC_MSG_ERROR([OpenLDAP requires compiler to support STDC prototypes.])
253 fi
254
255 dnl AM_C_PROTOTYPES
256
257 dnl Checks for libraries
258
259 dnl Find socket()
260 dnl Likely combinations:
261 dnl             -lsocket [ -lnsl_s | -lnsl ]
262 dnl             -linet
263
264 AC_CHECK_FUNC(socket, [have_socket=yes], [      
265 dnl
266 dnl hopefully we won't include too many libraries
267 dnl
268         AC_CHECK_LIB(socket, main)
269         AC_CHECK_LIB(net, main)
270         AC_CHECK_LIB(nsl_s, main)
271         AC_CHECK_LIB(nsl, main)
272         AC_CHECK_LIB(inet, socket)
273         AC_CHECK_LIB(gen, main)
274 ])
275
276 dnl Check for resolv
277 AC_CHECK_LIB(resolv, res_search)
278
279 dnl HP-UX requires -lV3
280 AC_CHECK_LIB(V3, sigset)
281
282 # ISODE tests
283 ol_link_isode=no
284 if test $ol_enable_ldapd != no ; then
285         dnl look for ISODE libraries
286         AC_CHECK_LIB(xtpp, main, [
287                 ol_link_isode=yes
288                 AC_DEFINE(HAVE_XTPP,1)
289                 LDAPD_LIBS="$LDAPD_LIBS -lxtpp -lxtdsap -lxtisode -losi"
290                 ],:,[-lxtdsap -lxtisode -losi])
291         AC_CHECK_LIB(dsap, main, [
292                 ol_link_isode=yes
293                 AC_DEFINE(HAVE_DSAP,1)
294                 LDAPD_LIBS="$LDAPD_LIBS -ldsap"
295                 ],:,[-lisode])
296         AC_CHECK_LIB(isode, main, [
297                 ol_link_isode=yes
298                 AC_DEFINE(HAVE_ISODE,1)
299                 LDAPD_LIBS="$LDAPD_LIBS -lisode"
300                 ],:)
301 fi
302
303 if test $ol_link_isode != no; then
304         AC_CHECK_LIB(pp, main, [
305                 AC_DEFINE(HAVE_PP,1)
306                 LDAPD_LIBS="-lpp $LDAPD_LIBS"
307                 ],:)
308
309         AC_PATH_PROG(PEPSY, pepsy)
310 fi
311
312 dnl
313 dnl check for kerberos
314 dnl
315 ol_link_kerberos=no
316
317 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k5 ; then
318         AC_CHECK_HEADERS(kerberosIV/krb.h kerberosIV/des.h)
319
320         if test $ac_cv_header_kerberosIV_krb_h = yes ; then
321                 AC_CHECK_LIB(krb4, main, [have_k5=yes], [have_k5=no],
322                         [-lkrb5 -ldes425])
323
324                 if test $have_k5 = yes ; then
325                         ol_with_kerberos=found
326                         ol_link_kerberos=yes
327
328                         AC_DEFINE(HAVE_KERBEROS)
329                         KRB_LIBS="-lkrb4 -lkrb5 -ldes425"
330                 fi
331         fi
332 fi
333
334 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k4 ; then
335         AC_CHECK_HEADERS(krb.h des.h)
336
337         if test $ac_cv_header_krb_h = yes ; then
338                 AC_CHECK_LIB(krb, main, [have_k4=yes], [have_k4=no], [-ldes])
339
340                 if test $have_k4 = yes ; then
341                         ol_with_kerberos=found
342                         ol_link_kerberos=yes
343
344                         AC_DEFINE(HAVE_KERBEROS)
345                         KRB_LIBS="-lkrb -ldes"
346                 fi
347         fi
348 fi
349
350 dnl     if test $ol_link_kerberos = yes ; then
351 dnl             save_LIBS=$LIBS
352 dnl             LIBS="$KRB_LIBS $LIBS"
353 dnl             AC_CHECK_FUNCS(des_string_to_key)
354 dnl             LIBS=$save_LIBS
355 dnl fi
356
357 ol_link_threads=no
358 if test $ol_with_threads = auto -o $ol_with_threads = yes \
359         -o $ol_with_threads = posix ; then
360
361         AC_CHECK_HEADERS(pthread.h sched.h)
362
363         if test $ac_cv_header_pthread_h = yes ; then
364                 OL_POSIX_THREAD_VERSION
365
366                 if test $ol_cv_pthread_version = final ; then
367                         AC_DEFINE(HAVE_PTHREADS_FINAL)
368                 elif test $ol_cv_pthread_version = draft4 ; then
369                         AC_DEFINE(HAVE_PTHREADS_D4)
370                 else
371                         AC_MSG_ERROR([unknown pthread version])
372                 fi
373
374                 # consider threads found
375                 ol_with_threads=found
376
377                 OL_LINUX_THREADS
378
379                 if test $ol_cv_linux_threads = yes ; then
380                         AC_DEFINE(HAVE_LINUX_THREADS,1)
381                 fi
382
383                 dnl Now the hard part, how to link
384
385                 dnl Check for pthread support in current $LIBS
386                 AC_CHECK_FUNC(pthread_create,[ol_link_threads=yes])
387
388                 if test $ol_link_threads = no ; then
389                         dnl try -pthread
390                         AC_CACHE_CHECK([for pthread_create with -pthread],
391                                 [ol_cv_pthread_flag], [
392                                 dnl save the flags
393                                 save_LIBS="$LIBS"
394                                 LIBS="-pthread $LIBS"
395                                 AC_TRY_LINK([char pthread();],[
396                                         pthread_create();
397                                         ], ol_cv_pthread_flag=yes, ol_cv_pthread_flag=no)
398                                 dnl restore the LIBS
399                                 LIBS="$save_LIBS"
400                         ])
401
402                         if test $ol_cv_pthread_flag = yes ; then
403                                 LTHREAD_LIBS="$LTHREAD_LIBS -pthread"
404                                 ol_link_threads=posix
405                         fi
406                 fi
407
408                 if test $ol_link_threads = no ; then
409                         dnl try -pthreads
410                         AC_CACHE_CHECK([for pthread_create with -pthreads],
411                                 [ol_cv_pthreads_flag], [
412                                 dnl save the flags
413                                 save_LIBS="$LIBS"
414                                 LIBS="-pthreads $LIBS"
415                                 AC_TRY_LINK([char pthread();],[
416                                         pthread_create();
417                                         ], ol_cv_pthreads_flag=yes, ol_cv_pthreads_flag=no)
418                                 dnl restore the LIBS
419                                 LIBS="$save_LIBS"
420                         ])
421
422                         if test $ol_cv_pthreads_flag = yes ; then
423                                 LTHREAD_LIBS="$LTHREAD_LIBS -pthreads"
424                                 ol_link_threads=posix
425                         fi
426                 fi
427
428                 if test $ol_link_threads = no ; then
429                         dnl try -thread
430                         AC_CACHE_CHECK([for pthread_create with -thread],
431                                 [ol_cv_thread_flag], [
432                                 dnl save the flags
433                                 save_LIBS="$LIBS"
434                                 LIBS="-thread $LIBS"
435                                 AC_TRY_LINK([char pthread();],[
436                                         pthread_create();
437                                         ], ol_cv_thread_flag=yes, ol_cv_thread_flag=no)
438                                 dnl restore the LIBS
439                                 LIBS="$save_LIBS"
440                         ])
441
442                         if test $ol_cv_thread_flag = yes ; then
443                                 LTHREAD_LIBS="$LTHREAD_LIBS -thread"
444                                 ol_link_threads=posix
445                         fi
446                 fi
447
448                 if test $ol_link_threads = no ; then
449                         dnl try DEC Threads -lpthread -lexc
450                         save_LIBS="$LIBS"
451                         AC_CHECK_LIB(pthread, pthread_join, [
452                                 ol_link_threads=posix
453                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lexc"
454                                 if test $ol_with_yielding_select = auto ; then
455                                         ol_with_yielding_select=yes
456                                 fi
457                                 ],,[-lexc])
458                         LIBS="$save_LIBS"
459                 fi
460
461                 if test $ol_link_threads = no ; then
462                         dnl try DEC Threads -lpthreads -lmach -lexc -lc_r
463                         save_LIBS="$LIBS"
464                         AC_CHECK_LIB(pthreads, pthread_join, [
465                                 ol_link_threads=posix
466                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r"
467                                 if test $ol_with_yielding_select = auto ; then
468                                         ol_with_yielding_select=yes
469                                 fi
470                                 ],,[-lmach -lexc -lc_r])
471                         LIBS="$save_LIBS"
472                 fi
473
474                 if test $ol_link_threads = no ; then
475                         dnl try -lpthread
476                         save_LIBS="$LIBS"
477                         AC_CHECK_LIB(pthread, pthread_create, [
478                                 ol_link_threads=posix
479                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"])
480                         LIBS="$save_LIBS"
481                 fi
482
483                 if test $ol_link_threads = no ; then
484                         dnl try -lc_r
485                         save_LIBS="$LIBS"
486                         AC_CHECK_LIB(c_r, pthread_create, [
487                                 ol_link_threads=posix
488                                 LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"])
489                         LIBS="$save_LIBS"
490                 fi
491
492                 if test $ol_link_threads = no ; then
493                         dnl try -lpthreads
494                         save_LIBS="$LIBS"
495                         AC_CHECK_LIB(pthreads, pthread_create, [
496                                 ol_link_threads=posix
497                                 LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"])
498                         LIBS="$save_LIBS"
499                 fi
500
501                 if test $ol_link_threads != no ; then
502                         AC_DEFINE(HAVE_PTHREADS)
503
504                         dnl save flags
505                         save_CPPFLAGS="$CPPFLAGS"
506                         save_LIBS="$LIBS"
507                         LIBS="$LTHREAD_LIBS $LIBS"
508
509                         dnl All POSIX Thread (final) implementations should have
510                         dnl sched_yield instead of pthread yield.
511                         dnl check for both
512                         AC_CHECK_FUNCS(sched_yield pthread_yield)
513
514                         if test $ac_cv_func_sched_yield = no -a \
515                                 $ac_cv_func_pthread_yield = no ; then
516                                 dnl Digital UNIX has sched_yield() in -lrt
517                                 AC_CHECK_LIB(rt, sched_yield,
518                                         [LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
519                                         AC_DEFINE(HAVE_SCHED_YIELD,1)
520                                         ac_cv_func_sched_yield=yes],
521                                         [ac_cv_func_sched_yield=no])
522                         fi
523                         if test $ac_cv_func_sched_yield = no -a \
524                                 $ac_cv_func_pthread_yield = no ; then
525                                 dnl Solaris has sched_yield() in -lposix4
526                                 AC_CHECK_LIB(posix4, sched_yield,
527                                         [LTHREAD_LIBS="$LTHREAD_LIBS -lposix4"
528                                         AC_DEFINE(HAVE_SCHED_YIELD,1)
529                                         ac_cv_func_sched_yield=yes],
530                                         [ac_cv_func_sched_yield=no])
531                         fi
532                         if test $ac_cv_func_sched_yield = no -a \
533                                 $ac_cv_func_pthread_yield = no ; then
534                                 AC_MSG_WARN([could not locate sched_yield() or pthread_yield()])
535                                 AC_MSG_ERROR([POSIX Threads are not usable])
536                         fi
537
538                         dnl Check functions for compatibility
539                         AC_CHECK_FUNCS(pthread_kill)
540                         AC_CHECK_FUNCS( \
541                                 pthread_attr_create pthread_attr_init \
542                                 pthread_attr_destroy pthread_attr_delete \
543                                 pthread_attr_setdetachstate pthread_attr_setdetach_np \
544                         )
545
546                         dnl Check for setconcurreny functions
547                         AC_CHECK_FUNCS( \
548                                 pthread_setconcurrency \
549                                 thr_setconcurrency \
550                         )
551
552                         AC_MSG_CHECKING([if pthread_create() works])
553                         AC_CACHE_VAL(ol_cv_pthread_create_works,[
554                         AC_TRY_RUN([
555 #include <pthread.h>
556 #ifndef NULL
557 #define NULL (void*)0
558 #endif
559
560 static void *task(p)
561         void *p;
562 {
563         return (void *) (p == NULL);
564 }
565
566 int main(argc, argv)
567         int argc;
568         char **argv;
569 {
570         pthread_t t;
571         exit(pthread_create(&t, NULL, task, NULL));
572 }
573 ],
574                                 [ol_cv_pthread_create_works=yes],
575                                 [ol_cv_pthread_create_works=no],
576                                 [dnl assume yes
577                                 ol_cv_pthread_create_works=yes])])
578                         AC_MSG_RESULT($ol_cv_pthread_create_works)
579
580                         if test $ol_cv_pthread_create_works = no ; then
581                                 AC_MSG_ERROR([pthread.h and pthread_create are not compatible])
582                         fi
583
584                         dnl Check if select causes an yield
585                         if test $ol_with_yielding_select = auto ; then
586                                 AC_MSG_CHECKING([if select yields when using pthreads])
587                                 AC_CACHE_VAL(ol_cv_pthread_select_yields,[
588                                 AC_TRY_RUN([
589 #include <sys/types.h>
590 #include <sys/time.h>
591 #include <unistd.h>
592 #include <pthread.h>
593 #ifndef NULL
594 #define NULL (void*) 0
595 #endif
596
597 static int fildes[2];
598
599 static void *task(p)
600         void *p;
601 {
602         int i;
603         struct timeval tv;
604
605         fd_set rfds;
606
607         tv.tv_sec=10;
608         tv.tv_usec=0;
609
610         FD_ZERO(&rfds);
611         FD_SET(fildes[0], &rfds);
612
613         /* we're not interested in any fds */
614         i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
615
616         if(i < 0) {
617                 perror("select");
618                 exit(10);
619         }
620
621         exit(0); /* if we exit here, the select blocked the whole process */
622 }
623
624 int main(argc, argv)
625         int argc;
626         char **argv;
627 {
628         pthread_t t;
629
630         /* create a pipe to select */
631         if(pipe(&fildes[0])) {
632                 perror("select");
633                 exit(1);
634         }
635
636 #ifdef HAVE_PTHREAD_SETCONCURRENCY
637         (void) pthread_setconcurrency(2);
638 #else
639 #ifdef HAVE_THR_SETCONCURRENCY
640         /* Set Solaris LWP concurrency to 2 */
641         thr_setconcurrency(2);
642 #endif
643 #endif
644
645         pthread_create(&t, NULL, task, NULL);
646
647 #if HAVE_SCHED_YIELD
648         sched_yield();  /* make sure task runs first */
649 #else
650 #ifdef HAVE_PTHREAD_YIELD
651         pthread_yield();        /* make sure task runs first */
652 #endif
653 #endif
654
655         exit(2);
656 }],
657                                 [ol_cv_pthread_select_yields=no],
658                                 [ol_cv_pthread_select_yields=yes], [
659                                 AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])])])
660                                 AC_MSG_RESULT($ol_cv_pthread_select_yields)
661
662                                 if test $ol_cv_pthread_select_yields = yes ; then
663                                         ol_with_yielding_select=yes
664                                 fi
665                         fi
666
667                         dnl restore flags
668                         CPPFLAGS="$save_CPPFLAGS"
669                         LIBS="$save_LIBS"
670                 else
671                         AC_MSG_ERROR([could not link with POSIX Threads])
672                 fi
673         fi
674
675         if test $ol_with_threads = posix ; then
676                 AC_MSG_ERROR([could not locate POSIX Threads])
677         fi
678 fi
679
680 if test $ol_with_threads = auto -o $ol_with_threads = yes \
681         -o $ol_with_threads = mach ; then
682
683         dnl check for Mach CThreads
684         AC_CHECK_HEADERS(mach/cthreads.h)
685         if test $ac_cv_header_mach_cthreads_h = yes ; then
686                 ol_with_threads=found
687
688                 dnl check for cthread support in current $LIBS
689                 AC_CHECK_FUNC(cthread_fork,[ol_link_threads=yes])
690
691                 if test $ol_link_threads = no ; then
692                         dnl try -all_load
693                         dnl this test needs work
694                         AC_CACHE_CHECK([for cthread_fork with -all_load],
695                                 [ol_cv_cthread_all_load], [
696                                 dnl save the flags
697                                 save_LIBS="$LIBS"
698                                 LIBS="-all_load $LIBS"
699                                 AC_TRY_LINK([#include <mach/cthreads.h>],[
700                                         cthread_fork((void *)0, (void *)0);
701                                         ], ol_cv_cthread_all_load=yes, ol_cv_cthread_all_load=no)
702                                 dnl restore the LIBS
703                                 LIBS="$save_LIBS"
704                         ])
705
706                         if test $ol_cv_cthread_all_load = yes ; then
707                                 LTHREAD_LIBS="$LTHREAD_LIBS -all_load"
708                                 ol_link_threads=mach
709                         fi
710                 fi
711
712                 if test $ol_link_threads != no ; then
713                         : check for cthread specific functionality here
714                         AC_DEFINE(HAVE_MACH_CTHREADS,1)
715                 else
716                         AC_MSG_ERROR([could not link with Mach CThreads])
717                 fi
718         fi
719
720         if test $ol_with_threads = mach ; then
721                 AC_MSG_ERROR([could not locate Mach CThreads])
722         fi
723 fi
724
725 if test $ol_with_threads = auto -o $ol_with_threads = yes \
726         -o $ol_with_threads = lwp ; then
727
728         dnl check for SunOS5 LWP
729         AC_CHECK_HEADERS(thread.h synch.h)
730         if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
731                 AC_CHECK_LIB(thread, thr_create, [have_thr=yes], [have_thr=no])
732
733                 if test $have_thr = yes ; then
734                         AC_DEFINE(HAVE_THR)
735                         LTHREAD_LIBS="$LTHREAD_LIBS -lthread"
736                         ol_link_threads=thr
737
738                         if test $ol_with_yielding_select = auto ; then
739                                 ol_with_yielding_select=yes
740                         fi
741                 fi
742         fi
743
744         dnl check for SunOS4 LWP
745         AC_CHECK_HEADERS(lwp/lwp.h)
746         if test $ac_cv_header_lwp_lwp_h = yes ; then
747                 AC_CHECK_LIB(lwp, lwp_create, [have_lwp=yes], [have_lwp=no])
748
749                 if test $have_lwp = yes ; then
750                         AC_DEFINE(HAVE_LWP)
751                         LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
752                         ol_link_threads=lwp
753
754                         if test $ol_with_yielding_select = auto ; then
755                                 ol_with_yielding_select=no
756                         fi
757                 fi
758         fi
759 fi
760
761 if test $ol_with_yielding_select = yes ; then
762         AC_DEFINE(HAVE_YIELDING_SELECT,1)
763 fi
764
765 if test $ol_with_threads = manual ; then
766         dnl User thinks he can manually configure threads.
767         ol_link_threads=yes
768
769         AC_MSG_WARN([thread defines and link options must be set manually])
770
771         AC_CHECK_HEADERS(pthread.h sched.h)
772         AC_CHECK_FUNCS(sched_yield pthread_yield)
773         OL_LINUX_THREADS
774
775         AC_CHECK_HEADERS(mach/cthreads.h)
776         AC_CHECK_HEADERS(lwp/lwp.h)
777         AC_CHECK_HEADERS(thread.h synch.h)
778 fi
779
780 if test $ol_link_threads != no ; then  
781         dnl needed to get reentrant/threadsafe versions
782         dnl
783         AC_DEFINE(REENTRANT,1)
784         AC_DEFINE(_REENTRANT,1)
785         AC_DEFINE(THREAD_SAFE,1)
786         AC_DEFINE(_THREAD_SAFE,1)
787         AC_DEFINE(THREADSAFE,1)
788         AC_DEFINE(_THREADSAFE,1)
789
790         dnl this might cause the errno symbol to be
791         dnl replaced with a function to get a thread specific errno.
792         dnl check to see if everything needs to be compiled
793         dnl with the thread libraries
794         AC_CACHE_CHECK([for thread specific errno],
795                 [ol_cv_errno_thread_specific], [
796                 AC_TRY_LINK([
797 #include <errno.h>
798                         ], [
799 int x = errno;
800                         ],
801                         [ol_cv_errno_thread_specific=yes],
802                         [ol_cv_errno_thread_specific=no])
803         ])
804
805         if test $ol_cv_errno_thread_specific != yes ; then
806                 LIBS="$LTHREAD_LIBS $LIBS"
807                 LTHREAD_LIBS=""
808         fi
809
810 dnl When in thread environment, use 
811 dnl             #if defined( HAVE_REENTRANT_FUNCTIONS ) \ 
812 dnl                     || defined( HAVE_FUNC_R )
813 dnl                     func_r(...);
814 dnl             #else
815 dnl             #       if defined( HAVE_THREADS ) 
816 dnl                             /* lock */
817 dnl             #       endif
818 dnl                             func(...);
819 dnl             #       if defined( HAVE_THREADS ) 
820 dnl                             /* unlock */
821 dnl             #       endif
822 dnl             #endif
823 dnl
824 dnl HAVE_REENTRANT_FUNCTIONS is derived from:
825 dnl             _POSIX_REENTRANT_FUNCTIONS
826 dnl             _POSIX_THREAD_SAFE_FUNCTIONS
827 dnl             _POSIX_THREADSAFE_FUNCTIONS
828 dnl
829 dnl             and is currently defined in lthread.h
830 dnl
831 dnl HAVE_THREADS is defined by lthread.h iff -UNO_THREADS
832 dnl 
833 dnl libldap/*.c should only include <lthread.h> iff
834 dnl LDAP_R_COMPILE is defined.  ie:
835 dnl             #ifdef LDAP_R_COMPILE
836 dnl             #       include LDAP_R_COMPILE
837 dnl             #endif
838 dnl
839 dnl LDAP_R_COMIPLE is defined by libldap_r/Makefile.in
840 dnl specifically for compiling the threadsafe version of
841 dnl     the ldap library (-lldap_r).
842 dnl             
843 dnl     dnl check for reentrant/threadsafe functions
844 dnl     dnl
845 dnl     dnl note: these should only be used when linking
846 dnl     dnl       with $LTHREAD_LIBS
847 dnl     dnl
848 dnl     save_CPPFLAGS="$CPPFLAGS"
849 dnl     save_LIBS="$LIBS"
850 dnl     LIBS="$LTHREAD_LIBS $LIBS"
851 dnl     AC_CHECK_FUNCS( \
852 dnl             strtok_r \
853 dnl             gmtime_r \
854 dnl             gethostbyaddr_r gethostbyname_r \
855 dnl             feof_unlocked unlocked_feof \
856 dnl             putc_unlocked unlocked_putc \
857 dnl             flockfile ftrylockfile \
858 dnl     )
859 dnl     CPPFLAGS="$save_CPPFLAGS"
860 dnl     LIBS="$save_LIBS"
861 fi  
862
863 dnl ----------------------------------------------------------------
864
865 if test $ol_link_threads = no ; then
866         if test $ol_with_threads = yes ; then
867                 AC_MSG_ERROR([no suitable thread support])
868         fi
869
870         if test $ol_with_threads = auto ; then
871                 AC_MSG_WARN([no suitable thread support, disabling threads])
872                 ol_with_threads=no
873         fi
874
875         AC_DEFINE(NO_THREADS,1)
876         LTHREAD_LIBS=""
877 fi
878
879 ol_link_ldbm=no 
880 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then
881         OL_BERKELEY_DB2
882
883         if test $ol_cv_berkeley_db2 = yes ; then
884                 ol_link_ldbm=db2
885                 ol_with_ldbm_api=db2
886
887                 if test $ol_with_ldbm_type = hash ; then
888                         AC_DEFINE(LDBM_USE_DBHASH,1)
889                 else
890                         AC_DEFINE(LDBM_USE_DBBTREE,1)
891                 fi
892
893                 dnl $ol_cv_lib_db2 should be yes or -ldb
894                 dnl (it could be no, but that would be an error
895                 if test $ol_cv_lib_db2 != yes ; then
896                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db2"
897                 fi
898         fi
899 fi
900
901 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then
902         OL_BERKELEY_DB
903
904         if test $ol_cv_berkeley_db = yes ; then
905                 ol_link_ldbm=db
906                 ol_with_ldbm_api=db
907
908                 if test $ol_with_ldbm_type = hash ; then
909                         AC_DEFINE(LDBM_USE_DBHASH,1)
910                 else
911                         AC_DEFINE(LDBM_USE_DBBTREE,1)
912                 fi
913
914                 dnl $ol_cv_lib_db should be yes or -ldb
915                 dnl (it could be no, but that would be an error
916                 if test $ol_cv_lib_db != yes ; then
917                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_db"
918                 fi
919         fi
920 fi
921
922 if test $ol_with_ldbm_api = manual ; then
923         dnl User thinks he can manually configure LDBM api.
924         ol_link_ldbm=yes
925
926         AC_MSG_WARN([LDBM defines and link options must be set manually])
927
928         AC_CHECK_HEADERS(db.h db_185.h gdbm.h ndbm.h)
929 fi
930
931 if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
932         AC_MSG_WARN(Could not find LDBM with BTREE support)
933         ol_with_ldbm_api=none
934 fi
935
936 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
937         OL_GDBM
938
939         if test $ol_cv_gdbm = yes ; then
940                 ol_link_ldbm=gdbm
941                 ol_with_ldbm_api=gdbm
942
943                 if test $ol_cv_lib_gdbm != yes ; then
944                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_gdbm"
945                 fi
946         fi
947 fi
948
949 if test $ol_with_ldbm_api = auto ; then
950         AC_MSG_WARN([skipping automatic checking for NDBM, must be manually enabled.])
951 elif test $ol_with_ldbm_api = ndbm ; then
952         OL_NDBM
953
954         if test $ol_cv_ndbm = yes ; then
955                 ol_link_ldbm=ndbm
956                 ol_with_ldbm_api=ndbm
957
958                 if test $ol_cv_lib_ndbm != yes ; then
959                         LDBM_LIBS="$LDBM_LIBS $ol_cv_lib_ndbm"
960                 fi
961         fi
962 fi
963
964 if test $ol_link_ldbm = no -a $ol_enable_ldbm != no ; then
965         AC_MSG_WARN(could not find suitable LDBM backend)
966         if test $ol_enable_ldbm = yes ; then
967                 AC_MSG_ERROR(select appropriate LDBM options or disable)
968         fi
969
970         AC_MSG_WARN(disabling LDBM)
971         ol_enable_ldbm=no
972 fi
973
974 if test $ol_enable_wrappers != no ; then
975         AC_CHECK_LIB(wrap, main,
976                 [have_wrappers=yes], [have_wrappers=no])
977
978         if test $have_wrappers = yes ; then
979                 AC_DEFINE(HAVE_TCPD)
980                 SLAPD_LIBS="$SLAPD_LIBS -lwrap"
981         else
982                 AC_MSG_WARN(could not find -lwrap)
983                 if test $ol_enable_wrappers = yes ; then
984                         AC_MSG_ERROR(could not find wrappers, select appropriate options or disable)
985                 fi
986
987                 AC_MSG_WARN(disabling wrappers support)
988                 ol_enable_wrappers=no
989         fi
990
991 fi
992
993 if test $ol_enable_syslog != no ; then
994         AC_CHECK_FUNC(openlog)
995         if test $ac_cv_func_openlog = no -a $ol_enable_syslog = yes; then
996                 AC_MSG_ERROR(could not find syslog, select appropriate options or disable)
997         fi
998         ol_enable_syslog=$ac_cv_func_openlog
999 fi
1000
1001 if test $ol_enable_dmalloc != no ; then
1002         AC_CHECK_HEADERS(dmalloc.h)
1003         AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
1004 fi
1005
1006 # ud needs termcap (should insert check here)
1007 ol_link_termcap=no
1008 AC_CHECK_HEADERS(termcap.h ncurses.h)
1009
1010 if test $ol_link_termcap = no ; then
1011         AC_CHECK_LIB(termcap, tputs, [have_termcap=yes], [have_termcap=no])
1012         if test $have_termcap = yes ; then
1013                 AC_DEFINE(HAVE_TERMCAP)
1014                 ol_link_termcap=yes
1015                 TERMCAP_LIBS=-ltermcap
1016         fi
1017 fi
1018
1019 if test $ol_link_termcap = no ; then
1020         AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
1021         if test $have_ncurses = yes ; then
1022                 AC_DEFINE(HAVE_NCURSES)
1023                 ol_link_termcap=yes
1024                 TERMCAP_LIBS=-lncurses
1025         fi
1026 fi
1027
1028 if test $ol_link_termcap = no ; then
1029         AC_DEFINE(NO_TERMCAP,1)
1030         TERMCAP_LIBS=
1031 fi
1032
1033 # FreeBSD (and others) have crypt(3) in -lcrypt
1034 if test $ol_enable_crypt != no ; then
1035         AC_CHECK_FUNC(crypt, [have_crypt=yes], [
1036                 AC_CHECK_LIB(crypt, crypt, [LUTIL_LIBS="$LUTIL_LIBS -lcrypt"
1037                         have_crypt=yes], [have_crypt=no])])
1038
1039         if test $have_crypt = yes ; then
1040                 AC_DEFINE(HAVE_CRYPT,1)
1041         else
1042                 AC_MSG_WARN(could not find crypt)
1043                 if test $ol_enable_crypt = yes ; then
1044                         AC_MSG_ERROR(could not find crypt, select appropriate options or disable)
1045                 fi
1046
1047                 AC_MSG_WARN(disabling crypt support)
1048                 ol_enable_crypt=no
1049         fi
1050 fi
1051
1052 # FreeBSD (and others) have setproctitle(3) in -lutil
1053 if test $ol_enable_proctitle != no ; then
1054         AC_CHECK_FUNC(setproctitle,     [have_setproctitle=yes], [
1055                 AC_CHECK_LIB(util, setproctitle,
1056                         [have_setproctitle=yes
1057                         LUTIL_LIBS="$LUTIL_LIBS -lutil"],
1058                         [have_setproctitle=no
1059                         LIBOBJS="$LIBOBJS setproctitle.o"])])
1060
1061         if test $have_setproctitle = yes ; then
1062                 AC_DEFINE(HAVE_SETPROCTITLE,1)
1063         fi
1064 fi
1065
1066 dnl ----------------------------------------------------------------
1067 dnl Checks for header files.
1068 AC_HEADER_STDC
1069
1070 if test $ac_cv_header_stdc != yes; then
1071         AC_MSG_WARN([could not Standard C compliant headers])
1072 fi
1073
1074 AC_HEADER_DIRENT
1075 AC_HEADER_SYS_WAIT
1076 AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
1077 if test $am_cv_sys_posix_termios = yes ; then
1078         AC_DEFINE(HAVE_POSIX_TERMIOS,1)
1079 fi
1080
1081 AC_CHECK_HEADERS(       \
1082         crypt.h                 \
1083         errno.h                 \
1084         fcntl.h                 \
1085         filio.h                 \
1086         getopt.h                \
1087         libutil.h               \
1088         limits.h                \
1089         malloc.h                \
1090         memory.h                \
1091         regex.h                 \
1092         psap.h                  \
1093         pwd.h                   \
1094         sgtty.h                 \
1095         stdarg.h                \
1096         stddef.h                \
1097         string.h                \
1098         strings.h               \
1099         sys/file.h              \
1100         sys/filio.h             \
1101         sys/errno.h             \
1102         sys/ioctl.h             \
1103         sys/param.h             \
1104         sys/resource.h  \
1105         sys/socket.h    \
1106         sys/syslog.h    \
1107         sys/time.h              \
1108         sys/types.h             \
1109         syslog.h                \
1110         termios.h               \
1111         unistd.h                \
1112 )
1113
1114 dnl ----------------------------------------------------------------
1115 dnl Checks for typedefs, structures, and compiler characteristics.
1116 AC_TYPE_GETGROUPS dnl requires AC_TYPE_UID_T
1117 AC_TYPE_MODE_T
1118 AC_TYPE_OFF_T
1119 AC_TYPE_PID_T
1120 AM_TYPE_PTRDIFF_T
1121 AC_TYPE_SIGNAL
1122 OL_TYPE_SIG_ATOMIC_T
1123 AC_TYPE_SIZE_T
1124 AC_STRUCT_ST_BLKSIZE
1125 AC_HEADER_TIME
1126 AC_STRUCT_TM
1127
1128 OL_C_UPPER_LOWER
1129 AC_C_CONST
1130 OL_C_VOLATILE
1131
1132 if test $cross_compiling = yes ; then
1133         AC_DEFINE(CROSS_COMPILING, 1)
1134 else
1135         AC_C_BIGENDIAN
1136         AC_CHECK_SIZEOF(short) 
1137         AC_CHECK_SIZEOF(int) 
1138         AC_CHECK_SIZEOF(long)
1139 fi
1140
1141 dnl ----------------------------------------------------------------
1142 dnl Checks for library functions.
1143 AC_FUNC_MEMCMP
1144 dnl AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h
1145 AC_FUNC_STRFTIME
1146 dnl AM_FUNC_STRTOD
1147 AC_FUNC_VPRINTF
1148
1149 if test $ac_cv_func_vprintf = yes ; then
1150         dnl check for vsnprintf
1151         AC_CHECK_FUNCS(vsnprintf vsprintf)
1152 fi
1153
1154 AC_FUNC_WAIT3
1155
1156 AC_CHECK_FUNCS(         \
1157         bcopy                   \
1158         flock                   \
1159         getdtablesize   \
1160         gethostname             \
1161         getpwuid                \
1162         gettimeofday    \
1163         lockf                   \
1164         memcpy                  \
1165         memmove                 \
1166         mkstemp                 \
1167         res_search              \
1168         select                  \
1169         setpwfile               \
1170         setsid                  \
1171         signal                  \
1172         sigset                  \
1173         snprintf                \
1174         socket                  \
1175         strerror                \
1176         strpbrk                 \
1177         strrchr                 \
1178         strsep                  \
1179         strstr                  \
1180         strtok                  \
1181         strtol                  \
1182         strtoul                 \
1183         sysconf                 \
1184         waitpid                 \
1185 )
1186
1187 # these functions are required to build a thread_safe -lldap
1188 AC_CHECK_FUNCS(         \
1189         strtok_r                \
1190         ctime_r                 \
1191         gethostbyaddr_r \
1192         gethostbyname_r \
1193 )
1194
1195 if test $ac_cv_func_strtok_r = yes \
1196         -a $ac_cv_func_ctime_r = yes \
1197         -a $ac_cv_func_gethostbyaddr_r = yes \
1198         -a $ac_cv_func_gethostbyname_r = yes \
1199         ; then
1200
1201         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT, 1)
1202 fi
1203
1204 if test $ol_link_threads != no ; then
1205         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE, 1)
1206 fi
1207
1208 dnl We actually may need to replace more than this.
1209 AC_REPLACE_FUNCS(getopt strdup tempnam)
1210
1211 dnl ----------------------------------------------------------------
1212 # Check Configuration
1213 OL_SYS_ERRLIST
1214
1215 dnl ----------------------------------------------------------------
1216 dnl Sort out defines
1217
1218 if test "$ol_enable_debug" != no ; then
1219         AC_DEFINE(LDAP_DEBUG,1)
1220 fi
1221 if test "$ol_enable_syslog" = yes ; then
1222         AC_DEFINE(LDAP_SYSLOG,1)
1223 fi
1224 if test "$ol_enable_libui" = yes ; then
1225         AC_DEFINE(LDAP_LIBUI,1)
1226 fi
1227 if test "$ol_enable_cache" = no ; then
1228         AC_DEFINE(LDAP_NOCACHE,1)
1229 fi
1230 if test "$ol_enable_dns" != no ; then
1231         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_DNS,LDAP_API_VENDOR_VERSION,1)
1232 fi
1233 if test "$ol_enable_proctitle" != no ; then
1234         AC_DEFINE(LDAP_PROCTITLE,1)
1235 fi
1236 if test "$ol_enable_referrals" != no ; then
1237         AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS,LDAP_API_VENDOR_VERSION,1)
1238 fi
1239 if test "$ol_enable_cldap" != no ; then
1240         AC_DEFINE(LDAP_CONNECTIONLESS,1)
1241 fi
1242
1243 if test "$ol_enable_aclgroups" != no ; then
1244         AC_DEFINE(SLAPD_ACLGROUPS,1)
1245 fi
1246 if test "$ol_enable_crypt" != no ; then
1247         AC_DEFINE(SLAPD_CRYPT,1)
1248 fi
1249 if test "$ol_enable_cleartext" != no ; then
1250         AC_DEFINE(SLAPD_CLEARTEXT,1)
1251 fi
1252 if test "$ol_enable_phonetic" != no ; then
1253         AC_DEFINE(SLAPD_PHONETIC,1)
1254 fi
1255 if test "$ol_enable_rlookups" != no ; then
1256         AC_DEFINE(SLAPD_RLOOKUPS,1)
1257 fi
1258
1259 if test "$ol_link_ldbm" != no ; then
1260         AC_DEFINE(SLAPD_LDBM,1)
1261         BUILD_SLAPD=yes
1262         BUILD_LDBM=yes
1263 fi
1264
1265 if test "$ol_enable_passwd" != no ; then
1266         AC_DEFINE(SLAPD_PASSWD,1)
1267         BUILD_SLAPD=yes
1268         BUILD_PASSWD=yes
1269 fi
1270
1271 if test "$ol_enable_shell" != no ; then
1272         AC_DEFINE(SLAPD_SHELL,1)
1273         BUILD_SLAPD=yes
1274         BUILD_SHELL=yes
1275 fi
1276
1277 if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
1278         $BUILD_SLAPD = yes ; then
1279         BUILD_SLURPD=yes
1280 fi
1281
1282 if test "$ol_link_isode" != no ; then
1283         BUILD_LDAPD=yes
1284 fi
1285
1286 dnl ----------------------------------------------------------------
1287
1288 AC_SUBST(BUILD_LDAPD)
1289 AC_SUBST(BUILD_SLAPD)
1290   AC_SUBST(BUILD_LDBM)
1291   AC_SUBST(BUILD_PASSWD)
1292   AC_SUBST(BUILD_SHELL)
1293 AC_SUBST(BUILD_SLURPD)
1294
1295
1296 AC_SUBST(LDAP_LIBS)
1297 AC_SUBST(LDAPD_LIBS)
1298 AC_SUBST(SLAPD_LIBS)
1299 AC_SUBST(SLURPD_LIBS)
1300 AC_SUBST(LDBM_LIBS)
1301 AC_SUBST(LTHREAD_LIBS)
1302 AC_SUBST(LUTIL_LIBS)
1303
1304 AC_SUBST(KRB_LIBS)
1305 AC_SUBST(TERMCAP_LIBS)
1306
1307 dnl ----------------------------------------------------------------
1308 dnl final output
1309 dnl
1310
1311 AC_OUTPUT( \
1312 Makefile:build/top.mk:Makefile.in:build/dir.mk \
1313 doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \
1314 doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk \
1315 doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk \
1316 doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk \
1317 doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk \
1318 doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk \
1319 clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
1320 clients/finger/Makefile:build/top.mk:clients/finger/Makefile.in:build/rules.mk \
1321 clients/fax500/Makefile:build/top.mk:clients/fax500/Makefile.in:build/rules.mk \
1322 clients/gopher/Makefile:build/top.mk:clients/gopher/Makefile.in:build/rules.mk \
1323 clients/mail500/Makefile:build/top.mk:clients/mail500/Makefile.in:build/rules.mk \
1324 clients/rcpt500/Makefile:build/top.mk:clients/rcpt500/Makefile.in:build/rules.mk \
1325 clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
1326 clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk \
1327 include/Makefile:build/top.mk:include/Makefile.in \
1328 libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk      \
1329 libraries/libavl/Makefile:build/top.mk:libraries/libavl/Makefile.in:build/lib.mk:build/lib-static.mk    \
1330 libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk  \
1331 libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk  \
1332 libraries/libldap_r/Makefile:build/top.mk:libraries/libldap_r/Makefile.in:build/lib.mk:build/lib-shared.mk      \
1333 libraries/libldbm/Makefile:build/top.mk:libraries/libldbm/Makefile.in:build/lib.mk:build/lib-static.mk  \
1334 libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.mk:build/lib-static.mk  \
1335 libraries/liblthread/Makefile:build/top.mk:libraries/liblthread/Makefile.in:build/lib.mk:build/lib-static.mk    \
1336 libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk        \
1337 servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk \
1338 servers/ldapd/Makefile:build/top.mk:servers/ldapd/Makefile.in:build/srv.mk \
1339 servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk \
1340 servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/srv.mk \
1341 servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/srv.mk \
1342 servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/srv.mk \
1343 servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
1344 servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
1345 servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
1346 tests/Makefile:build/top.mk:tests/Makefile.in \
1347 ,[
1348 date > stamp-h
1349 echo Please \"make depend\" to build dependencies
1350 ])