-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
282 lines (248 loc) · 7.03 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
dnl
dnl VTun - Virtual Tunnel over TCP/IP network.
dnl Copyright (C) 1998-2006 Maxim Krasnyansky <[email protected]>
dnl
dnl $Id$
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(vtun, 3) dnl this needs to change via variables as in the tail
AC_CONFIG_HEADER(config.h)
dnl Shapper support
AC_ARG_ENABLE(shaper,
--disable-shaper Don not compile shaper module,
SHAPER=$enableval,
SHAPER=yes
)
dnl Encryption support
AC_ARG_ENABLE(ssl,
--disable-ssl Don not compile encryption module,
SSL=$enableval,
SSL=yes
)
dnl ZLIB support
AC_ARG_ENABLE(zlib,
--disable-zlib Don not compile ZLIB compression module,
ZLIB=$enableval,
ZLIB=yes
)
dnl LZO support
AC_ARG_ENABLE(lzo,
--disable-lzo Don not compile LZO compression module,
LZO=$enableval,
LZO=yes
)
dnl SOCKS support
AC_ARG_ENABLE(socks,
--enable-socks Compile with SOCKS support,
SOCKS=$enableval,
SOCKS=no
)
dnl Delayed UDP Start support
AC_ARG_ENABLE(nathack,
--disable-nathack Do not enable Nat Hack code,
NATHACK=$enableval,
NATHACK=yes
)
AC_ARG_WITH(ssl-headers,
--with-ssl-headers=DIR Crypto Include files location,
SSL_HDR_DIR="$withval"
CPPFLAGS="$CPPFLAGS -I$withval"
)
AC_ARG_WITH(ssl-lib,
--with-ssl-lib=DIR Crypto Library location,
LIBS="$LIBS -L$withval"
)
AC_ARG_WITH(lzo-headers,
--with-lzo-headers=DIR LZO Include files location,
LZO_HDR_DIR="$withval"
)
AC_ARG_WITH(lzo-lib,
--with-lzo-lib=DIR LZO Library location,
LIBS="$LIBS -L$withval"
)
AC_ARG_WITH(blowfish-headers,
--with-blowfish-headers=DIR Blowfish Include files location,
BLOWFISH_HDR_DIR="$withval"
)
AC_ARG_WITH(socks-lib,
--with-socks-lib=DIR SOCKS Library location,
LIBS="$LIBS -L$withval"
)
dnl Guess host type.
AC_CANONICAL_HOST
AC_CANONICAL_SYSTEM
dnl Check for programs.
AC_PROG_YACC
AC_PROG_LEX
AC_PROG_CC
AC_PROG_INSTALL
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
dnl Check for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/resource.h netdb.h sched.h resolv.h arpa/inet.h)
AC_CHECK_HEADERS(netinet/ip.h netinet/in.h netinet/tcp.h netinet/in_systm.h)
AC_CHECK_HEADERS(libutil.h sys/sockio.h)
dnl Check for libsocket
AC_SEARCH_LIBS(socket, socket)
dnl Check for libnsl
AC_SEARCH_LIBS(inet_ntoa, nsl)
dnl Check for libresolv
AC_SEARCH_LIBS(gethostbyname, resolv nsl)
dnl Check for librt
AC_SEARCH_LIBS(nanosleep, rt posix4)
dnl Check for setproctitle in libutil
AC_SEARCH_LIBS(setproctitle, util bsd, AC_DEFINE(HAVE_SETPROC_TITLE, [1], [Define to 1 if you have setproctitle() function]) )
dnl Check for fork() (fallback to vfork() on non-MMU systems)
AC_FUNC_FORK
if test "$SHAPER" = "yes"; then
AC_DEFINE(HAVE_SHAPER, [1], [Define to 1 if you want to enable shaper module])
fi
if test "$ZLIB" = "yes"; then
AC_MSG_RESULT()
AC_CHECKING( for ZLIB Library and Header files ... )
AC_CHECK_LIB(z, deflate,
LIBS="$LIBS -lz"
AC_DEFINE(HAVE_ZLIB, [1], [Define to 1 if you have zlib]),
AC_MSG_ERROR( Zlib library not found.)
)
fi
dnl very servicable code borrowed heavily from openvpn.
if test "$LZO" = "yes"; then
LZOCHK=""
AC_MSG_RESULT()
AC_CHECKING( for LZO Library and Header files ... )
AC_SEARCH_HEADERS(lzo_asm.h,
$LZO_HDR_DIR /usr/include/lzo "" /usr/local/include,
LZOCHK="lzo2 lzo",
AC_SEARCH_HEADERS(lzo1x.h,
$LZO_HDR_DIR /usr/include/lzo "" /usr/local/include,
LZOCHK="lzo",
AC_MSG_ERROR( LZO library not found. )
)
)
if test -n "$LZOCHK"; then
havelzo=0;
for I in $LZOCHK ; do
if test $havelzo = 0; then
AC_CHECK_LIB($I, lzo1x_decompress,
[
LIBS="$LIBS -l"$I
AC_DEFINE(HAVE_LZO, [1], [Define to 1 if you have lzo])
havelzo=1
]
)
fi
done
if test $havelzo = 0; then
AC_MSG_ERROR( LZO library not found. )
fi
else
AC_MSG_ERROR( LZO headers not found. )
fi
fi
if test "$SSL" = "yes"; then
AC_MSG_RESULT()
AC_CHECKING( for md5 Library and Header files ... )
AC_SEARCH_HEADERS(md5.h,
$SSL_HDR_DIR /usr/include/openssl "" /usr/include /usr/include/ssl /usr/local/include /usr/local/ssl/include /usr/include/sys,
,
AC_MSG_ERROR( SSL headers not found. )
)
fi
if test "$SSL" = "yes"; then
AC_MSG_RESULT()
AC_CHECKING( for blowfish Library and Header files ... )
AC_SEARCH_HEADERS(blowfish.h,
$BLOWFISH_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include /usr/local/include /usr/local/ssl/include /usr/include/crypto,
AC_CHECK_LIB(crypto, BF_set_key,
[
LIBS="$LIBS -lcrypto"
AC_DEFINE(HAVE_SSL, [1], [Define to 1 if you have openssl])
AC_DEFINE(HAVE_SSL_BLOWFISH, [1], [Define to 1 if you have blowfish in openssl])
],
AC_MSG_ERROR( SSL library not found. )
),
AC_MSG_ERROR( SSL headers not found. )
)
fi
if test "$SSL" = "yes"; then
AC_MSG_RESULT()
AC_CHECKING( for AES Library and Header files ... )
AC_SEARCH_HEADERS(aes.h,
$SSL_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include /usr/local/include /usr/local/ssl/include /usr/include/crypto,
AC_CHECK_LIB(crypto, AES_set_encrypt_key,
[
AC_DEFINE(HAVE_SSL_AES, [1], [Define to 1 if you have AES in openssl])
],
AC_MSG_ERROR( AES library not found. )
),
AC_MSG_ERROR( AES headers not found. )
)
fi
if test "$SSL" = "yes"; then
AC_MSG_RESULT()
AC_CHECKING( for EVP Library and Header files ... )
AC_SEARCH_HEADERS(evp.h,
$SSL_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include /usr/local/include /usr/local/ssl/include /usr/include/crypto,
AC_CHECK_LIB(crypto, EVP_EncryptInit,
[
AC_DEFINE(HAVE_SSL_EVP, [1], [Define to 1 if you have EVP in openssl])
],
AC_MSG_ERROR( EVP library not found. )
),
AC_MSG_ERROR( EVP headers not found. )
)
fi
if test "$NATHACK" = "yes"; then
AC_DEFINE(ENABLE_NAT_HACK, [1], [Define to 1 if you want to enable Nat Hack code])
fi
if test "$SOCKS" = "yes"; then
AC_MSG_RESULT()
AC_CHECKING( for SOCKS Library ... )
AC_CHECK_LIB(socks5, SOCKSconnect,
[
CFLAGS="$CFLAGS -DVTUN_SOCKS=1"
LIBS="$LIBS -lsocks5"
],
AC_CHECK_LIB(socks, Rconnect,
[
CFLAGS="$CFLAGS -DVTUN_SOCKS=2"
LIBS="$LIBS -lsocks"
],
AC_MSG_ERROR( SOCKS library not found. )
)
)
fi
AC_MSG_RESULT()
AC_CHECK_FUNCS([getpt grantpt unlockpt ptsname])
OS_REL=`uname -r | tr -d '[A-Za-z\-\_\.]'`
case $host_os in
*linux*)
OS_DIR="linux"
AC_CHECK_HEADERS(linux/if_tun.h)
;;
*solaris*)
OS_DIR="svr4"
;;
*freebsd*)
if test "$OS_REL" -ge "40"; then
OS_DIR="freebsd"
fi
;;
*openbsd*)
if test "$OS_REL" -ge "25"; then
OS_DIR="openbsd"
fi
;;
esac
AC_LINK_DRV(`cat vtun.drivers`, $OS_DIR)
AC_MSG_RESULT()
dnl Build release name
changequote(<,>)
REL=`echo 'BRANCH-3_X' | tr -d '$: \-' | sed 's/^[A-Za-z]*//' | sed 's/\_/\./'`
changequote([,])
AC_DEFINE_UNQUOTED(VTUN_VER, "$REL `date '+%m/%d/%Y'`", [Vtun version])
AC_OUTPUT(Makefile)