Merge branch 'master' of ssh://lhoward@moonshot.suchdamage.org:822/srv/git/moonshot
[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 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      break;
19    fi
20 done
21 AC_MSG_RESULT($found_krb5)
22 if test x_$found_krb5 != x_yes; then
23    AC_MSG_ERROR([
24 ----------------------------------------------------------------------
25   Cannot find GSS-API/Kerberos libraries.
26
27   Please install MIT or Heimdal or specify installation directory with
28   --with-krb5=(dir).
29 ----------------------------------------------------------------------
30 ])
31 else
32         printf "Kerberos found in $krb5dir\n";
33         AC_SUBST(KRB5_CFLAGS)
34         AC_SUBST(KRB5_LIBS)
35         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_LDFLAGS")
36 fi
37 ])dnl
38
39 AC_DEFUN([AX_CHECK_EAP],
40 [AC_MSG_CHECKING(for EAP implementation)
41 EAP_DIR=
42 found_eap="no"
43 AC_ARG_WITH(eap,
44     AC_HELP_STRING([--with-eap],
45        [Use eap (in specified installation directory)]),
46     [check_eap_dir="$withval"],
47     [check_eap_dir=])
48 for dir in $check_eap_dir /usr /usr/local ; do
49    eapdir="$dir"
50    if test -f "$dir/src/eap_peer/eap.h"; then
51      found_eap="yes";
52      EAP_DIR="${eapdir}"
53      EAP_CFLAGS="-I$eapdir/src/common -I$eapdir/src -I$eapdir/src/utils";
54      break;
55    fi
56 done
57 AC_MSG_RESULT($found_eap)
58 if test x_$found_eap != x_yes; then
59    AC_MSG_ERROR([
60 ----------------------------------------------------------------------
61   Cannot find EAP libraries.
62
63   Please install wpa_supplicant or specify installation directory with
64   --with-eap=(dir).
65 ----------------------------------------------------------------------
66 ])
67 else
68         printf "EAP found in $eapdir\n";
69         EAP_CFLAGS="$EAP_CFLAGS \
70 -DEAP_TLS \
71 -DEAP_PEAP \
72 -DEAP_TTLS \
73 -DEAP_MD5 \
74 -DEAP_MSCHAPv2 \
75 -DEAP_GTC \
76 -DEAP_OTP \
77 -DEAP_LEAP \
78 -DEAP_PSK \
79 -DEAP_PAX \
80 -DEAP_SAKE \
81 -DEAP_GPSK \
82 -DEAP_GPSK_SHA256 \
83 -DEAP_SERVER_IDENTITY \
84 -DEAP_SERVER_TLS \
85 -DEAP_SERVER_PEAP \
86 -DEAP_SERVER_TTLS \
87 -DEAP_SERVER_MD5 \
88 -DEAP_SERVER_MSCHAPV2 \
89 -DEAP_SERVER_GTC \
90 -DEAP_SERVER_PSK \
91 -DEAP_SERVER_PAX \
92 -DEAP_SERVER_SAKE \
93 -DEAP_SERVER_GPSK \
94 -DEAP_SERVER_GPSK_SHA256 \
95 -DIEEE8021X_EAPOL";
96         EAP_LIBS="-leap -lutils -lcrypto -ltls";
97         EAP_LDFLAGS="-L$eapdir/eap_example -L$eapdir/src/utils -L$eapdir/src/crypto -L$eapdir/src/tls";
98         AC_SUBST(EAP_CFLAGS)
99         AC_SUBST(EAP_LDFLAGS)
100         AC_SUBST(EAP_LIBS)
101 fi
102 ])dnl
103
104 AC_DEFUN([AX_CHECK_SHIBSP],
105 [AC_MSG_CHECKING(for Shibboleth implementation)
106 SHIBSP_DIR=
107 found_shibsp="no"
108 AC_ARG_WITH(shibsp,
109     AC_HELP_STRING([--with-shibsp],
110        [Use shibspboleth (in specified installation directory)]),
111     [check_shibsp_dir="$withval"],
112     [check_shibsp_dir=])
113 for dir in $check_shibsp_dir /usr /usr/local ; do
114    shibspdir="$dir"
115    if test -f "$dir/include/shibsp/SPConfig.h"; then
116      found_shibsp="yes";
117      SHIBSP_DIR="${shibspdir}"
118      SHIBSP_CXXFLAGS="-I$shibspdir/include";
119      break;
120    fi
121 done
122 AC_MSG_RESULT($found_shibsp)
123 if test x_$found_shibsp != x_yes; then
124    AC_MSG_ERROR([
125 ----------------------------------------------------------------------
126   Cannot find Shibboleth/OpenSAML libraries.
127
128   Please install Shibboleth or specify installation directory with
129   --with-shibsp=(dir).
130 ----------------------------------------------------------------------
131 ])
132 else
133         printf "Shibboleth found in $shibspdir\n";
134         SHIBSP_LIBS="-lshibsp -llog4shib -lsaml -lxml-security-c -lxmltooling -lxerces-c";
135         SHIBSP_LDFLAGS="-L$shibspdir/lib";
136         AC_SUBST(SHIBSP_CXXFLAGS)
137         AC_SUBST(SHIBSP_LDFLAGS)
138         AC_SUBST(SHIBSP_LIBS)
139 fi
140 ])dnl
141
142 AC_DEFUN([AX_CHECK_SHIBRESOLVER],
143 [AC_MSG_CHECKING(for Shibboleth resolver implementation)
144 SHIBRESOLVER_DIR=
145 found_shibresolver="no"
146 AC_ARG_WITH(shibresolver,
147     AC_HELP_STRING([--with-shibresolver],
148        [Use Shibboleth resolver (in specified installation directory)]),
149     [check_shibresolver_dir="$withval"],
150     [check_shibresolver_dir=])
151 for dir in $check_shibresolver_dir /usr /usr/local ; do
152    shibresolverdir="$dir"
153    if test -f "$dir/include/shibresolver/resolver.h"; then
154      found_shibresolver="yes";
155      SHIBRESOLVER_DIR="${shibresolverdir}"
156      SHIBRESOLVER_CXXFLAGS="-I$shibresolverdir/include";
157      break;
158    fi
159 done
160 AC_MSG_RESULT($found_shibresolver)
161 if test x_$found_shibresolver != x_yes; then
162    AC_MSG_ERROR([
163 ----------------------------------------------------------------------
164   Cannot find Shibboleth resolver libraries.
165
166   Please install Shibboleth or specify installation directory with
167   --with-shibresolver=(dir).
168 ----------------------------------------------------------------------
169 ])
170 else
171         printf "Shibboleth resolver found in $shibresolverdir\n";
172         SHIBRESOLVER_LIBS="-lshibresolver";
173         SHIBRESOLVER_LDFLAGS="-L$shibresolverdir/lib";
174         AC_SUBST(SHIBRESOLVER_CXXFLAGS)
175         AC_SUBST(SHIBRESOLVER_LDFLAGS)
176         AC_SUBST(SHIBRESOLVER_LIBS)
177 fi
178 ])dnl