2 AC_INIT(openconnect, 3.13)
5 AM_MAINTAINER_MODE([enable])
6 AM_INIT_AUTOMAKE([foreign])
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
9 # Black magic: putting this before the conditional NLS bits below
10 # seems to avoid complaints about AMDEP being conditionally defined.
14 [ --disable-nls do not use Native Language Support],
15 [USE_NLS=$enableval], [USE_NLS=yes])
17 if test "$USE_NLS" = "yes"; then
18 AC_PATH_PROG(MSGFMT, msgfmt)
19 if test "$MSGFMT" = ""; then
20 AC_ERROR([msgfmt could not be found. Try configuring with --disable-nls])
24 if test "$USE_NLS" = "yes"; then
25 AC_MSG_CHECKING([for functional NLS support])
26 AC_LINK_IFELSE([AC_LANG_PROGRAM([
28 #include <libintl.h>],[
29 setlocale(LC_ALL, "");
30 (void)dgettext("openconnect", "foo");])],
34 AC_LINK_IFELSE([AC_LANG_PROGRAM([
36 #include <libintl.h>],[
37 setlocale(LC_ALL, "");
38 (void)dgettext("openconnect", "foo");])],
39 [AC_MSG_RESULT(yes (with -lintl))]
46 if test "$USE_NLS" = "yes"; then
48 AC_DEFINE(ENABLE_NLS, 1)
50 AM_CONDITIONAL(USE_NLS, [test "$USE_NLS" = "yes"])
52 AS_COMPILER_FLAGS(CFLAGS,
55 -Wno-missing-field-initializers
58 -Werror=pointer-to-int-cast
59 -Wdeclaration-after-statement
60 -Werror-implicit-function-declaration
64 -Wmissing-declarations
65 -Wmissing-include-dirs
70 AC_ARG_WITH([openssl],
71 AS_HELP_STRING([--with-openssl],
72 [Location of OpenSSL build dir]),
73 [OPENSSL_CFLAGS="-I${with_openssl}/include"
74 OPENSSL_LIBS="${with_openssl}/libssl.a ${with_openssl}/libcrypto.a -ldl -lz"
75 AC_SUBST(OPENSSL_CFLAGS)
76 AC_SUBST(OPENSSL_LIBS)
79 [PKG_CHECK_MODULES(OPENSSL, openssl)
83 PKG_CHECK_MODULES(LIBXML2, libxml-2.0)
85 PKG_CHECK_MODULES(ZLIB, zlib, [],
88 AC_MSG_CHECKING([for zlib without pkg-config])
89 AC_LINK_IFELSE([AC_LANG_PROGRAM([
92 deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
93 -12, 9, Z_DEFAULT_STRATEGY);])],
95 AC_SUBST([ZLIB_LIBS], [-lz])
96 AC_SUBST([ZLIB_CFLAGS], [])],
98 AC_ERROR([Could not build against zlib])])])
100 PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0,
101 [AC_SUBST(LIBPROXY_PC, libproxy-1.0)
102 AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
105 dnl Libproxy *can* exist without a .pc file, and its header may be called
106 dnl libproxy.h in that case.
107 if (test "$libproxy_pkg" = "no"); then
108 AC_CHECK_HEADER([proxy.h],
109 [AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
110 AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
111 [AC_CHECK_HEADER([libproxy.h],
112 [AC_DEFINE([LIBPROXY_HDR], ["libproxy.h"])
113 AC_SUBST([LIBPROXY_LIBS], [-lproxy])])])
116 AC_CHECK_HEADER([if_tun.h],
117 [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"])],
118 [AC_CHECK_HEADER([linux/if_tun.h],
119 [AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])],
120 [AC_CHECK_HEADER([net/if_tun.h],
121 [AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])],
122 [AC_CHECK_HEADER([net/tun/if_tun.h],
123 [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])])
125 AC_CHECK_LIB(ssl, ENGINE_by_id,
126 AC_DEFINE(HAVE_ENGINE, [1], [OpenSSL has ENGINE support]),
127 AC_MSG_NOTICE([Building without OpenSSL TPM ENGINE support]),
130 AC_CHECK_LIB(ssl, dtls1_stop_timer,
131 AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function]),
134 AC_PATH_PROG(PYTHON, [python], [], $PATH:/bin:/usr/bin)
135 if (test -n "${ac_cv_path_PYTHON}"); then
136 AC_SUBST(PYTHON, ${ac_cv_path_PYTHON})
138 AC_MSG_NOTICE([Python not found; not building HTML pages])
140 AM_CONDITIONAL(BUILD_WWW, [test -n "${ac_cv_path_PYTHON}"])
142 AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/po/LINGUAS'])
143 RAWLINGUAS=`sed -e "/^#/d" -e "s/#.*//" "${srcdir}/po/LINGUAS"`
145 LINGUAS=`echo $RAWLINGUAS`
148 AC_OUTPUT(Makefile openconnect.pc po/Makefile www/Makefile \
149 www/styles/Makefile www/inc/Makefile www/images/Makefile)