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