summaryrefslogtreecommitdiff
path: root/m4/gssapi.m4
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2010-02-09 15:21:12 -0800
committerRuss Allbery <rra@stanford.edu>2010-02-09 15:21:12 -0800
commit838a73223d19e64a6556047791006f068b779307 (patch)
tree11daa49dbf0abf7ee167860ec6bae0dfa71633a3 /m4/gssapi.m4
parent3b7b000d2d2423a578c0ddfa63773764417aec9e (diff)
Update the Autoconf code to rra-c-util 3.0
* Sanity-check the results of krb5-config before proceeding. * Fall back on manual probing if krb5-config results don't work. * Add --with-krb5-include and --with-krb5-lib configure options. * Add --with-remctl-include and --with-remctl-lib configure options. * Add --with-gssapi-include and --with-gssapi-lib configure options. * Don't break if the user clobbers CPPFLAGS at build time. * Suppress error output from krb5-config probes. * Prefer KRB5_CONFIG over a path constructed from --with-*. * Update GSS-API probes for Solaris 10's native implementation. * Change AC_TRY_* to AC_*_IFELSE as recommended by Autoconf. Also strip out more outdated AFS kaserver instructions from README.
Diffstat (limited to 'm4/gssapi.m4')
-rw-r--r--m4/gssapi.m4101
1 files changed, 63 insertions, 38 deletions
diff --git a/m4/gssapi.m4 b/m4/gssapi.m4
index a352e38..4b08569 100644
--- a/m4/gssapi.m4
+++ b/m4/gssapi.m4
@@ -1,30 +1,24 @@
-dnl gssapi.m4 -- Find the compiler and linker flags for GSS-API.
+dnl Find the compiler and linker flags for GSS-API.
dnl
-dnl Finds the compiler and linker flags for linking with GSS-API libraries
-dnl and sets the substitution variables GSSAPI_CPPFLAGS, GSSAPI_LDFLAGS, and
-dnl GSSAPI_LIBS. Provides the --with-gssapi configure option to specify a
-dnl non-standard path to the GSS-API libraries. Uses krb5-config where
-dnl available unless reduced dependencies is requested.
+dnl Finds the compiler and linker flags for linking with GSS-API libraries.
+dnl Provides the --with-gssapi, --with-gssapi-include, and --with-gssapi-lib
+dnl configure option to specify a non-standard path to the GSS-API libraries.
+dnl Uses krb5-config where available unless reduced dependencies is requested.
dnl
dnl Provides the macro RRA_LIB_GSSAPI and sets the substitution variables
dnl GSSAPI_CPPFLAGS, GSSAPI_LDFLAGS, and GSSAPI_LIBS. Also provides
-dnl RRA_LIB_GSSAPI_SET to set CPPFLAGS, LDFLAGS, and LIBS to include the
-dnl GSS-API libraries; RRA_LIB_GSSAPI_SWITCH to do the same but save the
-dnl current values first; and RRA_LIB_GSSAPI_RESTORE to restore those settings
-dnl to before the last RRA_LIB_GSSAPI_SWITCH.
+dnl RRA_LIB_GSSAPI_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include the
+dnl GSS-API libraries, saving the ecurrent values, and RRA_LIB_GSSAPI_RESTORE
+dnl to restore those settings to before the last RRA_LIB_GSSAPI_SWITCH.
+dnl
+dnl Depends on RRA_ENABLE_REDUCED_DEPENDS and RRA_SET_LDFLAGS.
dnl
dnl Written by Russ Allbery <rra@stanford.edu>
-dnl Copyright 2005, 2006, 2007, 2008
+dnl Copyright 2005, 2006, 2007, 2008, 2009
dnl Board of Trustees, Leland Stanford Jr. University
dnl
dnl See LICENSE for licensing terms.
-dnl Set CPPFLAGS, LDFLAGS, and LIBS to values including the GSS-API settings.
-AC_DEFUN([RRA_LIB_GSSAPI_SET],
-[CPPFLAGS="$GSSAPI_CPPFLAGS $CPPFLAGS"
- LDFLAGS="$GSSAPI_LDFLAGS $LDFLAGS"
- LIBS="$GSSAPI_LIBS $LIBS"])
-
dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to
dnl versions that include the GSS-API flags. Used as a wrapper, with
dnl RRA_LIB_GSSAPI_RESTORE, around tests.
@@ -32,7 +26,9 @@ AC_DEFUN([RRA_LIB_GSSAPI_SWITCH],
[rra_gssapi_save_CPPFLAGS="$CPPFLAGS"
rra_gssapi_save_LDFLAGS="$LDFLAGS"
rra_gssapi_save_LIBS="$LIBS"
- RRA_LIB_GSSAPI_SET])
+ CPPFLAGS="$GSSAPI_CPPFLAGS $CPPFLAGS"
+ LDFLAGS="$GSSAPI_LDFLAGS $LDFLAGS"
+ LIBS="$GSSAPI_LIBS $LIBS"])
dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before
dnl RRA_LIB_GSSAPI_SWITCH was called).
@@ -41,12 +37,18 @@ AC_DEFUN([RRA_LIB_GSSAPI_RESTORE],
LDFLAGS="$rra_gssapi_save_LDFLAGS"
LIBS="$rra_gssapi_save_LIBS"])
-dnl Set GSSAPI_CPPFLAGS and GSSAPI_LDFLAGS based on rra_gssapi_root.
+dnl Set GSSAPI_CPPFLAGS and GSSAPI_LDFLAGS based on rra_gssapi_root,
+dnl rra_gssapi_libdir, and rra_gssapi_includedir.
AC_DEFUN([_RRA_LIB_GSSAPI_PATHS],
-[AS_IF([test x"$rra_gssapi_root" != x],
- [AS_IF([test x"$rra_gssapi_root" != x/usr],
- [GSSAPI_CPPFLAGS="-I${rra_gssapi_root}/include"])
- GSSAPI_LDFLAGS="-L${rra_gssapi_root}/lib"])])
+[AS_IF([test x"$rra_gssapi_libdir" != x],
+ [GSSAPI_LDFLAGS="-L$rra_gssapi_libdir"],
+ [AS_IF([test x"$rra_gssapi_root" != x],
+ [RRA_SET_LDFLAGS([GSSAPI_LDFLAGS], [$rra_gssapi_root])])])
+ AS_IF([test x"$rra_gssapi_includedir" != x],
+ [GSSAPI_CPPFLAGS="-I$rra_gssapi_includedir"],
+ [AS_IF([test x"$rra_gssapi_root" != x],
+ [AS_IF([test x"$rra_gssapi_root" != x/usr],
+ [GSSAPI_CPPFLAGS="-I${rra_gssapi_root}/include"])])])])
dnl Does the appropriate library checks for reduced-dependency GSS-API
dnl linkage.
@@ -54,10 +56,13 @@ AC_DEFUN([_RRA_LIB_GSSAPI_REDUCED],
[RRA_LIB_GSSAPI_SWITCH
AC_CHECK_LIB([gssapi_krb5], [gss_import_name], [GSSAPI_LIBS="-lgssapi_krb5"],
[AC_CHECK_LIB([gssapi], [gss_import_name], [GSSAPI_LIBS="-lgssapi"],
- [AC_MSG_ERROR([cannot find usable GSS-API library])])])])
+ [AC_CHECK_LIB([gss], [gss_import_name], [GSSAPI_LIBS="-lgss"],
+ [AC_MSG_ERROR([cannot find usable GSS-API library])])])])])
dnl Does the appropriate library checks for GSS-API linkage when we don't
-dnl have krb5-config or reduced dependencies.
+dnl have krb5-config or reduced dependencies. libgss is used as a last
+dnl resort, since it may be a non-functional mech-independent wrapper, but
+dnl it's the right choice on Solaris 10.
AC_DEFUN([_RRA_LIB_GSSAPI_MANUAL],
[RRA_LIB_GSSAPI_SWITCH
rra_gssapi_extra=
@@ -91,53 +96,73 @@ AC_DEFUN([_RRA_LIB_GSSAPI_MANUAL],
rra_gssapi_extra="-lkrb5 $rra_gssapi_extra"
AC_CHECK_LIB([gssapi_krb5], [gss_import_name],
[GSSAPI_LIBS="-lgssapi_krb5 $rra_gssapi_extra"],
- [AC_MSG_ERROR([cannot find usable GSS-API library])],
+ [AC_CHECK_LIB([gss], [gss_import_name],
+ [GSSAPI_LIBS="-lgss"],
+ [AC_MSG_ERROR([cannot find usable GSS-API library])])],
[$rra_gssapi_extra])],
[-lkrb5 -lasn1 -lroken -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
-dnl GSS-API program.
+dnl GSS-API program. If not, fall back on the manual check.
AC_DEFUN([_RRA_LIB_GSSAPI_CHECK],
[RRA_LIB_GSSAPI_SWITCH
- AC_CHECK_FUNC([gss_import_name], ,
- [AC_MSG_FAILURE([krb5-config results fail for GSS-API])])
- RRA_LIB_GSSAPI_RESTORE])
+ AC_CHECK_FUNC([gss_import_name],
+ [RRA_LIB_GSSAPI_RESTORE],
+ [RRA_LIB_GSSAPI_RESTORE
+ GSSAPI_CPPFLAGS=
+ GSSAPI_LIBS=
+ _RRA_LIB_GSSAPI_PATHS
+ _RRA_LIB_GSSAPI_MANUAL])])
dnl The main macro.
AC_DEFUN([RRA_LIB_GSSAPI],
[AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS])
rra_gssapi_root=
+ rra_gssapi_libdir=
+ rra_gssapi_includedir=
GSSAPI_CPPFLAGS=
GSSAPI_LDFLAGS=
GSSAPI_LIBS=
AC_SUBST([GSSAPI_CPPFLAGS])
AC_SUBST([GSSAPI_LDFLAGS])
AC_SUBST([GSSAPI_LIBS])
+
AC_ARG_WITH([gssapi],
- [AC_HELP_STRING([--with-gssapi=DIR],
+ [AS_HELP_STRING([--with-gssapi=DIR],
[Location of GSS-API headers and libraries])],
[AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
[rra_gssapi_root="$withval"])])
+ AC_ARG_WITH([gssapi-include],
+ [AS_HELP_STRING([--with-gssapi-include=DIR],
+ [Location of GSS-API headers])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_gssapi_includedir="$withval"])])
+ AC_ARG_WITH([gssapi-lib],
+ [AS_HELP_STRING([--with-gssapi-lib=DIR],
+ [Location of GSS-API libraries])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_gssapi_libdir="$withval"])])
+
AS_IF([test x"$rra_reduced_depends" = xtrue],
[_RRA_LIB_GSSAPI_PATHS
_RRA_LIB_GSSAPI_REDUCED],
[AC_ARG_VAR([KRB5_CONFIG], [Path to krb5-config])
- AS_IF([test x"$rra_gssapi_root" != x],
+ AS_IF([test x"$rra_gssapi_root" != x && test -z "$KRB5_CONFIG"],
[AS_IF([test -x "${rra_gssapi_root}/bin/krb5-config"],
[KRB5_CONFIG="${rra_gssapi_root}/bin/krb5-config"])],
[AC_PATH_PROG([KRB5_CONFIG], [krb5-config])])
- AS_IF([test x"$KRB5_CONFIG" != x],
+ AS_IF([test x"$KRB5_CONFIG" != x && test -x "$KRB5_CONFIG"],
[AC_CACHE_CHECK([for gssapi support in krb5-config],
[rra_cv_lib_gssapi_config],
- [AS_IF(["$KRB5_CONFIG" | grep gssapi > /dev/null 2>&1],
+ [AS_IF(["$KRB5_CONFIG" 2>&1 | grep gssapi >/dev/null 2>&1],
[rra_cv_lib_gssapi_config=yes],
[rra_cv_lib_gssapi_config=no])])
AS_IF([test "$rra_cv_lib_gssapi_config" = yes],
- [GSSAPI_CPPFLAGS=`"$KRB5_CONFIG" --cflags gssapi`
- GSSAPI_LIBS=`"$KRB5_CONFIG" --libs gssapi`],
- [GSSAPI_CPPFLAGS=`"$KRB5_CONFIG" --cflags`
- GSSAPI_LIBS=`"$KRB5_CONFIG" --libs`])
+ [GSSAPI_CPPFLAGS=`"$KRB5_CONFIG" --cflags gssapi 2>/dev/null`
+ GSSAPI_LIBS=`"$KRB5_CONFIG" --libs gssapi 2>/dev/null`],
+ [GSSAPI_CPPFLAGS=`"$KRB5_CONFIG" --cflags 2>/dev/null`
+ GSSAPI_LIBS=`"$KRB5_CONFIG" --libs 2>/dev/null`])
GSSAPI_CPPFLAGS=`echo "$GSSAPI_CPPFLAGS" \
| sed 's%-I/usr/include ?%%'`
_RRA_LIB_GSSAPI_CHECK],