Try also locating apxs2 binary if apxs isn't found
[mod_auth_kerb.git] / configure.in
index 009177a..ea8c2e7 100644 (file)
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 AC_REVISION($Revision$)
 AC_PREREQ(2.57)
-AC_INIT(mod_auth_kerb, 0.5-rc5, modauthkerb-developers@lists.sourceforge.net)
+AC_INIT(mod_auth_kerb, 5.0-rc7, modauthkerb-developers@lists.sourceforge.net)
 AC_CONFIG_SRCDIR([src/mod_auth_kerb.c])
 AC_CONFIG_HEADER([config.h])
 
@@ -81,7 +81,7 @@ if test "x$with_krb5" != "xno" ; then
   if test -z "$KRB5_LDFLAGS" -a -n "$krb5_config_command"; then
      TMP_KRB5_LDFLAGS=`$krb5_config_command --libs gssapi 2>/dev/null`
      if test -n "$TMP_KRB5_LDFLAGS"; then
-        LIBS="$LIBS $TMP_KRB5_LDFLAGS"
+        LIBS="$LIBS $TMP_KRB5_LDFLAGS $LIB_resolv"
         AC_CHECK_LIB(krb5, krb5_init_context,
                      [ KRB5_LDFLAGS="$TMP_KRB5_LDFLAGS" ])
         LIBS="$ac_save_LIBS"
@@ -119,33 +119,68 @@ if test "x$with_krb5" != "xno" ; then
      AC_DEFINE(KRB5)
 
      # check for Heimdal
+     have_heimdal=""
      AC_MSG_CHECKING(whether we are using Heimdal)
      ac_save_CFLAGS="$CFLAGS"
      CFLAGS="$KRB5_CPPFLAGS"
      AC_TRY_COMPILE([#include <krb5.h>],
                    [ char *tmp = heimdal_version; ],
                    [ AC_MSG_RESULT(yes)
-                     AC_DEFINE(HEIMDAL) ],
+                     AC_DEFINE(HEIMDAL)
+                     have_heimdal=yes ],
                    [ AC_MSG_RESULT(no) ])
      CFLAGS="$ac_save_CFLAGS"
 
-     SPNEGO_SRCS="\
-       spnegokrb5/asn1_MechType.c         \
-        spnegokrb5/asn1_MechTypeList.c     \
-        spnegokrb5/asn1_ContextFlags.c     \
-        spnegokrb5/asn1_NegTokenInit.c     \
-        spnegokrb5/asn1_NegTokenTarg.c     \
-        spnegokrb5/der_get.c               \
-        spnegokrb5/der_put.c               \
-        spnegokrb5/der_free.c              \
-        spnegokrb5/der_length.c            \
-        spnegokrb5/der_copy.c              \
-        spnegokrb5/timegm.c                \
-        spnegokrb5/init_sec_context.c      \
-        spnegokrb5/accept_sec_context.c    \
-        spnegokrb5/encapsulate.c           \
-        spnegokrb5/decapsulate.c           \
-        spnegokrb5/external.c"
+# If SPNEGO is supported by the gssapi libraries, we shouln't build our support.
+# SPNEGO is supported as of Heimdal 0.7, don't know about MIT.
+     gssapi_supports_spnego=""
+     AC_MSG_CHECKING(whether the GSSAPI libraries support SPNEGO)
+     # Invent some better test
+     if test "$have_heimdal" = yes; then
+       ac_save_CFLAGS="$CFLAGS"
+       CFLAGS="$KRB5_CPPFLAGS"
+       AC_TRY_COMPILE([#include <gssapi.h>],
+                      [ gss_OID oid = GSS_SPNEGO_MECHANISM; ],
+                      [ AC_MSG_RESULT(yes)
+                        AC_DEFINE(GSSAPI_SUPPORTS_SPNEGO)
+                        gssapi_supports_spnego=yes ],
+                      [ AC_MSG_RESULT(no) ])
+       CFLAGS="$ac_save_CFLAGS"
+     else
+       AC_MSG_RESULT(no)
+     fi
+
+     if test -z "$gssapi_supports_spnego"; then
+       if test -n "$have_heimdal"; then SPNEGO_SRCS="\
+               spnegokrb5/asn1_MechType.c         \
+               spnegokrb5/asn1_MechTypeList.c     \
+               spnegokrb5/asn1_ContextFlags.c     \
+               spnegokrb5/asn1_NegTokenInit.c     \
+               spnegokrb5/asn1_NegTokenTarg.c     \
+               spnegokrb5/init_sec_context.c      \
+               spnegokrb5/accept_sec_context.c    \
+               spnegokrb5/encapsulate.c           \
+               spnegokrb5/decapsulate.c           \
+               spnegokrb5/external.c"
+       else SPNEGO_SRCS="\
+               spnegokrb5/asn1_MechType.c         \
+               spnegokrb5/asn1_MechTypeList.c     \
+               spnegokrb5/asn1_ContextFlags.c     \
+               spnegokrb5/asn1_NegTokenInit.c     \
+               spnegokrb5/asn1_NegTokenTarg.c     \
+               spnegokrb5/der_get.c               \
+               spnegokrb5/der_put.c               \
+               spnegokrb5/der_free.c              \
+               spnegokrb5/der_length.c            \
+               spnegokrb5/der_copy.c              \
+               spnegokrb5/timegm.c                \
+               spnegokrb5/init_sec_context.c      \
+               spnegokrb5/accept_sec_context.c    \
+               spnegokrb5/encapsulate.c           \
+               spnegokrb5/decapsulate.c           \
+               spnegokrb5/external.c"
+       fi
+     fi
   fi
 fi
 AC_SUBST(KRB5_CPPFLAGS)
@@ -246,7 +281,10 @@ AC_ARG_WITH(apache,
 
 AC_PATH_PROG([APXS], [apxs], [], [$with_apache/bin:$with_apache/sbin:$PATH])
 if test -z "$APXS"; then
-   AC_MSG_ERROR([failed to find apache apxs executable])
+   AC_PATH_PROG([APXS], [apxs2], [], [$with_apache/bin:$with_apache/sbin:$PATH])
+   if test -z "$APXS"; then
+      AC_MSG_ERROR([failed to find apache apxs executable])
+   fi
 fi
 AC_SUBST(APXS)