1 # Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision$)
4 AC_INIT(mod_auth_kerb, 0.5-rc6, 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" != "xno" ; then
43 ac_save_CPPFLAGS="$CPPFLAGS"
44 ac_save_LDFLAGS="$LDFLAGS"
47 if test -n "$with_krb5"; then
48 if test -x "$with_krb5/bin/krb5-config"; then
49 krb5_config_command="$with_krb5/bin/krb5-config"
51 krb5_config_command=""
59 if test -z "$KRB5_CPPFLAGS"; then
61 if test -n "$krb5_config_command"; then
62 TMP_KRB5_CPPFLAGS=`$krb5_config_command --cflags gssapi 2>/dev/null`
64 if test -z "$TMP_KRB5_CPPFLAGS"; then
65 TMP_KRB5_CPPFLAGS="-I$with_krb5/include"
67 CPPFLAGS="$CPPFLAGS $TMP_KRB5_CPPFLAGS"
68 AC_CHECK_HEADERS(gssapi.h,
69 [ KRB5_CPPFLAGS="$TMP_KRB5_CPPFLAGS" ])
70 if test -z "$KRB5_CPPFLAGS"; then
71 AC_CHECK_HEADERS(gssapi/gssapi.h,
72 [ KRB5_CPPFLAGS="$TMP_KRB5_CPPFLAGS" ])
74 CPPFLAGS="$ac_save_CPPFLAGS"
81 if test -z "$KRB5_LDFLAGS" -a -n "$krb5_config_command"; then
82 TMP_KRB5_LDFLAGS=`$krb5_config_command --libs gssapi 2>/dev/null`
83 if test -n "$TMP_KRB5_LDFLAGS"; then
84 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
85 AC_CHECK_LIB(krb5, krb5_init_context,
86 [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
91 if test -z "$KRB5_LDFLAGS"; then
93 TMP_KRB5_LDFLAGS="-L$with_krb5/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
94 LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
95 AC_CHECK_LIB(krb5, krb5_init_context, [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
99 if test -z "$KRB5_LDFLAGS"; then
101 TMP_KRB5_LDFLAGS="-L$with_krb5/lib -lgssapi -lkrb5 -lasn1 -lcrypto -lroken -lcrypt"
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
108 #Try Heimdal on OpenBSD
109 TMP_KRB5_LDFLAGS="-L$with_krb5/lib -lgssapi -lkrb5 -lasn1 -ldes -lcrypto"
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
123 AC_MSG_CHECKING(whether we are using Heimdal)
124 ac_save_CFLAGS="$CFLAGS"
125 CFLAGS="$KRB5_CPPFLAGS"
126 AC_TRY_COMPILE([#include <krb5.h>],
127 [ char *tmp = heimdal_version; ],
131 [ AC_MSG_RESULT(no) ])
132 CFLAGS="$ac_save_CFLAGS"
134 if test -n "$have_heimdal"; then
136 spnegokrb5/init_sec_context.c \
137 spnegokrb5/accept_sec_context.c \
138 spnegokrb5/encapsulate.c \
139 spnegokrb5/decapsulate.c \
140 spnegokrb5/external.c"
143 spnegokrb5/asn1_MechType.c \
144 spnegokrb5/asn1_MechTypeList.c \
145 spnegokrb5/asn1_ContextFlags.c \
146 spnegokrb5/asn1_NegTokenInit.c \
147 spnegokrb5/asn1_NegTokenTarg.c \
148 spnegokrb5/der_get.c \
149 spnegokrb5/der_put.c \
150 spnegokrb5/der_free.c \
151 spnegokrb5/der_length.c \
152 spnegokrb5/der_copy.c \
153 spnegokrb5/timegm.c \
154 spnegokrb5/init_sec_context.c \
155 spnegokrb5/accept_sec_context.c \
156 spnegokrb5/encapsulate.c \
157 spnegokrb5/decapsulate.c \
158 spnegokrb5/external.c"
162 AC_SUBST(KRB5_CPPFLAGS)
163 AC_SUBST(KRB5_LDFLAGS)
164 AC_SUBST(SPNEGO_SRCS)
167 # Kerberos4 enviroment
171 AC_HELP_STRING([--with-krb4=dir], [use krb4 in dir]),
172 [ with_krb4="$withval" ])
174 if test "x$with_krb4" != "xno"; then
175 AC_MSG_CHECKING([for Kerberos4 installation])
176 if test "x$with_krb4" != "x"; then
177 if test -x "$with_krb4/bin/krb4-config"; then
178 KRB4_CPPFLAGS=`$with_krb4/bin/krb4-config --cflags krb4 2>/dev/null`
179 KRB4_LDFLAGS=`$with_krb4/bin/krb4-config --libs krb4 2>/dev/null`
180 elif test -x "$with_krb4/bin/krb5-config"; then
181 KRB4_CPPFLAGS=`$with_krb4/bin/krb5-config --cflags krb4 2>/dev/null`
182 KRB4_LDFLAGS=`$with_krb4/bin/krb5-config --libs krb4 2>/dev/null`
184 AC_MSG_ERROR([failed to find krb4-config or krb5-config in $with_krb4/bin])
187 KRB4_CPPFLAGS=`krb4-config --cflags krb4 2>/dev/null`
188 KRB4_LDFLAGS=`krb4-config --libs krb4 2>/dev/null`
189 if test "x$KRB4_LDFLAGS" = "x" -a -n "$krb5_config_command"; then
190 KRB4_CPPFLAGS=`$krb5_config_command --cflags krb4 2>/dev/null`
191 KRB4_LDFLAGS=`$krb5_config_command --libs krb4 2>/dev/null`
192 if test $? -ne 0; then
198 if test "x$KRB4_LDFLAGS" = "x"; then
204 ac_save_CFLAGS=$CFLAGS
205 ac_save_CPPFLAGS=$CPPFLAGS
206 ac_save_LDFLAGS=$LDFLAGS
208 CFLAGS="$CFLAGS $KRB4_CPPFLAGS"
209 CPPFLAGS="$CFLAGS $KRB4_CPPFLAGS"
210 LDFLAGS="$LDFLAGS $KRB4_LDFLAGS"
211 LIBS="$LIBS $LDFLAGS $LIB_resolv"
213 # if not found krb.h suppose it's in the kerberosIV subdirectory
214 AC_CHECK_HEADER(krb.h, , with_krb4=no)
215 if test "x$with_krb4" = "xno"; then
216 KRB4_CPPFLAGS="$KRB4_CPPFLAGS ${KRB4_CPPFLAGS}/kerberosIV"
217 # second run of AC_CHECK_HEADER for the same library returns the cached
218 # result created by previous run :-(
219 AC_CHECK_HEADER(kerberosIV/krb.h, with_krb4=yes,
225 if test "x$with_krb4" != "xno"; then
226 AC_CHECK_LIB(krb4, krb_get_pw_in_tkt, [], [with_krb4=no])
227 if test "x$with_krb4" = "xno"; then
228 AC_CHECK_LIB(krb, krb_get_pw_in_tkt, [with_krb4=yes],
235 CFLAGS=$ac_save_CFLAGS
236 CPPFLAGS=$ac_save_CPPFLAGS
237 LDFLAGS=$ac_save_LDFLAGS
243 AC_SUBST(KRB4_CPPFLAGS)
244 AC_SUBST(KRB4_LDFLAGS)
247 if test "x$with_krb5" = "xno" -a "x$with_krb4" = "xno"; then
248 AC_MSG_ERROR([No Kerberos enviroment found])
255 AC_HELP_STRING([--with-apache=dir],[use apache in dir]),
256 [ with_apache="$withval" ])
258 AC_PATH_PROG([APXS], [apxs], [], [$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_CONFIG_FILES([Makefile])