From: Todd C. Miller Date: Fri, 25 Jan 2019 17:39:57 +0000 (-0700) Subject: Use $ac_cv_search_FUNCTION instead of $ac_lib and $ac_res. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c1d934894d303017bc7d1ee2bd2e360232594f52;p=sudo Use $ac_cv_search_FUNCTION instead of $ac_lib and $ac_res. Fixes a problem where libcrypt is not used with autoconf caching. Adapted from a diff from Adam Labbe. --- diff --git a/configure b/configure index e1b5dbb9c..8e0a18a59 100755 --- a/configure +++ b/configure @@ -24618,7 +24618,9 @@ $as_echo "$ac_cv_search_crypt" >&6; } ac_res=$ac_cv_search_crypt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - test -n "$ac_lib" && shadow_libs="${shadow_libs} $ac_res" + + test "${ac_cv_search_crypt}" != "none required" && shadow_libs="${shadow_libs} ${ac_cv_search_crypt}" + fi LIBS="$_LIBS" @@ -24704,8 +24706,12 @@ $as_echo "$ac_cv_search_getspnam" >&6; } ac_res=$ac_cv_search_getspnam if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - $as_echo "#define HAVE_GETSPNAM 1" >>confdefs.h - CHECKSHADOW=false; test -n "$ac_lib" && shadow_libs="${shadow_libs} $ac_res" + + $as_echo "#define HAVE_GETSPNAM 1" >>confdefs.h + + test "${ac_cv_search_getspnam}" != "none required" && shadow_libs="${shadow_libs} ${ac_cv_search_getspnam}" + CHECKSHADOW=false + fi fi @@ -24763,8 +24769,13 @@ $as_echo "$ac_cv_search_getprpwnam" >&6; } ac_res=$ac_cv_search_getprpwnam if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - $as_echo "#define HAVE_GETPRPWNAM 1" >>confdefs.h - CHECKSHADOW=false; SECUREWARE=1; test -n "$ac_lib" && shadow_libs="${shadow_libs} $ac_res" + + $as_echo "#define HAVE_GETPRPWNAM 1" >>confdefs.h + + test "${ac_cv_search_getprpwnam}" != "none required" && shadow_libs="${shadow_libs} ${ac_cv_search_getprpwnam}" + SECUREWARE=1 + CHECKSHADOW=false + fi fi @@ -25100,7 +25111,7 @@ ac_res=$ac_cv_search_ldap_init if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - test "$ac_res" != "none required" && LDAP_LIBS="$ac_res" + test "${ac_cv_search_ldap_init}" != "none required" && LDAP_LIBS="${ac_cv_search_ldap_init}" found=yes fi diff --git a/configure.ac b/configure.ac index 962a032a3..32ad35c96 100644 --- a/configure.ac +++ b/configure.ac @@ -3755,7 +3755,9 @@ if test ${with_passwd-'no'} != "no"; then dnl if test -z "$LIB_CRYPT"; then _LIBS="$LIBS" - AC_SEARCH_LIBS([crypt], [crypt crypt_d ufc], [test -n "$ac_lib" && shadow_libs="${shadow_libs} $ac_res"]) + AC_SEARCH_LIBS([crypt], [crypt crypt_d ufc], [ + test "${ac_cv_search_crypt}" != "none required" && shadow_libs="${shadow_libs} ${ac_cv_search_crypt}" + ]) LIBS="$_LIBS" fi @@ -3775,10 +3777,19 @@ if test ${with_passwd-'no'} != "no"; then LIBS="$_LIBS" fi if test "$CHECKSHADOW" = "true"; then - AC_SEARCH_LIBS([getspnam], [gen shadow], [AC_DEFINE(HAVE_GETSPNAM)] [CHECKSHADOW=false; test -n "$ac_lib" && shadow_libs="${shadow_libs} $ac_res"]) + AC_SEARCH_LIBS([getspnam], [gen shadow], [ + AC_DEFINE(HAVE_GETSPNAM) + test "${ac_cv_search_getspnam}" != "none required" && shadow_libs="${shadow_libs} ${ac_cv_search_getspnam}" + CHECKSHADOW=false + ]) fi if test "$CHECKSHADOW" = "true"; then - AC_SEARCH_LIBS([getprpwnam], [sec security prot], [AC_DEFINE(HAVE_GETPRPWNAM)] [CHECKSHADOW=false; SECUREWARE=1; test -n "$ac_lib" && shadow_libs="${shadow_libs} $ac_res"]) + AC_SEARCH_LIBS([getprpwnam], [sec security prot], [ + AC_DEFINE(HAVE_GETPRPWNAM) + test "${ac_cv_search_getprpwnam}" != "none required" && shadow_libs="${shadow_libs} ${ac_cv_search_getprpwnam}" + SECUREWARE=1 + CHECKSHADOW=false + ]) fi if test -n "$shadow_libs"; then # sudoers needs to link with shadow libs for password auth @@ -3843,8 +3854,8 @@ if test ${with_ldap-'no'} != "no"; then case "$host_os" in hpux*) AC_CHECK_LIB(Csup, main, [IBMLDAP_EXTRA=" -lCsup"]);; esac - AC_SEARCH_LIBS(ldap_init, "ibmldap${IBMLDAP_EXTRA}" "ibmldap -lidsldif${IBMLDAP_EXTRA}" "ldap" "ldap -llber" "ldap -llber -lssl -lcrypto" "ibmldap${IBMLDAP_EXTRA}", [ - test "$ac_res" != "none required" && LDAP_LIBS="$ac_res" + AC_SEARCH_LIBS([ldap_init], ["ibmldap${IBMLDAP_EXTRA}" "ibmldap -lidsldif${IBMLDAP_EXTRA}" "ldap" "ldap -llber" "ldap -llber -lssl -lcrypto" "ibmldap${IBMLDAP_EXTRA}]", [ + test "${ac_cv_search_ldap_init}" != "none required" && LDAP_LIBS="${ac_cv_search_ldap_init}" found=yes ]) # If nothing linked, try -lldap and hope for the best