test use = not == for string compare
[mech_eap.orig] / 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 AM_COND_IF(TARGET_WINDOWS,[
13    found_krb5="yes"
14    krb5dir=$check_krb5_dir
15    KRB5_CFLAGS=-I"$check_krb5_dir/include"
16    KRB5_LIBS="-L$check_krb5_dir/lib/ -lkrb5_32 -lgssapi32"
17    COMPILE_ET=
18 ],
19 [for dir in $check_krb5_dir $prefix /usr /usr/local ; do
20    krb5dir="$dir"
21    if test -x "$dir/bin/krb5-config"; then
22      found_krb5="yes";
23      KRB5_CFLAGS=`$dir/bin/krb5-config gssapi --cflags`;
24      KRB5_LIBS=`$dir/bin/krb5-config gssapi --libs`;
25      COMPILE_ET="$dir/bin/compile_et";
26      break;
27    fi
28 done])
29 AC_MSG_RESULT($found_krb5)
30 if test x_$found_krb5 != x_yes; then
31    AC_MSG_ERROR([
32 ----------------------------------------------------------------------
33   Cannot find GSS-API/Kerberos libraries.
34
35   Please install MIT or Heimdal or specify installation directory with
36   --with-krb5=(dir).
37 ----------------------------------------------------------------------
38 ])
39 else
40         printf "Kerberos found in $krb5dir\n";
41         AC_SUBST(KRB5_CFLAGS)
42         AC_SUBST(KRB5_LIBS)
43         AC_SUBST(COMPILE_ET)
44         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")
45         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")
46         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")
47         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")
48         AM_CONDITIONAL(HEIMDAL, test "x$heimdal" != "xno")
49 fi
50 ])dnl
51
52 AC_DEFUN([AX_CHECK_EAP],
53 [AC_MSG_CHECKING(for EAP implementation)
54 EAP_DIR=
55 found_eap="no"
56 AC_ARG_WITH(eap,
57     AC_HELP_STRING([--with-eap],
58        [Use eap (in specified installation directory)]),
59     [check_eap_dir="$withval"],
60     [check_eap_dir=])
61 for dir in $check_eap_dir $prefix /usr /usr/local ../libeap ; do
62    eapdir="$dir"
63    if test -f "$dir/src/eap_peer/eap.h"; then
64      found_eap="yes";
65      EAP_DIR="${eapdir}"
66      EAP_CFLAGS="-I$eapdir/src/common -I$eapdir/src -I$eapdir/src/utils";
67      break;
68    fi
69 done
70 AC_MSG_RESULT($found_eap)
71 if test x_$found_eap != x_yes; then
72    AC_MSG_ERROR([
73 ----------------------------------------------------------------------
74   Cannot find EAP libraries.
75
76   Please install wpa_supplicant or specify installation directory with
77   --with-eap=(dir).
78 ----------------------------------------------------------------------
79 ])
80 else
81         printf "EAP found in $eapdir\n";
82         EAP_CFLAGS="$EAP_CFLAGS \
83 -DEAP_TLS \
84 -DEAP_PEAP \
85 -DEAP_TTLS \
86 -DEAP_MD5 \
87 -DEAP_MSCHAPv2 \
88 -DEAP_GTC \
89 -DEAP_OTP \
90 -DEAP_LEAP \
91 -DEAP_PSK \
92 -DEAP_PAX \
93 -DEAP_SAKE \
94 -DEAP_GPSK \
95 -DEAP_GPSK_SHA256 \
96 -DEAP_SERVER_IDENTITY \
97 -DEAP_SERVER_TLS \
98 -DEAP_SERVER_PEAP \
99 -DEAP_SERVER_TTLS \
100 -DEAP_SERVER_MD5 \
101 -DEAP_SERVER_MSCHAPV2 \
102 -DEAP_SERVER_GTC \
103 -DEAP_SERVER_PSK \
104 -DEAP_SERVER_PAX \
105 -DEAP_SERVER_SAKE \
106 -DEAP_SERVER_GPSK \
107 -DEAP_SERVER_GPSK_SHA256 \
108 -DIEEE8021X_EAPOL";
109         EAP_LIBS="-leap -lutils -lcrypto -ltls";
110         EAP_LDFLAGS="-L$eapdir/eap_example -L$eapdir/src/utils -L$eapdir/src/crypto -L$eapdir/src/tls";
111         AC_SUBST(EAP_CFLAGS)
112         AC_SUBST(EAP_LDFLAGS)
113         AC_SUBST(EAP_LIBS)
114 fi
115 ])dnl
116
117 AC_DEFUN([AX_CHECK_SHIBSP],
118 [AC_MSG_CHECKING(for Shibboleth implementation)
119 SHIBSP_DIR=
120 found_shibsp="no"
121 AC_ARG_WITH(shibsp,
122     AC_HELP_STRING([--with-shibsp],
123        [Use shibspboleth (in specified installation directory)]),
124     [check_shibsp_dir="$withval"],
125     [check_shibsp_dir=])
126 for dir in $check_shibsp_dir $prefix /usr /usr/local ; do
127    shibspdir="$dir"
128    if test -f "$dir/include/shibsp/SPConfig.h"; then
129      found_shibsp="yes";
130      SHIBSP_DIR="${shibspdir}"
131      SHIBSP_CXXFLAGS="-I$shibspdir/include";
132      break;
133    fi
134 done
135 AC_MSG_RESULT($found_shibsp)
136 if test x_$found_shibsp != x_yes; then
137    AC_MSG_ERROR([
138 ----------------------------------------------------------------------
139   Cannot find Shibboleth/OpenSAML libraries.
140
141   Please install Shibboleth or specify installation directory with
142   --with-shibsp=(dir).
143 ----------------------------------------------------------------------
144 ])
145 else
146         printf "Shibboleth found in $shibspdir\n";
147         SHIBSP_LIBS="-lshibsp  -lsaml -lxml-security-c -lxmltooling -lxerces-c";
148         SHIBSP_LDFLAGS="-L$shibspdir/lib";
149         AC_SUBST(SHIBSP_CXXFLAGS)
150         AC_SUBST(SHIBSP_LDFLAGS)
151         AC_SUBST(SHIBSP_LIBS)
152 fi
153 ])dnl
154
155 AC_DEFUN([AX_CHECK_SHIBRESOLVER],
156 [AC_MSG_CHECKING(for Shibboleth resolver implementation)
157 SHIBRESOLVER_DIR=
158 found_shibresolver="no"
159 AC_ARG_WITH(shibresolver,
160     AC_HELP_STRING([--with-shibresolver],
161        [Use Shibboleth resolver (in specified installation directory)]),
162     [check_shibresolver_dir="$withval"],
163     [check_shibresolver_dir=])
164 for dir in $check_shibresolver_dir $prefix /usr /usr/local ; do
165    shibresolverdir="$dir"
166    if test -f "$dir/include/shibresolver/resolver.h"; then
167      found_shibresolver="yes";
168      SHIBRESOLVER_DIR="${shibresolverdir}"
169      SHIBRESOLVER_CXXFLAGS="-I$shibresolverdir/include";
170      break;
171    fi
172 done
173 AC_MSG_RESULT($found_shibresolver)
174 if test x_$found_shibresolver != x_yes; then
175    AC_MSG_ERROR([
176 ----------------------------------------------------------------------
177   Cannot find Shibboleth resolver libraries.
178
179   Please install Shibboleth or specify installation directory with
180   --with-shibresolver=(dir).
181 ----------------------------------------------------------------------
182 ])
183 else
184         printf "Shibboleth resolver found in $shibresolverdir\n";
185         SHIBRESOLVER_LIBS="-lshibresolver";
186         SHIBRESOLVER_LDFLAGS="-L$shibresolverdir/lib";
187         AC_SUBST(SHIBRESOLVER_CXXFLAGS)
188         AC_SUBST(SHIBRESOLVER_LDFLAGS)
189         AC_SUBST(SHIBRESOLVER_LIBS)
190 fi
191 ])dnl
192
193 AC_DEFUN([AX_CHECK_WINDOWS],
194 [AC_MSG_CHECKING(for windows)
195 target_windows="no"
196 AC_CHECK_HEADER(windows.h,[target_windows="yes"],[target_windows="no"])
197 AC_MSG_RESULT($target_windows)
198 AM_CONDITIONAL(TARGET_WINDOWS,test "x$target_windows" = "xyes")
199 ])dnl
200
201
202 AC_DEFUN([AX_CHECK_RADSEC],
203 [AC_MSG_CHECKING(for radsec)
204 RADSEC_DIR=
205 found_radsec="no"
206 AC_ARG_WITH(radsec,
207     AC_HELP_STRING([--with-radsec],
208        [Use radsec (in specified installation directory)]),
209     [check_radsec_dir="$withval"],
210     [check_radsec_dir=])
211 for dir in $check_radsec_dir $prefix /usr /usr/local ; do
212    radsecdir="$dir"
213    if test -f "$dir/include/radsec/radsec.h"; then
214      found_radsec="yes";
215      RADSEC_DIR="${radsecdir}"
216      RADSEC_CFLAGS="-I$radsecdir/include";
217      break;
218    fi
219 done
220 AC_MSG_RESULT($found_radsec)
221 if test x_$found_radsec != x_yes; then
222    AC_MSG_ERROR([
223 ----------------------------------------------------------------------
224   Cannot find radsec libraries.
225
226   Please install libradsec or specify installation directory with
227   --with-radsec=(dir).
228 ----------------------------------------------------------------------
229 ])
230 else
231         printf "radsec found in $radsecdir\n";
232         RADSEC_LIBS="-lradsec";
233         RADSEC_LDFLAGS="-L$radsecdir/lib";
234         AC_SUBST(RADSEC_CFLAGS)
235         AC_SUBST(RADSEC_LDFLAGS)
236         AC_SUBST(RADSEC_LIBS)
237 fi
238 ])dnl
239
240 AC_DEFUN([AX_CHECK_JANSSON],
241 [AC_MSG_CHECKING(for jansson)
242 JANSSON_DIR=
243 found_jansson="no"
244 AC_ARG_WITH(jansson,
245     AC_HELP_STRING([--with-jansson],
246        [Use jansson (in specified installation directory)]),
247     [check_jansson_dir="$withval"],
248     [check_jansson_dir=])
249 for dir in $check_jansson_dir $prefix /usr /usr/local ; do
250    janssondir="$dir"
251    if test -f "$dir/include/jansson.h"; then
252      found_jansson="yes";
253      JANSSON_DIR="${janssondir}"
254      JANSSON_CFLAGS="-I$janssondir/include";
255      break;
256    fi
257 done
258 AC_MSG_RESULT($found_jansson)
259 if test x_$found_jansson != x_yes; then
260    AC_MSG_ERROR([
261 ----------------------------------------------------------------------
262   Cannot find jansson libraries.
263
264   Please install libjansson or specify installation directory with
265   --with-jansson=(dir).
266 ----------------------------------------------------------------------
267 ])
268 else
269         printf "jansson found in $janssondir\n";
270         JANSSON_LIBS="-ljansson";
271         JANSSON_LDFLAGS="-L$janssondir/lib";
272         AC_SUBST(JANSSON_CFLAGS)
273         AC_SUBST(JANSSON_LDFLAGS)
274         AC_SUBST(JANSSON_LIBS)
275 fi
276 ])dnl