2 AC_INIT(openconnect, 3.17)
6 AM_MAINTAINER_MODE([enable])
7 AM_INIT_AUTOMAKE([foreign])
8 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
10 # Define htmldir and localedir for users of ancient autoconf building from git
11 AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME],
12 ['${datadir}/doc/${PACKAGE_TARNAME}'],
13 ['${datadir}/doc/${PACKAGE}'])
16 AC_PREREQ([2.60], [], [AC_SUBST([localedir], ['$(datadir)/locale'])])
18 AC_ARG_WITH([vpnc-script],
19 [AS_HELP_STRING([--with-vpnc-script],
20 [default location of vpnc-script helper])])
22 if test "$with_vpnc_script" = "yes" || test "$with_vpnc_script" = ""; then
23 with_vpnc_script=/etc/vpnc/vpnc-script
24 if ! test -x "$with_vpnc_script"; then
25 AC_MSG_ERROR([${with_vpnc_script} does not seem to be executable.]
26 [OpenConnect will not function correctly without a vpnc-script.]
27 [See http://www.infradead.org/openconnect/vpnc-script.html for more details.]
29 [If you are building a distribution package, please ensure that your]
30 [packaging is correct, and that a vpnc-script will be installed when the]
31 [user installs your package. You should provide a --with-vpnc-script=]
32 [argument to this configure script, giving the full path where the script]
35 [The standard location is ${with_vpnc_script}. To bypass this error and]
36 [build OpenConnect to use the script from this location, even though it's]
37 [not present at the time you are building OpenConnect, pass the argument]
38 ["--with-vpnc-script=${with_vpnc_script}"])
40 elif test "$with_vpnc_script" = "no"; then
41 AC_ERROR([You cannot disable vpnc-script.]
42 [OpenConnect will not function correctly without it.]
43 [See http://www.infradead.org/openconnect/vpnc-script.html])
46 AC_DEFINE_UNQUOTED(DEFAULT_VPNCSCRIPT, "${with_vpnc_script}")
50 AC_MSG_NOTICE([Applying feature macros for GNU build])
51 AC_DEFINE(_POSIX_C_SOURCE, 200112L)
53 AC_DEFINE(_BSD_SOURCE)
55 AC_DEFINE(_GNU_SOURCE)
58 AC_MSG_NOTICE([Applying feature macros for NetBSD build])
59 AC_DEFINE(_POSIX_C_SOURCE, 200112L)
60 AC_DEFINE(_NETBSD_SOURCE)
63 # On FreeBSD the only way to get vsyslog() visible is to define
64 # *nothing*, which makes absolutely everything visible.
65 # On Darwin enabling _POSIX_C_SOURCE breaks <sys/mount.h> because
66 # u_long and other types don't get defined. OpenBSD is similar.
70 AC_CHECK_FUNC(strcasestr, [AC_DEFINE(HAVE_STRCASESTR, 1)], [])
72 AC_CHECK_FUNC(asprintf, [AC_DEFINE(HAVE_ASPRINTF, 1)], [need_vacopy=yes])
73 if test "$need_vacopy" = "yes"; then
74 AC_MSG_CHECKING([for va_copy])
75 AC_LINK_IFELSE([AC_LANG_PROGRAM([
81 [AC_DEFINE(HAVE_VA_COPY, 1)
82 AC_MSG_RESULT(va_copy)],
83 [AC_LINK_IFELSE([AC_LANG_PROGRAM([
89 [AC_DEFINE(HAVE___VA_COPY, 1)
90 AC_MSG_RESULT(__va_copy)],
92 AC_MSG_ERROR([Your system lacks asprintf() and va_copy()])])
98 AS_COMPILER_FLAGS(CFLAGS,
101 -Wno-missing-field-initializers
103 -Wno-unused-parameter
104 -Werror=pointer-to-int-cast
105 -Wdeclaration-after-statement
106 -Werror-implicit-function-declaration
110 -Wmissing-declarations
111 -Wmissing-include-dirs
120 [ --disable-nls do not use Native Language Support],
121 [USE_NLS=$enableval], [USE_NLS=yes])
123 if test "$USE_NLS" = "yes"; then
124 AC_PATH_PROG(MSGFMT, msgfmt)
125 if test "$MSGFMT" = ""; then
126 AC_ERROR([msgfmt could not be found. Try configuring with --disable-nls])
130 if test "$USE_NLS" = "yes"; then
131 AC_MSG_CHECKING([for functional NLS support])
132 AC_LINK_IFELSE([AC_LANG_PROGRAM([
134 #include <libintl.h>],[
135 setlocale(LC_ALL, "");
136 bindtextdomain("openconnect", "/tmp");
137 (void)dgettext("openconnect", "foo");])],
138 [AC_MSG_RESULT(yes)],
141 AC_LINK_IFELSE([AC_LANG_PROGRAM([
143 #include <libintl.h>],[
144 setlocale(LC_ALL, "");
145 bindtextdomain("openconnect", "/tmp");
146 (void)dgettext("openconnect", "foo");])],
147 [AC_MSG_RESULT(yes (with -lintl))]
154 if test "$USE_NLS" = "yes"; then
156 AC_DEFINE(ENABLE_NLS, 1)
158 AM_CONDITIONAL(USE_NLS, [test "$USE_NLS" = "yes"])
160 AC_ARG_WITH([openssl],
161 AS_HELP_STRING([--with-openssl],
162 [Location of OpenSSL build dir]),
163 [OPENSSL_CFLAGS="-I${with_openssl}/include"
164 OPENSSL_LIBS="${with_openssl}/libssl.a ${with_openssl}/libcrypto.a -ldl -lz"
165 AC_SUBST(OPENSSL_CFLAGS)
166 AC_SUBST(OPENSSL_LIBS)
169 [PKG_CHECK_MODULES(OPENSSL, openssl, [],
171 LIBS="$LIBS -lssl -lcrypto"
172 AC_MSG_CHECKING([for OpenSSL without pkg-config])
173 AC_LINK_IFELSE([AC_LANG_PROGRAM([
174 #include <openssl/ssl.h>
175 #include <openssl/err.h>],[
178 SSL_load_error_strings();
179 OpenSSL_add_all_algorithms();])],
181 AC_SUBST([OPENSSL_LIBS], ["-lssl -lcrypto"])
182 AC_SUBST([OPENSSL_CFLAGS], [])],
184 AC_ERROR([Could not build against OpenSSL])])
187 # Needs to happen after we default to static/shared libraries based on OpenSSL
190 PKG_CHECK_MODULES(LIBXML2, libxml-2.0)
192 PKG_CHECK_MODULES(ZLIB, zlib, [],
195 AC_MSG_CHECKING([for zlib without pkg-config])
196 AC_LINK_IFELSE([AC_LANG_PROGRAM([
199 deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
200 -12, 9, Z_DEFAULT_STRATEGY);])],
202 AC_SUBST([ZLIB_LIBS], [-lz])
203 AC_SUBST([ZLIB_CFLAGS], [])],
205 AC_ERROR([Could not build against zlib])])
208 PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0,
209 [AC_SUBST(LIBPROXY_PC, libproxy-1.0)
210 AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
213 dnl Libproxy *can* exist without a .pc file, and its header may be called
214 dnl libproxy.h in that case.
215 if (test "$libproxy_pkg" = "no"); then
216 AC_MSG_CHECKING([for libproxy])
219 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <libproxy.h>],
220 [(void)px_proxy_factory_new();])],
221 [AC_MSG_RESULT(yes (with libproxy.h))
222 AC_DEFINE([LIBPROXY_HDR], ["libproxy.h"])
223 AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
224 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <proxy.h>],
225 [(void)px_proxy_factory_new();])],
226 [AC_MSG_RESULT(yes (with proxy.h))
227 AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
228 AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
229 [AC_MSG_RESULT(no)])])
233 AC_CHECK_HEADER([if_tun.h],
234 [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"])],
235 [AC_CHECK_HEADER([linux/if_tun.h],
236 [AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])],
237 [AC_CHECK_HEADER([net/if_tun.h],
238 [AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])],
239 [AC_CHECK_HEADER([net/tun/if_tun.h],
240 [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])])
242 AC_CHECK_LIB(ssl, ENGINE_by_id,
243 AC_DEFINE(HAVE_ENGINE, [1], [OpenSSL has ENGINE support]),
244 AC_MSG_NOTICE([Building without OpenSSL TPM ENGINE support]),
247 AC_CHECK_LIB(ssl, dtls1_stop_timer,
248 AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function]),
251 AC_PATH_PROG(PYTHON, [python], [], $PATH:/bin:/usr/bin)
252 if (test -n "${ac_cv_path_PYTHON}"); then
253 AC_SUBST(PYTHON, ${ac_cv_path_PYTHON})
255 AC_MSG_NOTICE([Python not found; not building HTML pages])
257 AM_CONDITIONAL(BUILD_WWW, [test -n "${ac_cv_path_PYTHON}"])
259 AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/po/LINGUAS'])
260 RAWLINGUAS=`sed -e "/^#/d" -e "s/#.*//" "${srcdir}/po/LINGUAS"`
262 LINGUAS=`echo $RAWLINGUAS`
265 # We want version.c to depend on the files that would affect the
266 # output of version.sh. But we cannot assume that they'll exist,
267 # and we cannot use $(wildcard) in a non-GNU makefile. So we just
268 # depend on the files which happen to exist at configure time.
270 for a in .git/index .git/packed-refs .git/refs/tags .git/HEAD; do
272 GITVERSIONDEPS="$GITVERSIONDEPS $a"
275 AC_SUBST(GITVERSIONDEPS)
277 AC_OUTPUT(Makefile openconnect.pc po/Makefile www/Makefile \
278 www/styles/Makefile www/inc/Makefile www/images/Makefile)