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