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