From dc3da0677264781bc99d079abfe35cd628113928 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Thu, 28 Apr 2011 12:56:11 -0700 Subject: [PATCH] Resync Autoconf macros from rra-c-util 3.3 This includes the following fixes: * Include krb5.h before probing for the IBM-specific header file for obtaining error strings to avoid Autoconf warnings on AIX. * Use [] to mark empty arguments to Autoconf macros. * Add an explicit license statement to these Autoconf macros, matching the normal Autoconf macro license. * Ensure rra_use_kerberos is always set so that other parts of configure can rely on it. Change-Id: I521d38ad6834808cf09c798aeba0efc0dd741fd6 Reviewed-on: http://gerrit.openafs.org/4588 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- acinclude.m4 | 2 +- src/cf/krb5.m4 | 50 +++++++++++++++++++++++------------------- src/cf/lib-depends.m4 | 6 +++-- src/cf/lib-pathname.m4 | 7 ++++-- src/cf/pam-const.m4 | 33 +++++++++++++++++----------- 5 files changed, 58 insertions(+), 40 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index c9bb7f7b42..a8b3634833 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1594,7 +1594,7 @@ AC_CHECK_TYPES([long long], [], [], []) AC_SIZEOF_TYPE(long) -AC_HEADER_PAM_CONST +RRA_HEADER_PAM_CONST dnl Directory PATH handling diff --git a/src/cf/krb5.m4 b/src/cf/krb5.m4 index 08c8c56230..4a967ce812 100644 --- a/src/cf/krb5.m4 +++ b/src/cf/krb5.m4 @@ -34,9 +34,11 @@ dnl HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_2_ARGS if it takes two arguments. dnl dnl Written by Russ Allbery dnl Copyright 2005, 2006, 2007, 2008, 2009, 2010 -dnl Board of Trustees, Leland Stanford Jr. University +dnl The Board of Trustees of the Leland Stanford Junior University dnl -dnl See LICENSE for licensing terms. +dnl This file is free software; the authors give unlimited permission to copy +dnl and/or distribute it, with or without modifications, as long as this +dnl notice is preserved. 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 @@ -80,12 +82,13 @@ 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_error_string], , - [AC_CHECK_FUNCS([krb5_get_err_txt], , + [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_HEADERS([ibm_svc/krb5_svc.h], [], [], + [#include ])], [AC_CHECK_LIB([com_err], [com_err], [KRB5_LIBS="$KRB5_LIBS -lcom_err"], [AC_MSG_ERROR([cannot find usable com_err library])]) @@ -99,11 +102,11 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL], [RRA_LIB_KRB5_SWITCH rra_krb5_extra= LIBS= - AC_SEARCH_LIBS([res_search], [resolv], , + AC_SEARCH_LIBS([res_search], [resolv], [], [AC_SEARCH_LIBS([__res_search], [resolv])]) AC_SEARCH_LIBS([gethostbyname], [nsl]) - AC_SEARCH_LIBS([socket], [socket], , - [AC_CHECK_LIB([nsl], [socket], [LIBS="-lnsl -lsocket $LIBS"], , + AC_SEARCH_LIBS([socket], [socket], [], + [AC_CHECK_LIB([nsl], [socket], [LIBS="-lnsl -lsocket $LIBS"], [], [-lsocket])]) AC_SEARCH_LIBS([crypt], [crypt]) AC_SEARCH_LIBS([rk_simple_execve], [roken]) @@ -119,15 +122,16 @@ AC_DEFUN([_RRA_LIB_KRB5_MANUAL], [rra_krb5_pthread="-lpthread"])]) AC_CHECK_LIB([krb5support], [krb5int_setspecific], [rra_krb5_extra="-lkrb5support $rra_krb5_extra $rra_krb5_pthread"], - , [$rra_krb5_pthread])]) + [], [$rra_krb5_pthread $rra_krb5_extra])], + [$rra_krb5_extra]) AC_CHECK_LIB([com_err], [error_message], - [rra_krb5_extra="-lcom_err $rra_krb5_extra"]) + [rra_krb5_extra="-lcom_err $rra_krb5_extra"], [], [$rra_krb5_extra]) AC_CHECK_LIB([ksvc], [krb5_svc_get_msg], - [rra_krb5_extra="-lksvc $rra_krb5_extra"]) + [rra_krb5_extra="-lksvc $rra_krb5_extra"], [], [$rra_krb5_extra]) AC_CHECK_LIB([k5crypto], [krb5int_hash_md5], - [rra_krb5_extra="-lk5crypto $rra_krb5_extra"]) + [rra_krb5_extra="-lk5crypto $rra_krb5_extra"], [], [$rra_krb5_extra]) AC_CHECK_LIB([k5profile], [profile_get_values], - [rra_krb5_extra="-lk5profile $rra_krb5_extra"]) + [rra_krb5_extra="-lk5profile $rra_krb5_extra"], [], [$rra_krb5_extra]) AC_CHECK_LIB([krb5], [krb5_cc_default], [KRB5_LIBS="-lkrb5 $rra_krb5_extra"], [AS_IF([test x"$1" = xtrue], @@ -137,12 +141,12 @@ 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_error_string], , - [AC_CHECK_FUNCS([krb5_get_err_txt], , - [AC_CHECK_FUNCS([error_message], , + [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])])])])])]) + [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [], + [#include ])], + [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 @@ -171,7 +175,7 @@ AC_DEFUN([_RRA_LIB_KRB5_INTERNAL], AS_IF([test x"$rra_krb5_root" != x && test -z "$KRB5_CONFIG"], [AS_IF([test -x "${rra_krb5_root}/bin/krb5-config"], [KRB5_CONFIG="${rra_krb5_root}/bin/krb5-config"])], - [AC_PATH_PROG([KRB5_CONFIG], [krb5-config], , + [AC_PATH_PROG([KRB5_CONFIG], [krb5-config], [], [${PATH}:/usr/kerberos/bin])]) AS_IF([test x"$KRB5_CONFIG" != x && test -x "$KRB5_CONFIG"], [AC_CACHE_CHECK([for krb5 support in krb5-config], @@ -189,10 +193,11 @@ AC_DEFUN([_RRA_LIB_KRB5_INTERNAL], RRA_LIB_KRB5_SWITCH AC_CHECK_FUNCS([krb5_get_error_message], [AC_CHECK_FUNCS([krb5_free_error_message])], - [AC_CHECK_FUNCS([krb5_get_error_string], , - [AC_CHECK_FUNCS([krb5_get_err_txt], , + [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([ibm_svc/krb5_svc.h], [], [], + [#include ])], [AC_CHECK_HEADERS([et/com_err.h])])])])]) RRA_LIB_KRB5_RESTORE], [_RRA_LIB_KRB5_PATHS @@ -210,6 +215,7 @@ AC_DEFUN([RRA_LIB_KRB5], [rra_krb5_root= rra_krb5_libdir= rra_krb5_includedir= + rra_use_kerberos=true AC_SUBST([KRB5_CPPFLAGS]) AC_SUBST([KRB5_LDFLAGS]) AC_SUBST([KRB5_LIBS]) diff --git a/src/cf/lib-depends.m4 b/src/cf/lib-depends.m4 index 039e245364..0aa0d1e50a 100644 --- a/src/cf/lib-depends.m4 +++ b/src/cf/lib-depends.m4 @@ -11,9 +11,11 @@ dnl can require it with AC_REQUIRE. dnl dnl Written by Russ Allbery dnl Copyright 2005, 2006, 2007 -dnl Board of Trustees, Leland Stanford Jr. University +dnl The Board of Trustees of the Leland Stanford Junior University dnl -dnl See LICENSE for licensing terms. +dnl This file is free software; the authors give unlimited permission to copy +dnl and/or distribute it, with or without modifications, as long as this +dnl notice is preserved. AC_DEFUN([RRA_ENABLE_REDUCED_DEPENDS], [rra_reduced_depends=false diff --git a/src/cf/lib-pathname.m4 b/src/cf/lib-pathname.m4 index fc326a0bc3..a639b17ac0 100644 --- a/src/cf/lib-pathname.m4 +++ b/src/cf/lib-pathname.m4 @@ -13,9 +13,12 @@ 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 -dnl Copyright 2008, 2009 Board of Trustees, Leland Stanford Jr. University +dnl Copyright 2008, 2009 +dnl The Board of Trustees of the Leland Stanford Junior University dnl -dnl See LICENSE for licensing terms. +dnl This file is free software; the authors give unlimited permission to copy +dnl and/or distribute it, with or without modifications, as long as this +dnl notice is preserved. 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 diff --git a/src/cf/pam-const.m4 b/src/cf/pam-const.m4 index 4914b3d214..ffbbb60c74 100644 --- a/src/cf/pam-const.m4 +++ b/src/cf/pam-const.m4 @@ -1,4 +1,4 @@ -dnl pam-const.m4 -- Determine whether PAM uses const in prototypes. +dnl Determine whether PAM uses const in prototypes. dnl dnl Linux marks several PAM arguments const, including the argument to dnl pam_get_item and some arguments to conversation functions, which Solaris @@ -10,20 +10,27 @@ dnl we guess wrong. This test is ugly, but it seems to work. dnl dnl Contributed by Markus Moeller. dnl -dnl Copyright 2007 Russ Allbery +dnl Copyright 2007 Russ Allbery dnl Copyright 2007, 2008 Markus Moeller dnl -dnl See LICENSE for licensing terms. -AC_DEFUN([_HEADER_PAM_CONST_SOURCE], -[ -#include +dnl This file is free software; the authors give unlimited permission to copy +dnl and/or distribute it, with or without modifications, as long as this +dnl notice is preserved. + +dnl Source used by RRA_HEADER_PAM_CONST. +AC_DEFUN([_RRA_HEADER_PAM_CONST_SOURCE], +[#ifdef HAVE_SECURITY_PAM_APPL_H +# include +#else +# include +#endif ]) -AC_DEFUN([AC_HEADER_PAM_CONST], -[AC_CACHE_CHECK([whether PAM prefers const], [ac_cv_header_pam_const], -[AC_EGREP_CPP([const void \*\* *item], _HEADER_PAM_CONST_SOURCE(), - [ac_cv_header_pam_const=yes], [ac_cv_header_pam_const=no])]) -AS_IF([test x"$ac_cv_header_pam_const" = xyes], - [ac_header_pam_const=const], [ac_header_pam_const=]) -AC_DEFINE_UNQUOTED([PAM_CONST], [$ac_header_pam_const], +AC_DEFUN([RRA_HEADER_PAM_CONST], +[AC_CACHE_CHECK([whether PAM prefers const], [rra_cv_header_pam_const], + [AC_EGREP_CPP([const void \*\* *item], _RRA_HEADER_PAM_CONST_SOURCE(), + [rra_cv_header_pam_const=yes], [rra_cv_header_pam_const=no])]) +AS_IF([test x"$rra_cv_header_pam_const" = xyes], + [rra_header_pam_const=const], [rra_header_pam_const=]) +AC_DEFINE_UNQUOTED([PAM_CONST], [$rra_header_pam_const], [Define to const if PAM uses const in pam_get_item, empty otherwise.])])