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