c1c2224c9e620cdcbac70f10e8eafbdca7e05e79
[moonshot.git] / moonshot / acinclude.m4
1 dnl Based on the one from the Boinc project by Reinhard
2
3 AC_DEFUN([AX_CHECK_KRB5],
4 [AC_MSG_CHECKING(for GSS-API and Kerberos implementation)
5 KRB5_DIR=
6 found_krb5="no"
7 AC_ARG_WITH(krb5,
8     AC_HELP_STRING([--with-krb5],
9        [Use krb5 (in specified installation directory)]),
10     [check_krb5_dir="$withval"],
11     [check_krb5_dir=])
12 for dir in $check_krb5_dir $prefix /usr /usr/local ; do
13    krb5dir="$dir"
14    if test -x "$dir/bin/krb5-config"; then
15      found_krb5="yes";
16      KRB5_CFLAGS=`$dir/bin/krb5-config gssapi --cflags`;
17      KRB5_LIBS=`$dir/bin/krb5-config gssapi --libs`;
18      COMPILE_ET="$dir/bin/compile_et";
19      break;
20    fi
21 done
22 AC_MSG_RESULT($found_krb5)
23 if test x_$found_krb5 != x_yes; then
24    AC_MSG_ERROR([
25 ----------------------------------------------------------------------
26   Cannot find GSS-API/Kerberos libraries.
27
28   Please install MIT or Heimdal or specify installation directory with
29   --with-krb5=(dir).
30 ----------------------------------------------------------------------
31 ])
32 else
33         printf "Kerberos found in $krb5dir\n";
34         AC_SUBST(KRB5_CFLAGS)
35         AC_SUBST(KRB5_LIBS)
36         AC_SUBST(COMPILE_ET)
37         AC_CHECK_LIB(krb5, GSS_C_NT_COMPOSITE_EXPORT, [AC_DEFINE_UNQUOTED([HAVE_GSS_C_NT_COMPOSITE_EXPORT], 1, [Define if GSS-API library supports recent naming extensions draft])], [], "$KRB5_LIBS")
38         AC_CHECK_LIB(krb5, gss_inquire_attrs_for_mech, [AC_DEFINE_UNQUOTED([HAVE_GSS_INQUIRE_ATTRS_FOR_MECH], 1, [Define if GSS-API library supports RFC 5587])], [], "$KRB5_LIBS")
39         AC_CHECK_LIB(krb5, gss_krb5_import_cred, [AC_DEFINE_UNQUOTED([HAVE_GSS_KRB5_IMPORT_CRED], 1, [Define if GSS-API library supports gss_krb5_import_cred])], [], "$KRB5_LIBS")
40         AC_CHECK_LIB(krb5, heimdal_version, [AC_DEFINE_UNQUOTED([HAVE_HEIMDAL_VERSION], 1, [Define if building against Heimdal Kerberos implementation]), heimdal=yes], [heimdal=no], "$KRB5_LIBS")
41         AM_CONDITIONAL(HEIMDAL, test "x$heimdal" != "xno")
42 fi
43 ])dnl
44
45 AC_DEFUN([AX_CHECK_EAP],
46 [AC_MSG_CHECKING(for EAP implementation)
47 EAP_DIR=
48 found_eap="no"
49 AC_ARG_WITH(eap,
50     AC_HELP_STRING([--with-eap],
51        [Use eap (in specified installation directory)]),
52     [check_eap_dir="$withval"],
53     [check_eap_dir=])
54 for dir in $check_eap_dir $prefix /usr /usr/local ../libeap ; do
55    eapdir="$dir"
56    if test -f "$dir/src/eap_peer/eap.h"; then
57      found_eap="yes";
58      EAP_DIR="${eapdir}"
59      EAP_CFLAGS="-I$eapdir/src/common -I$eapdir/src -I$eapdir/src/utils";
60      break;
61    fi
62 done
63 AC_MSG_RESULT($found_eap)
64 if test x_$found_eap != x_yes; then
65    AC_MSG_ERROR([
66 ----------------------------------------------------------------------
67   Cannot find EAP libraries.
68
69   Please install wpa_supplicant or specify installation directory with
70   --with-eap=(dir).
71 ----------------------------------------------------------------------
72 ])
73 else
74         printf "EAP found in $eapdir\n";
75         EAP_CFLAGS="$EAP_CFLAGS \
76 -DEAP_TLS \
77 -DEAP_PEAP \
78 -DEAP_TTLS \
79 -DEAP_MD5 \
80 -DEAP_MSCHAPv2 \
81 -DEAP_GTC \
82 -DEAP_OTP \
83 -DEAP_LEAP \
84 -DEAP_PSK \
85 -DEAP_PAX \
86 -DEAP_SAKE \
87 -DEAP_GPSK \
88 -DEAP_GPSK_SHA256 \
89 -DEAP_SERVER_IDENTITY \
90 -DEAP_SERVER_TLS \
91 -DEAP_SERVER_PEAP \
92 -DEAP_SERVER_TTLS \
93 -DEAP_SERVER_MD5 \
94 -DEAP_SERVER_MSCHAPV2 \
95 -DEAP_SERVER_GTC \
96 -DEAP_SERVER_PSK \
97 -DEAP_SERVER_PAX \
98 -DEAP_SERVER_SAKE \
99 -DEAP_SERVER_GPSK \
100 -DEAP_SERVER_GPSK_SHA256 \
101 -DIEEE8021X_EAPOL";
102         EAP_LIBS="-leap -lutils -lcrypto -ltls";
103         EAP_LDFLAGS="-L$eapdir/eap_example -L$eapdir/src/utils -L$eapdir/src/crypto -L$eapdir/src/tls";
104         AC_SUBST(EAP_CFLAGS)
105         AC_SUBST(EAP_LDFLAGS)
106         AC_SUBST(EAP_LIBS)
107 fi
108 ])dnl
109
110 AC_DEFUN([AX_CHECK_SHIBSP],
111 [AC_MSG_CHECKING(for Shibboleth implementation)
112 SHIBSP_DIR=
113 found_shibsp="no"
114 AC_ARG_WITH(shibsp,
115     AC_HELP_STRING([--with-shibsp],
116        [Use shibspboleth (in specified installation directory)]),
117     [check_shibsp_dir="$withval"],
118     [check_shibsp_dir=])
119 for dir in $check_shibsp_dir $prefix /usr /usr/local ; do
120    shibspdir="$dir"
121    if test -f "$dir/include/shibsp/SPConfig.h"; then
122      found_shibsp="yes";
123      SHIBSP_DIR="${shibspdir}"
124      SHIBSP_CXXFLAGS="-I$shibspdir/include";
125      break;
126    fi
127 done
128 AC_MSG_RESULT($found_shibsp)
129 if test x_$found_shibsp != x_yes; then
130    AC_MSG_ERROR([
131 ----------------------------------------------------------------------
132   Cannot find Shibboleth libraries.
133
134   Please install Shibboleth or specify installation directory with
135   --with-shibsp=(dir).
136 ----------------------------------------------------------------------
137 ])
138 else
139         printf "Shibboleth found in $shibspdir\n";
140         SHIBSP_LIBS="-lshibsp -lsaml -lxml-security-c -lxmltooling -lxerces-c";
141         SHIBSP_LDFLAGS="-L$shibspdir/lib";
142         AC_SUBST(SHIBSP_CXXFLAGS)
143         AC_SUBST(SHIBSP_LDFLAGS)
144         AC_SUBST(SHIBSP_LIBS)
145         AC_DEFINE_UNQUOTED([HAVE_SHIBSP], 1, [Define is Shibboleth SP is available])
146 fi
147 ])dnl
148
149 AC_DEFUN([AX_CHECK_SHIBRESOLVER],
150 [AC_MSG_CHECKING(for Shibboleth resolver implementation)
151 SHIBRESOLVER_DIR=
152 found_shibresolver="no"
153 AC_ARG_WITH(shibresolver,
154     AC_HELP_STRING([--with-shibresolver],
155        [Use Shibboleth resolver (in specified installation directory)]),
156     [check_shibresolver_dir="$withval"],
157     [check_shibresolver_dir=])
158 if test x_$check_shibresolver_dir != x_no; then
159 for dir in $check_shibresolver_dir $prefix /usr /usr/local ; do
160    shibresolverdir="$dir"
161    if test -f "$dir/include/shibresolver/resolver.h"; then
162      found_shibresolver="yes";
163      SHIBRESOLVER_DIR="${shibresolverdir}"
164      SHIBRESOLVER_CXXFLAGS="-I$shibresolverdir/include";
165      break;
166    fi
167 done
168 fi
169 AC_MSG_RESULT($found_shibresolver)
170 if test x_$check_shibresolver_dir != x_no; then
171 if test x_$found_shibresolver != x_yes; then
172    AC_MSG_WARN([
173 ----------------------------------------------------------------------
174   Cannot find Shibboleth resolver libraries, building without
175   Shibboleth support.
176
177   Please install Shibboleth or specify installation directory with
178   --with-shibresolver=(dir).
179 ----------------------------------------------------------------------
180 ])
181 else
182         printf "Shibboleth resolver found in $shibresolverdir\n";
183         SHIBRESOLVER_LIBS="-lshibresolver";
184         SHIBRESOLVER_LDFLAGS="-L$shibresolverdir/lib";
185         AC_SUBST(SHIBRESOLVER_CXXFLAGS)
186         AC_SUBST(SHIBRESOLVER_LDFLAGS)
187         AC_SUBST(SHIBRESOLVER_LIBS)
188         AC_DEFINE_UNQUOTED([HAVE_SHIBRESOLVER], 1, [Define is Shibboleth resolver is available])
189 fi
190 fi
191 AM_CONDITIONAL(SHIBRESOLVER, test "x_$check_shibresolver_dir" != "x_no")
192 ])dnl
193
194 AC_DEFUN([AX_CHECK_OPENSAML],
195 [AC_MSG_CHECKING(for OpenSAML implementation)
196 OPENSAML_DIR=
197 found_opensaml="no"
198 AC_ARG_WITH(opensaml,
199     AC_HELP_STRING([--with-opensaml],
200        [Use OpenSAML (in specified installation directory)]),
201     [check_opensaml_dir="$withval"],
202     [check_opensaml_dir=])
203 if test x_$check_opensaml_dir != x_no; then
204 for dir in $check_opensaml_dir $prefix /usr /usr/local ; do
205    opensamldir="$dir"
206    if test -f "$dir/include/saml/Assertion.h"; then
207      found_opensaml="yes";
208      OPENSAML_DIR="${opensamldir}"
209      OPENSAML_CXXFLAGS="-I$opensamldir/include";
210      break;
211    fi
212 done
213 fi
214 AC_MSG_RESULT($found_opensaml)
215 if test x_$check_opensaml_dir != x_no; then
216 if test x_$found_opensaml != x_yes; then
217    AC_MSG_WARN([
218 ----------------------------------------------------------------------
219   Cannot find OpenSAML libraries, building without OpenSAML support.
220
221   Please install OpenSAML or specify installation directory with
222   --with-opensaml=(dir).
223 ----------------------------------------------------------------------
224 ])
225 else
226         printf "OpenSAML found in $opensamldir\n";
227         OPENSAML_LIBS="-lsaml -lxml-security-c -lxmltooling -lxerces-c";
228         OPENSAML_LDFLAGS="-L$opensamldir/lib";
229         AC_SUBST(OPENSAML_CXXFLAGS)
230         AC_SUBST(OPENSAML_LDFLAGS)
231         AC_SUBST(OPENSAML_LIBS)
232         AC_DEFINE_UNQUOTED([HAVE_OPENSAML], 1, [Define is OpenSAML is available])
233 fi
234 fi
235 AM_CONDITIONAL(OPENSAML, test "x_$check_opensaml_dir" != "x_no")
236 ])dnl
237
238 AC_DEFUN([AX_CHECK_RADSEC],
239 [AC_MSG_CHECKING(for radsec)
240 RADSEC_DIR=
241 found_radsec="no"
242 AC_ARG_WITH(radsec,
243     AC_HELP_STRING([--with-radsec],
244        [Use radsec (in specified installation directory)]),
245     [check_radsec_dir="$withval"],
246     [check_radsec_dir=])
247 for dir in $check_radsec_dir $prefix /usr /usr/local ; do
248    radsecdir="$dir"
249    if test -f "$dir/include/radsec/radsec.h"; then
250      found_radsec="yes";
251      RADSEC_DIR="${radsecdir}"
252      RADSEC_CFLAGS="-I$radsecdir/include";
253      break;
254    fi
255 done
256 AC_MSG_RESULT($found_radsec)
257 if test x_$found_radsec != x_yes; then
258    AC_MSG_ERROR([
259 ----------------------------------------------------------------------
260   Cannot find radsec libraries.
261
262   Please install libradsec or specify installation directory with
263   --with-radsec=(dir).
264 ----------------------------------------------------------------------
265 ])
266 else
267         printf "radsec found in $radsecdir\n";
268         RADSEC_LIBS="-lradsec";
269         RADSEC_LDFLAGS="-L$radsecdir/lib";
270         AC_SUBST(RADSEC_CFLAGS)
271         AC_SUBST(RADSEC_LDFLAGS)
272         AC_SUBST(RADSEC_LIBS)
273 fi
274 ])dnl
275
276 AC_DEFUN([AX_CHECK_JANSSON],
277 [AC_MSG_CHECKING(for jansson)
278 JANSSON_DIR=
279 found_jansson="no"
280 AC_ARG_WITH(jansson,
281     AC_HELP_STRING([--with-jansson],
282        [Use jansson (in specified installation directory)]),
283     [check_jansson_dir="$withval"],
284     [check_jansson_dir=])
285 for dir in $check_jansson_dir $prefix /usr /usr/local ; do
286    janssondir="$dir"
287    if test -f "$dir/include/jansson.h"; then
288      found_jansson="yes";
289      JANSSON_DIR="${janssondir}"
290      JANSSON_CFLAGS="-I$janssondir/include";
291      break;
292    fi
293 done
294 AC_MSG_RESULT($found_jansson)
295 if test x_$found_jansson != x_yes; then
296    AC_MSG_ERROR([
297 ----------------------------------------------------------------------
298   Cannot find jansson libraries.
299
300   Please install libjansson or specify installation directory with
301   --with-jansson=(dir).
302 ----------------------------------------------------------------------
303 ])
304 else
305         printf "jansson found in $janssondir\n";
306         JANSSON_LIBS="-ljansson";
307         JANSSON_LDFLAGS="-L$janssondir/lib";
308         AC_SUBST(JANSSON_CFLAGS)
309         AC_SUBST(JANSSON_LDFLAGS)
310         AC_SUBST(JANSSON_LIBS)
311 fi
312 ])dnl
313
314 AC_DEFUN([AX_CHECK_LIBMOONSHOT],
315 [AC_MSG_CHECKING(for Moonshot identity selector implementation)
316 LIBMOONSHOT_DIR=
317 found_libmoonshot="no"
318 AC_ARG_WITH(libmoonshot,
319     AC_HELP_STRING([--with-libmoonshot],
320        [Use libmoonshot (in specified installation directory)]),
321     [check_libmoonshot_dir="$withval"],
322     [check_libmoonshot_dir=])
323 for dir in $check_libmoonshot_dir $prefix /usr /usr/local ../../moonshot-ui/libmoonshot ; do
324    libmoonshotdir="$dir"
325    if test -f "$dir/include/libmoonshot.h"; then
326      found_libmoonshot="yes";
327      LIBMOONSHOT_DIR="${libmoonshotdir}"
328      LIBMOONSHOT_CFLAGS="-I$libmoonshotdir/include";
329      break;
330    fi
331 done
332 AC_MSG_RESULT($found_libmoonshot)
333 if test x_$found_libmoonshot != x_yes; then
334    AC_MSG_ERROR([
335 ----------------------------------------------------------------------
336   Cannot find Moonshot identity selector libraries.
337
338   Please install wpa_supplicant or specify installation directory with
339   --with-libmoonshot=(dir).
340 ----------------------------------------------------------------------
341 ])
342 else
343         printf "libmoonshot found in $libmoonshotdir\n";
344         LIBMOONSHOT_LIBS="-lmoonshot";
345         LIBMOONSHOT_LDFLAGS="-L$libmoonshot/lib";
346         AC_SUBST(LIBMOONSHOT_CFLAGS)
347         AC_SUBST(LIBMOONSHOT_LDFLAGS)
348         AC_SUBST(LIBMOONSHOT_LIBS)
349         AC_CHECK_LIB(moonshot, moonshot_get_identity, [AC_DEFINE_UNQUOTED([HAVE_MOONSHOT_GET_IDENTITY], 1, [Define if Moonshot identity selector is available])], [], "$LIBMOONSHOT_LIBS")
350 fi
351 ])dnl
352