+if test $ol_cv_have_sys_errlist = yes ; then
+ AC_DEFINE(HAVE_SYS_ERRLIST,1,
+ [define if you actually have sys_errlist in your libs])
+fi
+])dnl
+dnl
+dnl ====================================================================
+dnl Early MIPS compilers (used in Ultrix 4.2) don't like
+dnl "int x; int *volatile a = &x; *a = 0;"
+dnl -- borrowed from PDKSH
+AC_DEFUN(OL_C_VOLATILE,
+ [AC_CACHE_CHECK(if compiler understands volatile, ol_cv_c_volatile,
+ [AC_TRY_COMPILE([int x, y, z;],
+ [volatile int a; int * volatile b = x ? &y : &z;
+ /* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
+ *b = 0;], ol_cv_c_volatile=yes, ol_cv_c_volatile=no)])
+ if test $ol_cv_c_volatile = yes; then
+ :
+ else
+ AC_DEFINE(volatile,,[define as empty if volatile is not supported])
+ fi
+ ])dnl
+dnl
+dnl ====================================================================
+dnl Look for fetch(3)
+AC_DEFUN([OL_LIB_FETCH],
+[ol_LIBS=$LIBS
+LIBS="-lfetch -lcom_err $LIBS"
+AC_CACHE_CHECK([fetch(3) library],ol_cv_lib_fetch,[
+ AC_TRY_LINK([
+#include <sys/param.h>
+#include <stdio.h>
+#include <fetch.h>],
+ [struct url *u = fetchParseURL("file:///"); ],
+ [ol_cv_lib_fetch=yes],
+ [ol_cv_lib_fetch=no])])
+LIBS=$ol_LIBS
+if test $ol_cv_lib_fetch != no ; then
+ ol_link_fetch="-lfetch -lcom_err"
+ AC_DEFINE(HAVE_FETCH,1,
+ [define if you actually have FreeBSD fetch(3)])
+fi
+])dnl
+dnl
+dnl ====================================================================
+dnl Define sig_atomic_t if not defined in signal.h
+AC_DEFUN(OL_TYPE_SIG_ATOMIC_T,
+ [AC_CACHE_CHECK(for sig_atomic_t, ol_cv_type_sig_atomic_t,
+ [AC_TRY_COMPILE([#include <signal.h>], [sig_atomic_t atomic;],
+ ol_cv_type_sig_atomic_t=yes, ol_cv_type_sig_atomic_t=no)])
+ if test $ol_cv_type_sig_atomic_t = no; then
+ AC_DEFINE(sig_atomic_t,int,
+ [define to atomic type if sig_atomic_t is not available])
+ fi
+ ])dnl
+dnl
+dnl ====================================================================
+dnl Define socklen_t if not defined in sys/types.h or sys/socket.h
+AC_DEFUN(OL_TYPE_SOCKLEN_T,
+ [AC_CACHE_CHECK(for socklen_t, ol_cv_type_socklen_t,
+ [AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+], [socklen_t len;],
+ ol_cv_type_socklen_t=yes, ol_cv_type_socklen_t=no)])
+ if test $ol_cv_type_socklen_t = no; then
+ AC_DEFINE(socklen_t, int,
+ [define to int if socklen_t is not available])
+ fi
+ ])dnl
+dnl
+dnl ====================================================================
+dnl Define inet_aton is available
+AC_DEFUN(OL_FUNC_INET_ATON,
+ [AC_CACHE_CHECK([for inet_aton()], ol_cv_func_inet_aton,
+ [AC_TRY_LINK([
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+# ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+# include <netinet/in.h>
+# ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+# endif
+#endif
+], [struct in_addr in;
+int rc = inet_aton( "255.255.255.255", &in );],
+ ol_cv_func_inet_aton=yes, ol_cv_func_inet_aton=no)])
+ if test $ol_cv_func_inet_aton != no; then
+ AC_DEFINE(HAVE_INET_ATON, 1,
+ [define to you inet_aton(3) is available])
+ fi
+ ])dnl
+dnl
+dnl ====================================================================
+dnl check no of arguments for ctime_r
+AC_DEFUN(OL_FUNC_CTIME_R_NARGS,
+ [AC_CACHE_CHECK(number of arguments of ctime_r, ol_cv_func_ctime_r_nargs,
+ [AC_TRY_COMPILE([#include <time.h>],
+ [time_t ti; char *buffer; ctime_r(&ti,buffer,32);],
+ ol_cv_func_ctime_r_nargs3=yes,
+ ol_cv_func_ctime_r_nargs3=no)
+
+ AC_TRY_COMPILE([#include <time.h>],
+ [time_t ti; char *buffer; ctime_r(&ti,buffer);],
+ ol_cv_func_ctime_r_nargs2=yes,
+ ol_cv_func_ctime_r_nargs2=no)
+
+ if test $ol_cv_func_ctime_r_nargs3 = yes -a \
+ $ol_cv_func_ctime_r_nargs2 = no ; then
+
+ ol_cv_func_ctime_r_nargs=3
+
+ elif test $ol_cv_func_ctime_r_nargs3 = no -a \
+ $ol_cv_func_ctime_r_nargs2 = yes ; then
+
+ ol_cv_func_ctime_r_nargs=2
+
+ else
+ ol_cv_func_ctime_r_nargs=0
+ fi
+ ])
+
+ if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
+ AC_DEFINE_UNQUOTED(CTIME_R_NARGS, $ol_cv_func_ctime_r_nargs,
+ [set to the number of arguments ctime_r() expects])
+ fi
+])dnl
+dnl
+dnl --------------------------------------------------------------------
+dnl check return type of ctime_r()
+AC_DEFUN(OL_FUNC_CTIME_R_TYPE,
+ [AC_CACHE_CHECK(return type of ctime_r, ol_cv_func_ctime_r_type,
+ [AC_TRY_COMPILE([#include <time.h>],
+ [extern int (ctime_r)();],
+ ol_cv_func_ctime_r_type="int", ol_cv_func_ctime_r_type="charp")
+ ])
+ if test $ol_cv_func_ctime_r_type = "int" ; then
+ AC_DEFINE(CTIME_R_RETURNS_INT,1, [define if ctime_r() returns int])
+ fi
+])dnl
+dnl ====================================================================
+dnl check no of arguments for gethostbyname_r
+AC_DEFUN(OL_FUNC_GETHOSTBYNAME_R_NARGS,
+ [AC_CACHE_CHECK(number of arguments of gethostbyname_r,
+ ol_cv_func_gethostbyname_r_nargs,
+ [AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#define BUFSIZE (sizeof(struct hostent)+10)],
+ [struct hostent hent; char buffer[BUFSIZE];
+ int bufsize=BUFSIZE;int h_errno;
+ (void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
+ buffer, bufsize, &h_errno);],
+ ol_cv_func_gethostbyname_r_nargs5=yes,
+ ol_cv_func_gethostbyname_r_nargs5=no)
+
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#define BUFSIZE (sizeof(struct hostent)+10)],
+ [struct hostent hent;struct hostent *rhent;
+ char buffer[BUFSIZE];
+ int bufsize=BUFSIZE;int h_errno;
+ (void)gethostbyname_r("localhost", &hent, buffer, bufsize,
+ &rhent, &h_errno);],
+ ol_cv_func_gethostbyname_r_nargs6=yes,
+ ol_cv_func_gethostbyname_r_nargs6=no)
+
+ if test $ol_cv_func_gethostbyname_r_nargs5 = yes -a \
+ $ol_cv_func_gethostbyname_r_nargs6 = no ; then
+
+ ol_cv_func_gethostbyname_r_nargs=5
+
+ elif test $ol_cv_func_gethostbyname_r_nargs5 = no -a \
+ $ol_cv_func_gethostbyname_r_nargs6 = yes ; then
+
+ ol_cv_func_gethostbyname_r_nargs=6
+
+ else
+ ol_cv_func_gethostbyname_r_nargs=0
+ fi
+ ])
+ if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
+ AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_NARGS,
+ $ol_cv_func_gethostbyname_r_nargs,
+ [set to the number of arguments gethostbyname_r() expects])
+ fi
+])dnl
+dnl
+dnl check no of arguments for gethostbyaddr_r
+AC_DEFUN(OL_FUNC_GETHOSTBYADDR_R_NARGS,
+ [AC_CACHE_CHECK(number of arguments of gethostbyaddr_r,
+ [ol_cv_func_gethostbyaddr_r_nargs],
+ [AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#define BUFSIZE (sizeof(struct hostent)+10)],
+ [struct hostent hent; char buffer[BUFSIZE];
+ struct in_addr add;
+ size_t alen=sizeof(struct in_addr);
+ int bufsize=BUFSIZE;int h_errno;
+ (void)gethostbyaddr_r( (void *)&(add.s_addr),
+ alen, AF_INET, &hent, buffer, bufsize, &h_errno);],
+ ol_cv_func_gethostbyaddr_r_nargs7=yes,
+ ol_cv_func_gethostbyaddr_r_nargs7=no)
+
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#define BUFSIZE (sizeof(struct hostent)+10)],
+ [struct hostent hent;
+ struct hostent *rhent; char buffer[BUFSIZE];
+ struct in_addr add;
+ size_t alen=sizeof(struct in_addr);
+ int bufsize=BUFSIZE;int h_errno;
+ (void)gethostbyaddr_r( (void *)&(add.s_addr),
+ alen, AF_INET, &hent, buffer, bufsize,
+ &rhent, &h_errno);],
+ ol_cv_func_gethostbyaddr_r_nargs8=yes,
+ ol_cv_func_gethostbyaddr_r_nargs8=no)
+
+ if test $ol_cv_func_gethostbyaddr_r_nargs7 = yes -a \
+ $ol_cv_func_gethostbyaddr_r_nargs8 = no ; then
+
+ ol_cv_func_gethostbyaddr_r_nargs=7
+
+ elif test $ol_cv_func_gethostbyaddr_r_nargs7 = no -a \
+ $ol_cv_func_gethostbyaddr_r_nargs8 = yes ; then
+
+ ol_cv_func_gethostbyaddr_r_nargs=8
+
+ else
+ ol_cv_func_gethostbyaddr_r_nargs=0
+ fi
+ ])
+ if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
+ AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_NARGS,
+ $ol_cv_func_gethostbyaddr_r_nargs,
+ [set to the number of arguments gethostbyaddr_r() expects])
+ fi