1 dnl Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
2 dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
4 dnl OpenLDAP Autoconf Macros
6 dnl --------------------------------------------------------------------
7 dnl Restricted form of AC_ARG_ENABLE that limits user options
11 dnl $3 = default value (auto)
12 dnl $4 = allowed values (auto yes no)
13 AC_DEFUN([OL_ARG_ENABLE], [# OpenLDAP --enable-$1
14 AC_ARG_ENABLE($1,[$2 (]ifelse($3,,auto,$3)[)],[
16 for ol_val in ifelse($4,,[auto yes no],[$4]) ; do
17 if test "$enableval" = "$ol_val" ; then
21 if test "$ol_arg" = "invalid" ; then
22 AC_MSG_ERROR(bad value $enableval for --enable-$1)
24 ol_enable_$1="$ol_arg"
26 [ ol_enable_$1=ifelse($3,,"auto","$3")])dnl
27 dnl AC_VERBOSE(OpenLDAP -enable-$1 $ol_enable_$1)
31 dnl --------------------------------------------------------------------
32 dnl Restricted form of AC_ARG_WITH that limits user options
36 dnl $3 = default value (no)
37 dnl $4 = allowed values (yes or no)
38 AC_DEFUN([OL_ARG_WITH], [# OpenLDAP --with-$1
39 AC_ARG_WITH($1,[$2 (]ifelse($3,,yes,$3)[)],[
41 for ol_val in ifelse($4,,[yes no],[$4]) ; do
42 if test "$withval" = "$ol_val" ; then
46 if test "$ol_arg" = "invalid" ; then
47 AC_MSG_ERROR(bad value $withval for --with-$1)
51 [ ol_with_$1=ifelse($3,,"no","$3")])dnl
52 dnl AC_VERBOSE(OpenLDAP --with-$1 $ol_with_$1)
56 dnl ====================================================================
57 dnl check if hard links are supported.
59 AC_DEFUN([OL_PROG_LN_H], [# test for ln hardlink support
60 AC_MSG_CHECKING(whether ln works)
61 AC_CACHE_VAL(ol_cv_prog_LN_H,
62 [rm -f conftest.src conftest.dst
63 echo "conftest" > conftest.src
64 if ln conftest.src conftest.dst 2>/dev/null
70 rm -f conftest.src conftest.dst
72 LN_H="$ol_cv_prog_LN_H"
73 if test "$ol_cv_prog_LN_H" = "ln"; then
81 dnl ====================================================================
82 dnl Check if system uses EBCDIC instead of ASCII
83 AC_DEFUN([OL_CPP_EBCDIC], [# test for EBCDIC
84 AC_MSG_CHECKING([for EBCDIC])
85 AC_CACHE_VAL(ol_cv_cpp_ebcdic,[
88 #include <__ASCII__/generate_error.h>
91 [ol_cv_cpp_ebcdic=yes],
92 [ol_cv_cpp_ebcdic=no])])
93 AC_MSG_RESULT($ol_cv_cpp_ebcdic)
94 if test $ol_cv_cpp_ebcdic = yes ; then
95 AC_DEFINE(HAVE_EBCDIC,1, [define if system uses EBCDIC instead of ASCII])
99 dnl --------------------------------------------------------------------
100 dnl OpenLDAP version of STDC header check w/ EBCDIC support
101 AC_DEFUN(OL_HEADER_STDC,
103 AC_REQUIRE([OL_CPP_EBCDIC])dnl
104 AC_CACHE_CHECK([for ANSI C header files], ol_cv_header_stdc,
105 [AC_TRY_CPP([#include <stdlib.h>
108 #include <float.h>], ol_cv_header_stdc=yes, ol_cv_header_stdc=no)
110 if test $ol_cv_header_stdc = yes; then
111 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
112 AC_EGREP_HEADER(memchr, string.h, , ol_cv_header_stdc=no)
115 if test $ol_cv_header_stdc = yes; then
116 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
117 AC_EGREP_HEADER(free, stdlib.h, , ol_cv_header_stdc=no)
120 if test $ol_cv_header_stdc = yes; then
121 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
122 AC_TRY_RUN([#include <ctype.h>
124 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
125 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
127 # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
128 || ('j' <= (c) && (c) <= 'r') \
129 || ('s' <= (c) && (c) <= 'z'))
130 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
132 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
133 int main () { int i; for (i = 0; i < 256; i++)
134 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
136 ], , ol_cv_header_stdc=no, :)
138 if test $ol_cv_header_stdc = yes; then
139 AC_DEFINE(STDC_HEADERS)
141 ac_cv_header_stdc=disable
144 dnl ====================================================================
145 dnl Check if struct passwd has pw_gecos
146 AC_DEFUN([OL_STRUCT_PASSWD_PW_GECOS], [# test for pw_gecos in struct passwd
147 AC_MSG_CHECKING([struct passwd for pw_gecos])
148 AC_CACHE_VAL(ol_cv_struct_passwd_pw_gecos,[
149 AC_TRY_COMPILE([#include <pwd.h>],[
151 pwd.pw_gecos = pwd.pw_name;
153 [ol_cv_struct_passwd_pw_gecos=yes],
154 [ol_cv_struct_passwd_pw_gecos=no])])
155 AC_MSG_RESULT($ol_cv_struct_passwd_pw_gecos)
156 if test $ol_cv_struct_passwd_pw_gecos = yes ; then
157 AC_DEFINE(HAVE_PW_GECOS,1, [define if struct passwd has pw_gecos])
161 dnl ====================================================================
162 dnl Check if db.h is Berkeley DB2
164 dnl defines ol_cv_header_db2 to 'yes' or 'no'
167 dnl AC_CHECK_HEADERS(db.h)
169 AC_DEFUN([OL_HEADER_BERKELEY_DB2],
170 [AC_CHECK_HEADERS(db.h)
171 if test $ac_cv_header_db_h = yes ; then
172 AC_CACHE_CHECK([if db.h is DB2], [ol_cv_header_db2],[
173 AC_EGREP_CPP(__db_version_2,[
175 /* this check could be improved */
176 # ifdef DB_VERSION_MAJOR
177 # if DB_VERSION_MAJOR == 2
181 ], ol_cv_header_db2=yes, ol_cv_header_db2=no)])
186 dnl --------------------------------------------------------------------
187 dnl Check if Berkeley DB2 library exists
188 dnl Check for dbopen in standard libraries or -ldb
190 dnl defines ol_cv_lib_db2 to '-ldb' or 'no'
193 dnl AC_CHECK_LIB(db,db_open)
195 AC_DEFUN([OL_LIB_BERKELEY_DB2],
196 [AC_CACHE_CHECK([for DB2 library], [ol_cv_lib_db2],
198 AC_CHECK_LIB(db,db_open,[ol_cv_lib_db2=-ldb],[ol_cv_lib_db2=no])
203 dnl --------------------------------------------------------------------
204 dnl Check if Berkeley db2 exists
206 dnl defines ol_cv_berkeley_db2 to 'yes' or 'no'
209 dnl OL_LIB_BERKELEY_DB2
210 dnl OL_HEADER_BERKELEY_DB2
212 AC_DEFUN([OL_BERKELEY_DB2],
213 [AC_REQUIRE([OL_LIB_BERKELEY_DB2])
214 AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
215 AC_CACHE_CHECK([for Berkeley DB2], [ol_cv_berkeley_db2], [
216 if test "$ol_cv_lib_db2" = no -o "$ol_cv_header_db2" = no ; then
217 ol_cv_berkeley_db2=no
219 ol_cv_berkeley_db2=yes
222 if test $ol_cv_berkeley_db2 = yes ; then
223 AC_DEFINE(HAVE_BERKELEY_DB2,1, [define if Berkeley DBv2 is available])
227 dnl ====================================================================
228 dnl Check for db.h/db_185.h is Berkeley DB
230 dnl defines ol_cv_header_db to 'yes' or 'no'
233 dnl OL_HEADER_BERKELEY_DB2
234 dnl AC_CHECK_HEADERS(db_185.h)
236 AC_DEFUN([OL_HEADER_BERKELEY_DB],
237 [AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
238 AC_CHECK_HEADERS(db_185.h)
239 if test "$ol_cv_header_db2" = yes ; then
242 ol_cv_header_db=$ac_cv_header_db_185_h
244 ol_cv_header_db=$ac_cv_header_db_h
248 dnl --------------------------------------------------------------------
249 dnl Check if Berkeley DB library exists
250 dnl Check for dbopen in standard libraries or -ldb
252 dnl defines ol_cv_lib_db to 'yes' or '-ldb' or 'no'
253 dnl 'yes' implies dbopen is in $LIBS
256 dnl AC_CHECK_FUNC(dbopen)
257 dnl AC_CHECK_LIB(db,dbopen)
259 AC_DEFUN([OL_LIB_BERKELEY_DB],
260 [AC_CACHE_CHECK([for Berkeley DB library], [ol_cv_lib_db],
262 AC_CHECK_FUNC(dbopen,[ol_cv_lib_db=yes], [
263 AC_CHECK_LIB(db1,dbopen,[ol_cv_lib_db=-ldb1],[
264 AC_CHECK_LIB(db,dbopen,[ol_cv_lib_db=-ldb]
272 dnl --------------------------------------------------------------------
273 dnl Check if Berkeley DB exists
275 dnl defines ol_cv_berkeley_db to 'yes' or 'no'
278 dnl OL_LIB_BERKELEY_DB
279 dnl OL_HEADER_BERKELEY_DB
281 AC_DEFUN([OL_BERKELEY_DB],
282 [AC_REQUIRE([OL_LIB_BERKELEY_DB])
283 AC_REQUIRE([OL_HEADER_BERKELEY_DB])
284 AC_CACHE_CHECK([for Berkeley DB], [ol_cv_berkeley_db], [
285 if test "$ol_cv_lib_db" = no -o "$ol_cv_header_db" = no ; then
288 ol_cv_berkeley_db=yes
291 if test $ol_cv_berkeley_db = yes ; then
292 AC_DEFINE(HAVE_BERKELEY_DB,1, [define if Berkeley DB is available])
296 dnl ====================================================================
297 dnl Check if GDBM library exists
298 dnl Check for gdbm_open in standard libraries or -lgdbm
300 dnl defines ol_cv_lib_gdbm to 'yes' or '-lgdbm' or 'no'
301 dnl 'yes' implies gdbm_open is in $LIBS
304 dnl AC_CHECK_FUNC(gdbm_open)
305 dnl AC_CHECK_LIB(gdbm,gdbm_open)
307 AC_DEFUN([OL_LIB_GDBM],
308 [AC_CACHE_CHECK(for GDBM library, [ol_cv_lib_gdbm],
310 AC_CHECK_FUNC(gdbm_open,[ol_cv_lib_gdbm=yes], [
311 AC_CHECK_LIB(gdbm,gdbm_open,[ol_cv_lib_gdbm=-lgdbm],[ol_cv_lib_gdbm=no])
317 dnl --------------------------------------------------------------------
318 dnl Check if GDBM exists
320 dnl defines ol_cv_gdbm to 'yes' or 'no'
324 dnl AC_CHECK_HEADERS(gdbm.h)
327 [AC_REQUIRE([OL_LIB_GDBM])
328 AC_CHECK_HEADERS(gdbm.h)
329 AC_CACHE_CHECK(for db, [ol_cv_gdbm], [
330 if test $ol_cv_lib_gdbm = no -o $ac_cv_header_gdbm_h = no ; then
336 if test $ol_cv_gdbm = yes ; then
337 AC_DEFINE(HAVE_GDBM,1, [define if GNU DBM is available])
341 dnl ====================================================================
342 dnl Check if MDBM library exists
343 dnl Check for mdbm_open in standard libraries or -lmdbm
345 dnl defines ol_cv_lib_mdbm to 'yes' or '-lmdbm' or 'no'
346 dnl 'yes' implies mdbm_open is in $LIBS
349 dnl AC_CHECK_FUNC(mdbm_set_chain)
350 dnl AC_CHECK_LIB(mdbm,mdbm_set_chain)
352 AC_DEFUN([OL_LIB_MDBM],
353 [AC_CACHE_CHECK(for MDBM library, [ol_cv_lib_mdbm],
355 AC_CHECK_FUNC(mdbm_set_chain,[ol_cv_lib_mdbm=yes], [
356 AC_CHECK_LIB(mdbm,mdbm_set_chain,[ol_cv_lib_mdbm=-lmdbm],[ol_cv_lib_mdbm=no])
362 dnl --------------------------------------------------------------------
363 dnl Check if MDBM exists
365 dnl defines ol_cv_mdbm to 'yes' or 'no'
369 dnl AC_CHECK_HEADERS(mdbm.h)
372 [AC_REQUIRE([OL_LIB_MDBM])
373 AC_CHECK_HEADERS(mdbm.h)
374 AC_CACHE_CHECK(for db, [ol_cv_mdbm], [
375 if test $ol_cv_lib_mdbm = no -o $ac_cv_header_mdbm_h = no ; then
381 if test $ol_cv_mdbm = yes ; then
382 AC_DEFINE(HAVE_MDBM,1, [define if MDBM is available])
386 dnl ====================================================================
387 dnl Check if NDBM library exists
388 dnl Check for dbm_open in standard libraries or -lndbm or -ldbm
390 dnl defines ol_cv_lib_ndbm to 'yes' or '-lndbm' or -ldbm or 'no'
391 dnl 'yes' implies ndbm_open is in $LIBS
394 dnl AC_CHECK_FUNC(dbm_open)
395 dnl AC_CHECK_LIB(ndbm,dbm_open)
396 dnl AC_CHECK_LIB(dbm,dbm_open)
399 dnl should also check SVR4 case: dbm_open() in -lucb but that
400 dnl would requiring dealing with -L/usr/ucblib
402 AC_DEFUN([OL_LIB_NDBM],
403 [AC_CACHE_CHECK(for NDBM library, [ol_cv_lib_ndbm],
405 AC_CHECK_FUNC(dbm_open,[ol_cv_lib_ndbm=yes], [
406 AC_CHECK_LIB(ndbm,dbm_open,[ol_cv_lib_ndbm=-lndbm], [
407 AC_CHECK_LIB(dbm,dbm_open,[ol_cv_lib_ndbm=-ldbm],
408 [ol_cv_lib_ndbm=no])dnl
415 dnl --------------------------------------------------------------------
416 dnl Check if NDBM exists
418 dnl defines ol_cv_ndbm to 'yes' or 'no'
422 dnl AC_CHECK_HEADERS(ndbm.h)
425 dnl Doesn't handle SVR4 case (see above)
428 [AC_REQUIRE([OL_LIB_NDBM])
429 AC_CHECK_HEADERS(ndbm.h)
430 AC_CACHE_CHECK(for db, [ol_cv_ndbm], [
431 if test $ol_cv_lib_ndbm = no -o $ac_cv_header_ndbm_h = no ; then
437 if test $ol_cv_ndbm = yes ; then
438 AC_DEFINE(HAVE_NDBM,1, [define if NDBM is available])
442 dnl ====================================================================
443 dnl Check POSIX Thread version
445 dnl defines ol_cv_posix_version to 'final' or 'draft' or 'unknown'
446 dnl 'unknown' implies that the version could not be detected
447 dnl or that pthreads.h does exist. Existance of pthreads.h
448 dnl should be tested separately.
450 AC_DEFUN([OL_POSIX_THREAD_VERSION],
451 [AC_CACHE_CHECK([POSIX thread version],[ol_cv_pthread_version],[
452 AC_EGREP_CPP(pthread_version_final,[
453 # include <pthread.h>
454 /* this check could be improved */
455 # ifdef PTHREAD_ONCE_INIT
456 pthread_version_final
458 ], ol_pthread_final=yes, ol_pthread_final=no)
460 AC_EGREP_CPP(pthread_version_draft4,[
461 # include <pthread.h>
462 /* this check could be improved */
463 # ifdef pthread_once_init
464 pthread_version_draft4
466 ], ol_pthread_draft4=yes, ol_pthread_draft4=no)
468 if test $ol_pthread_final = yes -a $ol_pthread_draft4 = no; then
469 ol_cv_pthread_version=final
470 elif test $ol_pthread_final = no -a $ol_pthread_draft4 = yes; then
471 ol_cv_pthread_version=draft4
473 ol_cv_pthread_version=unknown
478 dnl --------------------------------------------------------------------
479 AC_DEFUN([OL_PTHREAD_TRY_LINK], [# Pthread try link: $1 ($2)
480 if test "$ol_link_threads" = no ; then
482 AC_CACHE_CHECK([for pthread link with $1], [$2], [
490 #define NULL (void*)0
496 pthread_create(&t, pthread_attr_default, NULL, NULL);
497 pthread_detach( &t );
499 pthread_create(&t, NULL, NULL, NULL);
502 #ifdef HAVE_LINUX_THREADS
503 pthread_kill_other_threads_np();
505 ], [$2=yes], [$2=no])
511 if test $$2 = yes ; then
512 ol_link_pthreads="$1"
513 ol_link_threads=posix
518 dnl ====================================================================
519 dnl Check LinuxThreads Header
521 dnl defines ol_cv_header linux_threads to 'yes' or 'no'
522 dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
523 dnl doesn't exists. Existance of pthread.h should separately
526 AC_DEFUN([OL_HEADER_LINUX_THREADS], [
527 AC_CACHE_CHECK([for LinuxThreads pthread.h],
528 [ol_cv_header_linux_threads],
529 [AC_EGREP_CPP(pthread_kill_other_threads_np,
530 [#include <pthread.h>],
531 [ol_cv_header_linux_threads=yes],
532 [ol_cv_header_linux_threads=no])
534 if test $ol_cv_header_linux_threads = yes; then
535 AC_DEFINE(HAVE_LINUX_THREADS,1,[if you have LinuxThreads])
538 dnl --------------------------------------------------------------------
539 dnl Check LinuxThreads Implementation
541 dnl defines ol_cv_sys_linux_threads to 'yes' or 'no'
542 dnl 'no' implies pthreads implementation is not LinuxThreads.
544 AC_DEFUN([OL_SYS_LINUX_THREADS], [
545 AC_CHECK_FUNC(pthread_kill_other_threads_np)
546 AC_CACHE_CHECK([for LinuxThreads implementation],
547 [ol_cv_sys_linux_threads],
548 [ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np])
551 dnl --------------------------------------------------------------------
552 dnl Check LinuxThreads consistency
553 AC_DEFUN([OL_LINUX_THREADS], [
554 AC_REQUIRE([OL_HEADER_LINUX_THREADS])
555 AC_REQUIRE([OL_SYS_LINUX_THREADS])
556 AC_CACHE_CHECK([for LinuxThreads consistency], [ol_cv_linux_threads], [
557 if test $ol_cv_header_linux_threads = yes -a \
558 $ol_cv_sys_linux_threads = yes; then
559 ol_cv_linux_threads=yes
560 elif test $ol_cv_header_linux_threads = no -a \
561 $ol_cv_sys_linux_threads = no; then
562 ol_cv_linux_threads=no
564 ol_cv_linux_threads=error
569 dnl ====================================================================
570 dnl Check if toupper() requires islower() to be called first
571 AC_DEFUN([OL_C_UPPER_LOWER],
573 AC_MSG_CHECKING([if toupper() requires islower()])
574 AC_CACHE_VAL(ol_cv_c_upper_lower,[
579 if ('C' == toupper('C'))
584 [ol_cv_c_upper_lower=no],
585 [ol_cv_c_upper_lower=yes],
586 [ol_cv_c_upper_lower=safe])])
587 AC_MSG_RESULT($ol_cv_c_upper_lower)
588 if test $ol_cv_c_upper_lower != no ; then
589 AC_DEFINE(C_UPPER_LOWER,1, [define if toupper() requires islower()])
593 dnl ====================================================================
594 dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
595 dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
596 dnl Reported by Keith Bostic.
597 AC_DEFUN([OL_SYS_ERRLIST],
599 AC_MSG_CHECKING([declaration of sys_errlist])
600 AC_CACHE_VAL(ol_cv_dcl_sys_errlist,[
603 #include <sys/types.h>
604 #include <errno.h> ],
605 [char *c = (char *) *sys_errlist],
606 [ol_cv_dcl_sys_errlist=yes],
607 [ol_cv_dcl_sys_errlist=no])])
608 AC_MSG_RESULT($ol_cv_dcl_sys_errlist)
609 # It's possible (for near-UNIX clones) that sys_errlist doesn't exist
610 if test $ol_cv_dcl_sys_errlist = no ; then
611 AC_DEFINE(DECL_SYS_ERRLIST,1,
612 [define if sys_errlist is not declared in stdio.h or errno.h])
613 AC_MSG_CHECKING([existence of sys_errlist])
614 AC_CACHE_VAL(ol_cv_have_sys_errlist,[
615 AC_TRY_LINK([#include <errno.h>],
616 [char *c = (char *) *sys_errlist],
617 [ol_cv_have_sys_errlist=yes],
618 [ol_cv_have_sys_errlist=no])])
619 AC_MSG_RESULT($ol_cv_have_sys_errlist)
620 if test $ol_cv_have_sys_errlist = yes ; then
621 AC_DEFINE(HAVE_SYS_ERRLIST,1,
622 [define if you actually have sys_errlist in your libs])
627 dnl ====================================================================
628 dnl Check to see if we should not declare strdup if we have it
630 AC_DEFUN([OL_DECL_STRDUP],
632 AC_MSG_CHECKING([strdup declaration])
633 AC_CACHE_VAL(ol_cv_dcl_strdup,[
635 #include <string.h> ],
636 [extern char *strdup();],
637 [ol_cv_dcl_strdup=yes],
638 [ol_cv_dcl_strdup=no])])
639 AC_MSG_RESULT($ol_cv_dcl_strdup)
640 if test $ol_cv_dcl_strdup = yes ; then
641 AC_DEFINE(DECL_STRDUP,1,
642 [define if you have strdup() but it's not declared])
646 dnl ====================================================================
647 dnl Early MIPS compilers (used in Ultrix 4.2) don't like
648 dnl "int x; int *volatile a = &x; *a = 0;"
649 dnl -- borrowed from PDKSH
650 AC_DEFUN(OL_C_VOLATILE,
651 [AC_CACHE_CHECK(if compiler understands volatile, ol_cv_c_volatile,
652 [AC_TRY_COMPILE([int x, y, z;],
653 [volatile int a; int * volatile b = x ? &y : &z;
654 /* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
655 *b = 0;], ol_cv_c_volatile=yes, ol_cv_c_volatile=no)])
656 if test $ol_cv_c_volatile = yes; then
663 dnl ====================================================================
664 dnl Define sig_atomic_t if not defined in signal.h
665 AC_DEFUN(OL_TYPE_SIG_ATOMIC_T,
666 [AC_CACHE_CHECK(for sig_atomic_t, ol_cv_type_sig_atomic_t,
667 [AC_TRY_COMPILE([#include <signal.h>], [sig_atomic_t atomic;],
668 ol_cv_type_sig_atomic_t=yes, ol_cv_type_sig_atomic_t=no)])
669 if test $ol_cv_type_sig_atomic_t = no; then
670 AC_DEFINE(sig_atomic_t, int)
674 dnl ====================================================================
675 dnl check no of arguments for ctime_r
676 AC_DEFUN(OL_FUNC_CTIME_R_NARGS,
677 [AC_CACHE_CHECK(number of arguments of ctime_r, ol_cv_func_ctime_r_nargs,
678 [AC_TRY_COMPILE([#include <time.h>],
679 [time_t ti; char *buffer; ctime_r(&ti,buffer,32);],
680 ol_cv_func_ctime_r_nargs=3,
681 [AC_TRY_COMPILE([#include <time.h>],
682 [time_t ti; char *buffer; ctime_r(&ti,buffer);],
683 ol_cv_func_ctime_r_nargs=2,
684 ol_cv_func_ctime_r_nargs=0)])])
685 if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
686 AC_DEFINE_UNQUOTED(CTIME_R_NARGS, $ol_cv_func_ctime_r_nargs,
687 [set to the number of arguments ctime_r() expects])
691 dnl --------------------------------------------------------------------
692 dnl check return type of ctime_r()
693 AC_DEFUN(OL_FUNC_CTIME_R_TYPE,
694 [AC_CACHE_CHECK(return type of ctime_r, ol_cv_func_ctime_r_type,
695 [AC_TRY_COMPILE([#include <time.h>],
697 ol_cv_func_ctime_r_type="int", ol_cv_func_ctime_r_type="charp")
699 if test $ol_cv_func_ctime_r_type = "int" ; then
700 AC_DEFINE(CTIME_R_RETURNS_INT,1, [define if ctime_r() returns int])
703 dnl ====================================================================
704 dnl check no of arguments for gethostbyname_r
705 AC_DEFUN(OL_FUNC_GETHOSTBYNAME_R_NARGS,
706 [AC_CACHE_CHECK(number of arguments of gethostbyname_r,
707 ol_cv_func_gethostbyname_r_nargs,
708 [AC_TRY_COMPILE([#include <sys/types.h>
709 #include <sys/socket.h>
710 #include <netinet/in.h>
712 #define BUFSIZE (sizeof(struct hostent)+10)],
713 [struct hostent hent; char buffer[BUFSIZE];
714 int bufsize=BUFSIZE;int h_errno;
715 (void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
716 buffer, bufsize, &h_errno);],
717 ol_cv_func_gethostbyname_r_nargs=5,
718 [AC_TRY_COMPILE([#include <sys/types.h>
719 #include <sys/socket.h>
720 #include <netinet/in.h>
722 #define BUFSIZE (sizeof(struct hostent)+10)],
723 [struct hostent hent;struct hostent *rhent;
724 char buffer[BUFSIZE];
725 int bufsize=BUFSIZE;int h_errno;
726 (void)gethostbyname_r("localhost", &hent, buffer, bufsize,
728 ol_cv_func_gethostbyname_r_nargs=6,
729 ol_cv_func_gethostbyname_r_nargs=0)])])
730 if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
731 AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_NARGS,
732 $ol_cv_func_gethostbyname_r_nargs,
733 [set to the number of arguments gethostbyname_r() expects])
737 dnl check no of arguments for gethostbyaddr_r
738 AC_DEFUN(OL_FUNC_GETHOSTBYADDR_R_NARGS,
739 [AC_CACHE_CHECK(number of arguments of gethostbyaddr_r,
740 [ol_cv_func_gethostbyaddr_r_nargs],
741 [AC_TRY_COMPILE([#include <sys/types.h>
742 #include <sys/socket.h>
743 #include <netinet/in.h>
745 #define BUFSIZE (sizeof(struct hostent)+10)],
746 [struct hostent hent; char buffer[BUFSIZE];
748 size_t alen=sizeof(struct in_addr);
749 int bufsize=BUFSIZE;int h_errno;
750 (void)gethostbyaddr_r( (void *)&(add.s_addr),
751 alen, AF_INET, &hent, buffer, bufsize, &h_errno);],
752 ol_cv_func_gethostbyaddr_r_nargs=7,
753 [AC_TRY_COMPILE([#include <sys/types.h>
754 #include <sys/socket.h>
755 #include <netinet/in.h>
757 #define BUFSIZE (sizeof(struct hostent)+10)],
758 [struct hostent hent;
759 struct hostent *rhent; char buffer[BUFSIZE];
761 size_t alen=sizeof(struct in_addr);
762 int bufsize=BUFSIZE;int h_errno;
763 (void)gethostbyaddr_r( (void *)&(add.s_addr),
764 alen, AF_INET, &hent, buffer, bufsize,
766 ol_cv_func_gethostbyaddr_r_nargs=8,
767 ol_cv_func_gethostbyaddr_r_nargs=0)])])
768 if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
769 AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_NARGS,
770 $ol_cv_func_gethostbyaddr_r_nargs,
771 [set to the number of arguments gethostbyaddr_r() expects])