-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure
executable file
·183 lines (141 loc) · 3.79 KB
/
configure
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
#!/bin/sh
# Let,s chect environment. For instance what we are on
OS=`uname -s`
MAC=`uname -m`
RELEASE=`uname -r`
# Whoarewe ? :)
ME=`whoami`
echo -n "Operating System Type: "
if test "$OS" = Linux; then
echo "Linux"
elif test "$OS" = FreeBSD; then
echo "FreeBSD"
elif test "$OS" = OpenBSD; then
echo "OpenBSD"
elif test "$OS" = NetBSD; then
echo "NetBSD"
fi
echo -n "testing /usr/include/stdio.h..."
if(test -f /usr/include/stdio.h); then
echo "ok"
else
exit
fi
echo -n "testing /usr/include/stdlib.h..."
if(test -f /usr/include/stdlib.h); then
echo "ok"
else
exit
fi
echo -n "testing /usr/include/errno.h..."
if(test -f /usr/include/errno.h); then
echo "ok"
else
echo "no"
fi
if test "$OS" = Linux; then
echo -n "testing /usr/include/pcap.h..."
if(test -f /usr/include/pcap.h); then
echo "ok"
else
exit
fi
fi
echo -n "testing /usr/include/sys/socket.h..."
if(test -f /usr/include/sys/socket.h); then
echo "ok"
else
exit;
fi
echo -n "testing /usr/include/netinet/in.h..."
if(test -f /usr/include/netinet/in.h); then
echo "ok"
else
exit;
fi
echo -n "testing /usr/include/arpa/inet.h..."
if(test -f /usr/include/arpa/inet.h); then
echo "ok"
else
exit
fi
echo -n "testing /usr/include/netinet/if_ether.h..."
if(test -f /usr/include/netinet/if_ether.h); then
echo "ok"
else
exit
fi
if test "$OS" = Linux; then
echo -n "testing /usr/include/libnet.h..."
if(test -f /usr/include/libnet.h); then
echo "ok"
else
exit
fi
elif test "$OS" = FreeBSD || test "$OS" = OpenBSD || test "$OS" = NetBSD; then
echo -n "testing /usr/local/include/libnet.h..."
if(test -f /usr/local/include/libnet.h); then
echo "ok"
else
exit
fi
fi
if test "$OS" = FreeBSD || test "$OS" = OpenBSD || test "$OS" = NetBSD; then
echo -n "testing /usr/local/lib/libnet.a..."
if(test -f /usr/local/lib/libnet.a); then
echo "ok"
else
echo "can't find required libnet.a static library"
exit
fi
fi
if test "$OS" = Linux; then
echo -n "testing /usr/lib/libnet.a..."
if(test -f /usr/lib/libnet.a); then
echo "ok"
else
echo "can't find required libnet.a static library"
exit
fi
fi
if test "$OS" = Linux; then
echo -n "testing /usr/lib/libpcap.a..."
if(test -f /usr/lib/libpcap.a); then
echo "ok"
else
echo "can't find required libpcap.a static library"
exit
fi
fi
echo -n "Writing MakeFile..."
echo "#!/usr/bin/make -f" > Makefile
echo "LIBNETDEFS = `libnet-config --defines`" >> Makefile
echo "LIBNETLIB = `libnet-config --libs`" >> Makefile
echo " " >> Makefile
echo " " >> Makefile
echo "all: kn_arp.c kn_main.c kn_defs.h" >> Makefile
echo " gcc -Wall -c kn_main.c" >> Makefile
if test "$OS" = Linux; then
echo " gcc -Wall \$(LIBNETDEFS) -c kn_arp.c" >> Makefile
echo " gcc -o knowlan kn_main.o kn_arp.o -lnet -lpcap" >> Makefile
echo " " >> Makefile
echo " " >> Makefile
echo "install: knowlan" >> Makefile
echo " /bin/cp knowlan /usr/sbin/knowlan" >> Makefile
echo " /bin/chown root.root /usr/sbin/knowlan" >> Makefile
echo " /bin/chmod 755 /usr/sbin/knowlan" >> Makefile
elif test "$OS" = FreeBSD || test "$OS" = OpenBSD || test "$OS" = NetBSD; then
echo " gcc -Wall -D__BSD__=1 -D__GLIBC__=1 -I/usr/local/include/ \$(LIBNETDEFS) -c kn_arp.c" >> Makefile
echo " gcc -o knowlan kn_main.o kn_arp.o /usr/local/lib/libnet.a -lpcap" >> Makefile
echo " " >> Makefile
echo " " >> Makefile
echo "install: knowlan" >> Makefile
echo " /bin/cp knowlan /usr/sbin/knowlan" >> Makefile
echo " /bin/chown root.root /usr/sbin/knowlan" >> Makefile
echo " /bin/chmod 755 /usr/sbin/knowlan" >> Makefile
fi
echo "clean:" >> Makefile
echo " find ./ -name \"*.o\" -exec rm -rf {} \;" >> Makefile
echo " find ./ -name \"knowlan\" -exec rm -rf {} \;" >> Makefile
echo " find ./ -name \"*core\" -exec rm -rf {} \;" >> Makefile
echo "Done."