Skip to content

Latest commit

 

History

History
563 lines (527 loc) · 19.9 KB

configure.ac

File metadata and controls

563 lines (527 loc) · 19.9 KB
 
Feb 7, 2013
Feb 7, 2013
1
AC_INIT(openconnect, 4.99)
Jun 27, 2011
Jun 27, 2011
2
3
PKG_PROG_PKG_CONFIG
AC_LANG_C
Apr 8, 2012
Apr 8, 2012
4
AC_CANONICAL_HOST
Oct 7, 2011
Oct 7, 2011
5
AM_MAINTAINER_MODE([enable])
Jun 27, 2011
Jun 27, 2011
6
AM_INIT_AUTOMAKE([foreign])
Sep 15, 2011
Sep 15, 2011
7
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Jun 27, 2011
Jun 27, 2011
8
Apr 11, 2012
Apr 11, 2012
9
10
11
12
13
14
15
16
# Define htmldir and localedir for users of ancient autoconf building from git
AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME],
['${datadir}/doc/${PACKAGE_TARNAME}'],
['${datadir}/doc/${PACKAGE}'])
])])
AC_PREREQ([2.60], [], [AC_SUBST([localedir], ['$(datadir)/locale'])])
May 18, 2012
May 18, 2012
17
18
19
20
21
22
23
24
25
26
# Upstream's pkg.m4 (since 0.27) offers this now, but define our own
# compatible version in case the local version of pkgconfig isn't new enough.
# https://bugs.freedesktop.org/show_bug.cgi?id=48743
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR],
[AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir],
[install directory for openconnect.pc pkg-config file])],
[],[with_pkgconfigdir='$(libdir)/pkgconfig'])
AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])])
Apr 16, 2012
Apr 16, 2012
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
AC_ARG_WITH([vpnc-script],
[AS_HELP_STRING([--with-vpnc-script],
[default location of vpnc-script helper])])
if test "$with_vpnc_script" = "yes" || test "$with_vpnc_script" = ""; then
with_vpnc_script=/etc/vpnc/vpnc-script
if ! test -x "$with_vpnc_script"; then
AC_MSG_ERROR([${with_vpnc_script} does not seem to be executable.]
[OpenConnect will not function correctly without a vpnc-script.]
[See http://www.infradead.org/openconnect/vpnc-script.html for more details.]
[]
[If you are building a distribution package, please ensure that your]
[packaging is correct, and that a vpnc-script will be installed when the]
[user installs your package. You should provide a --with-vpnc-script=]
[argument to this configure script, giving the full path where the script]
[will be installed.]
[]
[The standard location is ${with_vpnc_script}. To bypass this error and]
[build OpenConnect to use the script from this location, even though it's]
[not present at the time you are building OpenConnect, pass the argument]
["--with-vpnc-script=${with_vpnc_script}"])
fi
elif test "$with_vpnc_script" = "no"; then
AC_ERROR([You cannot disable vpnc-script.]
[OpenConnect will not function correctly without it.]
[See http://www.infradead.org/openconnect/vpnc-script.html])
fi
AC_DEFINE_UNQUOTED(DEFAULT_VPNCSCRIPT, "${with_vpnc_script}")
Jun 7, 2012
Jun 7, 2012
56
AC_SUBST(DEFAULT_VPNCSCRIPT, "${with_vpnc_script}")
Sep 22, 2011
Sep 22, 2011
57
Nov 8, 2012
Nov 8, 2012
58
use_openbsd_libtool=
Apr 8, 2012
Apr 8, 2012
59
60
61
case $host_os in
*linux* | *gnu*)
AC_MSG_NOTICE([Applying feature macros for GNU build])
Nov 5, 2011
Nov 5, 2011
62
63
64
65
66
67
68
69
70
71
72
AC_DEFINE(_POSIX_C_SOURCE, 200112L)
# For strcasecmp()
AC_DEFINE(_BSD_SOURCE)
# For asprintf()
AC_DEFINE(_GNU_SOURCE)
;;
*netbsd*)
AC_MSG_NOTICE([Applying feature macros for NetBSD build])
AC_DEFINE(_POSIX_C_SOURCE, 200112L)
AC_DEFINE(_NETBSD_SOURCE)
;;
Nov 8, 2012
Nov 8, 2012
73
74
75
76
*openbsd*)
AC_MSG_NOTICE([Applying feature macros for OpenBSD build])
use_openbsd_libtool=true
;;
Nov 5, 2011
Nov 5, 2011
77
78
79
80
81
82
83
84
*)
# On FreeBSD the only way to get vsyslog() visible is to define
# *nothing*, which makes absolutely everything visible.
# On Darwin enabling _POSIX_C_SOURCE breaks <sys/mount.h> because
# u_long and other types don't get defined. OpenBSD is similar.
;;
esac
May 13, 2012
May 13, 2012
85
86
87
88
89
90
91
92
93
94
symver_time=
symver_getline=
symver_asprintf=
case $host_os in
*solaris*|*sunos*)
symver_time="openconnect__time;"
;;
esac
Jun 1, 2012
Jun 1, 2012
95
AC_CHECK_FUNC(fdevname_r, [AC_DEFINE(HAVE_FDEVNAME_R, 1)], [])
May 13, 2012
May 13, 2012
96
AC_CHECK_FUNC(getline, [AC_DEFINE(HAVE_GETLINE, 1)], [symver_getline="openconnect__getline;"])
Apr 18, 2012
Apr 18, 2012
97
AC_CHECK_FUNC(strcasestr, [AC_DEFINE(HAVE_STRCASESTR, 1)], [])
May 13, 2012
May 13, 2012
98
99
AC_CHECK_FUNC(asprintf, [AC_DEFINE(HAVE_ASPRINTF, 1)], [symver_asprintf="openconnect__asprintf;"])
if test -n "$symver_asprintf"; then
Apr 18, 2012
Apr 18, 2012
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
AC_MSG_CHECKING([for va_copy])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdarg.h>
va_list a;],[
va_list b;
va_copy(b,a);
va_end(b);])],
[AC_DEFINE(HAVE_VA_COPY, 1)
AC_MSG_RESULT(va_copy)],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdarg.h>
va_list a;],[
va_list b;
__va_copy(b,a);
va_end(b);])],
[AC_DEFINE(HAVE___VA_COPY, 1)
AC_MSG_RESULT(__va_copy)],
[AC_MSG_RESULT(no)
AC_MSG_ERROR([Your system lacks asprintf() and va_copy()])])
])
fi
May 13, 2012
May 13, 2012
121
122
123
AC_SUBST(SYMVER_TIME, $symver_time)
AC_SUBST(SYMVER_GETLINE, $symver_getline)
AC_SUBST(SYMVER_ASPRINTF, $symver_asprintf)
Apr 18, 2012
Apr 18, 2012
124
Sep 15, 2011
Sep 15, 2011
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
AS_COMPILER_FLAGS(CFLAGS,
"-Wall
-Wextra
-Wno-missing-field-initializers
-Wno-sign-compare
-Wno-unused-parameter
-Werror=pointer-to-int-cast
-Wdeclaration-after-statement
-Werror-implicit-function-declaration
-Wformat-nonliteral
-Wformat-security
-Winit-self
-Wmissing-declarations
-Wmissing-include-dirs
-Wnested-externs
-Wpointer-arith
-Wwrite-strings")
Nov 6, 2012
Nov 6, 2012
143
144
AC_CHECK_FUNC(socket, [], AC_CHECK_LIB(socket, socket, [], AC_ERROR(Cannot find socket() function)))
AC_CHECK_FUNC(inet_aton, [], AC_CHECK_LIB(nsl, inet_aton, [], AC_ERROR(Cannot find inet_aton() function)))
Mar 2, 2013
Mar 2, 2013
145
AC_CHECK_FUNC(__android_log_vprint, [], AC_CHECK_LIB(log, __android_log_vprint, [], []))
Nov 6, 2012
Nov 6, 2012
146
Apr 17, 2012
Apr 17, 2012
147
148
149
AC_ENABLE_SHARED
AC_DISABLE_STATIC
Apr 23, 2012
Apr 23, 2012
150
AC_ARG_ENABLE([nls],
May 28, 2012
May 28, 2012
151
[ --disable-nls do not use Native Language Support],
Apr 23, 2012
Apr 23, 2012
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
[USE_NLS=$enableval], [USE_NLS=yes])
LIBINTL=
if test "$USE_NLS" = "yes"; then
AC_PATH_PROG(MSGFMT, msgfmt)
if test "$MSGFMT" = ""; then
AC_ERROR([msgfmt could not be found. Try configuring with --disable-nls])
fi
fi
LIBINTL=
if test "$USE_NLS" = "yes"; then
AC_MSG_CHECKING([for functional NLS support])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <locale.h>
#include <libintl.h>],[
setlocale(LC_ALL, "");
bindtextdomain("openconnect", "/tmp");
(void)dgettext("openconnect", "foo");])],
[AC_MSG_RESULT(yes)],
[oldLIBS="$LIBS"
LIBS="$LIBS -lintl"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <locale.h>
#include <libintl.h>],[
setlocale(LC_ALL, "");
bindtextdomain("openconnect", "/tmp");
(void)dgettext("openconnect", "foo");])],
[AC_MSG_RESULT(yes (with -lintl))]
LIBINTL="-lintl",
Nov 7, 2012
Nov 7, 2012
180
181
182
183
184
185
186
187
188
189
190
191
[LIBS="$LIBS -liconv"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <locale.h>
#include <libintl.h>],[
setlocale(LC_ALL, "");
bindtextdomain("openconnect", "/tmp");
(void)dgettext("openconnect", "foo");])],
[AC_MSG_RESULT(yes (with -lintl -liconv))]
LIBINTL="-lintl",
[AC_MSG_RESULT(no)
USE_NLS=no])
LIBS="$oldLIBS"])])
Apr 23, 2012
Apr 23, 2012
192
193
194
195
196
197
198
199
fi
if test "$USE_NLS" = "yes"; then
AC_SUBST(LIBINTL)
AC_DEFINE(ENABLE_NLS, 1)
fi
AM_CONDITIONAL(USE_NLS, [test "$USE_NLS" = "yes"])
Jul 20, 2012
Jul 20, 2012
200
201
202
203
AC_ARG_WITH([system-cafile],
AS_HELP_STRING([--with-system-cafile],
[Location of the default system CA certificate file for old (<3.0.20) GnuTLS versions]))
Feb 12, 2013
Feb 12, 2013
204
205
206
207
208
# We will use GnuTLS by default if it's present, and if GnuTLS doesn't
# have DTLS support then we'll *also* use OpenSSL for that, but it
# appears *only* only in the openconnect executable and not the
# library (hence shouldn't be a problem for GPL'd programs using
# libopenconnect).
Jun 11, 2012
Jun 11, 2012
209
#
Feb 12, 2013
Feb 12, 2013
210
211
212
# If built with --without-openssl then we'll even eschew OpenSSL for
# DTLS support and will build without any DTLS support at all if
# GnuTLS cannot manage.
Jun 11, 2012
Jun 11, 2012
213
#
Feb 12, 2013
Feb 12, 2013
214
215
# You can build without GnuTLS, even if its pkg-config file is present
# on the system, by using '--without-gnutls'
Jun 11, 2012
Jun 11, 2012
216
May 28, 2012
May 28, 2012
217
AC_ARG_WITH([gnutls],
Feb 12, 2013
Feb 12, 2013
218
219
AS_HELP_STRING([--without-gnutls],
[Do not attempt to use GnuTLS; use OpenSSL instead]))
Jun 27, 2011
Jun 27, 2011
220
221
AC_ARG_WITH([openssl],
AS_HELP_STRING([--with-openssl],
May 28, 2012
May 28, 2012
222
223
224
[Location of OpenSSL build dir]))
ssl_library=
Feb 12, 2013
Feb 12, 2013
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
if test "$with_gnutls" = "yes" || test "$with_gnutls" = ""; then
PKG_CHECK_MODULES(GNUTLS, gnutls, [found_gnutls=yes], [found_gnutls=no])
if test "$found_gnutls" = "yes"; then
if ! $PKG_CONFIG --atleast-version=2.12.16 gnutls; then
found_gnutls=old
fi
fi
case $with_gnutls$found_gnutls in
yesold)
AC_MSG_ERROR([Your GnuTLS is too old. At least v2.12.16 is required])
;;
yesno)
AC_MSG_ERROR([GnuTLS requested but no package 'gnutls' found])
;;
old)
AC_MSG_WARN([GnuTLS is too old. At least v2.12.16 is required. Falling back to OpenSSL])
;;
yes)
with_gnutls=yes
;;
esac
elif test "$with_gnutls" != "no"; then
AC_MSG_ERROR([Values other than 'yes' or 'no' for --with-gnutls are not supported])
fi
Jun 11, 2012
Jun 11, 2012
250
if test "$with_gnutls" = "yes"; then
Jun 7, 2012
Jun 7, 2012
251
252
oldlibs="$LIBS"
LIBS="$LIBS $GNUTLS_LIBS"
Jun 30, 2012
Jun 30, 2012
253
254
AC_CHECK_FUNC(gnutls_dtls_set_data_mtu,
[AC_DEFINE(HAVE_GNUTLS_DTLS_SET_DATA_MTU, 1)], [])
Jun 10, 2012
Jun 10, 2012
255
256
AC_CHECK_FUNC(gnutls_certificate_set_x509_system_trust,
[AC_DEFINE(HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST, 1)], [])
Jul 20, 2012
Jul 20, 2012
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
283
284
285
286
287
288
if test "$ac_cv_func_gnutls_certificate_set_x509_system_trust" != "yes"; then
# We will need to tell GnuTLS the path to the system CA file.
if test "$with_system_cafile" = "yes" || test "$with_system_cafile" = ""; then
unset with_system_cafile
AC_MSG_CHECKING([For location of system CA trust file])
for file in /etc/ssl/certs/ca-certificates.crt \
/etc/pki/tls/cert.pem \
/usr/local/share/certs/ca-root-nss.crt \
/etc/ssl/cert.pem; do
if grep 'BEGIN CERTIFICATE-----' $file >/dev/null 2>&1; then
with_system_cafile=${file}
break
fi
done
AC_MSG_RESULT([${with_system_cafile-NOT FOUND}])
elif test "$with_system_cafile" = "no"; then
AC_MSG_ERROR([You cannot disable the system CA certificate file.])
fi
if test "$with_system_cafile" = ""; then
AC_MSG_ERROR([Unable to find a standard system CA certificate file.]
[Your GnuTLS requires a path to a CA certificate store. This is a file]
[which contains a list of the Certificate Authorities which are trusted.]
[Most distributions ship with this file in a standard location, but none]
[the known standard locations exist on your system. You should provide a]
[--with-system-cafile= argument to this configure script, giving the full]
[path to a default CA certificate file for GnuTLS to use. Also, please]
[send full details of your system, including 'uname -a' output and the]
[location of the system CA certificate store on your system, to the]
[openconnect-devel@lists.infradead.org mailing list.])
fi
AC_DEFINE_UNQUOTED([DEFAULT_SYSTEM_CAFILE], ["$with_system_cafile"])
fi
Jun 7, 2012
Jun 7, 2012
289
290
AC_CHECK_FUNC(gnutls_pkcs12_simple_parse,
[AC_DEFINE(HAVE_GNUTLS_PKCS12_SIMPLE_PARSE, 1)], [])
Jun 12, 2012
Jun 12, 2012
291
AC_CHECK_FUNC(gnutls_certificate_set_key,
Jun 14, 2012
Jun 14, 2012
292
[AC_DEFINE(HAVE_GNUTLS_CERTIFICATE_SET_KEY, 1)], [])
Feb 12, 2013
Feb 12, 2013
293
294
AC_CHECK_FUNC(gnutls_pubkey_verify_data2,
[AC_DEFINE(HAVE_GNUTLS_PUBKEY_VERIFY_DATA2, 1)], [])
Jun 13, 2012
Jun 13, 2012
295
if test "$with_openssl" = "" || test "$with_openssl" = "no"; then
Jun 11, 2012
Jun 11, 2012
296
297
298
299
300
301
302
303
304
AC_CHECK_FUNC(gnutls_session_set_premaster,
[have_gnutls_dtls=yes], [have_gnutls_dtls=no])
else
have_gnutls_dtls=no
fi
if test "$have_gnutls_dtls" = "yes"; then
if test "$with_openssl" = "" || test "$with_openssl" = "no"; then
# They either said no OpenSSL or didn't specify, and GnuTLS can
# do DTLS, so just use GnuTLS.
Feb 12, 2013
Feb 12, 2013
305
AC_DEFINE(HAVE_GNUTLS_SESSION_SET_PREMASTER, 1)
Jun 11, 2012
Jun 11, 2012
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
ssl_library=gnutls
with_openssl=no
else
# They specifically asked for OpenSSL, so use it for DTLS even
# though GnuTLS could manage.
ssl_library=both
fi
else
if test "$with_openssl" = "no"; then
# GnuTLS doesn't have DTLS, but they don't want OpenSSL. So build
# without DTLS support at all.
ssl_library=gnutls
else
# GnuTLS doesn't have DTLS so use OpenSSL for it, but GnuTLS for
# the TCP connection (and thus in the library).
ssl_library=both
fi
fi
Jun 8, 2012
Jun 8, 2012
324
325
326
AC_CHECK_FUNC(gnutls_pkcs11_add_provider,
[PKG_CHECK_MODULES(P11KIT, p11-kit-1, [AC_DEFINE(HAVE_P11KIT)
AC_SUBST(P11KIT_PC, p11-kit-1)], [:])], [])
Jun 14, 2012
Jun 14, 2012
327
328
329
LIBS="$oldlibs -ltspi"
AC_MSG_CHECKING([for tss library])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
Jun 13, 2012
Jun 13, 2012
330
331
332
333
334
335
336
337
338
#include <trousers/tss.h>
#include <trousers/trousers.h>],[
int err = Tspi_Context_Create((void *)0);
Trspi_Error_String(err);])],
[AC_MSG_RESULT(yes)
AC_SUBST([TSS_LIBS], [-ltspi])
AC_SUBST([TSS_CFLAGS], [])
AC_DEFINE(HAVE_TROUSERS, 1)],
[AC_MSG_RESULT(no)])
Jun 14, 2012
Jun 14, 2012
339
LIBS="$oldlibs"
May 28, 2012
May 28, 2012
340
fi
Jun 11, 2012
Jun 11, 2012
341
if test "$with_openssl" = "yes" || test "$with_openssl" = "" || test "$ssl_library" = "both"; then
May 28, 2012
May 28, 2012
342
343
344
345
346
PKG_CHECK_MODULES(OPENSSL, openssl, [],
[oldLIBS="$LIBS"
LIBS="$LIBS -lssl -lcrypto"
AC_MSG_CHECKING([for OpenSSL without pkg-config])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
Apr 15, 2012
Apr 15, 2012
347
348
349
350
351
352
#include <openssl/ssl.h>
#include <openssl/err.h>],[
SSL_library_init();
ERR_clear_error();
SSL_load_error_strings();
OpenSSL_add_all_algorithms();])],
May 28, 2012
May 28, 2012
353
354
355
356
[AC_MSG_RESULT(yes)
AC_SUBST([OPENSSL_LIBS], ["-lssl -lcrypto"])
AC_SUBST([OPENSSL_CFLAGS], [])],
[AC_MSG_RESULT(no)
Jun 11, 2012
Jun 11, 2012
357
358
359
360
361
if test "$ssl_library" = "both"; then
ssl_library="gnutls";
else
AC_ERROR([Could not build against OpenSSL]);
fi])
May 28, 2012
May 28, 2012
362
LIBS="$oldLIBS"])
Jun 11, 2012
Jun 11, 2012
363
364
365
if test "$ssl_library" != "both" && test "$ssl_library" != "gnutls"; then
ssl_library=openssl
fi
May 28, 2012
May 28, 2012
366
367
368
369
370
371
372
elif test "$with_openssl" != "no" ; then
OPENSSL_CFLAGS="-I${with_openssl}/include"
OPENSSL_LIBS="${with_openssl}/libssl.a ${with_openssl}/libcrypto.a -ldl -lz"
AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LIBS)
enable_static=yes
enable_shared=no
Jun 11, 2012
Jun 11, 2012
373
374
375
376
AC_DEFINE(DTLS_OPENSSL, 1)
if test "$ssl_library" != "both"; then
ssl_library=openssl
fi
May 28, 2012
May 28, 2012
377
378
379
380
381
fi
case "$ssl_library" in
gnutls)
AC_DEFINE(OPENCONNECT_GNUTLS, 1)
Jun 11, 2012
Jun 11, 2012
382
383
384
385
AC_DEFINE(DTLS_GNUTLS, 1)
AC_SUBST(SSL_LIBRARY, [gnutls])
AC_SUBST(SSL_LIBS, ['$(GNUTLS_LIBS)'])
AC_SUBST(SSL_CFLAGS, ['$(GNUTLS_CFLAGS)'])
May 28, 2012
May 28, 2012
386
387
388
;;
openssl)
AC_DEFINE(OPENCONNECT_OPENSSL, 1)
Jun 11, 2012
Jun 11, 2012
389
390
391
392
AC_DEFINE(DTLS_OPENSSL, 1)
AC_SUBST(SSL_LIBRARY, [openssl])
AC_SUBST(SSL_LIBS, ['$(OPENSSL_LIBS)'])
AC_SUBST(SSL_CFLAGS, ['$(OPENSSL_CFLAGS)'])
Jun 14, 2012
Jun 14, 2012
393
AC_SUBST(SYMVER_PRINT_ERR, ["openconnect_print_err_cb;"])
Jun 11, 2012
Jun 11, 2012
394
395
396
397
398
399
400
401
402
403
;;
both)
# GnuTLS for TCP, OpenSSL for DTLS
AC_DEFINE(OPENCONNECT_GNUTLS, 1)
AC_DEFINE(DTLS_OPENSSL, 1)
AC_SUBST(SSL_LIBRARY, [gnutls])
AC_SUBST(SSL_LIBS, ['$(GNUTLS_LIBS)'])
AC_SUBST(SSL_CFLAGS, ['$(GNUTLS_CFLAGS)'])
AC_SUBST(DTLS_SSL_LIBS, ['$(OPENSSL_LIBS)'])
AC_SUBST(DTLS_SSL_CFLAGS, ['$(OPENSSL_CFLAGS)'])
Jun 14, 2012
Jun 14, 2012
404
AC_SUBST(SYMVER_PRINT_ERR, ["openconnect_print_err_cb;"])
May 28, 2012
May 28, 2012
405
406
407
408
409
;;
*)
AC_MSG_ERROR([Neither OpenSSL nor GnuTLS selected for SSL.])
;;
esac
Jun 14, 2012
Jun 14, 2012
410
411
AM_CONDITIONAL(OPENCONNECT_GNUTLS, [ test "$ssl_library" != "openssl" ])
AM_CONDITIONAL(OPENCONNECT_OPENSSL, [ test "$ssl_library" = "openssl" ])
Jun 27, 2011
Jun 27, 2011
412
Apr 11, 2012
Apr 11, 2012
413
414
# Needs to happen after we default to static/shared libraries based on OpenSSL
AC_PROG_LIBTOOL
Nov 8, 2012
Nov 8, 2012
415
416
417
418
if test "$use_openbsd_libtool" = "true" && test -x /usr/bin/libtool; then
echo using OpenBSD libtool
LIBTOOL=/usr/bin/libtool
fi
Nov 12, 2012
Nov 12, 2012
419
420
AM_CONDITIONAL(OPENBSD_LIBTOOL, [ test "$use_openbsd_libtool" = "true" ])
May 13, 2012
May 13, 2012
421
422
423
424
425
426
# Ick. This seems like it's likely to be very fragile, but I can't see a better
# way. I shall console myself with the observation that the failure mode isn't
# particularly horrible — you just don't get symbol versioning if it fails.
symvers=no
if test "$enable_shared" = "yes" ; then
AC_MSG_CHECKING([if library symbol versioning is available]);
May 13, 2012
May 13, 2012
427
echo 'FOO { global: foo; local: *; };' > conftest.map
May 13, 2012
May 13, 2012
428
429
430
431
432
echo 'int foo = 0;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
soname=conftest
libobjs=conftest.$ac_objext
if AC_TRY_EVAL(archive_cmds ${wl}--version-script ${wl}conftest.map); then
May 13, 2012
May 13, 2012
433
434
435
436
437
AC_SUBST(VERSION_SCRIPT_ARG, [--version-script])
symvers="yes (with --version-script)"
elif AC_TRY_EVAL(archive_cmds ${wl}-M ${wl}conftest.map); then
AC_SUBST(VERSION_SCRIPT_ARG, [-M])
symvers="yes (with -M)"
May 13, 2012
May 13, 2012
438
439
440
441
fi
fi
AC_MSG_RESULT(${symvers})
fi
May 13, 2012
May 13, 2012
442
AM_CONDITIONAL(HAVE_SYMBOL_VERSIONING, [test "${symvers}" != "no"])
May 13, 2012
May 13, 2012
443
Jun 27, 2011
Jun 27, 2011
444
PKG_CHECK_MODULES(LIBXML2, libxml-2.0)
Nov 4, 2011
Nov 4, 2011
445
Jun 22, 2012
Jun 22, 2012
446
PKG_CHECK_MODULES(ZLIB, zlib, [AC_SUBST(ZLIB_PC, [zlib])],
Nov 4, 2011
Nov 4, 2011
447
448
449
450
451
452
453
454
455
456
457
458
[oldLIBS="$LIBS"
LIBS="$LIBS -lz"
AC_MSG_CHECKING([for zlib without pkg-config])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <zlib.h>],[
z_stream zs;
deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
-12, 9, Z_DEFAULT_STRATEGY);])],
[AC_MSG_RESULT(yes)
AC_SUBST([ZLIB_LIBS], [-lz])
AC_SUBST([ZLIB_CFLAGS], [])],
[AC_MSG_RESULT(no)
Apr 15, 2012
Apr 15, 2012
459
460
AC_ERROR([Could not build against zlib])])
LIBS="$oldLIBS"])
Jun 27, 2011
Jun 27, 2011
461
Sep 22, 2011
Sep 22, 2011
462
463
464
465
466
467
468
469
PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0,
[AC_SUBST(LIBPROXY_PC, libproxy-1.0)
AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
libproxy_pkg=yes],
libproxy_pkg=no)
dnl Libproxy *can* exist without a .pc file, and its header may be called
dnl libproxy.h in that case.
if (test "$libproxy_pkg" = "no"); then
Dec 3, 2011
Dec 3, 2011
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
AC_MSG_CHECKING([for libproxy])
oldLIBS="$LIBS"
LIBS="$LIBS -lproxy"
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <libproxy.h>],
[(void)px_proxy_factory_new();])],
[AC_MSG_RESULT(yes (with libproxy.h))
AC_DEFINE([LIBPROXY_HDR], ["libproxy.h"])
AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <proxy.h>],
[(void)px_proxy_factory_new();])],
[AC_MSG_RESULT(yes (with proxy.h))
AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
[AC_MSG_RESULT(no)])])
LIBS="$oldLIBS"
Jun 27, 2011
Jun 27, 2011
485
486
fi
Oct 13, 2012
Oct 13, 2012
487
488
489
490
491
492
PKG_CHECK_MODULES(LIBSTOKEN, stoken,
[AC_SUBST(LIBSTOKEN_PC, stoken)
AC_DEFINE([LIBSTOKEN_HDR], ["stoken.h"])
libstoken_pkg=yes],
libstoken_pkg=no)
Jun 27, 2011
Jun 27, 2011
493
494
495
496
497
498
499
500
501
AC_CHECK_HEADER([if_tun.h],
[AC_DEFINE([IF_TUN_HDR], ["if_tun.h"])],
[AC_CHECK_HEADER([linux/if_tun.h],
[AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])],
[AC_CHECK_HEADER([net/if_tun.h],
[AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])],
[AC_CHECK_HEADER([net/tun/if_tun.h],
[AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])])
Jun 11, 2012
Jun 11, 2012
502
if test "$ssl_library" = "openssl" || test "$ssl_library" = "both"; then
May 28, 2012
May 28, 2012
503
504
oldLIBS="$LIBS"
LIBS="$LIBS $OPENSSL_LIBS"
Mar 6, 2013
Mar 6, 2013
505
506
oldCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
May 10, 2012
May 10, 2012
507
Jun 11, 2012
Jun 11, 2012
508
509
510
511
512
513
514
515
516
if test "$ssl_library" = "openssl"; then
AC_MSG_CHECKING([for ENGINE_by_id() in OpenSSL])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <openssl/engine.h>],
[ENGINE_by_id("foo");])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ENGINE, [1], [OpenSSL has ENGINE support])],
[AC_MSG_RESULT(no)
AC_MSG_NOTICE([Building without OpenSSL TPM ENGINE support])])
fi
May 10, 2012
May 10, 2012
517
May 28, 2012
May 28, 2012
518
AC_MSG_CHECKING([for dtls1_stop_timer() in OpenSSL])
Jun 11, 2012
Jun 11, 2012
519
520
521
522
523
524
525
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <openssl/ssl.h>
#include <stdlib.h>
extern void dtls1_stop_timer(SSL *);],
[dtls1_stop_timer(NULL);])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function])],
[AC_MSG_RESULT(no)])
May 28, 2012
May 28, 2012
526
LIBS="$oldLIBS"
Mar 6, 2013
Mar 6, 2013
527
CFLAGS="$oldCFLAGS"
May 28, 2012
May 28, 2012
528
fi
Sep 15, 2011
Sep 15, 2011
529
Sep 28, 2011
Sep 28, 2011
530
531
532
533
534
535
536
AC_PATH_PROG(PYTHON, [python], [], $PATH:/bin:/usr/bin)
if (test -n "${ac_cv_path_PYTHON}"); then
AC_SUBST(PYTHON, ${ac_cv_path_PYTHON})
else
AC_MSG_NOTICE([Python not found; not building HTML pages])
fi
AM_CONDITIONAL(BUILD_WWW, [test -n "${ac_cv_path_PYTHON}"])
Nov 4, 2011
Nov 4, 2011
537
Jun 8, 2012
Jun 8, 2012
538
AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/po/LINGUAS $(top_srcdir)/openconnect.h ${top_srcdir}/libopenconnect.map.in'])
Nov 4, 2011
Nov 4, 2011
539
540
541
542
543
RAWLINGUAS=`sed -e "/^#/d" -e "s/#.*//" "${srcdir}/po/LINGUAS"`
# Remove newlines
LINGUAS=`echo $RAWLINGUAS`
AC_SUBST(LINGUAS)
May 29, 2012
May 29, 2012
544
545
APIMAJOR="`sed -n 's/^#define OPENCONNECT_API_VERSION_MAJOR \(.*\)/\1/p' ${srcdir}/openconnect.h`"
APIMINOR="`sed -n 's/^#define OPENCONNECT_API_VERSION_MINOR \(.*\)/\1/p' ${srcdir}/openconnect.h`"
May 13, 2012
May 13, 2012
546
547
548
AC_SUBST(APIMAJOR)
AC_SUBST(APIMINOR)
Nov 7, 2011
Nov 7, 2011
549
550
551
552
553
# We want version.c to depend on the files that would affect the
# output of version.sh. But we cannot assume that they'll exist,
# and we cannot use $(wildcard) in a non-GNU makefile. So we just
# depend on the files which happen to exist at configure time.
GITVERSIONDEPS=
Jun 8, 2012
Jun 8, 2012
554
555
for a in ${srcdir}/.git/index ${srcdir}/.git/packed-refs \
${srcdir}/.git/refs/tags ${srcdir}/.git/HEAD; do
Nov 7, 2011
Nov 7, 2011
556
557
558
559
560
561
if test -r $a ; then
GITVERSIONDEPS="$GITVERSIONDEPS $a"
fi
done
AC_SUBST(GITVERSIONDEPS)
May 13, 2012
May 13, 2012
562
AC_OUTPUT(Makefile openconnect.pc po/Makefile www/Makefile libopenconnect.map \
Jun 7, 2012
Jun 7, 2012
563
openconnect.8 www/styles/Makefile www/inc/Makefile www/images/Makefile)