1 # Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision$)
4 AC_INIT(mod_auth_kerb, 5.3, modauthkerb-developers@lists.sourceforge.net)
5 AC_CONFIG_SRCDIR([src/mod_auth_kerb.c])
6 AC_CONFIG_HEADER([config.h])
12 # Checks for libraries.
13 # FIXME: Replace `main' with a function in `-lresolv':
15 AC_CHECK_LIB([resolv], [main], [LIB_resolv=-lresolv])
18 # Checks for header files.
20 AC_CHECK_HEADERS([limits.h netdb.h stddef.h stdlib.h string.h unistd.h])
22 # Checks for typedefs, structures, and compiler characteristics.
27 # Checks for library functions.
30 #AC_CHECK_FUNCS([gethostbyname memset putenv strcasecmp strchr strdup strerror])
33 # kerberos5 enviroment
35 krb5_config_command=krb5-config
39 AC_HELP_STRING([--with-krb5=dir],[use krb5 in dir]),
40 [ with_krb5="$withval" ])
42 if test "x$with_krb5" = "xyes" ; then
46 if test "x$with_krb4" = "xyes" ; then
50 if test "x$with_krb5" != "xno" ; then
51 ac_save_CPPFLAGS="$CPPFLAGS"
52 ac_save_LDFLAGS="$LDFLAGS"
55 if test -n "$with_krb5"; then
56 if test -x "$with_krb5/bin/krb5-config"; then
57 krb5_config_command="$with_krb5/bin/krb5-config"
59 krb5_config_command=""
67 if test -z "$KRB5_CPPFLAGS"; then
69 if test -n "$krb5_config_command"; then
70 TMP_KRB5_CPPFLAGS=`$krb5_config_command --cflags gssapi 2>/dev/null`
72 if test -z "$TMP_KRB5_CPPFLAGS"; then
73 TMP_KRB5_CPPFLAGS="-I$with_krb5/include"
75 CPPFLAGS="$CPPFLAGS $TMP_KRB5_CPPFLAGS"
76 AC_CHECK_HEADERS(gssapi.h,
77 [ KRB5_CPPFLAGS="$TMP_KRB5_CPPFLAGS" ])
78 if test -z "$KRB5_CPPFLAGS"; then
79 AC_CHECK_HEADERS(gssapi/gssapi.h,
80 [ KRB5_CPPFLAGS="$TMP_KRB5_CPPFLAGS" ])
82 CPPFLAGS="$ac_save_CPPFLAGS"
89 if test -z "$KRB5_LDFLAGS" -a -n "$krb5_config_command"; then
90 TMP_KRB5_LDFLAGS=`$krb5_config_command --libs gssapi 2>/dev/null`
91 if test -n "$TMP_KRB5_LDFLAGS"; then
92 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
93 AC_CHECK_LIB(krb5, krb5_init_context,
94 [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
99 if test -z "$KRB5_LDFLAGS"; then
101 TMP_KRB5_LDFLAGS="-L$with_krb5/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
102 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
103 AC_CHECK_LIB(krb5, krb5_init_context, [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
107 if test -z "$KRB5_LDFLAGS"; then
109 TMP_KRB5_LDFLAGS="-L$with_krb5/lib -lgssapi -lkrb5 -lasn1 -lcrypto -lroken -lcrypt"
110 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
111 AC_CHECK_LIB(krb5, krb5_init_context, [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
115 if test -z "$KRB5_LDFLAGS"; then
116 #Try Heimdal on OpenBSD
117 TMP_KRB5_LDFLAGS="-L$with_krb5/lib -lgssapi -lkrb5 -lasn1 -ldes -lcrypto"
118 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
119 AC_CHECK_LIB(krb5, krb5_init_context, [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
123 if test -z "$KRB5_LDFLAGS"; then
130 [ AC_DEFINE(HAVE_KRB5_CC_NEW_UNIQUE) ])
134 AC_MSG_CHECKING(whether we are using Heimdal)
135 ac_save_CFLAGS="$CFLAGS"
136 CFLAGS="$KRB5_CPPFLAGS"
137 AC_TRY_COMPILE([#include <krb5.h>],
138 [ char *tmp = heimdal_version; ],
142 [ AC_MSG_RESULT(no) ])
143 CFLAGS="$ac_save_CFLAGS"
145 # If SPNEGO is supported by the gssapi libraries, we shouln't build our support.
146 # SPNEGO is supported as of Heimdal 0.7, and MIT 1.5.
147 gssapi_supports_spnego=""
148 AC_MSG_CHECKING(whether the GSSAPI libraries support SPNEGO)
150 ac_save_CFLAGS="$CFLAGS"
151 CFLAGS="$KRB5_CPPFLAGS"
152 ac_save_LDFLAGS="$LDFLAGS"
153 LDFLAGS=$KRB5_LDFLAGS
161 #include <gssapi/gssapi.h>
163 int main(int argc, char** argv)
165 OM_uint32 major_status, minor_status;
166 gss_OID_set mech_set;
167 gss_OID_desc spnego_oid_desc = {6, (void *)"\x2b\x06\x01\x05\x05\x02"};
170 major_status = gss_indicate_mechs(&minor_status, &mech_set);
171 if (GSS_ERROR(major_status))
175 for (i=0; i < mech_set->count && !SPNEGO; i++) {
176 gss_OID tmp_oid = &mech_set->elements[i];
177 if (tmp_oid->length == spnego_oid_desc.length &&
178 !memcmp(tmp_oid->elements, spnego_oid_desc.elements,
184 gss_release_oid_set(&minor_status, &mech_set);
188 [ if test $? -eq 0; then
190 AC_DEFINE(GSSAPI_SUPPORTS_SPNEGO)
191 gssapi_supports_spnego=yes
197 CFLAGS="$ac_save_CFLAGS"
198 LDFLAGS="$ac_save_LDFLAGS"
200 if test -z "$gssapi_supports_spnego"; then
201 if test -n "$have_heimdal"; then SPNEGO_SRCS="\
202 spnegokrb5/asn1_MechType.c \
203 spnegokrb5/asn1_MechTypeList.c \
204 spnegokrb5/asn1_ContextFlags.c \
205 spnegokrb5/asn1_NegTokenInit.c \
206 spnegokrb5/asn1_NegTokenTarg.c \
207 spnegokrb5/init_sec_context.c \
208 spnegokrb5/accept_sec_context.c \
209 spnegokrb5/encapsulate.c \
210 spnegokrb5/decapsulate.c \
211 spnegokrb5/external.c"
213 spnegokrb5/asn1_MechType.c \
214 spnegokrb5/asn1_MechTypeList.c \
215 spnegokrb5/asn1_ContextFlags.c \
216 spnegokrb5/asn1_NegTokenInit.c \
217 spnegokrb5/asn1_NegTokenTarg.c \
218 spnegokrb5/der_get.c \
219 spnegokrb5/der_put.c \
220 spnegokrb5/der_free.c \
221 spnegokrb5/der_length.c \
222 spnegokrb5/der_copy.c \
223 spnegokrb5/timegm.c \
224 spnegokrb5/init_sec_context.c \
225 spnegokrb5/accept_sec_context.c \
226 spnegokrb5/encapsulate.c \
227 spnegokrb5/decapsulate.c \
228 spnegokrb5/external.c"
233 AC_SUBST(KRB5_CPPFLAGS)
234 AC_SUBST(KRB5_LDFLAGS)
235 AC_SUBST(SPNEGO_SRCS)
238 # Kerberos4 enviroment
242 AC_HELP_STRING([--with-krb4=dir], [use krb4 in dir]),
243 [ with_krb4="$withval" ])
245 if test "x$with_krb4" != "xno"; then
246 AC_MSG_CHECKING([for Kerberos4 installation])
247 if test "x$with_krb4" != "x"; then
248 if test -x "$with_krb4/bin/krb4-config"; then
249 KRB4_CPPFLAGS=`$with_krb4/bin/krb4-config --cflags krb4 2>/dev/null`
250 KRB4_LDFLAGS=`$with_krb4/bin/krb4-config --libs krb4 2>/dev/null`
251 elif test -x "$with_krb4/bin/krb5-config"; then
252 KRB4_CPPFLAGS=`$with_krb4/bin/krb5-config --cflags krb4 2>/dev/null`
253 KRB4_LDFLAGS=`$with_krb4/bin/krb5-config --libs krb4 2>/dev/null`
255 AC_MSG_ERROR([failed to find krb4-config or krb5-config in $with_krb4/bin])
258 KRB4_CPPFLAGS=`krb4-config --cflags krb4 2>/dev/null`
259 KRB4_LDFLAGS=`krb4-config --libs krb4 2>/dev/null`
260 if test "x$KRB4_LDFLAGS" = "x" -a -n "$krb5_config_command"; then
261 KRB4_CPPFLAGS=`$krb5_config_command --cflags krb4 2>/dev/null`
262 KRB4_LDFLAGS=`$krb5_config_command --libs krb4 2>/dev/null`
263 if test $? -ne 0; then
269 if test "x$KRB4_LDFLAGS" = "x"; then
275 ac_save_CFLAGS=$CFLAGS
276 ac_save_CPPFLAGS=$CPPFLAGS
277 ac_save_LDFLAGS=$LDFLAGS
279 CFLAGS="$CFLAGS $KRB4_CPPFLAGS"
280 CPPFLAGS="$CFLAGS $KRB4_CPPFLAGS"
281 LDFLAGS="$LDFLAGS $KRB4_LDFLAGS"
282 LIBS="$LIBS $LDFLAGS $LIB_resolv"
284 # if not found krb.h suppose it's in the kerberosIV subdirectory
285 AC_CHECK_HEADER(krb.h, , with_krb4=no)
286 if test "x$with_krb4" = "xno"; then
287 KRB4_CPPFLAGS="$KRB4_CPPFLAGS ${KRB4_CPPFLAGS}/kerberosIV"
288 # second run of AC_CHECK_HEADER for the same library returns the cached
289 # result created by previous run :-(
290 AC_CHECK_HEADER(kerberosIV/krb.h, with_krb4=yes,
296 if test "x$with_krb4" != "xno"; then
297 AC_CHECK_LIB(krb4, krb_get_pw_in_tkt, [], [with_krb4=no])
298 if test "x$with_krb4" = "xno"; then
299 AC_CHECK_LIB(krb, krb_get_pw_in_tkt, [with_krb4=yes],
306 CFLAGS=$ac_save_CFLAGS
307 CPPFLAGS=$ac_save_CPPFLAGS
308 LDFLAGS=$ac_save_LDFLAGS
314 AC_SUBST(KRB4_CPPFLAGS)
315 AC_SUBST(KRB4_LDFLAGS)
318 if test "x$with_krb5" = "xno" -a "x$with_krb4" = "xno"; then
319 AC_MSG_ERROR([No Kerberos enviroment found])
326 AC_HELP_STRING([--with-apache=dir],[use apache in dir]),
327 [ with_apache="$withval" ])
329 AC_PATH_PROG([APXS], [apxs], [], [$with_apache/bin:$with_apache/sbin:$PATH])
330 if test -z "$APXS"; then
331 AC_PATH_PROG([APXS], [apxs2], [], [$with_apache/bin:$with_apache/sbin:$PATH])
332 if test -z "$APXS"; then
333 AC_MSG_ERROR([failed to find apache apxs executable])
338 AC_CONFIG_FILES([Makefile])