]> git.sur5r.net Git - openldap/blob - build/openldap.m4
cce2992a0400209e2117787865d22b4d1494b856
[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,[$2 (]ifelse($3,,auto,$3)[)],[
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,[$2 (]ifelse($3,,yes,$3)[)],[
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 Check if db.h is Berkeley DB2
242 dnl
243 dnl defines ol_cv_header_db2 to 'yes' or 'no'
244 dnl
245 dnl uses:
246 dnl             AC_CHECK_HEADERS(db.h)
247 dnl
248 AC_DEFUN([OL_HEADER_BERKELEY_DB2],
249 [AC_CHECK_HEADERS(db.h)
250 if test $ac_cv_header_db_h = yes ; then
251         AC_CACHE_CHECK([if db.h is DB2], [ol_cv_header_db2],[
252                 AC_EGREP_CPP(__db_version_2,[
253 #                       include <db.h>
254                         /* this check could be improved */
255 #                       ifdef DB_VERSION_MAJOR
256 #                               if DB_VERSION_MAJOR == 2
257                                         __db_version_2;
258 #                               endif
259 #                       endif
260                 ], ol_cv_header_db2=yes, ol_cv_header_db2=no)])
261 else
262         ol_cv_header_db2=no
263 fi
264 ])dnl
265 dnl --------------------------------------------------------------------
266 dnl Check if Berkeley DB2 library exists
267 dnl Check for dbopen in standard libraries or -ldb
268 dnl
269 dnl defines ol_cv_lib_db2 to '-ldb' or 'no'
270 dnl
271 dnl uses:
272 dnl             AC_CHECK_LIB(db,db_appexit)
273 dnl
274 AC_DEFUN([OL_LIB_BERKELEY_DB2],
275 [AC_CACHE_CHECK([for DB2 library], [ol_cv_lib_db2],
276 [       ol_LIBS="$LIBS"
277         AC_CHECK_LIB(db,db_appexit,[ol_cv_lib_db2=-ldb],[ol_cv_lib_db2=no])
278         LIBS="$ol_LIBS"
279 ])
280 ])dnl
281 dnl
282 dnl --------------------------------------------------------------------
283 dnl Check if Berkeley db2 exists
284 dnl
285 dnl defines ol_cv_berkeley_db2 to 'yes' or 'no'
286 dnl 
287 dnl uses:
288 dnl             OL_LIB_BERKELEY_DB2
289 dnl             OL_HEADER_BERKELEY_DB2
290 dnl
291 AC_DEFUN([OL_BERKELEY_DB2],
292 [AC_REQUIRE([OL_LIB_BERKELEY_DB2])
293  AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
294  AC_CACHE_CHECK([for Berkeley DB2], [ol_cv_berkeley_db2], [
295         if test "$ol_cv_lib_db2" = no -o "$ol_cv_header_db2" = no ; then
296                 ol_cv_berkeley_db2=no
297         else
298                 ol_cv_berkeley_db2=yes
299         fi
300 ])
301  if test $ol_cv_berkeley_db2 = yes ; then
302         AC_DEFINE(HAVE_BERKELEY_DB2,1, [define if Berkeley DBv2 is available])
303  fi
304 ])dnl
305 dnl
306 dnl
307 dnl --------------------------------------------------------------------
308 dnl Check if Berkeley db2 supports DB_THREAD
309 AC_DEFUN([OL_BERKELEY_DB2_DB_THREAD],
310 [AC_CACHE_CHECK([for DB_THREAD support], [ol_cv_berkeley_db2_db_thread], [
311         ol_LIBS="$LIBS"
312         if test $ol_cv_lib_db2 != yes ; then
313                 LIBS="$ol_cv_lib_db2"
314         fi
315
316         AC_TRY_RUN([
317 #include <db.h>
318 #ifndef NULL
319 #define NULL ((void *)0)
320 #endif
321 main()
322 {
323         int rc;
324         DB_ENV env;
325         u_int32_t flags = DB_CREATE | DB_THREAD;
326
327         memset( &env, '\0', sizeof(env) );
328
329         rc = db_appinit( NULL, NULL, &env, flags );
330
331         if( rc == 0 ) {
332                 db_appexit( &env );
333         }
334
335         return rc;
336 }],
337         [ol_cv_berkeley_db2_db_thread=yes],
338         [ol_cv_berkeley_db2_db_thread=no],
339         [ol_cv_berkeley_db2_db_thread=cross])
340
341         LIBS="$ol_LIBS"
342
343         if test $ol_cv_berkeley_db2_db_thread != no ; then
344                 AC_DEFINE(HAVE_BERKELEY_DB2_DB_THREAD, 1,
345                         [define if BerkeleyDB2 has DB_THREAD support])
346         fi
347 ])])dnl
348 dnl ====================================================================
349 dnl Check for db.h/db_185.h is Berkeley DB
350 dnl
351 dnl defines ol_cv_header_db to 'yes' or 'no'
352 dnl
353 dnl uses:
354 dnl             OL_HEADER_BERKELEY_DB2
355 dnl             AC_CHECK_HEADERS(db_185.h)
356 dnl
357 AC_DEFUN([OL_HEADER_BERKELEY_DB],
358 [AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
359 AC_CHECK_HEADERS(db_185.h)
360 if test "$ol_cv_header_db2" = yes ; then
361         dnl db.h is db2! 
362
363         ol_cv_header_db=$ac_cv_header_db_185_h
364 else
365         ol_cv_header_db=$ac_cv_header_db_h
366 fi
367 ])dnl
368 dnl
369 dnl --------------------------------------------------------------------
370 dnl Check if Berkeley DB library exists
371 dnl Check for dbopen in standard libraries or -ldb
372 dnl
373 dnl defines ol_cv_lib_db to 'yes' or '-ldb' or 'no'
374 dnl             'yes' implies dbopen is in $LIBS
375 dnl
376 dnl uses:
377 dnl             AC_CHECK_FUNC(dbopen)
378 dnl             AC_CHECK_LIB(db,dbopen)
379 dnl
380 AC_DEFUN([OL_LIB_BERKELEY_DB],
381 [AC_CACHE_CHECK([for Berkeley DB library], [ol_cv_lib_db],
382 [
383         AC_CHECK_HEADERS(db1/db.h)
384         ol_LIBS="$LIBS"
385         AC_CHECK_FUNC(dbopen,[ol_cv_lib_db=yes], [
386                 AC_CHECK_LIB(db1,dbopen,[ol_cv_lib_db=-ldb1],[
387                         AC_CHECK_LIB(db,dbopen,[ol_cv_lib_db=-ldb],
388                         [ol_cv_lib_db=no])
389                 ])
390         ])
391         LIBS="$ol_LIBS"
392 ])
393 ])dnl
394 dnl
395 dnl --------------------------------------------------------------------
396 dnl Check if Berkeley DB exists
397 dnl
398 dnl defines ol_cv_berkeley_db to 'yes' or 'no'
399 dnl 
400 dnl uses:
401 dnl             OL_LIB_BERKELEY_DB
402 dnl             OL_HEADER_BERKELEY_DB
403 dnl
404 AC_DEFUN([OL_BERKELEY_DB],
405 [AC_REQUIRE([OL_LIB_BERKELEY_DB])
406  AC_REQUIRE([OL_HEADER_BERKELEY_DB])
407  AC_CACHE_CHECK([for Berkeley DB], [ol_cv_berkeley_db], [
408         if test "$ol_cv_lib_db" = no -o "$ol_cv_header_db" = no ; then
409                 ol_cv_berkeley_db=no
410         else
411                 ol_cv_berkeley_db=yes
412         fi
413 ])
414  if test $ol_cv_berkeley_db = yes ; then
415         AC_DEFINE(HAVE_BERKELEY_DB,1, [define if Berkeley DB is available])
416  fi
417 ])dnl
418 dnl
419 dnl ====================================================================
420 dnl Check if GDBM library exists
421 dnl Check for gdbm_open in standard libraries or -lgdbm
422 dnl
423 dnl defines ol_cv_lib_gdbm to 'yes' or '-lgdbm' or 'no'
424 dnl             'yes' implies gdbm_open is in $LIBS
425 dnl
426 dnl uses:
427 dnl             AC_CHECK_FUNC(gdbm_open)
428 dnl             AC_CHECK_LIB(gdbm,gdbm_open)
429 dnl
430 AC_DEFUN([OL_LIB_GDBM],
431 [AC_CACHE_CHECK(for GDBM library, [ol_cv_lib_gdbm],
432 [       ol_LIBS="$LIBS"
433         AC_CHECK_FUNC(gdbm_open,[ol_cv_lib_gdbm=yes], [
434                 AC_CHECK_LIB(gdbm,gdbm_open,[ol_cv_lib_gdbm=-lgdbm],[ol_cv_lib_gdbm=no])
435         ])
436         LIBS="$ol_LIBS"
437 ])
438 ])dnl
439 dnl
440 dnl --------------------------------------------------------------------
441 dnl Check if GDBM exists
442 dnl
443 dnl defines ol_cv_gdbm to 'yes' or 'no'
444 dnl 
445 dnl uses:
446 dnl             OL_LIB_GDBM
447 dnl             AC_CHECK_HEADERS(gdbm.h)
448 dnl
449 AC_DEFUN([OL_GDBM],
450 [AC_REQUIRE([OL_LIB_GDBM])
451  AC_CHECK_HEADERS(gdbm.h)
452  AC_CACHE_CHECK(for db, [ol_cv_gdbm], [
453         if test $ol_cv_lib_gdbm = no -o $ac_cv_header_gdbm_h = no ; then
454                 ol_cv_gdbm=no
455         else
456                 ol_cv_gdbm=yes
457         fi
458 ])
459  if test $ol_cv_gdbm = yes ; then
460         AC_DEFINE(HAVE_GDBM,1, [define if GNU DBM is available])
461  fi
462 ])dnl
463 dnl
464 dnl ====================================================================
465 dnl Check if MDBM library exists
466 dnl Check for mdbm_open in standard libraries or -lmdbm
467 dnl
468 dnl defines ol_cv_lib_mdbm to 'yes' or '-lmdbm' or 'no'
469 dnl             'yes' implies mdbm_open is in $LIBS
470 dnl
471 dnl uses:
472 dnl             AC_CHECK_FUNC(mdbm_set_chain)
473 dnl             AC_CHECK_LIB(mdbm,mdbm_set_chain)
474 dnl
475 AC_DEFUN([OL_LIB_MDBM],
476 [AC_CACHE_CHECK(for MDBM library, [ol_cv_lib_mdbm],
477 [       ol_LIBS="$LIBS"
478         AC_CHECK_FUNC(mdbm_set_chain,[ol_cv_lib_mdbm=yes], [
479                 AC_CHECK_LIB(mdbm,mdbm_set_chain,[ol_cv_lib_mdbm=-lmdbm],[ol_cv_lib_mdbm=no])
480         ])
481         LIBS="$ol_LIBS"
482 ])
483 ])dnl
484 dnl
485 dnl --------------------------------------------------------------------
486 dnl Check if MDBM exists
487 dnl
488 dnl defines ol_cv_mdbm to 'yes' or 'no'
489 dnl 
490 dnl uses:
491 dnl             OL_LIB_MDBM
492 dnl             AC_CHECK_HEADERS(mdbm.h)
493 dnl
494 AC_DEFUN([OL_MDBM],
495 [AC_REQUIRE([OL_LIB_MDBM])
496  AC_CHECK_HEADERS(mdbm.h)
497  AC_CACHE_CHECK(for db, [ol_cv_mdbm], [
498         if test $ol_cv_lib_mdbm = no -o $ac_cv_header_mdbm_h = no ; then
499                 ol_cv_mdbm=no
500         else
501                 ol_cv_mdbm=yes
502         fi
503 ])
504  if test $ol_cv_mdbm = yes ; then
505         AC_DEFINE(HAVE_MDBM,1, [define if MDBM is available])
506  fi
507 ])dnl
508 dnl
509 dnl ====================================================================
510 dnl Check if NDBM library exists
511 dnl Check for dbm_open in standard libraries or -lndbm or -ldbm
512 dnl
513 dnl defines ol_cv_lib_ndbm to 'yes' or '-lndbm' or -ldbm or 'no'
514 dnl             'yes' implies ndbm_open is in $LIBS
515 dnl
516 dnl uses:
517 dnl             AC_CHECK_FUNC(dbm_open)
518 dnl             AC_CHECK_LIB(ndbm,dbm_open)
519 dnl             AC_CHECK_LIB(dbm,dbm_open)
520 dnl
521 dnl restrictions:
522 dnl             should also check SVR4 case: dbm_open() in -lucb but that
523 dnl             would requiring dealing with -L/usr/ucblib
524 dnl
525 AC_DEFUN([OL_LIB_NDBM],
526 [AC_CACHE_CHECK(for NDBM library, [ol_cv_lib_ndbm],
527 [       ol_LIBS="$LIBS"
528         AC_CHECK_FUNC(dbm_open,[ol_cv_lib_ndbm=yes], [
529                 AC_CHECK_LIB(ndbm,dbm_open,[ol_cv_lib_ndbm=-lndbm], [
530                         AC_CHECK_LIB(dbm,dbm_open,[ol_cv_lib_ndbm=-ldbm],
531                                 [ol_cv_lib_ndbm=no])dnl
532                 ])
533         ])
534         LIBS="$ol_LIBS"
535 ])
536 ])dnl
537 dnl
538 dnl --------------------------------------------------------------------
539 dnl Check if NDBM exists
540 dnl
541 dnl defines ol_cv_ndbm to 'yes' or 'no'
542 dnl 
543 dnl uses:
544 dnl             OL_LIB_NDBM
545 dnl             AC_CHECK_HEADERS(ndbm.h)
546 dnl
547 dnl restrictions:
548 dnl             Doesn't handle SVR4 case (see above)
549 dnl
550 AC_DEFUN([OL_NDBM],
551 [AC_REQUIRE([OL_LIB_NDBM])
552  AC_CHECK_HEADERS(ndbm.h)
553  AC_CACHE_CHECK(for db, [ol_cv_ndbm], [
554         if test $ol_cv_lib_ndbm = no -o $ac_cv_header_ndbm_h = no ; then
555                 ol_cv_ndbm=no
556         else
557                 ol_cv_ndbm=yes
558         fi
559 ])
560  if test $ol_cv_ndbm = yes ; then
561         AC_DEFINE(HAVE_NDBM,1, [define if NDBM is available])
562  fi
563 ])dnl
564 dnl
565 dnl ====================================================================
566 dnl Check POSIX Thread version 
567 dnl
568 dnl defines ol_cv_posix_version to 'final' or 'draft' or 'unknown'
569 dnl     'unknown' implies that the version could not be detected
570 dnl             or that pthreads.h does exist.  Existance of pthreads.h
571 dnl             should be tested separately.
572 dnl
573 AC_DEFUN([OL_POSIX_THREAD_VERSION],
574 [AC_CACHE_CHECK([POSIX thread version],[ol_cv_pthread_version],[
575         AC_EGREP_CPP(pthread_version_final,[
576 #               include <pthread.h>
577                 /* this check could be improved */
578 #               ifdef PTHREAD_ONCE_INIT
579                         pthread_version_final;
580 #               endif
581         ], ol_pthread_final=yes, ol_pthread_final=no)
582
583         AC_EGREP_CPP(pthread_version_draft4,[
584 #               include <pthread.h>
585                 /* this check could be improved */
586 #               ifdef pthread_once_init
587                         pthread_version_draft4;
588 #               endif
589         ], ol_pthread_draft4=yes, ol_pthread_draft4=no)
590
591         if test $ol_pthread_final = yes -a $ol_pthread_draft4 = no; then
592                 ol_cv_pthread_version=final
593         elif test $ol_pthread_final = no -a $ol_pthread_draft4 = yes; then
594                 ol_cv_pthread_version=draft4
595         else
596                 ol_cv_pthread_version=unknown
597         fi
598 ])
599 ])dnl
600 dnl
601 dnl --------------------------------------------------------------------
602 AC_DEFUN([OL_PTHREAD_TEST_INCLUDES],
603 [/* pthread test headers */
604 #include <pthread.h>
605 #ifndef NULL
606 #define NULL (void*)0
607 #endif
608
609 static void *task(p)
610         void *p;
611 {
612         return (void *) (p == NULL);
613 }
614 ])
615 AC_DEFUN([OL_PTHREAD_TEST_FUNCTION],[
616         /* pthread test function */
617         pthread_t t;
618         int status;
619 #if HAVE_PTHREADS_FINAL && defined(PTHREAD_CREATE_UNDETACHED)
620         /* This system (e.g. AIX) defaults detached; must override */
621         pthread_attr_t attr;
622
623         status = pthread_attr_init(&attr);
624         if( status ) exit( status );
625
626         status = pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_UNDETACHED);
627         if( status ) exit( status );
628
629 #define ATTR    &attr
630 #else
631 #if HAVE_PTHREADS_D4
632 #define ATTR    pthread_attr_default
633 #else
634 #define ATTR    NULL
635 #endif
636 #endif
637         /* make sure pthread_create() isn't just a stub */
638         status = pthread_create(&t, ATTR, task, NULL);
639         if( status ) exit( status );
640
641         /* make sure pthread_detach() isn't just a stub */
642 #if HAVE_PTHREADS_D4
643         status = pthread_detach( &t );
644 #else
645         status = pthread_detach( t );
646 #endif
647
648 #ifdef HAVE_LINUX_THREADS
649         pthread_kill_other_threads_np();
650 #endif
651
652         exit( status );
653 ])
654
655 AC_DEFUN([OL_PTHREAD_TEST_PROGRAM],
656 [OL_PTHREAD_TEST_INCLUDES
657
658 int main(argc, argv)
659         int argc;
660         char **argv;
661 {
662 OL_PTHREAD_TEST_FUNCTION
663 }
664 ])
665 dnl --------------------------------------------------------------------
666 AC_DEFUN([OL_PTHREAD_TRY], [# Pthread try link: $1 ($2)
667 if test "$ol_link_threads" = no ; then
668         # try $1
669         AC_CACHE_CHECK([for pthread link with $1], [$2], [
670                 # save the flags
671                 ol_LIBS="$LIBS"
672                 LIBS="$1 $LIBS"
673
674                 AC_TRY_RUN(OL_PTHREAD_TEST_PROGRAM,
675                         [$2=yes], [$2=no],
676                         [AC_TRY_LINK(OL_PTHREAD_TEST_INCLUDES,OL_PTHREAD_TEST_FUNCTION,
677                                 [$2=yes], [$2=no])])
678
679                 # restore the LIBS
680                 LIBS="$ol_LIBS"
681         ])
682
683         if test $$2 = yes ; then
684                 ol_link_pthreads="$1"
685                 ol_link_threads=posix
686         fi
687 fi
688 ])
689 dnl
690 dnl ====================================================================
691 dnl Check GNU Pth pthread Header
692 dnl
693 dnl defines ol_cv_header linux_threads to 'yes' or 'no'
694 dnl             'no' implies pthreads.h is not LinuxThreads or pthreads.h
695 dnl             doesn't exists.  Existance of pthread.h should separately
696 dnl             checked.
697 dnl 
698 AC_DEFUN([OL_HEADER_GNU_PTH_PTHREAD_H], [
699         AC_CACHE_CHECK([for GNU Pth pthread.h],
700                 [ol_cv_header_gnu_pth_pthread_h],
701                 [AC_EGREP_CPP(__gnu_pth__,
702                         [#include <pthread.h>
703 #ifdef _POSIX_THREAD_IS_GNU_PTH
704         __gnu_pth__;
705 #endif
706 ],
707                         [ol_cv_header_gnu_pth_pthread_h=yes],
708                         [ol_cv_header_gnu_pth_pthread_h=no])
709                 ])
710 ])dnl
711 dnl ====================================================================
712 dnl Check for NT Threads
713 AC_DEFUN([OL_NT_THREADS], [
714         AC_CACHE_CHECK([for NT Threads], [ol_cv_nt_threads], [
715                 AC_CHECK_FUNC(_beginthread,
716                         [ol_cv_nt_threads=yes],
717                         [ol_cv_nt_threads=no])
718         ])
719
720         if test $ol_cv_nt_threads = yes ; then
721                 AC_DEFINE(HAVE_NT_THREADS,1,[if you have NT Threads])
722         fi
723 ])
724 dnl ====================================================================
725 dnl Check LinuxThreads Header
726 dnl
727 dnl defines ol_cv_header linux_threads to 'yes' or 'no'
728 dnl             'no' implies pthreads.h is not LinuxThreads or pthreads.h
729 dnl             doesn't exists.  Existance of pthread.h should separately
730 dnl             checked.
731 dnl 
732 AC_DEFUN([OL_HEADER_LINUX_THREADS], [
733         AC_CACHE_CHECK([for LinuxThreads pthread.h],
734                 [ol_cv_header_linux_threads],
735                 [AC_EGREP_CPP(pthread_kill_other_threads_np,
736                         [#include <pthread.h>],
737                         [ol_cv_header_linux_threads=yes],
738                         [ol_cv_header_linux_threads=no])
739                 ])
740         if test $ol_cv_header_linux_threads = yes; then
741                 AC_DEFINE(HAVE_LINUX_THREADS,1,[if you have LinuxThreads])
742         fi
743 ])dnl
744 dnl --------------------------------------------------------------------
745 dnl     Check LinuxThreads Implementation
746 dnl
747 dnl     defines ol_cv_sys_linux_threads to 'yes' or 'no'
748 dnl     'no' implies pthreads implementation is not LinuxThreads.
749 dnl 
750 AC_DEFUN([OL_SYS_LINUX_THREADS], [
751         AC_CHECK_FUNC(pthread_kill_other_threads_np)
752         AC_CACHE_CHECK([for LinuxThreads implementation],
753                 [ol_cv_sys_linux_threads],
754                 [ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np])
755 ])dnl
756 dnl
757 dnl --------------------------------------------------------------------
758 dnl Check LinuxThreads consistency
759 AC_DEFUN([OL_LINUX_THREADS], [
760         AC_REQUIRE([OL_HEADER_LINUX_THREADS])
761         AC_REQUIRE([OL_SYS_LINUX_THREADS])
762         AC_CACHE_CHECK([for LinuxThreads consistency], [ol_cv_linux_threads], [
763                 if test $ol_cv_header_linux_threads = yes -a \
764                         $ol_cv_sys_linux_threads = yes; then
765                         ol_cv_linux_threads=yes
766                 elif test $ol_cv_header_linux_threads = no -a \
767                         $ol_cv_sys_linux_threads = no; then
768                         ol_cv_linux_threads=no
769                 else
770                         ol_cv_linux_threads=error
771                 fi
772         ])
773 ])dnl
774 dnl
775 dnl ====================================================================
776 dnl Check for POSIX Regex
777 AC_DEFUN([OL_POSIX_REGEX], [
778 AC_CACHE_CHECK([for compatible POSIX regex],ol_cv_c_posix_regex,[
779         AC_TRY_RUN([
780 #include <sys/types.h>
781 #include <regex.h>
782 static char *pattern, *string;
783 main()
784 {
785         int rc;
786         regex_t re;
787
788         pattern = "^A";
789
790         if(regcomp(&re, pattern, 0)) {
791                 return -1;
792         }
793         
794         string = "ALL MATCH";
795         
796         rc = regexec(&re, string, 0, (void*)0, 0);
797
798         regfree(&re);
799
800         return rc;
801 }],
802         [ol_cv_c_posix_regex=yes],
803         [ol_cv_c_posix_regex=no],
804         [ol_cv_c_posix_regex=cross])])
805 ])
806 dnl
807 dnl ====================================================================
808 dnl Check if toupper() requires islower() to be called first
809 AC_DEFUN([OL_C_UPPER_LOWER],
810 [AC_CACHE_CHECK([if toupper() requires islower()],ol_cv_c_upper_lower,[
811         AC_TRY_RUN([
812 #include <ctype.h>
813 main()
814 {
815         if ('C' == toupper('C'))
816                 exit(0);
817         else
818                 exit(1);
819 }],
820         [ol_cv_c_upper_lower=no],
821         [ol_cv_c_upper_lower=yes],
822         [ol_cv_c_upper_lower=safe])])
823 if test $ol_cv_c_upper_lower != no ; then
824         AC_DEFINE(C_UPPER_LOWER,1, [define if toupper() requires islower()])
825 fi
826 ])
827 dnl
828 dnl ====================================================================
829 dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
830 dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
831 dnl Reported by Keith Bostic.
832 AC_DEFUN([OL_SYS_ERRLIST],
833 [AC_CACHE_CHECK([declaration of sys_errlist],ol_cv_dcl_sys_errlist,[
834         AC_TRY_COMPILE([
835 #include <stdio.h>
836 #include <sys/types.h>
837 #include <errno.h>
838 #ifdef WINNT
839 #include <stdlib.h>
840 #endif ],
841         [char *c = (char *) *sys_errlist],
842         [ol_cv_dcl_sys_errlist=yes
843         ol_cv_have_sys_errlist=yes],
844         [ol_cv_dcl_sys_errlist=no])])
845 #
846 # It's possible (for near-UNIX clones) that sys_errlist doesn't exist
847 if test $ol_cv_dcl_sys_errlist = no ; then
848         AC_DEFINE(DECL_SYS_ERRLIST,1,
849                 [define if sys_errlist is not declared in stdio.h or errno.h])
850
851         AC_CACHE_CHECK([existence of sys_errlist],ol_cv_have_sys_errlist,[
852                 AC_TRY_LINK([#include <errno.h>],
853                         [char *c = (char *) *sys_errlist],
854                         [ol_cv_have_sys_errlist=yes],
855                         [ol_cv_have_sys_errlist=no])])
856 fi
857 if test $ol_cv_have_sys_errlist = yes ; then
858         AC_DEFINE(HAVE_SYS_ERRLIST,1,
859                 [define if you actually have sys_errlist in your libs])
860 fi
861 ])dnl
862 dnl
863 dnl ====================================================================
864 dnl Early MIPS compilers (used in Ultrix 4.2) don't like
865 dnl "int x; int *volatile a = &x; *a = 0;"
866 dnl     -- borrowed from PDKSH
867 AC_DEFUN(OL_C_VOLATILE,
868  [AC_CACHE_CHECK(if compiler understands volatile, ol_cv_c_volatile,
869     [AC_TRY_COMPILE([int x, y, z;],
870       [volatile int a; int * volatile b = x ? &y : &z;
871       /* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
872       *b = 0;], ol_cv_c_volatile=yes, ol_cv_c_volatile=no)])
873   if test $ol_cv_c_volatile = yes; then
874     : 
875   else
876     AC_DEFINE(volatile,,[define as empty if volatile is not supported])
877   fi
878  ])dnl
879 dnl
880 dnl ====================================================================
881 dnl Look for fetch(3)
882 AC_DEFUN([OL_LIB_FETCH],
883 [ol_LIBS=$LIBS
884 LIBS="-lfetch -lcom_err $LIBS"
885 AC_CACHE_CHECK([fetch(3) library],ol_cv_lib_fetch,[
886         AC_TRY_LINK([
887 #include <sys/param.h>
888 #include <stdio.h>
889 #include <fetch.h>],
890         [struct url *u = fetchParseURL("file:///"); ],
891         [ol_cv_lib_fetch=yes],
892         [ol_cv_lib_fetch=no])])
893 LIBS=$ol_LIBS
894 if test $ol_cv_lib_fetch != no ; then
895         ol_link_fetch="-lfetch -lcom_err"
896         AC_DEFINE(HAVE_FETCH,1,
897                 [define if you actually have FreeBSD fetch(3)])
898 fi
899 ])dnl
900 dnl
901 dnl ====================================================================
902 dnl Define sig_atomic_t if not defined in signal.h
903 AC_DEFUN(OL_TYPE_SIG_ATOMIC_T,
904  [AC_CACHE_CHECK(for sig_atomic_t, ol_cv_type_sig_atomic_t,
905     [AC_TRY_COMPILE([#include <signal.h>], [sig_atomic_t atomic;],
906                 ol_cv_type_sig_atomic_t=yes, ol_cv_type_sig_atomic_t=no)])
907   if test $ol_cv_type_sig_atomic_t = no; then
908     AC_DEFINE(sig_atomic_t,int,
909                 [define to atomic type if sig_atomic_t is not available])
910   fi
911  ])dnl
912 dnl
913 dnl ====================================================================
914 dnl Define socklen_t if not defined in sys/types.h or sys/socket.h
915 AC_DEFUN(OL_TYPE_SOCKLEN_T,
916  [AC_CACHE_CHECK(for socklen_t, ol_cv_type_socklen_t,
917     [AC_TRY_COMPILE([
918 #ifdef HAVE_SYS_TYPES_H
919 #include <sys/types.h>
920 #endif
921 #ifdef HAVE_SYS_SOCKET_H
922 #include <sys/socket.h>
923 #endif
924 ], [socklen_t len;],
925                 ol_cv_type_socklen_t=yes, ol_cv_type_socklen_t=no)])
926   if test $ol_cv_type_socklen_t = no; then
927     AC_DEFINE(socklen_t, int,
928                 [define to int if socklen_t is not available])
929   fi
930  ])dnl
931 dnl
932 dnl ====================================================================
933 dnl Define inet_aton is available
934 AC_DEFUN(OL_FUNC_INET_ATON,
935  [AC_CACHE_CHECK([for inet_aton()], ol_cv_func_inet_aton,
936     [AC_TRY_LINK([
937 #ifdef HAVE_SYS_TYPES_H
938 #       include <sys/types.h>
939 #endif
940 #ifdef HAVE_SYS_SOCKET_H
941 #       include <sys/socket.h>
942 #       ifdef HAVE_SYS_SELECT_H
943 #               include <sys/select.h>
944 #       endif
945 #       include <netinet/in.h>
946 #       ifdef HAVE_ARPA_INET_H
947 #               include <arpa/inet.h>
948 #       endif
949 #endif
950 ], [struct in_addr in;
951 int rc = inet_aton( "255.255.255.255", &in );],
952                 ol_cv_func_inet_aton=yes, ol_cv_func_inet_aton=no)])
953   if test $ol_cv_func_inet_aton != no; then
954     AC_DEFINE(HAVE_INET_ATON, 1,
955                 [define to you inet_aton(3) is available])
956   fi
957  ])dnl
958 dnl
959 dnl ====================================================================
960 dnl check no of arguments for ctime_r
961 AC_DEFUN(OL_FUNC_CTIME_R_NARGS,
962  [AC_CACHE_CHECK(number of arguments of ctime_r, ol_cv_func_ctime_r_nargs,
963    [AC_TRY_COMPILE([#include <time.h>],
964                 [time_t ti; char *buffer; ctime_r(&ti,buffer,32);],
965                         ol_cv_func_ctime_r_nargs3=yes,
966                         ol_cv_func_ctime_r_nargs3=no)
967
968         AC_TRY_COMPILE([#include <time.h>],
969                 [time_t ti; char *buffer; ctime_r(&ti,buffer);],
970                         ol_cv_func_ctime_r_nargs2=yes,
971                         ol_cv_func_ctime_r_nargs2=no)
972
973         if test $ol_cv_func_ctime_r_nargs3 = yes -a \
974                 $ol_cv_func_ctime_r_nargs2 = no ; then
975
976                 ol_cv_func_ctime_r_nargs=3
977
978         elif test $ol_cv_func_ctime_r_nargs3 = no -a \
979                 $ol_cv_func_ctime_r_nargs2 = yes ; then
980
981                 ol_cv_func_ctime_r_nargs=2
982
983         else
984                 ol_cv_func_ctime_r_nargs=0
985         fi
986   ])
987
988   if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
989         AC_DEFINE_UNQUOTED(CTIME_R_NARGS, $ol_cv_func_ctime_r_nargs,
990                 [set to the number of arguments ctime_r() expects])
991   fi
992 ])dnl
993 dnl
994 dnl --------------------------------------------------------------------
995 dnl check return type of ctime_r()
996 AC_DEFUN(OL_FUNC_CTIME_R_TYPE,
997  [AC_CACHE_CHECK(return type of ctime_r, ol_cv_func_ctime_r_type,
998    [AC_TRY_COMPILE([#include <time.h>],
999                 [extern int (ctime_r)();],
1000                         ol_cv_func_ctime_r_type="int", ol_cv_func_ctime_r_type="charp")
1001         ])
1002   if test $ol_cv_func_ctime_r_type = "int" ; then
1003         AC_DEFINE(CTIME_R_RETURNS_INT,1, [define if ctime_r() returns int])
1004   fi
1005 ])dnl
1006 dnl ====================================================================
1007 dnl check no of arguments for gethostbyname_r
1008 AC_DEFUN(OL_FUNC_GETHOSTBYNAME_R_NARGS,
1009  [AC_CACHE_CHECK(number of arguments of gethostbyname_r,
1010         ol_cv_func_gethostbyname_r_nargs,
1011         [AC_TRY_COMPILE([#include <sys/types.h>
1012 #include <sys/socket.h>
1013 #include <netinet/in.h>
1014 #include <netdb.h>
1015 #define BUFSIZE (sizeof(struct hostent)+10)],
1016                 [struct hostent hent; char buffer[BUFSIZE];
1017                 int bufsize=BUFSIZE;int h_errno;
1018                 (void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
1019                         buffer, bufsize, &h_errno);],
1020                 ol_cv_func_gethostbyname_r_nargs5=yes, 
1021                 ol_cv_func_gethostbyname_r_nargs5=no)
1022
1023         AC_TRY_COMPILE([#include <sys/types.h>
1024 #include <sys/socket.h>
1025 #include <netinet/in.h>
1026 #include <netdb.h>
1027 #define BUFSIZE (sizeof(struct hostent)+10)],
1028                 [struct hostent hent;struct hostent *rhent;
1029                 char buffer[BUFSIZE];
1030                 int bufsize=BUFSIZE;int h_errno;
1031                 (void)gethostbyname_r("localhost", &hent, buffer, bufsize,
1032                         &rhent, &h_errno);],
1033                 ol_cv_func_gethostbyname_r_nargs6=yes,
1034                 ol_cv_func_gethostbyname_r_nargs6=no)
1035
1036         if test $ol_cv_func_gethostbyname_r_nargs5 = yes -a \
1037                 $ol_cv_func_gethostbyname_r_nargs6 = no ; then
1038
1039                 ol_cv_func_gethostbyname_r_nargs=5
1040
1041         elif test $ol_cv_func_gethostbyname_r_nargs5 = no -a \
1042                 $ol_cv_func_gethostbyname_r_nargs6 = yes ; then
1043
1044                 ol_cv_func_gethostbyname_r_nargs=6
1045
1046         else
1047                 ol_cv_func_gethostbyname_r_nargs=0
1048         fi
1049   ])
1050   if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
1051         AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_NARGS,
1052                 $ol_cv_func_gethostbyname_r_nargs,
1053                 [set to the number of arguments gethostbyname_r() expects])
1054   fi
1055 ])dnl
1056 dnl
1057 dnl check no of arguments for gethostbyaddr_r
1058 AC_DEFUN(OL_FUNC_GETHOSTBYADDR_R_NARGS,
1059  [AC_CACHE_CHECK(number of arguments of gethostbyaddr_r,
1060         [ol_cv_func_gethostbyaddr_r_nargs],
1061         [AC_TRY_COMPILE([#include <sys/types.h>
1062 #include <sys/socket.h>
1063 #include <netinet/in.h>
1064 #include <netdb.h>
1065 #define BUFSIZE (sizeof(struct hostent)+10)],
1066            [struct hostent hent; char buffer[BUFSIZE]; 
1067             struct in_addr add;
1068             size_t alen=sizeof(struct in_addr);
1069             int bufsize=BUFSIZE;int h_errno;
1070                 (void)gethostbyaddr_r( (void *)&(add.s_addr),
1071                         alen, AF_INET, &hent, buffer, bufsize, &h_errno);],
1072                 ol_cv_func_gethostbyaddr_r_nargs7=yes,
1073                 ol_cv_func_gethostbyaddr_r_nargs7=no)
1074
1075         AC_TRY_COMPILE([#include <sys/types.h>
1076 #include <sys/socket.h>
1077 #include <netinet/in.h>
1078 #include <netdb.h>
1079 #define BUFSIZE (sizeof(struct hostent)+10)],
1080                 [struct hostent hent;
1081                 struct hostent *rhent; char buffer[BUFSIZE]; 
1082                 struct in_addr add;
1083                 size_t alen=sizeof(struct in_addr);
1084                 int bufsize=BUFSIZE;int h_errno;
1085                 (void)gethostbyaddr_r( (void *)&(add.s_addr),
1086                         alen, AF_INET, &hent, buffer, bufsize, 
1087                         &rhent, &h_errno);],
1088                 ol_cv_func_gethostbyaddr_r_nargs8=yes,
1089                 ol_cv_func_gethostbyaddr_r_nargs8=no)
1090
1091         if test $ol_cv_func_gethostbyaddr_r_nargs7 = yes -a \
1092                 $ol_cv_func_gethostbyaddr_r_nargs8 = no ; then
1093
1094                 ol_cv_func_gethostbyaddr_r_nargs=7
1095
1096         elif test $ol_cv_func_gethostbyaddr_r_nargs7 = no -a \
1097                 $ol_cv_func_gethostbyaddr_r_nargs8 = yes ; then
1098
1099                 ol_cv_func_gethostbyaddr_r_nargs=8
1100
1101         else
1102                 ol_cv_func_gethostbyaddr_r_nargs=0
1103         fi
1104   ])
1105   if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
1106     AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_NARGS,
1107                 $ol_cv_func_gethostbyaddr_r_nargs,
1108                 [set to the number of arguments gethostbyaddr_r() expects])
1109   fi
1110 ])dnl
1111 dnl