1dnl $OpenLDAP$
2dnl This work is part of OpenLDAP Software <http://www.openldap.org/>.
3dnl
4dnl Copyright 1998-2021 The OpenLDAP Foundation.
5dnl All rights reserved.
6dnl
7dnl Redistribution and use in source and binary forms, with or without
8dnl modification, are permitted only as authorized by the OpenLDAP
9dnl Public License.
10dnl
11dnl A copy of this license is available in the file LICENSE in the
12dnl top-level directory of the distribution or, alternatively, at
13dnl <http://www.OpenLDAP.org/license.html>.
14dnl
15dnl ----------------------------------------------------------------
16dnl Disable config.cache!
17define([AC_CACHE_LOAD], )dnl
18define([AC_CACHE_SAVE], )dnl
19dnl ----------------------------------------------------------------
20dnl Disable libtool 1.5 support for languages we don't use
21define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
22define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
23define([AC_LIBTOOL_LANG_GCJ_CONFIG], [:])dnl
24dnl ================================================================
25dnl Configure.in for OpenLDAP
26AC_COPYRIGHT([[Copyright 1998-2021 The OpenLDAP Foundation. All rights reserved.
27Restrictions apply, see COPYRIGHT and LICENSE files.]])
28AC_REVISION([Id: c8892a2009b69f5948d96e4a90b672eeb1ded5e1 ])
29AC_INIT([OpenLDAP],,[https://bugs.openldap.org],,[https://www.openldap.org])
30AC_CONFIG_SRCDIR(build/version.sh)dnl
31dnl ----------------------------------------------------------------
32dnl OpenLDAP Autoconf Macros
33builtin(include, build/openldap.m4)dnl
34dnl ================================================================
35
36m4_ifndef([PKG_PREREQ],
37	[m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
38
39AC_CONFIG_AUX_DIR(build)dnl
40AC_CONFIG_MACRO_DIRS([build])
41
42eval `$ac_aux_dir/version.sh`
43if test -z "$OL_STRING"; then
44	AC_MSG_ERROR([could not determine version])
45fi
46
47if test -f "$ac_aux_dir/shtool" && test ! -d $ac_aux_dir/shtool; then
48	ac_cv_shtool="$ac_aux_dir/shtool"
49else
50	AC_MSG_ERROR([no shtool found in $ac_aux_dir])
51fi
52
53SHTOOL="$ac_cv_shtool"
54dnl AC_SUBST(SHTOOL)dnl
55
56TB="" TN=""
57if test -t 1; then
58	TB="`$SHTOOL echo -e '%B' 2>/dev/null`"
59	TN="`$SHTOOL echo -e '%b' 2>/dev/null`"
60fi
61
62OPENLDAP_REPO=""
63if test -d $ac_aux_dir/../.git; then
64	OPENLDAP_REPO="(from Git clone) "
65elif test -d $ac_aux_dir/CVS; then
66	OPENLDAP_REPO="(from CVS checkout) "
67fi
68
69echo "Configuring ${TB}${OL_STRING}${TN} ${OPENLDAP_REPO}..."
70
71dnl Determine host platform
72dnl		we try not to use this for much
73AC_CANONICAL_TARGET([])
74
75AC_SUBST(PACKAGE,$OL_PACKAGE)dnl
76AC_SUBST(VERSION,$OL_VERSION)dnl
77AC_DEFINE_UNQUOTED(OPENLDAP_PACKAGE,"$PACKAGE",Package)
78AC_DEFINE_UNQUOTED(OPENLDAP_VERSION,"$VERSION",Version)
79
80AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION,$OL_API_INC,Version)
81AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION_MAJOR,$OL_MAJOR,Major)
82AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION_MINOR,$OL_MINOR,Minor)
83AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION_PATCH,$OL_PATCH,Patch)
84
85OPENLDAP_LIBRELEASE=$OL_API_LIB_RELEASE
86AC_SUBST(OPENLDAP_LIBRELEASE)dnl
87
88OPENLDAP_LIBVERSION=$OL_API_LIB_VERSION
89AC_SUBST(OPENLDAP_LIBVERSION)dnl
90
91OPENLDAP_RELEASE_DATE="$OL_RELEASE_DATE"
92AC_SUBST(OPENLDAP_RELEASE_DATE)dnl
93
94AC_PREREQ(2.69)dnl Required Autoconf version
95
96AH_TOP([
97/* begin of portable.h.pre */
98/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
99 *
100 * Copyright 1998-2021 The OpenLDAP Foundation
101 * All rights reserved.
102 *
103 * Redistribution and use in source and binary forms, with or without
104 * modification, are permitted only as authorized by the OpenLDAP
105 * Public License.
106 *
107 * A copy of this license is available in the file LICENSE in the
108 * top-level directory of the distribution or, alternatively, at
109 * <http://www.OpenLDAP.org/license.html>.
110 */
111
112#ifndef _LDAP_PORTABLE_H
113#define _LDAP_PORTABLE_H
114
115/* define this if needed to get reentrant functions */
116#ifndef REENTRANT
117#undef REENTRANT
118#endif
119#ifndef _REENTRANT
120#undef _REENTRANT
121#endif
122
123/* define this if needed to get threadsafe functions */
124#ifndef THREADSAFE
125#undef THREADSAFE
126#endif
127#ifndef _THREADSAFE
128#undef _THREADSAFE
129#endif
130#ifndef THREAD_SAFE
131#undef THREAD_SAFE
132#endif
133#ifndef _THREAD_SAFE
134#undef _THREAD_SAFE
135#endif
136
137#ifndef _SGI_MP_SOURCE
138#undef _SGI_MP_SOURCE
139#endif
140
141/* end of portable.h.pre */
142])
143AH_BOTTOM([
144/* begin of portable.h.post */
145
146#ifdef _WIN32
147	/* don't suck in all of the win32 api */
148#	define WIN32_LEAN_AND_MEAN 1
149#endif
150
151#ifndef LDAP_NEEDS_PROTOTYPES
152/* force LDAP_P to always include prototypes */
153#define LDAP_NEEDS_PROTOTYPES 1
154#endif
155
156#ifndef LDAP_REL_ENG
157#if (LDAP_VENDOR_VERSION == 000000) && !defined(LDAP_DEVEL)
158#define LDAP_DEVEL
159#endif
160#if defined(LDAP_DEVEL) && !defined(LDAP_TEST)
161#define LDAP_TEST
162#endif
163#endif
164
165#ifdef HAVE_STDDEF_H
166#	include <stddef.h>
167#endif
168
169#ifdef HAVE_EBCDIC 
170/* ASCII/EBCDIC converting replacements for stdio funcs
171 * vsnprintf and snprintf are used too, but they are already
172 * checked by the configure script
173 */
174#define fputs ber_pvt_fputs
175#define fgets ber_pvt_fgets
176#define printf ber_pvt_printf
177#define fprintf ber_pvt_fprintf
178#define vfprintf ber_pvt_vfprintf
179#define vsprintf ber_pvt_vsprintf
180#endif
181
182#include "ac/fdset.h"
183
184#include "ldap_cdefs.h"
185#include "ldap_features.h"
186
187#include "ac/assert.h"
188#include "ac/localize.h"
189
190#endif /* _LDAP_PORTABLE_H */
191/* end of portable.h.post */
192])
193
194AC_CONFIG_HEADERS([include/portable.h:include/portable.hin])
195AC_CONFIG_HEADERS([include/ldap_features.h:include/ldap_features.hin])
196AC_CONFIG_HEADERS([include/lber_types.h:include/lber_types.hin])
197
198dnl ================================================================
199dnl Start Args
200AC_MSG_CHECKING(configure arguments)
201AC_PREFIX_DEFAULT(/usr/local)
202
203top_builddir=`pwd`
204AC_SUBST(top_builddir)dnl
205
206dnl ----------------------------------------------------------------
207dnl --with-subdir
208ldap_subdir="/openldap"
209
210AC_ARG_WITH(subdir,
211[  --with-subdir=DIR       change default subdirectory used for installs],
212[case "$withval" in
213	no) ldap_subdir=""
214		;;
215	yes)
216		;;
217	/*|\\*)
218		ldap_subdir="$withval"
219		;;
220	*)
221		ldap_subdir="/$withval"
222		;;
223esac
224])dnl
225
226AC_SUBST(ldap_subdir)dnl
227
228dnl ----------------------------------------------------------------
229dnl General "enable" options
230dnl set default to traditional to enable the original debug style
231OL_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable debugging])], yes, [no yes traditional])dnl
232OL_ARG_ENABLE(dynamic, [AS_HELP_STRING([--enable-dynamic], [enable linking built binaries with dynamic libs])], auto)dnl
233OL_ARG_ENABLE(syslog, [AS_HELP_STRING([--enable-syslog], [enable syslog support])], auto)dnl
234dnl OL_ARG_ENABLE(referrals,[AS_HELP_STRING([--enable-referrals], [enable LDAPv2+ Referrals (experimental)])], no)dnl
235ol_enable_referrals=${ol_enable_referrals-no}
236OL_ARG_ENABLE(ipv6, [AS_HELP_STRING([--enable-ipv6], [enable IPv6 support])], auto)dnl
237OL_ARG_ENABLE(local, [AS_HELP_STRING([--enable-local], [enable AF_LOCAL (AF_UNIX) socket support])], auto)dnl
238
239dnl ----------------------------------------------------------------
240dnl General "with" options
241OL_ARG_WITH(cyrus_sasl, [AS_HELP_STRING([--with-cyrus-sasl], [with Cyrus SASL support])],
242	auto, [auto yes no] )
243OL_ARG_WITH(systemd, [AS_HELP_STRING([--with-systemd],	[with systemd service notification support])],
244	auto, [auto yes no] )
245OL_ARG_WITH(fetch, [AS_HELP_STRING([--with-fetch], [with fetch(3) URL support])],
246	auto, [auto yes no] )
247OL_ARG_WITH(threads,
248	[AS_HELP_STRING([--with-threads], [with threads library auto|nt|posix|pth|lwp|manual])],
249	auto, [auto nt posix pth lwp yes no manual] )
250OL_ARG_WITH(tls,
251	[AS_HELP_STRING([--with-tls], [with TLS/SSL support auto|openssl|gnutls])],
252	auto, [auto openssl gnutls yes no] )
253OL_ARG_WITH(yielding_select,
254	[AS_HELP_STRING([--with-yielding-select], [with implicitly yielding select])],
255	auto, [auto yes no manual] )
256OL_ARG_WITH(mp,
257	[AS_HELP_STRING([--with-mp], [with multiple precision statistics auto|longlong|long|bignum|gmp])],
258	auto, [auto longlong long bignum gmp yes no])
259OL_ARG_WITH(odbc,
260	[AS_HELP_STRING([--with-odbc], [with specific ODBC support iodbc|unixodbc|odbc32|auto])],
261	auto, [auto iodbc unixodbc odbc32] )
262
263dnl ----------------------------------------------------------------
264dnl Server options
265dnl ----------------------------------------------------------------
266
267dnl ----------------------------------------------------------------
268dnl SLAPD OPTIONS
269SlapdOptions="dynacl \
270	aci \
271	cleartext \
272	crypt \
273	spasswd \
274	modules \
275	rlookups \
276	slapi \
277	slp \
278	wrappers"
279
280AC_ARG_ENABLE(xxslapdoptions,[
281SLAPD (Standalone LDAP Daemon) Options:])
282
283OL_ARG_ENABLE(slapd, [AS_HELP_STRING([--enable-slapd], [enable building slapd])], yes)dnl
284OL_ARG_ENABLE(dynacl, [AS_HELP_STRING([--enable-dynacl], [enable run-time loadable ACL support (experimental)])], no)dnl
285OL_ARG_ENABLE(aci, [AS_HELP_STRING([--enable-aci], [enable per-object ACIs (experimental)])], no, [no yes mod])dnl
286OL_ARG_ENABLE(cleartext, [AS_HELP_STRING([--enable-cleartext], [enable cleartext passwords])], yes)dnl
287OL_ARG_ENABLE(crypt, [AS_HELP_STRING([--enable-crypt], [enable crypt(3) passwords])], no)dnl
288OL_ARG_ENABLE(spasswd, [AS_HELP_STRING([--enable-spasswd], [enable (Cyrus) SASL password verification])], no)dnl
289OL_ARG_ENABLE(modules, [AS_HELP_STRING([--enable-modules], [enable dynamic module support])], no)dnl
290OL_ARG_ENABLE(rlookups, [AS_HELP_STRING([--enable-rlookups], [enable reverse lookups of client hostnames])], no)dnl
291OL_ARG_ENABLE(slapi, [AS_HELP_STRING([--enable-slapi], [enable SLAPI support (experimental)])], no)dnl
292OL_ARG_ENABLE(slp, [AS_HELP_STRING([--enable-slp], [enable SLPv2 support])], no)dnl
293OL_ARG_ENABLE(wrappers, [AS_HELP_STRING([--enable-wrappers], [enable tcp wrapper support])], no)dnl
294
295dnl ----------------------------------------------------------------
296dnl SLAPD Backend Options
297Backends="dnssrv \
298	ldap \
299	mdb \
300	meta \
301	asyncmeta \
302	ndb \
303	null \
304	passwd \
305	perl \
306	relay \
307	sock \
308	sql \
309	wt"
310
311AC_ARG_ENABLE(xxslapbackends,[
312SLAPD Backend Options:])
313
314OL_ARG_ENABLE(backends, [AS_HELP_STRING([--enable-backends], [enable all available backends])],
315	--, [no yes mod])dnl
316OL_ARG_ENABLE(dnssrv, [AS_HELP_STRING([--enable-dnssrv], [enable dnssrv backend])],
317	no, [no yes mod], ol_enable_backends)dnl
318OL_ARG_ENABLE(ldap, [AS_HELP_STRING([--enable-ldap], [enable ldap backend])],
319	no, [no yes mod], ol_enable_backends)dnl
320OL_ARG_ENABLE(mdb, [AS_HELP_STRING([--enable-mdb], [enable mdb database backend])],
321	yes, [no yes mod], ol_enable_backends)dnl
322OL_ARG_ENABLE(meta, [AS_HELP_STRING([--enable-meta], [enable metadirectory backend])],
323	no, [no yes mod], ol_enable_backends)dnl
324OL_ARG_ENABLE(asyncmeta, [AS_HELP_STRING([--enable-asyncmeta], [enable asynchronous metadirectory backend])],
325	no, [no yes mod], ol_enable_backends)dnl
326OL_ARG_ENABLE(ndb, [AS_HELP_STRING([--enable-ndb], [enable MySQL NDB Cluster backend])],
327	no, [no yes mod])dnl
328OL_ARG_ENABLE(null, [AS_HELP_STRING([--enable-null], [enable null backend])],
329	no, [no yes mod], ol_enable_backends)dnl
330OL_ARG_ENABLE(passwd, [AS_HELP_STRING([--enable-passwd], [enable passwd backend])],
331	no, [no yes mod], ol_enable_backends)dnl
332OL_ARG_ENABLE(perl, [AS_HELP_STRING([--enable-perl], [enable perl backend])],
333	no, [no yes mod])dnl
334OL_ARG_ENABLE(relay, [AS_HELP_STRING([--enable-relay], [enable relay backend])],
335	yes, [no yes mod], ol_enable_backends)dnl
336OL_ARG_ENABLE(sock, [AS_HELP_STRING([--enable-sock], [enable sock backend])],
337	no, [no yes mod], ol_enable_backends)dnl
338OL_ARG_ENABLE(sql, [AS_HELP_STRING([--enable-sql], [enable sql backend])],
339	no, [no yes mod])dnl
340OL_ARG_ENABLE(wt, [AS_HELP_STRING([--enable-wt], [enable WiredTiger backend])],
341	no, [no yes mod], ol_enable_backends)dnl
342
343dnl ----------------------------------------------------------------
344dnl SLAPD Overlay Options
345Overlays="accesslog \
346	auditlog \
347	autoca \
348	collect \
349	constraint \
350	dds \
351	deref \
352	dyngroup \
353	dynlist \
354	homedir \
355	memberof \
356	otp \
357	ppolicy \
358	proxycache \
359	refint \
360	remoteauth \
361	retcode \
362	rwm \
363	seqmod \
364	sssvlv \
365	syncprov \
366	translucent \
367	unique \
368	valsort"
369
370Pwmods="argon2"
371
372AC_ARG_ENABLE(xxslapoverlays,[
373SLAPD Overlay Options:])
374
375OL_ARG_ENABLE(overlays, [AS_HELP_STRING([--enable-overlays], [enable all available overlays])],
376	--, [no yes mod])dnl
377OL_ARG_ENABLE(accesslog, [AS_HELP_STRING([--enable-accesslog], [In-Directory Access Logging overlay])],
378	no, [no yes mod], ol_enable_overlays)
379OL_ARG_ENABLE(auditlog, [AS_HELP_STRING([--enable-auditlog], [Audit Logging overlay])],
380	no, [no yes mod], ol_enable_overlays)
381OL_ARG_ENABLE(autoca, [AS_HELP_STRING([--enable-autoca], [Automatic Certificate Authority overlay])],
382	no, [no yes mod], ol_enable_overlays)
383OL_ARG_ENABLE(collect, [AS_HELP_STRING([--enable-collect], [Collect overlay])],
384	no, [no yes mod], ol_enable_overlays)
385OL_ARG_ENABLE(constraint, [AS_HELP_STRING([--enable-constraint], [Attribute Constraint overlay])],
386	no, [no yes mod], ol_enable_overlays)
387OL_ARG_ENABLE(dds, [AS_HELP_STRING([--enable-dds], [Dynamic Directory Services overlay])],
388	no, [no yes mod], ol_enable_overlays)
389OL_ARG_ENABLE(deref, [AS_HELP_STRING([--enable-deref], [Dereference overlay])],
390	no, [no yes mod], ol_enable_overlays)
391OL_ARG_ENABLE(dyngroup, [AS_HELP_STRING([--enable-dyngroup], [Dynamic Group overlay])],
392	no, [no yes mod], ol_enable_overlays)
393OL_ARG_ENABLE(dynlist, [AS_HELP_STRING([--enable-dynlist], [Dynamic List overlay])],
394	no, [no yes mod], ol_enable_overlays)
395OL_ARG_ENABLE(homedir, [AS_HELP_STRING([--enable-homedir], [Home Directory Management overlay])],
396	no, [no yes mod], ol_enable_overlays)
397OL_ARG_ENABLE(memberof, [AS_HELP_STRING([--enable-memberof], [Reverse Group Membership overlay])],
398	no, [no yes mod], ol_enable_overlays)
399OL_ARG_ENABLE(otp, [AS_HELP_STRING([--enable-otp], [OTP 2-factor authentication overlay])],
400	no, [no yes mod], ol_enable_overlays)
401OL_ARG_ENABLE(ppolicy, [AS_HELP_STRING([--enable-ppolicy], [Password Policy overlay])],
402	no, [no yes mod], ol_enable_overlays)
403OL_ARG_ENABLE(proxycache, [AS_HELP_STRING([--enable-proxycache], [Proxy Cache overlay])],
404	no, [no yes mod], ol_enable_overlays)
405OL_ARG_ENABLE(refint, [AS_HELP_STRING([--enable-refint], [Referential Integrity overlay])],
406	no, [no yes mod], ol_enable_overlays)
407OL_ARG_ENABLE(remoteauth, [AS_HELP_STRING([--enable-remoteauth], [Deferred Authentication overlay])],
408	no, [no yes mod], ol_enable_overlays)
409OL_ARG_ENABLE(retcode, [AS_HELP_STRING([--enable-retcode], [Return Code testing overlay])],
410	no, [no yes mod], ol_enable_overlays)
411OL_ARG_ENABLE(rwm, [AS_HELP_STRING([--enable-rwm], [Rewrite/Remap overlay])],
412	no, [no yes mod], ol_enable_overlays)
413OL_ARG_ENABLE(seqmod, [AS_HELP_STRING([--enable-seqmod], [Sequential Modify overlay])],
414	no, [no yes mod], ol_enable_overlays)
415OL_ARG_ENABLE(sssvlv, [AS_HELP_STRING([--enable-sssvlv], [ServerSideSort/VLV overlay])],
416	no, [no yes mod], ol_enable_overlays)
417OL_ARG_ENABLE(syncprov, [AS_HELP_STRING([--enable-syncprov], [Syncrepl Provider overlay])],
418	yes, [no yes mod], ol_enable_overlays)
419OL_ARG_ENABLE(translucent, [AS_HELP_STRING([--enable-translucent], [Translucent Proxy overlay])],
420	no, [no yes mod], ol_enable_overlays)
421OL_ARG_ENABLE(unique, [AS_HELP_STRING([--enable-unique], [Attribute Uniqueness overlay])],
422	no, [no yes mod], ol_enable_overlays)
423OL_ARG_ENABLE(valsort, [AS_HELP_STRING([--enable-valsort], [Value Sorting overlay])],
424	no, [no yes mod], ol_enable_overlays)
425
426dnl ----------------------------------------------------------------
427dnl PASSWORD MODULE OPTIONS
428AC_ARG_ENABLE(pwmodoptions,[
429SLAPD Password Module Options:])
430OL_ARG_ENABLE(argon2, [AS_HELP_STRING([--enable-argon2], [Argon2 password hashing module])],
431	no, [no yes], ol_enable_pwmodules)
432OL_ARG_WITH(argon2,
433	[AS_HELP_STRING([--with-argon2], [with argon2 support library auto|libsodium|libargon2])],
434	auto, [auto libsodium libargon2 yes no] )
435
436dnl ----------------------------------------------------------------
437dnl BALANCER OPTIONS
438AC_ARG_ENABLE(balanceroptions,[
439LLOADD (Load Balancer Daemon) Options:])
440OL_ARG_ENABLE(balancer, [AS_HELP_STRING([--enable-balancer], [enable load balancer])],
441	no, [no yes mod])
442
443dnl ----------------------------------------------------------------
444AC_ARG_ENABLE(xxliboptions,[
445Library Generation & Linking Options])
446AC_ENABLE_STATIC
447AC_ENABLE_SHARED
448OL_ARG_ENABLE(versioning, [AS_HELP_STRING([--enable-versioning], [Enable versioned symbols in shared library])],
449	auto, [no yes auto])
450dnl ----------------------------------------------------------------
451dnl Validate options
452dnl ----------------------------------------------------------------
453
454if test $ol_enable_slapd = no ; then
455	dnl SLAPD was specifically disabled
456	dnl Disable all of its options
457
458	for i in $SlapdOptions; do
459		eval "ol_tmp=\$ol_enable_$i"
460		if test $ol_tmp = yes ; then
461			AC_MSG_WARN([slapd disabled, ignoring --enable-$i argument])
462			eval "ol_enable_$i=no"
463		fi
464	done
465
466	for i in $Backends $Overlays $Pwmods; do
467		eval "ol_tmp=\$ol_enable_$i"
468		if test $ol_tmp != no ; then
469			AC_MSG_WARN([slapd disabled, ignoring --enable-$i argument])
470			eval "ol_enable_$i=no"
471		fi
472	done
473
474	if test $ol_enable_balancer = mod ; then
475		AC_MSG_WARN([slapd disabled, ignoring --enable-balancer=mod argument])
476		ol_enable_balancer=no
477	fi
478else
479	dnl If slapd enabled and loadable module support disabled
480	dnl then require at least one built-in backend
481
482	if test $ol_enable_modules = no; then
483
484		for i in backends overlays balancer $Backends $Overlays; do
485			eval "ol_tmp=\$ol_enable_$i"
486			if test -n "$ol_tmp" && test "$ol_tmp" = mod ; then
487				AC_MSG_ERROR([--enable-$i=mod requires --enable-modules])
488			fi
489		done
490
491		for i in $Pwmods; do
492			eval "ol_tmp=\$ol_enable_$i"
493			if test -n "$ol_tmp" && test "$ol_tmp" = yes ; then
494				AC_MSG_ERROR([--enable-$i=yes requires --enable-modules])
495			fi
496		done
497
498		ol_any_backend=no
499		for i in $Backends; do
500			eval "ol_tmp=\$ol_enable_$i"
501			if test $ol_tmp = yes; then
502				ol_any_backend=yes
503			fi
504		done
505
506		if test $ol_any_backend = no; then
507			AC_MSG_ERROR([slapd requires a backend])
508		fi
509	fi
510fi
511
512if test $ol_enable_aci = yes ; then
513	if test $ol_enable_dynacl = no ; then
514		AC_MSG_ERROR([--enable-aci requires --enable-dynacl])
515	fi
516elif test $ol_enable_aci = mod ; then
517	AC_MSG_ERROR([ACI build as dynamic module not supported (yet)])
518fi
519
520if test $ol_enable_modules = yes ; then
521	if test $ol_enable_dynamic = no ; then
522		AC_MSG_ERROR([--enable-modules requires --enable-dynamic])
523	fi
524	ol_enable_dynamic=yes
525fi
526
527if test $ol_enable_balancer != no ; then
528	dnl Load Balancer was specifically enabled
529	if test $ol_with_threads = no ; then
530		AC_MSG_ERROR([Load balancer requires threads])
531	fi
532fi
533
534if test $ol_enable_spasswd = yes ; then
535	if test $ol_with_cyrus_sasl = no ; then
536		AC_MSG_ERROR([--enable-spasswd requires --with-cyrus-sasl])
537	fi
538	ol_with_cyrus_sasl=yes
539fi
540
541if test $ol_enable_meta/$ol_enable_ldap = yes/no ; then
542	AC_MSG_ERROR([--enable-meta requires --enable-ldap])
543fi
544
545if test $ol_enable_asyncmeta/$ol_enable_ldap = yes/no ; then
546	AC_MSG_ERROR([--enable-asyncmeta requires --enable-ldap])
547fi
548
549AC_MSG_RESULT(done)
550
551dnl ----------------------------------------------------------------
552dnl Initialize vars
553LDAP_LIBS=
554SLAPD_NDB_LIBS=
555SLAPD_NDB_INCS=
556LTHREAD_LIBS=
557LEVENT_LIBS=
558LUTIL_LIBS=
559
560CLIENT_LIBS=
561
562SLAPD_LIBS=
563BALANCER_LIBS=
564BALANCER_INCLUDE=
565
566BUILD_SLAPD=no
567BUILD_BALANCER=no
568
569BUILD_THREAD=no
570
571BUILD_SLAPI=no
572SLAPD_SLAPI_DEPEND=
573
574BUILD_DNSSRV=no
575BUILD_LDAP=no
576BUILD_MDB=no
577BUILD_META=no
578BUILD_ASYNCMETA=no
579BUILD_NDB=no
580BUILD_NULL=no
581BUILD_PASSWD=no
582BUILD_PERL=no
583BUILD_RELAY=no
584BUILD_SHELL=no
585BUILD_SOCK=no
586BUILD_SQL=no
587BUILD_WT=no
588
589BUILD_ACCESSLOG=no
590BUILD_AUDITLOG=no
591BUILD_AUTOCA=no
592BUILD_CONSTRAINT=no
593BUILD_DDS=no
594BUILD_DENYOP=no
595BUILD_DEREF=no
596BUILD_DYNGROUP=no
597BUILD_DYNLIST=no
598BUILD_LASTMOD=no
599BUILD_HOMEDIR=no
600BUILD_MEMBEROF=no
601BUILD_OTP=no
602BUILD_PPOLICY=no
603BUILD_PROXYCACHE=no
604BUILD_REFINT=no
605BUILD_REMOTEAUTH=no
606BUILD_RETCODE=no
607BUILD_RWM=no
608BUILD_SEQMOD=no
609BUILD_SSSVLV=no
610BUILD_SYNCPROV=no
611BUILD_TRANSLUCENT=no
612BUILD_UNIQUE=no
613BUILD_VALSORT=no
614
615BUILD_PW_ARGON2=no
616
617SLAPD_STATIC_OVERLAYS=
618SLAPD_DYNAMIC_OVERLAYS=
619
620SLAPD_DYNAMIC_PWMODS=
621
622SLAPD_MODULES_LDFLAGS=
623SLAPD_MODULES_CPPFLAGS=
624
625SLAPD_STATIC_BACKENDS="back-ldif back-monitor"
626SLAPD_DYNAMIC_BACKENDS=
627
628SLAPD_PERL_LDFLAGS=
629MOD_PERL_LDFLAGS=
630PERL_CPPFLAGS=
631
632SLAPD_SQL_LDFLAGS=
633SLAPD_SQL_LIBS=
634SLAPD_SQL_INCLUDES=
635
636SASL_LIBS=
637TLS_LIBS=
638WITH_TLS_TYPE=no
639MODULES_LIBS=
640SLAPI_LIBS=
641LIBSLAPI=
642AUTH_LIBS=
643SYSTEMD_LIBS=
644
645SLAPD_SLP_LIBS=
646SLAPD_GMP_LIBS=
647
648dnl ================================================================
649dnl Checks for programs
650
651AC_DEFINE(HAVE_MKVERSION, 1, [define this if you have mkversion])
652
653dnl ----------------------------------------------------------------
654dnl
655dnl Determine which C translator to use
656dnl
657
658dnl AIX Thread requires we use cc_r or xlc_r.
659dnl But only do this IF AIX and CC is not set
660dnl and threads are auto|yes|posix.
661dnl
662dnl If we find cc_r|xlc_r, force pthreads and assume
663dnl		pthread_create is in $LIBS (ie: don't bring in
664dnl		any additional thread libraries)
665dnl If we do not find cc_r|xlc_r, disable threads
666
667ol_aix_threads=no
668case "$target" in
669*-*-aix*) dnl all AIX is not a good idea.
670	if test -z "$CC" ; then
671		case "$ol_with_threads" in
672		auto | yes |  posix) ol_aix_threads=yes ;;
673		esac
674	fi
675;;
676esac
677
678if test $ol_aix_threads = yes ; then
679	if test -z "${CC}" ; then
680		AC_CHECK_PROGS(CC,cc_r xlc_r cc)
681
682		if test "$CC" = cc ; then
683			dnl no CC! don't allow --with-threads
684			if test $ol_with_threads != auto ; then
685				AC_MSG_ERROR([--with-threads requires cc_r (or other suitable compiler) on AIX])
686			else
687				AC_MSG_WARN([disabling threads, no cc_r on AIX])
688			fi
689			ol_with_threads=no
690  		fi
691	fi
692
693	case ${CC} in cc_r | xlc_r)
694		ol_with_threads=posix
695		ol_cv_pthread_create=yes
696		;;
697	esac
698fi
699
700if test -z "${CC}"; then
701	AC_CHECK_PROGS(CC,cc gcc,missing)
702
703	if test "${CC}" = "missing" ; then
704		AC_MSG_ERROR([Unable to locate cc(1) or suitable replacement.  Check PATH or set CC.])
705	fi
706fi
707
708if test -z "${AR}"; then
709	AC_CHECK_PROGS(AR,ar gar,missing)
710
711	if test "${AR}" = "missing" ; then
712		AC_MSG_ERROR([Unable to locate ar(1) or suitable replacement.  Check PATH or set AR.])
713	fi
714fi
715
716if test -z "${STRIP}"; then
717	AC_CHECK_PROGS(STRIP,strip,missing)
718
719	if test "${STRIP}" = "missing" ; then
720		AC_MSG_ERROR([Unable to locate strip(1) or suitable replacement.  Check PATH or set STRIP.])
721	fi
722fi
723
724
725AC_LIBTOOL_WIN32_DLL
726AC_LIBTOOL_DLOPEN
727AC_PROG_MAKE_SET
728AC_PROG_LIBTOOL
729
730dnl ----------------------------------------------------------------
731dnl Perl
732ol_link_perl=no
733if test $ol_enable_perl != no ; then
734	AC_PATH_PROG(PERLBIN, perl, /usr/bin/perl)
735
736	if test "no$PERLBIN" = "no" ; then
737		if test $ol_enable_perl = yes ; then
738			AC_MSG_ERROR([could not locate perl])
739		fi
740
741	else
742		PERL_CPPFLAGS="`$PERLBIN -MExtUtils::Embed -e ccopts`"
743		PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e 's/ -lc / /' -e 's/ -lc$//'`"
744
745		if test x"$ol_enable_perl" = "xyes" ; then
746			SLAPD_PERL_LDFLAGS="$PERL_LDFLAGS"
747		else
748			MOD_PERL_LDFLAGS="$PERL_LDFLAGS"
749		fi
750		dnl should check perl version
751		ol_link_perl=yes
752	fi
753fi
754
755AC_PROG_CPP
756OL_MSVC
757
758dnl ----------------------------------------------------------------
759dnl Checks for Windows NT
760case $host_os in
761  *mingw32* ) ac_cv_mingw32=yes ;;
762  *cygwin* ) ac_cv_cygwin=yes ;;
763  *interix* ) ac_cv_interix=yes ;;
764esac
765
766AC_CHECK_TOOL(RC, windres, )
767
768dnl ----------------------------------------------------------------
769dnl Checks for file extensions
770AC_EXEEXT
771AC_OBJEXT
772AC_DEFINE_UNQUOTED(EXEEXT, "${EXEEXT}", [defined to be the EXE extension])
773
774dnl ----------------------------------------------------------------
775dnl BeOS requires -lbe -lroot -lnet
776AC_CHECK_LIB(be, be_app, [LIBS="$LIBS -lbe -lroot -lnet"], :, [-lroot -lnet])
777
778dnl ----------------------------------------------------------------
779dnl OpenLDAP requires STDC features
780AC_PROG_CC
781if test "X${ac_cv_prog_cc_stdc}" = "Xno" ; then
782	AC_MSG_ERROR([OpenLDAP requires compiler to support STDC constructs.])
783fi
784
785dnl ----------------------------------------------------------------
786dnl Check cc depend flags
787OL_MKDEPEND
788if test "${ol_cv_mkdep}" = no ; then
789	# this will soon become an error
790	AC_MSG_WARN([do not know how to generate dependencies])
791fi
792
793dnl ----------------------------------------------------------------
794dnl Check for AIX security library
795AC_CHECK_LIB(s, afopen, [
796	AUTH_LIBS=-ls
797	AC_DEFINE(HAVE_AIX_SECURITY,1,[define if you have AIX security lib])
798])
799
800dnl ----------------------------------------------------------------
801dnl Check for IBM OS/390
802case "$target" in
803*-ibm-openedition)
804	ac_cv_func_getopt=no
805	AC_DEFINE(BOTH_STRINGS_H,1,[define to use both <string.h> and <strings.h>])
806	;;
807esac
808
809dnl ----------------------------------------------------------------
810dnl Check for module support
811ol_link_modules=no
812WITH_MODULES_ENABLED=no
813if test $ol_enable_modules != no ; then
814	AC_CHECK_HEADERS(ltdl.h)
815
816	if test $ac_cv_header_ltdl_h = no ; then
817		AC_MSG_ERROR([could not locate libtool ltdl.h])
818	fi
819
820	AC_CHECK_LIB(ltdl, lt_dlinit, [
821		MODULES_LIBS=-lltdl
822		AC_DEFINE(HAVE_LIBLTDL,1,[define if you have libtool -ltdl])
823	])
824
825	if test "$ac_cv_lib_ltdl_lt_dlinit" = no ; then
826		AC_MSG_ERROR([could not locate libtool -lltdl])
827	fi
828	ol_link_modules=yes
829	WITH_MODULES_ENABLED=yes
830fi
831
832dnl ----------------------------------------------------------------
833dnl Checks for header files.
834OL_HEADER_STDC
835
836if test $ol_cv_header_stdc != yes; then
837	AC_MSG_WARN([could not locate Standard C compliant headers])
838fi
839
840AC_HEADER_DIRENT
841AC_HEADER_SYS_WAIT
842AC_HEADER_TIOCGWINSZ
843
844AC_CHECK_HEADERS(	\
845	arpa/inet.h		\
846	arpa/nameser.h	\
847	assert.h		\
848	bits/types.h	\
849	conio.h			\
850	crypt.h			\
851	direct.h		\
852	errno.h			\
853	fcntl.h			\
854	filio.h			\
855	getopt.h		\
856	grp.h			\
857	io.h			\
858	libutil.h		\
859	limits.h		\
860	locale.h		\
861	malloc.h		\
862	memory.h		\
863	psap.h			\
864	pwd.h			\
865	process.h		\
866	sgtty.h			\
867	shadow.h		\
868	stddef.h		\
869	string.h		\
870	strings.h		\
871	sysexits.h		\
872	sys/file.h		\
873	sys/filio.h		\
874	sys/fstyp.h		\
875	sys/errno.h		\
876	sys/ioctl.h		\
877	sys/param.h		\
878	sys/privgrp.h	\
879	sys/resource.h	\
880	sys/select.h	\
881	sys/socket.h	\
882	sys/stat.h		\
883	sys/syslog.h	\
884	sys/time.h		\
885	sys/types.h		\
886	sys/uio.h		\
887	sys/vmount.h	\
888	syslog.h		\
889	termios.h		\
890	unistd.h		\
891	utime.h			\
892)
893
894dnl Only check Winsock on MinGW
895if test "$ac_cv_mingw32" = yes \
896	-o "$ac_cv_interix" = yes \
897	-o "$ol_cv_msvc" = yes
898then
899	AC_CHECK_HEADERS( winsock.h winsock2.h )
900fi
901
902AC_CHECK_HEADERS( resolv.h, [], [],
903[$ac_includes_default
904#include <netinet/in.h>
905])
906
907AC_CHECK_HEADERS( netinet/tcp.h, [], [],
908[$ac_includes_default
909#include <netinet/in.h>
910])
911
912AC_CHECK_HEADERS( sys/ucred.h, [], [],
913[$ac_includes_default
914#ifdef HAVE_SYS_PARAM_H
915#include <sys/param.h>
916#endif
917])
918
919dnl ----------------------------------------------------------------
920dnl Checks for libraries
921
922AC_CHECK_FUNCS( sigaction sigset )
923AC_CHECK_FUNCS( fmemopen )
924
925dnl HP-UX requires -lV3
926dnl this is not needed on newer versions of HP-UX
927if test $ac_cv_func_sigaction = no && test $ac_cv_func_sigaction = no ; then
928	AC_CHECK_LIB(V3, sigset)
929fi
930
931if test $ol_cv_msvc = yes ; then
932   ol_cv_winsock=yes
933fi
934
935dnl The following is INTENTIONALLY scripted out because shell does not
936dnl support variable names with the '@' character, which is what
937dnl autoconf would try to generate if one merely used AC_SEARCH_LIBS
938if test "$ac_cv_header_winsock_h" = yes; then
939	AC_CACHE_CHECK([for winsock], [ol_cv_winsock],[
940	save_LIBS="$LIBS"
941	for curlib in none ws2_32 wsock32; do
942		if test $curlib != none ; then
943	    	LIBS="$save_LIBS -l$curlib"
944		fi
945		AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock.h>
946			]], [[
947			socket(0,0,0);
948			select(0,NULL,NULL,NULL,NULL);
949			closesocket(0);
950			gethostname(NULL,0);
951			]])],[ol_cv_winsock=$curlib],[ol_cv_winsock=no])
952
953		test "$ol_cv_winsock" != no && break
954	done
955	LIBS="$save_LIBS"
956	])
957
958	if test $ol_cv_winsock != no ; then
959    	AC_DEFINE(HAVE_WINSOCK, 1, [define if you have winsock])
960    	ac_cv_func_socket=yes
961    	ac_cv_func_select=yes
962    	ac_cv_func_closesocket=yes
963    	ac_cv_func_gethostname=yes
964
965		if test $ol_cv_winsock != none -a $ol_cv_winsock != yes ; then
966        	LIBS="$LIBS -l$ol_cv_winsock"
967		fi
968
969    	if test $ol_cv_winsock = ws2_32 -o $ol_cv_winsock = yes ; then
970			AC_DEFINE(HAVE_WINSOCK2, 1, [define if you have winsock2])
971    	fi
972	fi
973fi
974
975dnl Find socket()
976dnl Likely combinations:
977dnl		-lsocket [ -lnsl_s | -lnsl ]
978dnl		-linet
979
980AC_CHECK_FUNC(socket, :, [	
981dnl hopefully we won't include too many libraries
982	AC_CHECK_LIB(socket, main)
983	AC_CHECK_LIB(net, socket)
984	AC_CHECK_LIB(nsl_s, main)
985	AC_CHECK_LIB(nsl, main)
986	AC_CHECK_LIB(inet, socket)
987	AC_CHECK_LIB(gen, main)
988])
989
990dnl require select
991AC_CHECK_FUNC(select, :, AC_MSG_ERROR([select() required.]))
992
993if test "${ac_cv_header_winsock_h}" != yes; then
994	dnl Select arg types
995	dnl (if this detection becomes permanent, it and the select() detection
996	dnl should be done before the yielding select test) 
997	AC_FUNC_SELECT_ARGTYPES
998fi
999
1000dnl check to see if system call automatically restart
1001dnl AC_SYS_RESTARTABLE_SYSCALLS
1002
1003dnl ----------------------------------------------------------------
1004AC_CHECK_FUNCS( poll )
1005if test $ac_cv_func_poll = yes; then
1006AC_CHECK_HEADERS( poll.h sys/poll.h )
1007fi
1008
1009dnl ----------------------------------------------------------------
1010AC_CHECK_HEADERS( sys/epoll.h )
1011if test "${ac_cv_header_sys_epoll_h}" = yes; then
1012	AC_MSG_CHECKING(for epoll system call)
1013	AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(int argc, char **argv)
1014{
1015	int epfd = epoll_create(256);
1016	exit (epfd == -1 ? 1 : 0);
1017}]])],[AC_MSG_RESULT(yes)
1018	AC_DEFINE(HAVE_EPOLL,1, [define if your system supports epoll])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
1019fi
1020
1021dnl ----------------------------------------------------------------
1022AC_CHECK_HEADERS( sys/event.h )
1023if test "${ac_cv_header_sys_event_h}" = yes; then
1024AC_MSG_CHECKING(for kqueue system call)
1025AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(int argc, char **argv)
1026{
1027	int kqfd = kqueue();
1028	exit (kqfd == -1 ? 1 : 0);
1029}]])],[AC_MSG_RESULT(yes)
1030AC_DEFINE(HAVE_KQUEUE,1, [define if your system supports kqueue])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
1031fi
1032
1033dnl ----------------------------------------------------------------
1034AC_CHECK_HEADERS( sys/devpoll.h )
1035dnl "/dev/poll" needs <sys/poll.h> as well...
1036if test "${ac_cv_header_sys_devpoll_h}" = yes \
1037		-a "${ac_cv_header_poll_h}" = yes ; \
1038then
1039	AC_MSG_CHECKING(for /dev/poll)
1040	AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(int argc, char **argv)
1041{
1042	int devpollfd = open("/dev/poll", /* O_RDWR */ 2);
1043	exit (devpollfd == -1 ? 1 : 0);
1044}]])],[AC_MSG_RESULT(yes)
1045	AC_DEFINE(HAVE_DEVPOLL,1, [define if your system supports /dev/poll])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
1046fi
1047
1048dnl ----------------------------------------------------------------
1049OL_STRERROR
1050
1051dnl ----------------------------------------------------------------
1052dnl require POSIX regex
1053AC_CHECK_HEADERS( regex.h, [], [],
1054[$ac_includes_default
1055#ifdef HAVE_SYS_TYPES_H
1056#include <sys/types.h>
1057#endif
1058])
1059
1060if test "$ac_cv_header_regex_h" != yes ; then
1061	AC_MSG_ERROR([POSIX regex.h required.])
1062fi
1063AC_SEARCH_LIBS(regfree, [regex gnuregex],
1064	:, AC_MSG_ERROR([POSIX regex required.]))
1065
1066OL_POSIX_REGEX
1067if test "$ol_cv_c_posix_regex" = no ; then
1068	AC_MSG_ERROR([broken POSIX regex!])
1069fi
1070
1071dnl ----------------------------------------------------------------
1072dnl UUID Support
1073
1074have_uuid=no
1075AC_CHECK_HEADERS(sys/uuid.h)
1076dnl The HAVE_UUID_TO_STR code path also needs uuid_create
1077if test $ac_cv_header_sys_uuid_h = yes ; then
1078	save_LIBS="$LIBS"
1079	AC_SEARCH_LIBS([uuid_to_str], [uuid], [have_uuid=yes], :)
1080	AC_SEARCH_LIBS([uuid_create], [uuid], :, [have_uuid=no])
1081	LIBS="$save_LIBS"
1082
1083	if test $have_uuid = yes ; then
1084		AC_DEFINE(HAVE_UUID_TO_STR,1,
1085			[define if you have uuid_to_str()])
1086
1087		test "$ac_cv_search_uuid_to_str" = "none required" || \
1088			LUTIL_LIBS="$LUTIL_LIBS $ac_cv_search_uuid_to_str"
1089	fi
1090fi
1091
1092dnl Look for uuid_generate
1093dnl The HAVE_UUID_GENERATE code path also needs uuid_unparse_lower
1094if test $have_uuid = no ; then
1095	AC_CHECK_HEADERS(uuid/uuid.h)
1096	if test $ac_cv_header_uuid_uuid_h = yes ; then
1097		save_LIBS="$LIBS"
1098		AC_SEARCH_LIBS([uuid_generate], [uuid], [have_uuid=yes], :)
1099		AC_SEARCH_LIBS([uuid_unparse_lower], [uuid], :, [have_uuid=no])
1100		LIBS="$save_LIBS"
1101
1102		if test $have_uuid = yes ; then
1103			AC_DEFINE(HAVE_UUID_GENERATE,1,
1104				[define if you have uuid_generate()])
1105
1106			test "$ac_cv_search_uuid_generate" = "none required" || \
1107				LUTIL_LIBS="$LUTIL_LIBS $ac_cv_search_uuid_generate"
1108		fi
1109	fi
1110fi
1111
1112dnl For windows, check for the need of RPCRT for UUID function support
1113if test $have_uuid = no ; then
1114	AC_MSG_CHECKING(to see if -lrpcrt4 is needed for win32 UUID support)
1115	save_LIBS="$LIBS"
1116	LIBS="$LIBS -lrpcrt4"
1117	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1118		int __stdcall UuidCreate(void *);
1119		int __stdcall UuidToStringA(void *,void **);
1120		]], [[
1121		UuidCreate(0);
1122		UuidToStringA(0,0);
1123		]])],[need_rpcrt=yes],[need_rpcrt=no])
1124	if test $need_rpcrt = yes; then
1125		SLAPD_LIBS="$SLAPD_LIBS -lrpcrt4"
1126		CLIENT_LIBS="$CLIENT_LIBS -lrpcrt4"
1127	fi
1128	LIBS="$save_LIBS"
1129	AC_MSG_RESULT($need_rpcrt)
1130fi
1131
1132dnl ----------------------------------------------------------------
1133dnl Check for resolver routines
1134OL_RESOLVER_LINK
1135
1136ol_link_dnssrv=no
1137if test "$ol_cv_lib_resolver" != no ; then
1138	AC_DEFINE(HAVE_RES_QUERY,1,
1139		[define if you have res_query()])
1140
1141	if test "$ol_enable_dnssrv" != no ; then
1142		ol_link_dnssrv=yes
1143	fi
1144
1145	if test "$ol_cv_lib_resolver" != yes ; then
1146		LIBS="$ol_cv_lib_resolver $LIBS"
1147	fi
1148fi
1149
1150if test "$ol_enable_dnssrv" = yes || test "$ol_enable_dnssrv" = mod ; then
1151	if test "$ol_link_dnssrv" = no ; then
1152		AC_MSG_ERROR([DNSSRV requires res_query()])
1153	fi
1154else
1155	ol_enable_dnssrv=no
1156fi
1157
1158AC_CHECK_FUNCS( hstrerror )
1159
1160dnl ----------------------------------------------------------------
1161dnl PF_INET6 support requires getaddrinfo and INET6_ADDRSTRLEN
1162dnl PF_LOCAL may use getaddrinfo in available
1163AC_CHECK_FUNCS( getaddrinfo getnameinfo gai_strerror inet_ntop )
1164
1165ol_link_ipv6=no
1166if test $ac_cv_func_getaddrinfo = no || test $ac_cv_func_inet_ntop = no ; then
1167	if test $ol_enable_ipv6 = yes ; then
1168		AC_MSG_ERROR([IPv6 support requires getaddrinfo() and inet_ntop()])
1169	fi
1170elif test $ol_enable_ipv6 != no ; then
1171	AC_CACHE_CHECK([INET6_ADDRSTRLEN],[ol_cv_inet6_addrstrlen],[
1172		AC_EGREP_CPP(__has_inet6_addrstrlen__,[
1173#			include <netinet/in.h>
1174#			ifdef INET6_ADDRSTRLEN
1175				__has_inet6_addrstrlen__;
1176#			endif
1177		], [ol_cv_inet6_addrstrlen=yes], [ol_cv_inet6_addrstrlen=no])])
1178
1179
1180	AC_CACHE_CHECK([struct sockaddr_storage],ol_cv_struct_sockaddr_storage,[
1181		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1182#include <sys/types.h>
1183#include <sys/socket.h>
1184]], [[
1185			struct sockaddr_storage ss;
1186]])],[ol_cv_struct_sockaddr_storage=yes],[ol_cv_struct_sockaddr_storage=no])])
1187
1188	if test $ol_cv_inet6_addrstrlen = yes &&
1189	   test $ol_cv_struct_sockaddr_storage = yes ; then
1190		ol_link_ipv6=yes
1191	elif test $ol_enable_ipv6 = yes &&
1192	     test $ol_cv_inet6_addrstrlen = no ; then
1193		AC_MSG_ERROR([IPv6 support requires INET6_ADDRSTRLEN])
1194	elif test $ol_enable_ipv6 = yes &&
1195	     test $ol_cv_struct_sockaddr_storage = no ; then
1196		AC_MSG_ERROR([IPv6 support requires struct sockaddr_storage])
1197	fi
1198fi
1199
1200if test $ol_enable_local != no ; then
1201	AC_CHECK_HEADERS( sys/un.h )
1202
1203	if test $ol_enable_local = auto ; then
1204		ol_enable_local=$ac_cv_header_sys_un_h
1205	elif test $ac_cv_header_sys_un_h = no ; then
1206		AC_MSG_ERROR([AF_LOCAL domain support requires sys/un.h])
1207	fi
1208fi
1209
1210dnl ----------------------------------------------------------------
1211dnl TLS/SSL
1212	
1213if test $ol_with_tls = yes ; then
1214	ol_with_tls=auto
1215fi
1216
1217ol_link_tls=no
1218if test $ol_with_tls = openssl || test $ol_with_tls = auto ; then
1219	AC_CHECK_HEADERS(openssl/ssl.h)
1220
1221	if test $ac_cv_header_openssl_ssl_h = yes ; then
1222			AC_PREPROC_IFELSE([AC_LANG_SOURCE(
1223				[[#include <openssl/opensslv.h>]
1224[#if OPENSSL_VERSION_NUMBER < 0x1010100fL]
1225[#error "OpenSSL is too old"]
1226[#endif]])],
1227					, [AC_MSG_FAILURE([OpenSSL 1.1.1 or newer required])])
1228
1229		AC_CHECK_LIB(ssl, SSL_export_keying_material_early,
1230			[have_openssl=yes], [have_openssl=no],
1231			[-lcrypto])
1232
1233		if test $have_openssl = yes ; then
1234			ol_with_tls=openssl
1235			ol_link_tls=yes
1236			WITH_TLS_TYPE=openssl
1237
1238			AC_DEFINE(HAVE_OPENSSL, 1, 
1239				[define if you have OpenSSL])
1240
1241			TLS_LIBS="-lssl -lcrypto"
1242		fi
1243	fi
1244fi
1245
1246if test $ol_link_tls = no ; then
1247	if test $ol_with_tls = gnutls || test $ol_with_tls = auto ; then
1248		AC_CHECK_HEADERS(gnutls/gnutls.h)
1249
1250		if test $ac_cv_header_gnutls_gnutls_h = yes ; then
1251			AC_PREPROC_IFELSE([AC_LANG_SOURCE(
1252				[[#include <gnutls/gnutls.h>]
1253[#if GNUTLS_VERSION_NUMBER < 0x030306]
1254[#error "GnuTLS is too old"]
1255[#endif]])],
1256					, [AC_MSG_FAILURE([GnuTLS 3.3.6 or newer required])])
1257
1258			AC_CHECK_LIB(gnutls, gnutls_init,
1259				[have_gnutls=yes], [have_gnutls=no])
1260
1261			if test $have_gnutls = yes ; then
1262				ol_with_tls=gnutls
1263				ol_link_tls=yes
1264				WITH_TLS_TYPE=gnutls
1265
1266				TLS_LIBS="-lgnutls"
1267
1268				AC_DEFINE(HAVE_GNUTLS, 1, 
1269					[define if you have GNUtls])
1270			fi
1271		fi
1272	fi
1273fi
1274
1275WITH_TLS=no
1276if test $ol_link_tls = yes ; then
1277	AC_DEFINE(HAVE_TLS, 1, [define if you have TLS])
1278	WITH_TLS=yes
1279elif test $ol_with_tls = auto ; then
1280	AC_MSG_WARN([Could not locate TLS/SSL package])
1281	AC_MSG_WARN([TLS data protection not supported!])
1282elif test $ol_with_tls != no ; then
1283	AC_MSG_ERROR([Could not locate TLS/SSL package])
1284else
1285	AC_MSG_WARN([TLS data protection not supported!])
1286fi
1287
1288
1289dnl ----------------------------------------------------------------
1290dnl Threads?
1291ol_link_threads=no
1292
1293case $ol_with_threads in auto | yes | nt)
1294
1295	OL_NT_THREADS
1296
1297	if test "$ol_cv_nt_threads" = yes ; then
1298		ol_link_threads=nt
1299		ol_with_threads=found
1300		ol_with_yielding_select=yes
1301
1302		AC_DEFINE(HAVE_NT_SERVICE_MANAGER,1,[if you have NT Service Manager])
1303		AC_DEFINE(HAVE_NT_EVENT_LOG,1,[if you have NT Event Log])
1304	fi
1305
1306	if test $ol_with_threads = nt ; then
1307		AC_MSG_ERROR([could not locate NT Threads])
1308	fi
1309	;;
1310esac
1311
1312case $ol_with_threads in auto | yes | posix)
1313
1314	AC_CHECK_HEADERS(pthread.h)
1315
1316	if test $ac_cv_header_pthread_h = yes ; then
1317		OL_POSIX_THREAD_VERSION
1318
1319		if test $ol_cv_pthread_version != 0 ; then
1320			AC_DEFINE_UNQUOTED(HAVE_PTHREADS,$ol_cv_pthread_version,
1321				[define to pthreads API spec revision])
1322		else
1323			AC_MSG_ERROR([unknown pthread version])
1324		fi
1325
1326		# consider threads found
1327		ol_with_threads=found
1328
1329		OL_HEADER_LINUX_THREADS
1330		OL_HEADER_GNU_PTH_PTHREAD_H
1331
1332		if test $ol_cv_header_gnu_pth_pthread_h = no ; then
1333			AC_CHECK_HEADERS(sched.h)
1334		fi
1335
1336		dnl Now the hard part, how to link?
1337		dnl
1338		dnl currently supported checks:
1339		dnl
1340		dnl Check for no flags 
1341		dnl 	pthread_create() in $LIBS
1342		dnl
1343		dnl Check special pthread (final) flags
1344		dnl 	[skipped] pthread_create() with -mt (Solaris) [disabled]
1345		dnl 	pthread_create() with -kthread (FreeBSD)
1346		dnl 	pthread_create() with -pthread (FreeBSD/Digital Unix)
1347		dnl 	pthread_create() with -pthreads (?)
1348		dnl 	pthread_create() with -mthreads (AIX)
1349		dnl 	pthread_create() with -thread (?)
1350		dnl
1351		dnl Check pthread (final) libraries
1352		dnl 	pthread_mutex_unlock() in -lpthread -lmach -lexc -lc_r (OSF/1)
1353		dnl 	pthread_mutex_lock() in -lpthread -lmach -lexc (OSF/1)
1354		dnl 	[skipped] pthread_mutex_trylock() in -lpthread -lexc (OSF/1)
1355		dnl 	pthread_join() -Wl,-woff,85 -lpthread (IRIX)
1356		dnl 	pthread_create() in -lpthread (many)
1357		dnl 	pthread_create() in -lc_r (FreeBSD)
1358		dnl
1359		dnl Check pthread (draft4) flags (depreciated)
1360		dnl 	pthread_create() with -threads (OSF/1)
1361		dnl
1362		dnl Check pthread (draft4) libraries (depreciated)
1363		dnl 	pthread_mutex_unlock() in -lpthreads -lmach -lexc -lc_r (OSF/1)
1364		dnl 	pthread_mutex_lock() in -lpthreads -lmach -lexc (OSF/1)
1365		dnl 	pthread_mutex_trylock() in -lpthreads -lexc (OSF/1)
1366		dnl 	pthread_create() in -lpthreads (many)
1367		dnl
1368
1369		dnl pthread_create in $LIBS
1370		AC_CACHE_CHECK([for pthread_create in default libraries],
1371			ol_cv_pthread_create,[
1372			AC_RUN_IFELSE([OL_PTHREAD_TEST_PROGRAM],
1373				[ol_cv_pthread_create=yes],
1374				[ol_cv_pthread_create=no],
1375				[AC_TRY_LINK(OL_PTHREAD_TEST_INCLUDES,OL_PTHREAD_TEST_FUNCTION,
1376					[ol_cv_pthread_create=yes],
1377					[ol_cv_pthread_create=no])])])
1378
1379		if test $ol_cv_pthread_create != no ; then
1380			ol_link_threads=posix
1381			ol_link_pthreads=""
1382		fi
1383		
1384dnl		OL_PTHREAD_TRY([-mt],		[ol_cv_pthread_mt])
1385		OL_PTHREAD_TRY([-kthread],	[ol_cv_pthread_kthread])
1386		OL_PTHREAD_TRY([-pthread],	[ol_cv_pthread_pthread])
1387		OL_PTHREAD_TRY([-pthreads],	[ol_cv_pthread_pthreads])
1388		OL_PTHREAD_TRY([-mthreads],	[ol_cv_pthread_mthreads])
1389		OL_PTHREAD_TRY([-thread],	[ol_cv_pthread_thread])
1390
1391		OL_PTHREAD_TRY([-lpthread -lmach -lexc -lc_r],
1392			[ol_cv_pthread_lpthread_lmach_lexc_lc_r])
1393		OL_PTHREAD_TRY([-lpthread -lmach -lexc],
1394			[ol_cv_pthread_lpthread_lmach_lexc])
1395dnl		OL_PTHREAD_TRY([-lpthread -lexc],
1396dnl			[ol_cv_pthread_lpthread_lexc])
1397
1398		OL_PTHREAD_TRY([-lpthread -Wl,-woff,85],
1399			[ol_cv_pthread_lib_lpthread_woff])
1400
1401		OL_PTHREAD_TRY([-lpthread],	[ol_cv_pthread_lpthread])
1402		OL_PTHREAD_TRY([-lc_r],		[ol_cv_pthread_lc_r])
1403
1404		OL_PTHREAD_TRY([-threads],	[ol_cv_pthread_threads])
1405
1406		OL_PTHREAD_TRY([-lpthreads -lmach -lexc -lc_r],
1407			[ol_cv_pthread_lpthreads_lmach_lexc_lc_r])
1408		OL_PTHREAD_TRY([-lpthreads -lmach -lexc],
1409			[ol_cv_pthread_lpthreads_lmach_lexc])
1410		OL_PTHREAD_TRY([-lpthreads -lexc],
1411			[ol_cv_pthread_lpthreads_lexc])
1412
1413		OL_PTHREAD_TRY([-lpthreads],[ol_cv_pthread_lib_lpthreads])
1414
1415		if test $ol_link_threads != no ; then
1416			LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads"
1417
1418			dnl save flags
1419			save_CPPFLAGS="$CPPFLAGS"
1420			save_LIBS="$LIBS"
1421			LIBS="$LTHREAD_LIBS $LIBS"
1422
1423			dnl All POSIX Thread (final) implementations should have
1424			dnl sched_yield instead of pthread yield.
1425			dnl check for both, and thr_yield for Solaris
1426			AC_CHECK_FUNCS(sched_yield pthread_yield thr_yield)
1427
1428			if test $ac_cv_func_sched_yield = no &&
1429			   test $ac_cv_func_pthread_yield = no &&
1430			   test $ac_cv_func_thr_yield = no ; then
1431				dnl Digital UNIX has sched_yield() in -lrt
1432				AC_CHECK_LIB(rt, sched_yield,
1433					[LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
1434					AC_DEFINE(HAVE_SCHED_YIELD,1,
1435						[Define if you have the sched_yield function.])
1436					ac_cv_func_sched_yield=yes],
1437					[ac_cv_func_sched_yield=no])
1438			fi
1439			if test $ac_cv_func_sched_yield = no &&
1440			   test $ac_cv_func_pthread_yield = no &&
1441			   test "$ac_cv_func_thr_yield" = no ; then
1442				AC_MSG_WARN([could not locate sched_yield() or pthread_yield()])
1443			fi
1444
1445			dnl Check functions for compatibility
1446			AC_CHECK_FUNCS(pthread_kill)
1447
1448			dnl Check for pthread_rwlock_destroy with <pthread.h>
1449			dnl as pthread_rwlock_t may not be defined.
1450			AC_CACHE_CHECK([for pthread_rwlock_destroy with <pthread.h>],
1451				[ol_cv_func_pthread_rwlock_destroy], [
1452				dnl save the flags
1453				AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1454#include <pthread.h>
1455pthread_rwlock_t rwlock;
1456]], [[pthread_rwlock_destroy(&rwlock);]])],[ol_cv_func_pthread_rwlock_destroy=yes],[ol_cv_func_pthread_rwlock_destroy=no])
1457			])
1458			if test $ol_cv_func_pthread_rwlock_destroy = yes ; then
1459				AC_DEFINE(HAVE_PTHREAD_RWLOCK_DESTROY,1,
1460					[define if you have pthread_rwlock_destroy function])
1461			fi
1462
1463			dnl Check for pthread_detach with <pthread.h> inclusion
1464			dnl as it's symbol may have been mangled.
1465			AC_CACHE_CHECK([for pthread_detach with <pthread.h>],
1466				[ol_cv_func_pthread_detach], [
1467				dnl save the flags
1468				AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1469#include <pthread.h>
1470#ifndef NULL
1471#define NULL (void*)0
1472#endif
1473]], [[pthread_detach(NULL);]])],[ol_cv_func_pthread_detach=yes],[ol_cv_func_pthread_detach=no])
1474			])
1475
1476			if test $ol_cv_func_pthread_detach = no ; then
1477				AC_MSG_ERROR([could not locate pthread_detach()])
1478			fi
1479
1480			AC_DEFINE(HAVE_PTHREAD_DETACH,1,
1481				[define if you have pthread_detach function])
1482
1483			dnl Check for setconcurrency functions
1484			AC_CHECK_FUNCS(	\
1485				pthread_setconcurrency \
1486				pthread_getconcurrency \
1487				thr_setconcurrency \
1488				thr_getconcurrency \
1489			)
1490
1491			OL_SYS_LINUX_THREADS
1492			OL_LINUX_THREADS
1493
1494			if test $ol_cv_linux_threads = error; then
1495				AC_MSG_ERROR([LinuxThreads header/library mismatch]);
1496			fi
1497
1498			AC_CACHE_CHECK([AC_LANG_SOURCE([if pthread_create() works])],
1499				ol_cv_pthread_create_works,[
1500			AC_RUN_IFELSE([OL_PTHREAD_TEST_PROGRAM],
1501				[ol_cv_pthread_create_works=yes],
1502				[ol_cv_pthread_create_works=no],
1503				[dnl assume yes
1504				ol_cv_pthread_create_works=yes])])
1505
1506			if test $ol_cv_pthread_create_works = no ; then
1507				AC_MSG_ERROR([pthread_create is not usable, check environment settings])
1508			fi
1509
1510			ol_replace_broken_yield=no
1511dnl			case "$target" in
1512dnl			*-*-linux*) 
1513dnl				AC_CHECK_FUNCS(nanosleep)
1514dnl				ol_replace_broken_yield=yes
1515dnl			;;
1516dnl			esac
1517
1518			if test $ol_replace_broken_yield = yes ; then
1519				AC_DEFINE([REPLACE_BROKEN_YIELD],1,
1520					[define if sched_yield yields the entire process])
1521			fi
1522
1523			dnl Check if select causes an yield
1524			if test $ol_with_yielding_select = auto ; then
1525				AC_CACHE_CHECK([if select yields when using pthreads],
1526					ol_cv_pthread_select_yields,[
1527				AC_RUN_IFELSE([AC_LANG_SOURCE([[
1528#include <sys/types.h>
1529#include <sys/time.h>
1530#include <unistd.h>
1531#include <pthread.h>
1532#ifndef NULL
1533#define NULL (void*) 0
1534#endif
1535
1536static int fildes[2];
1537
1538static void *task(p)
1539	void *p;
1540{
1541	int i;
1542	struct timeval tv;
1543
1544	fd_set rfds;
1545
1546	tv.tv_sec=10;
1547	tv.tv_usec=0;
1548
1549	FD_ZERO(&rfds);
1550	FD_SET(fildes[0], &rfds);
1551
1552	/* we're not interested in any fds */
1553	i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
1554
1555	if(i < 0) {
1556		perror("select");
1557		exit(10);
1558	}
1559
1560	exit(0); /* if we exit here, the select blocked the whole process */
1561}
1562
1563int main(argc, argv)
1564	int argc;
1565	char **argv;
1566{
1567	pthread_t t;
1568
1569	/* create a pipe to select */
1570	if(pipe(&fildes[0])) {
1571		perror("select");
1572		exit(1);
1573	}
1574
1575#ifdef HAVE_PTHREAD_SETCONCURRENCY
1576	(void) pthread_setconcurrency(2);
1577#else
1578#ifdef HAVE_THR_SETCONCURRENCY
1579	/* Set Solaris LWP concurrency to 2 */
1580	thr_setconcurrency(2);
1581#endif
1582#endif
1583
1584#if HAVE_PTHREADS < 6
1585	pthread_create(&t, pthread_attr_default, task, NULL);
1586#else
1587	pthread_create(&t, NULL, task, NULL);
1588#endif
1589
1590	/* make sure task runs first */
1591#ifdef HAVE_THR_YIELD
1592	thr_yield();
1593#elif defined( HAVE_SCHED_YIELD )
1594	sched_yield();
1595#elif defined( HAVE_PTHREAD_YIELD )
1596	pthread_yield();
1597#endif
1598
1599	exit(2);
1600}]])],[ol_cv_pthread_select_yields=no],[ol_cv_pthread_select_yields=yes],[ol_cv_pthread_select_yields=cross])])
1601
1602				if test $ol_cv_pthread_select_yields = cross ; then
1603					AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])
1604				fi
1605
1606				if test $ol_cv_pthread_select_yields = yes ; then
1607					ol_with_yielding_select=yes
1608				fi
1609			fi
1610
1611			dnl restore flags
1612			CPPFLAGS="$save_CPPFLAGS"
1613			LIBS="$save_LIBS"
1614		else
1615			AC_MSG_ERROR([could not locate usable POSIX Threads])
1616		fi
1617	fi
1618
1619	if test $ol_with_threads = posix ; then
1620		AC_MSG_ERROR([could not locate POSIX Threads])
1621	fi
1622	;;
1623esac
1624
1625case $ol_with_threads in auto | yes | pth)
1626
1627	AC_CHECK_HEADERS(pth.h)
1628
1629	if test $ac_cv_header_pth_h = yes ; then
1630		AC_CHECK_LIB(pth, pth_version, [have_pth=yes], [have_pth=no])
1631
1632		if test $have_pth = yes ; then
1633			AC_DEFINE(HAVE_GNU_PTH,1,[if you have GNU Pth])
1634			LTHREAD_LIBS="$LTHREAD_LIBS -lpth"
1635			ol_link_threads=pth
1636			ol_with_threads=found
1637
1638			if test $ol_with_yielding_select = auto ; then
1639				ol_with_yielding_select=yes
1640			fi
1641		fi
1642	fi
1643	;;
1644esac
1645
1646case $ol_with_threads in auto | yes | lwp)
1647
1648	dnl check for SunOS5 LWP
1649	AC_CHECK_HEADERS(thread.h synch.h)
1650	if test $ac_cv_header_thread_h = yes &&
1651	   test $ac_cv_header_synch_h = yes ; then
1652		AC_CHECK_LIB(thread, thr_create, [have_thr=yes], [have_thr=no])
1653
1654		if test $have_thr = yes ; then
1655			AC_DEFINE(HAVE_THR,1,
1656				[if you have Solaris LWP (thr) package])
1657			LTHREAD_LIBS="$LTHREAD_LIBS -lthread"
1658			ol_link_threads=thr
1659
1660			if test $ol_with_yielding_select = auto ; then
1661				ol_with_yielding_select=yes
1662			fi
1663
1664			dnl Check for setconcurrency functions
1665			AC_CHECK_FUNCS(	\
1666				thr_setconcurrency \
1667				thr_getconcurrency \
1668			)
1669		fi
1670	fi
1671	;;
1672esac
1673
1674if test $ol_with_yielding_select = yes ; then
1675	AC_DEFINE(HAVE_YIELDING_SELECT,1,
1676		[define if select implicitly yields])
1677fi
1678
1679if test $ol_with_threads = manual ; then
1680	dnl User thinks he can manually configure threads.
1681	ol_link_threads=yes
1682
1683	AC_MSG_WARN([thread defines and link options must be set manually])
1684
1685	AC_CHECK_HEADERS(pthread.h sched.h)
1686	AC_CHECK_FUNCS(sched_yield pthread_yield)
1687	OL_HEADER_LINUX_THREADS
1688
1689	AC_CHECK_HEADERS(thread.h synch.h)
1690fi
1691
1692if test $ol_link_threads != no && test $ol_link_threads != nt ; then
1693	dnl needed to get reentrant/threadsafe versions
1694	dnl
1695	AC_DEFINE(REENTRANT,1)
1696	AC_DEFINE(_REENTRANT,1)
1697	AC_DEFINE(THREAD_SAFE,1)
1698	AC_DEFINE(_THREAD_SAFE,1)
1699	AC_DEFINE(THREADSAFE,1)
1700	AC_DEFINE(_THREADSAFE,1)
1701	AC_DEFINE(_SGI_MP_SOURCE,1)
1702
1703	dnl The errno declaration may dependent upon _REENTRANT.
1704	dnl If it does, we must link with thread support.
1705	AC_CACHE_CHECK([for thread specific errno],
1706		[ol_cv_errno_thread_specific], [
1707		AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]], [[errno = 0;]])],[ol_cv_errno_thread_specific=yes],[ol_cv_errno_thread_specific=no])
1708	])
1709
1710	dnl The h_errno declaration may dependent upon _REENTRANT.
1711	dnl If it does, we must link with thread support.
1712	AC_CACHE_CHECK([for thread specific h_errno],
1713		[ol_cv_h_errno_thread_specific], [
1714		AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[h_errno = 0;]])],[ol_cv_h_errno_thread_specific=yes],[ol_cv_h_errno_thread_specific=no])
1715	])
1716
1717	if test $ol_cv_errno_thread_specific != yes ||
1718	   test $ol_cv_h_errno_thread_specific != yes ; then
1719		LIBS="$LTHREAD_LIBS $LIBS"
1720		LTHREAD_LIBS=""
1721	fi
1722
1723dnl When in thread environment, use 
1724dnl		#if defined( HAVE_REENTRANT_FUNCTIONS ) || defined( HAVE_FUNC_R )
1725dnl			func_r(...);
1726dnl		#else
1727dnl			/* lock */
1728dnl			func(...);
1729dnl			/* unlock */
1730dnl		#endif
1731dnl
1732dnl HAVE_REENTRANT_FUNCTIONS is derived from:
1733dnl		_POSIX_REENTRANT_FUNCTIONS
1734dnl		_POSIX_THREAD_SAFE_FUNCTIONS
1735dnl		_POSIX_THREADSAFE_FUNCTIONS
1736dnl
1737dnl		and is currently defined in <ldap_pvt_thread.h>
1738dnl
1739dnl libldap/*.c should only include <ldap_pvt_thread.h> iff
1740dnl LDAP_R_COMPILE is defined.  ie:
1741dnl		#ifdef LDAP_R_COMPILE
1742dnl		#	include <ldap_pvt_thread.h>
1743dnl		#endif
1744dnl
1745dnl LDAP_R_COMPILE is defined by libldap/ldap-int.h
1746dnl specifically for compiling the threadsafe version of
1747dnl the ldap library.
1748dnl		
1749dnl	dnl check for reentrant/threadsafe functions
1750dnl	dnl
1751dnl	dnl note: these should only be used when linking
1752dnl	dnl		with $LTHREAD_LIBS
1753dnl	dnl
1754dnl	save_CPPFLAGS="$CPPFLAGS"
1755dnl	save_LIBS="$LIBS"
1756dnl	LIBS="$LTHREAD_LIBS $LIBS"
1757dnl	AC_CHECK_FUNCS(	\
1758dnl		gmtime_r \
1759dnl		gethostbyaddr_r gethostbyname_r \
1760dnl		feof_unlocked unlocked_feof \
1761dnl		putc_unlocked unlocked_putc \
1762dnl		flockfile ftrylockfile \
1763dnl	)
1764dnl	CPPFLAGS="$save_CPPFLAGS"
1765dnl	LIBS="$save_LIBS"
1766fi  
1767
1768if test $ol_link_threads = no ; then
1769	if test $ol_enable_slapd != no; then
1770		AC_MSG_ERROR([slapd requires thread support])
1771	fi
1772
1773	if test $ol_with_threads = yes ; then
1774		AC_MSG_ERROR([no suitable thread support])
1775	fi
1776
1777	if test $ol_with_threads = auto ; then
1778		AC_MSG_WARN([no suitable thread support, disabling threads])
1779		ol_with_threads=no
1780	fi
1781
1782	AC_DEFINE(NO_THREADS,1,
1783		[define if you have (or want) no threads])
1784	LTHREAD_LIBS=""
1785	BUILD_THREAD=no
1786else
1787	BUILD_THREAD=yes
1788fi
1789
1790if test $ol_link_threads != no ; then
1791	AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE,1,
1792		[define to 1 if library is thread safe])
1793
1794	dnl This could be enabled without threads if all of the
1795	dnl reentrant functions are available. Needs testing.
1796	AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT,1,
1797		[define to 1 if library is reentrant])
1798fi
1799
1800dnl ----------------------------------------------------------------
1801dnl Tests for reentrant functions necessary for reentrant build
1802AC_CHECK_FUNCS(		\
1803	ctime_r			\
1804	gmtime_r localtime_r \
1805	gethostbyname_r	gethostbyaddr_r \
1806)
1807
1808if test "$ac_cv_func_ctime_r" = no ; then
1809	ol_cv_func_ctime_r_nargs=0
1810else
1811	OL_FUNC_CTIME_R_NARGS
1812dnl	OL_FUNC_CTIME_R_TYPE
1813fi
1814
1815if test "$ac_cv_func_gethostbyname_r" = yes ; then
1816 	OL_FUNC_GETHOSTBYNAME_R_NARGS
1817else
1818 	ol_cv_func_gethostbyname_r_nargs=0
1819fi
1820 
1821if test "$ac_cv_func_gethostbyaddr_r" = yes ; then
1822 	OL_FUNC_GETHOSTBYADDR_R_NARGS
1823else
1824 	ol_cv_func_gethostbyaddr_r_nargs=0
1825fi
1826
1827dnl ----------------------------------------------------------------
1828
1829if test $ol_enable_dynamic = yes && test $enable_shared = yes ; then
1830	BUILD_LIBS_DYNAMIC=shared
1831	AC_DEFINE(LDAP_LIBS_DYNAMIC, 1, [define if LDAP libs are dynamic])
1832	LTSTATIC=""
1833else
1834	BUILD_LIBS_DYNAMIC=static
1835	LTSTATIC="-static"
1836fi
1837AC_SUBST(LTSTATIC)dnl
1838
1839dnl ----------------------------------------------------------------
1840if test $ol_enable_wrappers != no ; then
1841	AC_CHECK_HEADERS(tcpd.h,[
1842		AC_MSG_CHECKING([for TCP wrappers library])
1843		save_LIBS="$LIBS"
1844		LIBS="$LIBS -lwrap"
1845		AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1846#include <tcpd.h>
1847int allow_severity = 0;
1848int deny_severity  = 0;
1849
1850struct request_info *req;
1851		]], [[
1852hosts_access(req)
1853		]])],[AC_MSG_RESULT([-lwrap])
1854		have_wrappers=yes
1855		LIBS="$save_LIBS"],[
1856		dnl try with -lnsl
1857		LIBS="$LIBS -lnsl"
1858		AC_TRY_LINK([
1859#include <tcpd.h>
1860int allow_severity = 0;
1861int deny_severity  = 0;
1862
1863struct request_info *req;
1864		],[
1865hosts_access(req)
1866		],[AC_MSG_RESULT([-lwrap -lnsl])
1867		have_wrappers=yes
1868		LIBS="$save_LIBS -lnsl"],[
1869		AC_MSG_RESULT(no)
1870		have_wrappers=no
1871		LIBS=$save_LIBS])])],[have_wrappers=no])
1872
1873	if test $have_wrappers = yes ; then
1874		AC_DEFINE(HAVE_TCPD,1, [define if you have -lwrap])
1875		WRAP_LIBS="-lwrap"
1876	elif test $ol_enable_wrappers = yes ; then
1877		AC_MSG_ERROR([could not find TCP wrappers, select appropriate options or disable])
1878	else
1879		AC_MSG_WARN([could not find TCP wrappers, support disabled])
1880		WRAP_LIBS=""
1881	fi
1882fi
1883
1884dnl ----------------------------------------------------------------
1885if test $ol_enable_syslog != no ; then
1886	AC_CHECK_FUNC(openlog)
1887	if test $ac_cv_func_openlog = no && test $ol_enable_syslog = yes; then
1888		AC_MSG_ERROR(could not find syslog, select appropriate options or disable)
1889	fi
1890	ol_enable_syslog=$ac_cv_func_openlog
1891fi
1892
1893dnl ----------------------------------------------------------------
1894dnl SQL
1895ol_link_sql=no
1896if test $ol_enable_sql != no ; then
1897	AC_CHECK_HEADERS(sql.h sqlext.h,[],[
1898		AC_MSG_ERROR([could not locate SQL headers])
1899	])
1900
1901	sql_LIBS="$LIBS"
1902	LIBS="$LTHREAD_LIBS $LIBS"
1903
1904	if test $ol_with_odbc = auto ; then
1905		ol_with_odbc="iodbc unixodbc odbc32"
1906	fi
1907
1908	for odbc in $ol_with_odbc ; do
1909		if test $ol_link_sql = no ; then
1910			case $odbc in
1911			iodbc)
1912				AC_CHECK_LIB(iodbc, SQLDriverConnect, [have_iodbc=yes], [have_iodbc=no])
1913				if test $have_iodbc = yes ; then
1914					ol_link_sql="-liodbc"
1915				fi
1916				;;
1917
1918			unixodbc)
1919				AC_CHECK_LIB(odbc, SQLDriverConnect, [have_odbc=yes], [have_odbc=no])
1920				if test $have_odbc = yes ; then
1921					ol_link_sql="-lodbc"
1922				fi
1923				;;
1924
1925			odbc32)
1926				AC_CHECK_LIB(odbc32, SQLDriverConnect, [have_odbc32=yes], [have_odbc32=no])
1927				
1928				dnl The windows API uses __stdcall which cannot be detected by AC_CHECK_LIB
1929				if test $have_odbc32 = no ; then
1930					AC_MSG_CHECKING([for SQLDriverConnect in -lodbc32 with windows.h])
1931					save_LIBS="$LIBS"
1932					LIBS="$LIBS -lodbc32"
1933					AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>
1934					#include <sqlext.h>
1935						]], [[
1936						SQLDriverConnect(NULL,NULL,NULL,0,NULL,0,NULL,0);
1937						]])],[have_odbc32=yes], [have_odbc32=no])
1938					LIBS="$save_LIBS"
1939					AC_MSG_RESULT($have_odbc32)
1940				fi
1941				
1942				if test $have_odbc32 = yes ; then
1943					ol_link_sql="-lodbc32"
1944				fi
1945				;;
1946
1947			*)
1948				AC_MSG_ERROR([unknown ODBC library])
1949				;;
1950			esac
1951		fi
1952	done
1953
1954	LIBS="$sql_LIBS"
1955
1956	if test $ol_link_sql != no ; then
1957		SLAPD_SQL_LIBS="$ol_link_sql"
1958
1959	elif test $ol_enable_sql != auto ; then
1960		AC_MSG_ERROR([could not locate suitable ODBC library])
1961	fi
1962fi
1963
1964dnl ----------------------------------------------------------------
1965dnl MySQL NDBapi
1966dnl Note: uses C++, but we don't want to add C++ test overhead to
1967dnl the rest of the libtool machinery.
1968ol_link_ndb=no
1969if test $ol_enable_ndb != no ; then
1970	AC_CHECK_PROG(MYSQL,mysql_config,yes)
1971	if test "$MYSQL" != yes ; then
1972		AC_MSG_ERROR([could not locate mysql_config])
1973	fi
1974
1975	SQL_INC=`mysql_config --include`
1976	SLAPD_NDB_INCS="$SQL_INC $SQL_INC/storage/ndb $SQL_INC/storage/ndb/ndbapi"
1977
1978	save_CPPFLAGS="$CPPFLAGS"
1979	CPPFLAGS="$SLAPD_NDB_INCS"
1980	AC_MSG_CHECKING(for NdbApi.hpp)
1981	AC_PREPROC_IFELSE(
1982		[AC_LANG_SOURCE([[#include <NdbApi.hpp>]])],
1983			AC_MSG_RESULT(yes),
1984			AC_MSG_ERROR([could not locate NdbApi headers])
1985	)
1986	CPPFLAGS="$save_CPPFLAGS"
1987
1988	SQL_LIB=`mysql_config --libs_r`
1989	SLAPD_NDB_LIBS="$SQL_LIB -lndbclient -lstdc++"
1990
1991	save_LDFLAGS="$LDFLAGS"
1992	save_LIBS="$LIBS"
1993	LDFLAGS="$SQL_LIB"
1994	AC_CHECK_LIB(ndbclient,ndb_init,[: ok],[
1995		AC_MSG_ERROR([could not locate ndbclient library])
1996	],[-lstdc++])
1997	LIBS="$save_LIBS"
1998	LDFLAGS="$save_LDFLAGS"
1999
2000	if test "$ol_enable_ndb" = yes ; then
2001		SLAPD_LIBS="$SLAPD_LIBS \$(SLAPD_NDB_LIBS)"
2002	fi
2003fi
2004
2005dnl ----------------------------------------------------------------
2006dnl WiredTiger
2007ol_link_wt=no
2008if test $ol_enable_wt != no ; then
2009	PKG_CHECK_MODULES(WT, wiredtiger)
2010	if test $ol_enable_wt = yes ; then
2011		SLAPD_LIBS="$SLAPD_LIBS \$(WT_LIBS)"
2012	fi
2013	ol_link_wt=yes
2014fi
2015
2016dnl ----------------------------------------------------------------
2017dnl
2018dnl Check for Cyrus SASL
2019dnl
2020WITH_SASL=no
2021ol_link_sasl=no
2022ol_link_spasswd=no
2023if test $ol_with_cyrus_sasl != no ; then
2024	AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
2025
2026	if test $ac_cv_header_sasl_sasl_h = yes ||
2027	   test $ac_cv_header_sasl_h = yes; then
2028		AC_CHECK_LIB(sasl2, sasl_client_init,
2029			[ol_link_sasl="-lsasl2"],
2030			[AC_CHECK_LIB(sasl, sasl_client_init,
2031				[ol_link_sasl="-lsasl"])])
2032	fi
2033
2034	if test $ol_link_sasl = no ; then
2035		if test $ol_with_cyrus_sasl != auto ; then
2036			AC_MSG_ERROR([Could not locate Cyrus SASL])
2037		else
2038			AC_MSG_WARN([Could not locate Cyrus SASL])
2039			AC_MSG_WARN([SASL authentication not supported!])
2040			if test $ol_link_tls = no ; then
2041				AC_MSG_WARN([Strong authentication not supported!])
2042			fi
2043		fi
2044	else
2045		OL_SASL_COMPAT
2046		if test $ol_cv_sasl_compat = no ; then
2047			ol_link_sasl=no
2048			AC_MSG_ERROR([Cyrus SASL library located but is incompatible])
2049		fi
2050
2051		AC_DEFINE(HAVE_CYRUS_SASL,1,[define if you have Cyrus SASL])
2052		SASL_LIBS="$ol_link_sasl"
2053		if test $ol_enable_spasswd != no ; then
2054			ol_link_spasswd=yes
2055		fi
2056
2057		ac_save_LIBS="$LIBS"
2058		LIBS="$LIBS $ol_link_sasl"
2059		AC_CHECK_FUNC(sasl_version, [AC_DEFINE(HAVE_SASL_VERSION,1,
2060			[define if your SASL library has sasl_version()])])
2061		LIBS="$ac_save_LIBS"
2062
2063		WITH_SASL=yes
2064	fi
2065
2066else
2067	AC_MSG_WARN([SASL authentication not supported!])
2068	if test $ol_link_tls = no ; then
2069		AC_MSG_WARN([Strong authentication not supported!])
2070	fi
2071fi
2072
2073dnl ----------------------------------------------------------------
2074dnl
2075dnl Check for systemd (only if we have a server)
2076dnl
2077WITH_SYSTEMD=no
2078systemdsystemunitdir=
2079ol_link_systemd=no
2080if test $ol_enable_slapd == no && test $ol_enable_balancer != yes ; then
2081	if test $ol_with_systemd != no ; then
2082		AC_MSG_WARN([servers disabled, ignoring --with-systemd=$ol_with_systemd argument])
2083		ol_with_systemd=no
2084	fi
2085fi
2086if test $ol_with_systemd != no ; then
2087	AC_CHECK_HEADERS(systemd/sd-daemon.h)
2088
2089	if test $ac_cv_header_systemd_sd_daemon_h = yes; then
2090		AC_CHECK_LIB(systemd, sd_notify,
2091			[ol_link_systemd="-lsystemd"])
2092	fi
2093
2094	if test $ol_link_systemd = no ; then
2095		if test $ol_with_systemd != auto ; then
2096			AC_MSG_ERROR([Could not locate systemd])
2097		else
2098			AC_MSG_WARN([Could not locate systemd])
2099			AC_MSG_WARN([systemd service notification not supported!])
2100		fi
2101	else
2102		AC_DEFINE(HAVE_SYSTEMD,1,[define if you have systemd])
2103		SYSTEMD_LIBS="$ol_link_systemd"
2104		WITH_SYSTEMD=yes
2105
2106		PKG_CHECK_VAR(systemdsystemunitdir, systemd, systemdsystemunitdir)
2107		if test -z "$systemdsystemunitdir"; then
2108			if test -d /usr/lib/systemd/system; then
2109				systemdsystemunitdir=/usr/lib/systemd/system
2110			else
2111				systemdsystemunitdir=/lib/systemd/system
2112			fi
2113		fi
2114	fi
2115fi
2116AC_SUBST(systemdsystemunitdir)
2117
2118dnl ----------------------------------------------------------------
2119dnl Check for entropy sources
2120if test $cross_compiling != yes && test "$ac_cv_mingw32" != yes ; then
2121	dev=no
2122	if test -r /dev/urandom ; then
2123		dev="/dev/urandom";
2124	elif test -r /idev/urandom ; then
2125		dev="/idev/urandom";
2126	elif test -r /dev/srandom ; then
2127		dev="/dev/srandom";
2128	elif test -r /dev/random ; then
2129		dev="/dev/random";
2130	elif test -r /idev/random ; then
2131		dev="/idev/random";
2132	fi
2133
2134	if test $dev != no ; then
2135		AC_DEFINE_UNQUOTED(URANDOM_DEVICE,"$dev",[set to urandom device])
2136	fi
2137fi
2138
2139dnl ----------------------------------------------------------------
2140dnl
2141dnl Check for fetch URL support
2142dnl		should be extended to support other fetch URL APIs
2143dnl
2144ol_link_fetch=no
2145if test $ol_with_fetch != no ; then
2146	OL_LIB_FETCH
2147
2148	if test $ol_cv_lib_fetch != no ; then
2149		LIBS="$LIBS $ol_link_fetch"
2150		ol_link_fetch=freebsd
2151
2152	elif test $ol_with_fetch != auto ; then
2153		AC_MSG_ERROR(no suitable API for --with-fetch=$ol_with_fetch)
2154	fi 
2155fi
2156
2157dnl ----------------------------------------------------------------
2158dnl FreeBSD (and others) have crypt(3) in -lcrypt
2159if test $ol_enable_crypt != no ; then
2160	save_LIBS="$LIBS"
2161	LIBS="$TLS_LIBS $LIBS"
2162
2163	AC_CHECK_FUNC(crypt, [have_crypt=yes], [
2164		LIBS="$save_LIBS"
2165		AC_CHECK_LIB(crypt, crypt, [LUTIL_LIBS="$LUTIL_LIBS -lcrypt"
2166			have_crypt=yes], [have_crypt=no])])
2167
2168	LIBS="$TLS_LIBS $LIBS"
2169	AC_CHECK_LIB(crypt, crypt_r, [have_crypt_r=yes], [have_crypt_r=no])
2170
2171	LIBS="$save_LIBS"
2172
2173	if test $have_crypt = yes ; then
2174		AC_DEFINE(HAVE_CRYPT,1, [define if crypt(3) is available])
2175		if test $have_crypt_r = yes ; then
2176			AC_DEFINE(HAVE_CRYPT_R, 1, [define if crypt_r() is also available])
2177		fi
2178	else
2179		AC_MSG_WARN([could not find crypt])
2180		if test $ol_enable_crypt = yes ; then
2181			AC_MSG_ERROR([could not find crypt, select appropriate options or disable])
2182		fi
2183
2184		AC_MSG_WARN([disabling crypt support])
2185		ol_enable_crypt=no
2186	fi
2187fi
2188
2189dnl ----------------------------------------------------------------
2190if test $ol_enable_slp != no ; then
2191	AC_CHECK_HEADERS( slp.h )
2192
2193	if test $ac_cv_header_slp_h = yes ; then
2194		AC_CHECK_LIB(slp, SLPOpen, [have_slp=yes], [have_slp=no])
2195		if test $have_slp = yes ; then
2196			AC_DEFINE(HAVE_SLP, 1, [define if you have -lslp])
2197			SLAPD_SLP_LIBS=-lslp
2198		fi
2199
2200	elif test $ol_enable_slp = yes ; then
2201		AC_MSG_ERROR([SLP not found])
2202	fi
2203fi
2204
2205dnl ----------------------------------------------------------------
2206dnl Libevent
2207if test $ol_enable_balancer != no ; then
2208	AC_CHECK_LIB(event_extra, evdns_base_new,
2209		[have_libevent=yes
2210		LEVENT_LIBS="$LEVENT_LIBS -levent_core -levent_extra"],
2211		[AC_CHECK_LIB(event, evdns_base_new,
2212			[have_libevent=yes
2213			LEVENT_LIBS="$LEVENT_LIBS -levent"],
2214			[have_libevent=no])])
2215	AC_CHECK_LIB(event, libevent_global_shutdown, [], [have_libevent=no])
2216
2217	if test $have_libevent = yes ; then
2218		AC_DEFINE(HAVE_LIBEVENT, 1, [define if you have -levent])
2219	else
2220		AC_MSG_ERROR([You need libevent 2.1 or later with DNS support to build the load balancer])
2221	fi
2222fi
2223
2224dnl ----------------------------------------------------------------
2225dnl Checks for typedefs, structures, and compiler characteristics.
2226
2227AC_CHECK_TYPE(mode_t, int)
2228AC_CHECK_TYPE(off_t, long)
2229AC_CHECK_TYPE(pid_t, int)
2230AC_CHECK_TYPE(ssize_t, [signed int])
2231AC_CHECK_TYPE(caddr_t,	[char *])
2232AC_CHECK_TYPE(size_t, unsigned)
2233
2234AC_CHECK_TYPES([long long])
2235AC_CHECK_TYPES([ptrdiff_t])
2236
2237
2238AC_CHECK_TYPE([socklen_t],,, [$ac_includes_default
2239#ifdef HAVE_SYS_SOCKET_H
2240#include <sys/socket.h>
2241#endif
2242#ifdef HAVE_WINSOCK2
2243#include <ws2tcpip.h>
2244#endif])
2245
2246dnl socklen_t-like type in accept(), default socklen_t or int:
2247dnl - The OS might define socklen_t without using it.  POSIX moved from
2248dnl   int to size_t to socklen_t, hoping to stay at a 32-bit type, and
2249dnl   HP-UX now has selectors for what to use.
2250dnl - On Solaris 2.8 the prototype has void *len, but the default is OK.
2251AC_MSG_CHECKING([the type of arg 3 to accept()])
2252AC_CACHE_VAL(ol_cv_type_ber_socklen_t, [
2253	set socklen_t int unsigned "unsigned long" long size_t
2254	test "$ac_cv_type_socklen_t" = yes || shift
2255	ol_cv_type_ber_socklen_t=$1 guessing="guessing "
2256	for lentype in "$@" ; do for addrtype in "struct sockaddr" void ; do
2257		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_includes_default
2258#ifdef HAVE_SYS_SOCKET_H
2259#include <sys/socket.h>
2260#endif
2261extern int accept(int s, $addrtype *ap, $lentype *lp);
2262], [
2263accept(0, (struct sockaddr *) 0, ($lentype *) 0);
2264])], [ol_cv_type_ber_socklen_t=$lentype guessing= ; break 2])
2265	done ; done])
2266AC_MSG_RESULT([$guessing$ol_cv_type_ber_socklen_t *])
2267AC_DEFINE_UNQUOTED(ber_socklen_t, $ol_cv_type_ber_socklen_t,
2268	[Define to the type of arg 3 for `accept'.])
2269
2270dnl Modules should use ber_socklen_t, not socklen_t.  Define socklen_t
2271dnl for the time being anyway, for backwards compatibility.
2272if test "$ac_cv_type_socklen_t" != yes; then
2273	AC_DEFINE_UNQUOTED([socklen_t], [$ol_cv_type_ber_socklen_t],
2274		[Define like ber_socklen_t if <sys/socket.h> does not define.])
2275fi
2276
2277
2278AC_TYPE_SIGNAL
2279
2280AC_CHECK_TYPE([sig_atomic_t],,
2281	[AC_DEFINE_UNQUOTED([sig_atomic_t], [int],
2282		[Define to `int' if <signal.h> does not define.])],
2283	[$ac_includes_default
2284#include <signal.h>
2285	])
2286
2287AC_TYPE_UID_T
2288
2289AC_HEADER_TIME
2290AC_STRUCT_TM
2291AC_CHECK_MEMBERS([struct stat.st_blksize])
2292AC_CHECK_MEMBERS([struct passwd.pw_gecos],,,[$ac_includes_default
2293#include <pwd.h>])
2294AC_CHECK_MEMBERS([struct passwd.pw_passwd],,,[$ac_includes_default
2295#include <pwd.h>])
2296
2297OL_C_UPPER_LOWER
2298AC_C_CONST
2299OL_C_VOLATILE
2300
2301if test $cross_compiling = yes ; then
2302	AC_MSG_WARN([Crossing compiling... all bets are off!])
2303	AC_DEFINE(CROSS_COMPILING, 1, [define if cross compiling])
2304else
2305	AC_C_BIGENDIAN
2306fi
2307
2308AC_CHECK_SIZEOF(short) 
2309AC_CHECK_SIZEOF(int) 
2310AC_CHECK_SIZEOF(long)
2311AC_CHECK_SIZEOF(long long)
2312AC_CHECK_SIZEOF(wchar_t)
2313
2314if test "$ac_cv_sizeof_int" -lt 4 ; then
2315	AC_MSG_WARN([OpenLDAP requires 'int' to be 32 bits or greater.])
2316
2317	AC_DEFINE(LBER_INT_T,long,[define to 32-bit or greater integer type])
2318else
2319	AC_DEFINE(LBER_INT_T,int,[define to 32-bit or greater integer type])
2320fi
2321
2322AC_DEFINE(LBER_LEN_T,long,[define to large integer type])
2323AC_DEFINE(LBER_SOCKET_T,int,[define to socket descriptor type])
2324AC_DEFINE(LBER_TAG_T,long,[define to large integer type])
2325
2326dnl ----------------------------------------------------------------
2327dnl Check for multiple precision support
2328if test $ol_with_mp = longlong || test $ol_with_mp = auto ; then
2329	if test $ac_cv_sizeof_long_long -gt 4 ; then
2330		ol_with_mp=longlong
2331		AC_DEFINE(USE_MP_LONG_LONG,1,[define to use 'long long' for MP])
2332	elif test $ol_with_mp = longlong ; then
2333		AC_MSG_ERROR([long long unusable for multiple precision])
2334	fi
2335fi
2336if test $ol_with_mp = long || test $ol_with_mp = auto ; then
2337	if test $ac_cv_sizeof_long -gt 4 ; then
2338		ol_with_mp=long
2339		AC_DEFINE(USE_MP_LONG,1,[define to use 'long' for MP])
2340	elif test $ol_with_mp = long ; then
2341		AC_MSG_ERROR([long unusable for multiple precision])
2342	fi
2343fi
2344if test $ol_with_mp = bignum || test $ol_with_mp = auto ; then
2345	AC_CHECK_HEADERS(openssl/bn.h)
2346	AC_CHECK_HEADERS(openssl/crypto.h)
2347	if test "$ac_cv_header_openssl_bn_h" = "yes" &&
2348		test "$ac_cv_header_openssl_crypto_h" = "yes" &&
2349		test "$ol_with_tls" = "found" ; then
2350		ol_with_mp=bignum
2351		AC_DEFINE(USE_MP_BIGNUM,1,[define to use OpenSSL BIGNUM for MP])
2352	elif test $ol_with_mp = bignum ; then
2353		AC_MSG_ERROR([bignum not available])
2354	fi
2355fi
2356if test $ol_with_mp = gmp || test $ol_with_mp = auto ; then
2357	AC_CHECK_HEADERS(gmp.h)
2358	AC_CHECK_LIB(gmp, __gmpz_add_ui)
2359	if test $ac_cv_header_gmp_h = yes && test $ac_cv_lib_gmp___gmpz_add_ui = yes ; then
2360		AC_DEFINE(USE_MP_GMP,1,[define to use GMP for MP])
2361		ol_with_mp=gmp
2362	elif test $ol_with_mp = gmp ; then
2363		AC_MSG_ERROR([gmp not available])
2364	fi
2365fi
2366if test $ol_with_mp = auto ; then
2367	ol_with_mp=no
2368fi
2369
2370dnl ----------------------------------------------------------------
2371dnl Checks for library functions.
2372AC_FUNC_MEMCMP
2373
2374if test $ac_cv_func_memcmp_working = no ; then
2375	AC_DEFINE(NEED_MEMCMP_REPLACEMENT,1,
2376		[define if memcmp is not 8-bit clean or is otherwise broken])
2377fi
2378
2379AC_FUNC_STRFTIME
2380
2381OL_FUNC_INET_ATON
2382
2383dnl Check for NT specific routines
2384AC_CHECK_FUNC(_spawnlp, AC_DEFINE(HAVE_SPAWNLP,1,[if you have spawnlp()]))
2385
2386AC_CHECK_FUNC(_snprintf, [ac_cv_func_snprintf=yes
2387	AC_DEFINE(snprintf, _snprintf, [define to snprintf routine])
2388])
2389
2390AC_CHECK_FUNCS(vsnprintf _vsnprintf)
2391
2392if test $ac_cv_func_vsnprintf = no -a $ac_cv_func__vsnprintf = yes ; then
2393	ac_cv_func_vsnprintf=yes
2394	AC_DEFINE(vsnprintf, _vsnprintf, [define to vsnprintf routine])
2395fi
2396
2397AC_FUNC_VPRINTF
2398
2399if test $ac_cv_func_vprintf = yes ; then
2400	dnl check for vsnprintf
2401	AC_CHECK_FUNCS(snprintf vsnprintf)
2402fi
2403
2404AC_CHECK_FUNCS(			\
2405	bcopy			\
2406	clock_gettime	\
2407	closesocket		\
2408	chroot			\
2409	endgrent		\
2410	endpwent		\
2411	fcntl			\
2412	flock			\
2413	fstat			\
2414	getdtablesize		\
2415	geteuid			\
2416	getgrgid		\
2417	gethostname		\
2418	getpassphrase		\
2419	getpwuid		\
2420	getpwnam		\
2421	getspnam		\
2422	gettimeofday		\
2423	initgroups		\
2424	inet_ntoa_b		\
2425	ioctl			\
2426	lockf			\
2427	memcpy			\
2428	memmove			\
2429	memrchr			\
2430	mkstemp			\
2431	mktemp			\
2432	pipe			\
2433	read			\
2434	recv			\
2435	recvfrom		\
2436	setpwfile		\
2437	setgid			\
2438	setegid			\
2439	setsid			\
2440	setuid			\
2441	seteuid			\
2442	signal			\
2443	strdup			\
2444	strpbrk			\
2445	strrchr			\
2446	strsep			\
2447	strstr			\
2448	strtol			\
2449	strtoul			\
2450	strtoq			\
2451	strtouq			\
2452	strtoll			\
2453	strtoull		\
2454	strspn			\
2455	sysconf			\
2456	waitpid			\
2457	wait4			\
2458	write			\
2459	send			\
2460	sendmsg			\
2461	sendto			\
2462)
2463
2464dnl We actually may need to replace more than this.
2465AC_REPLACE_FUNCS(getopt getpeereid)
2466
2467if test "$ac_cv_func_getopt" != yes; then
2468	LIBSRCS="$LIBSRCS getopt.c"
2469fi
2470
2471if test "$ac_cv_func_getpeereid" != yes; then
2472	AC_CHECK_FUNCS( getpeerucred )
2473	if test "$ac_cv_func_getpeerucred" != yes ; then
2474		AC_CHECK_MEMBERS([struct msghdr.msg_accrightslen],,,
2475			[$ac_includes_default
2476#ifdef HAVE_SYS_SOCKET_H
2477#include <sys/socket.h>
2478#endif])
2479		if test "$ac_cv_member_struct_msghdr_msg_accrightslen" != yes; then
2480			AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
2481				[$ac_includes_default
2482#ifdef HAVE_SYS_SOCKET_H
2483#include <sys/socket.h>
2484#endif])
2485		fi
2486		AC_CHECK_MEMBERS([struct stat.st_fstype, struct stat.st_vfstype])
2487		if test "$ac_cv_member_struct_stat_st_fstype" = yes; then
2488			AC_COMPILE_IFELSE([AC_LANG_SOURCE([struct stat st; char *ptr=st.st_fstype;])],
2489				AC_DEFINE([HAVE_STRUCT_STAT_ST_FSTYPE_CHAR],1,[define to 1 if st_fstype is char *]),
2490				AC_DEFINE([HAVE_STRUCT_STAT_ST_FSTYPE_INT],1,[define to 1 if st_fstype is int]))
2491		fi
2492	fi
2493	LIBSRCS="$LIBSRCS getpeereid.c"
2494fi
2495
2496if test "$ac_cv_func_snprintf" != yes ||
2497   test "$ac_cv_func_vsnprintf" != yes; then
2498	if test "$ac_cv_func_snprintf" != yes; then
2499		AC_DEFINE(snprintf, ber_pvt_snprintf, [define to snprintf routine])
2500	fi
2501	if test "$ac_cv_func_vsnprintf" != yes; then
2502		AC_DEFINE(vsnprintf, ber_pvt_vsnprintf, [define to snprintf routine])
2503	fi
2504fi
2505
2506dnl ----------------------------------------------------------------
2507dnl Sort out defines
2508
2509if test "$ol_enable_slapi" != no ; then
2510	dnl This check is done also if --enable-modules is used;
2511	dnl it is duplicated here, 'cause it'd be cached anyway
2512	AC_CHECK_HEADERS(ltdl.h)
2513
2514	if test $ac_cv_header_ltdl_h != yes ; then
2515		AC_MSG_ERROR([could not locate <ltdl.h>])
2516	fi
2517	AC_CHECK_LIB(ltdl, lt_dlinit, [
2518		SLAPI_LIBS=-lltdl
2519		LIBSLAPI=slapi/libslapi.la
2520		AC_DEFINE(HAVE_LIBLTDL,1,[define if you have libtool -ltdl])
2521	],[AC_MSG_ERROR([could not locate libtool -lltdl])])
2522
2523	AC_DEFINE(LDAP_SLAPI,1, [define this to add SLAPI code])
2524fi
2525
2526if test "$ol_enable_debug" != no ; then
2527	if test "$ol_enable_debug" = traditional; then
2528		AC_DEFINE(OLD_DEBUG,1,
2529			[define to use the original debug style])
2530	fi
2531	AC_DEFINE(LDAP_DEBUG,1,
2532		[define this to add debugging code])
2533fi
2534if test "$ol_enable_syslog" != no ; then
2535	AC_DEFINE(LDAP_SYSLOG,1,
2536		[define this to add syslog code])
2537fi
2538if test "$ol_enable_referrals" != no ; then
2539	AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS,LDAP_VENDOR_VERSION,
2540		[define to LDAP VENDOR VERSION])
2541fi
2542if test "$ol_enable_local" != no; then
2543	AC_DEFINE(LDAP_PF_LOCAL,1,[define to support PF_LOCAL])
2544fi
2545if test "$ol_link_ipv6" != no; then
2546	AC_DEFINE(LDAP_PF_INET6,1,[define to support PF_INET6])
2547fi
2548if test "$ol_enable_cleartext" != no ; then
2549	AC_DEFINE(SLAPD_CLEARTEXT,1,[define to support cleartext passwords])
2550fi
2551if test "$ol_enable_crypt" != no ; then
2552	AC_DEFINE(SLAPD_CRYPT,1,[define to support crypt(3) passwords])
2553fi
2554if test "$ol_link_spasswd" != no ; then
2555	AC_DEFINE(SLAPD_SPASSWD,1,[define to support SASL passwords])
2556fi
2557if test "$ol_enable_rlookups" != no ; then
2558	AC_DEFINE(SLAPD_RLOOKUPS,1,[define to support reverse lookups])
2559fi
2560if test "$ol_enable_aci" != no ; then
2561	if test "$ol_enable_aci" = mod ; then
2562		MFLAG=SLAPD_MOD_DYNAMIC
2563		dnl remove this after moving servers/slapd/aci.c in contrib/slapd-modules/acl
2564		AC_MSG_ERROR([ACI build as dynamic module not supported (yet)])
2565	else 
2566		MFLAG=SLAPD_MOD_STATIC
2567	fi
2568	WITH_ACI_ENABLED=$ol_enable_aci
2569	AC_DEFINE_UNQUOTED(SLAPD_ACI_ENABLED,$MFLAG,[define to support per-object ACIs])
2570else
2571	WITH_ACI_ENABLED=no
2572fi
2573if test "$ol_enable_dynacl" != no ; then
2574	AC_DEFINE(SLAP_DYNACL,1,[define to support run-time loadable ACL])
2575fi
2576
2577if test "$ol_link_modules" != no ; then
2578	AC_DEFINE(SLAPD_MODULES,1,[define to support modules])
2579	BUILD_SLAPD=yes
2580	SLAPD_MODULES_LDFLAGS="-dlopen self"
2581fi
2582
2583AC_DEFINE(SLAPD_MOD_STATIC,1,[statically linked module])
2584AC_DEFINE(SLAPD_MOD_DYNAMIC,2,[dynamically linked module])
2585
2586if test "$ol_enable_dnssrv" != no ; then
2587	BUILD_SLAPD=yes
2588	BUILD_DNSSRV=$ol_enable_dnssrv
2589	if test "$ol_enable_dnssrv" = mod ; then
2590		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-dnssrv"
2591		MFLAG=SLAPD_MOD_DYNAMIC
2592	else
2593		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-dnssrv"
2594		MFLAG=SLAPD_MOD_STATIC
2595	fi
2596	AC_DEFINE_UNQUOTED(SLAPD_DNSSRV,$MFLAG,[define to support DNS SRV backend])
2597fi
2598
2599if test "$ol_enable_ldap" != no ; then
2600	BUILD_SLAPD=yes
2601	BUILD_LDAP=$ol_enable_ldap
2602	if test "$ol_enable_ldap" = mod ; then
2603		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-ldap"
2604		MFLAG=SLAPD_MOD_DYNAMIC
2605	else
2606		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-ldap"
2607		MFLAG=SLAPD_MOD_STATIC
2608	fi
2609	AC_DEFINE_UNQUOTED(SLAPD_LDAP,$MFLAG,[define to support LDAP backend])
2610fi
2611
2612if test "$ol_enable_mdb" != no ; then
2613	BUILD_SLAPD=yes
2614	BUILD_MDB=$ol_enable_mdb
2615	if test "$ol_enable_mdb" = mod ; then
2616		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-mdb"
2617		MFLAG=SLAPD_MOD_DYNAMIC
2618	else
2619		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-mdb"
2620		MFLAG=SLAPD_MOD_STATIC
2621	fi
2622	AC_DEFINE_UNQUOTED(SLAPD_MDB,$MFLAG,[define to support MDB backend])
2623fi
2624
2625if test "$ol_enable_meta" != no ; then
2626	BUILD_SLAPD=yes
2627	BUILD_META=$ol_enable_meta
2628	if test "$ol_enable_meta" = mod ; then
2629		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-meta"
2630		MFLAG=SLAPD_MOD_DYNAMIC
2631	else
2632		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-meta"
2633		MFLAG=SLAPD_MOD_STATIC
2634	fi
2635	AC_DEFINE_UNQUOTED(SLAPD_META,$MFLAG,[define to support LDAP Metadirectory backend])
2636fi
2637
2638if test "$ol_enable_asyncmeta" != no ; then
2639	BUILD_SLAPD=yes
2640	BUILD_ASYNCMETA=$ol_enable_asyncmeta
2641	if test "$ol_enable_asyncmeta" = mod ; then
2642		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-asyncmeta"
2643		MFLAG=SLAPD_MOD_DYNAMIC
2644	else
2645		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-asyncmeta"
2646		MFLAG=SLAPD_MOD_STATIC
2647	fi
2648	AC_DEFINE_UNQUOTED(SLAPD_ASYNCMETA,$MFLAG,[define to support LDAP Async Metadirectory backend])
2649fi
2650
2651if test "$ol_enable_ndb" != no ; then
2652	BUILD_SLAPD=yes
2653	BUILD_NDB=$ol_enable_ndb
2654	if test "$ol_enable_ndb" = mod ; then
2655		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-ndb"
2656		MFLAG=SLAPD_MOD_DYNAMIC
2657	else
2658		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-ndb"
2659		MFLAG=SLAPD_MOD_STATIC
2660	fi
2661	AC_DEFINE_UNQUOTED(SLAPD_NDB,$MFLAG,[define to support NDB backend])
2662fi
2663
2664if test "$ol_enable_null" != no ; then
2665	BUILD_SLAPD=yes
2666	BUILD_NULL=$ol_enable_null
2667	if test "$ol_enable_null" = mod ; then
2668		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-null"
2669		MFLAG=SLAPD_MOD_DYNAMIC
2670	else
2671		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-null"
2672		MFLAG=SLAPD_MOD_STATIC
2673	fi
2674	AC_DEFINE_UNQUOTED(SLAPD_NULL,$MFLAG,[define to support NULL backend])
2675fi
2676
2677if test "$ol_enable_passwd" != no ; then
2678	BUILD_SLAPD=yes
2679	BUILD_PASSWD=$ol_enable_passwd
2680	if test "$ol_enable_passwd" = mod ; then
2681		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-passwd"
2682		MFLAG=SLAPD_MOD_DYNAMIC
2683	else
2684		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-passwd"
2685		MFLAG=SLAPD_MOD_STATIC
2686	fi
2687	AC_DEFINE_UNQUOTED(SLAPD_PASSWD,$MFLAG,[define to support PASSWD backend])
2688fi
2689
2690if test "$ol_link_perl" != no ; then
2691	BUILD_SLAPD=yes
2692	BUILD_PERL=$ol_enable_perl
2693	if test "$ol_enable_perl" = mod ; then
2694		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-perl"
2695		MFLAG=SLAPD_MOD_DYNAMIC
2696	else
2697		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-perl"
2698		MFLAG=SLAPD_MOD_STATIC
2699	fi
2700	AC_DEFINE_UNQUOTED(SLAPD_PERL,$MFLAG,[define to support PERL backend])
2701fi
2702
2703if test "$ol_enable_relay" != no ; then
2704	BUILD_SLAPD=yes
2705	BUILD_RELAY=$ol_enable_relay
2706	if test "$ol_enable_relay" = mod ; then
2707		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-relay"
2708		MFLAG=SLAPD_MOD_DYNAMIC
2709	else
2710		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-relay"
2711		MFLAG=SLAPD_MOD_STATIC
2712	fi
2713	AC_DEFINE_UNQUOTED(SLAPD_RELAY,$MFLAG,[define to support relay backend])
2714fi
2715
2716if test "$ol_enable_sock" != no ; then
2717	BUILD_SLAPD=yes
2718	BUILD_SOCK=$ol_enable_sock
2719	if test "$ol_enable_sock" = mod ; then
2720		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-sock"
2721		MFLAG=SLAPD_MOD_DYNAMIC
2722	else
2723		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-sock"
2724		MFLAG=SLAPD_MOD_STATIC
2725	fi
2726	AC_DEFINE_UNQUOTED(SLAPD_SOCK,$MFLAG,[define to support SOCK backend])
2727fi
2728
2729if test "$ol_link_sql" != no ; then
2730	BUILD_SLAPD=yes
2731	BUILD_SQL=$ol_enable_sql
2732	if test "$ol_enable_sql" = mod; then
2733		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-sql"
2734		MFLAG=SLAPD_MOD_DYNAMIC
2735	else
2736		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-sql"
2737		MFLAG=SLAPD_MOD_STATIC
2738	fi
2739	AC_DEFINE_UNQUOTED(SLAPD_SQL,$MFLAG,[define to support SQL backend])
2740fi
2741
2742if test "$ol_link_wt" != no ; then
2743	BUILD_SLAPD=yes
2744	BUILD_WT=$ol_enable_wt
2745	if test "$ol_enable_wt" = mod; then
2746		SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-wt"
2747		MFLAG=SLAPD_MOD_DYNAMIC
2748	else
2749		SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-wt"
2750		MFLAG=SLAPD_MOD_STATIC
2751	fi
2752	AC_DEFINE_UNQUOTED(SLAPD_WT,$MFLAG,[define to support WiredTiger backend])
2753fi
2754
2755if test "$ol_enable_accesslog" != no ; then
2756	BUILD_ACCESSLOG=$ol_enable_accesslog
2757	if test "$ol_enable_accesslog" = mod ; then
2758		MFLAG=SLAPD_MOD_DYNAMIC
2759		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS accesslog.la"
2760	else
2761		MFLAG=SLAPD_MOD_STATIC
2762		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS accesslog.o"
2763	fi
2764	AC_DEFINE_UNQUOTED(SLAPD_OVER_ACCESSLOG,$MFLAG,[define for In-Directory Access Logging overlay])
2765fi
2766
2767if test "$ol_enable_auditlog" != no ; then
2768	BUILD_AUDITLOG=$ol_enable_auditlog
2769	if test "$ol_enable_auditlog" = mod ; then
2770		MFLAG=SLAPD_MOD_DYNAMIC
2771		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS auditlog.la"
2772	else
2773		MFLAG=SLAPD_MOD_STATIC
2774		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS auditlog.o"
2775	fi
2776	AC_DEFINE_UNQUOTED(SLAPD_OVER_AUDITLOG,$MFLAG,[define for Audit Logging overlay])
2777fi
2778
2779if test "$ol_enable_autoca" != no ; then
2780	if test $ol_with_tls != openssl ; then
2781		AC_MSG_ERROR([--enable-autoca=$ol_enable_autoca requires --with-tls=openssl])
2782	fi
2783
2784	BUILD_AUTOCA=$ol_enable_autoca
2785	if test "$ol_enable_autoca" = mod ; then
2786		MFLAG=SLAPD_MOD_DYNAMIC
2787		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS autoca.la"
2788	else
2789		MFLAG=SLAPD_MOD_STATIC
2790		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS autoca.o"
2791	fi
2792	AC_DEFINE_UNQUOTED(SLAPD_OVER_AUTOCA,$MFLAG,[define for Automatic Certificate Authority overlay])
2793fi
2794
2795if test "$ol_enable_collect" != no ; then
2796        BUILD_COLLECT=$ol_enable_collect
2797        if test "$ol_enable_collect" = mod ; then
2798                MFLAG=SLAPD_MOD_DYNAMIC
2799                SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS collect.la"
2800        else
2801                MFLAG=SLAPD_MOD_STATIC
2802                SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS collect.o"
2803        fi
2804        AC_DEFINE_UNQUOTED(SLAPD_OVER_COLLECT,$MFLAG,[define for Collect overlay])
2805fi
2806
2807if test "$ol_enable_constraint" != no ; then
2808	BUILD_CONSTRAINT=$ol_enable_constraint
2809	if test "$ol_enable_constraint" = mod ; then
2810		MFLAG=SLAPD_MOD_DYNAMIC
2811		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS constraint.la"
2812	else
2813		MFLAG=SLAPD_MOD_STATIC
2814		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS constraint.o"
2815	fi
2816	AC_DEFINE_UNQUOTED(SLAPD_OVER_CONSTRAINT,$MFLAG,[define for Attribute Constraint overlay])
2817fi
2818
2819if test "$ol_enable_dds" != no ; then
2820	BUILD_DDS=$ol_enable_dds
2821	if test "$ol_enable_dds" = mod ; then
2822		MFLAG=SLAPD_MOD_DYNAMIC
2823		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS dds.la"
2824	else
2825		MFLAG=SLAPD_MOD_STATIC
2826		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS dds.o"
2827	fi
2828	AC_DEFINE_UNQUOTED(SLAPD_OVER_DDS,$MFLAG,[define for Dynamic Directory Services overlay])
2829fi
2830
2831if test "$ol_enable_deref" != no ; then
2832	BUILD_DEREF=$ol_enable_deref
2833	if test "$ol_enable_deref" = mod ; then
2834		MFLAG=SLAPD_MOD_DYNAMIC
2835		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS deref.la"
2836	else
2837		MFLAG=SLAPD_MOD_STATIC
2838		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS deref.o"
2839	fi
2840	AC_DEFINE_UNQUOTED(SLAPD_OVER_DEREF,$MFLAG,[define for Dynamic Directory Services overlay])
2841fi
2842
2843if test "$ol_enable_dyngroup" != no ; then
2844	BUILD_DYNGROUP=$ol_enable_dyngroup
2845	if test "$ol_enable_dyngroup" = mod ; then
2846		MFLAG=SLAPD_MOD_DYNAMIC
2847		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS dyngroup.la"
2848	else
2849		MFLAG=SLAPD_MOD_STATIC
2850		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS dyngroup.o"
2851	fi
2852	AC_DEFINE_UNQUOTED(SLAPD_OVER_DYNGROUP,$MFLAG,[define for Dynamic Group overlay])
2853fi
2854
2855if test "$ol_enable_dynlist" != no ; then
2856	BUILD_DYNLIST=$ol_enable_dynlist
2857	if test "$ol_enable_dynlist" = mod ; then
2858		MFLAG=SLAPD_MOD_DYNAMIC
2859		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS dynlist.la"
2860	else
2861		MFLAG=SLAPD_MOD_STATIC
2862		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS dynlist.o"
2863	fi
2864	AC_DEFINE_UNQUOTED(SLAPD_OVER_DYNLIST,$MFLAG,[define for Dynamic List overlay])
2865fi
2866
2867if test "$ol_enable_homedir" != no ; then
2868	BUILD_HOMEDIR=$ol_enable_homedir
2869	if test "$ol_enable_homedir" = mod ; then
2870		MFLAG=SLAPD_MOD_DYNAMIC
2871		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS homedir.la"
2872	else
2873		MFLAG=SLAPD_MOD_STATIC
2874		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS homedir.o"
2875	fi
2876	AC_DEFINE_UNQUOTED(SLAPD_OVER_HOMEDIR,$MFLAG,[define for Home Directory Management overlay])
2877fi
2878
2879if test "$ol_enable_memberof" != no ; then
2880	BUILD_MEMBEROF=$ol_enable_memberof
2881	if test "$ol_enable_memberof" = mod ; then
2882		MFLAG=SLAPD_MOD_DYNAMIC
2883		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS memberof.la"
2884	else
2885		MFLAG=SLAPD_MOD_STATIC
2886		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS memberof.o"
2887	fi
2888	AC_DEFINE_UNQUOTED(SLAPD_OVER_MEMBEROF,$MFLAG,[define for Reverse Group Membership overlay])
2889fi
2890
2891if test "$ol_enable_otp" != no ; then
2892	if test $ol_with_tls = no ; then
2893		AC_MSG_ERROR([--enable-otp=$ol_enable_otp requires --with-tls])
2894	fi
2895
2896	BUILD_OTP=$ol_enable_otp
2897	if test "$ol_enable_otp" = mod ; then
2898		MFLAG=SLAPD_MOD_DYNAMIC
2899		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS otp.la"
2900	else
2901		MFLAG=SLAPD_MOD_STATIC
2902		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS otp.o"
2903	fi
2904	AC_DEFINE_UNQUOTED(SLAPD_OVER_OTP,$MFLAG,[define for OTP 2-factor Authentication overlay])
2905fi
2906
2907if test "$ol_enable_ppolicy" != no ; then
2908	BUILD_PPOLICY=$ol_enable_ppolicy
2909	if test "$ol_enable_ppolicy" = mod ; then
2910		MFLAG=SLAPD_MOD_DYNAMIC
2911		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS ppolicy.la"
2912	else
2913		MFLAG=SLAPD_MOD_STATIC
2914		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS ppolicy.o"
2915	fi
2916	AC_DEFINE_UNQUOTED(SLAPD_OVER_PPOLICY,$MFLAG,[define for Password Policy overlay])
2917fi
2918
2919if test "$ol_enable_proxycache" != no ; then
2920	BUILD_PROXYCACHE=$ol_enable_proxycache
2921	if test "$ol_enable_proxycache" = mod ; then
2922		MFLAG=SLAPD_MOD_DYNAMIC
2923		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS pcache.la"
2924	else
2925		MFLAG=SLAPD_MOD_STATIC
2926		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS pcache.o"
2927	fi
2928	AC_DEFINE_UNQUOTED(SLAPD_OVER_PROXYCACHE,$MFLAG,[define for Proxy Cache overlay])
2929fi
2930
2931if test "$ol_enable_refint" != no ; then
2932	BUILD_REFINT=$ol_enable_refint
2933	if test "$ol_enable_refint" = mod ; then
2934		MFLAG=SLAPD_MOD_DYNAMIC
2935		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS refint.la"
2936	else
2937		MFLAG=SLAPD_MOD_STATIC
2938		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS refint.o"
2939	fi
2940	AC_DEFINE_UNQUOTED(SLAPD_OVER_REFINT,$MFLAG,[define for Referential Integrity overlay])
2941fi
2942
2943if test "$ol_enable_remoteauth" != no ; then
2944	BUILD_REMOTEAUTH=$ol_enable_remoteauth
2945	if test "$ol_enable_remoteauth" = mod ; then
2946		MFLAG=SLAPD_MOD_DYNAMIC
2947		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS remoteauth.la"
2948	else
2949		MFLAG=SLAPD_MOD_STATIC
2950		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS remoteauth.o"
2951	fi
2952	AC_DEFINE_UNQUOTED(SLAPD_OVER_REMOTEAUTH,$MFLAG,[define for Deferred Authentication overlay])
2953fi
2954
2955if test "$ol_enable_retcode" != no ; then
2956	BUILD_RETCODE=$ol_enable_retcode
2957	if test "$ol_enable_retcode" = mod ; then
2958		MFLAG=SLAPD_MOD_DYNAMIC
2959		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS retcode.la"
2960	else
2961		MFLAG=SLAPD_MOD_STATIC
2962		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS retcode.o"
2963	fi
2964	AC_DEFINE_UNQUOTED(SLAPD_OVER_RETCODE,$MFLAG,[define for Return Code overlay])
2965fi
2966
2967if test "$ol_enable_rwm" != no ; then
2968	BUILD_RWM=$ol_enable_rwm
2969	if test "$ol_enable_rwm" = mod ; then
2970		MFLAG=SLAPD_MOD_DYNAMIC
2971		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS rwm.la"
2972	else
2973		MFLAG=SLAPD_MOD_STATIC
2974		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS rwm_x.o"
2975	fi
2976	AC_DEFINE_UNQUOTED(SLAPD_OVER_RWM,$MFLAG,[define for Rewrite/Remap overlay])
2977fi
2978
2979if test "$ol_enable_seqmod" != no ; then
2980	BUILD_SEQMOD=$ol_enable_seqmod
2981	if test "$ol_enable_seqmod" = mod ; then
2982		MFLAG=SLAPD_MOD_DYNAMIC
2983		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS seqmod.la"
2984	else
2985		MFLAG=SLAPD_MOD_STATIC
2986		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS seqmod.o"
2987	fi
2988	AC_DEFINE_UNQUOTED(SLAPD_OVER_SEQMOD,$MFLAG,[define for Sequential Modify overlay])
2989fi
2990
2991if test "$ol_enable_sssvlv" != no ; then
2992	BUILD_SSSVLV=$ol_enable_sssvlv
2993	if test "$ol_enable_sssvlv" = mod ; then
2994		MFLAG=SLAPD_MOD_DYNAMIC
2995		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS sssvlv.la"
2996	else
2997		MFLAG=SLAPD_MOD_STATIC
2998		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS sssvlv.o"
2999	fi
3000	AC_DEFINE_UNQUOTED(SLAPD_OVER_SSSVLV,$MFLAG,[define for ServerSideSort/VLV overlay])
3001fi
3002
3003if test "$ol_enable_syncprov" != no ; then
3004	BUILD_SYNCPROV=$ol_enable_syncprov
3005	if test "$ol_enable_syncprov" = mod ; then
3006		MFLAG=SLAPD_MOD_DYNAMIC
3007		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS syncprov.la"
3008	else
3009		MFLAG=SLAPD_MOD_STATIC
3010		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS syncprov.o"
3011	fi
3012	AC_DEFINE_UNQUOTED(SLAPD_OVER_SYNCPROV,$MFLAG,[define for Syncrepl Provider overlay])
3013fi
3014
3015if test "$ol_enable_translucent" != no ; then
3016	BUILD_TRANSLUCENT=$ol_enable_translucent
3017	if test "$ol_enable_translucent" = mod ; then
3018		MFLAG=SLAPD_MOD_DYNAMIC
3019		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS translucent.la"
3020	else
3021		MFLAG=SLAPD_MOD_STATIC
3022		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS translucent.o"
3023	fi
3024	AC_DEFINE_UNQUOTED(SLAPD_OVER_TRANSLUCENT,$MFLAG,[define for Translucent Proxy overlay])
3025fi
3026
3027if test "$ol_enable_unique" != no ; then
3028	BUILD_UNIQUE=$ol_enable_unique
3029	if test "$ol_enable_unique" = mod ; then
3030		MFLAG=SLAPD_MOD_DYNAMIC
3031		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS unique.la"
3032	else
3033		MFLAG=SLAPD_MOD_STATIC
3034		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS unique.o"
3035	fi
3036	AC_DEFINE_UNQUOTED(SLAPD_OVER_UNIQUE,$MFLAG,[define for Attribute Uniqueness overlay])
3037fi
3038
3039if test "$ol_enable_valsort" != no ; then
3040	BUILD_VALSORT=$ol_enable_valsort
3041	if test "$ol_enable_valsort" = mod ; then
3042		MFLAG=SLAPD_MOD_DYNAMIC
3043		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS valsort.la"
3044	else
3045		MFLAG=SLAPD_MOD_STATIC
3046		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS valsort.o"
3047	fi
3048	AC_DEFINE_UNQUOTED(SLAPD_OVER_VALSORT,$MFLAG,[define for Value Sorting overlay])
3049fi
3050
3051ol_link_argon2=no
3052if test "$ol_enable_argon2" = "yes" ; then
3053	if test $ol_with_argon2 = libargon2 || test $ol_with_argon2 = auto; then
3054		AC_CHECK_HEADERS(argon2.h)
3055		if test $ac_cv_header_argon2_h = yes ; then
3056			AC_CHECK_LIB(argon2, argon2i_hash_encoded,
3057				[have_argon2=yes], [have_argon2=no],
3058				[-largon2])
3059		fi
3060		if test "$have_argon2" = "yes" ; then
3061			ol_with_argon2=libargon2
3062			ol_link_argon2=yes
3063			AC_DEFINE(HAVE_LIBARGON2, 1,
3064				[define if you have libargon2])
3065			ARGON2_LIBS="-largon2"
3066		fi
3067	fi
3068	if test $ol_with_argon2 = libsodium || test $ol_with_argon2 = auto; then
3069		AC_CHECK_HEADERS(sodium.h)
3070		if test $ac_cv_header_sodium_h = yes ; then
3071			AC_CHECK_LIB(sodium, crypto_pwhash_str_alg,
3072				[have_argon2=yes], [have_argon2=no],
3073				[-lsodium])
3074		fi
3075		if test "$have_argon2" = "yes" ; then
3076			ol_with_argon2=libsodium
3077			ol_link_argon2=yes
3078			AC_DEFINE(HAVE_LIBSODIUM, 1,
3079				[define if you have libsodium])
3080			ARGON2_LIBS="-lsodium"
3081		fi
3082	fi
3083
3084	if test "$ol_link_argon2" = no ; then
3085		AC_MSG_ERROR([--enable_argon2=$ol_enable_argon2 requires --with-argon2])
3086	fi
3087
3088	BUILD_PW_ARGON2=$ol_enable_argon2
3089	if test "$ol_enable_argon2" = "yes" ; then
3090		SLAPD_DYNAMIC_PWMODS="$SLAPD_DYNAMIC_PWDMODS argon2.la"
3091	fi
3092	AC_DEFINE_UNQUOTED(SLAPD_PWMOD_PW_ARGON2,$SLAPD_MOD_DYNAMIC,[define for Argon2 Password hashing module])
3093fi
3094
3095if test "$ol_enable_balancer" != no \
3096		-a "$ol_with_threads" != no \
3097		-a "$have_libevent" = yes ; then
3098	if test "$ol_enable_balancer" = mod; then
3099		BALANCER_INCLUDE=Makefile.module
3100		BUILD_BALANCER=mod
3101	else
3102		BALANCER_INCLUDE=Makefile.server
3103		BUILD_BALANCER=yes
3104	fi
3105fi
3106
3107if test "$ol_enable_slapi" != no ; then
3108	AC_DEFINE(ENABLE_SLAPI,1,[define to enable slapi library])
3109	BUILD_SLAPI=yes
3110	SLAPD_SLAPI_DEPEND=libslapi.a
3111fi
3112
3113OL_VERSIONED_SYMBOLS=""
3114if test $ol_enable_versioning != no; then
3115	LDVS=`$LD --help < /dev/null 2>/dev/null | grep gnu-version-script`
3116	if test -z "$LDVS"; then
3117		LDVS=`$LD --help < /dev/null 2>/dev/null | grep version-script`
3118		if test -z "$LDVS"; then
3119			if test $ol_enable_versioning = "yes" ; then
3120				AC_MSG_ERROR([Library symbol versioning requested but not supported])
3121			fi
3122		else
3123			OL_VERSIONED_SYMBOLS="-Wl,--version-script="
3124		fi
3125	else
3126		OL_VERSIONED_SYMBOLS="-z gnu-version-script="
3127	fi
3128fi
3129
3130dnl ----------------------------------------------------------------
3131
3132dnl
3133dnl For Windows build, we don't want to include -dlopen flags.
3134dnl They hurt more than they help.
3135dnl
3136
3137if test "$ac_cv_mingw32" = yes -o $ol_cv_msvc = yes ; then
3138	PLAT=NT
3139	SLAPD_MODULES_LDFLAGS=
3140else
3141	PLAT=UNIX
3142fi
3143
3144AC_SUBST(LIBSRCS)
3145AC_SUBST(PLAT)
3146AC_SUBST(WITH_SASL)
3147AC_SUBST(WITH_TLS)
3148AC_SUBST(WITH_MODULES_ENABLED)
3149AC_SUBST(WITH_ACI_ENABLED)
3150AC_SUBST(WITH_SYSTEMD)
3151AC_SUBST(BUILD_THREAD)
3152AC_SUBST(BUILD_LIBS_DYNAMIC)
3153AC_SUBST(OL_VERSIONED_SYMBOLS)
3154
3155AC_SUBST(BUILD_SLAPD)
3156dnl slapi
3157  AC_SUBST(BUILD_SLAPI)
3158  AC_SUBST(SLAPD_SLAPI_DEPEND)
3159dnl backends
3160  AC_SUBST(BUILD_DNSSRV)
3161  AC_SUBST(BUILD_LDAP)
3162  AC_SUBST(BUILD_MDB)
3163  AC_SUBST(BUILD_META)
3164  AC_SUBST(BUILD_ASYNCMETA)
3165  AC_SUBST(BUILD_NDB)
3166  AC_SUBST(BUILD_NULL)
3167  AC_SUBST(BUILD_PASSWD)
3168  AC_SUBST(BUILD_RELAY)
3169  AC_SUBST(BUILD_PERL)
3170  AC_SUBST(BUILD_SHELL)
3171  AC_SUBST(BUILD_SOCK)
3172  AC_SUBST(BUILD_SQL)
3173  AC_SUBST(BUILD_WT)
3174dnl overlays
3175  AC_SUBST(BUILD_ACCESSLOG)
3176  AC_SUBST(BUILD_AUDITLOG)
3177  AC_SUBST(BUILD_AUTOCA)
3178  AC_SUBST(BUILD_COLLECT)
3179  AC_SUBST(BUILD_CONSTRAINT)
3180  AC_SUBST(BUILD_DDS)
3181  AC_SUBST(BUILD_DENYOP)
3182  AC_SUBST(BUILD_DEREF)
3183  AC_SUBST(BUILD_DYNGROUP)
3184  AC_SUBST(BUILD_DYNLIST)
3185  AC_SUBST(BUILD_LASTMOD)
3186  AC_SUBST(BUILD_HOMEDIR)
3187  AC_SUBST(BUILD_MEMBEROF)
3188  AC_SUBST(BUILD_OTP)
3189  AC_SUBST(BUILD_PPOLICY)
3190  AC_SUBST(BUILD_PROXYCACHE)
3191  AC_SUBST(BUILD_REFINT)
3192  AC_SUBST(BUILD_REMOTEAUTH)
3193  AC_SUBST(BUILD_RETCODE)
3194  AC_SUBST(BUILD_RWM)
3195  AC_SUBST(BUILD_SEQMOD)
3196  AC_SUBST(BUILD_SSSVLV)
3197  AC_SUBST(BUILD_SYNCPROV)
3198  AC_SUBST(BUILD_TRANSLUCENT)
3199  AC_SUBST(BUILD_UNIQUE)
3200  AC_SUBST(BUILD_VALSORT)
3201  AC_SUBST(BUILD_BALANCER)
3202dnl pwmods
3203  AC_SUBST(BUILD_PW_ARGON2)
3204
3205AC_SUBST(LDAP_LIBS)
3206AC_SUBST(CLIENT_LIBS)
3207AC_SUBST(SLAPD_LIBS)
3208AC_SUBST(BALANCER_LIBS)
3209AC_SUBST(SLAPD_NDB_LIBS)
3210AC_SUBST(SLAPD_NDB_INCS)
3211AC_SUBST(LTHREAD_LIBS)
3212AC_SUBST(LUTIL_LIBS)
3213AC_SUBST(LEVENT_LIBS)
3214AC_SUBST(WRAP_LIBS)
3215
3216AC_SUBST(SLAPD_MODULES_CPPFLAGS)
3217AC_SUBST(SLAPD_MODULES_LDFLAGS)
3218
3219AC_SUBST(SLAPD_NO_STATIC)
3220AC_SUBST(SLAPD_STATIC_BACKENDS)
3221AC_SUBST(SLAPD_DYNAMIC_BACKENDS)
3222AC_SUBST(SLAPD_STATIC_OVERLAYS)
3223AC_SUBST(SLAPD_DYNAMIC_OVERLAYS)
3224AC_SUBST(SLAPD_DYNAMIC_PWMODS)
3225
3226AC_SUBST(PERL_CPPFLAGS)
3227AC_SUBST(SLAPD_PERL_LDFLAGS)
3228AC_SUBST(MOD_PERL_LDFLAGS)
3229
3230AC_SUBST(SASL_LIBS)
3231AC_SUBST(TLS_LIBS)
3232AC_SUBST(WITH_TLS_TYPE)
3233AC_SUBST(MODULES_LIBS)
3234AC_SUBST(SLAPI_LIBS)
3235AC_SUBST(LIBSLAPI)
3236AC_SUBST(AUTH_LIBS)
3237AC_SUBST(ARGON2_LIBS)
3238AC_SUBST(SYSTEMD_LIBS)
3239
3240AC_SUBST(SLAPD_SLP_LIBS)
3241AC_SUBST(SLAPD_GMP_LIBS)
3242
3243AC_SUBST(SLAPD_SQL_LDFLAGS)
3244AC_SUBST(SLAPD_SQL_LIBS)
3245AC_SUBST(SLAPD_SQL_INCLUDES)
3246
3247AC_SUBST(WT_CFLAGS)
3248AC_SUBST(WT_LIBS)
3249
3250AC_SUBST(BALANCER_INCLUDE)
3251
3252dnl ----------------------------------------------------------------
3253dnl final help output
3254AC_ARG_WITH(xxinstall,[
3255See INSTALL file for further details.])
3256
3257dnl ----------------------------------------------------------------
3258dnl final output
3259dnl
3260
3261AC_CONFIG_FILES([Makefile:build/top.mk:Makefile.in:build/dir.mk]
3262[doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk]
3263[doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk]
3264[doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk]
3265[doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk]
3266[doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk]
3267[doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk]
3268[clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk]
3269[clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk]
3270[include/Makefile:build/top.mk:include/Makefile.in]
3271[libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk]
3272[libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk]
3273[libraries/liblber/lber.pc]
3274[libraries/liblber/liblber.vers]
3275[libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk]
3276[libraries/libldap/ldap.pc]
3277[libraries/libldap/libldap.vers]
3278[libraries/liblunicode/Makefile:build/top.mk:libraries/liblunicode/Makefile.in:build/lib.mk:build/lib-static.mk]
3279[libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk]
3280[libraries/librewrite/Makefile:build/top.mk:libraries/librewrite/Makefile.in:build/lib.mk:build/lib-static.mk]
3281[servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk]
3282[servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk]
3283[servers/slapd/back-dnssrv/Makefile:build/top.mk:servers/slapd/back-dnssrv/Makefile.in:build/mod.mk]
3284[servers/slapd/back-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.in:build/mod.mk]
3285[servers/slapd/back-ldif/Makefile:build/top.mk:servers/slapd/back-ldif/Makefile.in:build/mod.mk]
3286[servers/slapd/back-mdb/Makefile:build/top.mk:servers/slapd/back-mdb/Makefile.in:build/mod.mk]
3287[servers/slapd/back-meta/Makefile:build/top.mk:servers/slapd/back-meta/Makefile.in:build/mod.mk]
3288[servers/slapd/back-asyncmeta/Makefile:build/top.mk:servers/slapd/back-asyncmeta/Makefile.in:build/mod.mk]
3289[servers/slapd/back-monitor/Makefile:build/top.mk:servers/slapd/back-monitor/Makefile.in:build/mod.mk]
3290[servers/slapd/back-ndb/Makefile:build/top.mk:servers/slapd/back-ndb/Makefile.in:build/mod.mk]
3291[servers/slapd/back-null/Makefile:build/top.mk:servers/slapd/back-null/Makefile.in:build/mod.mk]
3292[servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/mod.mk]
3293[servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/mod.mk]
3294[servers/slapd/back-relay/Makefile:build/top.mk:servers/slapd/back-relay/Makefile.in:build/mod.mk]
3295[servers/slapd/back-sock/Makefile:build/top.mk:servers/slapd/back-sock/Makefile.in:build/mod.mk]
3296[servers/slapd/back-sql/Makefile:build/top.mk:servers/slapd/back-sql/Makefile.in:build/mod.mk]
3297[servers/slapd/back-wt/Makefile:build/top.mk:servers/slapd/back-wt/Makefile.in:build/mod.mk]
3298[servers/slapd/slapi/Makefile:build/top.mk:servers/slapd/slapi/Makefile.in:build/lib.mk:build/lib-shared.mk]
3299[servers/slapd/overlays/Makefile:build/top.mk:servers/slapd/overlays/Makefile.in:build/lib.mk]
3300[servers/slapd/pwmods/Makefile:build/top.mk:servers/slapd/pwmods/Makefile.in:build/lib.mk]
3301[servers/lloadd/Makefile:build/top.mk:servers/lloadd/Makefile.in]
3302[servers/lloadd/Makefile.server:servers/lloadd/Makefile_server.in:build/srv.mk]
3303[servers/lloadd/Makefile.module:servers/lloadd/Makefile_module.in:build/mod.mk]
3304[tests/Makefile:build/top.mk:tests/Makefile.in:build/dir.mk]
3305[tests/run]
3306[tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk])
3307
3308AC_CONFIG_COMMANDS([default],[[
3309chmod +x tests/run
3310date > stamp-h
3311BACKENDSC="servers/slapd/backends.c"
3312echo "Making $BACKENDSC"
3313rm -f $BACKENDSC
3314cat > $BACKENDSC << ENDX
3315/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3316 *
3317 * Copyright 1998-2021 The OpenLDAP Foundation.
3318 * All rights reserved.
3319 *
3320 * Redistribution and use in source and binary forms, with or without
3321 * modification, are permitted only as authorized by the OpenLDAP
3322 * Public License.
3323 *
3324 * A copy of this license is available in the file LICENSE in the
3325 * top-level directory of the distribution or, alternatively, at
3326 * <http://www.OpenLDAP.org/license.html>.
3327 */
3328/* This file is automatically generated by configure; please do not edit. */
3329
3330#include "portable.h"
3331#include "slap.h"
3332
3333ENDX
3334if test "${STATIC_BACKENDS}"; then
3335	for b in config ${STATIC_BACKENDS}; do
3336		bb=`echo "${b}" | sed -e 's/back-//'`
3337		cat >> $BACKENDSC << ENDX
3338extern BI_init ${bb}_back_initialize;
3339ENDX
3340	done
3341
3342	cat >> $BACKENDSC << ENDX
3343
3344BackendInfo slap_binfo[] = {
3345ENDX
3346
3347	for b in config ${STATIC_BACKENDS}; do
3348		bb=`echo "${b}" | sed -e 's/back-//'`
3349		echo "    Add ${bb} ..."
3350		cat >> $BACKENDSC << ENDX
3351	{ "${bb}", ${bb}_back_initialize },
3352ENDX
3353	done
3354
3355	cat >> $BACKENDSC << ENDX
3356	{ NULL, NULL },
3357};
3358
3359/* end of generated file */
3360ENDX
3361fi
3362OVERLAYSC="servers/slapd/overlays/statover.c"
3363echo "Making $OVERLAYSC"
3364rm -f $OVERLAYSC
3365cat > $OVERLAYSC << ENDX
3366/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3367 *
3368 * Copyright 1998-2021 The OpenLDAP Foundation.
3369 * All rights reserved.
3370 *
3371 * Redistribution and use in source and binary forms, with or without
3372 * modification, are permitted only as authorized by the OpenLDAP
3373 * Public License.
3374 *
3375 * A copy of this license is available in the file LICENSE in the
3376 * top-level directory of the distribution or, alternatively, at
3377 * <http://www.OpenLDAP.org/license.html>.
3378 */
3379/* This file is automatically generated by configure; please do not edit. */
3380
3381#include "portable.h"
3382#include "slap.h"
3383
3384ENDX
3385if test "${STATIC_OVERLAYS}"; then
3386	for o in ${STATIC_OVERLAYS}; do
3387		oo=`echo "${o}" | sed -e 's/.o$//' -e 's/_x$//'`
3388		cat >> $OVERLAYSC << ENDX
3389extern OV_init ${oo}_initialize;
3390ENDX
3391	done
3392fi
3393
3394cat >> $OVERLAYSC << ENDX
3395
3396OverlayInit slap_oinfo[] = {
3397ENDX
3398
3399if test "${STATIC_OVERLAYS}"; then
3400	for o in ${STATIC_OVERLAYS}; do
3401		oo=`echo "${o}" | sed -e 's/.o$//' -e 's/_x$//'`
3402		echo "    Add ${oo} ..."
3403		cat >> $OVERLAYSC << ENDX
3404	{ "${oo}", ${oo}_initialize },
3405ENDX
3406	done
3407fi
3408
3409	cat >> $OVERLAYSC << ENDX
3410	{ NULL, NULL },
3411};
3412
3413/* end of generated file */
3414ENDX
3415
3416if test "${ol_cv_mkdep}" = no; then
3417	echo '(Do not "make depend"; we do not know how to build dependencies)'
3418else
3419	echo 'Please run "make depend" to build dependencies'
3420fi
3421]],[[
3422STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS"
3423STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS"
3424]])
3425AC_OUTPUT
3426