dnl dnl configure.in dnl dnl Copyright (c) 2001 Dug Song dnl dnl $Id: configure.in,v 1.18 2002/04/13 05:20:49 dugsong Exp $ AC_INIT(fragroute.c) AM_INIT_AUTOMAKE(fragroute, 1.2) AM_CONFIG_HEADER(config.h) dnl Initialize prefix. if test "$prefix" = "NONE"; then prefix="/usr/local" fi dnl Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB dnl XXX - we need MingW32 under Cygwin for win32 AC_CYGWIN if test "$CYGWIN" = yes ; then if test -d /usr/include/mingw; then CPPFLAGS="$CPPFLAGS -mno-cygwin" CFLAGS="$CFLAGS -mno-cygwin" AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [Define for faster code generation.]) AC_DEFINE(snprintf, _snprintf, [Use MingW32's internal snprintf]) AC_DEFINE(vsnprintf, _vsnprintf, [Use MingW32's internal vsnprintf]) else AC_MSG_ERROR([need MingW32 package to build under Cygwin]) fi dnl XXX - use our internal event-win32 hack EVENTINC="-I${srcdir}/win32" LIBOBJS="$LIBOBJS event-win32.o" AC_SUBST(EVENTINC) else dnl XXX - BEGIN !CYGWIN AC_LBL_LIBRARY_NET dnl Checks for libevent AC_MSG_CHECKING(for libevent) AC_ARG_WITH(libevent, [ --with-libevent=DIR use libevent in DIR], [ case "$withval" in yes|no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT($withval) if 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" elif 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" else AC_ERROR(event.h or libevent.a not found in $withval) fi ;; esac ], [ if test -f ${prefix}/include/event.h -a -f ${prefix}/lib/libevent.a; then EVENTINC="-I${prefix}/include" EVENTLIB="-L${prefix}/lib -levent" else AC_MSG_RESULT(no) AC_ERROR(libevent not found) fi AC_MSG_RESULT(yes) ] ) AC_SUBST(EVENTINC) AC_SUBST(EVENTLIB) dnl XXX - END !CYGWIN fi dnl Checks for libpcap AC_MSG_CHECKING(for libpcap) AC_ARG_WITH(libpcap, [ --with-libpcap=DIR use libpcap in DIR], [ case "$withval" in yes|no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT($withval) if test -f $withval/pcap.h -a -f $withval/libpcap.a; then owd=`pwd` if cd $withval; then withval=`pwd`; cd $owd; fi PCAPINC="-I$withval -I$withval/bpf" PCAPLIB="-L$withval -lpcap" elif test -f $withval/include/pcap.h -a \ -f $withval/include/net/bpf.h; then owd=`pwd` if cd $withval; then withval=`pwd`; cd $owd; fi PCAPINC="-I$withval/include" if test -f $withval/lib/libwpcap.a; then PCAPLIB="-L$withval/lib -lwpcap" else PCAPLIB="-L$withval/lib -lpcap" fi else AC_ERROR(pcap.h, net/bpf.h, or libpcap.a not found in $withval) fi ;; esac ], [ if test -f ${prefix}/include/pcap.h; then PCAPINC="-I${prefix}/include" if test -f ${prefix}/lib/libwpcap.a; then PCAPLIB="-L${prefix}/lib -lwpcap" else PCAPLIB="-L${prefix}/lib -lpcap" fi elif test -f /usr/include/pcap/pcap.h; then PCAPINC="-I/usr/include/pcap" PCAPLIB="-lpcap" elif test -f /usr/include/pcap.h; then PCAPLIB="-lpcap" else AC_MSG_RESULT(no) AC_ERROR(libpcap not found) fi AC_MSG_RESULT(yes) ] ) AC_SUBST(PCAPINC) AC_SUBST(PCAPLIB) dnl Checks for (installed) libdnet AC_MSG_CHECKING(for libdnet) AC_ARG_WITH(libdnet, [ --with-libdnet=DIR use libdnet in DIR], [ case "$withval" in yes|no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT($withval) if test -f $withval/src/libdnet.a; then DNETINC="-I$withval/include" DNETLIB="-L$withval/src -ldnet `$withval/dnet-config --libs`" elif test -x $withval/bin/dnet-config; then DNETINC="`$withval/bin/dnet-config --cflags`" DNETLIB="`$withval/bin/dnet-config --libs`" else AC_ERROR(dnet-config not found in $withval/bin) fi ;; esac ], [ if test -x ${prefix}/bin/dnet-config; then DNETINC="`${prefix}/bin/dnet-config --cflags`" DNETLIB="`${prefix}/bin/dnet-config --libs`" else AC_MSG_RESULT(no) AC_ERROR(libdnet not found) fi AC_MSG_RESULT(yes) ] ) AC_SUBST(DNETINC) AC_SUBST(DNETLIB) dnl Check for tunnel interface AC_MSG_CHECKING(for tunnel interface) if test -c /dev/ip -a -c /dev/tun -a -f /usr/include/net/if_tun.h; then AC_MSG_RESULT(Universal TUN/TAP driver on Solaris) LIBOBJS="$LIBOBJS tun-solaris.o" elif test "$CYGWIN" = yes ; then AC_MSG_RESULT(win32 - assume CIPE driver is installed) LIBOBJS="$LIBOBJS tun-win32.o" else AC_MSG_RESULT(using loopback) LIBOBJS="$LIBOBJS tun-loop.o" fi dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h inttypes.h malloc.h stdint.h strings.h) AC_CHECK_HEADERS(sys/ioctl.h sys/time.h unistd.h) AC_CHECK_HEADERS(windows.h winsock.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_PROG_GCC_TRADITIONAL if test "$GCC" = yes; then CFLAGS="$CFLAGS -Wall" fi dnl Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS(arc4random gettimeofday select strdup) AC_REPLACE_FUNCS(getopt strlcat strlcpy) dnl Set system-wide configuration file. FRAGROUTE_CONF=`eval echo ${sysconfdir}/fragroute.conf` AC_SUBST(FRAGROUTE_CONF) AC_DEFINE_UNQUOTED(FRAGROUTE_CONF, "$FRAGROUTE_CONF", [Location of configuration file.]) AC_OUTPUT(Makefile scripts/Makefile win32/Makefile fragroute.8)