dnl configure.in for libdnsres AC_INIT(res_init.c) AM_INIT_AUTOMAKE(libdnsres,0.1a) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE dnl Initialize prefix. if test "$prefix" = "NONE"; then prefix="/usr/local" fi dnl Checks for programs. AC_PROG_CC_C_O AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_LIBTOOL AC_PROG_GCC_TRADITIONAL if test "$GCC" = yes ; then CFLAGS="$CFLAGS -Wall" fi dnl Check for endianness AC_C_BIGENDIAN(AC_DEFINE(HAVE_BIG_ENDIAN, 1, [Define if architecture is big endian]),,) dnl Checks for libraries. AC_CHECK_LIB(socket, socket) dnl Checks for libevent AC_MSG_CHECKING(for libevent) AC_ARG_WITH(libevent, [ --with-libevent=DIR use libevent build directory], [ case "$withval" in yes|no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT($withval) if test -f $withval/event.h -a -f $withval/libevent.a; then owd=`pwd` if cd $withval; then withval=`pwd`; cd $owd; fi EVENTINC="-I$withval" EVENTLIB="-L$withval -levent" elif test -f $withval/include/event.h -a -f $withval/lib/libevent.a; then owd=`pwd` if cd $withval; then withval=`pwd`; cd $owd; fi EVENTINC="-I$withval/include" EVENTLIB="-L$withval/lib -levent" else AC_ERROR(event.h or libevent.a not found in $withval) fi ;; esac ], [ if test -f ${prefix}/include/event.h; then EVENTINC="-I${prefix}/include" EVENTLIB="-L${prefix}/lib -levent" elif test -f /usr/include/event/event.h; then EVENTINC="-I/usr/include/event" EVENTLIB="-levent" elif test -f /usr/include/event.h; then EVENTLIB="-levent" else AC_MSG_RESULT(no) AC_ERROR(libevent not found) fi AC_MSG_RESULT(yes) ] ) AC_SUBST(EVENTINC) AC_SUBST(EVENTLIB) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h stdarg.h inttypes.h stdint.h signal.h unistd.h sys/time.h sys/queue.h sys/ioctl.h) if test "x$ac_cv_header_sys_queue_h" = "xyes"; then AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h) AC_EGREP_CPP(yes, [ #include #ifdef TAILQ_FOREACH yes #endif ], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_TAILQFOREACH, 1, [Define if TAILQ_FOREACH is defined in ])], AC_MSG_RESULT(no) ) fi if test "x$ac_cv_header_sys_time_h" = "xyes"; then AC_MSG_CHECKING(for timeradd in sys/time.h) AC_EGREP_CPP(yes, [ #include #ifdef timeradd yes #endif ], [ AC_DEFINE(HAVE_TIMERADD, 1, [Define if timeradd is defined in ]) AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) ) fi if test "x$ac_cv_header_sys_time_h" = "xyes"; then AC_MSG_CHECKING(for timercmp in sys/time.h) AC_EGREP_CPP(yes, [ #include #ifdef timercmp yes #endif ], [ AC_DEFINE(HAVE_TIMERCMP, 1, [Define if timercmp is defined in ]) AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) ) fi if test "x$ac_cv_header_sys_time_h" = "xyes"; then AC_MSG_CHECKING(for timerclear in sys/time.h) AC_EGREP_CPP(yes, [ #include #ifdef timerclear yes #endif ], [ AC_DEFINE(HAVE_TIMERCLEAR, 1, [Define if timerclear is defined in ]) AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) ) fi if test "x$ac_cv_header_sys_time_h" = "xyes"; then AC_MSG_CHECKING(for timerisset in sys/time.h) AC_EGREP_CPP(yes, [ #include #ifdef timerisset yes #endif ], [ AC_DEFINE(HAVE_TIMERISSET, 1, [Define if timerisset is defined in ]) AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) ) fi dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_HEADER_TIME dnl Checks for library functions. AC_REPLACE_FUNCS(strlcpy arc4random) AC_CHECK_FUNCS(gettimeofday vasprintf fcntl fgetln issetugid) AC_MSG_CHECKING(for F_SETFD in fcntl.h) AC_EGREP_CPP(yes, [ #define _GNU_SOURCE #include #ifdef F_SETFD yes #endif ], [ AC_DEFINE(HAVE_SETFD, 1, [Define if F_SETFD is defined in ]) AC_MSG_RESULT(yes) ], AC_MSG_RESULT(no)) AC_TYPE_PID_T AC_TYPE_SIZE_T AC_CHECK_TYPE(u_int64_t, unsigned long long) AC_CHECK_TYPE(u_int32_t, unsigned int) AC_CHECK_TYPE(u_int16_t, unsigned short) AC_CHECK_TYPE(u_int8_t, unsigned char) AC_MSG_CHECKING([for sin_len]) AC_TRY_COMPILE([ #include #include #include ], [struct sockaddr_in sin; sin.sin_len = 1;], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_SIN_LEN, 1, [Define if sockaddr_in has sin_len])], [AC_MSG_RESULT([no])] ) AC_MSG_CHECKING([for socklen_t]) AC_TRY_COMPILE([ #include #include ], [socklen_t x;], AC_MSG_RESULT([yes]), [AC_MSG_RESULT([no]) AC_DEFINE(socklen_t, unsigned int, [Define to unsigned int if you dont have it])] ) AC_MSG_CHECKING([whether our compiler supports __func__]) AC_TRY_COMPILE([], [void foo() { const char *cp = __func__; }], AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]) AC_MSG_CHECKING([whether our compiler supports __FUNCTION__]) AC_TRY_COMPILE([], [void foo() { const char *cp = __FUNCTION__; }], AC_MSG_RESULT([yes]) AC_DEFINE(__func__, __FUNCTION__, [Define to appropriate substitue if compiler doesnt have __func__]), AC_MSG_RESULT([no]) AC_DEFINE(__func__, __FILE__, [Define to appropriate substitue if compiler doesnt have __func__]))) AC_OUTPUT(Makefile)