gssapi lib added to the `openbsd part'
[mod_auth_kerb.cvs/.git] / configure.in
index b2e0c93..e09b685 100644 (file)
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 AC_REVISION($Revision$)
 AC_PREREQ(2.53)
-AC_INIT(mod_auth_kerb, 0.5-rc2, modauthkerb-developers@lists.sourceforge.net)
+AC_INIT(mod_auth_kerb, 0.5-rc3, modauthkerb-developers@lists.sourceforge.net)
 AC_CONFIG_SRCDIR([src/mod_auth_kerb.c])
 AC_CONFIG_HEADER([config.h])
 
@@ -21,7 +21,7 @@ AC_CHECK_HEADERS([limits.h netdb.h stddef.h stdlib.h string.h unistd.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 #AC_C_CONST
-#AC_TYPE_SIZE_T
+AC_TYPE_SIZE_T
 AC_STRUCT_TM
 
 # Checks for library functions.
@@ -44,14 +44,22 @@ AC_ARG_WITH(krb5,
 if test "x$with_krb5" != "xno" ; then
   AC_MSG_CHECKING([for Kerberos5 installation])
   if test "x$with_krb5" != "x"; then
-     if test ! -x "$with_krb5/bin/krb5-config"; then
-        AC_MSG_ERROR([failed to find krb5-config in $with_krb5/bin])
+     if test -x "$with_krb5/bin/krb5-config"; then
+        krb5_config_command="$with_krb5/bin/krb5-config"
+     else 
+        # quick fix for OpenBSD installations where krb5-config is missing.
+        # OpenBSD uses Heimdal, so add openbsd-specific configuration 
+        # libs for Heimdal 
+        KRB5_CPPFLAGS="-I$with_krb5/include"
+        KRB5_LDFLAGS="-L$with_krb5/lib -lgssapi -lkrb5 -lasn1 -ldes -lcrypt"
+        krb5_config_command=""
      fi
-     krb5_config_command="$with_krb5/bin/krb5-config"
   fi
 
-  KRB5_CPPFLAGS=`$krb5_config_command --cflags gssapi 2>/dev/null`
-  KRB5_LDFLAGS=`$krb5_config_command --libs gssapi 2>/dev/null`
+  if test -n "$krb5_config_command"; then
+     KRB5_CPPFLAGS=`$krb5_config_command --cflags gssapi 2>/dev/null`
+     KRB5_LDFLAGS=`$krb5_config_command --libs gssapi 2>/dev/null`
+  fi
   if test "x$KRB5_LDFLAGS" = "x"; then
      with_krb5=no
      AC_MSG_RESULT(no)
@@ -71,8 +79,13 @@ if test "x$with_krb5" != "xno" ; then
         # check if krb5_cc_gen_new() is implemented by the krb5 library
         AC_CHECK_FUNC(krb5_cc_gen_new, [AC_DEFINE(HAVE_KRB5_CC_GEN_NEW)])
 
-        # check if you're using Heimdal
-        # ...
+        # check for Heimdal
+        AC_MSG_CHECKING(whether we are using Heimdal)
+       AC_TRY_COMPILE([#include <krb5.h>],
+                      [ char *tmp = heimdal_version; ],
+                      [ AC_MSG_RESULT(yes)
+                        AC_DEFINE(HEIMDAL) ],
+                      [ AC_MSG_RESULT(no) ])
      fi
 
      CFLAGS=$ac_save_CFLAGS
@@ -114,6 +127,10 @@ if test "x$with_krb4" != "xno"; then
      if test "x$KRB4_LDFLAGS" = "x"; then
         KRB4_CPPFLAGS=`$krb5_config_command --cflags krb4 2>/dev/null`
         KRB4_LDFLAGS=`$krb5_config_command --libs krb4 2>/dev/null`
+        if test $? -ne 0; then
+           KRB4_CPPFLAGS=""
+           KRB4_LDFLAGS=""
+        fi
      fi
   fi
   if test "x$KRB4_LDFLAGS" = "x"; then