1 # Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision$)
4 AC_INIT(mod_auth_kerb, 0.5-rc3, 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
37 krb5_config_command=krb5-config
41 AC_HELP_STRING([--with-krb5=dir],[use krb5 in dir]),
42 [ with_krb5="$withval" ])
44 if test "x$with_krb5" != "xno" ; then
45 AC_MSG_CHECKING([for Kerberos5 installation])
46 if test "x$with_krb5" != "x"; then
47 if test ! -x "$with_krb5/bin/krb5-config"; then
48 AC_MSG_ERROR([failed to find krb5-config in $with_krb5/bin])
50 krb5_config_command="$with_krb5/bin/krb5-config"
53 KRB5_CPPFLAGS=`$krb5_config_command --cflags gssapi 2>/dev/null`
54 KRB5_LDFLAGS=`$krb5_config_command --libs gssapi 2>/dev/null`
55 if test "x$KRB5_LDFLAGS" = "x"; then
61 ac_save_CFLAGS=$CFLAGS
62 ac_save_LDFLAGS=$LDFLAGS
64 CFLAGS="$CFLAGS $KRB5_CPPFLAGS"
65 LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
66 LIBS="$LIBS $LDFLAGS $LIB_resolv"
68 AC_CHECK_LIB(krb5, krb5_init_context, [], [with_krb5=no])
70 if test "x$with_krb5" != "xno"; then
71 # check if krb5_cc_gen_new() is implemented by the krb5 library
72 AC_CHECK_FUNC(krb5_cc_gen_new, [AC_DEFINE(HAVE_KRB5_CC_GEN_NEW)])
75 AC_MSG_CHECKING(whether we are using Heimdal)
76 AC_TRY_COMPILE([#include <krb5.h>],
77 [ char *tmp = heimdal_version; ],
80 [ AC_MSG_RESULT(no) ])
83 CFLAGS=$ac_save_CFLAGS
84 LDFLAGS=$ac_save_LDFLAGS
90 AC_SUBST(KRB5_CPPFLAGS)
91 AC_SUBST(KRB5_LDFLAGS)
95 # Kerberos4 enviroment
101 AC_HELP_STRING([--with-krb4=dir], [use krb4 in dir]),
102 [ with_krb4="$withval" ])
104 if test "x$with_krb4" != "xno"; then
105 AC_MSG_CHECKING([for Kerberos4 installation])
106 if test "x$with_krb4" != "x"; then
107 if test -x "$with_krb4/bin/krb4-config"; then
108 KRB4_CPPFLAGS=`$with_krb4/bin/krb4-config --cflags krb4 2>/dev/null`
109 KRB4_LDFLAGS=`$with_krb4/bin/krb4-config --libs krb4 2>/dev/null`
110 elif test -x "$with_krb4/bin/krb5-config"; then
111 KRB4_CPPFLAGS=`$with_krb4/bin/krb5-config --cflags krb4 2>/dev/null`
112 KRB4_LDFLAGS=`$with_krb4/bin/krb5-config --libs krb4 2>/dev/null`
114 AC_MSG_ERROR([failed to find krb4-config or krb5-config in $with_krb4/bin])
117 KRB4_CPPFLAGS=`krb4-config --cflags krb4 2>/dev/null`
118 KRB4_LDFLAGS=`krb4-config --libs krb4 2>/dev/null`
119 if test "x$KRB4_LDFLAGS" = "x"; then
120 KRB4_CPPFLAGS=`$krb5_config_command --cflags krb4 2>/dev/null`
121 KRB4_LDFLAGS=`$krb5_config_command --libs krb4 2>/dev/null`
122 if test $? -ne 0; then
128 if test "x$KRB4_LDFLAGS" = "x"; then
134 ac_save_CFLAGS=$CFLAGS
135 ac_save_CPPFLAGS=$CPPFLAGS
136 ac_save_LDFLAGS=$LDFLAGS
138 CFLAGS="$CFLAGS $KRB4_CPPFLAGS"
139 CPPFLAGS="$CFLAGS $KRB4_CPPFLAGS"
140 LDFLAGS="$LDFLAGS $KRB4_LDFLAGS"
141 LIBS="$LIBS $LDFLAGS $LIB_resolv"
143 # if not found krb.h suppose it's in the kerberosIV subdirectory
144 AC_CHECK_HEADER(krb.h, , with_krb4=no)
145 if test "x$with_krb4" = "xno"; then
146 KRB4_CPPFLAGS="$KRB4_CPPFLAGS ${KRB4_CPPFLAGS}/kerberosIV"
147 # second run of AC_CHECK_HEADER for the same library returns the cached
148 # result created by previous run :-(
149 AC_CHECK_HEADER(kerberosIV/krb.h, with_krb4=yes,
155 if test "x$with_krb4" != "xno"; then
156 AC_CHECK_LIB(krb4, krb_get_pw_in_tkt, [], [with_krb4=no])
157 if test "x$with_krb4" = "xno"; then
158 AC_CHECK_LIB(krb, krb_get_pw_in_tkt, [with_krb4=yes],
165 CFLAGS=$ac_save_CFLAGS
166 CPPFLAGS=$ac_save_CPPFLAGS
167 LDFLAGS=$ac_save_LDFLAGS
173 AC_SUBST(KRB4_CPPFLAGS)
174 AC_SUBST(KRB4_LDFLAGS)
177 if test "x$with_krb5" = "xno" -a "x$with_krb4" = "xno"; then
178 AC_MSG_ERROR([No Kerberos enviroment found])
185 AC_HELP_STRING([--with-apache=dir],[use apache in dir]),
186 [ with_apache="$withval" ])
188 AC_MSG_CHECKING([for Apache installation])
192 if test "x$with_apache" != "x"; then
193 if test ! -x "$with_apache/bin/httpd" -o ! -x "$with_apache/bin/apxs"; then
194 AC_MSG_ERROR([failed to find apache files in $with_apache])
196 APXS="$with_apache/bin/apxs"
197 if test ! -x $APXS; then
198 APXS="$with_apache/sbin/apxs"
200 HTTPD="$with_apache/bin/httpd"
201 if test ! -x $HTTPD; then
202 HTTPD"$with_apache/sbin/httpd"
206 apache_v1_3=`$HTTPD -v | grep "^Server version: Apache/1.3."`
207 apache_v2_0=`$HTTPD -v | grep "^Server version: Apache/2.0."`
208 if test "x$apache_v1_3" = "x" -a "x$apache_v2_0" = "x"; then
209 AC_MSG_ERROR([cannot find valid apache installation on your system])
211 if test -n "$apache_v1_3"; then
218 AC_CONFIG_FILES([Makefile
219 spnegokrb5/Makefile])