1 dnl OpenLDAP Autoconf Macros
3 dnl This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 dnl Copyright 1998-2007 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 = 5 ; then
490 OL_BERKELEY_DB_TRY(ol_cv_db_db45,[-ldb45])
491 OL_BERKELEY_DB_TRY(ol_cv_db_db_45,[-ldb-45])
492 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_5,[-ldb-4.5])
493 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_5,[-ldb-4-5])
494 elif test $ol_cv_bdb_minor = 4 ; then
495 OL_BERKELEY_DB_TRY(ol_cv_db_db44,[-ldb44])
496 OL_BERKELEY_DB_TRY(ol_cv_db_db_44,[-ldb-44])
497 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_4,[-ldb-4.4])
498 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_4,[-ldb-4-4])
499 elif test $ol_cv_bdb_minor = 3 ; then
500 OL_BERKELEY_DB_TRY(ol_cv_db_db43,[-ldb43])
501 OL_BERKELEY_DB_TRY(ol_cv_db_db_43,[-ldb-43])
502 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_3,[-ldb-4.3])
503 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_3,[-ldb-4-3])
504 elif test $ol_cv_bdb_minor = 2 ; then
505 OL_BERKELEY_DB_TRY(ol_cv_db_db42,[-ldb42])
506 OL_BERKELEY_DB_TRY(ol_cv_db_db_42,[-ldb-42])
507 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_2,[-ldb-4.2])
508 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_2,[-ldb-4-2])
509 elif test $ol_cv_bdb_minor = 1 ; then
510 OL_BERKELEY_DB_TRY(ol_cv_db_db41,[-ldb41])
511 OL_BERKELEY_DB_TRY(ol_cv_db_db_41,[-ldb-41])
512 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_1,[-ldb-4.1])
513 OL_BERKELEY_DB_TRY(ol_cv_db_db_4_1,[-ldb-4-1])
515 OL_BERKELEY_DB_TRY(ol_cv_db_db_4,[-ldb-4])
516 OL_BERKELEY_DB_TRY(ol_cv_db_db4,[-ldb4])
517 OL_BERKELEY_DB_TRY(ol_cv_db_db,[-ldb])
519 elif test $ol_cv_bdb_major = 3 ; then
520 OL_BERKELEY_DB_TRY(ol_cv_db_db3,[-ldb3])
521 OL_BERKELEY_DB_TRY(ol_cv_db_db_3,[-ldb-3])
523 elif test $ol_cv_bdb_major = 2 ; then
524 OL_BERKELEY_DB_TRY(ol_cv_db_db2,[-ldb2])
525 OL_BERKELEY_DB_TRY(ol_cv_db_db_2,[-ldb-2])
527 elif test $ol_cv_bdb_major = 1 ; then
528 OL_BERKELEY_DB_TRY(ol_cv_db_db1,[-ldb1])
529 OL_BERKELEY_DB_TRY(ol_cv_db_db_1,[-ldb-1])
531 OL_BERKELEY_DB_TRY(ol_cv_db_none)
534 dnl --------------------------------------------------------------------
535 dnl Check if Berkeley DB version
536 AC_DEFUN([OL_BERKELEY_DB_VERSION],
537 [AC_CACHE_CHECK([for Berkeley DB version match], [ol_cv_berkeley_db_version], [
539 LIBS="$LTHREAD_LIBS $LIBS"
540 if test $ol_cv_lib_db != yes ; then
541 LIBS="$ol_cv_lib_db $LIBS"
544 AC_RUN_IFELSE([AC_LANG_SOURCE([[
550 #ifndef DB_VERSION_MAJOR
551 # define DB_VERSION_MAJOR 1
554 #define NULL ((void *)0)
558 #if DB_VERSION_MAJOR > 1
560 int major, minor, patch;
562 version = db_version( &major, &minor, &patch );
564 if( major != DB_VERSION_MAJOR ||
565 minor != DB_VERSION_MINOR ||
566 patch != DB_VERSION_PATCH )
568 printf("Berkeley DB version mismatch\n"
569 "\theader: %s\n\tlibrary: %s\n",
570 DB_VERSION_STRING, version);
576 }]])],[ol_cv_berkeley_db_version=yes],[ol_cv_berkeley_db_version=no],[ol_cv_berkeley_db_version=cross])
581 if test $ol_cv_berkeley_db_version = no ; then
582 AC_MSG_ERROR([Berkeley DB version mismatch])
586 dnl --------------------------------------------------------------------
587 dnl Check if Berkeley DB supports DB_THREAD
588 AC_DEFUN([OL_BERKELEY_DB_THREAD],
589 [AC_CACHE_CHECK([for Berkeley DB thread support], [ol_cv_berkeley_db_thread], [
591 LIBS="$LTHREAD_LIBS $LIBS"
592 if test $ol_cv_lib_db != yes ; then
593 LIBS="$ol_cv_lib_db $LIBS"
596 AC_RUN_IFELSE([AC_LANG_SOURCE([[
603 #define NULL ((void *)0)
608 u_int32_t flags = DB_CREATE |
614 #if DB_VERSION_MAJOR > 2
617 rc = db_env_create( &env, 0 );
619 flags |= DB_INIT_MPOOL;
620 #ifdef DB_MPOOL_PRIVATE
621 flags |= DB_MPOOL_PRIVATE;
625 printf("BerkeleyDB: %s\n", db_strerror(rc) );
629 #if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
630 rc = env->open( env, NULL, flags, 0 );
632 rc = env->open( env, NULL, NULL, flags, 0 );
636 rc = env->close( env, 0 );
640 printf("BerkeleyDB: %s\n", db_strerror(rc) );
646 memset( &env, '\0', sizeof(env) );
648 rc = db_appinit( NULL, NULL, &env, flags );
654 unlink("__db_mpool.share");
655 unlink("__db_lock.share");
659 }]])],[ol_cv_berkeley_db_thread=yes],[ol_cv_berkeley_db_thread=no],[ol_cv_berkeley_db_thread=cross])
664 if test $ol_cv_berkeley_db_thread != no ; then
665 AC_DEFINE(HAVE_BERKELEY_DB_THREAD, 1,
666 [define if Berkeley DB has DB_THREAD support])
670 dnl --------------------------------------------------------------------
672 AC_DEFUN([OL_BERKELEY_DB],
673 [ol_cv_berkeley_db=no
674 AC_CHECK_HEADERS(db.h)
675 if test $ac_cv_header_db_h = yes; then
677 if test "$ol_cv_lib_db" != no ; then
678 ol_cv_berkeley_db=yes
679 OL_BERKELEY_DB_VERSION
680 OL_BERKELEY_DB_THREAD
684 dnl --------------------------------------------------------------------
685 dnl Check for version compatility with back-bdb
686 AC_DEFUN([OL_BDB_COMPAT],
687 [AC_CACHE_CHECK([Berkeley DB version for BDB/HDB backends], [ol_cv_bdb_compat],[
688 AC_EGREP_CPP(__db_version_compat,[
691 /* this check could be improved */
692 #ifndef DB_VERSION_MAJOR
693 # define DB_VERSION_MAJOR 1
695 #ifndef DB_VERSION_MINOR
696 # define DB_VERSION_MINOR 0
699 /* require 4.2 or later, but exclude 4.3 */
700 #if (DB_VERSION_MAJOR >= 4) && (DB_VERSION_MINOR >= 2) && (DB_VERSION_MINOR !=3)
703 ], [ol_cv_bdb_compat=yes], [ol_cv_bdb_compat=no])])
706 dnl --------------------------------------------------------------------
707 dnl Find old Berkeley DB 1.85/1.86
708 AC_DEFUN([OL_BERKELEY_COMPAT_DB],
709 [AC_CHECK_HEADERS(db_185.h db.h)
710 if test $ac_cv_header_db_185_h = yes || test $ac_cv_header_db_h = yes; then
711 AC_CACHE_CHECK([if Berkeley DB header compatibility], [ol_cv_header_db1],[
712 AC_EGREP_CPP(__db_version_1,[
719 /* this check could be improved */
720 #ifndef DB_VERSION_MAJOR
721 # define DB_VERSION_MAJOR 1
724 #if DB_VERSION_MAJOR == 1
727 ], [ol_cv_header_db1=yes], [ol_cv_header_db1=no])])
729 if test $ol_cv_header_db1 = yes ; then
731 if test "$ol_cv_lib_db" != no ; then
732 ol_cv_berkeley_db=yes
738 dnl ====================================================================
739 dnl Check if GDBM library exists
740 dnl Check for gdbm_open in standard libraries or -lgdbm
742 dnl defines ol_cv_lib_gdbm to 'yes' or '-lgdbm' or 'no'
743 dnl 'yes' implies gdbm_open is in $LIBS
746 dnl AC_CHECK_FUNC(gdbm_open)
747 dnl AC_CHECK_LIB(gdbm,gdbm_open)
749 AC_DEFUN([OL_LIB_GDBM],
750 [AC_CACHE_CHECK(for GDBM library, [ol_cv_lib_gdbm],
752 AC_CHECK_FUNC(gdbm_open,[ol_cv_lib_gdbm=yes], [
753 AC_CHECK_LIB(gdbm,gdbm_open,[ol_cv_lib_gdbm=-lgdbm],[ol_cv_lib_gdbm=no])
759 dnl --------------------------------------------------------------------
760 dnl Check if GDBM exists
762 dnl defines ol_cv_gdbm to 'yes' or 'no'
766 dnl AC_CHECK_HEADERS(gdbm.h)
769 [AC_REQUIRE([OL_LIB_GDBM])
770 AC_CHECK_HEADERS(gdbm.h)
771 AC_CACHE_CHECK(for db, [ol_cv_gdbm], [
772 if test $ol_cv_lib_gdbm = no || test $ac_cv_header_gdbm_h = no ; then
778 if test $ol_cv_gdbm = yes ; then
779 AC_DEFINE(HAVE_GDBM,1, [define if GNU DBM is available])
783 dnl ====================================================================
784 dnl Check if MDBM library exists
785 dnl Check for mdbm_open in standard libraries or -lmdbm
787 dnl defines ol_cv_lib_mdbm to 'yes' or '-lmdbm' or 'no'
788 dnl 'yes' implies mdbm_open is in $LIBS
791 dnl AC_CHECK_FUNC(mdbm_set_chain)
792 dnl AC_CHECK_LIB(mdbm,mdbm_set_chain)
794 AC_DEFUN([OL_LIB_MDBM],
795 [AC_CACHE_CHECK(for MDBM library, [ol_cv_lib_mdbm],
797 AC_CHECK_FUNC(mdbm_set_chain,[ol_cv_lib_mdbm=yes], [
798 AC_CHECK_LIB(mdbm,mdbm_set_chain,[ol_cv_lib_mdbm=-lmdbm],[ol_cv_lib_mdbm=no])
804 dnl --------------------------------------------------------------------
805 dnl Check if MDBM exists
807 dnl defines ol_cv_mdbm to 'yes' or 'no'
811 dnl AC_CHECK_HEADERS(mdbm.h)
814 [AC_REQUIRE([OL_LIB_MDBM])
815 AC_CHECK_HEADERS(mdbm.h)
816 AC_CACHE_CHECK(for db, [ol_cv_mdbm], [
817 if test $ol_cv_lib_mdbm = no || test $ac_cv_header_mdbm_h = no ; then
823 if test $ol_cv_mdbm = yes ; then
824 AC_DEFINE(HAVE_MDBM,1, [define if MDBM is available])
828 dnl ====================================================================
829 dnl Check if NDBM library exists
830 dnl Check for dbm_open in standard libraries or -lndbm or -ldbm
832 dnl defines ol_cv_lib_ndbm to 'yes' or '-lndbm' or -ldbm or 'no'
833 dnl 'yes' implies ndbm_open is in $LIBS
836 dnl AC_CHECK_FUNC(dbm_open)
837 dnl AC_CHECK_LIB(ndbm,dbm_open)
838 dnl AC_CHECK_LIB(dbm,dbm_open)
841 dnl should also check SVR4 case: dbm_open() in -lucb but that
842 dnl would requiring dealing with -L/usr/ucblib
844 AC_DEFUN([OL_LIB_NDBM],
845 [AC_CACHE_CHECK(for NDBM library, [ol_cv_lib_ndbm],
847 AC_CHECK_FUNC(dbm_open,[ol_cv_lib_ndbm=yes], [
848 AC_CHECK_LIB(ndbm,dbm_open,[ol_cv_lib_ndbm=-lndbm], [
849 AC_CHECK_LIB(dbm,dbm_open,[ol_cv_lib_ndbm=-ldbm],
850 [ol_cv_lib_ndbm=no])dnl
857 dnl --------------------------------------------------------------------
858 dnl Check if NDBM exists
860 dnl defines ol_cv_ndbm to 'yes' or 'no'
864 dnl AC_CHECK_HEADERS(ndbm.h)
867 dnl Doesn't handle SVR4 case (see above)
870 [AC_REQUIRE([OL_LIB_NDBM])
871 AC_CHECK_HEADERS(ndbm.h)
872 AC_CACHE_CHECK(for db, [ol_cv_ndbm], [
873 if test $ol_cv_lib_ndbm = no || test $ac_cv_header_ndbm_h = no ; then
879 if test $ol_cv_ndbm = yes ; then
880 AC_DEFINE(HAVE_NDBM,1, [define if NDBM is available])
884 dnl ====================================================================
885 dnl Check POSIX Thread version
887 dnl defines ol_cv_pthread_version to 4, 5, 6, 7, 8, 10, depending on the
888 dnl version of the POSIX.4a Draft that is implemented.
889 dnl 10 == POSIX.4a Final == POSIX.1c-1996 for our purposes.
890 dnl Existence of pthread.h should be tested separately.
893 dnl pthread_detach() was dropped in Draft 8, it is present
894 dnl in every other version
895 dnl PTHREAD_CREATE_UNDETACHED is only in Draft 7, it was called
896 dnl PTHREAD_CREATE_JOINABLE after that
897 dnl pthread_attr_create was renamed to pthread_attr_init in Draft 6.
898 dnl Draft 6-10 has _init, Draft 4-5 has _create.
899 dnl pthread_attr_default was dropped in Draft 6, only 4 and 5 have it
900 dnl PTHREAD_MUTEX_INITIALIZER was introduced in Draft 5. It's not
901 dnl interesting to us because we don't try to statically
902 dnl initialize mutexes. 5-10 has it.
904 dnl Draft 9 and 10 are equivalent for our purposes.
906 AC_DEFUN([OL_POSIX_THREAD_VERSION],
907 [AC_CACHE_CHECK([POSIX thread version],[ol_cv_pthread_version],[
908 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
909 # include <pthread.h>
911 int i = PTHREAD_CREATE_JOINABLE;
913 AC_EGREP_HEADER(pthread_detach,pthread.h,
914 ol_cv_pthread_version=10, ol_cv_pthread_version=8)],[
915 AC_EGREP_CPP(draft7,[
916 # include <pthread.h>
917 # ifdef PTHREAD_CREATE_UNDETACHED
920 ], ol_cv_pthread_version=7, [
921 AC_EGREP_HEADER(pthread_attr_init,pthread.h,
922 ol_cv_pthread_version=6, [
923 AC_EGREP_CPP(draft5,[
924 # include <pthread.h>
925 #ifdef PTHREAD_MUTEX_INITIALIZER
928 ], ol_cv_pthread_version=5, ol_cv_pthread_version=4) ]) ]) ])
932 dnl --------------------------------------------------------------------
933 AC_DEFUN([OL_PTHREAD_TEST_INCLUDES], [[
934 /* pthread test headers */
936 #if HAVE_PTHREADS < 7
940 #define NULL (void*)0
946 return (void *) (p == NULL);
949 AC_DEFUN([OL_PTHREAD_TEST_FUNCTION],[[
950 /* pthread test function */
951 #ifndef PTHREAD_CREATE_DETACHED
952 #define PTHREAD_CREATE_DETACHED 1
956 int detach = PTHREAD_CREATE_DETACHED;
958 #if HAVE_PTHREADS > 4
962 status = pthread_attr_init(&attr);
963 if( status ) return status;
965 #if HAVE_PTHREADS < 7
966 status = pthread_attr_setdetachstate(&attr, &detach);
967 if( status < 0 ) status = errno;
969 status = pthread_attr_setdetachstate(&attr, detach);
971 if( status ) return status;
972 status = pthread_create( &t, &attr, task, NULL );
973 #if HAVE_PTHREADS < 7
974 if( status < 0 ) status = errno;
976 if( status ) return status;
978 /* Draft 4 pthreads */
979 status = pthread_create( &t, pthread_attr_default, task, NULL );
980 if( status ) return errno;
982 /* give thread a chance to complete */
983 /* it should remain joinable and hence detachable */
986 status = pthread_detach( &t );
987 if( status ) return errno;
990 #ifdef HAVE_LINUX_THREADS
991 pthread_kill_other_threads_np();
997 AC_DEFUN([OL_PTHREAD_TEST_PROGRAM],
998 AC_LANG_SOURCE([OL_PTHREAD_TEST_INCLUDES
1000 int main(argc, argv)
1004 OL_PTHREAD_TEST_FUNCTION
1007 dnl --------------------------------------------------------------------
1008 AC_DEFUN([OL_PTHREAD_TRY], [# Pthread try link: $1 ($2)
1009 if test "$ol_link_threads" = no ; then
1011 AC_CACHE_CHECK([for pthread link with $1], [$2], [
1016 AC_RUN_IFELSE([OL_PTHREAD_TEST_PROGRAM],
1019 [AC_LINK_IFELSE([AC_LANG_PROGRAM(OL_PTHREAD_TEST_INCLUDES,
1020 OL_PTHREAD_TEST_FUNCTION)],
1021 [$2=yes], [$2=no])])
1027 if test $$2 = yes ; then
1028 ol_link_pthreads="$1"
1029 ol_link_threads=posix
1034 dnl ====================================================================
1035 dnl Check GNU Pth pthread Header
1037 dnl defines ol_cv_header linux_threads to 'yes' or 'no'
1038 dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
1039 dnl doesn't exists. Existance of pthread.h should separately
1042 AC_DEFUN([OL_HEADER_GNU_PTH_PTHREAD_H], [
1043 AC_CACHE_CHECK([for GNU Pth pthread.h],
1044 [ol_cv_header_gnu_pth_pthread_h],
1045 [AC_EGREP_CPP(__gnu_pth__,
1046 [#include <pthread.h>
1047 #ifdef _POSIX_THREAD_IS_GNU_PTH
1051 [ol_cv_header_gnu_pth_pthread_h=yes],
1052 [ol_cv_header_gnu_pth_pthread_h=no])
1055 dnl ====================================================================
1056 dnl Check for NT Threads
1057 AC_DEFUN([OL_NT_THREADS], [
1058 AC_CHECK_FUNC(_beginthread)
1060 if test $ac_cv_func__beginthread = yes ; then
1061 AC_DEFINE(HAVE_NT_THREADS,1,[if you have NT Threads])
1062 ol_cv_nt_threads=yes
1065 dnl ====================================================================
1066 dnl Check LinuxThreads Header
1068 dnl defines ol_cv_header linux_threads to 'yes' or 'no'
1069 dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
1070 dnl doesn't exists. Existance of pthread.h should separately
1073 AC_DEFUN([OL_HEADER_LINUX_THREADS], [
1074 AC_CACHE_CHECK([for LinuxThreads pthread.h],
1075 [ol_cv_header_linux_threads],
1076 [AC_EGREP_CPP(pthread_kill_other_threads_np,
1077 [#include <pthread.h>],
1078 [ol_cv_header_linux_threads=yes],
1079 [ol_cv_header_linux_threads=no])
1081 if test $ol_cv_header_linux_threads = yes; then
1082 AC_DEFINE(HAVE_LINUX_THREADS,1,[if you have LinuxThreads])
1085 dnl --------------------------------------------------------------------
1086 dnl Check LinuxThreads Implementation
1088 dnl defines ol_cv_sys_linux_threads to 'yes' or 'no'
1089 dnl 'no' implies pthreads implementation is not LinuxThreads.
1091 AC_DEFUN([OL_SYS_LINUX_THREADS], [
1092 AC_CHECK_FUNCS(pthread_kill_other_threads_np)
1093 AC_CACHE_CHECK([for LinuxThreads implementation],
1094 [ol_cv_sys_linux_threads],
1095 [ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np])
1098 dnl --------------------------------------------------------------------
1099 dnl Check LinuxThreads consistency
1100 AC_DEFUN([OL_LINUX_THREADS], [
1101 AC_REQUIRE([OL_HEADER_LINUX_THREADS])
1102 AC_REQUIRE([OL_SYS_LINUX_THREADS])
1103 AC_CACHE_CHECK([for LinuxThreads consistency], [ol_cv_linux_threads], [
1104 if test $ol_cv_header_linux_threads = yes &&
1105 test $ol_cv_sys_linux_threads = yes; then
1106 ol_cv_linux_threads=yes
1107 elif test $ol_cv_header_linux_threads = no &&
1108 test $ol_cv_sys_linux_threads = no; then
1109 ol_cv_linux_threads=no
1111 ol_cv_linux_threads=error
1116 dnl ====================================================================
1117 dnl Check for POSIX Regex
1118 AC_DEFUN([OL_POSIX_REGEX], [
1119 AC_CACHE_CHECK([for compatible POSIX regex],ol_cv_c_posix_regex,[
1120 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1121 #include <sys/types.h>
1123 static char *pattern, *string;
1131 if(regcomp(&re, pattern, 0)) {
1135 string = "ALL MATCH";
1137 rc = regexec(&re, string, 0, (void*)0, 0);
1142 }]])],[ol_cv_c_posix_regex=yes],[ol_cv_c_posix_regex=no],[ol_cv_c_posix_regex=cross])])
1145 dnl ====================================================================
1146 dnl Check if toupper() requires islower() to be called first
1147 AC_DEFUN([OL_C_UPPER_LOWER],
1148 [AC_CACHE_CHECK([if toupper() requires islower()],ol_cv_c_upper_lower,[
1149 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1153 if ('C' == toupper('C'))
1157 }]])],[ol_cv_c_upper_lower=no],[ol_cv_c_upper_lower=yes],[ol_cv_c_upper_lower=safe])])
1158 if test $ol_cv_c_upper_lower != no ; then
1159 AC_DEFINE(C_UPPER_LOWER,1, [define if toupper() requires islower()])
1163 dnl ====================================================================
1164 dnl Error string checks
1166 dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
1167 dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
1168 dnl Reported by Keith Bostic.
1169 AC_DEFUN([OL_SYS_ERRLIST],
1170 [AC_CACHE_CHECK([declaration of sys_errlist],ol_cv_dcl_sys_errlist,[
1171 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1173 #include <sys/types.h>
1177 #endif ]], [[char *c = (char *) *sys_errlist]])],[ol_cv_dcl_sys_errlist=yes
1178 ol_cv_have_sys_errlist=yes],[ol_cv_dcl_sys_errlist=no])])
1180 # It's possible (for near-UNIX clones) that sys_errlist doesn't exist
1181 if test $ol_cv_dcl_sys_errlist = no ; then
1182 AC_DEFINE(DECL_SYS_ERRLIST,1,
1183 [define if sys_errlist is not declared in stdio.h or errno.h])
1185 AC_CACHE_CHECK([existence of sys_errlist],ol_cv_have_sys_errlist,[
1186 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])])
1188 if test $ol_cv_have_sys_errlist = yes ; then
1189 AC_DEFINE(HAVE_SYS_ERRLIST,1,
1190 [define if you actually have sys_errlist in your libs])
1193 AC_DEFUN([OL_NONPOSIX_STRERROR_R],
1194 [AC_CACHE_CHECK([non-posix strerror_r],ol_cv_nonposix_strerror_r,[
1195 AC_EGREP_CPP(strerror_r,[#include <string.h>],
1196 ol_decl_strerror_r=yes, ol_decl_strerror_r=no)dnl
1198 if test $ol_decl_strerror_r = yes ; then
1199 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[ /* from autoconf 2.59 */
1201 char x = *strerror_r (0, buf, sizeof buf);
1202 char *p = strerror_r (0, buf, sizeof buf);
1203 ]])],[ol_cv_nonposix_strerror_r=yes],[ol_cv_nonposix_strerror_r=no])
1205 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1209 strerror_r( 1, buf, sizeof buf );
1210 exit( buf[0] == 0 );
1212 ]])],[ol_cv_nonposix_strerror_r=yes],[ol_cv_nonposix_strerror=no],[ol_cv_nonposix_strerror=no])
1215 if test $ol_cv_nonposix_strerror_r = yes ; then
1216 AC_DEFINE(HAVE_NONPOSIX_STRERROR_R,1,
1217 [define if strerror_r returns char* instead of int])
1221 AC_DEFUN([OL_STRERROR],
1222 [OL_SYS_ERRLIST dnl TEMPORARY
1223 AC_CHECK_FUNCS(strerror strerror_r)
1224 ol_cv_func_strerror_r=no
1225 if test "${ac_cv_func_strerror_r}" = yes ; then
1226 OL_NONPOSIX_STRERROR_R
1227 elif test "${ac_cv_func_strerror}" = no ; then
1231 dnl ====================================================================
1232 dnl Early MIPS compilers (used in Ultrix 4.2) don't like
1233 dnl "int x; int *volatile a = &x; *a = 0;"
1234 dnl -- borrowed from PDKSH
1235 AC_DEFUN([OL_C_VOLATILE],
1236 [AC_CACHE_CHECK(if compiler understands volatile, ol_cv_c_volatile,
1237 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int x, y, z;]], [[volatile int a; int * volatile b = x ? &y : &z;
1238 /* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
1239 *b = 0;]])],[ol_cv_c_volatile=yes],[ol_cv_c_volatile=no])])
1240 if test $ol_cv_c_volatile = yes; then
1243 AC_DEFINE(volatile,,[define as empty if volatile is not supported])
1247 dnl ====================================================================
1248 dnl Look for fetch(3)
1249 AC_DEFUN([OL_LIB_FETCH],
1251 LIBS="-lfetch -lcom_err $LIBS"
1252 AC_CACHE_CHECK([fetch(3) library],ol_cv_lib_fetch,[
1253 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1254 #include <sys/param.h>
1256 #include <fetch.h>]], [[struct url *u = fetchParseURL("file:///"); ]])],[ol_cv_lib_fetch=yes],[ol_cv_lib_fetch=no])])
1258 if test $ol_cv_lib_fetch != no ; then
1259 ol_link_fetch="-lfetch -lcom_err"
1260 AC_DEFINE(HAVE_FETCH,1,
1261 [define if you actually have FreeBSD fetch(3)])
1265 dnl ====================================================================
1266 dnl Define inet_aton is available
1267 AC_DEFUN([OL_FUNC_INET_ATON],
1268 [AC_CACHE_CHECK([for inet_aton()], ol_cv_func_inet_aton,
1269 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1270 #ifdef HAVE_SYS_TYPES_H
1271 # include <sys/types.h>
1273 #ifdef HAVE_SYS_SOCKET_H
1274 # include <sys/socket.h>
1275 # ifdef HAVE_SYS_SELECT_H
1276 # include <sys/select.h>
1278 # include <netinet/in.h>
1279 # ifdef HAVE_ARPA_INET_H
1280 # include <arpa/inet.h>
1283 ]], [[struct in_addr in;
1284 int rc = inet_aton( "255.255.255.255", &in );]])],[ol_cv_func_inet_aton=yes],[ol_cv_func_inet_aton=no])])
1285 if test $ol_cv_func_inet_aton != no; then
1286 AC_DEFINE(HAVE_INET_ATON, 1,
1287 [define to you inet_aton(3) is available])
1291 dnl ====================================================================
1292 dnl check no of arguments for ctime_r
1293 AC_DEFUN([OL_FUNC_CTIME_R_NARGS],
1294 [AC_CACHE_CHECK(number of arguments of ctime_r, ol_cv_func_ctime_r_nargs,
1295 [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])
1297 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])
1299 if test $ol_cv_func_ctime_r_nargs3 = yes &&
1300 test $ol_cv_func_ctime_r_nargs2 = no ; then
1302 ol_cv_func_ctime_r_nargs=3
1304 elif test $ol_cv_func_ctime_r_nargs3 = no &&
1305 test $ol_cv_func_ctime_r_nargs2 = yes ; then
1307 ol_cv_func_ctime_r_nargs=2
1310 ol_cv_func_ctime_r_nargs=0
1314 if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
1315 AC_DEFINE_UNQUOTED(CTIME_R_NARGS, $ol_cv_func_ctime_r_nargs,
1316 [set to the number of arguments ctime_r() expects])
1320 dnl --------------------------------------------------------------------
1321 dnl check return type of ctime_r()
1322 AC_DEFUN([OL_FUNC_CTIME_R_TYPE],
1323 [AC_CACHE_CHECK(return type of ctime_r, ol_cv_func_ctime_r_type,
1324 [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"])
1326 if test $ol_cv_func_ctime_r_type = "int" ; then
1327 AC_DEFINE(CTIME_R_RETURNS_INT,1, [define if ctime_r() returns int])
1330 dnl ====================================================================
1331 dnl check no of arguments for gethostbyname_r
1332 AC_DEFUN([OL_FUNC_GETHOSTBYNAME_R_NARGS],
1333 [AC_CACHE_CHECK(number of arguments of gethostbyname_r,
1334 ol_cv_func_gethostbyname_r_nargs,
1335 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1336 #include <sys/socket.h>
1337 #include <netinet/in.h>
1339 #define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent; char buffer[BUFSIZE];
1340 int bufsize=BUFSIZE;int h_errno;
1341 (void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
1342 buffer, bufsize, &h_errno);]])],[ol_cv_func_gethostbyname_r_nargs5=yes],[ol_cv_func_gethostbyname_r_nargs5=no])
1344 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1345 #include <sys/socket.h>
1346 #include <netinet/in.h>
1348 #define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent;struct hostent *rhent;
1349 char buffer[BUFSIZE];
1350 int bufsize=BUFSIZE;int h_errno;
1351 (void)gethostbyname_r("localhost", &hent, buffer, bufsize,
1352 &rhent, &h_errno);]])],[ol_cv_func_gethostbyname_r_nargs6=yes],[ol_cv_func_gethostbyname_r_nargs6=no])
1354 if test $ol_cv_func_gethostbyname_r_nargs5 = yes &&
1355 test $ol_cv_func_gethostbyname_r_nargs6 = no ; then
1357 ol_cv_func_gethostbyname_r_nargs=5
1359 elif test $ol_cv_func_gethostbyname_r_nargs5 = no &&
1360 test $ol_cv_func_gethostbyname_r_nargs6 = yes ; then
1362 ol_cv_func_gethostbyname_r_nargs=6
1365 ol_cv_func_gethostbyname_r_nargs=0
1368 if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
1369 AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_NARGS,
1370 $ol_cv_func_gethostbyname_r_nargs,
1371 [set to the number of arguments gethostbyname_r() expects])
1375 dnl check no of arguments for gethostbyaddr_r
1376 AC_DEFUN([OL_FUNC_GETHOSTBYADDR_R_NARGS],
1377 [AC_CACHE_CHECK(number of arguments of gethostbyaddr_r,
1378 [ol_cv_func_gethostbyaddr_r_nargs],
1379 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1380 #include <sys/socket.h>
1381 #include <netinet/in.h>
1383 #define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent; char buffer[BUFSIZE];
1385 size_t alen=sizeof(struct in_addr);
1386 int bufsize=BUFSIZE;int h_errno;
1387 (void)gethostbyaddr_r( (void *)&(add.s_addr),
1388 alen, AF_INET, &hent, buffer, bufsize, &h_errno);]])],[ol_cv_func_gethostbyaddr_r_nargs7=yes],[ol_cv_func_gethostbyaddr_r_nargs7=no])
1390 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1391 #include <sys/socket.h>
1392 #include <netinet/in.h>
1394 #define BUFSIZE (sizeof(struct hostent)+10)]], [[struct hostent hent;
1395 struct hostent *rhent; char buffer[BUFSIZE];
1397 size_t alen=sizeof(struct in_addr);
1398 int bufsize=BUFSIZE;int h_errno;
1399 (void)gethostbyaddr_r( (void *)&(add.s_addr),
1400 alen, AF_INET, &hent, buffer, bufsize,
1401 &rhent, &h_errno);]])],[ol_cv_func_gethostbyaddr_r_nargs8=yes],[ol_cv_func_gethostbyaddr_r_nargs8=no])
1403 if test $ol_cv_func_gethostbyaddr_r_nargs7 = yes &&
1404 test $ol_cv_func_gethostbyaddr_r_nargs8 = no ; then
1406 ol_cv_func_gethostbyaddr_r_nargs=7
1408 elif test $ol_cv_func_gethostbyaddr_r_nargs7 = no &&
1409 test $ol_cv_func_gethostbyaddr_r_nargs8 = yes ; then
1411 ol_cv_func_gethostbyaddr_r_nargs=8
1414 ol_cv_func_gethostbyaddr_r_nargs=0
1417 if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
1418 AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_NARGS,
1419 $ol_cv_func_gethostbyaddr_r_nargs,
1420 [set to the number of arguments gethostbyaddr_r() expects])
1424 dnl --------------------------------------------------------------------
1425 dnl Check for Cyrus SASL version compatility
1426 AC_DEFUN([OL_SASL_COMPAT],
1427 [AC_CACHE_CHECK([Cyrus SASL library version], [ol_cv_sasl_compat],[
1428 AC_EGREP_CPP(__sasl_compat,[
1429 #ifdef HAVE_SASL_SASL_H
1430 #include <sasl/sasl.h>
1435 /* Require 2.1.15+ */
1436 #if SASL_VERSION_MAJOR == 2 && SASL_VERSION_MINOR > 1
1437 char *__sasl_compat = "2.2+ or better okay (we guess)";
1438 #elif SASL_VERSION_MAJOR == 2 && SASL_VERSION_MINOR == 1 \
1439 && SASL_VERSION_STEP >=15
1440 char *__sasl_compat = "2.1.15+ or better okay";
1442 ], [ol_cv_sasl_compat=yes], [ol_cv_sasl_compat=no])])
1444 dnl ====================================================================
1445 dnl check for SSL compatibility
1446 AC_DEFUN([OL_SSL_COMPAT],
1447 [AC_CACHE_CHECK([OpenSSL library version (CRL checking capability)],
1448 [ol_cv_ssl_crl_compat],[
1449 AC_EGREP_CPP(__ssl_compat,[
1450 #ifdef HAVE_OPENSSL_SSL_H
1451 #include <openssl/ssl.h>
1454 /* Require 0.9.7d+ */
1455 #if OPENSSL_VERSION_NUMBER >= 0x0090704fL
1456 char *__ssl_compat = "0.9.7d";
1458 ], [ol_cv_ssl_crl_compat=yes], [ol_cv_ssl_crl_compat=no])])