Heimdal portability fixes (except for reauth)
[mech_eap.git] / 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 /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(gssapi_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(gssapi_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(gssapi_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])], [], "$KRB5_LIBS")
41 fi
42 ])dnl
43
44 AC_DEFUN([AX_CHECK_EAP],
45 [AC_MSG_CHECKING(for EAP implementation)
46 EAP_DIR=
47 found_eap="no"
48 AC_ARG_WITH(eap,
49     AC_HELP_STRING([--with-eap],
50        [Use eap (in specified installation directory)]),
51     [check_eap_dir="$withval"],
52     [check_eap_dir=])
53 for dir in $check_eap_dir /usr /usr/local ; do
54    eapdir="$dir"
55    if test -f "$dir/src/eap_peer/eap.h"; then
56      found_eap="yes";
57      EAP_DIR="${eapdir}"
58      EAP_CFLAGS="-I$eapdir/src/common -I$eapdir/src -I$eapdir/src/utils";
59      break;
60    fi
61 done
62 AC_MSG_RESULT($found_eap)
63 if test x_$found_eap != x_yes; then
64    AC_MSG_ERROR([
65 ----------------------------------------------------------------------
66   Cannot find EAP libraries.
67
68   Please install wpa_supplicant or specify installation directory with
69   --with-eap=(dir).
70 ----------------------------------------------------------------------
71 ])
72 else
73         printf "EAP found in $eapdir\n";
74         EAP_CFLAGS="$EAP_CFLAGS \
75 -DEAP_TLS \
76 -DEAP_PEAP \
77 -DEAP_TTLS \
78 -DEAP_MD5 \
79 -DEAP_MSCHAPv2 \
80 -DEAP_GTC \
81 -DEAP_OTP \
82 -DEAP_LEAP \
83 -DEAP_PSK \
84 -DEAP_PAX \
85 -DEAP_SAKE \
86 -DEAP_GPSK \
87 -DEAP_GPSK_SHA256 \
88 -DEAP_SERVER_IDENTITY \
89 -DEAP_SERVER_TLS \
90 -DEAP_SERVER_PEAP \
91 -DEAP_SERVER_TTLS \
92 -DEAP_SERVER_MD5 \
93 -DEAP_SERVER_MSCHAPV2 \
94 -DEAP_SERVER_GTC \
95 -DEAP_SERVER_PSK \
96 -DEAP_SERVER_PAX \
97 -DEAP_SERVER_SAKE \
98 -DEAP_SERVER_GPSK \
99 -DEAP_SERVER_GPSK_SHA256 \
100 -DIEEE8021X_EAPOL";
101         EAP_LIBS="-leap -lutils -lcrypto -ltls";
102         EAP_LDFLAGS="-L$eapdir/eap_example -L$eapdir/src/utils -L$eapdir/src/crypto -L$eapdir/src/tls";
103         AC_SUBST(EAP_CFLAGS)
104         AC_SUBST(EAP_LDFLAGS)
105         AC_SUBST(EAP_LIBS)
106 fi
107 ])dnl
108
109 AC_DEFUN([AX_CHECK_SHIBSP],
110 [AC_MSG_CHECKING(for Shibboleth implementation)
111 SHIBSP_DIR=
112 found_shibsp="no"
113 AC_ARG_WITH(shibsp,
114     AC_HELP_STRING([--with-shibsp],
115        [Use shibspboleth (in specified installation directory)]),
116     [check_shibsp_dir="$withval"],
117     [check_shibsp_dir=])
118 for dir in $check_shibsp_dir /usr /usr/local ; do
119    shibspdir="$dir"
120    if test -f "$dir/include/shibsp/SPConfig.h"; then
121      found_shibsp="yes";
122      SHIBSP_DIR="${shibspdir}"
123      SHIBSP_CXXFLAGS="-I$shibspdir/include";
124      break;
125    fi
126 done
127 AC_MSG_RESULT($found_shibsp)
128 if test x_$found_shibsp != x_yes; then
129    AC_MSG_ERROR([
130 ----------------------------------------------------------------------
131   Cannot find Shibboleth/OpenSAML libraries.
132
133   Please install Shibboleth or specify installation directory with
134   --with-shibsp=(dir).
135 ----------------------------------------------------------------------
136 ])
137 else
138         printf "Shibboleth found in $shibspdir\n";
139         SHIBSP_LIBS="-lshibsp -llog4shib -lsaml -lxml-security-c -lxmltooling -lxerces-c";
140         SHIBSP_LDFLAGS="-L$shibspdir/lib";
141         AC_SUBST(SHIBSP_CXXFLAGS)
142         AC_SUBST(SHIBSP_LDFLAGS)
143         AC_SUBST(SHIBSP_LIBS)
144 fi
145 ])dnl
146
147 AC_DEFUN([AX_CHECK_SHIBRESOLVER],
148 [AC_MSG_CHECKING(for Shibboleth resolver implementation)
149 SHIBRESOLVER_DIR=
150 found_shibresolver="no"
151 AC_ARG_WITH(shibresolver,
152     AC_HELP_STRING([--with-shibresolver],
153        [Use Shibboleth resolver (in specified installation directory)]),
154     [check_shibresolver_dir="$withval"],
155     [check_shibresolver_dir=])
156 for dir in $check_shibresolver_dir /usr /usr/local ; do
157    shibresolverdir="$dir"
158    if test -f "$dir/include/shibresolver/resolver.h"; then
159      found_shibresolver="yes";
160      SHIBRESOLVER_DIR="${shibresolverdir}"
161      SHIBRESOLVER_CXXFLAGS="-I$shibresolverdir/include";
162      break;
163    fi
164 done
165 AC_MSG_RESULT($found_shibresolver)
166 if test x_$found_shibresolver != x_yes; then
167    AC_MSG_ERROR([
168 ----------------------------------------------------------------------
169   Cannot find Shibboleth resolver libraries.
170
171   Please install Shibboleth or specify installation directory with
172   --with-shibresolver=(dir).
173 ----------------------------------------------------------------------
174 ])
175 else
176         printf "Shibboleth resolver found in $shibresolverdir\n";
177         SHIBRESOLVER_LIBS="-lshibresolver";
178         SHIBRESOLVER_LDFLAGS="-L$shibresolverdir/lib";
179         AC_SUBST(SHIBRESOLVER_CXXFLAGS)
180         AC_SUBST(SHIBRESOLVER_LDFLAGS)
181         AC_SUBST(SHIBRESOLVER_LIBS)
182 fi
183 ])dnl
184
185 AC_DEFUN([AX_CHECK_RADSEC],
186 [AC_MSG_CHECKING(for radsec)
187 RADSEC_DIR=
188 found_radsec="no"
189 AC_ARG_WITH(radsec,
190     AC_HELP_STRING([--with-radsec],
191        [Use radsec (in specified installation directory)]),
192     [check_radsec_dir="$withval"],
193     [check_radsec_dir=])
194 for dir in $check_radsec_dir /usr /usr/local ; do
195    radsecdir="$dir"
196    if test -f "$dir/include/radsec/radsec.h"; then
197      found_radsec="yes";
198      RADSEC_DIR="${radsecdir}"
199      RADSEC_CFLAGS="-I$radsecdir/include";
200      break;
201    fi
202 done
203 AC_MSG_RESULT($found_radsec)
204 if test x_$found_radsec != x_yes; then
205    AC_MSG_ERROR([
206 ----------------------------------------------------------------------
207   Cannot find radsec libraries.
208
209   Please install libradsec or specify installation directory with
210   --with-radsec=(dir).
211 ----------------------------------------------------------------------
212 ])
213 else
214         printf "radsec found in $radsecdir\n";
215         RADSEC_LIBS="-lradsec";
216         RADSEC_LDFLAGS="-L$radsecdir/lib";
217         AC_SUBST(RADSEC_CFLAGS)
218         AC_SUBST(RADSEC_LDFLAGS)
219         AC_SUBST(RADSEC_LIBS)
220 fi
221 ])dnl