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)
112 # Needs to happen after we default to static/shared libraries based on OpenSSL
115 PKG_CHECK_MODULES(LIBXML2, libxml-2.0)
117 PKG_CHECK_MODULES(ZLIB, zlib, [],
120 AC_MSG_CHECKING([for zlib without pkg-config])
121 AC_LINK_IFELSE([AC_LANG_PROGRAM([
124 deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
125 -12, 9, Z_DEFAULT_STRATEGY);])],
127 AC_SUBST([ZLIB_LIBS], [-lz])
128 AC_SUBST([ZLIB_CFLAGS], [])],
130 AC_ERROR([Could not build against zlib])])])
132 PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0,
133 [AC_SUBST(LIBPROXY_PC, libproxy-1.0)
134 AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
137 dnl Libproxy *can* exist without a .pc file, and its header may be called
138 dnl libproxy.h in that case.
139 if (test "$libproxy_pkg" = "no"); then
140 AC_MSG_CHECKING([for libproxy])
143 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <libproxy.h>],
144 [(void)px_proxy_factory_new();])],
145 [AC_MSG_RESULT(yes (with libproxy.h))
146 AC_DEFINE([LIBPROXY_HDR], ["libproxy.h"])
147 AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
148 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <proxy.h>],
149 [(void)px_proxy_factory_new();])],
150 [AC_MSG_RESULT(yes (with proxy.h))
151 AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
152 AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
153 [AC_MSG_RESULT(no)])])
157 AC_CHECK_HEADER([if_tun.h],
158 [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"])],
159 [AC_CHECK_HEADER([linux/if_tun.h],
160 [AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])],
161 [AC_CHECK_HEADER([net/if_tun.h],
162 [AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])],
163 [AC_CHECK_HEADER([net/tun/if_tun.h],
164 [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])])
166 AC_CHECK_LIB(ssl, ENGINE_by_id,
167 AC_DEFINE(HAVE_ENGINE, [1], [OpenSSL has ENGINE support]),
168 AC_MSG_NOTICE([Building without OpenSSL TPM ENGINE support]),
171 AC_CHECK_LIB(ssl, dtls1_stop_timer,
172 AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function]),
175 AC_PATH_PROG(PYTHON, [python], [], $PATH:/bin:/usr/bin)
176 if (test -n "${ac_cv_path_PYTHON}"); then
177 AC_SUBST(PYTHON, ${ac_cv_path_PYTHON})
179 AC_MSG_NOTICE([Python not found; not building HTML pages])
181 AM_CONDITIONAL(BUILD_WWW, [test -n "${ac_cv_path_PYTHON}"])
183 AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/po/LINGUAS'])
184 RAWLINGUAS=`sed -e "/^#/d" -e "s/#.*//" "${srcdir}/po/LINGUAS"`
186 LINGUAS=`echo $RAWLINGUAS`
189 # We want version.c to depend on the files that would affect the
190 # output of version.sh. But we cannot assume that they'll exist,
191 # and we cannot use $(wildcard) in a non-GNU makefile. So we just
192 # depend on the files which happen to exist at configure time.
194 for a in .git/index .git/packed-refs .git/refs/tags .git/HEAD; do
196 GITVERSIONDEPS="$GITVERSIONDEPS $a"
199 AC_SUBST(GITVERSIONDEPS)
201 AC_OUTPUT(Makefile openconnect.pc po/Makefile www/Makefile \
202 www/styles/Makefile www/inc/Makefile www/images/Makefile)