xref: /netbsd-src/external/bsd/openldap/dist/build/openldap.m4 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1dnl OpenLDAP Autoconf Macros
2dnl $OpenLDAP$
3dnl This work is part of OpenLDAP Software <http://www.openldap.org/>.
4dnl
5dnl Copyright 1998-2017 The OpenLDAP Foundation.
6dnl All rights reserved.
7dnl
8dnl Redistribution and use in source and binary forms, with or without
9dnl modification, are permitted only as authorized by the OpenLDAP
10dnl Public License.
11dnl
12dnl A copy of this license is available in the file LICENSE in the
13dnl top-level directory of the distribution or, alternatively, at
14dnl <http://www.OpenLDAP.org/license.html>.
15dnl
16dnl --------------------------------------------------------------------
17dnl Restricted form of AC_ARG_ENABLE that limits user options
18dnl
19dnl $1 = option name
20dnl $2 = help-string
21dnl $3 = default value	(auto).  "--" means do not set it by default
22dnl $4 = allowed values (auto yes no)
23dnl $5 = overridden default
24AC_DEFUN([OL_ARG_ENABLE], [# OpenLDAP --enable-$1
25	pushdef([ol_DefVal],ifelse($3,,auto,$3))
26	AC_ARG_ENABLE($1,ifelse($4,,[$2],[$2] translit([$4],[ ],[|])) ifelse($3,--,,@<:@ol_DefVal@:>@),[
27	ol_arg=invalid
28	for ol_val in ifelse($4,,[auto yes no],[$4]) ; do
29		if test "$enableval" = "$ol_val" ; then
30			ol_arg="$ol_val"
31		fi
32	done
33	if test "$ol_arg" = "invalid" ; then
34		AC_MSG_ERROR(bad value $enableval for --enable-$1)
35	fi
36	ol_enable_$1="$ol_arg"
37]ifelse($3,--,,[,
38[	ol_enable_$1=ifelse($5,,ol_DefVal,[${]$5[:-]ol_DefVal[}])]]))dnl
39dnl AC_MSG_RESULT([OpenLDAP -enable-$1 $ol_enable_$1])
40	popdef([ol_DefVal])
41# end --enable-$1
42])dnl
43dnl
44dnl --------------------------------------------------------------------
45dnl Restricted form of AC_ARG_WITH that limits user options
46dnl
47dnl $1 = option name
48dnl $2 = help-string
49dnl $3 = default value (no)
50dnl $4 = allowed values (yes or no)
51AC_DEFUN([OL_ARG_WITH], [# OpenLDAP --with-$1
52	AC_ARG_WITH($1,[$2 @<:@]ifelse($3,,yes,$3)@:>@,[
53	ol_arg=invalid
54	for ol_val in ifelse($4,,[yes no],[$4]) ; do
55		if test "$withval" = "$ol_val" ; then
56			ol_arg="$ol_val"
57		fi
58	done
59	if test "$ol_arg" = "invalid" ; then
60		AC_MSG_ERROR(bad value $withval for --with-$1)
61	fi
62	ol_with_$1="$ol_arg"
63],
64[	ol_with_$1=ifelse($3,,"no","$3")])dnl
65dnl AC_MSG_RESULT([OpenLDAP --with-$1 $ol_with_$1])
66# end --with-$1
67])dnl
68dnl ====================================================================
69dnl Check for dependency generation flag
70AC_DEFUN([OL_MKDEPEND], [# test for make depend flag
71OL_MKDEP=
72OL_MKDEP_FLAGS=
73if test -z "${MKDEP}"; then
74	OL_MKDEP="${CC-cc}"
75	if test -z "${MKDEP_FLAGS}"; then
76		AC_CACHE_CHECK([for ${OL_MKDEP} depend flag], ol_cv_mkdep, [
77			ol_cv_mkdep=no
78			for flag in "-M" "-xM"; do
79				cat > conftest.c <<EOF
80 noCode;
81EOF
82				if AC_TRY_COMMAND($OL_MKDEP $flag conftest.c) \
83					| grep '^conftest\.'"${ac_objext}" >/dev/null 2>&1
84				then
85					if test ! -f conftest."${ac_object}" ; then
86						ol_cv_mkdep=$flag
87						OL_MKDEP_FLAGS="$flag"
88						break
89					fi
90				fi
91			done
92			rm -f conftest*
93		])
94		test "$ol_cv_mkdep" = no && OL_MKDEP=":"
95	else
96		cc_cv_mkdep=yes
97		OL_MKDEP_FLAGS="${MKDEP_FLAGS}"
98	fi
99else
100	cc_cv_mkdep=yes
101	OL_MKDEP="${MKDEP}"
102	OL_MKDEP_FLAGS="${MKDEP_FLAGS}"
103fi
104AC_SUBST(OL_MKDEP)
105AC_SUBST(OL_MKDEP_FLAGS)
106])
107dnl
108dnl ====================================================================
109dnl Check if system uses EBCDIC instead of ASCII
110AC_DEFUN([OL_CPP_EBCDIC], [# test for EBCDIC
111AC_CACHE_CHECK([for EBCDIC],ol_cv_cpp_ebcdic,[
112	AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
113#if !('M' == 0xd4)
114#include <__ASCII__/generate_error.h>
115#endif
116]])],[ol_cv_cpp_ebcdic=yes],[ol_cv_cpp_ebcdic=no])])
117if test $ol_cv_cpp_ebcdic = yes ; then
118	AC_DEFINE(HAVE_EBCDIC,1, [define if system uses EBCDIC instead of ASCII])
119fi
120])
121dnl
122dnl --------------------------------------------------------------------
123dnl Check for MSVC
124AC_DEFUN([OL_MSVC],
125[AC_REQUIRE_CPP()dnl
126AC_CACHE_CHECK([whether we are using MS Visual C++], ol_cv_msvc,
127[AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
128#ifndef _MSC_VER
129#include <__FOO__/generate_error.h>
130#endif
131]])],[ol_cv_msvc=yes],[ol_cv_msvc=no])])])
132
133dnl --------------------------------------------------------------------
134dnl OpenLDAP version of STDC header check w/ EBCDIC support
135AC_DEFUN([OL_HEADER_STDC],
136[AC_REQUIRE_CPP()dnl
137AC_REQUIRE([OL_CPP_EBCDIC])dnl
138AC_CACHE_CHECK([for ANSI C header files], ol_cv_header_stdc,
139[AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
140#include <stdarg.h>
141#include <string.h>
142#include <float.h>]])],[ol_cv_header_stdc=yes],[ol_cv_header_stdc=no])
143
144if test $ol_cv_header_stdc = yes; then
145  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
146AC_EGREP_HEADER(memchr, string.h, , ol_cv_header_stdc=no)
147fi
148
149if test $ol_cv_header_stdc = yes; then
150  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
151AC_EGREP_HEADER(free, stdlib.h, , ol_cv_header_stdc=no)
152fi
153
154if test $ol_cv_header_stdc = yes; then
155  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
156AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <ctype.h>
157#ifndef HAVE_EBCDIC
158#	define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
159#	define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
160#else
161#	define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
162		|| ('j' <= (c) && (c) <= 'r') \
163		|| ('s' <= (c) && (c) <= 'z'))
164#	define TOUPPER(c)	(ISLOWER(c) ? ((c) | 0x40) : (c))
165#endif
166#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
167int main () { int i; for (i = 0; i < 256; i++)
168if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
169exit (0); }
170]])],[],[ol_cv_header_stdc=no],[:])
171fi])
172if test $ol_cv_header_stdc = yes; then
173  AC_DEFINE(STDC_HEADERS)
174fi
175ac_cv_header_stdc=disable
176])
177dnl
178dnl ====================================================================
179dnl DNS resolver macros
180AC_DEFUN([OL_RESOLVER_TRY],
181[if test $ol_cv_lib_resolver = no ; then
182	AC_CACHE_CHECK([for resolver link (]ifelse($2,,default,$2)[)],[$1],
183[
184	ol_RESOLVER_LIB=ifelse($2,,,$2)
185	ol_LIBS=$LIBS
186	LIBS="$ol_RESOLVER_LIB $LIBS"
187
188	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
189#ifdef HAVE_SYS_TYPES_H
190#	include <sys/types.h>
191#endif
192#include <netinet/in.h>
193#ifdef HAVE_ARPA_NAMESER_H
194#	include <arpa/nameser.h>
195#endif
196#ifdef HAVE_RESOLV_H
197#	include <resolv.h>
198#endif
199]], [[{
200	int len, status;
201	char *request = NULL;
202	unsigned char reply[64*1024];
203	unsigned char host[64*1024];
204	unsigned char *p;
205
206#ifdef NS_HFIXEDSZ
207	/* Bind 8/9 interface */
208	len = res_query(request, ns_c_in, ns_t_srv, reply, sizeof(reply));
209#else
210	/* Bind 4 interface */
211# ifndef T_SRV
212#  define T_SRV 33
213# endif
214	len = res_query(request, C_IN, T_SRV, reply, sizeof(reply));
215#endif
216	p = reply;
217#ifdef NS_HFIXEDSZ
218	/* Bind 8/9 interface */
219	p += NS_HFIXEDSZ;
220#elif defined(HFIXEDSZ)
221	/* Bind 4 interface w/ HFIXEDSZ */
222	p += HFIXEDSZ;
223#else
224	/* Bind 4 interface w/o HFIXEDSZ */
225	p += sizeof(HEADER);
226#endif
227	status = dn_expand( reply, reply+len, p, host, sizeof(host));
228}]])],[$1=yes],[$1=no])
229
230	LIBS="$ol_LIBS"
231])
232
233	if test $$1 = yes ; then
234		ol_cv_lib_resolver=ifelse($2,,yes,$2)
235	fi
236fi
237])
238dnl --------------------------------------------------------------------
239dnl Try to locate appropriate library
240AC_DEFUN([OL_RESOLVER_LINK],
241[ol_cv_lib_resolver=no
242OL_RESOLVER_TRY(ol_cv_resolver_none)
243OL_RESOLVER_TRY(ol_cv_resolver_resolv,[-lresolv])
244OL_RESOLVER_TRY(ol_cv_resolver_bind,[-lbind])
245])
246dnl
247dnl ====================================================================
248dnl International Components for Unicode (ICU)
249AC_DEFUN([OL_ICU],
250[ol_icu=no
251AC_CHECK_HEADERS( unicode/utypes.h )
252if test $ac_cv_header_unicode_utypes_h = yes ; then
253	dnl OL_ICULIBS="-licui18n -licuuc -licudata"
254	OL_ICULIBS="-licuuc -licudata"
255
256	AC_CACHE_CHECK([for ICU libraries], [ol_cv_lib_icu], [
257		ol_LIBS="$LIBS"
258		LIBS="$OL_ICULIBS $LIBS"
259		AC_LINK_IFELSE([AC_LANG_PROGRAM([[
260#include <unicode/utypes.h>
261]], [[
262(void) u_errorName(0);
263]])],[ol_cv_lib_icu=yes],[ol_cv_lib_icu=no])
264		LIBS="$ol_LIBS"
265])
266
267	if test $ol_cv_lib_icu != no ; then
268		ol_icu="$OL_ICULIBS"
269		AC_DEFINE(HAVE_ICU,1,[define if you actually have ICU])
270	fi
271fi
272])
273dnl
274dnl ====================================================================
275dnl Berkeley DB macros
276dnl
277dnl --------------------------------------------------------------------
278dnl Try to link
279AC_DEFUN([OL_BERKELEY_DB_TRY],
280[if test $ol_cv_lib_db = no ; then
281	AC_CACHE_CHECK([for Berkeley DB link (]ifelse($2,,default,$2)[)],[$1],
282[
283	ol_DB_LIB=ifelse($2,,,$2)
284	ol_LIBS=$LIBS
285	LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
286
287	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
288#ifdef HAVE_DB_185_H
289# include <db_185.h>
290#else
291# include <db.h>
292#endif
293
294#ifndef DB_VERSION_MAJOR
295# define DB_VERSION_MAJOR 1
296#endif
297
298#ifndef NULL
299#define NULL ((void*)0)
300#endif
301]], [[
302#if DB_VERSION_MAJOR > 2
303	db_env_create( NULL, 0 );
304#elif DB_VERSION_MAJOR > 1
305	db_appexit( NULL );
306#else
307	(void) dbopen( NULL, 0, 0, 0, NULL);
308#endif
309]])],[$1=yes],[$1=no])
310
311	LIBS="$ol_LIBS"
312])
313
314	if test $$1 = yes ; then
315		ol_cv_lib_db=ifelse($2,,yes,$2)
316	fi
317fi
318])
319dnl
320dnl --------------------------------------------------------------------
321dnl Get major and minor version from <db.h>
322AC_DEFUN([OL_BDB_HEADER_VERSION],
323[AC_CACHE_CHECK([for Berkeley DB major version in db.h], [ol_cv_bdb_major],[
324	AC_LANG_CONFTEST([
325#include <db.h>
326#ifndef DB_VERSION_MAJOR
327#	define DB_VERSION_MAJOR 1
328#endif
329__db_version DB_VERSION_MAJOR
330])
331	set X `eval "$ac_cpp -P conftest.$ac_ext" | $EGREP __db_version` none none
332	ol_cv_bdb_major=${3}
333])
334case $ol_cv_bdb_major in [[1-9]]*) : ;; *)
335	AC_MSG_ERROR([Unknown Berkeley DB major version in db.h]) ;;
336esac
337
338dnl Determine minor version
339AC_CACHE_CHECK([for Berkeley DB minor version in db.h], [ol_cv_bdb_minor],[
340	AC_LANG_CONFTEST([
341#include <db.h>
342#ifndef DB_VERSION_MINOR
343#	define DB_VERSION_MINOR 0
344#endif
345__db_version DB_VERSION_MINOR
346])
347	set X `eval "$ac_cpp -P conftest.$ac_ext" | $EGREP __db_version` none none
348	ol_cv_bdb_minor=${3}
349])
350case $ol_cv_bdb_minor in [[0-9]]*) : ;; *)
351	AC_MSG_ERROR([Unknown Berkeley DB minor version in db.h]) ;;
352esac
353])
354dnl
355dnl --------------------------------------------------------------------
356dnl Try to locate appropriate library
357AC_DEFUN([OL_BERKELEY_DB_LINK],
358[ol_cv_lib_db=no
359
360if test $ol_cv_bdb_major = 5 ; then
361	OL_BERKELEY_DB_TRY(ol_cv_db_db_5_dot_m,[-ldb-5.$ol_cv_bdb_minor])
362	OL_BERKELEY_DB_TRY(ol_cv_db_db5m,[-ldb5$ol_cv_bdb_minor])
363	OL_BERKELEY_DB_TRY(ol_cv_db_db_5m,[-ldb-5$ol_cv_bdb_minor])
364	OL_BERKELEY_DB_TRY(ol_cv_db_db_5_m,[-ldb-5-$ol_cv_bdb_minor])
365	OL_BERKELEY_DB_TRY(ol_cv_db_db_5,[-ldb-5])
366	OL_BERKELEY_DB_TRY(ol_cv_db_db5,[-ldb5])
367elif test $ol_cv_bdb_major = 4 ; then
368	OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_m,[-ldb-4.$ol_cv_bdb_minor])
369	OL_BERKELEY_DB_TRY(ol_cv_db_db4m,[-ldb4$ol_cv_bdb_minor])
370	OL_BERKELEY_DB_TRY(ol_cv_db_db_4m,[-ldb-4$ol_cv_bdb_minor])
371	OL_BERKELEY_DB_TRY(ol_cv_db_db_4_m,[-ldb-4-$ol_cv_bdb_minor])
372	OL_BERKELEY_DB_TRY(ol_cv_db_db_4,[-ldb-4])
373	OL_BERKELEY_DB_TRY(ol_cv_db_db4,[-ldb4])
374fi
375OL_BERKELEY_DB_TRY(ol_cv_db_db,[-ldb])
376OL_BERKELEY_DB_TRY(ol_cv_db_none)
377])
378dnl
379dnl --------------------------------------------------------------------
380dnl Check if Berkeley DB version
381AC_DEFUN([OL_BERKELEY_DB_VERSION],
382[AC_CACHE_CHECK([for Berkeley DB library and header version match], [ol_cv_berkeley_db_version], [
383	ol_LIBS="$LIBS"
384	LIBS="$LTHREAD_LIBS $LIBS"
385	if test $ol_cv_lib_db != yes ; then
386		LIBS="$ol_cv_lib_db $LIBS"
387	fi
388
389	AC_RUN_IFELSE([AC_LANG_SOURCE([[
390#ifdef HAVE_DB_185_H
391	choke me;
392#else
393#include <db.h>
394#endif
395#ifndef DB_VERSION_MAJOR
396# define DB_VERSION_MAJOR 1
397#endif
398#ifndef NULL
399#define NULL ((void *)0)
400#endif
401main()
402{
403#if DB_VERSION_MAJOR > 1
404	char *version;
405	int major, minor, patch;
406
407	version = db_version( &major, &minor, &patch );
408
409	if( major != DB_VERSION_MAJOR ||
410		minor != DB_VERSION_MINOR ||
411		patch != DB_VERSION_PATCH )
412	{
413		printf("Berkeley DB version mismatch\n"
414			"\theader: %s\n\tlibrary: %s\n",
415			DB_VERSION_STRING, version);
416		return 1;
417	}
418#endif
419
420	return 0;
421}]])],[ol_cv_berkeley_db_version=yes],[ol_cv_berkeley_db_version=no],[ol_cv_berkeley_db_version=cross])
422
423	LIBS="$ol_LIBS"
424])
425
426	if test $ol_cv_berkeley_db_version = no ; then
427		AC_MSG_ERROR([Berkeley DB version mismatch])
428	fi
429])dnl
430dnl
431dnl --------------------------------------------------------------------
432dnl Check if Berkeley DB supports DB_THREAD
433AC_DEFUN([OL_BERKELEY_DB_THREAD],
434[AC_CACHE_CHECK([for Berkeley DB thread support], [ol_cv_berkeley_db_thread], [
435	ol_LIBS="$LIBS"
436	LIBS="$LTHREAD_LIBS $LIBS"
437	if test $ol_cv_lib_db != yes ; then
438		LIBS="$ol_cv_lib_db $LIBS"
439	fi
440
441	AC_RUN_IFELSE([AC_LANG_SOURCE([[
442#ifdef HAVE_DB_185_H
443	choke me;
444#else
445#include <db.h>
446#endif
447#ifndef NULL
448#define NULL ((void *)0)
449#endif
450main()
451{
452	int rc;
453	u_int32_t flags = DB_CREATE |
454#ifdef DB_PRIVATE
455		DB_PRIVATE |
456#endif
457		DB_THREAD;
458
459#if DB_VERSION_MAJOR > 2
460	DB_ENV *env = NULL;
461
462	rc = db_env_create( &env, 0 );
463
464	flags |= DB_INIT_MPOOL;
465#ifdef DB_MPOOL_PRIVATE
466	flags |= DB_MPOOL_PRIVATE;
467#endif
468
469	if( rc ) {
470		printf("BerkeleyDB: %s\n", db_strerror(rc) );
471		return rc;
472	}
473
474#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
475	rc = (env->open)( env, NULL, flags, 0 );
476#else
477	rc = (env->open)( env, NULL, NULL, flags, 0 );
478#endif
479
480	if ( rc == 0 ) {
481		rc = env->close( env, 0 );
482	}
483
484	if( rc ) {
485		printf("BerkeleyDB: %s\n", db_strerror(rc) );
486		return rc;
487	}
488
489#else
490	DB_ENV env;
491	memset( &env, '\0', sizeof(env) );
492
493	rc = db_appinit( NULL, NULL, &env, flags );
494
495	if( rc == 0 ) {
496		db_appexit( &env );
497	}
498
499	unlink("__db_mpool.share");
500	unlink("__db_lock.share");
501#endif
502
503	return rc;
504}]])],[ol_cv_berkeley_db_thread=yes],[ol_cv_berkeley_db_thread=no],[ol_cv_berkeley_db_thread=cross])
505
506	LIBS="$ol_LIBS"
507])
508
509	if test $ol_cv_berkeley_db_thread != no ; then
510		AC_DEFINE(HAVE_BERKELEY_DB_THREAD, 1,
511			[define if Berkeley DB has DB_THREAD support])
512	fi
513])dnl
514dnl
515dnl --------------------------------------------------------------------
516dnl Find any DB
517AC_DEFUN([OL_BERKELEY_DB],
518[ol_cv_berkeley_db=no
519AC_CHECK_HEADERS(db.h)
520if test $ac_cv_header_db_h = yes; then
521	OL_BDB_HEADER_VERSION
522	OL_BDB_COMPAT
523
524	if test $ol_cv_bdb_compat != yes ; then
525		AC_MSG_ERROR([BerkeleyDB version incompatible with BDB/HDB backends])
526	fi
527
528	OL_BERKELEY_DB_LINK
529	if test "$ol_cv_lib_db" != no ; then
530		ol_cv_berkeley_db=yes
531		OL_BERKELEY_DB_VERSION
532		OL_BERKELEY_DB_THREAD
533	fi
534fi
535])
536dnl --------------------------------------------------------------------
537dnl Check for version compatility with back-bdb
538AC_DEFUN([OL_BDB_COMPAT],
539[AC_CACHE_CHECK([if Berkeley DB version supported by BDB/HDB backends], [ol_cv_bdb_compat],[
540	AC_EGREP_CPP(__db_version_compat,[
541#include <db.h>
542
543 /* this check could be improved */
544#ifndef DB_VERSION_MAJOR
545#	define DB_VERSION_MAJOR 1
546#endif
547#ifndef DB_VERSION_MINOR
548#	define DB_VERSION_MINOR 0
549#endif
550#ifndef DB_VERSION_PATCH
551#      define DB_VERSION_PATCH 0
552#endif
553
554#define DB_VERSION_FULL        ((DB_VERSION_MAJOR<<16)|(DB_VERSION_MINOR<<8)|DB_VERSION_PATCH)
555
556/* require 4.4 or later, but less than 6.0.20 */
557#if DB_VERSION_FULL >= 0x040400 && DB_VERSION_FULL < 0x060014
558	__db_version_compat
559#endif
560#if DB_VERSION_FULL >= 0x060014
561#error "BerkeleyDB 6.0.20+ license is incompatible with LDAP"
562#endif
563	], [ol_cv_bdb_compat=yes], [ol_cv_bdb_compat=no])])
564])
565
566dnl
567dnl ====================================================================
568dnl Check POSIX Thread version
569dnl
570dnl defines ol_cv_pthread_version to 4, 5, 6, 7, 8, 10, depending on the
571dnl	version of the POSIX.4a Draft that is implemented.
572dnl	10 == POSIX.4a Final == POSIX.1c-1996 for our purposes.
573dnl	Existence of pthread.h should be tested separately.
574dnl
575dnl tests:
576dnl	pthread_detach() was dropped in Draft 8, it is present
577dnl		in every other version
578dnl	PTHREAD_CREATE_UNDETACHED is only in Draft 7, it was called
579dnl		PTHREAD_CREATE_JOINABLE after that
580dnl	pthread_attr_create was renamed to pthread_attr_init in Draft 6.
581dnl		Draft 6-10 has _init, Draft 4-5 has _create.
582dnl	pthread_attr_default was dropped in Draft 6, only 4 and 5 have it
583dnl	PTHREAD_MUTEX_INITIALIZER was introduced in Draft 5. It's not
584dnl		interesting to us because we don't try to statically
585dnl		initialize mutexes. 5-10 has it.
586dnl
587dnl Draft 9 and 10 are equivalent for our purposes.
588dnl
589AC_DEFUN([OL_POSIX_THREAD_VERSION],
590[AC_CACHE_CHECK([POSIX thread version],[ol_cv_pthread_version],[
591	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
592#		include <pthread.h>
593	]], [[
594		int i = PTHREAD_CREATE_JOINABLE;
595	]])],[
596	AC_EGREP_HEADER(pthread_detach,pthread.h,
597	ol_cv_pthread_version=10, ol_cv_pthread_version=8)],[
598	AC_EGREP_CPP(draft7,[
599#		include <pthread.h>
600#		ifdef PTHREAD_CREATE_UNDETACHED
601		draft7
602#		endif
603	], ol_cv_pthread_version=7, [
604	AC_EGREP_HEADER(pthread_attr_init,pthread.h,
605	ol_cv_pthread_version=6, [
606	AC_EGREP_CPP(draft5,[
607#		include <pthread.h>
608#ifdef		PTHREAD_MUTEX_INITIALIZER
609		draft5
610#endif
611	], ol_cv_pthread_version=5, ol_cv_pthread_version=4) ]) ]) ])
612])
613])dnl
614dnl
615dnl --------------------------------------------------------------------
616AC_DEFUN([OL_PTHREAD_TEST_INCLUDES], [[
617/* pthread test headers */
618#include <pthread.h>
619#if HAVE_PTHREADS < 7
620#include <errno.h>
621#endif
622#ifndef NULL
623#define NULL (void*)0
624#endif
625
626static void *task(p)
627	void *p;
628{
629	return (void *) (p == NULL);
630}
631]])
632AC_DEFUN([OL_PTHREAD_TEST_FUNCTION],[[
633	/* pthread test function */
634#ifndef PTHREAD_CREATE_DETACHED
635#define	PTHREAD_CREATE_DETACHED	1
636#endif
637	pthread_t t;
638	int status;
639	int detach = PTHREAD_CREATE_DETACHED;
640
641#if HAVE_PTHREADS > 4
642	/* Final pthreads */
643	pthread_attr_t attr;
644
645	status = pthread_attr_init(&attr);
646	if( status ) return status;
647
648#if HAVE_PTHREADS < 7
649	status = pthread_attr_setdetachstate(&attr, &detach);
650	if( status < 0 ) status = errno;
651#else
652	status = pthread_attr_setdetachstate(&attr, detach);
653#endif
654	if( status ) return status;
655	status = pthread_create( &t, &attr, task, NULL );
656#if HAVE_PTHREADS < 7
657	if( status < 0 ) status = errno;
658#endif
659	if( status ) return status;
660#else
661	/* Draft 4 pthreads */
662	status = pthread_create( &t, pthread_attr_default, task, NULL );
663	if( status ) return errno;
664
665	/* give thread a chance to complete */
666	/* it should remain joinable and hence detachable */
667	sleep( 1 );
668
669	status = pthread_detach( &t );
670	if( status ) return errno;
671#endif
672
673#ifdef HAVE_LINUX_THREADS
674	pthread_kill_other_threads_np();
675#endif
676
677	return 0;
678]])
679
680AC_DEFUN([OL_PTHREAD_TEST_PROGRAM],
681AC_LANG_SOURCE([OL_PTHREAD_TEST_INCLUDES
682
683int main(argc, argv)
684	int argc;
685	char **argv;
686{
687OL_PTHREAD_TEST_FUNCTION
688}
689]))
690dnl --------------------------------------------------------------------
691AC_DEFUN([OL_PTHREAD_TRY], [# Pthread try link: $1 ($2)
692if test "$ol_link_threads" = no ; then
693	# try $1
694	AC_CACHE_CHECK([for pthread link with $1], [$2], [
695		# save the flags
696		ol_LIBS="$LIBS"
697		LIBS="$1 $LIBS"
698
699		AC_RUN_IFELSE([OL_PTHREAD_TEST_PROGRAM],
700			[$2=yes],
701			[$2=no],
702			[AC_LINK_IFELSE([AC_LANG_PROGRAM(OL_PTHREAD_TEST_INCLUDES,
703				OL_PTHREAD_TEST_FUNCTION)],
704				[$2=yes], [$2=no])])
705
706		# restore the LIBS
707		LIBS="$ol_LIBS"
708	])
709
710	if test $$2 = yes ; then
711		ol_link_pthreads="$1"
712		ol_link_threads=posix
713	fi
714fi
715])
716dnl
717dnl ====================================================================
718dnl Check GNU Pth pthread Header
719dnl
720dnl defines ol_cv_header linux_threads to 'yes' or 'no'
721dnl		'no' implies pthreads.h is not LinuxThreads or pthreads.h
722dnl		doesn't exists.  Existance of pthread.h should separately
723dnl		checked.
724dnl
725AC_DEFUN([OL_HEADER_GNU_PTH_PTHREAD_H], [
726	AC_CACHE_CHECK([for GNU Pth pthread.h],
727		[ol_cv_header_gnu_pth_pthread_h],
728		[AC_EGREP_CPP(__gnu_pth__,
729			[#include <pthread.h>
730#ifdef _POSIX_THREAD_IS_GNU_PTH
731	__gnu_pth__;
732#endif
733],
734			[ol_cv_header_gnu_pth_pthread_h=yes],
735			[ol_cv_header_gnu_pth_pthread_h=no])
736		])
737])dnl
738dnl ====================================================================
739dnl Check for NT Threads
740AC_DEFUN([OL_NT_THREADS], [
741	AC_CHECK_FUNC(_beginthread)
742
743	if test $ac_cv_func__beginthread = yes ; then
744		AC_DEFINE(HAVE_NT_THREADS,1,[if you have NT Threads])
745		ol_cv_nt_threads=yes
746	fi
747])
748dnl ====================================================================
749dnl Check LinuxThreads Header
750dnl
751dnl defines ol_cv_header linux_threads to 'yes' or 'no'
752dnl		'no' implies pthreads.h is not LinuxThreads or pthreads.h
753dnl		doesn't exists.  Existance of pthread.h should separately
754dnl		checked.
755dnl
756AC_DEFUN([OL_HEADER_LINUX_THREADS], [
757	AC_CACHE_CHECK([for LinuxThreads pthread.h],
758		[ol_cv_header_linux_threads],
759		[AC_EGREP_CPP(pthread_kill_other_threads_np,
760			[#include <pthread.h>],
761			[ol_cv_header_linux_threads=yes],
762			[ol_cv_header_linux_threads=no])
763		])
764	if test $ol_cv_header_linux_threads = yes; then
765		AC_DEFINE(HAVE_LINUX_THREADS,1,[if you have LinuxThreads])
766	fi
767])dnl
768dnl --------------------------------------------------------------------
769dnl	Check LinuxThreads Implementation
770dnl
771dnl	defines ol_cv_sys_linux_threads to 'yes' or 'no'
772dnl	'no' implies pthreads implementation is not LinuxThreads.
773dnl
774AC_DEFUN([OL_SYS_LINUX_THREADS], [
775	AC_CHECK_FUNCS(pthread_kill_other_threads_np)
776	AC_CACHE_CHECK([for LinuxThreads implementation],
777		[ol_cv_sys_linux_threads],
778		[ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np])
779])dnl
780dnl
781dnl --------------------------------------------------------------------
782dnl Check LinuxThreads consistency
783AC_DEFUN([OL_LINUX_THREADS], [
784	AC_REQUIRE([OL_HEADER_LINUX_THREADS])
785	AC_REQUIRE([OL_SYS_LINUX_THREADS])
786	AC_CACHE_CHECK([for LinuxThreads consistency], [ol_cv_linux_threads], [
787		if test $ol_cv_header_linux_threads = yes &&
788		   test $ol_cv_sys_linux_threads = yes; then
789			ol_cv_linux_threads=yes
790		elif test $ol_cv_header_linux_threads = no &&
791		     test $ol_cv_sys_linux_threads = no; then
792			ol_cv_linux_threads=no
793		else
794			ol_cv_linux_threads=error
795		fi
796	])
797])dnl
798dnl
799dnl ====================================================================
800dnl Check for POSIX Regex
801AC_DEFUN([OL_POSIX_REGEX], [
802AC_CACHE_CHECK([for compatible POSIX regex],ol_cv_c_posix_regex,[
803	AC_RUN_IFELSE([AC_LANG_SOURCE([[
804#include <sys/types.h>
805#include <regex.h>
806static char *pattern, *string;
807main()
808{
809	int rc;
810	regex_t re;
811
812	pattern = "^A";
813
814	if(regcomp(&re, pattern, 0)) {
815		return -1;
816	}
817
818	string = "ALL MATCH";
819
820	rc = regexec(&re, string, 0, (void*)0, 0);
821
822	regfree(&re);
823
824	return rc;
825}]])],[ol_cv_c_posix_regex=yes],[ol_cv_c_posix_regex=no],[ol_cv_c_posix_regex=cross])])
826])
827dnl
828dnl ====================================================================
829dnl Check if toupper() requires islower() to be called first
830AC_DEFUN([OL_C_UPPER_LOWER],
831[AC_CACHE_CHECK([if toupper() requires islower()],ol_cv_c_upper_lower,[
832	AC_RUN_IFELSE([AC_LANG_SOURCE([[
833#include <ctype.h>
834main()
835{
836	if ('C' == toupper('C'))
837		exit(0);
838	else
839		exit(1);
840}]])],[ol_cv_c_upper_lower=no],[ol_cv_c_upper_lower=yes],[ol_cv_c_upper_lower=safe])])
841if test $ol_cv_c_upper_lower != no ; then
842	AC_DEFINE(C_UPPER_LOWER,1, [define if toupper() requires islower()])
843fi
844])
845dnl
846dnl ====================================================================
847dnl Error string checks
848dnl
849dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
850dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
851dnl Reported by Keith Bostic.
852AC_DEFUN([OL_SYS_ERRLIST],
853[AC_CACHE_CHECK([declaration of sys_errlist],ol_cv_dcl_sys_errlist,[
854	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
855#include <stdio.h>
856#include <sys/types.h>
857#include <errno.h>
858#ifdef _WIN32
859#include <stdlib.h>
860#endif ]], [[char *c = (char *) *sys_errlist]])],[ol_cv_dcl_sys_errlist=yes
861	ol_cv_have_sys_errlist=yes],[ol_cv_dcl_sys_errlist=no])])
862#
863# It's possible (for near-UNIX clones) that sys_errlist doesn't exist
864if test $ol_cv_dcl_sys_errlist = no ; then
865	AC_DEFINE(DECL_SYS_ERRLIST,1,
866		[define if sys_errlist is not declared in stdio.h or errno.h])
867
868	AC_CACHE_CHECK([existence of sys_errlist],ol_cv_have_sys_errlist,[
869		AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]], [[char *c = (char *) *sys_errlist]])],[ol_cv_have_sys_errlist=yes],[ol_cv_have_sys_errlist=no])])
870fi
871if test $ol_cv_have_sys_errlist = yes ; then
872	AC_DEFINE(HAVE_SYS_ERRLIST,1,
873		[define if you actually have sys_errlist in your libs])
874fi
875])dnl
876AC_DEFUN([OL_NONPOSIX_STRERROR_R],
877[AC_CACHE_CHECK([non-posix strerror_r],ol_cv_nonposix_strerror_r,[
878	AC_EGREP_CPP(strerror_r,[#include <string.h>],
879		ol_decl_strerror_r=yes, ol_decl_strerror_r=no)dnl
880
881	if test $ol_decl_strerror_r = yes ; then
882		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[   /* from autoconf 2.59 */
883				char buf[100];
884				char x = *strerror_r (0, buf, sizeof buf);
885				char *p = strerror_r (0, buf, sizeof buf);
886			]])],[ol_cv_nonposix_strerror_r=yes],[ol_cv_nonposix_strerror_r=no])
887	else
888		AC_RUN_IFELSE([AC_LANG_SOURCE([[
889			main() {
890				char buf[100];
891				buf[0] = 0;
892				strerror_r( 1, buf, sizeof buf );
893				exit( buf[0] == 0 );
894			}
895			]])],[ol_cv_nonposix_strerror_r=yes],[ol_cv_nonposix_strerror=no],[ol_cv_nonposix_strerror=no])
896	fi
897	])
898if test $ol_cv_nonposix_strerror_r = yes ; then
899	AC_DEFINE(HAVE_NONPOSIX_STRERROR_R,1,
900		[define if strerror_r returns char* instead of int])
901fi
902])dnl
903dnl
904AC_DEFUN([OL_STRERROR],
905[OL_SYS_ERRLIST dnl TEMPORARY
906AC_CHECK_FUNCS(strerror strerror_r)
907ol_cv_func_strerror_r=no
908if test "${ac_cv_func_strerror_r}" = yes ; then
909	OL_NONPOSIX_STRERROR_R
910elif test "${ac_cv_func_strerror}" = no ; then
911	OL_SYS_ERRLIST
912fi
913])dnl
914dnl ====================================================================
915dnl Early MIPS compilers (used in Ultrix 4.2) don't like
916dnl "int x; int *volatile a = &x; *a = 0;"
917dnl 	-- borrowed from PDKSH
918AC_DEFUN([OL_C_VOLATILE],
919 [AC_CACHE_CHECK(if compiler understands volatile, ol_cv_c_volatile,
920    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x, y, z;]], [[volatile int a; int * volatile b = x ? &y : &z;
921      /* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
922      *b = 0;]])],[ol_cv_c_volatile=yes],[ol_cv_c_volatile=no])])
923  if test $ol_cv_c_volatile = yes; then
924    :
925  else
926    AC_DEFINE(volatile,,[define as empty if volatile is not supported])
927  fi
928 ])dnl
929dnl
930dnl ====================================================================
931dnl Look for fetch(3)
932AC_DEFUN([OL_LIB_FETCH],
933[ol_LIBS=$LIBS
934LIBS="-lfetch -lcom_err $LIBS"
935AC_CACHE_CHECK([fetch(3) library],ol_cv_lib_fetch,[
936	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
937#ifdef HAVE_SYS_PARAM_H
938#include <sys/param.h>
939#endif
940#include <stdio.h>
941#include <fetch.h>]], [[struct url *u = fetchParseURL("file:///"); ]])],[ol_cv_lib_fetch=yes],[ol_cv_lib_fetch=no])])
942LIBS=$ol_LIBS
943if test $ol_cv_lib_fetch != no ; then
944	ol_link_fetch="-lfetch -lcom_err"
945	AC_DEFINE(HAVE_FETCH,1,
946		[define if you actually have FreeBSD fetch(3)])
947fi
948])dnl
949dnl
950dnl ====================================================================
951dnl Define inet_aton is available
952AC_DEFUN([OL_FUNC_INET_ATON],
953 [AC_CACHE_CHECK([for inet_aton()], ol_cv_func_inet_aton,
954    [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
955#ifdef HAVE_SYS_TYPES_H
956#	include <sys/types.h>
957#endif
958#ifdef HAVE_SYS_SOCKET_H
959#	include <sys/socket.h>
960#	ifdef HAVE_SYS_SELECT_H
961#		include <sys/select.h>
962#	endif
963#	include <netinet/in.h>
964#	ifdef HAVE_ARPA_INET_H
965#		include <arpa/inet.h>
966#	endif
967#endif
968]], [[struct in_addr in;
969int rc = inet_aton( "255.255.255.255", &in );]])],[ol_cv_func_inet_aton=yes],[ol_cv_func_inet_aton=no])])
970  if test $ol_cv_func_inet_aton != no; then
971    AC_DEFINE(HAVE_INET_ATON, 1,
972		[define to you inet_aton(3) is available])
973  fi
974 ])dnl
975dnl
976dnl ====================================================================
977dnl check no of arguments for ctime_r
978AC_DEFUN([OL_FUNC_CTIME_R_NARGS],
979 [AC_CACHE_CHECK(number of arguments of ctime_r, ol_cv_func_ctime_r_nargs,
980   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[time_t ti; char *buffer; ctime_r(&ti,buffer,32);]])],[ol_cv_func_ctime_r_nargs3=yes],[ol_cv_func_ctime_r_nargs3=no])
981
982	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[time_t ti; char *buffer; ctime_r(&ti,buffer);]])],[ol_cv_func_ctime_r_nargs2=yes],[ol_cv_func_ctime_r_nargs2=no])
983
984	if test $ol_cv_func_ctime_r_nargs3 = yes &&
985	   test $ol_cv_func_ctime_r_nargs2 = no ; then
986
987		ol_cv_func_ctime_r_nargs=3
988
989	elif test $ol_cv_func_ctime_r_nargs3 = no &&
990	     test $ol_cv_func_ctime_r_nargs2 = yes ; then
991
992		ol_cv_func_ctime_r_nargs=2
993
994	else
995		ol_cv_func_ctime_r_nargs=0
996	fi
997  ])
998
999  if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
1000 	AC_DEFINE_UNQUOTED(CTIME_R_NARGS, $ol_cv_func_ctime_r_nargs,
1001		[set to the number of arguments ctime_r() expects])
1002  fi
1003])dnl
1004dnl
1005dnl --------------------------------------------------------------------
1006dnl check return type of ctime_r()
1007AC_DEFUN([OL_FUNC_CTIME_R_TYPE],
1008 [AC_CACHE_CHECK(return type of ctime_r, ol_cv_func_ctime_r_type,
1009   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[extern int (ctime_r)();]])],[ol_cv_func_ctime_r_type="int"],[ol_cv_func_ctime_r_type="charp"])
1010	])
1011  if test $ol_cv_func_ctime_r_type = "int" ; then
1012	AC_DEFINE(CTIME_R_RETURNS_INT,1, [define if ctime_r() returns int])
1013  fi
1014])dnl
1015dnl ====================================================================
1016dnl check no of arguments for gethostbyname_r
1017AC_DEFUN([OL_FUNC_GETHOSTBYNAME_R_NARGS],
1018 [AC_CACHE_CHECK(number of arguments of gethostbyname_r,
1019	ol_cv_func_gethostbyname_r_nargs,
1020	[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1021#include <sys/socket.h>
1022#include <netinet/in.h>
1023#include <netdb.h>
1024#define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent; char buffer[BUFSIZE];
1025		int bufsize=BUFSIZE;int h_errno;
1026		(void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
1027			buffer, bufsize, &h_errno);]])],[ol_cv_func_gethostbyname_r_nargs5=yes],[ol_cv_func_gethostbyname_r_nargs5=no])
1028
1029	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1030#include <sys/socket.h>
1031#include <netinet/in.h>
1032#include <netdb.h>
1033#define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent;struct hostent *rhent;
1034		char buffer[BUFSIZE];
1035		int bufsize=BUFSIZE;int h_errno;
1036		(void)gethostbyname_r("localhost", &hent, buffer, bufsize,
1037			&rhent, &h_errno);]])],[ol_cv_func_gethostbyname_r_nargs6=yes],[ol_cv_func_gethostbyname_r_nargs6=no])
1038
1039	if test $ol_cv_func_gethostbyname_r_nargs5 = yes &&
1040	   test $ol_cv_func_gethostbyname_r_nargs6 = no ; then
1041
1042		ol_cv_func_gethostbyname_r_nargs=5
1043
1044	elif test $ol_cv_func_gethostbyname_r_nargs5 = no &&
1045	     test $ol_cv_func_gethostbyname_r_nargs6 = yes ; then
1046
1047		ol_cv_func_gethostbyname_r_nargs=6
1048
1049	else
1050		ol_cv_func_gethostbyname_r_nargs=0
1051	fi
1052  ])
1053  if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
1054	AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_NARGS,
1055		$ol_cv_func_gethostbyname_r_nargs,
1056		[set to the number of arguments gethostbyname_r() expects])
1057  fi
1058])dnl
1059dnl
1060dnl check no of arguments for gethostbyaddr_r
1061AC_DEFUN([OL_FUNC_GETHOSTBYADDR_R_NARGS],
1062 [AC_CACHE_CHECK(number of arguments of gethostbyaddr_r,
1063	[ol_cv_func_gethostbyaddr_r_nargs],
1064	[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1065#include <sys/socket.h>
1066#include <netinet/in.h>
1067#include <netdb.h>
1068#define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent; char buffer[BUFSIZE];
1069	    struct in_addr add;
1070	    size_t alen=sizeof(struct in_addr);
1071	    int bufsize=BUFSIZE;int h_errno;
1072		(void)gethostbyaddr_r( (void *)&(add.s_addr),
1073			alen, AF_INET, &hent, buffer, bufsize, &h_errno);]])],[ol_cv_func_gethostbyaddr_r_nargs7=yes],[ol_cv_func_gethostbyaddr_r_nargs7=no])
1074
1075	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1076#include <sys/socket.h>
1077#include <netinet/in.h>
1078#include <netdb.h>
1079#define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent;
1080		struct hostent *rhent; char buffer[BUFSIZE];
1081		struct in_addr add;
1082		size_t alen=sizeof(struct in_addr);
1083		int bufsize=BUFSIZE;int h_errno;
1084		(void)gethostbyaddr_r( (void *)&(add.s_addr),
1085			alen, AF_INET, &hent, buffer, bufsize,
1086			&rhent, &h_errno);]])],[ol_cv_func_gethostbyaddr_r_nargs8=yes],[ol_cv_func_gethostbyaddr_r_nargs8=no])
1087
1088	if test $ol_cv_func_gethostbyaddr_r_nargs7 = yes &&
1089	   test $ol_cv_func_gethostbyaddr_r_nargs8 = no ; then
1090
1091		ol_cv_func_gethostbyaddr_r_nargs=7
1092
1093	elif test $ol_cv_func_gethostbyaddr_r_nargs7 = no &&
1094	     test $ol_cv_func_gethostbyaddr_r_nargs8 = yes ; then
1095
1096		ol_cv_func_gethostbyaddr_r_nargs=8
1097
1098	else
1099		ol_cv_func_gethostbyaddr_r_nargs=0
1100	fi
1101  ])
1102  if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
1103    AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_NARGS,
1104		$ol_cv_func_gethostbyaddr_r_nargs,
1105		[set to the number of arguments gethostbyaddr_r() expects])
1106  fi
1107])dnl
1108dnl
1109dnl --------------------------------------------------------------------
1110dnl Check for Cyrus SASL version compatility
1111AC_DEFUN([OL_SASL_COMPAT],
1112[AC_CACHE_CHECK([Cyrus SASL library version], [ol_cv_sasl_compat],[
1113	AC_EGREP_CPP(__sasl_compat,[
1114#ifdef HAVE_SASL_SASL_H
1115#include <sasl/sasl.h>
1116#else
1117#include <sasl.h>
1118#endif
1119
1120/* Require 2.1.15+ */
1121#if SASL_VERSION_MAJOR == 2  && SASL_VERSION_MINOR > 1
1122	char *__sasl_compat = "2.2+ or better okay (we guess)";
1123#elif SASL_VERSION_MAJOR == 2  && SASL_VERSION_MINOR == 1 \
1124	&& SASL_VERSION_STEP >=15
1125	char *__sasl_compat = "2.1.15+ or better okay";
1126#endif
1127	],	[ol_cv_sasl_compat=yes], [ol_cv_sasl_compat=no])])
1128])
1129dnl ====================================================================
1130dnl check for SSL compatibility
1131AC_DEFUN([OL_SSL_COMPAT],
1132[AC_CACHE_CHECK([OpenSSL library version (CRL checking capability)],
1133	[ol_cv_ssl_crl_compat],[
1134		AC_EGREP_CPP(__ssl_compat,[
1135#ifdef HAVE_OPENSSL_SSL_H
1136#include <openssl/ssl.h>
1137#endif
1138
1139/* Require 0.9.7d+ */
1140#if OPENSSL_VERSION_NUMBER >= 0x0090704fL
1141	char *__ssl_compat = "0.9.7d";
1142#endif
1143	], [ol_cv_ssl_crl_compat=yes], [ol_cv_ssl_crl_compat=no])])
1144])
1145