Annotation of embedaddon/libnet/configure.in, revision 1.1.1.2
1.1 misho 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:
1.1.1.2 ! misho 7: AC_INIT(libnet, 1.1.6)
! 8: AC_MSG_RESULT(beginning autoconfiguration process for libnet-${PACKAGE_VERSION} ...)
1.1 misho 9: AC_CANONICAL_SYSTEM
1.1.1.2 ! misho 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])
1.1 misho 14: AM_MAINTAINER_MODE
15:
16: dnl
17: dnl Check for the usual programs
18: dnl
19: AC_PROG_CC
20: AC_PROG_INSTALL
1.1.1.2 ! misho 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: )
1.1 misho 29:
30: AC_CHECK_HEADERS(sys/sockio.h)
1.1.1.2 ! misho 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
1.1 misho 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)
1.1.1.2 ! misho 50: AC_SUBST(LTLIBOBJS)
1.1 misho 51:
52: dnl
53: dnl Set the root install directory
54: dnl
1.1.1.2 ! misho 55: AC_PREFIX_DEFAULT(/usr/local)
1.1 misho 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
1.1.1.2 ! misho 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:
1.1 misho 70: AC_MSG_CHECKING(link-layer packet interface type)
71:
1.1.1.2 ! misho 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
1.1 misho 88: AC_LIBOBJ([libnet_link_bpf])
1.1.1.2 ! misho 89: AC_MSG_RESULT(found link layer bpf)
! 90: elif test "${ac_cv_header_net_pfilt_h}" = "yes" ; then
1.1 misho 91: AC_LIBOBJ([libnet_link_pf])
1.1.1.2 ! misho 92: AC_MSG_RESULT(found link layer pf)
! 93: elif test "${cross_compiling}" != "yes" -a -r /dev/nit ; then
1.1 misho 94: AC_LIBOBJ([libnet_link_snit])
1.1.1.2 ! misho 95: AC_MSG_RESULT(found link layer snit)
! 96: elif test "${ac_cv_header_sys_net_nit_h}" = "yes" ; then
1.1 misho 97: AC_LIBOBJ([libnet_link_nit])
1.1.1.2 ! misho 98: AC_MSG_RESULT(found link layer nit)
! 99: elif test "${ac_cv_header_net_raw_h}" = "yes" ; then
1.1 misho 100: AC_LIBOBJ([libnet_link_snoop])
1.1.1.2 ! misho 101: AC_MSG_RESULT(found link layer snoop)
! 102: elif test "${ac_cv_header_sys_dlpi_h}" = "yes" ; then
1.1 misho 103: AC_LIBOBJ([libnet_link_dlpi])
1.1.1.2 ! misho 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
1.1 misho 107: AC_LIBOBJ([libnet_link_linux])
1.1.1.2 ! misho 108: AC_MSG_RESULT(found link layer linux)
1.1 misho 109: AC_LIBNET_CHECK_PF_PACKET
110: AC_LIBNET_LINUX_PROCFS
1.1.1.2 ! misho 111: elif test "${cross_compiling}" != "yes" -a -c /dev/bpf0 ; then # check again in case not readable
1.1 misho 112: AC_LIBOBJ([libnet_link_bpf])
1.1.1.2 ! misho 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
1.1 misho 115: AC_LIBOBJ([libnet_link_snit])
1.1.1.2 ! misho 116: AC_MSG_RESULT(found link layer snit)
1.1 misho 117: elif test "$target_os" = "cygwin" ; then
1.1.1.2 ! misho 118: AC_LIBOBJ([libnet_link_win32])
! 119: AC_MSG_RESULT(found link layer win32 wpcap)
1.1 misho 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:
1.1.1.2 ! misho 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:
1.1 misho 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*)
1.1.1.2 ! misho 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:
1.1 misho 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*)
1.1.1.2 ! misho 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:
1.1 misho 171: LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DHAVE_SOCKADDR_SA_LEN"
172: ;;
173:
174: *netbsd*)
1.1.1.2 ! misho 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:
1.1 misho 180: LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP"
181: ;;
182:
183: *openbsd*)
1.1.1.2 ! misho 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.])
1.1 misho 188: LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS"
189: ;;
190:
191: *bsdi*)
1.1.1.2 ! misho 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.])
1.1 misho 196: LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP"
197: ;;
198:
199: *darwin*)
1.1.1.2 ! misho 200: AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1,
! 201: [Define if the sockaddr structure includes a sa_len member.])
1.1 misho 202: LIBNET_CONFIG_DEFINES="-DHAVE_SOCKADDR_SA_LEN"
1.1.1.2 ! misho 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:
1.1 misho 220: ;;
221:
222: *solaris*)
1.1.1.2 ! misho 223: AC_DEFINE(HAVE_SOLARIS, 1, [Define if we are running on Solaris.])
1.1 misho 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)
1.1.1.2 ! misho 228: AC_DEFINE(HAVE_DEV_DLPI, 1, [Define if /dev/dlpi is available.])
1.1 misho 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)
1.1.1.2 ! misho 235: AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir",
! 236: [Define if /dev/dlpi is a directory.])
1.1 misho 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.))
1.1.1.2 ! misho 243: AC_CHECK_LIB(resolv, hstrerror, ,AC_MSG_ERROR(libresolv not found.))
1.1 misho 244:
245: dnl
246: dnl Broken checksums?
247: dnl
248: case "`uname -r`" in
249: 5.4)
1.1.1.2 ! misho 250: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
! 251: [Define if our version of Solaris has broken checksums.])
1.1 misho 252: ;;
253: 5.5*)
1.1.1.2 ! misho 254: AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
! 255: [Define if our version of Solaris has broken checksums.])
1.1 misho 256: ;;
257: 5.8)
1.1.1.2 ! misho 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:
1.1 misho 263: ;;
264: 5.9)
1.1.1.2 ! misho 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.])
1.1 misho 273: ;;
274:
275: esac
276:
1.1.1.2 ! misho 277: ADDITIONAL_LIBS='-lresolv -lsocket -lnsl'
! 278: LIBNET_CONFIG_LIBS="$LIBNET_CONFIG_LIBS -lresolv -lsocket -lnsl"
! 279:
1.1 misho 280: ;;
281:
282: *hpux11*)
1.1.1.2 ! misho 283: AC_DEFINE(HAVE_HPUX11, 1, [Define if we are building on HP/UX.])
1.1 misho 284: AC_CHECK_HEADERS(sys/dlpi_ext.h)
285: ;;
286:
287: *cygwin*)
1.1.1.2 ! misho 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.])
1.1 misho 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)
1.1.1.2 ! misho 302: AC_MSG_RESULT(please send diffs to vieuxtech@gmail.com)
1.1 misho 303: ;;
304:
305: esac
306:
1.1.1.2 ! misho 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)
1.1 misho 319: dnl EOF
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>