2 AC_INIT(openconnect, 3.16)
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'])])
19 [ --disable-nls do not use Native Language Support],
20 [USE_NLS=$enableval], [USE_NLS=yes])
22 if test "$USE_NLS" = "yes"; then
23 AC_PATH_PROG(MSGFMT, msgfmt)
24 if test "$MSGFMT" = ""; then
25 AC_ERROR([msgfmt could not be found. Try configuring with --disable-nls])
29 if test "$USE_NLS" = "yes"; then
30 AC_MSG_CHECKING([for functional NLS support])
31 AC_LINK_IFELSE([AC_LANG_PROGRAM([
33 #include <libintl.h>],[
34 setlocale(LC_ALL, "");
35 bindtextdomain("openconnect", "/tmp");
36 (void)dgettext("openconnect", "foo");])],
40 AC_LINK_IFELSE([AC_LANG_PROGRAM([
42 #include <libintl.h>],[
43 setlocale(LC_ALL, "");
44 bindtextdomain("openconnect", "/tmp");
45 (void)dgettext("openconnect", "foo");])],
46 [AC_MSG_RESULT(yes (with -lintl))]
53 if test "$USE_NLS" = "yes"; then
55 AC_DEFINE(ENABLE_NLS, 1)
57 AM_CONDITIONAL(USE_NLS, [test "$USE_NLS" = "yes"])
61 AC_MSG_NOTICE([Applying feature macros for GNU build])
62 AC_DEFINE(_POSIX_C_SOURCE, 200112L)
64 AC_DEFINE(_BSD_SOURCE)
66 AC_DEFINE(_GNU_SOURCE)
69 AC_MSG_NOTICE([Applying feature macros for NetBSD build])
70 AC_DEFINE(_POSIX_C_SOURCE, 200112L)
71 AC_DEFINE(_NETBSD_SOURCE)
74 # On FreeBSD the only way to get vsyslog() visible is to define
75 # *nothing*, which makes absolutely everything visible.
76 # On Darwin enabling _POSIX_C_SOURCE breaks <sys/mount.h> because
77 # u_long and other types don't get defined. OpenBSD is similar.
81 AS_COMPILER_FLAGS(CFLAGS,
84 -Wno-missing-field-initializers
87 -Werror=pointer-to-int-cast
88 -Wdeclaration-after-statement
89 -Werror-implicit-function-declaration
93 -Wmissing-declarations
94 -Wmissing-include-dirs
99 AC_ARG_WITH([openssl],
100 AS_HELP_STRING([--with-openssl],
101 [Location of OpenSSL build dir]),
102 [OPENSSL_CFLAGS="-I${with_openssl}/include"
103 OPENSSL_LIBS="${with_openssl}/libssl.a ${with_openssl}/libcrypto.a -ldl -lz"
104 AC_SUBST(OPENSSL_CFLAGS)
105 AC_SUBST(OPENSSL_LIBS)
108 [PKG_CHECK_MODULES(OPENSSL, openssl, [],
110 LIBS="$LIBS -lssl -lcrypto"
111 AC_MSG_CHECKING([for OpenSSL without pkg-config])
112 AC_LINK_IFELSE([AC_LANG_PROGRAM([
113 #include <openssl/ssl.h>
114 #include <openssl/err.h>],[
117 SSL_load_error_strings();
118 OpenSSL_add_all_algorithms();])],
120 AC_SUBST([OPENSSL_LIBS], ["-lssl -lcrypto"])
121 AC_SUBST([OPENSSL_CFLAGS], [])],
123 AC_ERROR([Could not build against OpenSSL])])
128 # Needs to happen after we default to static/shared libraries based on OpenSSL
131 PKG_CHECK_MODULES(LIBXML2, libxml-2.0)
133 PKG_CHECK_MODULES(ZLIB, zlib, [],
136 AC_MSG_CHECKING([for zlib without pkg-config])
137 AC_LINK_IFELSE([AC_LANG_PROGRAM([
140 deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
141 -12, 9, Z_DEFAULT_STRATEGY);])],
143 AC_SUBST([ZLIB_LIBS], [-lz])
144 AC_SUBST([ZLIB_CFLAGS], [])],
146 AC_ERROR([Could not build against zlib])])
149 PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0,
150 [AC_SUBST(LIBPROXY_PC, libproxy-1.0)
151 AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
154 dnl Libproxy *can* exist without a .pc file, and its header may be called
155 dnl libproxy.h in that case.
156 if (test "$libproxy_pkg" = "no"); then
157 AC_MSG_CHECKING([for libproxy])
160 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <libproxy.h>],
161 [(void)px_proxy_factory_new();])],
162 [AC_MSG_RESULT(yes (with libproxy.h))
163 AC_DEFINE([LIBPROXY_HDR], ["libproxy.h"])
164 AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
165 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <proxy.h>],
166 [(void)px_proxy_factory_new();])],
167 [AC_MSG_RESULT(yes (with proxy.h))
168 AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
169 AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
170 [AC_MSG_RESULT(no)])])
174 AC_CHECK_HEADER([if_tun.h],
175 [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"])],
176 [AC_CHECK_HEADER([linux/if_tun.h],
177 [AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])],
178 [AC_CHECK_HEADER([net/if_tun.h],
179 [AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])],
180 [AC_CHECK_HEADER([net/tun/if_tun.h],
181 [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])])
183 AC_CHECK_LIB(ssl, ENGINE_by_id,
184 AC_DEFINE(HAVE_ENGINE, [1], [OpenSSL has ENGINE support]),
185 AC_MSG_NOTICE([Building without OpenSSL TPM ENGINE support]),
188 AC_CHECK_LIB(ssl, dtls1_stop_timer,
189 AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function]),
192 AC_PATH_PROG(PYTHON, [python], [], $PATH:/bin:/usr/bin)
193 if (test -n "${ac_cv_path_PYTHON}"); then
194 AC_SUBST(PYTHON, ${ac_cv_path_PYTHON})
196 AC_MSG_NOTICE([Python not found; not building HTML pages])
198 AM_CONDITIONAL(BUILD_WWW, [test -n "${ac_cv_path_PYTHON}"])
200 AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/po/LINGUAS'])
201 RAWLINGUAS=`sed -e "/^#/d" -e "s/#.*//" "${srcdir}/po/LINGUAS"`
203 LINGUAS=`echo $RAWLINGUAS`
206 # We want version.c to depend on the files that would affect the
207 # output of version.sh. But we cannot assume that they'll exist,
208 # and we cannot use $(wildcard) in a non-GNU makefile. So we just
209 # depend on the files which happen to exist at configure time.
211 for a in .git/index .git/packed-refs .git/refs/tags .git/HEAD; do
213 GITVERSIONDEPS="$GITVERSIONDEPS $a"
216 AC_SUBST(GITVERSIONDEPS)
218 AC_OUTPUT(Makefile openconnect.pc po/Makefile www/Makefile \
219 www/styles/Makefile www/inc/Makefile www/images/Makefile)