[OpenAFS-devel] Check For GSSAPI In Configure: Advice Sought

Antoine Verheijen antoine.verheijen@ualberta.ca
Wed, 20 Apr 2011 01:52:17 -0600


Hi, all. I'm looking for a quick bit of advice.

First, the problem: OpenBSD has built-in Heimdal support but, in their
infinite "wisdom", the developers elected to remove all trace of the
roken library which they deemed unnecessary. As a result, the configure
check for GSSAPI (via gssapi.m4) fails, even though -lgssapi exists,
because the check hard-codes -lroken in its library list.

I submitted a patch for this (via gerrit) but it was rightfully
considered inappropriate. I have two alternatives:

Option 1: Perform a simple check for the existence of -lroken and use
the result of that in the library list for the gssapi check. The
resultant patch would look like:

--- a/src/cf/gssapi.m4
+++ b/src/cf/gssapi.m4
@@ -77,8 +77,11 @@ AC_DEFUN([_RRA_LIB_GSSAPI_MANUAL],
  AC_SEARCH_LIBS([crypt], [crypt])
  rra_gssapi_extra="$LIBS"
  LIBS="$rra_gssapi_save_LIBS"
+ AC_CHECK_LIB([roken], [ct_memcmp],
+    [rra_gssapi_libroken=-lroken],
+    [rra_gssapi_libroken=])
  AC_CHECK_LIB([gssapi], [gss_import_name],
-    [GSSAPI_LIBS="-lgssapi -lkrb5 -lasn1 -lroken -lcrypto -lcom_err"
+    [GSSAPI_LIBS="-lgssapi -lkrb5 -lasn1 $rra_gssapi_libroken -lcrypto -lcom_err"
      GSSAPI_LIBS="$GSSAPI_LIBS $rra_gssapi_extra"],
     [AC_CHECK_LIB([krb5support], [krb5int_getspecific],
         [rra_gssapi_extra="-lkrb5support $rra_gssapi_extra"],
@@ -101,7 +104,7 @@ AC_DEFUN([_RRA_LIB_GSSAPI_MANUAL],
             [GSSAPI_LIBS="-lgss"],
             [AC_MSG_ERROR([cannot find usable GSS-API library])])],
         [$rra_gssapi_extra])],
-    [-lkrb5 -lasn1 -lroken -lcrypto -lcom_err $rra_gssapi_extra])
+    [-lkrb5 -lasn1 $rra_gssapi_libroken -lcrypto -lcom_err $rra_gssapi_extra])
  RRA_LIB_GSSAPI_RESTORE])
 
 dnl Sanity-check the results of krb5-config and be sure we can really link a

Option 2: Perform the GSSAPI check first with -lroken in the library
list and if that fails, try again without -lroken in the list. In this
case, the patch would look like:

--- a/src/cf/gssapi.m4
+++ b/src/cf/gssapi.m4
@@ -80,6 +80,11 @@ AC_DEFUN([_RRA_LIB_GSSAPI_MANUAL],
  AC_CHECK_LIB([gssapi], [gss_import_name],
     [GSSAPI_LIBS="-lgssapi -lkrb5 -lasn1 -lroken -lcrypto -lcom_err"
      GSSAPI_LIBS="$GSSAPI_LIBS $rra_gssapi_extra"],
+    [echo "checking for gss_import_name in -lgssapi without roken library"
+     AS_UNSET([ac_cv_lib_gssapi_gss_import_name])
+     AC_CHECK_LIB([gssapi], [gss_import_name],
+        [GSSAPI_LIBS="-lgssapi -lkrb5 -lasn1 -lcrypto -lcom_err"
+         GSSAPI_LIBS="$GSSAPI_LIBS $rra_gssapi_extra"],
     [AC_CHECK_LIB([krb5support], [krb5int_getspecific],
         [rra_gssapi_extra="-lkrb5support $rra_gssapi_extra"],
         [AC_CHECK_LIB([pthreads], [pthread_setspecific],
@@ -101,6 +106,7 @@ AC_DEFUN([_RRA_LIB_GSSAPI_MANUAL],
             [GSSAPI_LIBS="-lgss"],
             [AC_MSG_ERROR([cannot find usable GSS-API library])])],
         [$rra_gssapi_extra])],
+        [-lkrb5 -lasn1 -lcrypto -lcom_err $rra_gssapi_extra])],
     [-lkrb5 -lasn1 -lroken -lcrypto -lcom_err $rra_gssapi_extra])
  RRA_LIB_GSSAPI_RESTORE])
 

Both seem to address the major complaint about my earlier patch.
Before I submit another update, I thought I'd check to see if either
one is acceptable and if so, which would be preferable.

My personal preference is actually for option 2 since it doesn't
care really one way or the other about -lroken or what it might
contain but I'm not 100% sure if it's the way to go. What do others
think? Or should I simply submit one and see what happens? Also, if
I go with option 2, do I leave in the addition of the "echo ..." line
or not? I think it adds a little more info in the log about why the
seemingly same check is being repeated but I'm not married to it.

Thanks. Bye.

------------------------------------------------------------------------
Antoine Verheijen                   Email: antoine.verheijen@ualberta.ca
AICT (formerly CNS)                 Phone: (780) 492-9312
University of Alberta               Fax:   (780) 492-1729