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

Russ Allbery rra@stanford.edu
Wed, 20 Apr 2011 22:42:45 -0700


Antoine Verheijen <antoine.verheijen@ualberta.ca> writes:

> 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.

Thanks for the report!  We should use the same technique that was used to
solve the same problem in the krb5 library check for consistency, I
think.  There, I probed for roken first, similar to your option 1, since
that fits the model used for all other optional dependency libraries.  I
can see the appeal in option two, but it requires fiddling with internal
Autoconf cache variables, and I don't trust that to continue working in
later versions since it's not part of the documented Autoconf interface.

I'm on vacation at the moment so can't easily work on this, but I'll add a
fix to rra-c-util (which is upstream for this file) as soon as I get back.

> --- 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])

This is the right basic idea for how I'd fix this, except libroken can be
added to rra_gssapi_extra (that's what it's for) and hence the probe
should be done before setting rra_gssapi_extra and can be simpler.  The
krb5 probe uses:

 AC_SEARCH_LIBS([rk_simple_execve], [roken])

before setting rra_gssapi_extra, and then the remaining changes aren't
required.

libroken thankfully doesn't ever depend on libcrypto or libcom_err, so one
doesn't have to be careful about preserving that part of the library
ordering.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>