configure.in 81.5 KB
Newer Older
1
dnl $OpenLDAP$
2
dnl
Kurt Zeilenga's avatar
Kurt Zeilenga committed
3
dnl Copyright 1998-2003 The OpenLDAP Foundation.  All Rights Reserved.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
4
dnl 
5
6
7
8
9
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted only as authorized by the OpenLDAP
dnl Public License.  A copy of this license is available at
dnl http://www.OpenLDAP.org/license.html or in file LICENSE in the
dnl top-level directory of the distribution.
10
dnl
11
dnl ----------------------------------------------------------------
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
dnl Redefine AC_INIT_BINSH to provide RCS IDs and copyright notice
dnl at top of generated configure script.  Prints simple copyright.
define([AC_INIT_BINSH],
[[#! /bin/sh
# $]OpenLDAP[$
# from] translit([$OpenLDAP$], $")] [

# Copyright 1998-2003 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 at
# http://www.OpenLDAP.org/license.html or in file LICENSE in the
# top-level directory of the distribution.

echo "Copyright 1998-2003 The OpenLDAP Foundation,  All Rights Reserved."
echo "	Restrictions apply, see COPYRIGHT and LICENSE files."
29
])dnl
30
31
32
33
dnl ----------------------------------------------------------------
dnl Disable config.cache!
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl
Kurt Zeilenga's avatar
Kurt Zeilenga committed
34
dnl ================================================================
Kurt Zeilenga's avatar
Kurt Zeilenga committed
35
dnl Configure.in for OpenLDAP
36
AC_INIT(build/version.sh)dnl
37

38
39
40
41
42
43
44
45
46
47
# set unset (borrowed from autoconf 2.49c)
if (OL_FOO=OL_FOO; unset OL_FOO) >/dev/null 2>&1; then
  ol_unset=unset
else
  ol_unset=false
fi
# unset CDPATH
$ol_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }

AC_CONFIG_AUX_DIR(build)dnl
48

49
50
eval `$ac_aux_dir/version.sh`
if test -z "$OL_STRING"; then
51
52
53
	AC_MSG_ERROR([could not determine version])
fi

54
55
56
57
58
59
60
61
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
62

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

66
67
68
69
70
71
OPENLDAP_CVS=""
if test -d $ac_aux_dir/CVS; then
	OPENLDAP_CVS="(from CVS sources) "
fi

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

73
74
75
76
dnl Determine host platform
dnl		we try not to use this for much
AC_CANONICAL_SYSTEM

77
78
79
80
81
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
82

83
84
85
86
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)
87
88

OPENLDAP_LIBVERSION=$OL_API_LIB
Kurt Zeilenga's avatar
Kurt Zeilenga committed
89
AC_SUBST(OPENLDAP_LIBVERSION)dnl
90

91
92
93
OPENLDAP_RELEASE_DATE="$OL_RELEASE_DATE"
AC_SUBST(OPENLDAP_RELEASE_DATE)dnl

94
95
96
97
dnl We use autoconf features new to 2.13.
dnl aclocal.m4 should be built using aclocal from automake 1.4
dnl libtool 1.4.2 should be installed.
AC_PREREQ(2.13)dnl Required Autoconf version
98

99
AC_CONFIG_HEADER(include/portable.h include/ldap_features.h include/lber_types.h)dnl
100

101
dnl ================================================================
Kurt Zeilenga's avatar
Kurt Zeilenga committed
102
103
104
105
dnl Start Args
AC_MSG_CHECKING(configure arguments)
AC_PREFIX_DEFAULT(/usr/local)

106
107
108
top_builddir=`pwd`
AC_SUBST(top_builddir)dnl

109
110
dnl ----------------------------------------------------------------
dnl --with-subdir
111
ldap_subdir="/openldap"
Kurt Zeilenga's avatar
Kurt Zeilenga committed
112

113
AC_ARG_WITH(subdir,
Kurt Zeilenga's avatar
Kurt Zeilenga committed
114
[  --with-subdir=DIR       change default subdirectory used for installs],
115
116
117
118
119
120
[case "$withval" in
	no) ldap_subdir=""
		;;
	yes)
		;;
	/*|\\*)
121
		ldap_subdir="$withval"
122
123
124
125
126
		;;
	*)
		ldap_subdir="/$withval"
		;;
esac
127
128
])dnl

129
130
AC_SUBST(ldap_subdir)dnl

131
132
dnl ----------------------------------------------------------------
dnl General "enable" options
133
134
135
136
137
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
138
ol_enable_referrals=${ol_enable_referrals-no}
139
dnl OL_ARG_ENABLE(kbind,[  --enable-kbind	  enable LDAPv2+ Kerberos IV bind (deprecated)], no)dnl
140
ol_enable_kbind=${ol_enable_kbind-no}
141
142
143
144
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
OL_ARG_ENABLE(x_compile,[  --enable-x-compile	  enable cross compiling],
	no, [yes no])dnl
Kurt Zeilenga's avatar
Kurt Zeilenga committed
145

146
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
147
dnl General "with" options
148
149
150
151
152
153
dnl OL_ARG_ENABLE(dmalloc,[  --enable-dmalloc	  enable debug malloc support], no)dnl

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
154
155
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
156
ol_with_kerberos=${ol_with_kerberos-auto}
157
158
159
160
161
162
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] )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
163

164
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
165
dnl Server options
166
167
dnl ----------------------------------------------------------------

168
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
169
dnl SLAPD OPTIONS
170
171
172
173
174
175
AC_ARG_WITH(xxslapdoptions,[
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
Kurt Zeilenga's avatar
Kurt Zeilenga committed
176
177
dnl OL_ARG_ENABLE(kpasswd,[    --enable-kpasswd	  enable Kerberos password verification], no)dnl
ol_enable_kpasswd=${ol_enable_kpasswd-no}
178
179
180
181
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
182
ol_enable_multimaster=${ol_enable_multimaster-no}
183
184
OL_ARG_ENABLE(rewrite,[    --enable-rewrite	  enable DN rewriting in back-ldap and back-meta], no)dnl
OL_ARG_ENABLE(rlookups,[    --enable-rlookups	  enable reverse lookups of client hostnames], no)dnl
185
OL_ARG_ENABLE(slapi,[    --enable-slapi        enable SLAPI support (experimental)], no)dnl
186
187
188
OL_ARG_ENABLE(slp,[    --enable-slp          enable SLPv2 support], no)dnl     
OL_ARG_ENABLE(wrappers,[    --enable-wrappers	  enable tcp wrapper support], no)dnl

189

Kurt Zeilenga's avatar
Kurt Zeilenga committed
190
dnl SLAPD Backend options
191
192
193
194
195
196
OL_ARG_ENABLE(bdb,[    --enable-bdb	  enable Berkeley DB backend], yes)dnl
OL_ARG_WITH(bdb_module,[    --with-bdb-module     module type static|dynamic], static,
	[static dynamic])
OL_ARG_ENABLE(dnssrv,[    --enable-dnssrv	  enable dnssrv backend], no)dnl
OL_ARG_WITH(dnssrv_module,[    --with-dnssrv-module  module type static|dynamic], static,
	[static dynamic])
Howard Chu's avatar
Howard Chu committed
197
198
199
OL_ARG_ENABLE(hdb,[    --enable-hdb	  enable Hierarchical DB backend], no)dnl
OL_ARG_WITH(hdb_module,[    --with-hdb-module     module type static|dynamic], static,
	[static dynamic])
200
201
202
203
204
205
206
207
208
209
210
211
212
OL_ARG_ENABLE(ldap,[    --enable-ldap	  enable ldap backend], no)dnl
OL_ARG_WITH(ldap_module,[    --with-ldap-module	  module type static|dynamic], static,
	[static dynamic])
OL_ARG_ENABLE(ldbm,[    --enable-ldbm	  enable ldbm backend], no)dnl
OL_ARG_WITH(ldbm_api,[    --with-ldbm-api       with LDBM API auto|berkeley|bcompat|mdbm|gdbm], auto,
	[auto berkeley bcompat mdbm gdbm])
OL_ARG_WITH(ldbm_module,[    --with-ldbm-module	  module type static|dynamic], static,
	[static dynamic])
OL_ARG_WITH(ldbm_type,[    --with-ldbm-type	  use LDBM type auto|btree|hash], auto,
	[auto btree hash])
OL_ARG_ENABLE(meta,[    --enable-meta	  enable metadirectory backend], no)dnl
OL_ARG_WITH(meta_module,[    --with-meta-module	  module type static|dynamic], static,
	[static dynamic])
213
OL_ARG_ENABLE(monitor,[    --enable-monitor	  enable monitor backend], yes)dnl
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
OL_ARG_WITH(monitor_module,[    --with-monitor-module module type static|dynamic], static,
	[static dynamic])
OL_ARG_ENABLE(null,[    --enable-null	  enable null backend], no)dnl
OL_ARG_WITH(null_module,[    --with-null-module	  module type static|dynamic], static,
	[static dynamic])
OL_ARG_ENABLE(passwd,[    --enable-passwd	  enable passwd backend], no)dnl
OL_ARG_WITH(passwd_module,[    --with-passwd-module  module type static|dynamic], static,
	[static dynamic])
OL_ARG_ENABLE(perl,[    --enable-perl	  enable perl backend], no)dnl
OL_ARG_WITH(perl_module,[    --with-perl-module	  module type static|dynamic], static,
	[static dynamic])
OL_ARG_ENABLE(shell,[    --enable-shell	  enable shell backend], no)dnl
OL_ARG_WITH(shell_module,[    --with-shell-module	  module type static|dynamic], static,
	[static dynamic])
OL_ARG_ENABLE(sql,[    --enable-sql	  enable sql backend], no)dnl
OL_ARG_WITH(sql_module,[    --with-sql-module	  module type static|dynamic], static,
	[static dynamic])
OL_ARG_ENABLE(tcl,[    --enable-tcl	  enable tcl backend], no)dnl
OL_ARG_WITH(tcl_module,[    --with-tcl-module	  module type static|dynamic], static,
	[static dynamic])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
234

235
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
236
dnl SLURPD OPTIONS
237
238
239
AC_ARG_WITH(xxslurpdoptions,[
SLURPD (Replication Daemon) Options:])
OL_ARG_ENABLE(slurpd,[  --enable-slurpd	  enable building slurpd], auto)dnl
Kurt Zeilenga's avatar
Kurt Zeilenga committed
240

241
dnl ----------------------------------------------------------------
242
243
AC_ARG_WITH(xxliboptions,[
Library Generation & Linking Options])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
244
245
AC_ENABLE_STATIC
AC_ENABLE_SHARED
246

247
248
dnl ----------------------------------------------------------------

249
dnl General "enable" options
250
# validate options
Kurt Zeilenga's avatar
Kurt Zeilenga committed
251
252
if test $ol_enable_slapd = no ; then
	dnl SLAPD was specificallly disabled
253
254
255
	if test $ol_enable_slapi = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-slapi argument])
	fi
256
257
258
	if test $ol_enable_bdb = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-bdb argument])
	fi
259
260
261
	if test $ol_enable_dnssrv = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-dnssrv argument])
	fi
Howard Chu's avatar
Howard Chu committed
262
263
264
	if test $ol_enable_hdb = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-hdb argument])
	fi
265
	if test $ol_enable_ldap = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
266
		AC_MSG_WARN([slapd disabled, ignoring --enable-ldap argument])
267
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
268
	if test $ol_enable_ldbm = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
269
		AC_MSG_WARN([slapd disabled, ignoring --enable-ldbm argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
270
	fi
Pierangelo Masarati's avatar
Pierangelo Masarati committed
271
272
273
	if test $ol_enable_meta = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-meta argument])
	fi
Pierangelo Masarati's avatar
Pierangelo Masarati committed
274
	if test $ol_enable_monitor = yes ; then
275
276
		AC_MSG_WARN([slapd disabled, ignoring --enable-monitor argument])
	fi
277
278
279
	if test $ol_enable_null = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-null argument])
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
280
	if test $ol_enable_passwd = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
281
		AC_MSG_WARN([slapd disabled, ignoring --enable-passwd argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
282
	fi
283
	if test $ol_enable_perl = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
284
		AC_MSG_WARN([slapd disabled, ignoring --enable-perl argument])
285
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
286
	if test $ol_enable_shell = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
287
		AC_MSG_WARN([slapd disabled, ignoring --enable-shell argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
288
	fi
289
	if test $ol_enable_tcl = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
290
		AC_MSG_WARN([slapd disabled, ignoring --enable-tcl argument])
291
	fi
292
293
294
	if test $ol_enable_sql = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-sql argument])
	fi
295
	if test $ol_enable_modules = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
296
		AC_MSG_WARN([slapd disabled, ignoring --enable-modules argument])
297
	fi
298
299
300
	if test $ol_enable_multimaster = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-multimaster argument])
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
301
	if test $ol_enable_wrappers = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
302
		AC_MSG_WARN([slapd disabled, ignoring --enable-wrappers argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
303
304
	fi
	if test $ol_enable_rlookups = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
305
		AC_MSG_WARN([slapd disabled, ignoring --enable-rlookups argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
306
	fi
307
308
309
	if test $ol_enable_aci = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-aci argument])
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
310
	if test $ol_with_ldbm_api != auto ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
311
		AC_MSG_WARN([slapd disabled, ignoring --with-ldbm-api argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
312
313
	fi
	if test $ol_with_ldbm_type != auto ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
314
		AC_MSG_WARN([slapd disabled, ignoring --with-ldbm-type argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
315
	fi
316
317
318
	if test $ol_with_bdb_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-bdb-module argument])
	fi
319
320
321
	if test $ol_with_dnssrv_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-dnssrv-module argument])
	fi
Howard Chu's avatar
Howard Chu committed
322
323
324
	if test $ol_with_hdb_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-hdb-module argument])
	fi
325
326
327
328
329
330
	if test $ol_with_ldap_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-ldap-module argument])
	fi
	if test $ol_with_ldbm_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-ldbm-module argument])
	fi
Pierangelo Masarati's avatar
Pierangelo Masarati committed
331
332
333
	if test $ol_with_meta_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-meta-module argument])
	fi
334
335
336
	if test $ol_with_monitor_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-monitor-module argument])
	fi
337
338
339
	if test $ol_with_null_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-null-module argument])
	fi
340
341
342
343
344
345
346
347
348
349
350
351
	if test $ol_with_passwd_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-passwd-module argument])
	fi
	if test $ol_with_perl_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-perl-module argument])
	fi
	if test $ol_with_shell_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-shell-module argument])
	fi
	if test $ol_with_tcl_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-tcl-module argument])
	fi
352
353
354
	if test $ol_with_sql_module != static ; then
		AC_MSG_WARN([slapd disabled, ignoring --with-sql-module argument])
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
355
	if test $ol_enable_slurpd = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
356
		AC_MSG_ERROR([slurpd requires slapd])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
357
	fi
Pierangelo Masarati's avatar
Pierangelo Masarati committed
358
359
360
	if test $ol_enable_rewrite = yes ; then
		AC_MSG_WARN([slapd disabled, ignoring --enable-rewrite argument])
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
361
362

	# force settings to no
363
	ol_enable_slapi=no
364
	ol_enable_bdb=no
365
	ol_enable_dnssrv=no
Howard Chu's avatar
Howard Chu committed
366
	ol_enable_hdb=no
367
	ol_enable_ldap=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
368
	ol_enable_ldbm=no
Pierangelo Masarati's avatar
Pierangelo Masarati committed
369
	ol_enable_meta=no
370
	ol_enable_monitor=no
371
	ol_enable_null=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
372
	ol_enable_passwd=no
373
374
	ol_enable_perl=no
	ol_enable_shell=no
375
	ol_enable_tcl=no
376
	ol_enable_sql=no
377
378

	ol_enable_modules=no
379
	ol_enable_multimaster=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
380
	ol_enable_rlookups=no
381
	ol_enable_aci=no
382
	ol_enable_wrappers=no
383
	ol_enable_dynamic=no
384

Kurt Zeilenga's avatar
Kurt Zeilenga committed
385
386
	ol_with_ldbm_api=no
	ol_with_ldbm_type=no
387

388
	ol_with_bdb_module=static
389
	ol_with_dnssrv_module=static
Howard Chu's avatar
Howard Chu committed
390
	ol_with_hdb_module=static
391
392
	ol_with_ldap_module=static
	ol_with_ldbm_module=static
Pierangelo Masarati's avatar
Pierangelo Masarati committed
393
	ol_with_meta_module=static
394
	ol_with_monitor_module=static
395
	ol_with_null_module=static
396
397
398
399
	ol_with_passwd_module=static
	ol_with_perl_module=static
	ol_with_shell_module=static
	ol_with_tcl_module=static
400
	ol_with_sql_module=static
401

Kurt Zeilenga's avatar
Kurt Zeilenga committed
402
403
	ol_enable_slurpd=no

Pierangelo Masarati's avatar
Pierangelo Masarati committed
404
405
	ol_enable_rewrite=no

Kurt Zeilenga's avatar
Kurt Zeilenga committed
406
407
408
409
elif test $ol_enable_ldbm = no ; then
	dnl SLAPD without LDBM

	if test $ol_with_ldbm_api != auto ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
410
		AC_MSG_WARN([LDBM disabled, ignoring --with-ldbm-api argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
411
412
413
	fi

	if test $ol_with_ldbm_type != auto ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
414
		AC_MSG_WARN([LDBM disabled, ignoring --with-ldbm-type argument])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
415
416
	fi

417
418
419
420
	if test $ol_with_ldbm_module != static ; then
		AC_MSG_WARN([LDBM disabled, ignoring --with-ldbm-module argument])
	fi

421
	if test $ol_enable_modules != yes -a \
422
		$ol_enable_bdb = no -a \
423
		$ol_enable_dnssrv = no -a \
Howard Chu's avatar
Howard Chu committed
424
		$ol_enable_hdb = no -a \
425
		$ol_enable_ldap = no -a \
Pierangelo Masarati's avatar
Pierangelo Masarati committed
426
		$ol_enable_meta = no -a \
427
		$ol_enable_monitor = no -a \
428
		$ol_enable_null = no -a \
429
		$ol_enable_passwd = no -a \
430
		$ol_enable_perl = no -a \
431
		$ol_enable_shell = no -a \
432
433
		$ol_enable_sql = no -a \
		$ol_enable_tcl = no ; then
434
435
436
437
438
439
440

		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
441
442
443
444
	fi

	ol_with_ldbm_api=no
	ol_with_ldbm_type=no
445
	ol_with_ldbm_module=static
Kurt Zeilenga's avatar
Kurt Zeilenga committed
446

Howard Chu's avatar
Howard Chu committed
447
	if test $ol_enable_bdb != no -o $ol_enable_hdb != no; then
448
449
450
		ol_with_ldbm_api=berkeley
	fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
451
452
453
454
else
	dnl SLAPD with LDBM
	if test $ol_with_ldbm_api = gdbm -a \
		$ol_with_ldbm_type = btree ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
455
		AC_MSG_ERROR([GDBM only supports LDBM type hash])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
456
	fi
Juan Gomez's avatar
Juan Gomez committed
457
458
459
460
	if test $ol_with_ldbm_api = mdbm -a \
		$ol_with_ldbm_type = btree ; then
		AC_MSG_ERROR([MDBM only supports LDBM type hash])
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
461
462
	if test $ol_with_ldbm_api = ndbm -a \
		$ol_with_ldbm_type = btree ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
463
		AC_MSG_ERROR([NDBM only supports LDBM type hash])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
464
	fi
465

Howard Chu's avatar
Howard Chu committed
466
	if test $ol_enable_bdb = yes -o $ol_enable_hdb = yes ; then
467
468
469
		if test $ol_with_ldbm_api = auto ; then
			ol_with_ldbm_api=berkeley
		elif test $ol_with_ldbm_api != berkeley ; then
Howard Chu's avatar
Howard Chu committed
470
			AC_MSG_ERROR([LDBM API not compatible with BDB/HDB])
471
472
473
474
475
476
477
478
479
		fi

	elif test $ol_enable_bdb = auto ; then
		if test $ol_with_ldbm_api != berkeley \
			-o $ol_with_ldbm_api != auto ; then
			AC_MSG_WARN([LDBM API not compatible with BDB, disabling BDB])
			ol_enable_bdb=no
		fi
	fi
Kurt Zeilenga's avatar
Kurt Zeilenga committed
480
481
482
483
484
fi

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
485
		AC_MSG_ERROR([slurpd requires threads])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
486
487
488
	fi
fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
489
490
491
492
493
494
if test $ol_enable_lmpasswd = yes ; then
	if test $ol_with_tls = no ; then
		AC_MSG_ERROR([LAN Manager passwords require OpenSSL])
	fi
fi

495
496
497
if test $ol_enable_kbind = yes -o $ol_enable_kpasswd = yes ; then
	if test $ol_with_kerberos = no ; then
		AC_MSG_ERROR([options require --with-kerberos])
Kurt Zeilenga's avatar
Kurt Zeilenga committed
498
	elif test $ol_with_kerberos = auto ; then
499
		ol_with_kerberos=yes
500
	fi
501

502
elif test $ol_enable_kbind = no -o $ol_enable_kpasswd = no ; then
503
504
505
	if test $ol_with_kerberos = auto ; then
		ol_with_kerberos=no
	elif test $ol_with_kerberos != no ; then
506
		AC_MSG_WARN([Kerberos detection enabled unnecessarily]);
507
		ol_with_kerberos=no
508
	fi
509
510
fi

511
512
513
514
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
515
	ol_with_cyrus_sasl=yes
516
517
fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
518
519
AC_MSG_RESULT(done)

520
521
dnl ----------------------------------------------------------------
dnl Initialize vars
Kurt Zeilenga's avatar
Kurt Zeilenga committed
522
523
524
525
526
527
528
529
530
531
532
LDAP_LIBS=
LDBM_LIBS=
LTHREAD_LIBS=
LUTIL_LIBS=

SLAPD_LIBS=
SLURPD_LIBS=

BUILD_SLAPD=no
BUILD_SLURPD=no

533
534
BUILD_THREAD=no

535
536
537
BUILD_SLAPI=no
SLAPD_SLAPI_DEPEND=

538
BUILD_BDB=no
539
BUILD_DNSSRV=no
Howard Chu's avatar
Howard Chu committed
540
BUILD_HDB=no
541
BUILD_LDAP=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
542
BUILD_LDBM=no
Pierangelo Masarati's avatar
Pierangelo Masarati committed
543
BUILD_META=no
544
BUILD_MONITOR=no
545
BUILD_CACHE=no
546
BUILD_NULL=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
547
BUILD_PASSWD=no
548
BUILD_PERL=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
549
BUILD_SHELL=no
550
BUILD_SQL=no
551
BUILD_TCL=no
Kurt Zeilenga's avatar
Kurt Zeilenga committed
552

553
BUILD_BDB_DYNAMIC=static
554
BUILD_DNSSRV_DYNAMIC=static
Howard Chu's avatar
Howard Chu committed
555
BUILD_HDB_DYNAMIC=static
Howard Chu's avatar
Howard Chu committed
556
557
BUILD_LDAP_DYNAMIC=static
BUILD_LDBM_DYNAMIC=static
Pierangelo Masarati's avatar
Pierangelo Masarati committed
558
BUILD_META_DYNAMIC=static
559
BUILD_MONITOR_DYNAMIC=static
560
BUILD_NULL_DYNAMIC=static
Howard Chu's avatar
Howard Chu committed
561
562
563
564
BUILD_PASSWD_DYNAMIC=static
BUILD_PERL_DYNAMIC=static
BUILD_SHELL_DYNAMIC=static
BUILD_TCL_DYNAMIC=static
565
BUILD_SQL_DYNAMIC=static
566

567
568
569
SLAPD_MODULES_LDFLAGS=
SLAPD_MODULES_CPPFLAGS=

570
571
572
SLAPD_STATIC_BACKENDS=
SLAPD_DYNAMIC_BACKENDS=

573
SLAPD_PERL_LDFLAGS=
574
575
MOD_PERL_LDFLAGS=
PERL_CPPFLAGS=
576

577
578
579
580
SLAPD_SQL_LDFLAGS=
SLAPD_SQL_LIBS=
SLAPD_SQL_INCLUDES=

581
MOD_TCL_LIB=
582
583
KRB4_LIBS=
KRB5_LIBS=
584
SASL_LIBS=
Kurt Zeilenga's avatar
Kurt Zeilenga committed
585
TERMCAP_LIBS=
Bart Hartgers's avatar
   
Bart Hartgers committed
586
TLS_LIBS=
587
MODULES_LIBS=
588
SLAPI_LIBS=
Pierangelo Masarati's avatar
Pierangelo Masarati committed
589
590
LIBSLAPI=
LIBSLAPITOOLS=
591
AUTH_LIBS=
Kurt Zeilenga's avatar
Kurt Zeilenga committed
592

593
594
SLAPD_SLP_LIBS=

595
dnl ================================================================
Kurt Zeilenga's avatar
Kurt Zeilenga committed
596
597
dnl Checks for programs

Kurt Zeilenga's avatar
Kurt Zeilenga committed
598
AC_PROG_INSTALL
599

600
601
AC_DEFINE(HAVE_MKVERSION, 1, [define this if you have mkversion])

602
dnl ----------------------------------------------------------------
603
604
605
606
dnl
dnl Determine which C translator to use
dnl

607
dnl AIX Thread requires we use cc_r or xlc_r.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
608
609
dnl But only do this IF AIX and CC is not set
dnl and threads are auto|yes|posix.
610
dnl
611
dnl If we find cc_r|xlc_r, force pthreads and assume
612
613
dnl		pthread_create is in $LIBS (ie: don't bring in
dnl		any additional thread libraries)
614
dnl If we do not find cc_r|xlc_r, disable threads
615
616

ol_aix_threads=no
617
case "$target" in
Kurt Zeilenga's avatar
Kurt Zeilenga committed
618
*-*-aix*) dnl all AIX is not a good idea.
619
	if test -z "$CC" ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
620
		case "$ol_with_threads" in
621
		auto | yes |  posix) ol_aix_threads=yes ;;
Kurt Zeilenga's avatar
Kurt Zeilenga committed
622
623
624
625
		esac
	fi
;;
esac
626

627
628
629
630
631
632
633
634
635
636
637
638
639
640
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
641

642
	if test "${CC}" = "cc_r" -o "${CC}" = "xlc_r" ; then
643
644
645
646
647
		ol_with_threads=posix
		ol_cv_pthread_create=yes
	fi
fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
648
if test -z "${CC}"; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
649
	AC_CHECK_PROGS(CC,cc gcc,missing)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
650
651

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

656
657
658
659
if test -z "${AR}"; then
	AC_CHECK_PROGS(AR,ar gar,missing)

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

Howard Chu's avatar
Howard Chu committed
664
AC_LIBTOOL_WIN32_DLL
665
AC_LIBTOOL_DLOPEN
Kurt Zeilenga's avatar
Kurt Zeilenga committed
666
AC_PROG_LIBTOOL
Kurt Zeilenga's avatar
Kurt Zeilenga committed
667

668
669
OL_PROG_LN_H
AC_PROG_LN_S
670

671
672
dnl ----------------------------------------------------------------
dnl Perl
673
674
ol_link_perl=no
if test $ol_enable_perl != no ; then
675
676
677
	AC_PATH_PROG(PERLBIN, perl, /usr/bin/perl)

	if test "no$PERLBIN" = "no" ; then
678
679
680
		if test $ol_enable_perl = yes ; then
			AC_MSG_ERROR([could not locate perl])
		fi
681

682
	else
683
		PERL_CPPFLAGS="`$PERLBIN -MExtUtils::Embed -e ccopts`"
Kurt Zeilenga's avatar
Kurt Zeilenga committed
684
685
		PERL_LDFLAGS="`$PERLBIN -MExtUtils::Embed -e ldopts|sed -e 's/ -lc / /'`"

Kurt Zeilenga's avatar
Kurt Zeilenga committed
686
		if test x"$ol_with_perl_module" = "xstatic" ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
687
			SLAPD_PERL_LDFLAGS="$PERL_LDFLAGS"
688
		else
Kurt Zeilenga's avatar
Kurt Zeilenga committed
689
			MOD_PERL_LDFLAGS="$PERL_LDFLAGS"
690
		fi
691
692
693
		dnl should check perl version
		ol_link_perl=yes
	fi
694
695
fi

696
AC_PROG_CPP
697

698
699
dnl ----------------------------------------------------------------
dnl Cross compiling checks
700
if test $cross_compiling = yes -a $ol_enable_x_compile = yes; then
701
	AC_MSG_WARN([cross compiling....  some functionality will be removed.])
702
703

elif test $cross_compiling = no -a $ol_enable_x_compile = yes; then
704
705
	AC_MSG_WARN([programs compiled here do run here...])
	AC_MSG_ERROR([  if not cross compiling, use --disable-x-compile.])
706
707

elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
708
709
	AC_MSG_WARN([programs compiled here do not run here...])
	AC_MSG_ERROR([  if cross compiling,  add --enable-x-compile.])
710
711
fi

712
dnl ----------------------------------------------------------------
713
dnl Checks for UNIX Variants
Kurt Zeilenga's avatar
Kurt Zeilenga committed
714
715
716
dnl AC_AIX
dnl AC_ISC_POSIX
dnl AC_MINIX
Kurt Zeilenga's avatar
Kurt Zeilenga committed
717

718
dnl ----------------------------------------------------------------
719
720
721
722
723
dnl Checks for system services
AC_CYGWIN
AC_MINGW32
AC_EXEEXT
AC_OBJEXT
724

Kurt Zeilenga's avatar
Kurt Zeilenga committed
725
AC_DEFINE_UNQUOTED(EXEEXT, "${EXEEXT}", [defined to be the EXE extension])
726

727
dnl ----------------------------------------------------------------
728
729
730
dnl BeOS requires -lbe -lroot -lnet
AC_CHECK_LIB(be, be_app, [LIBS="$LIBS -lbe -lroot -lnet"], :, [-lroot -lnet])

731
dnl ----------------------------------------------------------------
732
733
734
dnl OpenLDAP requires STDC features
AM_PROG_CC_STDC
if test "X${am_cv_prog_cc_stdc}" = "Xno" ; then
735
	AC_MSG_ERROR([OpenLDAP requires compiler to support STDC constructs.])
736
737
fi

738
dnl ----------------------------------------------------------------
739
dnl Check cc depend flags
Kurt Zeilenga's avatar
Kurt Zeilenga committed
740
741
742
743
744
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
745

746
747
dnl ----------------------------------------------------------------
dnl Check for AIX security library
748
AC_CHECK_LIB(s, afopen, [
749
750
751
752
	AUTH_LIBS=-ls
	AC_DEFINE(HAVE_AIX_SECURITY,1,[define if you have AIX security lib])
])

753
754
755
756
757
758
759
760
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
761

762
dnl ----------------------------------------------------------------
763
764
765
766
767
768
769
770
771
dnl Check for module support
ol_link_modules=no
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
772
	AC_CHECK_LIB(ltdl, lt_dlinit, [
Kurt Zeilenga's avatar
Kurt Zeilenga committed
773
774
		MODULES_LIBS=-lltdl
		AC_DEFINE(HAVE_LIBLTDL,1,[define if you have libtool -ltdl])
Howard Chu's avatar
Howard Chu committed
775
776
	])

777
778
779
780
781
	if test "$ac_cv_lib_ltdl_lt_dlinit" = no ; then
		AC_MSG_ERROR([could not locate libtool -lltdl])
	fi
	ol_link_modules=yes
else
782
	ol_with_bdb_module=static
783
	ol_with_dnssrv_module=static
Howard Chu's avatar
Howard Chu committed
784
	ol_with_hdb_module=static
785
786
	ol_with_ldap_module=static
	ol_with_ldbm_module=static
Pierangelo Masarati's avatar
Pierangelo Masarati committed
787
	ol_with_meta_module=static
788
	ol_with_monitor_module=static
789
	ol_with_null_module=static
790
791
792
793
	ol_with_passwd_module=static
	ol_with_perl_module=static
	ol_with_shell_module=static
	ol_with_tcl_module=static
794
	ol_with_sql_module=static
795
796
fi

797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
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
AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
if test $am_cv_sys_posix_termios = yes ; then
	AC_DEFINE(HAVE_POSIX_TERMIOS,1,
		[define if you have POSIX termios])
fi

AC_CHECK_HEADERS(	\
	arpa/inet.h		\
	arpa/nameser.h	\
	assert.h		\
Howard Chu's avatar
Howard Chu committed
817
	conio.h			\
818
	crypt.h			\
Howard Chu's avatar
Howard Chu committed
819
	direct.h		\
820
821
822
823
824
	errno.h			\
	fcntl.h			\
	filio.h			\
	getopt.h		\
	grp.h			\
Howard Chu's avatar
Howard Chu committed
825
	io.h			\
826
827
828
829
830
831
832
833
	libutil.h		\
	limits.h		\
	locale.h		\
	netinet/tcp.h	\
	malloc.h		\
	memory.h		\
	psap.h			\
	pwd.h			\
Howard Chu's avatar
Howard Chu committed
834
	process.h		\
835
	resolv.h		\
836
837
838
839
840
841
842
843
844
845
846
847
848
849
	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		\
	sys/resource.h	\
	sys/select.h	\
	sys/socket.h	\
850
	sys/stat.h		\
851
852
853
	sys/syslog.h	\
	sys/time.h		\
	sys/types.h		\
854
	sys/ucred.h		\
855
	sys/uio.h		\
856
857
858
	syslog.h		\
	termios.h		\
	unistd.h		\
859
	winsock.h		\
Howard Chu's avatar
Howard Chu committed
860
	winsock2.h		\
861
862
)

Howard Chu's avatar
Howard Chu committed
863

864
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
865
866
dnl Checks for libraries

867
868
AC_CHECK_FUNC(dlopen, :, [AC_CHECK_LIB(dl, dlopen)])

869
870
871
dnl HP-UX requires -lV3
dnl this is not needed on newer versions of HP-UX
AC_CHECK_LIB(V3, sigset)
872

Howard Chu's avatar
Howard Chu committed
873
874
875
876
877
878
879
880
881
882
883
884
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
AC_MSG_CHECKING(for winsock)
save_LIBS="$LIBS"
for curlib in ws2_32 wsock32; do
	LIBS="$LIBS -l$curlib"
	AC_TRY_LINK([
			char socket@12();
			char select@20();
			char closesocket@4();
			char gethostname@8();
Kurt Zeilenga's avatar
Kurt Zeilenga committed
885
886
			],
			[
Howard Chu's avatar
Howard Chu committed
887
888
889
890
			socket@12();
			select@20();
			closesocket@4();
			gethostname@8();
Kurt Zeilenga's avatar
Kurt Zeilenga committed
891
892
			],
			have_winsock=yes, have_winsock=no)
Howard Chu's avatar
Howard Chu committed
893
894
895

	if test $have_winsock = yes; then
		AC_DEFINE(HAVE_WINSOCK, 1, [define if you have winsock])
896
897
898
899
		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
900
901
902
903
904
905
		if test $curlib = ws2_32; then
			have_winsock=winsock2
			AC_DEFINE(HAVE_WINSOCK2, 1,
				  [define if you have winsock2])
		fi
		break
906
	fi
Howard Chu's avatar
Howard Chu committed
907
908
909
	LIBS="$save_LIBS"
done
AC_MSG_RESULT($have_winsock)
Howard Chu's avatar
Howard Chu committed
910

Kurt Zeilenga's avatar
Kurt Zeilenga committed
911
912
913
914
915
dnl Find socket()
dnl Likely combinations:
dnl		-lsocket [ -lnsl_s | -lnsl ]
dnl		-linet

Kurt Zeilenga's avatar
Kurt Zeilenga committed
916
AC_CHECK_FUNC(socket, :, [	
Kurt Zeilenga's avatar
Kurt Zeilenga committed
917
918
919
920
921
922
923
924
925
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
926
dnl require select
927
928
AC_CHECK_FUNC(select, :, AC_MSG_ERROR([select() required.]))

Howard Chu's avatar
Howard Chu committed
929
if test "${ac_cv_header_winsock_h}" != yes; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
930
931
932
933
	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
934
fi
935

936
dnl check to see if system call automatically restart
937
dnl AC_SYS_RESTARTABLE_SYSCALLS
938

939
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
940
dnl require POSIX regex
941
942
943
944
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
945
AC_SEARCH_LIBS(regfree, [regex gnuregex],
Kurt Zeilenga's avatar
Kurt Zeilenga committed
946
	:, AC_MSG_ERROR([POSIX regex required.]))
947
948
949
950
951
952

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

953
dnl ----------------------------------------------------------------
Kurt Zeilenga's avatar
Kurt Zeilenga committed
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
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

972
dnl For windows, check for the need of RPCRT for UUID function support
Kurt Zeilenga's avatar
Kurt Zeilenga committed
973
974
975
976
977
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"
	AC_TRY_LINK([
978
979
980
981
982
983
984
985
		char UuidCreate@4();
		char UuidToStringA@8();
		],
		[
		UuidCreate@4();
		UuidToStringA@8();
		],
		need_rpcrt=yes, need_rpcrt=no)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
986
987
988
989
990
	if test $need_rpcrt = yes; then
		SLAPD_LIBS="$SLAPD_LIBS -lrpcrt4"
	fi
	LIBS="$save_LIBS"
	AC_MSG_RESULT($need_rpcrt)
991
992
fi

993
dnl ----------------------------------------------------------------
994
dnl Check for resolver routines
995
996
dnl	  need to check for both res_query and __res_query
dnl   need to check -lc, -lbind, and -lresolv
997
998
ol_link_dnssrv=no
AC_CHECK_FUNC(res_query,:)
999
1000
if test $ac_cv_func_res_query = no ; then 
	AC_CHECK_FUNC(__res_query,:)