1 # Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision$)
4 AC_INIT(mod_auth_gssapi, 1.0, 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
38 AC_HELP_STRING([--with-krb5=dir],[use krb5 in dir]),
39 [ with_krb5="$withval" ])
41 if test "x$with_krb5" = "xyes" ; then
45 if test "x$with_krb5" != "xno" ; then
47 AC_PATH_PROG(krb5_config_command,krb5-config,:,[$PATH:/usr/kerberos/bin:/usr/krb5/bin])
48 if test $krb5_config_command = : ; then
49 AC_MSG_ERROR(krb5-config not found)
52 ac_save_CPPFLAGS="$CPPFLAGS"
53 ac_save_LDFLAGS="$LDFLAGS"
56 if test -n "$with_krb5"; then
57 if test -x "$with_krb5/bin/krb5-config"; then
58 krb5_config_command="$with_krb5/bin/krb5-config"
60 krb5_config_command=""
68 if test -z "$KRB5_CPPFLAGS"; then
70 if test -n "$krb5_config_command"; then
71 TMP_KRB5_CPPFLAGS=`$krb5_config_command --cflags gssapi 2>/dev/null`
73 if test -z "$TMP_KRB5_CPPFLAGS" -a -n "with_krb5"; then
74 TMP_KRB5_CPPFLAGS="-I$with_krb5/include"
76 CPPFLAGS="$CPPFLAGS $TMP_KRB5_CPPFLAGS"
77 AC_CHECK_HEADERS(gssapi.h,
78 [ KRB5_CPPFLAGS="$TMP_KRB5_CPPFLAGS" ])
79 if test -z "$KRB5_CPPFLAGS"; then
80 AC_CHECK_HEADERS(gssapi/gssapi.h,
81 [ KRB5_CPPFLAGS="$TMP_KRB5_CPPFLAGS" ])
83 CPPFLAGS="$ac_save_CPPFLAGS"
90 if test -z "$KRB5_LDFLAGS" -a -n "$krb5_config_command"; then
91 TMP_KRB5_LDFLAGS=`$krb5_config_command --libs gssapi 2>/dev/null`
92 if test -n "$TMP_KRB5_LDFLAGS"; then
93 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
94 AC_CHECK_LIB(krb5, krb5_init_context,
95 [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
99 if test "x$with_krb5"="x"; then
104 if test -z "$KRB5_LDFLAGS"; then
106 TMP_KRB5_LDFLAGS="$tmp_lf_inc$with_krb5/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
107 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
108 AC_CHECK_LIB(krb5, krb5_init_context, [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
112 if test -z "$KRB5_LDFLAGS"; then
114 TMP_KRB5_LDFLAGS="$tmp_lf_inc$with_krb5/lib -lgssapi -lkrb5 -lasn1 -lcrypto -lroken -lcrypt"
115 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
116 AC_CHECK_LIB(krb5, krb5_init_context, [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
120 if test -z "$KRB5_LDFLAGS"; then
121 #Try Heimdal on OpenBSD
122 TMP_KRB5_LDFLAGS="$tmp_lf_inc$with_krb5/lib -lgssapi -lkrb5 -lasn1 -ldes -lcrypto"
123 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
124 AC_CHECK_LIB(krb5, krb5_init_context, [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
128 if test -z "$KRB5_LDFLAGS"; then
131 AC_DEFINE(KRB5,,[Kerberos 5 enabled.])
134 [ AC_DEFINE(HAVE_KRB5_CC_NEW_UNIQUE,1,[Have krb5_cc_new_unique]) ])
138 AC_MSG_CHECKING(whether we are using Heimdal)
139 ac_save_CFLAGS="$CFLAGS"
140 CFLAGS="$KRB5_CPPFLAGS"
141 AC_TRY_COMPILE([#include <krb5.h>],
142 [ char *tmp = heimdal_version; ],
144 AC_DEFINE(HEIMDAL,,[Using the Heimdal implementation of Kerberos])
146 [ AC_MSG_RESULT(no) ])
147 CFLAGS="$ac_save_CFLAGS"
149 # If SPNEGO is supported by the gssapi libraries, we shouln't build our support.
150 # SPNEGO is supported as of Heimdal 0.7, and MIT 1.5.
151 gssapi_supports_spnego=""
152 AC_MSG_CHECKING(whether the GSSAPI libraries support SPNEGO)
154 ac_save_CFLAGS="$CFLAGS"
155 CFLAGS="$KRB5_CPPFLAGS"
156 ac_save_LDFLAGS="$LDFLAGS"
157 if test -n "$with_krb5"; then
158 LDFLAGS="$KRB5_LDFLAGS -Wl,-rpath -Wl,$with_krb5/lib"
160 LDFLAGS="$KRB5_LDFLAGS"
168 #include <gssapi/gssapi.h>
170 int main(int argc, char** argv)
172 OM_uint32 major_status, minor_status;
173 gss_OID_set mech_set;
174 gss_OID_desc spnego_oid_desc = {6, (void *)"\x2b\x06\x01\x05\x05\x02"};
177 major_status = gss_indicate_mechs(&minor_status, &mech_set);
178 if (GSS_ERROR(major_status))
182 for (i=0; i < mech_set->count && !SPNEGO; i++) {
183 gss_OID tmp_oid = &mech_set->elements[i];
184 if (tmp_oid->length == spnego_oid_desc.length &&
185 !memcmp(tmp_oid->elements, spnego_oid_desc.elements,
191 gss_release_oid_set(&minor_status, &mech_set);
195 [ if test $? -eq 0; then
197 AC_DEFINE(GSSAPI_SUPPORTS_SPNEGO,,[GSS-API library supports SPNEGO])
198 gssapi_supports_spnego=yes
204 CFLAGS="$ac_save_CFLAGS"
205 LDFLAGS="$ac_save_LDFLAGS"
207 if test -z "$gssapi_supports_spnego"; then
208 if test -n "$have_heimdal"; then SPNEGO_SRCS="\
209 spnegokrb5/asn1_MechType.c \
210 spnegokrb5/asn1_MechTypeList.c \
211 spnegokrb5/asn1_ContextFlags.c \
212 spnegokrb5/asn1_NegTokenInit.c \
213 spnegokrb5/asn1_NegTokenTarg.c \
214 spnegokrb5/init_sec_context.c \
215 spnegokrb5/accept_sec_context.c \
216 spnegokrb5/encapsulate.c \
217 spnegokrb5/decapsulate.c \
218 spnegokrb5/external.c"
220 spnegokrb5/asn1_MechType.c \
221 spnegokrb5/asn1_MechTypeList.c \
222 spnegokrb5/asn1_ContextFlags.c \
223 spnegokrb5/asn1_NegTokenInit.c \
224 spnegokrb5/asn1_NegTokenTarg.c \
225 spnegokrb5/der_get.c \
226 spnegokrb5/der_put.c \
227 spnegokrb5/der_free.c \
228 spnegokrb5/der_length.c \
229 spnegokrb5/der_copy.c \
230 spnegokrb5/timegm.c \
231 spnegokrb5/init_sec_context.c \
232 spnegokrb5/accept_sec_context.c \
233 spnegokrb5/encapsulate.c \
234 spnegokrb5/decapsulate.c \
235 spnegokrb5/external.c"
240 AC_SUBST(KRB5_CPPFLAGS)
241 AC_SUBST(KRB5_LDFLAGS)
242 AC_SUBST(SPNEGO_SRCS)
245 if test "x$with_krb5" = "xno" -a "x$with_krb4" = "xno"; then
246 AC_MSG_ERROR([No Kerberos enviroment found])
253 AC_HELP_STRING([--with-apache=dir],[use apache in dir]),
254 [ with_apache="$withval" ])
256 AC_PATH_PROG([APXS], [apxs], [], [$with_apache/bin:$with_apache/sbin:$PATH])
257 if test -z "$APXS"; then
258 AC_PATH_PROG([APXS], [apxs2], [], [$with_apache/bin:$with_apache/sbin:$PATH])
259 if test -z "$APXS"; then
260 AC_MSG_ERROR([failed to find apache apxs executable])
264 AC_SUBST(PACKAGE_VERSION)
265 AC_SUBST(PACKAGE_TARNAME)
268 AC_CONFIG_FILES([Makefile])