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