File: configure.in

package info (click to toggle)
libnet 1.1.4-2.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 5,760 kB
  • sloc: ansic: 17,745; sh: 8,828; makefile: 146
file content (262 lines) | stat: -rw-r--r-- 8,040 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
dnl $Id: configure.in,v 1.10 2004/11/09 07:02:52 mike Exp $
dnl
dnl Libnet autoconfiguration information file
dnl Copyright (c) 1998 - 2002 Mike D. Schiffman <mike@infonexus.com>
dnl All rights reserved.
dnl
dnl Process this file with autoconf to produce a configure script.

AC_INIT(libnet, 1.1.4)
AC_MSG_RESULT(beginning autoconfiguration process for libnet-${PACKAGE_VERSION} ...)
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src/libnet_build_ip.c])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([include/config.h])
AM_MAINTAINER_MODE

dnl
dnl Check for the usual programs
dnl
AC_PROG_CC
AC_PROG_INSTALL
dnl disable shared libraries (for now)
dnl AC_DISABLE_SHARED
AC_PROG_LIBTOOL

AC_CHECK_HEADERS(sys/sockio.h)

dnl
dnl And some custom things
dnl

AC_LIBNET_ENDIAN_CHECK
AC_LBL_UNALIGNED_ACCESS
dnl AC_LBL_LIBRARY_NET

AC_SUBST(ENDIANESS)
AC_SUBST(HAVE_PACKET_SOCKET)
AC_SUBST(ADDITIONAL_LIBS)
AC_SUBST(LIBNET_CONFIG_DEFINES)
AC_SUBST(LIBNET_CONFIG_LIBS)
AC_SUBST(LIBNET_CONFIG_CFLAGS)
AC_SUBST(LTLIBOBJS)

dnl
dnl Set the root install directory
dnl
AC_PREFIX_DEFAULT(/usr/local)
dnl if test "$prefix" = "NONE"; then
dnl     prefix="/usr"
dnl fi

dnl
dnl Get link-layer interface type
dnl
AC_MSG_CHECKING(link-layer packet interface type)

if test -r /dev/bpf0 ; then
    AC_LIBOBJ([libnet_link_bpf])
    AC_MSG_RESULT(found bpf)
elif test -r /usr/include/net/pfilt.h ; then
    AC_LIBOBJ([libnet_link_pf])
    AC_MSG_RESULT(found pf)
elif test -r /dev/nit ; then
    AC_LIBOBJ([libnet_link_snit])
    AC_MSG_RESULT(found snit)
elif test -r /usr/include/sys/net/nit.h ; then
    AC_LIBOBJ([libnet_link_nit])
    AC_MSG_RESULT(found nit)
elif test -r /usr/include/net/raw.h ; then
    AC_LIBOBJ([libnet_link_snoop])
    AC_MSG_RESULT(found snoop)
elif test -r /usr/include/sys/dlpi.h ; then
    AC_LIBOBJ([libnet_link_dlpi])
    AC_MSG_RESULT(found dlpi)
    AC_DEFINE(HAVE_DLPI, 1, [Define if the <sys/dlpi.h> header exists.])
elif test -r /usr/include/linux/socket.h ; then
    AC_LIBOBJ([libnet_link_linux])
    AC_MSG_RESULT(found linux primitives)
    AC_LIBNET_CHECK_PF_PACKET
    AC_LIBNET_LINUX_PROCFS
elif test -c /dev/bpf0 ; then           # check again in case not readable
    AC_LIBOBJ([libnet_link_bpf])
    AC_MSG_RESULT(found bpf)
elif test -c /dev/nit ; then            # check again in case not readable
    AC_LIBOBJ([libnet_link_snit])
    AC_MSG_RESULT(found snit)
elif test "$target_os" = "cygwin" ; then
     AC_LIBOBJ([libnet_link_win32])
     AC_MSG_RESULT(found win32 wpcap)
else
    AC_LIBOBJ([libnet_link_none])
    AC_MSG_WARN(could not find a link-layer packet interface)
    AC_MSG_WARN(link-layer packet injection will not be available)
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 Inform user about the packet builders we've got
dnl
echo -n "scanning available packet construction modules: "
for dir in src/*build*c ; do
    echo $dir | sed -e /src\\/libnet_build_/s/// | sed -e /\\.c/s/// | tr \\n \\040
done
echo ""

dnl
dnl Check and set OS specific parameters
dnl

case "$target_os" in

*linux*)
    AC_DEFINE(_BSD_SOURCE, 1,
        [Define as necessary to "unhide" header symbols.])
    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"
    AC_CHECK_HEADERS(net/ethernet.h, \
        LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DHAVE_NET_ETHERNET_H")
    ;;

*freebsd*)
    AC_DEFINE(LIBNET_BSDISH_OS, 1,
        [Define if our build OS supports the BSD APIs])
    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"
    ;;

*netbsd*)
    AC_DEFINE(LIBNET_BSDISH_OS, 1,
        [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"
    ;;

*openbsd*)
    AC_DEFINE(LIBNET_BSDISH_OS, 1,
        [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"
    ;;

*bsdi*)
    AC_DEFINE(LIBNET_BSDISH_OS, 1,
        [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"
    ;;

*darwin*)
    AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1,
        [Define if the sockaddr structure includes a sa_len member.])
    LIBNET_CONFIG_DEFINES="-DHAVE_SOCKADDR_SA_LEN"
    ;;

*solaris*)
    AC_DEFINE(HAVE_SOLARIS, 1, [Define if we are running on Solaris.])
    AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
    AC_MSG_CHECKING(for /dev/dlpi device)
    if test -c /dev/dlpi; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_DEV_DLPI, 1, [Define if /dev/dlpi is available.])
    else
        AC_MSG_RESULT(no)
        dir="/dev/dlpi"
        AC_MSG_CHECKING(for $dir directory)
        if test -d $dir ; then
            AC_MSG_RESULT(yes)
            AC_DEFINE_UNQUOTED(DLPI_DEV_PREFIX, "$dir",
                [Define if /dev/dlpi is a directory.])
        else
            AC_MSG_RESULT(no)
        fi
    fi
    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(resolv, hstrerror, ,AC_MSG_ERROR(libresolv not found.))

dnl 
dnl Broken checksums?
dnl
    case "`uname -r`" in
    5.4)
        AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
            [Define if our version of Solaris has broken checksums.])
        ;;
    5.5*)
        AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
            [Define if our version of Solaris has broken checksums.])
        ;;
    5.8)
        AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
            [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)
        AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG, 1,
            [Define if our version of Solaris has broken checksums.])
        AC_DEFINE(HAVE_SOLARIS_IPV6, 1,
            [Define if our version of Solaris supports IPv6.])
        ;;

    esac

    ADDITIONAL_LIBS='-lresolv -lsocket -lnsl'
    LIBNET_CONFIG_LIBS="$LIBNET_CONFIG_LIBS -lresolv -lsocket -lnsl"

    ;;

*hpux11*)
    AC_DEFINE(HAVE_HPUX11, 1, [Define if we're building on HP/UX.])
    AC_CHECK_HEADERS(sys/dlpi_ext.h)
    ;;

*cygwin*)
     AC_DEFINE(LIBNET_BSDISH_OS, 1,
         [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"
     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(wpcap, pcap_setmode, ,AC_MSG_ERROR(pcap lib not found.))
     LIBS="$LIBS -lws2_32"
     ;;

*)
    AC_MSG_WARN(apparently your OS is not officially supported yet)
    AC_MSG_WARN(this may not work)
    AC_MSG_RESULT(please send diffs to mike@infonexus.com)
    ;;

esac

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