File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libnet / configure.in
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 11:54:41 2013 UTC (10 years, 10 months ago) by misho
Branches: libnet, MAIN
CVS tags: v1_1_6p5, v1_1_6p4, v1_1_6p0, v1_1_6, HEAD
1.1.6

    1: dnl Libnet autoconfiguration information file
    2: dnl Copyright (c) 1998 - 2002 Mike D. Schiffman <mike@infonexus.com>
    3: dnl All rights reserved.
    4: dnl
    5: dnl Process this file with autoconf to produce a configure script.
    6: 
    7: AC_INIT(libnet, 1.1.6)
    8: AC_MSG_RESULT(beginning autoconfiguration process for libnet-${PACKAGE_VERSION} ...)
    9: AC_CANONICAL_SYSTEM
   10: AC_CONFIG_SRCDIR([src/libnet_build_ip.c])
   11: AC_CONFIG_MACRO_DIR([m4])
   12: AM_INIT_AUTOMAKE
   13: AM_CONFIG_HEADER([include/config.h])
   14: AM_MAINTAINER_MODE
   15: 
   16: dnl
   17: dnl Check for the usual programs
   18: dnl
   19: AC_PROG_CC
   20: AC_PROG_INSTALL
   21: AC_USE_SYSTEM_EXTENSIONS
   22: dnl disable shared libraries (for now)
   23: dnl AC_DISABLE_SHARED
   24: ifdef(
   25:       [LT_INIT],
   26:       [LT_INIT],
   27:       [AC_PROG_LIBTOOL]
   28: )
   29: 
   30: AC_CHECK_HEADERS(sys/sockio.h)
   31: AC_CHECK_FUNCS([gethostbyname2])
   32: AC_CHECK_FUNCS([getifaddrs])
   33: AC_TYPE_UINT16_T
   34: AC_TYPE_UINT32_T
   35: AC_TYPE_UINT64_T
   36: 
   37: dnl
   38: dnl And some custom things
   39: dnl
   40: 
   41: AC_LIBNET_ENDIAN_CHECK
   42: dnl AC_LBL_LIBRARY_NET
   43: 
   44: AC_SUBST(ENDIANESS)
   45: AC_SUBST(HAVE_PACKET_SOCKET)
   46: AC_SUBST(ADDITIONAL_LIBS)
   47: AC_SUBST(LIBNET_CONFIG_DEFINES)
   48: AC_SUBST(LIBNET_CONFIG_LIBS)
   49: AC_SUBST(LIBNET_CONFIG_CFLAGS)
   50: AC_SUBST(LTLIBOBJS)
   51: 
   52: dnl
   53: dnl Set the root install directory
   54: dnl
   55: AC_PREFIX_DEFAULT(/usr/local)
   56: dnl if test "$prefix" = "NONE"; then
   57: dnl     prefix="/usr"
   58: dnl fi
   59: 
   60: dnl
   61: dnl Get link-layer interface type
   62: dnl
   63: AC_ARG_WITH(
   64: 	[link-layer],
   65: 	[AS_HELP_STRING([--with-link-layer],[when cross-compiling, one of * from libnet_link_*.c @<:@autodetect@:>@])]
   66: )
   67: 
   68: AC_CHECK_HEADERS([net/pfilt.h sys/net/nit.h net/raw.h sys/dlpi.h linux/socket.h])
   69: 
   70: AC_MSG_CHECKING(link-layer packet interface type)
   71: 
   72: if test -n "${with_link_layer}"; then
   73:     case "${with_link_layer}" in
   74:         bpf)   AC_LIBOBJ([libnet_link_bpf]) ;;
   75:         pf)    AC_LIBOBJ([libnet_link_pf]) ;;
   76:         snit)  AC_LIBOBJ([libnet_link_snit]) ;;
   77:         nit)   AC_LIBOBJ([libnet_link_nit]) ;;
   78:         snoop) AC_LIBOBJ([libnet_link_snoop]) ;;
   79:         dlpi)  AC_LIBOBJ([libnet_link_dlpi]) ;;
   80:         linux) AC_LIBOBJ([libnet_link_linux])
   81: 	       AC_LIBNET_CHECK_PF_PACKET
   82: 	       AC_LIBNET_LINUX_PROCFS ;;
   83:         none) AC_LIBOBJ([libnet_link_none]) ;;
   84:         *) AC_MSG_ERROR([Invalid link type "${with_link_layer}"]) ;;
   85:     esac
   86:     AC_MSG_RESULT(user selected link layer ${with_link_layer})
   87: elif test "${cross_compiling}" != "yes" -a -r /dev/bpf0 ; then
   88:     AC_LIBOBJ([libnet_link_bpf])
   89:     AC_MSG_RESULT(found link layer bpf)
   90: elif test "${ac_cv_header_net_pfilt_h}" = "yes" ; then
   91:     AC_LIBOBJ([libnet_link_pf])
   92:     AC_MSG_RESULT(found link layer pf)
   93: elif test "${cross_compiling}" != "yes" -a -r /dev/nit ; then
   94:     AC_LIBOBJ([libnet_link_snit])
   95:     AC_MSG_RESULT(found link layer snit)
   96: elif test "${ac_cv_header_sys_net_nit_h}" = "yes" ; then
   97:     AC_LIBOBJ([libnet_link_nit])
   98:     AC_MSG_RESULT(found link layer nit)
   99: elif test "${ac_cv_header_net_raw_h}" = "yes" ; then
  100:     AC_LIBOBJ([libnet_link_snoop])
  101:     AC_MSG_RESULT(found link layer snoop)
  102: elif test "${ac_cv_header_sys_dlpi_h}" = "yes" ; then
  103:     AC_LIBOBJ([libnet_link_dlpi])
  104:     AC_MSG_RESULT(found link layer dlpi)
  105:     AC_DEFINE(HAVE_DLPI, 1, [Define if the <sys/dlpi.h> header exists.])
  106: elif test "${ac_cv_header_linux_socket_h}" = "yes" ; then
  107:     AC_LIBOBJ([libnet_link_linux])
  108:     AC_MSG_RESULT(found link layer linux)
  109:     AC_LIBNET_CHECK_PF_PACKET
  110:     AC_LIBNET_LINUX_PROCFS
  111: elif test "${cross_compiling}" != "yes" -a -c /dev/bpf0 ; then           # check again in case not readable
  112:     AC_LIBOBJ([libnet_link_bpf])
  113:     AC_MSG_RESULT(found link layer bpf)
  114: elif test "${cross_compiling}" != "yes" -a -c /dev/nit ; then            # check again in case not readable
  115:     AC_LIBOBJ([libnet_link_snit])
  116:     AC_MSG_RESULT(found link layer snit)
  117: elif test "$target_os" = "cygwin" ; then
  118:     AC_LIBOBJ([libnet_link_win32])
  119:     AC_MSG_RESULT(found link layer win32 wpcap)
  120: else
  121:     AC_LIBOBJ([libnet_link_none])
  122:     AC_MSG_WARN(could not find a link-layer packet interface)
  123:     AC_MSG_WARN(link-layer packet injection will not be available)
  124: fi
  125: 
  126: dnl This is necessary so that .o files in LIBOBJS are also built via
  127: dnl the ANSI2KNR-filtering rules.
  128: LIB@&t@OBJS=`echo "$LIB@&t@OBJS" |
  129:        sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'`
  130: LTLIBOBJS=`echo "$LIB@&t@OBJS" |
  131:        sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
  132: 
  133: 
  134: 
  135: dnl
  136: dnl Inform user about the packet builders we've got
  137: dnl
  138: echo -n "scanning available packet construction modules: "
  139: for dir in src/*build*c ; do
  140:     echo $dir | sed -e /src\\/libnet_build_/s/// | sed -e /\\.c/s/// | tr \\n \\040
  141: done
  142: echo ""
  143: 
  144: dnl
  145: dnl Check and set OS specific parameters
  146: dnl
  147: 
  148: case "$target_os" in
  149: 
  150: *linux*)
  151:     AC_DEFINE(_BSD_SOURCE, 1,
  152:         [Define as necessary to "unhide" header symbols.])
  153:     AC_DEFINE(__BSD_SOURCE, 1,
  154:         [Define as necessary to "unhide" header symbols.])
  155:     AC_DEFINE(__FAVOR_BSD, 1,
  156:         [Define if we should favor the BSD APIs when possible in Linux.])
  157: 
  158:     LIBNET_CONFIG_DEFINES="-D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD"
  159:     AC_CHECK_HEADERS(net/ethernet.h, \
  160:         LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H")
  161:     ;;
  162: 
  163: *freebsd*)
  164:     AC_DEFINE(LIBNET_BSDISH_OS, 1,
  165:         [Define if our build OS supports the BSD APIs])
  166:     AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1,
  167:         [Define if libnet should byteswap data.])
  168:     AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1,
  169:         [Define if the sockaddr structure includes a sa_len member.])
  170: 
  171:     LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DHAVE_SOCKADDR_SA_LEN"
  172:     ;;
  173: 
  174: *netbsd*)
  175:     AC_DEFINE(LIBNET_BSDISH_OS, 1,
  176:         [Define if our build OS supports the BSD APIs])
  177:     AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1,
  178:         [Define if libnet should byteswap data.])
  179: 
  180:     LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP"
  181:     ;;
  182: 
  183: *openbsd*)
  184:     AC_DEFINE(LIBNET_BSDISH_OS, 1,
  185:         [Define if our build OS supports the BSD APIs])
  186:     AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1,
  187:         [Define if the sockaddr structure includes a sa_len member.])
  188:     LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS"
  189:     ;;
  190: 
  191: *bsdi*)
  192:     AC_DEFINE(LIBNET_BSDISH_OS, 1,
  193:         [Define if our build OS supports the BSD APIs])
  194:     AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1,
  195:         [Define if libnet should byteswap data.])
  196:     LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP"
  197:     ;;
  198: 
  199: *darwin*)
  200:     AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1,
  201:         [Define if the sockaddr structure includes a sa_len member.])
  202:     LIBNET_CONFIG_DEFINES="-DHAVE_SOCKADDR_SA_LEN"
  203: 
  204: dnl
  205: dnl Check to see if x86
  206: dnl
  207: 
  208:     case "$target" in
  209:     i?86-*-*darwin*)
  210:         AC_DEFINE(LIBNET_BSDISH_OS)
  211:         AC_DEFINE(LIBNET_BSD_BYTE_SWAP)
  212:         LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP"
  213:         ;;
  214: 
  215:     *)
  216:         ;;
  217: 
  218:     esac
  219: 
  220:     ;;
  221: 
  222: *solaris*)
  223:     AC_DEFINE(HAVE_SOLARIS, 1, [Define if we are running on Solaris.])
  224:     AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
  225:     AC_MSG_CHECKING(for /dev/dlpi device)
  226:     if test -c /dev/dlpi; then
  227:         AC_MSG_RESULT(yes)
  228:         AC_DEFINE(HAVE_DEV_DLPI, 1, [Define if /dev/dlpi is available.])
  229:     else
  230:         AC_MSG_RESULT(no)
  231:         dir="/dev/dlpi"
  232:         AC_MSG_CHECKING(for $dir directory)
  233:         if test -d $dir ; then
  234:             AC_MSG_RESULT(yes)
  235:             AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir",
  236:                 [Define if /dev/dlpi is a directory.])
  237:         else
  238:             AC_MSG_RESULT(no)
  239:         fi
  240:     fi
  241:     AC_CHECK_LIB(socket, socket, ,AC_MSG_ERROR(libsocket not found.))
  242:     AC_CHECK_LIB(nsl, gethostbyname, ,AC_MSG_ERROR(libnsl not found.))
  243:     AC_CHECK_LIB(resolv, hstrerror, ,AC_MSG_ERROR(libresolv not found.))
  244: 
  245: dnl 
  246: dnl Broken checksums?
  247: dnl
  248:     case "`uname -r`" in
  249:     5.4)
  250:         AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
  251:             [Define if our version of Solaris has broken checksums.])
  252:         ;;
  253:     5.5*)
  254:         AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
  255:             [Define if our version of Solaris has broken checksums.])
  256:         ;;
  257:     5.8)
  258:         AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
  259:             [Define if our version of Solaris has broken checksums.])
  260:         AC_DEFINE(HAVE_SOLARIS_IPV6, 1,
  261:             [Define if our version of Solaris supports IPv6.])
  262: 
  263:         ;;
  264:     5.9)
  265:         AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
  266:             [Define if our version of Solaris has broken checksums.])
  267:         AC_DEFINE(HAVE_SOLARIS_IPV6, 1,
  268:             [Define if our version of Solaris supports IPv6.])
  269:         ;;
  270:     5.10|5.11|5.12)
  271:         AC_DEFINE(HAVE_SOLARIS_IPV6, 1,
  272:             [Define if our version of Solaris supports IPv6.])
  273:         ;;
  274: 
  275:     esac
  276: 
  277:     ADDITIONAL_LIBS='-lresolv -lsocket -lnsl'
  278:     LIBNET_CONFIG_LIBS="$LIBNET_CONFIG_LIBS -lresolv -lsocket -lnsl"
  279: 
  280:     ;;
  281: 
  282: *hpux11*)
  283:     AC_DEFINE(HAVE_HPUX11, 1, [Define if we are building on HP/UX.])
  284:     AC_CHECK_HEADERS(sys/dlpi_ext.h)
  285:     ;;
  286: 
  287: *cygwin*)
  288:      AC_DEFINE(LIBNET_BSDISH_OS, 1,
  289:          [Define if our build OS supports the BSD APIs])
  290:      AC_DEFINE(NO_SNPRINTF, 1,
  291:          [Define if snprintf() is unavailable on our system.])
  292:      LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DNO_SNPRINTF"
  293:      CFLAGS="$CFLAGS -mno-cygwin -O0 -fnative-struct -DNO_SNPRINTF -I/usr/include/pcap"
  294:      AC_CHECK_LIB(packet, PacketSetMode, ,AC_MSG_ERROR(packet lib not found.))
  295:      AC_CHECK_LIB(wpcap, pcap_setmode, ,AC_MSG_ERROR(pcap lib not found.))
  296:      LIBS="$LIBS -lws2_32"
  297:      ;;
  298: 
  299: *)
  300:     AC_MSG_WARN(apparently your OS is not officially supported yet)
  301:     AC_MSG_WARN(this may not work)
  302:     AC_MSG_RESULT(please send diffs to vieuxtech@gmail.com)
  303:     ;;
  304: 
  305: esac
  306: 
  307: 
  308: AC_ARG_ENABLE([samples],
  309:     [AS_HELP_STRING([--enable-samples],[install the sample programs @<:@default=no@:>@])])
  310: 
  311: AM_CONDITIONAL([INSTALL_SAMPLES], [test x"$enable_samples" = xyes])
  312: 
  313: AC_OUTPUT(Makefile src/Makefile win32/Makefile \
  314: 	include/Makefile \
  315: 	include/libnet/Makefile include/win32/Makefile \
  316: 	sample/Makefile doc/Makefile \
  317: 	doc/man/Makefile doc/man/man3/Makefile doc/html/Makefile \
  318: 	version.h include/libnet.h libnet-config)
  319: dnl EOF

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>