1 dnl OpenLDAP Autoconf Macros
3 dnl This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 dnl Copyright 1998-2006 The OpenLDAP Foundation.
6 dnl All rights reserved.
8 dnl Redistribution and use in source and binary forms, with or without
9 dnl modification, are permitted only as authorized by the OpenLDAP
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>.
16 dnl --------------------------------------------------------------------
17 dnl Restricted form of AC_ARG_ENABLE that limits user options
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@:>@),[
28 for ol_val in ifelse($4,,[auto yes no],[$4]) ; do
29 if test "$enableval" = "$ol_val" ; then
33 if test "$ol_arg" = "invalid" ; then
34 AC_MSG_ERROR(bad value $enableval for --enable-$1)
36 ol_enable_$1="$ol_arg"
38 [ ol_enable_$1=ifelse($5,,ol_DefVal,[${]$5[:-]ol_DefVal[}])]]))dnl
39 dnl AC_MSG_RESULT([OpenLDAP -enable-$1 $ol_enable_$1])
44 dnl --------------------------------------------------------------------
45 dnl Restricted form of AC_ARG_WITH that limits user options
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)@:>@,[
54 for ol_val in ifelse($4,,[yes no],[$4]) ; do
55 if test "$withval" = "$ol_val" ; then
59 if test "$ol_arg" = "invalid" ; then
60 AC_MSG_ERROR(bad value $withval for --with-$1)
64 [ ol_with_$1=ifelse($3,,"no","$3")])dnl
65 dnl AC_MSG_RESULT([OpenLDAP --with-$1 $ol_with_$1])
68 dnl ====================================================================
69 dnl Check for dependency generation flag
70 AC_DEFUN([OL_MKDEPEND], [# test for make depend flag
73 if test -z "${MKDEP}"; then
75 if test -z "${MKDEP_FLAGS}"; then
76 AC_CACHE_CHECK([for ${OL_MKDEP} depend flag], ol_cv_mkdep, [
78 for flag in "-M" "-xM"; do
79 cat > conftest.c <<EOF
82 if AC_TRY_COMMAND($OL_MKDEP $flag conftest.c) \
83 | grep '^conftest\.'"${ac_objext}" >/dev/null 2>&1
85 if test ! -f conftest."${ac_object}" ; then
87 OL_MKDEP_FLAGS="$flag"
96 OL_MKDEP_FLAGS="${MKDEP_FLAGS}"
101 OL_MKDEP_FLAGS="${MKDEP_FLAGS}"
104 AC_SUBST(OL_MKDEP_FLAGS)
107 dnl ====================================================================
108 dnl Check if system uses EBCDIC instead of ASCII
109 AC_DEFUN([OL_CPP_EBCDIC], [# test for EBCDIC
110 AC_CACHE_CHECK([for EBCDIC],ol_cv_cpp_ebcdic,[
111 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
113 #include <__ASCII__/generate_error.h>
115 ]])],[ol_cv_cpp_ebcdic=yes],[ol_cv_cpp_ebcdic=no])])
116 if test $ol_cv_cpp_ebcdic = yes ; then
117 AC_DEFINE(HAVE_EBCDIC,1, [define if system uses EBCDIC instead of ASCII])
121 dnl --------------------------------------------------------------------
122 dnl OpenLDAP version of STDC header check w/ EBCDIC support
123 AC_DEFUN([OL_HEADER_STDC],
125 AC_REQUIRE([OL_CPP_EBCDIC])dnl
126 AC_CACHE_CHECK([for ANSI C header files], ol_cv_header_stdc,
127 [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
130 #include <float.h>]])],[ol_cv_header_stdc=yes],[ol_cv_header_stdc=no])
132 if test $ol_cv_header_stdc = yes; then
133 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
134 AC_EGREP_HEADER(memchr, string.h, , ol_cv_header_stdc=no)
137 if test $ol_cv_header_stdc = yes; then
138 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
139 AC_EGREP_HEADER(free, stdlib.h, , ol_cv_header_stdc=no)
142 if test $ol_cv_header_stdc = yes; then
143 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
144 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <ctype.h>
146 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
147 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
149 # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
150 || ('j' <= (c) && (c) <= 'r') \
151 || ('s' <= (c) && (c) <= 'z'))
152 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
154 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
155 int main () { int i; for (i = 0; i < 256; i++)
156 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
158 ]])],[],[ol_cv_header_stdc=no],[:])
160 if test $ol_cv_header_stdc = yes; then
161 AC_DEFINE(STDC_HEADERS)
163 ac_cv_header_stdc=disable
166 dnl ====================================================================
167 dnl DNS resolver macros
168 AC_DEFUN([OL_RESOLVER_TRY],
169 [if test $ol_cv_lib_resolver = no ; then
170 AC_CACHE_CHECK([for resolver link (]ifelse($2,,default,$2)[)],[$1],
172 ol_RESOLVER_LIB=ifelse($2,,,$2)
174 LIBS="$ol_RESOLVER_LIB $LIBS"
176 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
177 #ifdef HAVE_SYS_TYPES_H
178 # include <sys/types.h>
180 #include <netinet/in.h>
181 #ifdef HAVE_ARPA_NAMESER_H
182 # include <arpa/nameser.h>
189 char *request = NULL;
190 unsigned char reply[64*1024];
191 unsigned char host[64*1024];
195 /* Bind 8/9 interface */
196 len = res_query(request, ns_c_in, ns_t_srv, reply, sizeof(reply));
198 /* Bind 4 interface */
202 len = res_query(request, C_IN, T_SRV, reply, sizeof(reply));
206 /* Bind 8/9 interface */
208 #elif defined(HFIXEDSZ)
209 /* Bind 4 interface w/ HFIXEDSZ */
212 /* Bind 4 interface w/o HFIXEDSZ */
215 status = dn_expand( reply, reply+len, p, host, sizeof(host));
216 }]])],[$1=yes],[$1=no])
221 if test $$1 = yes ; then
222 ol_cv_lib_resolver=ifelse($2,,yes,$2)
226 dnl --------------------------------------------------------------------
227 dnl Try to locate appropriate library
228 AC_DEFUN([OL_RESOLVER_LINK],
229 [ol_cv_lib_resolver=no
230 OL_RESOLVER_TRY(ol_cv_resolver_none)
231 OL_RESOLVER_TRY(ol_cv_resolver_resolv,[-lresolv])
232 OL_RESOLVER_TRY(ol_cv_resolver_bind,[-lbind])
235 dnl ====================================================================
236 dnl International Components for Unicode (ICU)
239 AC_CHECK_HEADERS( unicode/utypes.h )
240 if test $ac_cv_header_unicode_utypes_h = yes ; then
241 dnl OL_ICULIBS="-licui18n -licuuc -licudata"
242 OL_ICULIBS="-licuuc -licudata"
244 AC_CACHE_CHECK([for ICU libraries], [ol_cv_lib_icu], [
246 LIBS="$OL_ICULIBS $LIBS"
247 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
248 #include <unicode/utypes.h>
250 (void) u_errorName(0);
251 ]])],[ol_cv_lib_icu=yes],[ol_cv_lib_icu=no])
255 if test $ol_cv_lib_icu != no ; then
257 AC_DEFINE(HAVE_ICU,1,[define if you actually have ICU])
262 dnl ====================================================================
263 dnl Berkeley DB macros
265 dnl --------------------------------------------------------------------
267 AC_DEFUN([OL_BERKELEY_DB_TRY],
268 [if test $ol_cv_lib_db = no ; then
269 AC_CACHE_CHECK([for Berkeley DB link (]ifelse($2,,default,$2)[)],[$1],
271 ol_DB_LIB=ifelse($2,,,$2)
273 LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
275 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
282 #ifndef DB_VERSION_MAJOR
283 # define DB_VERSION_MAJOR 1
287 #define NULL ((void*)0)
290 #if DB_VERSION_MAJOR > 1
293 int major, minor, patch;
295 version = db_version( &major, &minor, &patch );
297 if( major != DB_VERSION_MAJOR ||
298 minor < DB_VERSION_MINOR )
300 printf("Berkeley DB version mismatch\n"
301 "\theader: %s\n\tlibrary: %s\n",
302 DB_VERSION_STRING, version);
308 #if DB_VERSION_MAJOR > 2
309 db_env_create( NULL, 0 );
310 #elif DB_VERSION_MAJOR > 1
313 (void) dbopen( NULL, 0, 0, 0, NULL);
315 ]])],[$1=yes],[$1=no])
320 if test $$1 = yes ; then
321 ol_cv_lib_db=ifelse($2,,yes,$2)
326 dnl --------------------------------------------------------------------
327 dnl Try to locate appropriate library
328 AC_DEFUN([OL_BERKELEY_DB_LINK],
331 dnl Determine major version
332 AC_CACHE_CHECK([for Berkeley DB major version], [ol_cv_bdb_major],[
334 if test $ol_cv_bdb_major = 0 ; then
335 AC_EGREP_CPP(__db_version, [
337 #ifndef DB_VERSION_MAJOR
338 # define DB_VERSION_MAJOR 1
340 #if DB_VERSION_MAJOR == 4
343 ], [ol_cv_bdb_major=4], [:])
345 if test $ol_cv_bdb_major = 0 ; then
346 AC_EGREP_CPP(__db_version, [
348 #ifndef DB_VERSION_MAJOR
349 # define DB_VERSION_MAJOR 1
351 #if DB_VERSION_MAJOR == 3
354 ], [ol_cv_bdb_major=3], [:])
356 if test $ol_cv_bdb_major = 0 ; then
357 AC_EGREP_CPP(__db_version, [
359 #ifndef DB_VERSION_MAJOR
360 # define DB_VERSION_MAJOR 1
362 #if DB_VERSION_MAJOR == 2
365 ], [ol_cv_bdb_major=2], [:])
367 if test $ol_cv_bdb_major = 0 ; then
368 AC_EGREP_CPP(__db_version, [
370 #ifndef DB_VERSION_MAJOR
371 # define DB_VERSION_MAJOR 1
373 #if DB_VERSION_MAJOR == 1
376 ], [ol_cv_bdb_major=1], [:])
379 if test $ol_cv_bdb_major = 0 ; then
380 AC_MSG_ERROR([Unknown Berkeley DB major version])
384 dnl Determine minor version
385 AC_CACHE_CHECK([for Berkeley DB minor version], [ol_cv_bdb_minor],[
387 if test $ol_cv_bdb_minor = 0 ; then
388 AC_EGREP_CPP(__db_version, [
390 #ifndef DB_VERSION_MINOR
391 # define DB_VERSION_MINOR 0
393 #if DB_VERSION_MINOR == 9
396 ], [ol_cv_bdb_minor=9], [:])
398 if test $ol_cv_bdb_minor = 0 ; then
399 AC_EGREP_CPP(__db_version, [
401 #ifndef DB_VERSION_MINOR
402 # define DB_VERSION_MINOR 0
404 #if DB_VERSION_MINOR == 8
407 ], [ol_cv_bdb_minor=8], [:])
409 if test $ol_cv_bdb_minor = 0 ; then
410 AC_EGREP_CPP(__db_version, [
412 #ifndef DB_VERSION_MINOR
413 # define DB_VERSION_MINOR 0
415 #if DB_VERSION_MINOR == 7
418 ], [ol_cv_bdb_minor=7], [:])
420 if test $ol_cv_bdb_minor = 0 ; then
421 AC_EGREP_CPP(__db_version, [
423 #ifndef DB_VERSION_MINOR
424 # define DB_VERSION_MINOR 0
426 #if DB_VERSION_MINOR == 6
429 ], [ol_cv_bdb_minor=6], [:])
431 if test $ol_cv_bdb_minor = 0 ; then
432 AC_EGREP_CPP(__db_version, [
434 #ifndef DB_VERSION_MINOR
435 # define DB_VERSION_MINOR 0
437 #if DB_VERSION_MINOR == 5
440 ], [ol_cv_bdb_minor=5], [:])
442 if test $ol_cv_bdb_minor = 0 ; then
443 AC_EGREP_CPP(__db_version, [
445 #ifndef DB_VERSION_MINOR
446 # define DB_VERSION_MINOR 0
448 #if DB_VERSION_MINOR == 4
451 ], [ol_cv_bdb_minor=4], [:])
453 if test $ol_cv_bdb_minor = 0 ; then
454 AC_EGREP_CPP(__db_version, [
456 #ifndef DB_VERSION_MINOR
457 # define DB_VERSION_MINOR 0
459 #if DB_VERSION_MINOR == 3
462 ], [ol_cv_bdb_minor=3], [:])
464 if test $ol_cv_bdb_minor = 0 ; then
465 AC_EGREP_CPP(__db_version, [
467 #ifndef DB_VERSION_MINOR
468 # define DB_VERSION_MINOR 0
470 #if DB_VERSION_MINOR == 2
473 ], [ol_cv_bdb_minor=2], [:])
475 if test $ol_cv_bdb_minor = 0 ; then
476 AC_EGREP_CPP(__db_version, [
478 #ifndef DB_VERSION_MINOR
479 # define DB_VERSION_MINOR 0
481 #if DB_VERSION_MINOR == 1
484 ], [ol_cv_bdb_minor=1], [:])
488 if test $ol_cv_bdb_major = 4 ; then
489 if test $ol_cv_bdb_minor = 4 ; then
490 OL_BERKELEY_DB_TRY(ol_cv_db_db44,[-ldb44])
491 OL_BERKELEY_DB_TRY(ol_cv_db_db_44,[-ldb-44])
492 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_4,[-ldb-4.4])
493 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_4,[-ldb-4-4])
494 elif test $ol_cv_bdb_minor = 3 ; then
495 OL_BERKELEY_DB_TRY(ol_cv_db_db43,[-ldb43])
496 OL_BERKELEY_DB_TRY(ol_cv_db_db_43,[-ldb-43])
497 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_3,[-ldb-4.3])
498 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_3,[-ldb-4-3])
499 elif test $ol_cv_bdb_minor = 2 ; then
500 OL_BERKELEY_DB_TRY(ol_cv_db_db42,[-ldb42])
501 OL_BERKELEY_DB_TRY(ol_cv_db_db_42,[-ldb-42])
502 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_2,[-ldb-4.2])
503 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_2,[-ldb-4-2])
504 elif test $ol_cv_bdb_minor = 1 ; then
505 OL_BERKELEY_DB_TRY(ol_cv_db_db41,[-ldb41])
506 OL_BERKELEY_DB_TRY(ol_cv_db_db_41,[-ldb-41])
507 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_1,[-ldb-4.1])
508 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_1,[-ldb-4-1])
510 OL_BERKELEY_DB_TRY(ol_cv_db_db_4,[-ldb-4])
511 OL_BERKELEY_DB_TRY(ol_cv_db_db4,[-ldb4])
512 OL_BERKELEY_DB_TRY(ol_cv_db_db,[-ldb])
514 elif test $ol_cv_bdb_major = 3 ; then
515 OL_BERKELEY_DB_TRY(ol_cv_db_db3,[-ldb3])
516 OL_BERKELEY_DB_TRY(ol_cv_db_db_3,[-ldb-3])
518 elif test $ol_cv_bdb_major = 2 ; then
519 OL_BERKELEY_DB_TRY(ol_cv_db_db2,[-ldb2])
520 OL_BERKELEY_DB_TRY(ol_cv_db_db_2,[-ldb-2])
522 elif test $ol_cv_bdb_major = 1 ; then
523 OL_BERKELEY_DB_TRY(ol_cv_db_db1,[-ldb1])
524 OL_BERKELEY_DB_TRY(ol_cv_db_db_1,[-ldb-1])
526 OL_BERKELEY_DB_TRY(ol_cv_db_none)
529 dnl --------------------------------------------------------------------
530 dnl Check if Berkeley DB version
531 AC_DEFUN([OL_BERKELEY_DB_VERSION],
532 [AC_CACHE_CHECK([for Berkeley DB version match], [ol_cv_berkeley_db_version], [
534 LIBS="$LTHREAD_LIBS $LIBS"
535 if test $ol_cv_lib_db != yes ; then
536 LIBS="$ol_cv_lib_db $LIBS"
539 AC_RUN_IFELSE([AC_LANG_SOURCE([[
545 #ifndef DB_VERSION_MAJOR
546 # define DB_VERSION_MAJOR 1
549 #define NULL ((void *)0)
553 #if DB_VERSION_MAJOR > 1
555 int major, minor, patch;
557 version = db_version( &major, &minor, &patch );
559 if( major != DB_VERSION_MAJOR ||
560 minor != DB_VERSION_MINOR ||
561 patch != DB_VERSION_PATCH )
563 printf("Berkeley DB version mismatch\n"
564 "\theader: %s\n\tlibrary: %s\n",
565 DB_VERSION_STRING, version);
571 }]])],[ol_cv_berkeley_db_version=yes],[ol_cv_berkeley_db_version=no],[ol_cv_berkeley_db_version=cross])
576 if test $ol_cv_berkeley_db_version = no ; then
577 AC_MSG_ERROR([Berkeley DB version mismatch])
581 dnl --------------------------------------------------------------------
582 dnl Check if Berkeley DB supports DB_THREAD
583 AC_DEFUN([OL_BERKELEY_DB_THREAD],
584 [AC_CACHE_CHECK([for Berkeley DB thread support], [ol_cv_berkeley_db_thread], [
586 LIBS="$LTHREAD_LIBS $LIBS"
587 if test $ol_cv_lib_db != yes ; then
588 LIBS="$ol_cv_lib_db $LIBS"
591 AC_RUN_IFELSE([AC_LANG_SOURCE([[
598 #define NULL ((void *)0)
603 u_int32_t flags = DB_CREATE |
609 #if DB_VERSION_MAJOR > 2
612 rc = db_env_create( &env, 0 );
614 flags |= DB_INIT_MPOOL;
615 #ifdef DB_MPOOL_PRIVATE
616 flags |= DB_MPOOL_PRIVATE;
620 printf("BerkeleyDB: %s\n", db_strerror(rc) );
624 #if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
625 rc = env->open( env, NULL, flags, 0 );
627 rc = env->open( env, NULL, NULL, flags, 0 );
631 rc = env->close( env, 0 );
635 printf("BerkeleyDB: %s\n", db_strerror(rc) );
641 memset( &env, '\0', sizeof(env) );
643 rc = db_appinit( NULL, NULL, &env, flags );
649 unlink("__db_mpool.share");
650 unlink("__db_lock.share");
654 }]])],[ol_cv_berkeley_db_thread=yes],[ol_cv_berkeley_db_thread=no],[ol_cv_berkeley_db_thread=cross])
659 if test $ol_cv_berkeley_db_thread != no ; then
660 AC_DEFINE(HAVE_BERKELEY_DB_THREAD, 1,
661 [define if Berkeley DB has DB_THREAD support])
665 dnl --------------------------------------------------------------------
667 AC_DEFUN([OL_BERKELEY_DB],
668 [ol_cv_berkeley_db=no
669 AC_CHECK_HEADERS(db.h)
670 if test $ac_cv_header_db_h = yes; then
672 if test "$ol_cv_lib_db" != no ; then
673 ol_cv_berkeley_db=yes
674 OL_BERKELEY_DB_VERSION
675 OL_BERKELEY_DB_THREAD
679 dnl --------------------------------------------------------------------
680 dnl Check for version compatility with back-bdb
681 AC_DEFUN([OL_BDB_COMPAT],
682 [AC_CACHE_CHECK([Berkeley DB version for BDB/HDB backends], [ol_cv_bdb_compat],[
683 AC_EGREP_CPP(__db_version_compat,[
686 /* this check could be improved */
687 #ifndef DB_VERSION_MAJOR
688 # define DB_VERSION_MAJOR 1
690 #ifndef DB_VERSION_MINOR
691 # define DB_VERSION_MINOR 0
694 /* require 4.2 or later */
695 #if (DB_VERSION_MAJOR >= 4) && (DB_VERSION_MINOR >= 2)
698 ], [ol_cv_bdb_compat=yes], [ol_cv_bdb_compat=no])])
701 dnl --------------------------------------------------------------------
702 dnl Find old Berkeley DB 1.85/1.86
703 AC_DEFUN([OL_BERKELEY_COMPAT_DB],
704 [AC_CHECK_HEADERS(db_185.h db.h)
705 if test $ac_cv_header_db_185_h = yes || test $ac_cv_header_db_h = yes; then
706 AC_CACHE_CHECK([if Berkeley DB header compatibility], [ol_cv_header_db1],[
707 AC_EGREP_CPP(__db_version_1,[
714 /* this check could be improved */
715 #ifndef DB_VERSION_MAJOR
716 # define DB_VERSION_MAJOR 1
719 #if DB_VERSION_MAJOR == 1
722 ], [ol_cv_header_db1=yes], [ol_cv_header_db1=no])])
724 if test $ol_cv_header_db1 = yes ; then
726 if test "$ol_cv_lib_db" != no ; then
727 ol_cv_berkeley_db=yes
733 dnl ====================================================================
734 dnl Check if GDBM library exists
735 dnl Check for gdbm_open in standard libraries or -lgdbm
737 dnl defines ol_cv_lib_gdbm to 'yes' or '-lgdbm' or 'no'
738 dnl 'yes' implies gdbm_open is in $LIBS
741 dnl AC_CHECK_FUNC(gdbm_open)
742 dnl AC_CHECK_LIB(gdbm,gdbm_open)
744 AC_DEFUN([OL_LIB_GDBM],
745 [AC_CACHE_CHECK(for GDBM library, [ol_cv_lib_gdbm],
747 AC_CHECK_FUNC(gdbm_open,[ol_cv_lib_gdbm=yes], [
748 AC_CHECK_LIB(gdbm,gdbm_open,[ol_cv_lib_gdbm=-lgdbm],[ol_cv_lib_gdbm=no])
754 dnl --------------------------------------------------------------------
755 dnl Check if GDBM exists
757 dnl defines ol_cv_gdbm to 'yes' or 'no'
761 dnl AC_CHECK_HEADERS(gdbm.h)
764 [AC_REQUIRE([OL_LIB_GDBM])
765 AC_CHECK_HEADERS(gdbm.h)
766 AC_CACHE_CHECK(for db, [ol_cv_gdbm], [
767 if test $ol_cv_lib_gdbm = no || test $ac_cv_header_gdbm_h = no ; then
773 if test $ol_cv_gdbm = yes ; then
774 AC_DEFINE(HAVE_GDBM,1, [define if GNU DBM is available])
778 dnl ====================================================================
779 dnl Check if MDBM library exists
780 dnl Check for mdbm_open in standard libraries or -lmdbm
782 dnl defines ol_cv_lib_mdbm to 'yes' or '-lmdbm' or 'no'
783 dnl 'yes' implies mdbm_open is in $LIBS
786 dnl AC_CHECK_FUNC(mdbm_set_chain)
787 dnl AC_CHECK_LIB(mdbm,mdbm_set_chain)
789 AC_DEFUN([OL_LIB_MDBM],
790 [AC_CACHE_CHECK(for MDBM library, [ol_cv_lib_mdbm],
792 AC_CHECK_FUNC(mdbm_set_chain,[ol_cv_lib_mdbm=yes], [
793 AC_CHECK_LIB(mdbm,mdbm_set_chain,[ol_cv_lib_mdbm=-lmdbm],[ol_cv_lib_mdbm=no])
799 dnl --------------------------------------------------------------------
800 dnl Check if MDBM exists
802 dnl defines ol_cv_mdbm to 'yes' or 'no'
806 dnl AC_CHECK_HEADERS(mdbm.h)
809 [AC_REQUIRE([OL_LIB_MDBM])
810 AC_CHECK_HEADERS(mdbm.h)
811 AC_CACHE_CHECK(for db, [ol_cv_mdbm], [
812 if test $ol_cv_lib_mdbm = no || test $ac_cv_header_mdbm_h = no ; then
818 if test $ol_cv_mdbm = yes ; then
819 AC_DEFINE(HAVE_MDBM,1, [define if MDBM is available])
823 dnl ====================================================================
824 dnl Check if NDBM library exists
825 dnl Check for dbm_open in standard libraries or -lndbm or -ldbm
827 dnl defines ol_cv_lib_ndbm to 'yes' or '-lndbm' or -ldbm or 'no'
828 dnl 'yes' implies ndbm_open is in $LIBS
831 dnl AC_CHECK_FUNC(dbm_open)
832 dnl AC_CHECK_LIB(ndbm,dbm_open)
833 dnl AC_CHECK_LIB(dbm,dbm_open)
836 dnl should also check SVR4 case: dbm_open() in -lucb but that
837 dnl would requiring dealing with -L/usr/ucblib
839 AC_DEFUN([OL_LIB_NDBM],
840 [AC_CACHE_CHECK(for NDBM library, [ol_cv_lib_ndbm],
842 AC_CHECK_FUNC(dbm_open,[ol_cv_lib_ndbm=yes], [
843 AC_CHECK_LIB(ndbm,dbm_open,[ol_cv_lib_ndbm=-lndbm], [
844 AC_CHECK_LIB(dbm,dbm_open,[ol_cv_lib_ndbm=-ldbm],
845 [ol_cv_lib_ndbm=no])dnl
852 dnl --------------------------------------------------------------------
853 dnl Check if NDBM exists
855 dnl defines ol_cv_ndbm to 'yes' or 'no'
859 dnl AC_CHECK_HEADERS(ndbm.h)
862 dnl Doesn't handle SVR4 case (see above)
865 [AC_REQUIRE([OL_LIB_NDBM])
866 AC_CHECK_HEADERS(ndbm.h)
867 AC_CACHE_CHECK(for db, [ol_cv_ndbm], [
868 if test $ol_cv_lib_ndbm = no || test $ac_cv_header_ndbm_h = no ; then
874 if test $ol_cv_ndbm = yes ; then
875 AC_DEFINE(HAVE_NDBM,1, [define if NDBM is available])
879 dnl ====================================================================
880 dnl Check POSIX Thread version
882 dnl defines ol_cv_pthread_version to 4, 5, 6, 7, 8, 10, depending on the
883 dnl version of the POSIX.4a Draft that is implemented.
884 dnl 10 == POSIX.4a Final == POSIX.1c-1996 for our purposes.
885 dnl Existence of pthread.h should be tested separately.
888 dnl pthread_detach() was dropped in Draft 8, it is present
889 dnl in every other version
890 dnl PTHREAD_CREATE_UNDETACHED is only in Draft 7, it was called
891 dnl PTHREAD_CREATE_JOINABLE after that
892 dnl pthread_attr_create was renamed to pthread_attr_init in Draft 6.
893 dnl Draft 6-10 has _init, Draft 4-5 has _create.
894 dnl pthread_attr_default was dropped in Draft 6, only 4 and 5 have it
895 dnl PTHREAD_MUTEX_INITIALIZER was introduced in Draft 5. It's not
896 dnl interesting to us because we don't try to statically
897 dnl initialize mutexes. 5-10 has it.
899 dnl Draft 9 and 10 are equivalent for our purposes.
901 AC_DEFUN([OL_POSIX_THREAD_VERSION],
902 [AC_CACHE_CHECK([POSIX thread version],[ol_cv_pthread_version],[
903 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
904 # include <pthread.h>
906 int i = PTHREAD_CREATE_JOINABLE;
908 AC_EGREP_HEADER(pthread_detach,pthread.h,
909 ol_cv_pthread_version=10, ol_cv_pthread_version=8)],[
910 AC_EGREP_CPP(draft7,[
911 # include <pthread.h>
912 # ifdef PTHREAD_CREATE_UNDETACHED
915 ], ol_cv_pthread_version=7, [
916 AC_EGREP_HEADER(pthread_attr_init,pthread.h,
917 ol_cv_pthread_version=6, [
918 AC_EGREP_CPP(draft5,[
919 # include <pthread.h>
920 #ifdef PTHREAD_MUTEX_INITIALIZER
923 ], ol_cv_pthread_version=5, ol_cv_pthread_version=4) ]) ]) ])
927 dnl --------------------------------------------------------------------
928 AC_DEFUN([OL_PTHREAD_TEST_INCLUDES], [[
929 /* pthread test headers */
931 #if HAVE_PTHREADS < 7
935 #define NULL (void*)0
941 return (void *) (p == NULL);
944 AC_DEFUN([OL_PTHREAD_TEST_FUNCTION],[[
945 /* pthread test function */
946 #ifndef PTHREAD_CREATE_DETACHED
947 #define PTHREAD_CREATE_DETACHED 1
951 int detach = PTHREAD_CREATE_DETACHED;
953 #if HAVE_PTHREADS > 4
957 status = pthread_attr_init(&attr);
958 if( status ) return status;
960 #if HAVE_PTHREADS < 7
961 status = pthread_attr_setdetachstate(&attr, &detach);
962 if( status < 0 ) status = errno;
964 status = pthread_attr_setdetachstate(&attr, detach);
966 if( status ) return status;
967 status = pthread_create( &t, &attr, task, NULL );
968 #if HAVE_PTHREADS < 7
969 if( status < 0 ) status = errno;
971 if( status ) return status;
973 /* Draft 4 pthreads */
974 status = pthread_create( &t, pthread_attr_default, task, NULL );
975 if( status ) return errno;
977 /* give thread a chance to complete */
978 /* it should remain joinable and hence detachable */
981 status = pthread_detach( &t );
982 if( status ) return errno;
985 #ifdef HAVE_LINUX_THREADS
986 pthread_kill_other_threads_np();
992 AC_DEFUN([OL_PTHREAD_TEST_PROGRAM],
993 AC_LANG_SOURCE([OL_PTHREAD_TEST_INCLUDES
999 OL_PTHREAD_TEST_FUNCTION
1002 dnl --------------------------------------------------------------------
1003 AC_DEFUN([OL_PTHREAD_TRY], [# Pthread try link: $1 ($2)
1004 if test "$ol_link_threads" = no ; then
1006 AC_CACHE_CHECK([for pthread link with $1], [$2], [
1011 AC_RUN_IFELSE([OL_PTHREAD_TEST_PROGRAM],
1014 [AC_LINK_IFELSE([AC_LANG_PROGRAM(OL_PTHREAD_TEST_INCLUDES,
1015 OL_PTHREAD_TEST_FUNCTION)],
1016 [$2=yes], [$2=no])])
1022 if test $$2 = yes ; then
1023 ol_link_pthreads="$1"
1024 ol_link_threads=posix
1029 dnl ====================================================================
1030 dnl Check GNU Pth pthread Header
1032 dnl defines ol_cv_header linux_threads to 'yes' or 'no'
1033 dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
1034 dnl doesn't exists. Existance of pthread.h should separately
1037 AC_DEFUN([OL_HEADER_GNU_PTH_PTHREAD_H], [
1038 AC_CACHE_CHECK([for GNU Pth pthread.h],
1039 [ol_cv_header_gnu_pth_pthread_h],
1040 [AC_EGREP_CPP(__gnu_pth__,
1041 [#include <pthread.h>
1042 #ifdef _POSIX_THREAD_IS_GNU_PTH
1046 [ol_cv_header_gnu_pth_pthread_h=yes],
1047 [ol_cv_header_gnu_pth_pthread_h=no])
1050 dnl ====================================================================
1051 dnl Check for NT Threads
1052 AC_DEFUN([OL_NT_THREADS], [
1053 AC_CHECK_FUNC(_beginthread)
1055 if test $ac_cv_func__beginthread = yes ; then
1056 AC_DEFINE(HAVE_NT_THREADS,1,[if you have NT Threads])
1057 ol_cv_nt_threads=yes
1060 dnl ====================================================================
1061 dnl Check LinuxThreads Header
1063 dnl defines ol_cv_header linux_threads to 'yes' or 'no'
1064 dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
1065 dnl doesn't exists. Existance of pthread.h should separately
1068 AC_DEFUN([OL_HEADER_LINUX_THREADS], [
1069 AC_CACHE_CHECK([for LinuxThreads pthread.h],
1070 [ol_cv_header_linux_threads],
1071 [AC_EGREP_CPP(pthread_kill_other_threads_np,
1072 [#include <pthread.h>],
1073 [ol_cv_header_linux_threads=yes],
1074 [ol_cv_header_linux_threads=no])
1076 if test $ol_cv_header_linux_threads = yes; then
1077 AC_DEFINE(HAVE_LINUX_THREADS,1,[if you have LinuxThreads])
1080 dnl --------------------------------------------------------------------
1081 dnl Check LinuxThreads Implementation
1083 dnl defines ol_cv_sys_linux_threads to 'yes' or 'no'
1084 dnl 'no' implies pthreads implementation is not LinuxThreads.
1086 AC_DEFUN([OL_SYS_LINUX_THREADS], [
1087 AC_CHECK_FUNCS(pthread_kill_other_threads_np)
1088 AC_CACHE_CHECK([for LinuxThreads implementation],
1089 [ol_cv_sys_linux_threads],
1090 [ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np])
1093 dnl --------------------------------------------------------------------
1094 dnl Check LinuxThreads consistency
1095 AC_DEFUN([OL_LINUX_THREADS], [
1096 AC_REQUIRE([OL_HEADER_LINUX_THREADS])
1097 AC_REQUIRE([OL_SYS_LINUX_THREADS])
1098 AC_CACHE_CHECK([for LinuxThreads consistency], [ol_cv_linux_threads], [
1099 if test $ol_cv_header_linux_threads = yes &&
1100 test $ol_cv_sys_linux_threads = yes; then
1101 ol_cv_linux_threads=yes
1102 elif test $ol_cv_header_linux_threads = no &&
1103 test $ol_cv_sys_linux_threads = no; then
1104 ol_cv_linux_threads=no
1106 ol_cv_linux_threads=error
1111 dnl ====================================================================
1112 dnl Check for POSIX Regex
1113 AC_DEFUN([OL_POSIX_REGEX], [
1114 AC_CACHE_CHECK([for compatible POSIX regex],ol_cv_c_posix_regex,[
1115 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1116 #include <sys/types.h>
1118 static char *pattern, *string;
1126 if(regcomp(&re, pattern, 0)) {
1130 string = "ALL MATCH";
1132 rc = regexec(&re, string, 0, (void*)0, 0);
1137 }]])],[ol_cv_c_posix_regex=yes],[ol_cv_c_posix_regex=no],[ol_cv_c_posix_regex=cross])])
1140 dnl ====================================================================
1141 dnl Check if toupper() requires islower() to be called first
1142 AC_DEFUN([OL_C_UPPER_LOWER],
1143 [AC_CACHE_CHECK([if toupper() requires islower()],ol_cv_c_upper_lower,[
1144 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1148 if ('C' == toupper('C'))
1152 }]])],[ol_cv_c_upper_lower=no],[ol_cv_c_upper_lower=yes],[ol_cv_c_upper_lower=safe])])
1153 if test $ol_cv_c_upper_lower != no ; then
1154 AC_DEFINE(C_UPPER_LOWER,1, [define if toupper() requires islower()])
1158 dnl ====================================================================
1159 dnl Error string checks
1161 dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
1162 dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
1163 dnl Reported by Keith Bostic.
1164 AC_DEFUN([OL_SYS_ERRLIST],
1165 [AC_CACHE_CHECK([declaration of sys_errlist],ol_cv_dcl_sys_errlist,[
1166 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1168 #include <sys/types.h>
1172 #endif ]], [[char *c = (char *) *sys_errlist]])],[ol_cv_dcl_sys_errlist=yes
1173 ol_cv_have_sys_errlist=yes],[ol_cv_dcl_sys_errlist=no])])
1175 # It's possible (for near-UNIX clones) that sys_errlist doesn't exist
1176 if test $ol_cv_dcl_sys_errlist = no ; then
1177 AC_DEFINE(DECL_SYS_ERRLIST,1,
1178 [define if sys_errlist is not declared in stdio.h or errno.h])
1180 AC_CACHE_CHECK([existence of sys_errlist],ol_cv_have_sys_errlist,[
1181 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])])
1183 if test $ol_cv_have_sys_errlist = yes ; then
1184 AC_DEFINE(HAVE_SYS_ERRLIST,1,
1185 [define if you actually have sys_errlist in your libs])
1188 AC_DEFUN([OL_NONPOSIX_STRERROR_R],
1189 [AC_CACHE_CHECK([non-posix strerror_r],ol_cv_nonposix_strerror_r,[
1190 AC_EGREP_CPP(strerror_r,[#include <string.h>],
1191 ol_decl_strerror_r=yes, ol_decl_strerror_r=no)dnl
1193 if test $ol_decl_strerror_r = yes ; then
1194 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[ /* from autoconf 2.59 */
1196 char x = *strerror_r (0, buf, sizeof buf);
1197 char *p = strerror_r (0, buf, sizeof buf);
1198 ]])],[ol_cv_nonposix_strerror_r=yes],[ol_cv_nonposix_strerror_r=no])
1200 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1204 strerror_r( 1, buf, sizeof buf );
1205 exit( buf[0] == 0 );
1207 ]])],[ol_cv_nonposix_strerror_r=yes],[ol_cv_nonposix_strerror=no],[ol_cv_nonposix_strerror=no])
1210 if test $ol_cv_nonposix_strerror_r = yes ; then
1211 AC_DEFINE(HAVE_NONPOSIX_STRERROR_R,1,
1212 [define if strerror_r returns char* instead of int])
1216 AC_DEFUN([OL_STRERROR],
1217 [OL_SYS_ERRLIST dnl TEMPORARY
1218 AC_CHECK_FUNCS(strerror strerror_r)
1219 ol_cv_func_strerror_r=no
1220 if test "${ac_cv_func_strerror_r}" = yes ; then
1221 OL_NONPOSIX_STRERROR_R
1222 elif test "${ac_cv_func_strerror}" = no ; then
1226 dnl ====================================================================
1227 dnl Early MIPS compilers (used in Ultrix 4.2) don't like
1228 dnl "int x; int *volatile a = &x; *a = 0;"
1229 dnl -- borrowed from PDKSH
1230 AC_DEFUN([OL_C_VOLATILE],
1231 [AC_CACHE_CHECK(if compiler understands volatile, ol_cv_c_volatile,
1232 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x, y, z;]], [[volatile int a; int * volatile b = x ? &y : &z;
1233 /* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
1234 *b = 0;]])],[ol_cv_c_volatile=yes],[ol_cv_c_volatile=no])])
1235 if test $ol_cv_c_volatile = yes; then
1238 AC_DEFINE(volatile,,[define as empty if volatile is not supported])
1242 dnl ====================================================================
1243 dnl Look for fetch(3)
1244 AC_DEFUN([OL_LIB_FETCH],
1246 LIBS="-lfetch -lcom_err $LIBS"
1247 AC_CACHE_CHECK([fetch(3) library],ol_cv_lib_fetch,[
1248 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1249 #include <sys/param.h>
1251 #include <fetch.h>]], [[struct url *u = fetchParseURL("file:///"); ]])],[ol_cv_lib_fetch=yes],[ol_cv_lib_fetch=no])])
1253 if test $ol_cv_lib_fetch != no ; then
1254 ol_link_fetch="-lfetch -lcom_err"
1255 AC_DEFINE(HAVE_FETCH,1,
1256 [define if you actually have FreeBSD fetch(3)])
1260 dnl ====================================================================
1261 dnl Define inet_aton is available
1262 AC_DEFUN([OL_FUNC_INET_ATON],
1263 [AC_CACHE_CHECK([for inet_aton()], ol_cv_func_inet_aton,
1264 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1265 #ifdef HAVE_SYS_TYPES_H
1266 # include <sys/types.h>
1268 #ifdef HAVE_SYS_SOCKET_H
1269 # include <sys/socket.h>
1270 # ifdef HAVE_SYS_SELECT_H
1271 # include <sys/select.h>
1273 # include <netinet/in.h>
1274 # ifdef HAVE_ARPA_INET_H
1275 # include <arpa/inet.h>
1278 ]], [[struct in_addr in;
1279 int rc = inet_aton( "255.255.255.255", &in );]])],[ol_cv_func_inet_aton=yes],[ol_cv_func_inet_aton=no])])
1280 if test $ol_cv_func_inet_aton != no; then
1281 AC_DEFINE(HAVE_INET_ATON, 1,
1282 [define to you inet_aton(3) is available])
1286 dnl ====================================================================
1287 dnl check no of arguments for ctime_r
1288 AC_DEFUN([OL_FUNC_CTIME_R_NARGS],
1289 [AC_CACHE_CHECK(number of arguments of ctime_r, ol_cv_func_ctime_r_nargs,
1290 [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])
1292 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])
1294 if test $ol_cv_func_ctime_r_nargs3 = yes &&
1295 test $ol_cv_func_ctime_r_nargs2 = no ; then
1297 ol_cv_func_ctime_r_nargs=3
1299 elif test $ol_cv_func_ctime_r_nargs3 = no &&
1300 test $ol_cv_func_ctime_r_nargs2 = yes ; then
1302 ol_cv_func_ctime_r_nargs=2
1305 ol_cv_func_ctime_r_nargs=0
1309 if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
1310 AC_DEFINE_UNQUOTED(CTIME_R_NARGS, $ol_cv_func_ctime_r_nargs,
1311 [set to the number of arguments ctime_r() expects])
1315 dnl --------------------------------------------------------------------
1316 dnl check return type of ctime_r()
1317 AC_DEFUN([OL_FUNC_CTIME_R_TYPE],
1318 [AC_CACHE_CHECK(return type of ctime_r, ol_cv_func_ctime_r_type,
1319 [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"])
1321 if test $ol_cv_func_ctime_r_type = "int" ; then
1322 AC_DEFINE(CTIME_R_RETURNS_INT,1, [define if ctime_r() returns int])
1325 dnl ====================================================================
1326 dnl check no of arguments for gethostbyname_r
1327 AC_DEFUN([OL_FUNC_GETHOSTBYNAME_R_NARGS],
1328 [AC_CACHE_CHECK(number of arguments of gethostbyname_r,
1329 ol_cv_func_gethostbyname_r_nargs,
1330 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1331 #include <sys/socket.h>
1332 #include <netinet/in.h>
1334 #define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent; char buffer[BUFSIZE];
1335 int bufsize=BUFSIZE;int h_errno;
1336 (void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
1337 buffer, bufsize, &h_errno);]])],[ol_cv_func_gethostbyname_r_nargs5=yes],[ol_cv_func_gethostbyname_r_nargs5=no])
1339 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1340 #include <sys/socket.h>
1341 #include <netinet/in.h>
1343 #define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent;struct hostent *rhent;
1344 char buffer[BUFSIZE];
1345 int bufsize=BUFSIZE;int h_errno;
1346 (void)gethostbyname_r("localhost", &hent, buffer, bufsize,
1347 &rhent, &h_errno);]])],[ol_cv_func_gethostbyname_r_nargs6=yes],[ol_cv_func_gethostbyname_r_nargs6=no])
1349 if test $ol_cv_func_gethostbyname_r_nargs5 = yes &&
1350 test $ol_cv_func_gethostbyname_r_nargs6 = no ; then
1352 ol_cv_func_gethostbyname_r_nargs=5
1354 elif test $ol_cv_func_gethostbyname_r_nargs5 = no &&
1355 test $ol_cv_func_gethostbyname_r_nargs6 = yes ; then
1357 ol_cv_func_gethostbyname_r_nargs=6
1360 ol_cv_func_gethostbyname_r_nargs=0
1363 if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
1364 AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_NARGS,
1365 $ol_cv_func_gethostbyname_r_nargs,
1366 [set to the number of arguments gethostbyname_r() expects])
1370 dnl check no of arguments for gethostbyaddr_r
1371 AC_DEFUN([OL_FUNC_GETHOSTBYADDR_R_NARGS],
1372 [AC_CACHE_CHECK(number of arguments of gethostbyaddr_r,
1373 [ol_cv_func_gethostbyaddr_r_nargs],
1374 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1375 #include <sys/socket.h>
1376 #include <netinet/in.h>
1378 #define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent; char buffer[BUFSIZE];
1380 size_t alen=sizeof(struct in_addr);
1381 int bufsize=BUFSIZE;int h_errno;
1382 (void)gethostbyaddr_r( (void *)&(add.s_addr),
1383 alen, AF_INET, &hent, buffer, bufsize, &h_errno);]])],[ol_cv_func_gethostbyaddr_r_nargs7=yes],[ol_cv_func_gethostbyaddr_r_nargs7=no])
1385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1386 #include <sys/socket.h>
1387 #include <netinet/in.h>
1389 #define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent;
1390 struct hostent *rhent; char buffer[BUFSIZE];
1392 size_t alen=sizeof(struct in_addr);
1393 int bufsize=BUFSIZE;int h_errno;
1394 (void)gethostbyaddr_r( (void *)&(add.s_addr),
1395 alen, AF_INET, &hent, buffer, bufsize,
1396 &rhent, &h_errno);]])],[ol_cv_func_gethostbyaddr_r_nargs8=yes],[ol_cv_func_gethostbyaddr_r_nargs8=no])
1398 if test $ol_cv_func_gethostbyaddr_r_nargs7 = yes &&
1399 test $ol_cv_func_gethostbyaddr_r_nargs8 = no ; then
1401 ol_cv_func_gethostbyaddr_r_nargs=7
1403 elif test $ol_cv_func_gethostbyaddr_r_nargs7 = no &&
1404 test $ol_cv_func_gethostbyaddr_r_nargs8 = yes ; then
1406 ol_cv_func_gethostbyaddr_r_nargs=8
1409 ol_cv_func_gethostbyaddr_r_nargs=0
1412 if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
1413 AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_NARGS,
1414 $ol_cv_func_gethostbyaddr_r_nargs,
1415 [set to the number of arguments gethostbyaddr_r() expects])
1419 dnl --------------------------------------------------------------------
1420 dnl Check for Cyrus SASL version compatility
1421 AC_DEFUN([OL_SASL_COMPAT],
1422 [AC_CACHE_CHECK([Cyrus SASL library version], [ol_cv_sasl_compat],[
1423 AC_EGREP_CPP(__sasl_compat,[
1424 #ifdef HAVE_SASL_SASL_H
1425 #include <sasl/sasl.h>
1430 /* Require 2.1.15+ */
1431 #if SASL_VERSION_MAJOR == 2 && SASL_VERSION_MINOR > 1
1432 char *__sasl_compat = "2.2+ or better okay (we guess)";
1433 #elif SASL_VERSION_MAJOR == 2 && SASL_VERSION_MINOR == 1 \
1434 && SASL_VERSION_STEP >=15
1435 char *__sasl_compat = "2.1.15+ or better okay";
1437 ], [ol_cv_sasl_compat=yes], [ol_cv_sasl_compat=no])])
1439 dnl ====================================================================
1440 dnl check for SSL compatibility
1441 AC_DEFUN([OL_SSL_COMPAT],
1442 [AC_CACHE_CHECK([OpenSSL library version (CRL checking capability)], [ol_cv_ssl_crl_compat],[
1443 AC_EGREP_CPP(__ssl_compat,[
1444 #ifdef HAVE_OPENSSL_SSL_H
1445 #include <openssl/ssl.h>
1450 /* Require 0.9.7d+ */
1451 #if OPENSSL_VERSION_NUMBER >= 0x0090704fL
1452 char *__ssl_compat = "0.9.7d";
1454 ], [ol_cv_ssl_crl_compat=yes], [ol_cv_ssl_crl_compat=no])])