summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/gssapi.m4101
-rw-r--r--m4/krb5.m4164
-rw-r--r--m4/lib-depends.m44
-rw-r--r--m4/lib-pathname.m455
-rw-r--r--m4/remctl.m479
-rw-r--r--m4/snprintf.m417
-rw-r--r--m4/vamacros.m455
7 files changed, 320 insertions, 155 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],
diff --git a/m4/krb5.m4 b/m4/krb5.m4
index 12d97f8..bba9694 100644
--- a/m4/krb5.m4
+++ b/m4/krb5.m4
@@ -1,41 +1,36 @@
-dnl krb5.m4 -- Find the compiler and linker flags for Kerberos v5.
+dnl Find the compiler and linker flags for Kerberos v5.
dnl
-dnl Finds the compiler and linker flags for linking with Kerberos v5 libraries
-dnl and sets the substitution variables KRB5_CPPFLAGS, KRB5_LDFLAGS, and
-dnl KRB5_LIBS. Provides the --with-krb5 configure option to specify a
-dnl non-standard path to the Kerberos libraries. Uses krb5-config where
-dnl available unless reduced dependencies is requested.
-dnl
-dnl Sets an Automake conditional saying whether we use com_err, since if we're
-dnl also linking with AFS libraries, we may have to change library ordering in
-dnl that case.
+dnl Finds the compiler and linker flags for linking with Kerberos v5
+dnl libraries. Provides the --with-krb5, --with-krb5-include, and
+dnl --with-krb5-lib configure options to specify non-standards paths to the
+dnl Kerberos libraries. Uses krb5-config where available unless reduced
+dnl dependencies is requested.
dnl
dnl Provides the macro RRA_LIB_KRB5 and sets the substitution variables
dnl KRB5_CPPFLAGS, KRB5_LDFLAGS, and KRB5_LIBS. Also provides
-dnl RRA_LIB_KRB5_SET to set CPPFLAGS, LDFLAGS, and LIBS to include the
-dnl Kerberos libraries; RRA_LIB_KRB5_SWITCH to do the same but save the
-dnl current values first; and RRA_LIB_KRB5_RESTORE to restore those settings
-dnl to before the last RRA_LIB_KRB5_SWITCH.
+dnl RRA_LIB_KRB5_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include the
+dnl Kerberos libraries, saving the current values first, and
+dnl RRA_LIB_KRB5_RESTORE to restore those settings to before the last
+dnl RRA_LIB_KRB5_SWITCH.
dnl
-dnl Also provides the RRA_LIB_KRB5_OPTIONAL macro, which should be used if
-dnl Kerberos support is optional. This macro will still always set the
-dnl substitution variables, but they'll be empty unless --with-krb5 is used.
-dnl Also, HAVE_KERBEROS will be defined if --with-krb5 is given and
+dnl Provides the RRA_LIB_KRB5_OPTIONAL macro, which should be used if Kerberos
+dnl support is optional. This macro will still always set the substitution
+dnl variables, but they'll be empty unless --with-krb5 is given. Also,
+dnl HAVE_KERBEROS will be defined if --with-krb5 is given and
dnl $rra_use_kerberos will be set to "true".
dnl
+dnl Sets the Automake conditional KRB5_USES_COM_ERR saying whether we use
+dnl com_err, since if we're also linking with AFS libraries, we may have to
+dnl change library ordering in that case.
+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 Kerberos v5
-dnl settings.
-AC_DEFUN([RRA_LIB_KRB5_SET],
-[CPPFLAGS="$KRB5_CPPFLAGS $CPPFLAGS"
- LDFLAGS="$KRB5_LDFLAGS $LDFLAGS"
- LIBS="$KRB5_LIBS $LIBS"])
-
dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to
dnl versions that include the Kerberos v5 flags. Used as a wrapper, with
dnl RRA_LIB_KRB5_RESTORE, around tests.
@@ -43,7 +38,9 @@ AC_DEFUN([RRA_LIB_KRB5_SWITCH],
[rra_krb5_save_CPPFLAGS="$CPPFLAGS"
rra_krb5_save_LDFLAGS="$LDFLAGS"
rra_krb5_save_LIBS="$LIBS"
- RRA_LIB_KRB5_SET])
+ CPPFLAGS="$KRB5_CPPFLAGS $CPPFLAGS"
+ LDFLAGS="$KRB5_LDFLAGS $LDFLAGS"
+ LIBS="$KRB5_LIBS $LIBS"])
dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before
dnl RRA_LIB_KRB5_SWITCH was called).
@@ -52,12 +49,18 @@ AC_DEFUN([RRA_LIB_KRB5_RESTORE],
LDFLAGS="$rra_krb5_save_LDFLAGS"
LIBS="$rra_krb5_save_LIBS"])
-dnl Set KRB5_CPPFLAGS and KRB5_LDFLAGS based on rra_krb5_root.
+dnl Set KRB5_CPPFLAGS and KRB5_LDFLAGS based on rra_krb5_root,
+dnl rra_krb5_libdir, and rra_krb5_includedir.
AC_DEFUN([_RRA_LIB_KRB5_PATHS],
-[AS_IF([test x"$rra_krb5_root" != x],
- [AS_IF([test x"$rra_krb5_root" != x/usr],
- [KRB5_CPPFLAGS="-I${rra_krb5_root}/include"])
- KRB5_LDFLAGS="-L${rra_krb5_root}/lib"])])
+[AS_IF([test x"$rra_krb5_libdir" != x],
+ [KRB5_LDFLAGS="-L$rra_krb5_libdir"],
+ [AS_IF([test x"$rra_krb5_root" != x],
+ [RRA_SET_LDFLAGS([KRB5_LDFLAGS], [$rra_krb5_root])])])
+ AS_IF([test x"$rra_krb5_includedir" != x],
+ [KRB5_CPPFLAGS="-I$rra_krb5_includedir"],
+ [AS_IF([test x"$rra_krb5_root" != x],
+ [AS_IF([test x"$rra_krb5_root" != x/usr],
+ [KRB5_CPPFLAGS="-I${rra_krb5_root}/include"])])])])
dnl Does the appropriate library checks for reduced-dependency Kerberos v5
dnl linkage. The single argument, if true, says to fail if Kerberos could not
@@ -70,15 +73,16 @@ AC_DEFUN([_RRA_LIB_KRB5_REDUCED],
LIBS="$KRB5_LIBS $LIBS"
AC_CHECK_FUNCS([krb5_get_error_message],
[AC_CHECK_FUNCS([krb5_free_error_message])],
- [AC_CHECK_FUNCS([krb5_get_err_txt], ,
- [AC_CHECK_LIB([ksvc], [krb5_svc_get_msg],
- [KRB5_LIBS="$KRB5_LIBS -lksvc"
- AC_DEFINE([HAVE_KRB5_SVC_GET_MSG], [1])
- AC_CHECK_HEADERS([ibm_svc/krb5_svc.h])],
- [AC_CHECK_LIB([com_err], [com_err],
- [KRB5_LIBS="$KRB5_LIBS -lcom_err"],
- [AC_MSG_ERROR([cannot find usable com_err library])])
- AC_CHECK_HEADERS([et/com_err.h])])])])
+ [AC_CHECK_FUNCS([krb5_get_error_string], ,
+ [AC_CHECK_FUNCS([krb5_get_err_txt], ,
+ [AC_CHECK_LIB([ksvc], [krb5_svc_get_msg],
+ [KRB5_LIBS="$KRB5_LIBS -lksvc"
+ AC_DEFINE([HAVE_KRB5_SVC_GET_MSG], [1])
+ AC_CHECK_HEADERS([ibm_svc/krb5_svc.h])],
+ [AC_CHECK_LIB([com_err], [com_err],
+ [KRB5_LIBS="$KRB5_LIBS -lcom_err"],
+ [AC_MSG_ERROR([cannot find usable com_err library])])
+ AC_CHECK_HEADERS([et/com_err.h])])])])])
RRA_LIB_KRB5_RESTORE])
dnl Does the appropriate library checks for Kerberos v5 linkage when we don't
@@ -125,24 +129,26 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL],
LIBS="$KRB5_LIBS $LIBS"
AC_CHECK_FUNCS([krb5_get_error_message],
[AC_CHECK_FUNCS([krb5_free_error_message])],
- [AC_CHECK_FUNCS([krb5_get_err_txt], ,
- [AC_CHECK_FUNCS([krb5_svc_get_msg],
- [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h])],
- [AC_CHECK_HEADERS([et/com_err.h])])])])
+ [AC_CHECK_FUNCS([krb5_get_error_string], ,
+ [AC_CHECK_FUNCS([krb5_get_err_txt], ,
+ [AC_CHECK_FUNCS([krb5_svc_get_msg],
+ [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h])],
+ [AC_CHECK_HEADERS([et/com_err.h])])])])])
RRA_LIB_KRB5_RESTORE])
dnl Sanity-check the results of krb5-config and be sure we can really link a
-dnl Kerberos program. The first option says whether to fail if Kerberos was
-dnl not found. If we shouldn't fail, clear KRB5_CPPFLAGS and KRB5_LIBS so
-dnl that we know we don't have usable flags.
+dnl Kerberos program. If that fails, clear KRB5_CPPFLAGS and KRB5_LIBS so
+dnl that we know we don't have usable flags and fall back on the manual
+dnl check.
AC_DEFUN([_RRA_LIB_KRB5_CHECK],
[RRA_LIB_KRB5_SWITCH
- AC_CHECK_FUNC([krb5_init_context], ,
- [AS_IF([test x"$1" = xtrue],
- [AC_MSG_FAILURE([krb5-config results fail for Kerberos v5])])
+ AC_CHECK_FUNC([krb5_init_context],
+ [RRA_LIB_KRB5_RESTORE],
+ [RRA_LIB_KRB5_RESTORE
KRB5_CPPFLAGS=
- KRB5_LIBS=])
- RRA_LIB_KRB5_RESTORE])
+ KRB5_LIBS=
+ _RRA_LIB_KRB5_PATHS
+ _RRA_LIB_KRB5_MANUAL([$1])])])
dnl The core of the library checking, shared between RRA_LIB_KRB5 and
dnl RRA_LIB_KRB5_OPTIONAL. The single argument, if "true", says to fail if
@@ -160,23 +166,24 @@ AC_DEFUN([_RRA_LIB_KRB5_INTERNAL],
AS_IF([test x"$KRB5_CONFIG" != x && test -x "$KRB5_CONFIG"],
[AC_CACHE_CHECK([for krb5 support in krb5-config],
[rra_cv_lib_krb5_config],
- [AS_IF(["$KRB5_CONFIG" | grep krb5 > /dev/null 2>&1],
+ [AS_IF(["$KRB5_CONFIG" 2>&1 | grep krb5 >/dev/null 2>&1],
[rra_cv_lib_krb5_config=yes],
[rra_cv_lib_krb5_config=no])])
- AS_IF([test "$rra_cv_lib_krb5_config" = yes],
- [KRB5_CPPFLAGS=`"$KRB5_CONFIG" --cflags krb5`
- KRB5_LIBS=`"$KRB5_CONFIG" --libs krb5`],
- [KRB5_CPPFLAGS=`"$KRB5_CONFIG" --cflags`
- KRB5_LIBS=`"$KRB5_CONFIG" --libs`])
+ AS_IF([test x"$rra_cv_lib_krb5_config" = xyes],
+ [KRB5_CPPFLAGS=`"$KRB5_CONFIG" --cflags krb5 2>/dev/null`
+ KRB5_LIBS=`"$KRB5_CONFIG" --libs krb5 2>/dev/null`],
+ [KRB5_CPPFLAGS=`"$KRB5_CONFIG" --cflags 2>/dev/null`
+ KRB5_LIBS=`"$KRB5_CONFIG" --libs 2>/dev/null`])
KRB5_CPPFLAGS=`echo "$KRB5_CPPFLAGS" | sed 's%-I/usr/include ?%%'`
_RRA_LIB_KRB5_CHECK([$1])
RRA_LIB_KRB5_SWITCH
AC_CHECK_FUNCS([krb5_get_error_message],
[AC_CHECK_FUNCS([krb5_free_error_message])],
- [AC_CHECK_FUNCS([krb5_get_err_txt], ,
- [AC_CHECK_FUNCS([krb5_svc_get_msg],
- [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h])],
- [AC_CHECK_HEADERS([et/com_err.h])])])])
+ [AC_CHECK_FUNCS([krb5_get_error_string], ,
+ [AC_CHECK_FUNCS([krb5_get_err_txt], ,
+ [AC_CHECK_FUNCS([krb5_svc_get_msg],
+ [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h])],
+ [AC_CHECK_HEADERS([et/com_err.h])])])])])
RRA_LIB_KRB5_RESTORE],
[_RRA_LIB_KRB5_PATHS
_RRA_LIB_KRB5_MANUAL([$1])])])
@@ -191,22 +198,37 @@ AC_DEFUN([_RRA_LIB_KRB5_INTERNAL],
dnl The main macro for packages with mandatory Kerberos support.
AC_DEFUN([RRA_LIB_KRB5],
[rra_krb5_root=
+ rra_krb5_libdir=
+ rra_krb5_includedir=
KRB5_CPPFLAGS=
KRB5_LDFLAGS=
KRB5_LIBS=
AC_SUBST([KRB5_CPPFLAGS])
AC_SUBST([KRB5_LDFLAGS])
AC_SUBST([KRB5_LIBS])
+
AC_ARG_WITH([krb5],
- [AC_HELP_STRING([--with-krb5=DIR],
+ [AS_HELP_STRING([--with-krb5=DIR],
[Location of Kerberos v5 headers and libraries])],
[AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
[rra_krb5_root="$withval"])])
+ AC_ARG_WITH([krb5-include],
+ [AS_HELP_STRING([--with-krb5-include=DIR],
+ [Location of Kerberos v5 headers])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_krb5_includedir="$withval"])])
+ AC_ARG_WITH([krb5-lib],
+ [AS_HELP_STRING([--with-krb5-lib=DIR],
+ [Location of Kerberos v5 libraries])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_krb5_libdir="$withval"])])
_RRA_LIB_KRB5_INTERNAL([true])])
dnl The main macro for packages with optional Kerberos support.
AC_DEFUN([RRA_LIB_KRB5_OPTIONAL],
[rra_krb5_root=
+ rra_krb5_libdir=
+ rra_krb5_includedir=
rra_use_kerberos=
KRB5_CPPFLAGS=
KRB5_LDFLAGS=
@@ -214,13 +236,25 @@ AC_DEFUN([RRA_LIB_KRB5_OPTIONAL],
AC_SUBST([KRB5_CPPFLAGS])
AC_SUBST([KRB5_LDFLAGS])
AC_SUBST([KRB5_LIBS])
+
AC_ARG_WITH([krb5],
- [AC_HELP_STRING([--with-krb5@<:@=DIR@:>@],
+ [AS_HELP_STRING([--with-krb5@<:@=DIR@:>@],
[Location of Kerberos v5 headers and libraries])],
[AS_IF([test x"$withval" = xno],
[rra_use_kerberos=false],
[AS_IF([test x"$withval" != xyes], [rra_krb5_root="$withval"])
rra_use_kerberos=true])])
+ AC_ARG_WITH([krb5-include],
+ [AS_HELP_STRING([--with-krb5-include=DIR],
+ [Location of Kerberos v5 headers])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_krb5_includedir="$withval"])])
+ AC_ARG_WITH([krb5-lib],
+ [AS_HELP_STRING([--with-krb5-lib=DIR],
+ [Location of Kerberos v5 libraries])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_krb5_libdir="$withval"])])
+
AS_IF([test x"$rra_use_kerberos" != xfalse],
[AS_IF([test x"$rra_use_kerberos" = xtrue],
[_RRA_LIB_KRB5_INTERNAL([true])],
diff --git a/m4/lib-depends.m4 b/m4/lib-depends.m4
index 1d7e769..039e245 100644
--- a/m4/lib-depends.m4
+++ b/m4/lib-depends.m4
@@ -1,4 +1,4 @@
-dnl lib-depends.m4 -- Provides option to change library probes.
+dnl Provides option to change library probes.
dnl
dnl This file provides RRA_ENABLE_REDUCED_DEPENDS, which adds the configure
dnl option --enable-reduced-depends to request that library probes assume
@@ -18,6 +18,6 @@ dnl See LICENSE for licensing terms.
AC_DEFUN([RRA_ENABLE_REDUCED_DEPENDS],
[rra_reduced_depends=false
AC_ARG_ENABLE([reduced-depends],
- [AC_HELP_STRING([--enable-reduced-depends],
+ [AS_HELP_STRING([--enable-reduced-depends],
[Try to minimize shared library dependencies])],
[AS_IF([test x"$enableval" = xyes], [rra_reduced_depends=true])])])
diff --git a/m4/lib-pathname.m4 b/m4/lib-pathname.m4
new file mode 100644
index 0000000..fc326a0
--- /dev/null
+++ b/m4/lib-pathname.m4
@@ -0,0 +1,55 @@
+dnl Determine the library path name.
+dnl
+dnl Red Hat systems and some other Linux systems use lib64 and lib32 rather
+dnl than just lib in some circumstances. This file provides an Autoconf
+dnl macro, RRA_SET_LDFLAGS, which given a variable, a prefix, and an optional
+dnl suffix, adds -Lprefix/lib, -Lprefix/lib32, or -Lprefix/lib64 to the
+dnl variable depending on which directories exist and the size of a long in
+dnl the compilation environment. If a suffix is given, a slash and that
+dnl suffix will be appended, to allow for adding a subdirectory of the library
+dnl directory.
+dnl
+dnl This file also provides the Autoconf macro RRA_SET_LIBDIR, which sets the
+dnl libdir variable to PREFIX/lib{,32,64} as appropriate.
+dnl
+dnl Written by Russ Allbery <rra@stanford.edu>
+dnl Copyright 2008, 2009 Board of Trustees, Leland Stanford Jr. University
+dnl
+dnl See LICENSE for licensing terms.
+
+dnl Probe for the alternate library name that we should attempt on this
+dnl architecture, given the size of an int, and set rra_lib_arch_name to that
+dnl name. Separated out so that it can be AC_REQUIRE'd and not run multiple
+dnl times.
+dnl
+dnl There is an unfortunate abstraction violation here where we assume we know
+dnl the cache variable name used by Autoconf. Unfortunately, Autoconf doesn't
+dnl provide any other way of getting at that information in shell that I can
+dnl see.
+AC_DEFUN([_RRA_LIB_ARCH_NAME],
+[rra_lib_arch_name=lib
+ AC_CHECK_SIZEOF([long])
+ AS_IF([test "$ac_cv_sizeof_long" -eq 4 && test -d /usr/lib32],
+ [rra_lib_arch_name=lib32],
+ [AS_IF([test "$ac_cv_sizeof_long" -eq 8 && test -d /usr/lib64],
+ [rra_lib_arch_name=lib64])])])
+
+dnl Set VARIABLE to -LPREFIX/lib{,32,64} or -LPREFIX/lib{,32,64}/SUFFIX as
+dnl appropriate.
+AC_DEFUN([RRA_SET_LDFLAGS],
+[AC_REQUIRE([_RRA_LIB_ARCH_NAME])
+ AS_IF([test -d "$2/$rra_lib_arch_name"],
+ [AS_IF([test x"$3" = x],
+ [$1="[$]$1 -L$2/${rra_lib_arch_name}"],
+ [$1="[$]$1 -L$2/${rra_lib_arch_name}/$3"])],
+ [AS_IF([test x"$3" = x],
+ [$1="[$]$1 -L$2/lib"],
+ [$1="[$]$1 -L$2/lib/$3"])])
+ $1=`echo "[$]$1" | sed -e 's/^ *//'`])
+
+dnl Set libdir to PREFIX/lib{,32,64} as appropriate.
+AC_DEFUN([RRA_SET_LIBDIR],
+[AC_REQUIRE([_RRA_LIB_ARCH_NAME])
+ AS_IF([test -d "$1/$rra_lib_arch_name"],
+ [libdir="$1/${rra_lib_arch_name}"],
+ [libdir="$1/lib"])])
diff --git a/m4/remctl.m4 b/m4/remctl.m4
index 5705a26..8ee3c16 100644
--- a/m4/remctl.m4
+++ b/m4/remctl.m4
@@ -1,27 +1,25 @@
-dnl remctl.m4 -- Find the compiler and linker flags for remctl.
+dnl Find the compiler and linker flags for remctl.
dnl
-dnl This file provides RRA_LIB_REMCTL, which finds the compiler and linker
-dnl flags for linking with remctl libraries and sets the substitution
-dnl variables REMCTL_CPPFLAGS, REMCTL_LDFLAGS, and REMCTL_LIBS. Also provides
-dnl RRA_LIB_REMCTL_SET to set CPPFLAGS, LDFLAGS, and LIBS to include the
-dnl remctl libraries; RRA_LIB_REMCTL_SWITCH to do the same but save the
-dnl current values first; and RRA_LIB_REMCTL_RESTORE to restore those settings
-dnl to before the last RRA_LIB_REMCTL_SWITCH.
+dnl Finds the compiler and linker flags for linking with remctl libraries.
+dnl Provides the --with-remctl, --with-remctl-include, and --with-remctl-lib
+dnl configure options to specify non-standard paths to the remctl headers and
+dnl libraries.
dnl
-dnl This macro depends on RRA_ENABLE_REDUCED_DEPENDS and RRA_LIB_GSSAPI.
+dnl Provides the macro RRA_LIB_REMCTL and sets the substitution variables
+dnl REMCTL_CPPFLAGS, REMCTL_LDFLAGS, and REMCTL_LIBS. Also provides
+dnl RRA_LIB_REMCTL_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include the
+dnl remctl libraries, saving the current values first, and
+dnl RRA_LIB_REMCTL_RESTORE to restore those settings to before the last
+dnl RRA_LIB_REMCTL_SWITCH.
+dnl
+dnl Depends on RRA_ENABLE_REDUCED_DEPENDS, RRA_SET_LDFLAGS, and
+dnl RRA_LIB_GSSAPI.
dnl
dnl Written by Russ Allbery <rra@stanford.edu>
-dnl Copyright 2008 Board of Trustees, Leland Stanford Jr. University
+dnl Copyright 2008, 2009 Board of Trustees, Leland Stanford Jr. University
dnl
dnl See LICENSE for licensing terms.
-dnl Set CPPFLAGS, LDFLAGS, and LIBS to values including the Kerberos v5
-dnl settings.
-AC_DEFUN([RRA_LIB_REMCTL_SET],
-[CPPFLAGS="$REMCTL_CPPFLAGS $CPPFLAGS"
- LDFLAGS="$REMCTL_LDFLAGS $LDFLAGS"
- LIBS="$REMCTL_LIBS $LIBS"])
-
dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to
dnl versions that include the Kerberos v5 flags. Used as a wrapper, with
dnl RRA_LIB_REMCTL_RESTORE, around tests.
@@ -29,7 +27,9 @@ AC_DEFUN([RRA_LIB_REMCTL_SWITCH],
[rra_remctl_save_CPPFLAGS="$CPPFLAGS"
rra_remctl_save_LDFLAGS="$LDFLAGS"
rra_remctl_save_LIBS="$LIBS"
- RRA_LIB_REMCTL_SET])
+ CPPFLAGS="$REMCTL_CPPFLAGS $CPPFLAGS"
+ LDFLAGS="$REMCTL_LDFLAGS $LDFLAGS"
+ LIBS="$REMCTL_LIBS $LIBS"])
dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before
dnl RRA_LIB_REMCTL_SWITCH was called).
@@ -38,32 +38,61 @@ AC_DEFUN([RRA_LIB_REMCTL_RESTORE],
LDFLAGS="$rra_remctl_save_LDFLAGS"
LIBS="$rra_remctl_save_LIBS"])
-dnl Set REMCTL_CPPFLAGS and REMCTL_LDFLAGS based on rra_remctl_root.
+dnl Set REMCTL_CPPFLAGS and REMCTL_LDFLAGS based on rra_remctl_root,
+dnl rra_remctl_libdir, and rra_remctl_includedir.
AC_DEFUN([_RRA_LIB_REMCTL_PATHS],
-[AS_IF([test x"$rra_remctl_root" != x],
- [AS_IF([test x"$rra_remctl_root" != x/usr],
- [REMCTL_CPPFLAGS="-I${rra_remctl_root}/include"])
- REMCTL_LDFLAGS="-L${rra_remctl_root}/lib"])])
+[AS_IF([test x"$rra_remctl_libdir" != x],
+ [REMCTL_LDFLAGS="-L$rra_remctl_libdir"],
+ [AS_IF([test x"$rra_remctl_root" != x],
+ [RRA_SET_LDFLAGS([REMCTL_LDFLAGS], [$rra_remctl_root])])])
+ AS_IF([test x"$rra_remctl_includedir" != x],
+ [REMCTL_CPPFLAGS="-I$rra_remctl_includedir"],
+ [AS_IF([test x"$rra_remctl_root" != x],
+ [AS_IF([test x"$rra_remctl_root" != x/usr],
+ [REMCTL_CPPFLAGS="-I${rra_remctl_root}/include"])])])])
+
+dnl Sanity-check the results of the remctl library search to be sure we can
+dnl really link a remctl program.
+AC_DEFUN([_RRA_LIB_REMCTL_CHECK],
+[RRA_LIB_REMCTL_SWITCH
+ AC_CHECK_FUNC([remctl_open], ,
+ [AC_MSG_FAILURE([unable to link with remctl library])])
+ RRA_LIB_REMCTL_RESTORE])
dnl The main macro.
AC_DEFUN([RRA_LIB_REMCTL],
[AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS])
rra_remctl_root=
+ rra_remctl_libdir=
+ rra_remctl_includedir=
REMCTL_CPPFLAGS=
REMCTL_LDFLAGS=
REMCTL_LIBS=
AC_SUBST([REMCTL_CPPFLAGS])
AC_SUBST([REMCTL_LDFLAGS])
AC_SUBST([REMCTL_LIBS])
+
AC_ARG_WITH([remctl],
- [AC_HELP_STRING([--with-remctl=DIR],
+ [AS_HELP_STRING([--with-remctl=DIR],
[Location of remctl headers and libraries])],
[AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
[rra_remctl_root="$withval"])])
+ AC_ARG_WITH([remctl-include],
+ [AS_HELP_STRING([--with-remctl-include=DIR],
+ [Location of remctl headers])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_remctl_includedir="$withval"])])
+ AC_ARG_WITH([remctl-lib],
+ [AS_HELP_STRING([--with-remctl-lib=DIR],
+ [Location of remctl libraries])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_remctl_libdir="$withval"])])
+
_RRA_LIB_REMCTL_PATHS
AS_IF([test x"$rra_reduced_depends" = xtrue],
[REMCTL_LIBS="-lremctl"],
[RRA_LIB_GSSAPI
REMCTL_CPPFLAGS="$REMCTL_CPPFLAGS $GSSAPI_CPPFLAGS"
REMCTL_LDFLAGS="$REMCTL_LDFLAGS $GSSAPI_LDFLAGS"
- REMCTL_LIBS="-lremctl $GSSAPI_LIBS"])])
+ REMCTL_LIBS="-lremctl $GSSAPI_LIBS"])
+ _RRA_LIB_REMCTL_CHECK])
diff --git a/m4/snprintf.m4 b/m4/snprintf.m4
index 79c0089..d933f55 100644
--- a/m4/snprintf.m4
+++ b/m4/snprintf.m4
@@ -1,4 +1,4 @@
-dnl snprintf.m4 -- Test for a working C99 snprintf.
+dnl Test for a working C99 snprintf.
dnl
dnl Check for a working snprintf. Some systems have an snprintf that doesn't
dnl nul-terminate if the buffer isn't large enough. Others return -1 if the
@@ -10,12 +10,14 @@ dnl Provides RRA_FUNC_SNPRINTF, which adds snprintf.o to LIBOBJS unless a
dnl fully working snprintf is found.
dnl
dnl Written by Russ Allbery <rra@stanford.edu>
-dnl Copyright 2006, 2008 Board of Trustees, Leland Stanford Jr. University
+dnl Copyright 2006, 2008, 2009
+dnl Board of Trustees, Leland Stanford Jr. University
+dnl
dnl See LICENSE for licensing terms.
dnl Source used by RRA_FUNC_SNPRINTF.
-define([_RRA_FUNC_SNPRINTF_SOURCE],
-[[#include <stdio.h>
+AC_DEFUN([_RRA_FUNC_SNPRINTF_SOURCE], [[
+#include <stdio.h>
#include <stdarg.h>
char buf[2];
@@ -37,16 +39,17 @@ main()
{
return ((test("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
&& snprintf(NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
-}]])
+}
+]])
dnl The user-callable test.
AC_DEFUN([RRA_FUNC_SNPRINTF],
[AC_CACHE_CHECK([for working snprintf], [rra_cv_func_snprintf_works],
- [AC_TRY_RUN(_RRA_FUNC_SNPRINTF_SOURCE(),
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([_RRA_FUNC_SNPRINTF_SOURCE])],
[rra_cv_func_snprintf_works=yes],
[rra_cv_func_snprintf_works=no],
[rra_cv_func_snprintf_works=no])])
-AS_IF([test "$rra_cv_func_snprintf_works" = yes],
+ AS_IF([test x"$rra_cv_func_snprintf_works" = xyes],
[AC_DEFINE([HAVE_SNPRINTF], 1,
[Define if your system has a working snprintf function.])],
[AC_LIBOBJ([snprintf])])])
diff --git a/m4/vamacros.m4 b/m4/vamacros.m4
index 6740d77..855bb40 100644
--- a/m4/vamacros.m4
+++ b/m4/vamacros.m4
@@ -1,4 +1,4 @@
-dnl vamacros.m4 -- Check for support for variadic macros.
+dnl Check for support for variadic macros.
dnl
dnl This file defines two macros for probing for compiler support for variadic
dnl macros. Provided are RRA_C_C99_VAMACROS, which checks for support for the
@@ -14,30 +14,49 @@ dnl
dnl They set HAVE_C99_VAMACROS or HAVE_GNU_VAMACROS as appropriate.
dnl
dnl Written by Russ Allbery <rra@stanford.edu>
-dnl Copyright 2006, 2008 Board of Trustees, Leland Stanford Jr. University
+dnl Copyright 2006, 2008, 2009
+dnl Board of Trustees, Leland Stanford Jr. University
dnl
dnl See LICENSE for licensing terms.
+AC_DEFUN([_RRA_C_C99_VAMACROS_SOURCE], [[
+#include <stdio.h>
+#define error(...) fprintf(stderr, __VA_ARGS__)
+
+int
+main(void) {
+ error("foo");
+ error("foo %d", 0);
+ return 0;
+}
+]])
+
AC_DEFUN([RRA_C_C99_VAMACROS],
[AC_CACHE_CHECK([for C99 variadic macros], [rra_cv_c_c99_vamacros],
-[AC_TRY_COMPILE(
-[#include <stdio.h>
-#define error(...) fprintf(stderr, __VA_ARGS__)],
- [error("foo"); error("foo %d", 0); return 0;],
- [rra_cv_c_c99_vamacros=yes],
- [rra_cv_c_c99_vamacros=no])])
-AS_IF([test $rra_cv_c_c99_vamacros = yes],
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_C_C99_VAMACROS_SOURCE])],
+ [rra_cv_c_c99_vamacros=yes],
+ [rra_cv_c_c99_vamacros=no])])
+ AS_IF([test x"$rra_cv_c_c99_vamacros" = xyes],
[AC_DEFINE([HAVE_C99_VAMACROS], 1,
- [Define if the compiler supports C99 variadic macros.])])])
+ [Define if the compiler supports C99 variadic macros.])])])
+
+AC_DEFUN([_RRA_C_GNU_VAMACROS_SOURCE], [[
+#include <stdio.h>
+#define error(args...) fprintf(stderr, args)
+
+int
+main(void) {
+ error("foo");
+ error("foo %d", 0);
+ return 0;
+}
+]])
AC_DEFUN([RRA_C_GNU_VAMACROS],
[AC_CACHE_CHECK([for GNU-style variadic macros], [rra_cv_c_gnu_vamacros],
-[AC_TRY_COMPILE(
-[#include <stdio.h>
-#define error(args...) fprintf(stderr, args)],
- [error("foo"); error("foo %d", 0); return 0;],
- [rra_cv_c_gnu_vamacros=yes],
- [rra_cv_c_gnu_vamacros=no])])
-AS_IF([test $rra_cv_c_gnu_vamacros = yes],
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_C_GNU_VAMACROS_SOURCE])],
+ [rra_cv_c_gnu_vamacros=yes],
+ [rra_cv_c_gnu_vamacros=no])])
+ AS_IF([test x"$rra_cv_c_gnu_vamacros" = xyes],
[AC_DEFINE([HAVE_GNU_VAMACROS], 1,
- [Define if the compiler supports GNU-style variadic macros.])])])
+ [Define if the compiler supports GNU-style variadic macros.])])])