Annotation of embedaddon/libnet/configure.in, revision 1.1
1.1 ! misho 1: dnl $Id: configure.in,v 1.9 2004/03/01 20:26:11 mike Exp $
! 2: dnl
! 3: dnl Libnet autoconfiguration information file
! 4: dnl Copyright (c) 1998 - 2002 Mike D. Schiffman <mike@infonexus.com>
! 5: dnl All rights reserved.
! 6: dnl
! 7: dnl Process this file with autoconf to produce a configure script.
! 8:
! 9:
! 10: AC_INIT(src/libnet_build_ip.c)
! 11: LIBNET_VERSION=`cat VERSION`
! 12: AC_MSG_RESULT(beginning autoconfiguration process for libnet-$LIBNET_VERSION...)
! 13: AC_CANONICAL_SYSTEM
! 14:
! 15: AM_INIT_AUTOMAKE(libnet, $LIBNET_VERSION)
! 16: AM_CONFIG_HEADER(include/config.h)
! 17: AM_MAINTAINER_MODE
! 18:
! 19: dnl
! 20: dnl Check for the usual programs
! 21: dnl
! 22: AC_PROG_CC
! 23: AC_PROG_INSTALL
! 24: AC_PROG_RANLIB
! 25:
! 26: AC_CHECK_HEADERS(sys/sockio.h)
! 27:
! 28: dnl
! 29: dnl And some custom things
! 30: dnl
! 31:
! 32: AC_LIBNET_ENDIAN_CHECK
! 33: AC_LBL_UNALIGNED_ACCESS
! 34: dnl AC_LBL_LIBRARY_NET
! 35:
! 36: AC_SUBST(ENDIANESS)
! 37: AC_SUBST(LIBNET_VERSION)
! 38: AC_SUBST(HAVE_PACKET_SOCKET)
! 39: AC_SUBST(ADDITIONAL_LIBS)
! 40: AC_SUBST(LIBNET_CONFIG_DEFINES)
! 41: AC_SUBST(LIBNET_CONFIG_LIBS)
! 42: AC_SUBST(LIBNET_CONFIG_CFLAGS)
! 43:
! 44: dnl
! 45: dnl Check for typedefs, structures, and compiler characteristics
! 46: dnl
! 47: AC_PROG_GCC_TRADITIONAL
! 48: if test "$GCC" = yes ; then
! 49: CFLAGS="$CFLAGS -Wall"
! 50: fi
! 51:
! 52: dnl
! 53: dnl Set the root install directory
! 54: dnl
! 55: AC_PREFIX_DEFAULT(/usr)
! 56: dnl if test "$prefix" = "NONE"; then
! 57: dnl prefix="/usr"
! 58: dnl fi
! 59:
! 60: dnl
! 61: dnl Check for library functions.
! 62: dnl
! 63: AC_CHECK_FUNCS(strerror)
! 64:
! 65: dnl
! 66: dnl Get link-layer interface type
! 67: dnl
! 68: AC_MSG_CHECKING(link-layer packet interface type)
! 69:
! 70: if test -r /dev/bpf0 ; then
! 71: AC_LIBOBJ([libnet_link_bpf])
! 72: AC_MSG_RESULT(found bpf)
! 73: elif test -r /usr/include/net/pfilt.h ; then
! 74: AC_LIBOBJ([libnet_link_pf])
! 75: AC_MSG_RESULT(found pf)
! 76: elif test -r /dev/nit ; then
! 77: AC_LIBOBJ([libnet_link_snit])
! 78: AC_MSG_RESULT(found snit)
! 79: elif test -r /usr/include/sys/net/nit.h ; then
! 80: AC_LIBOBJ([libnet_link_nit])
! 81: AC_MSG_RESULT(found nit)
! 82: elif test -r /usr/include/net/raw.h ; then
! 83: AC_LIBOBJ([libnet_link_snoop])
! 84: AC_MSG_RESULT(found snoop)
! 85: elif test -r /usr/include/sys/dlpi.h ; then
! 86: AC_LIBOBJ([libnet_link_dlpi])
! 87: AC_MSG_RESULT(found dlpi)
! 88: AC_DEFINE(HAVE_DLPI)
! 89: elif test -r /usr/include/linux/socket.h ; then
! 90: AC_LIBOBJ([libnet_link_linux])
! 91: AC_MSG_RESULT(found linux primitives)
! 92: AC_LIBNET_CHECK_PF_PACKET
! 93: AC_LIBNET_LINUX_PROCFS
! 94: elif test -c /dev/bpf0 ; then # check again in case not readable
! 95: AC_LIBOBJ([libnet_link_bpf])
! 96: AC_MSG_RESULT(found bpf)
! 97: elif test -c /dev/nit ; then # check again in case not readable
! 98: AC_LIBOBJ([libnet_link_snit])
! 99: AC_MSG_RESULT(found snit)
! 100: elif test "$target_os" = "cygwin" ; then
! 101: AC_LIBOBJ([libnet_link_win32])
! 102: AC_MSG_RESULT(found win32 wpcap)
! 103: else
! 104: AC_LIBOBJ([libnet_link_none])
! 105: AC_MSG_WARN(could not find a link-layer packet interface)
! 106: AC_MSG_WARN(link-layer packet injection will not be available)
! 107: fi
! 108:
! 109: dnl
! 110: dnl Inform user about the packet builders we've got
! 111: dnl
! 112: echo -n "scanning available packet construction modules: "
! 113: for dir in src/*build*c ; do
! 114: echo $dir | sed -e /src\\/libnet_build_/s/// | sed -e /\\.c/s/// | tr \\n \\040
! 115: done
! 116: echo ""
! 117:
! 118: dnl
! 119: dnl Check and set OS specific parameters
! 120: dnl
! 121:
! 122: case "$target_os" in
! 123:
! 124: *linux*)
! 125: AC_DEFINE(_BSD_SOURCE)
! 126: AC_DEFINE(__BSD_SOURCE)
! 127: AC_DEFINE(__FAVOR_BSD)
! 128: LIBNET_CONFIG_DEFINES="-D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD"
! 129: AC_CHECK_HEADERS(net/ethernet.h, \
! 130: LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H")
! 131: ;;
! 132:
! 133: *freebsd*)
! 134: AC_DEFINE(LIBNET_BSDISH_OS)
! 135: AC_DEFINE(LIBNET_BSD_BYTE_SWAP)
! 136: AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
! 137: LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DHAVE_SOCKADDR_SA_LEN"
! 138: ;;
! 139:
! 140: *netbsd*)
! 141: AC_DEFINE(LIBNET_BSDISH_OS)
! 142: AC_DEFINE(LIBNET_BSD_BYTE_SWAP)
! 143: LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP"
! 144: ;;
! 145:
! 146: *openbsd*)
! 147: AC_DEFINE(LIBNET_BSDISH_OS)
! 148: AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
! 149: LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS"
! 150: ;;
! 151:
! 152: *bsdi*)
! 153: AC_DEFINE(LIBNET_BSDISH_OS)
! 154: AC_DEFINE(LIBNET_BSD_BYTE_SWAP)
! 155: LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP"
! 156: ;;
! 157:
! 158: *darwin*)
! 159: AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
! 160: LIBNET_CONFIG_DEFINES="-DHAVE_SOCKADDR_SA_LEN"
! 161: ;;
! 162:
! 163: *solaris*)
! 164: AC_DEFINE(HAVE_SOLARIS)
! 165: AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
! 166: AC_MSG_CHECKING(for /dev/dlpi device)
! 167: if test -c /dev/dlpi; then
! 168: AC_MSG_RESULT(yes)
! 169: AC_DEFINE(HAVE_DEV_DLPI)
! 170: else
! 171: AC_MSG_RESULT(no)
! 172: dir="/dev/dlpi"
! 173: AC_MSG_CHECKING(for $dir directory)
! 174: if test -d $dir ; then
! 175: AC_MSG_RESULT(yes)
! 176: AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir")
! 177: else
! 178: AC_MSG_RESULT(no)
! 179: fi
! 180: fi
! 181: AC_CHECK_LIB(socket, socket, ,AC_MSG_ERROR(libsocket not found.))
! 182: AC_CHECK_LIB(nsl, gethostbyname, ,AC_MSG_ERROR(libnsl not found.))
! 183:
! 184: dnl
! 185: dnl Broken checksums?
! 186: dnl
! 187: case "`uname -r`" in
! 188: 5.4)
! 189: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
! 190: ;;
! 191: 5.5*)
! 192: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
! 193: ;;
! 194: 5.8)
! 195: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
! 196: AC_DEFINE(HAVE_SOLARIS_IPV6)
! 197: ;;
! 198: 5.9)
! 199: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
! 200: AC_DEFINE(HAVE_SOLARIS_IPV6)
! 201: ;;
! 202:
! 203: esac
! 204:
! 205: ADDITIONAL_LIBS='-lsocket -lnsl'
! 206: LIBNET_CONFIG_LIBS="$LIBNET_CONFIG_LIBS -lsocket -lnsl"
! 207: ;;
! 208:
! 209: *hpux11*)
! 210: AC_DEFINE(HAVE_HPUX11)
! 211: AC_CHECK_HEADERS(sys/dlpi_ext.h)
! 212: ;;
! 213:
! 214: *cygwin*)
! 215: AC_DEFINE(LIBNET_BSDISH_OS)
! 216: AC_DEFINE(NO_SNPRINTF)
! 217: LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DNO_SNPRINTF"
! 218: CFLAGS="$CFLAGS -mno-cygwin -O0 -fnative-struct -DNO_SNPRINTF -I/usr/include/pcap"
! 219: AC_CHECK_LIB(packet, PacketSetMode, ,AC_MSG_ERROR(packet lib not found.))
! 220: AC_CHECK_LIB(wpcap, pcap_setmode, ,AC_MSG_ERROR(pcap lib not found.))
! 221: LIBS="$LIBS -lws2_32"
! 222: ;;
! 223:
! 224: *)
! 225: AC_MSG_WARN(apparently your OS is not officially supported yet)
! 226: AC_MSG_WARN(this may not work)
! 227: AC_MSG_RESULT(please send diffs to mike@infonexus.com)
! 228: ;;
! 229:
! 230: esac
! 231:
! 232: AC_OUTPUT(Makefile src/Makefile include/Makefile \
! 233: include/libnet/Makefile sample/Makefile version.h include/libnet.h \
! 234: libnet-config, chmod +x libnet-config)
! 235: dnl EOF
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>