configure.in 88.4 KB
Newer Older
1
dnl $OpenLDAP$
Kurt Zeilenga's avatar
Kurt Zeilenga committed
2
dnl This work is part of OpenLDAP Software <http://www.openldap.org/>.
3
dnl
Kurt Zeilenga's avatar
Kurt Zeilenga committed
4
dnl Copyright 1998-2005 The OpenLDAP Foundation.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
5
6
dnl All rights reserved.
dnl
7
8
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted only as authorized by the OpenLDAP
Kurt Zeilenga's avatar
Kurt Zeilenga committed
9
10
11
12
13
dnl Public License.
dnl
dnl A copy of this license is available in the file LICENSE in the
dnl top-level directory of the distribution or, alternatively, at
dnl <http://www.OpenLDAP.org/license.html>.
14
dnl
15
dnl ----------------------------------------------------------------
16
17
18
dnl Disable config.cache!
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl
19
20
21
22
23
dnl ----------------------------------------------------------------
dnl Disable libtool 1.5 support for languages we don't use
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
define([AC_LIBTOOL_LANG_GCJ_CONFIG], [:])dnl
Kurt Zeilenga's avatar
Kurt Zeilenga committed
24
dnl ================================================================
Kurt Zeilenga's avatar
Kurt Zeilenga committed
25
dnl Configure.in for OpenLDAP
26
27
28
29
30
31
32
33
34
AC_COPYRIGHT([[Copyright 1998-2005 The OpenLDAP Foundation. All rights reserved.
Restrictions apply, see COPYRIGHT and LICENSE files.]])
AC_REVISION([$OpenLDAP$])
AC_INIT([OpenLDAP],,[http://www.openldap.org/its/])
AC_CONFIG_SRCDIR(build/version.sh)dnl
dnl ----------------------------------------------------------------
dnl OpenLDAP Autoconf Macros
builtin(include, build/openldap.m4)dnl
dnl ================================================================
35
36

AC_CONFIG_AUX_DIR(build)dnl
37

38
39
eval `$ac_aux_dir/version.sh`
if test -z "$OL_STRING"; then
40
41
42
	AC_MSG_ERROR([could not determine version])
fi

43
44
45
46
47
48
49
50
if test -f "$ac_aux_dir/shtool" -a ! -d $ac_aux_dir/shtool; then
	ac_cv_shtool="$ac_aux_dir/shtool"
else
	AC_MSG_ERROR([no shtool found in $ac_aux_dir])
fi

SHTOOL="$ac_cv_shtool"
dnl AC_SUBST(SHTOOL)dnl
51

Kurt Zeilenga's avatar
Kurt Zeilenga committed
52
53
TB="`$SHTOOL echo -e '%B' 2>/dev/null`"
TN="`$SHTOOL echo -e '%b' 2>/dev/null`"
Kurt Zeilenga's avatar
Kurt Zeilenga committed
54

55
56
57
58
59
60
OPENLDAP_CVS=""
if test -d $ac_aux_dir/CVS; then
	OPENLDAP_CVS="(from CVS sources) "
fi

echo "Configuring ${TB}${OL_STRING}${TN} ${OPENLDAP_CVS}..."
61

62
63
dnl Determine host platform
dnl		we try not to use this for much
64
AC_CANONICAL_TARGET([])
65

66
67
68
69
70
AM_INIT_AUTOMAKE([$OL_PACKAGE],[$OL_VERSION], [no defines])dnl
AC_SUBST(PACKAGE)dnl
AC_SUBST(VERSION)dnl
AC_DEFINE_UNQUOTED(OPENLDAP_PACKAGE,"$PACKAGE",Package)
AC_DEFINE_UNQUOTED(OPENLDAP_VERSION,"$VERSION",Version)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
71

72
73
74
75
AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION,$OL_API_INC,Version)
AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION_MAJOR,$OL_MAJOR,Major)
AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION_MINOR,$OL_MINOR,Minor)
AC_DEFINE_UNQUOTED(LDAP_VENDOR_VERSION_PATCH,$OL_PATCH,Patch)
76

Kurt Zeilenga's avatar
Kurt Zeilenga committed
77
78
79
80
OPENLDAP_LIBRELEASE=$OL_API_LIB_RELEASE
AC_SUBST(OPENLDAP_LIBRELEASE)dnl

OPENLDAP_LIBVERSION=$OL_API_LIB_VERSION
Kurt Zeilenga's avatar
Kurt Zeilenga committed
81
AC_SUBST(OPENLDAP_LIBVERSION)dnl
82

83
84
85
OPENLDAP_RELEASE_DATE="$OL_RELEASE_DATE"
AC_SUBST(OPENLDAP_RELEASE_DATE)dnl

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
dnl We use autoconf features new to 2.59.  Later versions like won't work.
dnl aclocal.m4 should be built using aclocal from automake 1.5
dnl libtool 1.5 should be installed.
AC_PREREQ(2.59)dnl Required Autoconf version

AH_TOP([
/* begin of portable.h.pre */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
 *
 * Copyright 1998-2005 The OpenLDAP Foundation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted only as authorized by the OpenLDAP
 * Public License.
 *
 * A copy of this license is available in the file LICENSE in the
 * top-level directory of the distribution or, alternatively, at
 * <http://www.OpenLDAP.org/license.html>.
 */

#ifndef _LDAP_PORTABLE_H
#define _LDAP_PORTABLE_H

/* define this if needed to get reentrant functions */
#ifndef REENTRANT
#undef REENTRANT
#endif
#ifndef _REENTRANT
#undef _REENTRANT
#endif

/* define this if needed to get threadsafe functions */
#ifndef THREADSAFE
#undef THREADSAFE
#endif
#ifndef _THREADSAFE
#undef _THREADSAFE
#endif
#ifndef THREAD_SAFE
#undef THREAD_SAFE
#endif
#ifndef _THREAD_SAFE
#undef _THREAD_SAFE
#endif

#ifndef _SGI_MP_SOURCE
#undef _SGI_MP_SOURCE
#endif

/* end of portable.h.pre */
])
AH_BOTTOM([
/* begin of portable.h.post */

#ifdef _WIN32
	/* don't suck in all of the win32 api */
#	define WIN32_LEAN_AND_MEAN 1
#endif

#ifndef LDAP_NEEDS_PROTOTYPES
/* force LDAP_P to always include prototypes */
#define LDAP_NEEDS_PROTOTYPES 1
#endif

#ifndef LDAP_REL_ENG
#if (LDAP_VENDOR_VERSION == 000000) && !defined(LDAP_DEVEL)
#define LDAP_DEVEL
#endif
#if defined(LDAP_DEVEL) && !defined(LDAP_TEST)
#define LDAP_TEST
#endif
#endif

#ifdef HAVE_STDDEF_H
#	include <stddef.h>
#endif

#ifdef HAVE_EBCDIC 
/* ASCII/EBCDIC converting replacements for stdio funcs
 * vsnprintf and snprintf are used too, but they are already
 * checked by the configure script
 */
#define fputs ber_pvt_fputs
#define fgets ber_pvt_fgets
#define printf ber_pvt_printf
#define fprintf ber_pvt_fprintf
#define vfprintf ber_pvt_vfprintf
#define vsprintf ber_pvt_vsprintf
#endif

#include "ac/fdset.h"

#include "ldap_cdefs.h"
#include "ldap_features.h"
181

182
183
184
185
186
187
188
189
190
191
#include "ac/assert.h"
#include "ac/localize.h"

#endif /* _LDAP_PORTABLE_H */
/* end of portable.h.post */
])

AC_CONFIG_HEADERS([include/portable.h:include/portable.hin])
AC_CONFIG_HEADERS([include/ldap_features.h:include/ldap_features.hin])
AC_CONFIG_HEADERS([include/lber_types.h:include/lber_types.hin])
192

193
dnl ================================================================
Kurt Zeilenga's avatar
Kurt Zeilenga committed
194
195
196
197
dnl Start Args
AC_MSG_CHECKING(configure arguments)
AC_PREFIX_DEFAULT(/usr/local)

198
199
200
top_builddir=`pwd`
AC_SUBST(top_builddir)dnl

201
202
dnl ----------------------------------------------------------------
dnl --with-subdir
203
ldap_subdir="/openldap"
Kurt Zeilenga's avatar
Kurt Zeilenga committed
204

205
AC_ARG_WITH(subdir,
Kurt Zeilenga's avatar
Kurt Zeilenga committed
206
[  --with-subdir=DIR       change default subdirectory used for installs],
207
208
209
210
211
212
[case "$withval" in
	no) ldap_subdir=""
		;;
	yes)
		;;
	/*|\\*)
213
		ldap_subdir="$withval"
214
215
216
217
218
		;;
	*)
		ldap_subdir="/$withval"
		;;
esac
219
220
])dnl

221
222
AC_SUBST(ldap_subdir)dnl

223
224
dnl ----------------------------------------------------------------
dnl General "enable" options
225
226
227
228
229
OL_ARG_ENABLE(debug,[  --enable-debug 	  enable debugging], yes)dnl
OL_ARG_ENABLE(dynamic,[  --enable-dynamic	  enable linking built binaries with dynamic libs], no)dnl
OL_ARG_ENABLE(syslog,[  --enable-syslog	  enable syslog support], auto)dnl
OL_ARG_ENABLE(proctitle,[  --enable-proctitle	  enable proctitle support], yes)dnl
dnl OL_ARG_ENABLE(referrals,[  --enable-referrals	  enable LDAPv2+ Referrals (experimental)], no)dnl
230
ol_enable_referrals=${ol_enable_referrals-no}
231
dnl OL_ARG_ENABLE(kbind,[  --enable-kbind	  enable LDAPv2+ Kerberos IV bind (deprecated)], no)dnl
232
ol_enable_kbind=${ol_enable_kbind-no}
233
234
OL_ARG_ENABLE(ipv6,[  --enable-ipv6 	  enable IPv6 support], auto)dnl
OL_ARG_ENABLE(local,[  --enable-local	  enable AF_LOCAL (AF_UNIX) socket support], auto)dnl
Kurt Zeilenga's avatar
Kurt Zeilenga committed
235

236
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
237
dnl General "with" options
238
239
240
241
OL_ARG_WITH(cyrus_sasl,[  --with-cyrus-sasl	  with Cyrus SASL support],
	auto, [auto yes no] )
OL_ARG_WITH(fetch,[  --with-fetch		  with fetch(3) URL support],
	auto, [auto yes no] )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
242
243
dnl	OL_ARG_WITH(kerberos,[  --with-kerberos	  with Kerberos support],
dnl		auto, [auto k5 k5only k425 kth k4 afs yes no])
Howard Chu's avatar
Howard Chu committed
244
ol_with_kerberos=${ol_with_kerberos-auto}
245
246
247
248
249
250
OL_ARG_WITH(threads,[  --with-threads	  with threads],
	auto, [auto nt posix mach pth lwp yes no manual] )
OL_ARG_WITH(tls,[  --with-tls		  with TLS/SSL support],
	auto, [auto ssleay openssl yes no] )
OL_ARG_WITH(yielding_select,[  --with-yielding-select  with implicitly yielding select],
	auto, [auto yes no manual] )
251
252
253
254
OL_ARG_WITH(multiple_precision,[  --with-multiple-precision
                          multiple precision support for statistics
			  auto|bignum|gmp],
	auto, [auto bignum gmp yes no] )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
255

256
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
257
dnl Server options
258
259
dnl ----------------------------------------------------------------

260
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
261
dnl SLAPD OPTIONS
262
AC_ARG_ENABLE(xxslapdoptions,[
263
264
265
266
267
268
269
270
271
SLAPD (Standalone LDAP Daemon) Options:])
OL_ARG_ENABLE(slapd,[  --enable-slapd	  enable building slapd], yes)dnl
OL_ARG_ENABLE(aci,[    --enable-aci	  enable per-object ACIs (experimental)], no)dnl
OL_ARG_ENABLE(cleartext,[    --enable-cleartext	  enable cleartext passwords], yes)dnl
OL_ARG_ENABLE(crypt,[    --enable-crypt	  enable crypt(3) passwords], no)dnl
OL_ARG_ENABLE(lmpasswd,[    --enable-lmpasswd	  enable LAN Manager passwords], no)dnl
OL_ARG_ENABLE(spasswd,[    --enable-spasswd	  enable (Cyrus) SASL password verification], no)dnl
OL_ARG_ENABLE(modules,[    --enable-modules	  enable dynamic module support], no)dnl
dnl OL_ARG_ENABLE(multimaster,[    --enable-multimaster  enable multimaster replication], no)dnl
272
ol_enable_multimaster=${ol_enable_multimaster-no}
Kurt Zeilenga's avatar
Kurt Zeilenga committed
273
OL_ARG_ENABLE(rewrite,[    --enable-rewrite	  enable DN rewriting in back-ldap and rwm overlay], auto)dnl
274
OL_ARG_ENABLE(rlookups,[    --enable-rlookups	  enable reverse lookups of client hostnames], no)dnl
275
OL_ARG_ENABLE(slapi,[    --enable-slapi        enable SLAPI support (experimental)], no)dnl
276
277
278
OL_ARG_ENABLE(slp,[    --enable-slp          enable SLPv2 support], no)dnl     
OL_ARG_ENABLE(wrappers,[    --enable-wrappers	  enable tcp wrapper support], no)dnl

Kurt Zeilenga's avatar
cleanup    
Kurt Zeilenga committed
279
280
dnl ----------------------------------------------------------------
dnl SLAPD Backend Options
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
Backends="bdb \
	dnssrv \
	hdb \
	ldap \
	ldbm \
	meta \
	monitor \
	null \
	passwd \
	perl \
	relay \
	shell \
	sql"

AC_ARG_ENABLE(xxslapbackends,[
Kurt Zeilenga's avatar
cleanup    
Kurt Zeilenga committed
296
297
SLAPD Backend Options:])

298
OL_ARG_ENABLE(backends,[    --enable-backends	  enable all available backends],
Kurt Zeilenga's avatar
Kurt Zeilenga committed
299
	--, [no yes mod])dnl
300
301
302
303
304
305
306
307
308
309
310
311
312
313
OL_ARG_ENABLE(bdb,[    --enable-bdb	  enable Berkeley DB backend],
	yes, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(dnssrv,[    --enable-dnssrv	  enable dnssrv backend],
	no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(hdb,[    --enable-hdb	  enable Hierarchical DB backend],
	yes, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(ldap,[    --enable-ldap	  enable ldap backend],
	no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(ldbm,[    --enable-ldbm	  enable ldbm backend],
	no, [no yes mod], ol_enable_backends)dnl
AC_ARG_WITH(ldbm_api,,[
	AC_MSG_WARN([Please use --enable-ldbm-api instead of --with-ldbm-api])
	enable_ldbm_api="$with_ldbm_api"])
OL_ARG_ENABLE(ldbm_api,[      --enable-ldbm-api   use LDBM API],
Kurt Zeilenga's avatar
cleanup    
Kurt Zeilenga committed
314
	auto, [auto berkeley bcompat mdbm gdbm])
315
316
317
318
AC_ARG_WITH(ldbm_type,,[
	AC_MSG_WARN([Please use --enable-ldbm-type instead of --with-ldbm-type])
	enable_ldbm_type="$with_ldbm_type"])
OL_ARG_ENABLE(ldbm_type,[      --enable-ldbm-type  use LDBM type],
Kurt Zeilenga's avatar
cleanup    
Kurt Zeilenga committed
319
	auto, [auto btree hash])
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
OL_ARG_ENABLE(meta,[    --enable-meta	  enable metadirectory backend],
	no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(monitor,[    --enable-monitor	  enable monitor backend],
	yes, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(null,[    --enable-null	  enable null backend],
	no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(passwd,[    --enable-passwd	  enable passwd backend],
	no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(perl,[    --enable-perl	  enable perl backend],
	no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(relay,[    --enable-relay  	  enable relay backend],
	yes, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(shell,[    --enable-shell	  enable shell backend],
	no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(sql,[    --enable-sql	  enable sql backend],
	no, [no yes mod], ol_enable_backends)dnl
Kurt Zeilenga's avatar
Kurt Zeilenga committed
336

Howard Chu's avatar
Howard Chu committed
337
338
dnl ----------------------------------------------------------------
dnl SLAPD Overlay Options
339
340
341
342
343
344
345
346
347
348
349
350
351
352
Overlays="accesslog \
	denyop \
	dyngroup \
	dynlist \
	lastmod \
	ppolicy \
	proxycache \
	refint \
	retcode \
	rwm \
	syncprov \
	translucent \
	unique \
	valsort"
353

354
AC_ARG_ENABLE(xxslapoverlays,[
Howard Chu's avatar
Howard Chu committed
355
SLAPD Overlay Options:])
Kurt Zeilenga's avatar
cleanup    
Kurt Zeilenga committed
356

357
OL_ARG_ENABLE(overlays,[    --enable-overlays	  enable all available overlays],
Kurt Zeilenga's avatar
Kurt Zeilenga committed
358
	--, [no yes mod])dnl
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
OL_ARG_ENABLE(accesslog,[    --enable-accesslog	  In-Directory Access Logging overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(denyop,[    --enable-denyop  	  Deny Operation overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(dyngroup,[    --enable-dyngroup	  Dynamic Group overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(dynlist,[    --enable-dynlist	  Dynamic List overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(lastmod,[    --enable-lastmod	  Last Modification overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(ppolicy,[    --enable-ppolicy	  Password Policy overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(proxycache,[    --enable-proxycache	  Proxy Cache overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(refint,[    --enable-refint	  Referential Integrity overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(retcode,[    --enable-retcode	  Return Code testing overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(rwm,[    --enable-rwm       	  Rewrite/Remap overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(syncprov,[    --enable-syncprov	  Syncrepl Provider overlay],
	yes, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(translucent,[    --enable-translucent  Translucent Proxy overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(unique,[    --enable-unique       Attribute Uniqueness overlay],
	no, [no yes mod], ol_enable_overlays)
OL_ARG_ENABLE(valsort,[    --enable-valsort      Value Sorting overlay],
	no, [no yes mod], ol_enable_overlays)
Howard Chu's avatar
Howard Chu committed
387

388
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
389
dnl SLURPD OPTIONS
390
AC_ARG_ENABLE(xxslurpdoptions,[
391
392
SLURPD (Replication Daemon) Options:])
OL_ARG_ENABLE(slurpd,[  --enable-slurpd	  enable building slurpd], auto)dnl
Kurt Zeilenga's avatar
Kurt Zeilenga committed
393

394
dnl ----------------------------------------------------------------
395
AC_ARG_ENABLE(xxliboptions,[
396
Library Generation & Linking Options])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
397
398
AC_ENABLE_STATIC
AC_ENABLE_SHARED
399

400
401
dnl ----------------------------------------------------------------

402
# validate options
Kurt Zeilenga's avatar
Kurt Zeilenga committed
403
404
if test $ol_enable_slapd = no ; then
	dnl SLAPD was specificallly disabled
405
406
407
	if test $ol_enable_slapi = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-slapi argument])
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
408
	case "$ol_enable_backends" in yes | mod)
409
		AC_MSG_WARN([slapd disabled, ignoring --enable-backends argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
410
	esac
411
412
413
414
	for i in $Backends; do
		eval "ol_tmp=\$ol_enable_$i"
		if test $ol_tmp != no ; then
			AC_MSG_WARN([slapd disabled, ignoring --enable-$i argument])
Howard Chu's avatar
Howard Chu committed
415
			eval "ol_enable_$i=no"
416
417
		fi
	done
418
	if test $ol_enable_modules = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
419
		AC_MSG_WARN([slapd disabled, ignoring --enable-modules argument])
420
	fi
421
422
423
	if test $ol_enable_multimaster = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-multimaster argument])
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
424
	if test $ol_enable_wrappers = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
425
		AC_MSG_WARN([slapd disabled, ignoring --enable-wrappers argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
426
427
	fi
	if test $ol_enable_rlookups = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
428
		AC_MSG_WARN([slapd disabled, ignoring --enable-rlookups argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
429
	fi
430
431
432
	if test $ol_enable_aci = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-aci argument])
	fi
433
434
	if test $ol_enable_ldbm_api != auto ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-ldbm-api argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
435
	fi
436
437
	if test $ol_enable_ldbm_type != auto ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-ldbm-type argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
438
439
	fi
	if test $ol_enable_slurpd = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
440
		AC_MSG_ERROR([slurpd requires slapd])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
441
	fi
Pierangelo Masarati's avatar
Pierangelo Masarati committed
442
443
444
	if test $ol_enable_rewrite = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-rewrite argument])
	fi
Pierangelo Masarati's avatar
Pierangelo Masarati committed
445
	dnl overlays
Kurt Zeilenga's avatar
Kurt Zeilenga committed
446
	case "$ol_enable_overlays" in yes | mod)
447
		AC_MSG_WARN([slapd disabled, ignoring --enable-overlays argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
448
	esac
449
450
451
452
	for i in $Overlays; do
		eval "ol_tmp=\$ol_enable_$i"
		if test $ol_tmp != no ; then
			AC_MSG_WARN([slapd disabled, ignoring --enable-$i argument])
Howard Chu's avatar
Howard Chu committed
453
			eval "ol_enable_$i=no"
454
455
		fi
	done
Kurt Zeilenga's avatar
Kurt Zeilenga committed
456
457

	# force settings to no
458
	ol_enable_slapi=no
459

Kurt Zeilenga's avatar
Kurt Zeilenga committed
460
461
	ol_enable_backends=
	ol_enable_overlays=
462
	ol_enable_modules=no
463
	ol_enable_multimaster=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
464
	ol_enable_rlookups=no
465
	ol_enable_aci=no
466
467
	ol_enable_wrappers=no

468
469
	ol_enable_ldbm_api=no
	ol_enable_ldbm_type=no
470

Kurt Zeilenga's avatar
Kurt Zeilenga committed
471
472
	ol_enable_slurpd=no

Pierangelo Masarati's avatar
Pierangelo Masarati committed
473
474
	ol_enable_rewrite=no

Kurt Zeilenga's avatar
Kurt Zeilenga committed
475
476
477
elif test $ol_enable_ldbm = no ; then
	dnl SLAPD without LDBM

478
479
	if test $ol_enable_ldbm_api != auto ; then
		AC_MSG_WARN([LDBM disabled, ignoring --enable-ldbm-api argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
480
481
	fi

482
483
	if test $ol_enable_ldbm_type != auto ; then
		AC_MSG_WARN([LDBM disabled, ignoring --enable-ldbm-type argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
484
485
	fi

486
	if test $ol_enable_modules != yes -a \
487
		$ol_enable_bdb = no -a \
488
		$ol_enable_dnssrv = no -a \
Howard Chu's avatar
Howard Chu committed
489
		$ol_enable_hdb = no -a \
490
		$ol_enable_ldap = no -a \
Pierangelo Masarati's avatar
Pierangelo Masarati committed
491
		$ol_enable_meta = no -a \
492
		$ol_enable_monitor = no -a \
493
		$ol_enable_null = no -a \
494
		$ol_enable_passwd = no -a \
495
		$ol_enable_perl = no -a \
496
		$ol_enable_relay = no -a \
497
		$ol_enable_shell = no -a \
498
		$ol_enable_sql = no ; then
499
500
501
502
503
504
505

		if test $ol_enable_slapd = yes ; then
			AC_MSG_ERROR([slapd requires a backend])
		else
			AC_MSG_WARN([skipping slapd, no backend specified])
			ol_enable_slapd=no
		fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
506
507
	fi

508
509
	ol_enable_ldbm_api=no
	ol_enable_ldbm_type=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
510

Howard Chu's avatar
Howard Chu committed
511
	if test $ol_enable_bdb != no -o $ol_enable_hdb != no; then
512
		ol_enable_ldbm_api=berkeley
513
514
	fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
515
516
else
	dnl SLAPD with LDBM
517
518
	if test $ol_enable_ldbm_api = gdbm -a \
		$ol_enable_ldbm_type = btree ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
519
		AC_MSG_ERROR([GDBM only supports LDBM type hash])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
520
	fi
521
522
	if test $ol_enable_ldbm_api = mdbm -a \
		$ol_enable_ldbm_type = btree ; then
Juan Gomez's avatar
Juan Gomez committed
523
524
		AC_MSG_ERROR([MDBM only supports LDBM type hash])
	fi
525
526
	if test $ol_enable_ldbm_api = ndbm -a \
		$ol_enable_ldbm_type = btree ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
527
		AC_MSG_ERROR([NDBM only supports LDBM type hash])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
528
	fi
529

Howard Chu's avatar
Howard Chu committed
530
	if test $ol_enable_bdb != no -o $ol_enable_hdb != no ; then
531
532
533
		if test $ol_enable_ldbm_api = auto ; then
			ol_enable_ldbm_api=berkeley
		elif test $ol_enable_ldbm_api != berkeley ; then
Howard Chu's avatar
Howard Chu committed
534
			AC_MSG_ERROR([LDBM API not compatible with BDB/HDB])
535
536
		fi
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
537
538
fi

539
540
541
542
if test $ol_enable_meta = yes -a $ol_enable_ldap = no ; then
	AC_MSG_ERROR([--enable-meta requires --enable-ldap])
fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
543
544
545
if test $ol_enable_slurpd = yes ; then
	dnl SLURPD was specifically enabled
	if test $ol_with_threads = no ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
546
		AC_MSG_ERROR([slurpd requires threads])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
547
548
549
	fi
fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
550
551
552
553
554
555
if test $ol_enable_lmpasswd = yes ; then
	if test $ol_with_tls = no ; then
		AC_MSG_ERROR([LAN Manager passwords require OpenSSL])
	fi
fi

Howard Chu's avatar
Howard Chu committed
556
if test $ol_enable_kbind = yes ; then
557
558
	if test $ol_with_kerberos = no ; then
		AC_MSG_ERROR([options require --with-kerberos])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
559
	elif test $ol_with_kerberos = auto ; then
560
		ol_with_kerberos=yes
561
	fi
562

Howard Chu's avatar
Howard Chu committed
563
elif test $ol_enable_kbind = no ; then
564
565
566
	if test $ol_with_kerberos = auto ; then
		ol_with_kerberos=no
	elif test $ol_with_kerberos != no ; then
567
		AC_MSG_WARN([Kerberos detection enabled unnecessarily]);
568
		ol_with_kerberos=no
569
	fi
570
571
fi

572
573
574
575
if test $ol_enable_spasswd = yes ; then
	if test $ol_with_cyrus_sasl = no ; then
		AC_MSG_ERROR([options require --with-cyrus-sasl])
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
576
	ol_with_cyrus_sasl=yes
577
578
fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
579
580
AC_MSG_RESULT(done)

581
582
dnl ----------------------------------------------------------------
dnl Initialize vars
Kurt Zeilenga's avatar
Kurt Zeilenga committed
583
584
585
586
587
588
589
590
591
592
593
LDAP_LIBS=
LDBM_LIBS=
LTHREAD_LIBS=
LUTIL_LIBS=

SLAPD_LIBS=
SLURPD_LIBS=

BUILD_SLAPD=no
BUILD_SLURPD=no

594
595
BUILD_THREAD=no

596
597
598
BUILD_SLAPI=no
SLAPD_SLAPI_DEPEND=

599
BUILD_BDB=no
600
BUILD_DNSSRV=no
Howard Chu's avatar
Howard Chu committed
601
BUILD_HDB=no
602
BUILD_LDAP=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
603
BUILD_LDBM=no
Pierangelo Masarati's avatar
Pierangelo Masarati committed
604
BUILD_META=no
605
BUILD_MONITOR=no
606
BUILD_NULL=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
607
BUILD_PASSWD=no
608
BUILD_PERL=no
609
BUILD_RELAY=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
610
BUILD_SHELL=no
611
BUILD_SQL=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
612

Kurt Zeilenga's avatar
Kurt Zeilenga committed
613
BUILD_ACCESSLOG=no
Pierangelo Masarati's avatar
Pierangelo Masarati committed
614
BUILD_DENYOP=no
Howard Chu's avatar
Howard Chu committed
615
BUILD_DYNGROUP=no
616
BUILD_DYNLIST=no
617
BUILD_LASTMOD=no
Howard Chu's avatar
Howard Chu committed
618
BUILD_PPOLICY=no
Howard Chu's avatar
Howard Chu committed
619
BUILD_PROXYCACHE=no
620
BUILD_REFINT=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
621
BUILD_RETCODE=no
622
BUILD_RWM=no
Howard Chu's avatar
Howard Chu committed
623
BUILD_SYNCPROV=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
624
BUILD_TRANSLUCENT=no
625
BUILD_UNIQUE=no
626
BUILD_VALSORT=no
Howard Chu's avatar
Howard Chu committed
627

628
SLAPD_STATIC_OVERLAYS=
Howard Chu's avatar
Howard Chu committed
629
630
SLAPD_DYNAMIC_OVERLAYS=

631
632
633
SLAPD_MODULES_LDFLAGS=
SLAPD_MODULES_CPPFLAGS=

Kurt Zeilenga's avatar
Kurt Zeilenga committed
634
SLAPD_STATIC_BACKENDS=back-ldif
635
636
SLAPD_DYNAMIC_BACKENDS=

637
SLAPD_PERL_LDFLAGS=
638
639
MOD_PERL_LDFLAGS=
PERL_CPPFLAGS=
640

641
642
643
644
SLAPD_SQL_LDFLAGS=
SLAPD_SQL_LIBS=
SLAPD_SQL_INCLUDES=

645
646
KRB4_LIBS=
KRB5_LIBS=
647
SASL_LIBS=
Bart Hartgers's avatar
   
Bart Hartgers committed
648
TLS_LIBS=
649
MODULES_LIBS=
650
SLAPI_LIBS=
Pierangelo Masarati's avatar
Pierangelo Masarati committed
651
652
LIBSLAPI=
LIBSLAPITOOLS=
653
AUTH_LIBS=
Kurt Zeilenga's avatar
Kurt Zeilenga committed
654

655
SLAPD_SLP_LIBS=
656
SLAPD_GMP_LIBS=
657

658
dnl ================================================================
Kurt Zeilenga's avatar
Kurt Zeilenga committed
659
660
dnl Checks for programs

661
662
AC_DEFINE(HAVE_MKVERSION, 1, [define this if you have mkversion])

663
dnl ----------------------------------------------------------------
664
665
666
667
dnl
dnl Determine which C translator to use
dnl

668
dnl AIX Thread requires we use cc_r or xlc_r.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
669
670
dnl But only do this IF AIX and CC is not set
dnl and threads are auto|yes|posix.
671
dnl
672
dnl If we find cc_r|xlc_r, force pthreads and assume
673
674
dnl		pthread_create is in $LIBS (ie: don't bring in
dnl		any additional thread libraries)
675
dnl If we do not find cc_r|xlc_r, disable threads
676
677

ol_aix_threads=no
678
case "$target" in
Kurt Zeilenga's avatar
Kurt Zeilenga committed
679
*-*-aix*) dnl all AIX is not a good idea.
680
	if test -z "$CC" ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
681
		case "$ol_with_threads" in
682
		auto | yes |  posix) ol_aix_threads=yes ;;
Kurt Zeilenga's avatar
Kurt Zeilenga committed
683
684
685
686
		esac
	fi
;;
esac
687

688
689
690
691
692
693
694
695
696
697
698
699
700
701
if test $ol_aix_threads = yes ; then
	if test -z "${CC}" ; then
		AC_CHECK_PROGS(CC,cc_r xlc_r cc)

		if test "$CC" = cc ; then
			dnl no CC! don't allow --with-threads
			if test $ol_with_threads != auto ; then
				AC_MSG_ERROR([--with-threads requires cc_r (or other suitable compiler) on AIX])
			else
				AC_MSG_WARN([disabling threads, no cc_r on AIX])
			fi
			ol_with_threads=no
  		fi
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
702

703
	if test "${CC}" = "cc_r" -o "${CC}" = "xlc_r" ; then
704
705
706
707
708
		ol_with_threads=posix
		ol_cv_pthread_create=yes
	fi
fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
709
if test -z "${CC}"; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
710
	AC_CHECK_PROGS(CC,cc gcc,missing)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
711
712

	if test "${CC}" = "missing" ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
713
		AC_MSG_ERROR([Unable to locate cc(1) or suitable replacement.  Check PATH or set CC.])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
714
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
715
716
fi

717
718
719
720
if test -z "${AR}"; then
	AC_CHECK_PROGS(AR,ar gar,missing)

	if test "${AR}" = "missing" ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
721
		AC_MSG_ERROR([Unable to locate ar(1) or suitable replacement.  Check PATH or set AR.])
722
723
	fi
fi
724

Howard Chu's avatar
Howard Chu committed
725
AC_LIBTOOL_WIN32_DLL
726
AC_LIBTOOL_DLOPEN
Kurt Zeilenga's avatar
Kurt Zeilenga committed
727
AC_PROG_LIBTOOL
Kurt Zeilenga's avatar
Kurt Zeilenga committed
728

729
730
dnl ----------------------------------------------------------------
dnl Perl
731
732
ol_link_perl=no
if test $ol_enable_perl != no ; then
733
734
735
	AC_PATH_PROG(PERLBIN, perl, /usr/bin/perl)

	if test "no$PERLBIN" = "no" ; then
736
737
738
		if test $ol_enable_perl = yes ; then
			AC_MSG_ERROR([could not locate perl])
		fi
739

740
	else
741
		PERL_CPPFLAGS="`$PERLBIN -MExtUtils::Embed -e ccopts`"
742
		PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e 's/ -lc / /' -e 's/ -lc$//'`"
Kurt Zeilenga's avatar
Kurt Zeilenga committed
743

744
		if test x"$ol_enable_perl" = "xyes" ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
745
			SLAPD_PERL_LDFLAGS="$PERL_LDFLAGS"
746
		else
Kurt Zeilenga's avatar
Kurt Zeilenga committed
747
			MOD_PERL_LDFLAGS="$PERL_LDFLAGS"
748
		fi
749
750
751
		dnl should check perl version
		ol_link_perl=yes
	fi
752
753
fi

754
AC_PROG_CPP
755

756
dnl ----------------------------------------------------------------
757
758
759
760
761
dnl Checks for Windows NT
case $host_os in
  *mingw32* ) ac_cv_mingw32=yes ;;
  *cygwin* ) ac_cv_cygwin=yes ;;
esac
Kurt Zeilenga's avatar
Kurt Zeilenga committed
762

763
dnl ----------------------------------------------------------------
764
dnl Checks for file extensions
765
766
AC_EXEEXT
AC_OBJEXT
Kurt Zeilenga's avatar
Kurt Zeilenga committed
767
AC_DEFINE_UNQUOTED(EXEEXT, "${EXEEXT}", [defined to be the EXE extension])
768

769
dnl ----------------------------------------------------------------
770
771
772
dnl BeOS requires -lbe -lroot -lnet
AC_CHECK_LIB(be, be_app, [LIBS="$LIBS -lbe -lroot -lnet"], :, [-lroot -lnet])

773
dnl ----------------------------------------------------------------
774
dnl OpenLDAP requires STDC features
775
776
AC_PROG_CC
if test "X${ac_cv_prog_cc_stdc}" = "Xno" ; then
777
	AC_MSG_ERROR([OpenLDAP requires compiler to support STDC constructs.])
778
779
fi

780
dnl ----------------------------------------------------------------
781
dnl Check cc depend flags
Kurt Zeilenga's avatar
Kurt Zeilenga committed
782
783
784
785
786
OL_MKDEPEND
if test "${ol_cv_mkdep}" = no ; then
	# this will soon become an error
	AC_MSG_WARN([do not know how to generate dependencies])
fi
787

788
789
dnl ----------------------------------------------------------------
dnl Check for AIX security library
790
AC_CHECK_LIB(s, afopen, [
791
792
793
794
	AUTH_LIBS=-ls
	AC_DEFINE(HAVE_AIX_SECURITY,1,[define if you have AIX security lib])
])

795
796
797
798
799
800
801
802
dnl ----------------------------------------------------------------
dnl Check for IBM OS/390
case "$target" in
*-ibm-openedition)
	ac_cv_func_getopt=no
	AC_DEFINE(BOTH_STRINGS_H,1,[define to use both <string.h> and <strings.h>])
	;;
esac
803

804
dnl ----------------------------------------------------------------
805
806
dnl Check for module support
ol_link_modules=no
807
WITH_MODULES_ENABLED=no
808
809
810
811
812
813
814
if test $ol_enable_modules != no ; then
	AC_CHECK_HEADERS(ltdl.h)

	if test $ac_cv_header_ltdl_h = no ; then
		AC_MSG_ERROR([could not locate libtool ltdl.h])
	fi

Howard Chu's avatar
Howard Chu committed
815
	AC_CHECK_LIB(ltdl, lt_dlinit, [
Kurt Zeilenga's avatar
Kurt Zeilenga committed
816
817
		MODULES_LIBS=-lltdl
		AC_DEFINE(HAVE_LIBLTDL,1,[define if you have libtool -ltdl])
Howard Chu's avatar
Howard Chu committed
818
819
	])

820
821
822
823
	if test "$ac_cv_lib_ltdl_lt_dlinit" = no ; then
		AC_MSG_ERROR([could not locate libtool -lltdl])
	fi
	ol_link_modules=yes
824
	WITH_MODULES_ENABLED=yes
825

826
else
827
828
829
830
	for i in $Backends; do
		eval "ol_tmp=\$ol_enable_$i"
		if test $ol_tmp = mod ; then
			AC_MSG_WARN([building static $i backend])
Howard Chu's avatar
Howard Chu committed
831
			eval "ol_enable_$i=yes"
832
833
834
835
836
837
		fi
	done
	for i in $Overlays; do
		eval "ol_tmp=\$ol_enable_$i"
		if test $ol_tmp = mod ; then
			AC_MSG_WARN([building static $i overlay])
Howard Chu's avatar
Howard Chu committed
838
			eval "ol_enable_$i=yes"
839
840
		fi
	done
841
842
fi

843
844
845
846
847
848
849
850
851
852
dnl ----------------------------------------------------------------
dnl Checks for header files.
OL_HEADER_STDC

if test $ol_cv_header_stdc != yes; then
	AC_MSG_WARN([could not locate Standard C compliant headers])
fi

AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
853
AC_HEADER_TIOCGWINSZ
854

Kurt Zeilenga's avatar
Kurt Zeilenga committed
855
AC_CHECK_HEADERS(		\
856
	arpa/inet.h		\
Kurt Zeilenga's avatar
Kurt Zeilenga committed
857
	arpa/nameser.h		\
858
	assert.h		\
Kurt Zeilenga's avatar
Kurt Zeilenga committed
859
	bits/types.h		\
Howard Chu's avatar
Howard Chu committed
860
	conio.h			\
861
	crypt.h			\
Howard Chu's avatar
Howard Chu committed
862
	direct.h		\
863
864
865
866
867
	errno.h			\
	fcntl.h			\
	filio.h			\
	getopt.h		\
	grp.h			\
Howard Chu's avatar
Howard Chu committed
868
	io.h			\
869
870
871
	libutil.h		\
	limits.h		\
	locale.h		\
Kurt Zeilenga's avatar
Kurt Zeilenga committed
872
	netinet/tcp.h		\
873
874
875
876
	malloc.h		\
	memory.h		\
	psap.h			\
	pwd.h			\
Howard Chu's avatar
Howard Chu committed
877
	process.h		\
878
879
880
881
882
883
884
885
886
887
888
	sgtty.h			\
	shadow.h		\
	stddef.h		\
	string.h		\
	strings.h		\
	sysexits.h		\
	sys/file.h		\
	sys/filio.h		\
	sys/errno.h		\
	sys/ioctl.h		\
	sys/param.h		\
Kurt Zeilenga's avatar
Kurt Zeilenga committed
889
890
891
	sys/resource.h		\
	sys/select.h		\
	sys/socket.h		\
892
	sys/stat.h		\
Kurt Zeilenga's avatar
Kurt Zeilenga committed
893
	sys/syslog.h		\
894
895
	sys/time.h		\
	sys/types.h		\
896
	sys/uio.h		\
897
898
899
	syslog.h		\
	termios.h		\
	unistd.h		\
Kurt Zeilenga's avatar
Kurt Zeilenga committed
900
	utime.h			\
901
	winsock.h		\
Howard Chu's avatar
Howard Chu committed
902
	winsock2.h		\
903
904
)

905
906
907
908
909
910
911
912
913
914
915
916
AC_CHECK_HEADERS( resolv.h, [], [],
[$ac_includes_default]
#include <netinet/in.h>
)

AC_CHECK_HEADERS(sys/ucred.h, [], [],
[$ac_includes_default
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
])

917
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
918
919
dnl Checks for libraries

Kurt Zeilenga's avatar
Kurt Zeilenga committed
920
921
AC_CHECK_FUNCS( sigaction sigset )

922
923
dnl HP-UX requires -lV3
dnl this is not needed on newer versions of HP-UX
Kurt Zeilenga's avatar
Kurt Zeilenga committed
924
925
926
if test $ac_cv_func_sigaction = no && test $ac_cv_func_sigaction = no ; then
	AC_CHECK_LIB(V3, sigset)
fi
927

Howard Chu's avatar
Howard Chu committed
928
929
930
dnl The following is INTENTIONALLY scripted out because shell does not
dnl support variable names with the '@' character, which is what
dnl autoconf would try to generate if one merely used AC_SEARCH_LIBS
931
932
933
dnl
dnl Skip Winsock tests on Cygwin
if test "$ac_cv_cygwin" != yes && test "$ac_cv_header_winsock_h" = yes; then
934
AC_CACHE_CHECK([for winsock], [ol_cv_winsock],
Howard Chu's avatar
Howard Chu committed
935
936
937
save_LIBS="$LIBS"
for curlib in ws2_32 wsock32; do
	LIBS="$LIBS -l$curlib"
938
939
	AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock.h>
			]], [[
940
941
942
943
			socket(0,0,0);
			select(0,NULL,NULL,NULL,NULL);
			closesocket(0);
			gethostname(NULL,0);
944
			]])],[ol_cv_winsock=yes],[ol_cv_winsock=no])
Howard Chu's avatar
Howard Chu committed
945

946
	if test $ol_cv_winsock = yes; then
Howard Chu's avatar
Howard Chu committed
947
		AC_DEFINE(HAVE_WINSOCK, 1, [define if you have winsock])
948
949
950
951
		ac_cv_func_socket=yes
		ac_cv_func_select=yes
		ac_cv_func_closesocket=yes
		ac_cv_func_gethostname=yes
Howard Chu's avatar
Howard Chu committed
952
		if test $curlib = ws2_32; then
953
			ol_cv_winsock=winsock2
Howard Chu's avatar
Howard Chu committed
954
955
956
957
			AC_DEFINE(HAVE_WINSOCK2, 1,
				  [define if you have winsock2])
		fi
		break
958
	fi
Howard Chu's avatar
Howard Chu committed
959
	LIBS="$save_LIBS"
960
961
done)
fi
Howard Chu's avatar
Howard Chu committed
962

Kurt Zeilenga's avatar
Kurt Zeilenga committed
963
964
965
966
967
dnl Find socket()
dnl Likely combinations:
dnl		-lsocket [ -lnsl_s | -lnsl ]
dnl		-linet

Kurt Zeilenga's avatar
Kurt Zeilenga committed
968
AC_CHECK_FUNC(socket, :, [	
Kurt Zeilenga's avatar
Kurt Zeilenga committed
969
970
971
972
973
974
975
976
977
dnl hopefully we won't include too many libraries
	AC_CHECK_LIB(socket, main)
	AC_CHECK_LIB(net, main)
	AC_CHECK_LIB(nsl_s, main)
	AC_CHECK_LIB(nsl, main)
	AC_CHECK_LIB(inet, socket)
	AC_CHECK_LIB(gen, main)
])

Kurt Zeilenga's avatar
Kurt Zeilenga committed
978
dnl require select
979
980
AC_CHECK_FUNC(select, :, AC_MSG_ERROR([select() required.]))

Howard Chu's avatar
Howard Chu committed
981
if test "${ac_cv_header_winsock_h}" != yes; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
982
983
984
985
	dnl Select arg types
	dnl (if this detection becomes permenent, it and the select() detection
	dnl should be done before the yielding select test) 
	AC_FUNC_SELECT_ARGTYPES
Howard Chu's avatar
Howard Chu committed
986
fi
987

988
dnl check to see if system call automatically restart
989
dnl AC_SYS_RESTARTABLE_SYSCALLS
990

Kurt Zeilenga's avatar
Kurt Zeilenga committed
991
dnl ----------------------------------------------------------------
992
AC_CHECK_FUNCS( poll )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
993
AC_CHECK_HEADERS( poll.h )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
994

995
996
dnl ----------------------------------------------------------------
AC_CHECK_HEADERS( sys/epoll.h )
997
998
if test "${ac_cv_header_sys_epoll_h}" = yes; then
AC_MSG_CHECKING(for epoll system call)
999
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(int argc, char *argv)
1000
1001
1002
{
	int epfd = epoll_create(256);
	exit (epfd == -1 ? 1 : 0);
1003
1004
}]])],[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_EPOLL,1, [define if your system supports epoll])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
1005
fi
1006

Kurt Zeilenga's avatar
Kurt Zeilenga committed
1007
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1008
1009
1010
# strerror checks
OL_STRERROR

1011
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1012
dnl require POSIX regex
1013
1014
1015
1016
AC_CHECK_HEADERS( regex.h )
if test "$ac_cv_header_regex_h" != yes ; then
	AC_MSG_ERROR([POSIX regex.h required.])
fi
Howard Chu's avatar
Howard Chu committed
1017
AC_SEARCH_LIBS(regfree, [regex gnuregex],
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1018
	:, AC_MSG_ERROR([POSIX regex required.]))
1019
1020
1021
1022
1023
1024

OL_POSIX_REGEX
if test "$ol_cv_c_posix_regex" = no ; then
	AC_MSG_ERROR([broken POSIX regex!])
fi

1025
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
dnl UUID Support

have_uuid=no
AC_CHECK_HEADERS(sys/uuid.h)
if test $ac_cv_header_sys_uuid_h = yes ; then
	save_LIBS="$LIBS"
	AC_SEARCH_LIBS(uuid_to_str, uuid, [have_uuid=yes], :)
	LIBS="$save_LIBS"

	if test have_uuid = yes ; then
		AC_DEFINE(HAVE_UUID_TO_STR,1,
			[define if you have uuid_to_str()])

		test "$ac_cv_search_uuid_to_str" = "none required" || \
			SLAPD_LIBS="$SLAPD_LIBS $ac_cv_search_uuid_to_str"
	fi
fi

1044
dnl For windows, check for the need of RPCRT for UUID function support
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1045
1046
1047
1048
if test $have_uuid = no ; then
	AC_MSG_CHECKING(to see if -lrpcrt4 is needed for win32 UUID support)
	save_LIBS="$LIBS"
	LIBS="$LIBS -lrpcrt4"
1049
	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1050
1051
		int __stdcall UuidCreate(void *);
		int __stdcall UuidToStringA(void *,void **);
1052
		]], [[
1053
1054
		UuidCreate(0);
		UuidToStringA(0,0);
1055
		]])],[need_rpcrt=yes],[need_rpcrt=no])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1056
1057
1058
1059
1060
	if test $need_rpcrt = yes; then
		SLAPD_LIBS="$SLAPD_LIBS -lrpcrt4"
	fi
	LIBS="$save_LIBS"
	AC_MSG_RESULT($need_rpcrt)
1061
1062
fi

1063
dnl ----------------------------------------------------------------
1064
dnl Check for resolver routines
1065
OL_RESOLVER_LINK
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1066

1067
1068
ol_link_dnssrv=no
if test "$ol_cv_lib_resolver" != no ; then
1069
1070
1071
	AC_DEFINE(HAVE_RES_QUERY,1,
		[define if you have res_query()])

1072
	if test "$ol_enable_dnssrv" != no ; then
1073
1074
		ol_link_dnssrv=yes
	fi
1075
1076
1077
1078

	if test "$ol_cv_lib_resolver" != yes ; then
		LIBS="$ol_cv_lib_resolver $LIBS"
	fi
1079
fi
1080

1081
1082
1083
1084
1085
1086
if test "$ol_enable_dnssrv" = yes -o "$ol_enable_dnssrv" = mod ; then
	if test "$ol_link_dnssrv" = no ; then
		AC_MSG_ERROR([DNSSRV requires res_query()])
	fi
else
	ol_enable_dnssrv=no
1087
fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1088

Kurt Zeilenga's avatar
Kurt Zeilenga committed
1089
1090
AC_CHECK_FUNCS( hstrerror )

Kurt Zeilenga's avatar
Kurt Zeilenga committed
1091
1092
1093
dnl ----------------------------------------------------------------
dnl PF_INET6 support requires getaddrinfo and INET6_ADDRSTRLEN
dnl PF_LOCAL may use getaddrinfo in available
1094
AC_CHECK_FUNCS( getaddrinfo getnameinfo gai_strerror inet_ntop )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1095
1096

ol_link_ipv6=no
1097
if test $ac_cv_func_getaddrinfo = no -o $ac_cv_func_inet_ntop = no ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1098
	if test $ol_enable_ipv6 = yes ; then
1099
		AC_MSG_ERROR([IPv6 support requires getaddrinfo() and inet_ntop()])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1100
	fi
1101
elif test $ol_enable_ipv6 != no ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1102
1103
	AC_CACHE_CHECK([INET6_ADDRSTRLEN],[ol_cv_inet6_addrstrlen],[
		AC_EGREP_CPP(__has_inet6_addrstrlen__,[
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1104
#			include <netinet/in.h>
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1105
1106
#			ifdef INET6_ADDRSTRLEN
				__has_inet6_addrstrlen__;
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1107
#			endif
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1108
		], [ol_cv_inet6_addrstrlen=yes], [ol_cv_inet6_addrstrlen=no])])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1109