1 dnl $Id: configure.in,v 1.1.1.1 2000/05/25 00:28:49 route Exp $
3 dnl Libnet autoconfiguration information file
4 dnl Copyright (c) 1998 - 2001 Mike D. Schiffman <mike@infonexus.com>
5 dnl All rights reserved.
7 dnl Process this file with autoconf to produce a configure script.
9 AC_INIT(src/libnet_build_ip.c)
12 AC_MSG_RESULT(Beginning autoconfiguration process for libnet-$VER...)
14 AC_SUBST(LL_INT_TYPE_UC)
23 AC_SUBST(ADDITIONAL_LIBS)
24 AC_SUBST(LIBNET_CONFIG_DEFINES)
25 AC_SUBST(LIBNET_CONFIG_LIBS)
26 AC_SUBST(LIBNET_CONFIG_CFLAGS)
29 dnl Determine hosttype and set the root install directory.
32 AC_PREFIX_DEFAULT(/usr)
34 if test "$prefix" = "NONE"; then
39 dnl Check compiler type.
44 dnl Check for typedefs, structures, and compiler characteristics.
50 dnl Use these compiler flags if we have gcc.
52 if test $ac_cv_prog_gcc = yes; then
53 dnl if test -z $CFLAGS; then
54 CCOPTS='-O2 -funroll-loops -fomit-frame-pointer -Wall'
60 dnl Check for package inclusion/exclusion
62 AC_ARG_WITH(pf_packet, [ --with-pf_packet=[yes,no] override defaults], \
63 with_pf_packet=yes, with_pf_packet=no)
65 AC_ARG_WITH(fast_x86_check, [ --with-fast_x86_check=[yes,no] override defaults], \
66 AC_DEFINE(LIBNET_FAST_X86_CHECK),)
69 dnl Check for programs.
73 AC_CHECK_PROGS(RANLIB, ranlib, @true)
74 AC_CHECK_PROGS(AR, ar, @true)
75 AC_CHECK_PROGS(LN, ln, @true)
78 dnl Check for library functions.
80 AC_CHECK_FUNCS(strerror)
83 dnl Check for libaries
85 AC_CHECK_LIB(pcap, pcap_open_live, AC_DEFINE(HAVE_LIB_PCAP))
88 dnl Get lowlevel packet writing interface type
90 AC_MSG_CHECKING(low-level packet interface type)
92 if test -r /dev/bpf0 ; then
94 AC_MSG_RESULT(found bpf)
95 elif test -r /usr/include/net/pfilt.h ; then
97 AC_MSG_RESULT(found pf)
98 elif test -r /dev/nit ; then
100 AC_MSG_RESULT(found snit)
101 elif test -r /usr/include/sys/net/nit.h ; then
103 AC_MSG_RESULT(found nit)
104 elif test -r /usr/include/net/raw.h ; then
106 AC_MSG_RESULT(found snoop)
107 elif test -r /usr/include/sys/dlpi.h ; then
109 AC_MSG_RESULT(found dlpi)
111 elif test -r /usr/include/linux/socket.h ; then
112 LL_INT_TYPE=sockpacket
113 AC_MSG_RESULT(found SOCK_PACKET)
114 if test $with_pf_packet = yes; then
115 AC_LIBNET_CHECK_PF_PACKET
117 elif test -c /dev/bpf0 ; then # check again in case not readable
119 AC_MSG_RESULT(found bpf)
120 elif test -c /dev/enet ; then # check again in case not readable
122 AC_MSG_RESULT(found enet)
123 elif test -c /dev/nit ; then # check again in case not readable
125 AC_MSG_RESULT(found snit)
128 AC_MSG_WARN(could not find a low level packet interface)
129 AC_MSG_WARN(low level packet creation API will not be added to the library)
133 dnl Convert link layer type to uppercase.
135 LL_INT_TYPE_UC=`echo $LL_INT_TYPE | tr a-z A-Z`
138 dnl Check and set OS specific parameters.
144 AC_DEFINE(_BSD_SOURCE)
145 AC_DEFINE(__BSD_SOURCE)
146 AC_DEFINE(__FAVOR_BSD)
147 LIBNET_CONFIG_DEFINES="-D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD"
148 AC_CHECK_HEADERS(net/ethernet.h, \
149 LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H")
150 MAN_PREFIX="$prefix/man/man3/"
151 LIB_PREFIX="$prefix/lib/"
152 INC_PREFIX="$prefix/include/"
153 BIN_PREFIX="$prefix/bin/"
157 AC_DEFINE(LIBNET_BSDISH_OS)
158 AC_DEFINE(LIBNET_BSD_BYTE_SWAP)
159 AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
160 LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP \
161 -DHAVE_SOCKADDR_SA_LEN"
162 MAN_PREFIX="$prefix/man/man3/"
163 LIB_PREFIX="$prefix/lib/aout"
164 INC_PREFIX="$prefix/include/"
165 BIN_PREFIX="$prefix/bin/"
166 AC_MSG_RESULT(Note: support/bpf-lkm/etherspoof contains the lkm source \
167 required to spoof ethernet frames)
168 ln -sf FreeBSD support/bpf-lkm/etherspoof
172 AC_DEFINE(LIBNET_BSDISH_OS)
173 AC_DEFINE(LIBNET_BSD_BYTE_SWAP)
174 LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP"
175 MAN_PREFIX="$prefix/man/man3/"
176 LIB_PREFIX="$prefix/lib/aout"
177 INC_PREFIX="$prefix/include/"
178 BIN_PREFIX="$prefix/bin/"
182 AC_DEFINE(LIBNET_BSDISH_OS)
183 AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
184 LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS"
185 MAN_PREFIX="$prefix/man/man3/"
186 LIB_PREFIX="$prefix/lib/"
187 INC_PREFIX="$prefix/include/"
188 BIN_PREFIX="$prefix/bin/"
189 AC_MSG_RESULT(Note: support/bpf-lkm/etherspoof contains the lkm required \
190 to spoof ethernet frames)
191 ln -sf OpenBSD support/bpf-lkm/etherspoof
195 AC_DEFINE(LIBNET_BSDISH_OS)
196 AC_DEFINE(LIBNET_BSD_BYTE_SWAP)
197 LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP"
198 MAN_PREFIX="$prefix/man/man3/"
199 LIB_PREFIX="$prefix/lib/"
200 INC_PREFIX="$prefix/include/"
201 BIN_PREFIX="$prefix/bin/"
205 AC_DEFINE(HAVE_SOLARIS)
206 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
207 AC_MSG_CHECKING(for /dev/dlpi device)
208 if test -c /dev/dlpi; then
210 AC_DEFINE(HAVE_DEV_DLPI)
214 AC_MSG_CHECKING(for $dir directory)
215 if test -d $dir ; then
217 AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir")
222 AC_CHECK_LIB(socket, socket, ,AC_MSG_ERROR(libsocket not found.))
223 AC_CHECK_LIB(nsl, gethostbyname, ,AC_MSG_ERROR(libnsl not found.))
226 dnl Broken checksums?
230 AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
233 AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
238 ADDITIONAL_LIBS='-lsocket -lnsl'
239 LIBNET_CONFIG_LIBS="$LIBNET_CONFIG_LIBS -lsocket -lnsl"
240 MAN_PREFIX="$prefix/man/man3/"
241 LIB_PREFIX="$prefix/lib/"
242 INC_PREFIX="$prefix/include/"
243 BIN_PREFIX="$prefix/bin/"
247 AC_MSG_WARN(apparently your OS is not officially supported yet)
248 AC_MSG_WARN(this may not work)
249 AC_MSG_RESULT(you'll have to edit the makefile by hand)
250 AC_MSG_RESULT(please send diffs to mike@infonexus.com)
255 AC_LIBNET_CHECK_LIBNET_VER
256 AC_LIBNET_ENDIAN_CHECK
257 AC_LBL_UNALIGNED_ACCESS
259 AC_CHECK_HEADERS(sys/sockio.h)
260 AC_CONFIG_HEADER(include/config.h)
261 AC_OUTPUT(Makefile test/Makefile test/TCP/Makefile test/Ethernet/Makefile \
262 test/UDP/Makefile test/ICMP/Makefile test/Random/Makefile \
263 test/OSPF/Makefile util/Makefile util/Get-mac/Makefile example/Makefile \
264 libnet-config, chmod +x libnet-config)