-
Notifications
You must be signed in to change notification settings - Fork 12
/
configure.in
248 lines (215 loc) · 7.24 KB
/
configure.in
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
dnl Blah blah standard autoconf
AC_INIT(Makefile.in)
dnl Host type
AC_CANONICAL_HOST
dnl Check for standard tools
AC_PROG_CC
AC_PROG_LIBTOOL
# Liberated from ethereal's configure.in
#
# Add any platform-specific compiler flags needed.
#
AC_MSG_CHECKING(for platform-specific compiler flags)
if test "x$GCC" = x
then
#
# Not GCC - assume it's the vendor's compiler.
#
case "$host_os" in
hpux*)
#
# HP's ANSI C compiler; flags suggested by Jost Martin.
# "-Ae" for ANSI C plus extensions such as "long long".
# "+O2", for optimization. XXX - works with "-g"?
#
CFLAGS="-Ae +O2 $CFLAGS"
AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
;;
darwin*)
#
# It may be called "cc", but it's really a GCC derivative
# with a problematic special precompiler and precompiled
# headers; turn off the special precompiler, as some
# apparently-legal code won't compile with its precompiled
# headers.
#
CFLAGS="-no-cpp-precomp $CFLAGS"
AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
darwin="yes"
;;
linux*)
AC_MSG_RESULT(none needed)
AC_DEFINE(SYS_LINUX, 1, Compiling for Linux OS)
linux="yes"
;;
freebsd*)
AC_MSG_RESULT(none needed)
AC_DEFINE(SYS_FREEBSD, 1, Compiling for FreeBSD)
;;
openbsd*)
AC_MSG_RESULT(none needed)
AC_DEFINE(SYS_OPENBSD, 1, Compiling for OpenBSD)
;;
cygwin*)
AC_MSG_RESULT(none needed)
AC_DEFINE(SYS_CYGWIN, 1, Compiling for Cygwin)
cygwin="yes"
;;
*)
AC_MSG_RESULT(none needed)
;;
esac
else
case "$host_os" in
solaris*)
# the X11 headers don't automatically include prototype info
# and a lot don't include the return type
CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
;;
darwin*)
#
# See comments above about Apple's lovely C compiler.
#
CFLAGS="-no-cpp-precomp $CFLAGS"
AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
darwin="yes"
;;
linux*)
AC_MSG_RESULT(none needed)
AC_DEFINE(SYS_LINUX, 1, Compiling for Linux OS)
linux="yes"
;;
freebsd*)
AC_MSG_RESULT(none needed)
AC_DEFINE(SYS_FREEBSD, 1, Compiling for FreeBSD)
;;
openbsd*)
AC_MSG_RESULT(none needed)
AC_DEFINE(SYS_OPENBSD, 1, Compiling for OpenBSD)
;;
cygwin*)
# Adding -mno-cygwin uses the MingW linking process, precluding the use
# of cygwin.dll; linking to cygwin.dll forces GPL
CFLAGS="-mno-cygwin $CFLAGS"
AC_MSG_RESULT(none needed)
AC_DEFINE(SYS_CYGWIN, 1, Compiling for Cygwin)
cygwin="yes"
;;
*)
AC_MSG_RESULT(none needed)
;;
esac
fi
dnl Check for endian
AC_C_BIGENDIAN
dnl Check for headers and such
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h net/if_arp.h sys/socket.h)
dnl Look for linux kernel wireless headers
if test "$linux" = "yes"; then
AC_MSG_CHECKING(that linux/wireless.h is what we expect)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <sys/types.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/resource.h>
#include <asm/types.h>
#include <linux/if.h>
#include <linux/wireless.h>
]], [[
struct iwreq wrq;
wrq.u.essid.flags = 0;
]])],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LINUX_WIRELESS, 1, Linux wireless extentions present)
],[
AC_MSG_RESULT(no)
AC_MSG_ERROR(*** Missing working Linux wireless kernel extensions ***)
])
fi # linux
dnl Look for airpcap under cygwin
if test "$cygwin" = "yes"; then
AC_ARG_ENABLE(airpcap, [ --disable-airpcap disable checking for CACE airpcap],,wantairpcap=yes)
if test "$wantairpcap" = "yes"; then
airpcap_devpack="none"
AC_ARG_WITH(airpcap-devpack,
[ --with-airpcap[=DIR] Location of the CACE AirPcap device pack NOTE cygwin appears to have link errors if the path is not within the current directory],
[ airpcap_devpack="$withval" ])
if test "$airpcap_devpack" = "none"; then
AC_MSG_ERROR(No airpcap path provided use --with-airpcap-devpack)
fi # devpack none
dnl set the lib flags to refer to the devpack files
LDFLAGS="$LDFLAGS -L$airpcap_devpack/WinPcap_Devpack/Lib -L$airpcap_devpack/Airpcap_Devpack/Lib"
dnl set the CPP flags to refer to the devpack files
CPPFLAGS="$CPPFLAGS -I$airpcap_devpack/WinPcap_Devpack/Include -I$airpcap_devpack/Airpcap_Devpack/include"
AC_CHECK_LIB([wpcap], [pcap_open_live],
AC_DEFINE(HAVE_LIBWPCAP, 1, libwpcap library),
AC_MSG_ERROR(Could not link libwpcap check airpcap-devpack path))
AC_CHECK_LIB([wpcap], [pcap_get_airpcap_handle],,
AC_MSG_ERROR(Could not use pcap_get_airpcap_handle are you using the CACE airpcap libwpcap))
#AC_CHECK_LIB([airpcap], [AirpcapSetLinkType],
# AC_DEFINE(HAVE_LIBAIRPCAP, 1, libairpcap library),
# AC_MSG_ERROR(Could not link libairpcap check airpcap-devpack path))
AC_CHECK_HEADER([pcap.h],
AC_DEFINE(HAVE_PCAP_H, 1, pcap.h present),
AC_MSG_ERROR(Could not find pcap.h check airpcap-devpack path))
AC_CHECK_HEADER([airpcap.h],
AC_DEFINE(HAVE_AIRPCAP_H, 1, airpcap.h preset),
AC_MSG_ERROR(Could not find airpcap.h check airpcap-devpack path))
LIBS="$LIBS -lwpcap -lairpcap"
fi # waitairpcap
fi # cygwin
havenetlink=no
if test "$linux" = "yes"; then
havenetlink=yes
OLIBS="$LIBS"
AC_CHECK_HEADERS([asm/types.h netlink/genl/genl.h netlink/genl/family.h netlink/genl/ctrl.h netlink/msg.h netlink/attr.h linux/nl80211.h linux/if_arp.h linux/wireless.h],
AC_DEFINE(HAVE_NETLINKHEADERS, 1, Netlink headers are there),
havenetlink=no)
if test "$havenetlink" = "yes"; then
AC_CHECK_LIB([nl], [nl_handle_alloc],
AC_DEFINE(HAVE_LIBNL, 1, libnl netlink library), havenetlink=no)
else
AC_MSG_WARN(Missing libnl or libnl too old support will not be able to control mac80211 vaps)
fi
if test "$havenetlink" = "yes"; then
LIBS="$LIBS -lnl"
AC_MSG_CHECKING(For mac80211 support in netlink library)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <asm/types.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/family.h>
#include <netlink/genl/ctrl.h>
#include <netlink/msg.h>
#include <netlink/attr.h>
#include <linux/nl80211.h>
#include <linux/if_arp.h>
#include <linux/wireless.h>
]], [[
NL80211_IFTYPE_MONITOR;
return 0;
]])],[havenetlink=yes],[havenetlink=no])
else
AC_MSG_WARN(Missing libnl netlink library will not be able to control mac80211 vaps)
fi
if test "$havenetlink" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LINUX_NETLINK, 1, Netlink works)
else
LIBS="$OLIBS"
AC_MSG_RESULT(no netlink support for mac80211 will not be able to control mac80211 vaps)
fi # netlink checks
fi # netlink total
AC_CHECK_LIB([m], [pow],
AC_DEFINE(HAVE_LIBM, 1, Math lib) LIBS="$LIBS -lm",
AC_MSG_ERROR(*** Missing working libm math lib ***)
)
AC_CONFIG_HEADER(config.h)
CFLAGS=" -DHAVE_CONFIG_H $CFLAGS"
dnl Write it
AC_OUTPUT(Makefile)