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])
23 if test "$USE_NLS" = "yes"; then
24 AC_CHECK_DECL([dgettext(char *, char *)], [],
25 AC_ERROR([dgettext() is not declared in libintl.h. Try configuring with --disable-nls]),
26 [#include <libintl.h>])
28 if test "$USE_NLS" = "yes"; then
29 AC_SEARCH_LIBS(dgettext, intl,
30 [if test "$ac_cv_search_dgettext" != "none required"; then
31 LIBINTL="$ac_cv_search_dgettext"; fi],
32 AC_ERROR([dgettext() could not be found. Try configuring with --disable-nls]))
34 if test "$USE_NLS" = "absent"; then
35 AC_MSG_NOTICE([Native Language Support will not be supported in this build])
38 if test "$USE_NLS" = "yes"; then
40 AC_SUBST(GETTEXT_PACKAGE, [openconnect])
41 AC_DEFINE(ENABLE_NLS, 1)
43 AM_CONDITIONAL(USE_NLS, [test "$USE_NLS" = "yes"])
45 AS_COMPILER_FLAGS(CFLAGS,
48 -Wno-missing-field-initializers
51 -Werror=pointer-to-int-cast
52 -Wdeclaration-after-statement
53 -Werror-implicit-function-declaration
57 -Wmissing-declarations
58 -Wmissing-include-dirs
63 AC_ARG_WITH([openssl],
64 AS_HELP_STRING([--with-openssl],
65 [Location of OpenSSL build dir]),
66 [OPENSSL_CFLAGS="-I${with_openssl}/include"
67 OPENSSL_LIBS="${with_openssl}/libssl.a ${with_openssl}/libcrypto.a -ldl -lz"
68 AC_SUBST(OPENSSL_CFLAGS)
69 AC_SUBST(OPENSSL_LIBS)
72 [PKG_CHECK_MODULES(OPENSSL, openssl)
78 PKG_CHECK_MODULES(LIBXML2, libxml-2.0)
79 PKG_CHECK_MODULES(ZLIB, zlib)
81 PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0,
82 [AC_SUBST(LIBPROXY_PC, libproxy-1.0)
83 AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
86 dnl Libproxy *can* exist without a .pc file, and its header may be called
87 dnl libproxy.h in that case.
88 if (test "$libproxy_pkg" = "no"); then
89 AC_CHECK_HEADER([proxy.h],
90 [AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
91 AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
92 [AC_CHECK_HEADER([libproxy.h],
93 [AC_DEFINE([LIBPROXY_HDR], ["libproxy.h"])
94 AC_SUBST([LIBPROXY_LIBS], [-lproxy])])])
97 AC_CHECK_HEADER([if_tun.h],
98 [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"])],
99 [AC_CHECK_HEADER([linux/if_tun.h],
100 [AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])],
101 [AC_CHECK_HEADER([net/if_tun.h],
102 [AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])],
103 [AC_CHECK_HEADER([net/tun/if_tun.h],
104 [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])])
106 AC_CHECK_LIB(ssl, ENGINE_by_id,
107 AC_DEFINE(HAVE_ENGINE, [1], [OpenSSL has ENGINE support]),
108 AC_MSG_NOTICE([Building without OpenSSL TPM ENGINE support]),
111 AC_CHECK_LIB(ssl, dtls1_stop_timer,
112 AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function]),
115 AC_PATH_PROG(PYTHON, [python], [], $PATH:/bin:/usr/bin)
116 if (test -n "${ac_cv_path_PYTHON}"); then
117 AC_SUBST(PYTHON, ${ac_cv_path_PYTHON})
119 AC_MSG_NOTICE([Python not found; not building HTML pages])
121 AM_CONDITIONAL(BUILD_WWW, [test -n "${ac_cv_path_PYTHON}"])
123 AC_OUTPUT(Makefile openconnect.pc po/Makefile www/Makefile \
124 www/styles/Makefile www/inc/Makefile www/images/Makefile)