Attempt to build without NLS if intltool isn't available
[platform/upstream/openconnect.git] / configure.ac
1
2 AC_INIT(openconnect, 3.13)
3 PKG_PROG_PKG_CONFIG
4 AC_LANG_C
5 AM_MAINTAINER_MODE([enable])
6 AM_INIT_AUTOMAKE([foreign])
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
8
9 # Black magic: putting this before the conditional IT_PROG_LIBTOOL below
10 # seems to avoid complaints about AMDEP being conditionally defined.
11 AC_PROG_LIBTOOL
12
13 # Ick. IT_PROG_INTLTOOL isn't capable of doing this for itself? And hell,
14 # we don't even *need* intltool for a build-from-tarball on most systems,
15 # do we? But to avoid a whole chain of dependencies, we need it to be
16 # optional.
17 AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update])
18 AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge])
19 AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract])
20 if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then
21     AC_MSG_NOTICE([The intltool scripts were not found. Disabling NLS.])
22     USE_NLS=no
23 else
24     IT_PROG_INTLTOOL
25 fi
26
27 AC_SUBST(GETTEXT_PACKAGE, [openconnect])
28 AM_CONDITIONAL(USE_NLS, [test "$USE_NLS" = "yes"])
29 if (test "$USE_NLS" = "yes"); then
30    AC_DEFINE(ENABLE_NLS, 1)
31 fi
32
33 AS_COMPILER_FLAGS(CFLAGS,
34         "-Wall
35          -Wextra
36          -Wno-missing-field-initializers
37          -Wno-sign-compare
38          -Wno-unused-parameter
39          -Werror=pointer-to-int-cast
40          -Wdeclaration-after-statement
41          -Werror-implicit-function-declaration
42          -Wformat-nonliteral
43          -Wformat-security
44          -Winit-self
45          -Wmissing-declarations
46          -Wmissing-include-dirs
47          -Wmissing-noreturn
48          -Wnested-externs
49          -Wpointer-arith
50          -Wundef
51          -Wwrite-strings")
52
53 AC_ARG_WITH([openssl],
54             AS_HELP_STRING([--with-openssl],
55                            [Location of OpenSSL build dir]),
56             [OPENSSL_CFLAGS="-I${with_openssl}/include"
57              OPENSSL_LIBS="${with_openssl}/libssl.a ${with_openssl}/libcrypto.a -ldl -lz"
58              AC_SUBST(OPENSSL_CFLAGS)
59              AC_SUBST(OPENSSL_LIBS)
60              AC_ENABLE_STATIC
61              AC_DISABLE_SHARED],
62             [PKG_CHECK_MODULES(OPENSSL, openssl)
63              AC_ENABLE_SHARED
64              AC_DISABLE_STATIC])
65
66 AC_PROG_LIBTOOL
67
68 PKG_CHECK_MODULES(LIBXML2, libxml-2.0)
69 PKG_CHECK_MODULES(ZLIB, zlib)
70
71 PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0,
72                 [AC_SUBST(LIBPROXY_PC, libproxy-1.0)
73                  AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
74                  libproxy_pkg=yes],
75                  libproxy_pkg=no)
76 dnl Libproxy *can* exist without a .pc file, and its header may be called
77 dnl libproxy.h in that case.
78 if (test "$libproxy_pkg" = "no"); then
79    AC_CHECK_HEADER([proxy.h],
80         [AC_DEFINE([LIBPROXY_HDR], ["proxy.h"])
81          AC_SUBST([LIBPROXY_LIBS], [-lproxy])],
82     [AC_CHECK_HEADER([libproxy.h],
83         [AC_DEFINE([LIBPROXY_HDR], ["libproxy.h"])
84          AC_SUBST([LIBPROXY_LIBS], [-lproxy])])])
85 fi
86
87 AC_CHECK_HEADER([if_tun.h],
88     [AC_DEFINE([IF_TUN_HDR], ["if_tun.h"])],
89     [AC_CHECK_HEADER([linux/if_tun.h],
90         [AC_DEFINE([IF_TUN_HDR], ["linux/if_tun.h"])],
91         [AC_CHECK_HEADER([net/if_tun.h],
92             [AC_DEFINE([IF_TUN_HDR], ["net/if_tun.h"])],
93             [AC_CHECK_HEADER([net/tun/if_tun.h],
94                 [AC_DEFINE([IF_TUN_HDR], ["net/tun/if_tun.h"])])])])])
95
96 AC_CHECK_LIB(ssl, ENGINE_by_id,
97              AC_DEFINE(HAVE_ENGINE, [1], [OpenSSL has ENGINE support]),
98              AC_MSG_NOTICE([Building without OpenSSL TPM ENGINE support]),
99              ${OPENSSL_LIBS})
100
101 AC_CHECK_LIB(ssl, dtls1_stop_timer,
102                   AC_DEFINE(HAVE_DTLS1_STOP_TIMER, [1], [OpenSSL has dtls1_stop_timer() function]),
103                   ,,${OPENSSL_LIBS})
104
105 AC_PATH_PROG(PYTHON, [python], [], $PATH:/bin:/usr/bin)
106 if (test -n "${ac_cv_path_PYTHON}"); then
107    AC_SUBST(PYTHON, ${ac_cv_path_PYTHON})
108 else
109    AC_MSG_NOTICE([Python not found; not building HTML pages])
110 fi
111 AM_CONDITIONAL(BUILD_WWW, [test -n "${ac_cv_path_PYTHON}"])
112                    
113 AC_OUTPUT(Makefile openconnect.pc po/Makefile.in www/Makefile \
114           www/styles/Makefile www/inc/Makefile www/images/Makefile)