AC_INIT(Makefile.PL) AC_CONFIG_HEADER(config.h) if test -f Makefile.PL -a ! -f Makefile ; then perl Makefile.PL || exit 1 fi AC_PROG_CC dnl TODO: do we want these, too? AC_CYGWIN AC_MINGW32 AC_EXEEXT dnl ---------------------------------------------------------------------- AC_HEADER_STDC AC_CHECK_HEADERS(sys/time.h syslog.h unistd.h errno.h sys/errno.h) AC_CHECK_HEADERS(time.h sysexits.h sys/socket.h netdb.h netinet/in.h) AC_CHECK_HEADERS(getopt.h pwd.h signal.h) AC_C_CONST AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_UID_T AC_TYPE_SIZE_T dnl ---------------------------------------------------------------------- AC_CACHE_CHECK([for SHUT_RD], shutrd, [ AC_TRY_COMPILE([#include #include ], [printf ("%d", SHUT_RD); return 0;], [shutrd=yes], [shutrd=no]), ]) if test $shutrd = yes ; then AC_DEFINE(HAVE_SHUT_RD) fi dnl ---------------------------------------------------------------------- AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(inet, connect) AC_CHECK_LIB(nsl, t_accept) AC_CHECK_LIB(dl, dlopen) AC_CHECK_FUNCS(socket strdup strtod strtol snprintf shutdown) dnl ---------------------------------------------------------------------- AC_CACHE_CHECK([for h_errno], herrno, [ AC_TRY_COMPILE([#include ], [printf ("%d", h_errno); return 0;], [herrno=yes], [herrno=no]), ]) if test $herrno = yes ; then AC_DEFINE(HAVE_H_ERRNO) fi dnl ---------------------------------------------------------------------- AC_CACHE_CHECK([for optarg], haveoptarg, [ AC_TRY_COMPILE([#include ], [if (optarg == (char *) 0L) { return 0; } return 1;], [haveoptarg=yes], [haveoptarg=no]), ]) if test $haveoptarg = yes ; then AC_DEFINE(HAVE_OPTARG) fi dnl ---------------------------------------------------------------------- AC_CACHE_CHECK([for in_addr_t], inaddrt, [ AC_TRY_COMPILE([#include #include ], [in_addr_t foo; return 0;], [inaddrt=yes], [inaddrt=no]), ]) if test $inaddrt = no ; then AC_CHECK_TYPE(in_addr_t, unsigned long) fi dnl ---------------------------------------------------------------------- AC_CACHE_CHECK([for INADDR_NONE], haveinaddrnone, [ AC_TRY_COMPILE([#include #include ], [in_addr_t foo = INADDR_NONE; return 0;], [haveinaddrnone=yes], [haveinaddrnone=no]), ]) if test $haveinaddrnone = yes ; then AC_DEFINE(HAVE_INADDR_NONE) fi dnl ---------------------------------------------------------------------- AC_CACHE_CHECK([for EX__MAX], haveexmax, [ AC_TRY_COMPILE([#ifdef HAVE_SYSEXITS_H #include #endif #include ], [int foo = EX__MAX; return 0;], [haveexmax=yes], [haveexmax=no]), ]) if test $haveexmax = yes ; then AC_DEFINE(HAVE_EX__MAX) fi dnl ---------------------------------------------------------------------- # we cheat, since we *know* we have Perl installed ;) CCDLFLAGS=`perl -e 'use Config; print $Config::Config{ccdlflags}'` LDDLFLAGS=`perl -e 'use Config; print $Config::Config{lddlflags}'` AC_SUBST(CCDLFLAGS) AC_SUBST(LDDLFLAGS) AC_SUBST(HAVE_SHUT_RD) AC_OUTPUT(binaries.mk)