version 1.1.1.1, 2012/02/21 22:14:23
|
version 1.1.1.2, 2013/07/22 11:54:41
|
Line 1
|
Line 1
|
dnl $Id$ |
|
dnl |
|
dnl Libnet autoconfiguration information file |
dnl Libnet autoconfiguration information file |
dnl Copyright (c) 1998 - 2002 Mike D. Schiffman <mike@infonexus.com> |
dnl Copyright (c) 1998 - 2002 Mike D. Schiffman <mike@infonexus.com> |
dnl All rights reserved. |
dnl All rights reserved. |
dnl |
dnl |
dnl Process this file with autoconf to produce a configure script. |
dnl Process this file with autoconf to produce a configure script. |
|
|
| AC_INIT(libnet, 1.1.6) |
AC_INIT(src/libnet_build_ip.c) | AC_MSG_RESULT(beginning autoconfiguration process for libnet-${PACKAGE_VERSION} ...) |
LIBNET_VERSION=`cat VERSION` | |
AC_MSG_RESULT(beginning autoconfiguration process for libnet-$LIBNET_VERSION...) | |
AC_CANONICAL_SYSTEM |
AC_CANONICAL_SYSTEM |
| AC_CONFIG_SRCDIR([src/libnet_build_ip.c]) |
AM_INIT_AUTOMAKE(libnet, $LIBNET_VERSION) | AC_CONFIG_MACRO_DIR([m4]) |
AM_CONFIG_HEADER(include/config.h) | AM_INIT_AUTOMAKE |
| AM_CONFIG_HEADER([include/config.h]) |
AM_MAINTAINER_MODE |
AM_MAINTAINER_MODE |
|
|
dnl |
dnl |
Line 21 dnl Check for the usual programs
|
Line 18 dnl Check for the usual programs
|
dnl |
dnl |
AC_PROG_CC |
AC_PROG_CC |
AC_PROG_INSTALL |
AC_PROG_INSTALL |
AC_PROG_RANLIB | AC_USE_SYSTEM_EXTENSIONS |
| dnl disable shared libraries (for now) |
| dnl AC_DISABLE_SHARED |
| ifdef( |
| [LT_INIT], |
| [LT_INIT], |
| [AC_PROG_LIBTOOL] |
| ) |
|
|
AC_CHECK_HEADERS(sys/sockio.h) |
AC_CHECK_HEADERS(sys/sockio.h) |
|
AC_CHECK_FUNCS([gethostbyname2]) |
|
AC_CHECK_FUNCS([getifaddrs]) |
|
AC_TYPE_UINT16_T |
|
AC_TYPE_UINT32_T |
|
AC_TYPE_UINT64_T |
|
|
dnl |
dnl |
dnl And some custom things |
dnl And some custom things |
dnl |
dnl |
|
|
AC_LIBNET_ENDIAN_CHECK |
AC_LIBNET_ENDIAN_CHECK |
AC_LBL_UNALIGNED_ACCESS |
|
dnl AC_LBL_LIBRARY_NET |
dnl AC_LBL_LIBRARY_NET |
|
|
AC_SUBST(ENDIANESS) |
AC_SUBST(ENDIANESS) |
AC_SUBST(LIBNET_VERSION) |
|
AC_SUBST(HAVE_PACKET_SOCKET) |
AC_SUBST(HAVE_PACKET_SOCKET) |
AC_SUBST(ADDITIONAL_LIBS) |
AC_SUBST(ADDITIONAL_LIBS) |
AC_SUBST(LIBNET_CONFIG_DEFINES) |
AC_SUBST(LIBNET_CONFIG_DEFINES) |
AC_SUBST(LIBNET_CONFIG_LIBS) |
AC_SUBST(LIBNET_CONFIG_LIBS) |
AC_SUBST(LIBNET_CONFIG_CFLAGS) |
AC_SUBST(LIBNET_CONFIG_CFLAGS) |
|
AC_SUBST(LTLIBOBJS) |
|
|
dnl |
dnl |
dnl Check for typedefs, structures, and compiler characteristics |
|
dnl |
|
AC_PROG_GCC_TRADITIONAL |
|
if test "$GCC" = yes ; then |
|
CFLAGS="$CFLAGS -Wall" |
|
fi |
|
|
|
dnl |
|
dnl Set the root install directory |
dnl Set the root install directory |
dnl |
dnl |
AC_PREFIX_DEFAULT(/usr) | AC_PREFIX_DEFAULT(/usr/local) |
dnl if test "$prefix" = "NONE"; then |
dnl if test "$prefix" = "NONE"; then |
dnl prefix="/usr" |
dnl prefix="/usr" |
dnl fi |
dnl fi |
|
|
dnl |
dnl |
dnl Check for library functions. |
|
dnl |
|
AC_CHECK_FUNCS(strerror) |
|
|
|
dnl |
|
dnl Get link-layer interface type |
dnl Get link-layer interface type |
dnl |
dnl |
|
AC_ARG_WITH( |
|
[link-layer], |
|
[AS_HELP_STRING([--with-link-layer],[when cross-compiling, one of * from libnet_link_*.c @<:@autodetect@:>@])] |
|
) |
|
|
|
AC_CHECK_HEADERS([net/pfilt.h sys/net/nit.h net/raw.h sys/dlpi.h linux/socket.h]) |
|
|
AC_MSG_CHECKING(link-layer packet interface type) |
AC_MSG_CHECKING(link-layer packet interface type) |
|
|
if test -r /dev/bpf0 ; then | if test -n "${with_link_layer}"; then |
| case "${with_link_layer}" in |
| bpf) AC_LIBOBJ([libnet_link_bpf]) ;; |
| pf) AC_LIBOBJ([libnet_link_pf]) ;; |
| snit) AC_LIBOBJ([libnet_link_snit]) ;; |
| nit) AC_LIBOBJ([libnet_link_nit]) ;; |
| snoop) AC_LIBOBJ([libnet_link_snoop]) ;; |
| dlpi) AC_LIBOBJ([libnet_link_dlpi]) ;; |
| linux) AC_LIBOBJ([libnet_link_linux]) |
| AC_LIBNET_CHECK_PF_PACKET |
| AC_LIBNET_LINUX_PROCFS ;; |
| none) AC_LIBOBJ([libnet_link_none]) ;; |
| *) AC_MSG_ERROR([Invalid link type "${with_link_layer}"]) ;; |
| esac |
| AC_MSG_RESULT(user selected link layer ${with_link_layer}) |
| elif test "${cross_compiling}" != "yes" -a -r /dev/bpf0 ; then |
AC_LIBOBJ([libnet_link_bpf]) |
AC_LIBOBJ([libnet_link_bpf]) |
AC_MSG_RESULT(found bpf) | AC_MSG_RESULT(found link layer bpf) |
elif test -r /usr/include/net/pfilt.h ; then | elif test "${ac_cv_header_net_pfilt_h}" = "yes" ; then |
AC_LIBOBJ([libnet_link_pf]) |
AC_LIBOBJ([libnet_link_pf]) |
AC_MSG_RESULT(found pf) | AC_MSG_RESULT(found link layer pf) |
elif test -r /dev/nit ; then | elif test "${cross_compiling}" != "yes" -a -r /dev/nit ; then |
AC_LIBOBJ([libnet_link_snit]) |
AC_LIBOBJ([libnet_link_snit]) |
AC_MSG_RESULT(found snit) | AC_MSG_RESULT(found link layer snit) |
elif test -r /usr/include/sys/net/nit.h ; then | elif test "${ac_cv_header_sys_net_nit_h}" = "yes" ; then |
AC_LIBOBJ([libnet_link_nit]) |
AC_LIBOBJ([libnet_link_nit]) |
AC_MSG_RESULT(found nit) | AC_MSG_RESULT(found link layer nit) |
elif test -r /usr/include/net/raw.h ; then | elif test "${ac_cv_header_net_raw_h}" = "yes" ; then |
AC_LIBOBJ([libnet_link_snoop]) |
AC_LIBOBJ([libnet_link_snoop]) |
AC_MSG_RESULT(found snoop) | AC_MSG_RESULT(found link layer snoop) |
elif test -r /usr/include/sys/dlpi.h ; then | elif test "${ac_cv_header_sys_dlpi_h}" = "yes" ; then |
AC_LIBOBJ([libnet_link_dlpi]) |
AC_LIBOBJ([libnet_link_dlpi]) |
AC_MSG_RESULT(found dlpi) | AC_MSG_RESULT(found link layer dlpi) |
AC_DEFINE(HAVE_DLPI) | AC_DEFINE(HAVE_DLPI, 1, [Define if the <sys/dlpi.h> header exists.]) |
elif test -r /usr/include/linux/socket.h ; then | elif test "${ac_cv_header_linux_socket_h}" = "yes" ; then |
AC_LIBOBJ([libnet_link_linux]) |
AC_LIBOBJ([libnet_link_linux]) |
AC_MSG_RESULT(found linux primitives) | AC_MSG_RESULT(found link layer linux) |
AC_LIBNET_CHECK_PF_PACKET |
AC_LIBNET_CHECK_PF_PACKET |
AC_LIBNET_LINUX_PROCFS |
AC_LIBNET_LINUX_PROCFS |
elif test -c /dev/bpf0 ; then # check again in case not readable | elif test "${cross_compiling}" != "yes" -a -c /dev/bpf0 ; then # check again in case not readable |
AC_LIBOBJ([libnet_link_bpf]) |
AC_LIBOBJ([libnet_link_bpf]) |
AC_MSG_RESULT(found bpf) | AC_MSG_RESULT(found link layer bpf) |
elif test -c /dev/nit ; then # check again in case not readable | elif test "${cross_compiling}" != "yes" -a -c /dev/nit ; then # check again in case not readable |
AC_LIBOBJ([libnet_link_snit]) |
AC_LIBOBJ([libnet_link_snit]) |
AC_MSG_RESULT(found snit) | AC_MSG_RESULT(found link layer snit) |
elif test "$target_os" = "cygwin" ; then |
elif test "$target_os" = "cygwin" ; then |
AC_LIBOBJ([libnet_link_win32]) | AC_LIBOBJ([libnet_link_win32]) |
AC_MSG_RESULT(found win32 wpcap) | AC_MSG_RESULT(found link layer win32 wpcap) |
else |
else |
AC_LIBOBJ([libnet_link_none]) |
AC_LIBOBJ([libnet_link_none]) |
AC_MSG_WARN(could not find a link-layer packet interface) |
AC_MSG_WARN(could not find a link-layer packet interface) |
AC_MSG_WARN(link-layer packet injection will not be available) |
AC_MSG_WARN(link-layer packet injection will not be available) |
fi |
fi |
|
|
|
dnl This is necessary so that .o files in LIBOBJS are also built via |
|
dnl the ANSI2KNR-filtering rules. |
|
LIB@&t@OBJS=`echo "$LIB@&t@OBJS" | |
|
sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'` |
|
LTLIBOBJS=`echo "$LIB@&t@OBJS" | |
|
sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'` |
|
|
|
|
|
|
dnl |
dnl |
dnl Inform user about the packet builders we've got |
dnl Inform user about the packet builders we've got |
dnl |
dnl |
Line 122 dnl
|
Line 148 dnl
|
case "$target_os" in |
case "$target_os" in |
|
|
*linux*) |
*linux*) |
AC_DEFINE(_BSD_SOURCE) | AC_DEFINE(_BSD_SOURCE, 1, |
AC_DEFINE(__BSD_SOURCE) | [Define as necessary to "unhide" header symbols.]) |
AC_DEFINE(__FAVOR_BSD) | AC_DEFINE(__BSD_SOURCE, 1, |
| [Define as necessary to "unhide" header symbols.]) |
| AC_DEFINE(__FAVOR_BSD, 1, |
| [Define if we should favor the BSD APIs when possible in Linux.]) |
| |
LIBNET_CONFIG_DEFINES="-D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD" |
LIBNET_CONFIG_DEFINES="-D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD" |
AC_CHECK_HEADERS(net/ethernet.h, \ |
AC_CHECK_HEADERS(net/ethernet.h, \ |
LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H") |
LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H") |
;; |
;; |
|
|
*freebsd*) |
*freebsd*) |
AC_DEFINE(LIBNET_BSDISH_OS) | AC_DEFINE(LIBNET_BSDISH_OS, 1, |
AC_DEFINE(LIBNET_BSD_BYTE_SWAP) | [Define if our build OS supports the BSD APIs]) |
AC_DEFINE(HAVE_SOCKADDR_SA_LEN) | AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1, |
| [Define if libnet should byteswap data.]) |
| AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, |
| [Define if the sockaddr structure includes a sa_len member.]) |
| |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DHAVE_SOCKADDR_SA_LEN" |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DHAVE_SOCKADDR_SA_LEN" |
;; |
;; |
|
|
*netbsd*) |
*netbsd*) |
AC_DEFINE(LIBNET_BSDISH_OS) | AC_DEFINE(LIBNET_BSDISH_OS, 1, |
AC_DEFINE(LIBNET_BSD_BYTE_SWAP) | [Define if our build OS supports the BSD APIs]) |
| AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1, |
| [Define if libnet should byteswap data.]) |
| |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP" |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP" |
;; |
;; |
|
|
*openbsd*) |
*openbsd*) |
AC_DEFINE(LIBNET_BSDISH_OS) | AC_DEFINE(LIBNET_BSDISH_OS, 1, |
AC_DEFINE(HAVE_SOCKADDR_SA_LEN) | [Define if our build OS supports the BSD APIs]) |
| AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, |
| [Define if the sockaddr structure includes a sa_len member.]) |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS" |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS" |
;; |
;; |
|
|
*bsdi*) |
*bsdi*) |
AC_DEFINE(LIBNET_BSDISH_OS) | AC_DEFINE(LIBNET_BSDISH_OS, 1, |
AC_DEFINE(LIBNET_BSD_BYTE_SWAP) | [Define if our build OS supports the BSD APIs]) |
| AC_DEFINE(LIBNET_BSD_BYTE_SWAP, 1, |
| [Define if libnet should byteswap data.]) |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP" |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP" |
;; |
;; |
|
|
*darwin*) |
*darwin*) |
AC_DEFINE(HAVE_SOCKADDR_SA_LEN) | AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, |
| [Define if the sockaddr structure includes a sa_len member.]) |
LIBNET_CONFIG_DEFINES="-DHAVE_SOCKADDR_SA_LEN" |
LIBNET_CONFIG_DEFINES="-DHAVE_SOCKADDR_SA_LEN" |
|
|
|
dnl |
|
dnl Check to see if x86 |
|
dnl |
|
|
|
case "$target" in |
|
i?86-*-*darwin*) |
|
AC_DEFINE(LIBNET_BSDISH_OS) |
|
AC_DEFINE(LIBNET_BSD_BYTE_SWAP) |
|
LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP" |
|
;; |
|
|
|
*) |
|
;; |
|
|
|
esac |
|
|
;; |
;; |
|
|
*solaris*) |
*solaris*) |
AC_DEFINE(HAVE_SOLARIS) | AC_DEFINE(HAVE_SOLARIS, 1, [Define if we are running on Solaris.]) |
AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) |
AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) |
AC_MSG_CHECKING(for /dev/dlpi device) |
AC_MSG_CHECKING(for /dev/dlpi device) |
if test -c /dev/dlpi; then |
if test -c /dev/dlpi; then |
AC_MSG_RESULT(yes) |
AC_MSG_RESULT(yes) |
AC_DEFINE(HAVE_DEV_DLPI) | AC_DEFINE(HAVE_DEV_DLPI, 1, [Define if /dev/dlpi is available.]) |
else |
else |
AC_MSG_RESULT(no) |
AC_MSG_RESULT(no) |
dir="/dev/dlpi" |
dir="/dev/dlpi" |
AC_MSG_CHECKING(for $dir directory) |
AC_MSG_CHECKING(for $dir directory) |
if test -d $dir ; then |
if test -d $dir ; then |
AC_MSG_RESULT(yes) |
AC_MSG_RESULT(yes) |
AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir") | AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir", |
| [Define if /dev/dlpi is a directory.]) |
else |
else |
AC_MSG_RESULT(no) |
AC_MSG_RESULT(no) |
fi |
fi |
fi |
fi |
AC_CHECK_LIB(socket, socket, ,AC_MSG_ERROR(libsocket not found.)) |
AC_CHECK_LIB(socket, socket, ,AC_MSG_ERROR(libsocket not found.)) |
AC_CHECK_LIB(nsl, gethostbyname, ,AC_MSG_ERROR(libnsl not found.)) |
AC_CHECK_LIB(nsl, gethostbyname, ,AC_MSG_ERROR(libnsl not found.)) |
|
AC_CHECK_LIB(resolv, hstrerror, ,AC_MSG_ERROR(libresolv not found.)) |
|
|
dnl |
dnl |
dnl Broken checksums? |
dnl Broken checksums? |
dnl |
dnl |
case "`uname -r`" in |
case "`uname -r`" in |
5.4) |
5.4) |
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) | AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1, |
| [Define if our version of Solaris has broken checksums.]) |
;; |
;; |
5.5*) |
5.5*) |
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) | AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1, |
| [Define if our version of Solaris has broken checksums.]) |
;; |
;; |
5.8) |
5.8) |
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) | AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1, |
AC_DEFINE(HAVE_SOLARIS_IPV6) | [Define if our version of Solaris has broken checksums.]) |
| AC_DEFINE(HAVE_SOLARIS_IPV6, 1, |
| [Define if our version of Solaris supports IPv6.]) |
| |
;; |
;; |
5.9) |
5.9) |
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) | AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1, |
AC_DEFINE(HAVE_SOLARIS_IPV6) | [Define if our version of Solaris has broken checksums.]) |
| AC_DEFINE(HAVE_SOLARIS_IPV6, 1, |
| [Define if our version of Solaris supports IPv6.]) |
;; |
;; |
|
5.10|5.11|5.12) |
|
AC_DEFINE(HAVE_SOLARIS_IPV6, 1, |
|
[Define if our version of Solaris supports IPv6.]) |
|
;; |
|
|
esac |
esac |
|
|
ADDITIONAL_LIBS='-lsocket -lnsl' | ADDITIONAL_LIBS='-lresolv -lsocket -lnsl' |
LIBNET_CONFIG_LIBS="$LIBNET_CONFIG_LIBS -lsocket -lnsl" | LIBNET_CONFIG_LIBS="$LIBNET_CONFIG_LIBS -lresolv -lsocket -lnsl" |
| |
;; |
;; |
|
|
*hpux11*) |
*hpux11*) |
AC_DEFINE(HAVE_HPUX11) | AC_DEFINE(HAVE_HPUX11, 1, [Define if we are building on HP/UX.]) |
AC_CHECK_HEADERS(sys/dlpi_ext.h) |
AC_CHECK_HEADERS(sys/dlpi_ext.h) |
;; |
;; |
|
|
*cygwin*) |
*cygwin*) |
AC_DEFINE(LIBNET_BSDISH_OS) | AC_DEFINE(LIBNET_BSDISH_OS, 1, |
AC_DEFINE(NO_SNPRINTF) | [Define if our build OS supports the BSD APIs]) |
| AC_DEFINE(NO_SNPRINTF, 1, |
| [Define if snprintf() is unavailable on our system.]) |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DNO_SNPRINTF" |
LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DNO_SNPRINTF" |
CFLAGS="$CFLAGS -mno-cygwin -O0 -fnative-struct -DNO_SNPRINTF -I/usr/include/pcap" |
CFLAGS="$CFLAGS -mno-cygwin -O0 -fnative-struct -DNO_SNPRINTF -I/usr/include/pcap" |
AC_CHECK_LIB(packet, PacketSetMode, ,AC_MSG_ERROR(packet lib not found.)) |
AC_CHECK_LIB(packet, PacketSetMode, ,AC_MSG_ERROR(packet lib not found.)) |
Line 224 dnl
|
Line 299 dnl
|
*) |
*) |
AC_MSG_WARN(apparently your OS is not officially supported yet) |
AC_MSG_WARN(apparently your OS is not officially supported yet) |
AC_MSG_WARN(this may not work) |
AC_MSG_WARN(this may not work) |
AC_MSG_RESULT(please send diffs to mike@infonexus.com) | AC_MSG_RESULT(please send diffs to vieuxtech@gmail.com) |
;; |
;; |
|
|
esac |
esac |
|
|
AC_OUTPUT(Makefile src/Makefile include/Makefile \ | |
include/libnet/Makefile sample/Makefile version.h include/libnet.h \ | AC_ARG_ENABLE([samples], |
libnet-config, chmod +x libnet-config) | [AS_HELP_STRING([--enable-samples],[install the sample programs @<:@default=no@:>@])]) |
| |
| AM_CONDITIONAL([INSTALL_SAMPLES], [test x"$enable_samples" = xyes]) |
| |
| AC_OUTPUT(Makefile src/Makefile win32/Makefile \ |
| include/Makefile \ |
| include/libnet/Makefile include/win32/Makefile \ |
| sample/Makefile doc/Makefile \ |
| doc/man/Makefile doc/man/man3/Makefile doc/html/Makefile \ |
| version.h include/libnet.h libnet-config) |
dnl EOF |
dnl EOF |