2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 18:08:23 +00:00

Use AC_CACHE_CHECK in place of AC_MSG_CHECKING + AC_CACHE_VAL where possible.

This commit is contained in:
Todd C. Miller 2021-07-25 19:29:25 -06:00
parent 4a90deb2a0
commit f8e05dd984
3 changed files with 46 additions and 63 deletions

52
configure vendored
View File

@ -18599,7 +18599,8 @@ if test ${sudo_cv_uid_t_len+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else $as_nop else $as_nop
rm -f conftestdata
rm -f conftestdata
if test "$cross_compiling" = yes if test "$cross_compiling" = yes
then : then :
sudo_cv_uid_t_len=10 sudo_cv_uid_t_len=10
@ -18638,10 +18639,9 @@ fi
fi fi
rm -f conftestdata
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_uid_t_len" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_uid_t_len" >&5
printf "%s\n" "$sudo_cv_uid_t_len" >&6; } printf "%s\n" "$sudo_cv_uid_t_len" >&6; }
rm -f conftestdata
printf "%s\n" "#define MAX_UID_T_LEN $sudo_cv_uid_t_len" >>confdefs.h printf "%s\n" "#define MAX_UID_T_LEN $sudo_cv_uid_t_len" >>confdefs.h
@ -20771,14 +20771,15 @@ done
fi fi
done done
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working fnmatch with FNM_CASEFOLD" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working fnmatch with FNM_CASEFOLD" >&5
printf %s "checking for working fnmatch with FNM_CASEFOLD... " >&6; } printf %s "checking for working fnmatch with FNM_CASEFOLD... " >&6; }
if test ${sudo_cv_func_fnmatch+y} if test ${sudo_cv_func_fnmatch+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else $as_nop else $as_nop
rm -f conftestdata; > conftestdata
if test "$cross_compiling" = yes if test "$cross_compiling" = yes
then : then :
sudo_cv_func_fnmatch=no sudo_cv_func_fnmatch=no
else $as_nop else $as_nop
@ -20797,12 +20798,11 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext conftest.$ac_objext conftest.beam conftest.$ac_ext
fi fi
rm -f core core.* *.core
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_func_fnmatch" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_func_fnmatch" >&5
printf "%s\n" "$sudo_cv_func_fnmatch" >&6; } printf "%s\n" "$sudo_cv_func_fnmatch" >&6; }
if test $sudo_cv_func_fnmatch = yes if test $sudo_cv_func_fnmatch = yes
then : then :
printf "%s\n" "#define HAVE_FNMATCH 1" >>confdefs.h printf "%s\n" "#define HAVE_FNMATCH 1" >>confdefs.h
@ -20823,6 +20823,7 @@ esac
COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }fnm_test" COMPAT_TEST_PROGS="${COMPAT_TEST_PROGS}${COMPAT_TEST_PROGS+ }fnm_test"
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for isblank" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for isblank" >&5
printf %s "checking for isblank... " >&6; } printf %s "checking for isblank... " >&6; }
if test ${sudo_cv_func_isblank+y} if test ${sudo_cv_func_isblank+y}
@ -21463,7 +21464,7 @@ esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for optreset" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for optreset" >&5
printf %s "checking for optreset... " >&6; } printf %s "checking for optreset... " >&6; }
if test ${sudo_cv_optreset+y} if test ${sudo_cv_optreset+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else $as_nop else $as_nop
@ -21488,13 +21489,12 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \ rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_optreset" >&5
printf "%s\n" "$sudo_cv_optreset" >&6; }
if test "$sudo_cv_optreset" = "yes"; then if test "$sudo_cv_optreset" = "yes"; then
printf "%s\n" "#define HAVE_OPTRESET 1" >>confdefs.h printf "%s\n" "#define HAVE_OPTRESET 1" >>confdefs.h
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_optreset" >&5
printf "%s\n" "$sudo_cv_optreset" >&6; }
fi fi
@ -23419,7 +23419,7 @@ else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __progname" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __progname" >&5
printf %s "checking for __progname... " >&6; } printf %s "checking for __progname... " >&6; }
if test ${sudo_cv___progname+y} if test ${sudo_cv___progname+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else $as_nop else $as_nop
@ -23444,13 +23444,12 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \ rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv___progname" >&5
printf "%s\n" "$sudo_cv___progname" >&6; }
if test "$sudo_cv___progname" = "yes"; then if test "$sudo_cv___progname" = "yes"; then
printf "%s\n" "#define HAVE___PROGNAME 1" >>confdefs.h printf "%s\n" "#define HAVE___PROGNAME 1" >>confdefs.h
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv___progname" >&5
printf "%s\n" "$sudo_cv___progname" >&6; }
for _sym in sudo_getprogname; do for _sym in sudo_getprogname; do
COMPAT_EXP="${COMPAT_EXP}${_sym} COMPAT_EXP="${COMPAT_EXP}${_sym}
@ -23494,7 +23493,6 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \ rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv___func__" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv___func__" >&5
printf "%s\n" "$sudo_cv___func__" >&6; } printf "%s\n" "$sudo_cv___func__" >&6; }
if test "$sudo_cv___func__" = "yes"; then if test "$sudo_cv___func__" = "yes"; then
@ -23503,7 +23501,7 @@ if test "$sudo_cv___func__" = "yes"; then
elif test -n "$GCC"; then elif test -n "$GCC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __FUNCTION__" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __FUNCTION__" >&5
printf %s "checking for __FUNCTION__... " >&6; } printf %s "checking for __FUNCTION__... " >&6; }
if test ${sudo_cv___FUNCTION__+y} if test ${sudo_cv___FUNCTION__+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else $as_nop else $as_nop
@ -23528,8 +23526,7 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \ rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv___FUNCTION__" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv___FUNCTION__" >&5
printf "%s\n" "$sudo_cv___FUNCTION__" >&6; } printf "%s\n" "$sudo_cv___FUNCTION__" >&6; }
if test "$sudo_cv___FUNCTION__" = "yes"; then if test "$sudo_cv___FUNCTION__" = "yes"; then
printf "%s\n" "#define HAVE___FUNC__ 1" >>confdefs.h printf "%s\n" "#define HAVE___FUNC__ 1" >>confdefs.h
@ -28831,14 +28828,15 @@ if test x"$ax_cv_check_ldflags___pie" = xyes
then : then :
if test "$enable_pie" = "maybe"; then if test "$enable_pie" = "maybe"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working PIE support" >&5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working PIE support" >&5
printf %s "checking for working PIE support... " >&6; } printf %s "checking for working PIE support... " >&6; }
if test ${sudo_cv_working_pie+y} if test ${sudo_cv_working_pie+y}
then : then :
printf %s "(cached) " >&6 printf %s "(cached) " >&6
else $as_nop else $as_nop
rm -f conftestdata; > conftestdata
if test "$cross_compiling" = yes if test "$cross_compiling" = yes
then : then :
sudo_cv_working_pie=no sudo_cv_working_pie=no
else $as_nop else $as_nop
@ -28857,15 +28855,15 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext conftest.$ac_objext conftest.beam conftest.$ac_ext
fi fi
rm -f core core.* *.core
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_working_pie" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_working_pie" >&5
printf "%s\n" "$sudo_cv_working_pie" >&6; } printf "%s\n" "$sudo_cv_working_pie" >&6; }
if test $sudo_cv_working_pie = yes if test $sudo_cv_working_pie = yes
then : then :
enable_pie=yes enable_pie=yes
fi fi
fi fi
if test "$enable_pie" = "yes"; then if test "$enable_pie" = "yes"; then
PIE_CFLAGS="-fPIE" PIE_CFLAGS="-fPIE"

View File

@ -2811,13 +2811,11 @@ AC_CHECK_FUNCS([clock_gettime], [], [
AC_CHECK_FUNCS([getopt_long], [], [ AC_CHECK_FUNCS([getopt_long], [], [
AC_LIBOBJ(getopt_long) AC_LIBOBJ(getopt_long)
SUDO_APPEND_COMPAT_EXP(sudo_getopt_long sudo_getopt_long_only) SUDO_APPEND_COMPAT_EXP(sudo_getopt_long sudo_getopt_long_only)
AC_MSG_CHECKING([for optreset]) AC_CACHE_CHECK([for optreset], sudo_cv_optreset, [
AC_CACHE_VAL(sudo_cv_optreset, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern int optreset; optreset = 1; return optreset;]])], [sudo_cv_optreset=yes], [sudo_cv_optreset=no])]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern int optreset; optreset = 1; return optreset;]])], [sudo_cv_optreset=yes], [sudo_cv_optreset=no])])
if test "$sudo_cv_optreset" = "yes"; then if test "$sudo_cv_optreset" = "yes"; then
AC_DEFINE(HAVE_OPTRESET) AC_DEFINE(HAVE_OPTRESET)
fi fi
AC_MSG_RESULT($sudo_cv_optreset)
]) ])
AC_CHECK_FUNCS([closefrom], [], [AC_LIBOBJ(closefrom) AC_CHECK_FUNCS([closefrom], [], [AC_LIBOBJ(closefrom)
SUDO_APPEND_COMPAT_EXP(sudo_closefrom) SUDO_APPEND_COMPAT_EXP(sudo_closefrom)
@ -3253,30 +3251,24 @@ dnl
AC_CHECK_FUNCS([getprogname], [ AC_CHECK_FUNCS([getprogname], [
AC_CHECK_FUNCS([setprogname], [], [SUDO_APPEND_COMPAT_EXP(sudo_setprogname)]) AC_CHECK_FUNCS([setprogname], [], [SUDO_APPEND_COMPAT_EXP(sudo_setprogname)])
], [ ], [
AC_MSG_CHECKING([for __progname]) AC_CACHE_CHECK([for __progname], sudo_cv___progname, [
AC_CACHE_VAL(sudo_cv___progname, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char *__progname; if (__progname[0] == '\0') return 1;]])], [sudo_cv___progname=yes], [sudo_cv___progname=no])]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char *__progname; if (__progname[0] == '\0') return 1;]])], [sudo_cv___progname=yes], [sudo_cv___progname=no])])
if test "$sudo_cv___progname" = "yes"; then if test "$sudo_cv___progname" = "yes"; then
AC_DEFINE(HAVE___PROGNAME) AC_DEFINE(HAVE___PROGNAME)
fi fi
AC_MSG_RESULT($sudo_cv___progname)
SUDO_APPEND_COMPAT_EXP(sudo_getprogname) SUDO_APPEND_COMPAT_EXP(sudo_getprogname)
SUDO_APPEND_COMPAT_EXP(sudo_setprogname) SUDO_APPEND_COMPAT_EXP(sudo_setprogname)
]) ])
dnl dnl
dnl Check for __func__ or __FUNCTION__ dnl Check for __func__ or __FUNCTION__
dnl dnl
AC_MSG_CHECKING([for __func__]) AC_CACHE_CHECK([for __func__], sudo_cv___func__, [
AC_CACHE_VAL(sudo_cv___func__, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[if (__func__[0] == '\0') return 1;]])], [sudo_cv___func__=yes], [sudo_cv___func__=no])]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[if (__func__[0] == '\0') return 1;]])], [sudo_cv___func__=yes], [sudo_cv___func__=no])])
AC_MSG_RESULT($sudo_cv___func__)
if test "$sudo_cv___func__" = "yes"; then if test "$sudo_cv___func__" = "yes"; then
AC_DEFINE(HAVE___FUNC__) AC_DEFINE(HAVE___FUNC__)
elif test -n "$GCC"; then elif test -n "$GCC"; then
AC_MSG_CHECKING([for __FUNCTION__]) AC_CACHE_CHECK([for __FUNCTION__], sudo_cv___FUNCTION__, [
AC_CACHE_VAL(sudo_cv___FUNCTION__, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[if(__FUNCTION__[0] == '\0') return 1;]])], [sudo_cv___FUNCTION__=yes], [sudo_cv___FUNCTION__=no])]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[if(__FUNCTION__[0] == '\0') return 1;]])], [sudo_cv___FUNCTION__=yes], [sudo_cv___FUNCTION__=no])])
AC_MSG_RESULT($sudo_cv___FUNCTION__)
if test "$sudo_cv___FUNCTION__" = "yes"; then if test "$sudo_cv___FUNCTION__" = "yes"; then
AC_DEFINE(HAVE___FUNC__) AC_DEFINE(HAVE___FUNC__)
AC_DEFINE(__func__, __FUNCTION__, [Define to __FUNCTION__ if your compiler supports __FUNCTION__ but not __func__]) AC_DEFINE(__func__, __FUNCTION__, [Define to __FUNCTION__ if your compiler supports __FUNCTION__ but not __func__])

View File

@ -225,16 +225,14 @@ AC_DEFUN([SUDO_LOGDIR], [
dnl dnl
dnl check for working fnmatch(3) dnl check for working fnmatch(3)
dnl dnl
AC_DEFUN([SUDO_FUNC_FNMATCH], AC_DEFUN([SUDO_FUNC_FNMATCH], [
[AC_MSG_CHECKING([for working fnmatch with FNM_CASEFOLD]) AC_CACHE_CHECK([for working fnmatch with FNM_CASEFOLD],
AC_CACHE_VAL(sudo_cv_func_fnmatch, sudo_cv_func_fnmatch, [
[rm -f conftestdata; > conftestdata AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <fnmatch.h>
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <fnmatch.h> int main() { return(fnmatch("/*/bin/echo *", "/usr/bin/echo just a test", FNM_CASEFOLD)); }]])], [sudo_cv_func_fnmatch=yes], [sudo_cv_func_fnmatch=no], [sudo_cv_func_fnmatch=no])
int main() { return(fnmatch("/*/bin/echo *", "/usr/bin/echo just a test", FNM_CASEFOLD)); }]])], [sudo_cv_func_fnmatch=yes], [sudo_cv_func_fnmatch=no], ])
[sudo_cv_func_fnmatch=no]) AS_IF([test $sudo_cv_func_fnmatch = yes], [$1], [$2])
rm -f core core.* *.core]) ])
AC_MSG_RESULT($sudo_cv_func_fnmatch)
AS_IF([test $sudo_cv_func_fnmatch = yes], [$1], [$2])])
dnl dnl
dnl Attempt to check for working PIE support. dnl Attempt to check for working PIE support.
@ -242,16 +240,13 @@ dnl This is a bit of a hack but on Solaris 10 with GNU ld and GNU as
dnl we can end up with strange values from malloc(). dnl we can end up with strange values from malloc().
dnl A better check would be to verify that ASLR works with PIE. dnl A better check would be to verify that ASLR works with PIE.
dnl dnl
AC_DEFUN([SUDO_WORKING_PIE], AC_DEFUN([SUDO_WORKING_PIE], [
[AC_MSG_CHECKING([for working PIE support]) AC_CACHE_CHECK([for working PIE support], sudo_cv_working_pie, [
AC_CACHE_VAL(sudo_cv_working_pie, AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT
[rm -f conftestdata; > conftestdata int main() { char *p = malloc(1024); if (p == NULL) return 1; memset(p, 0, 1024); return 0; }])], [sudo_cv_working_pie=yes], [sudo_cv_working_pie=no], [sudo_cv_working_pie=no])
AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT ])
int main() { char *p = malloc(1024); if (p == NULL) return 1; memset(p, 0, 1024); return 0; }])], [sudo_cv_working_pie=yes], [sudo_cv_working_pie=no], AS_IF([test $sudo_cv_working_pie = yes], [$1], [$2])
[sudo_cv_working_pie=no]) ])
rm -f core core.* *.core])
AC_MSG_RESULT($sudo_cv_working_pie)
AS_IF([test $sudo_cv_working_pie = yes], [$1], [$2])])
dnl dnl
dnl check for isblank(3) dnl check for isblank(3)
@ -399,9 +394,8 @@ dnl only for backward compatibility.
dnl dnl
AC_DEFUN([SUDO_UID_T_LEN], AC_DEFUN([SUDO_UID_T_LEN],
[AC_REQUIRE([AC_TYPE_UID_T]) [AC_REQUIRE([AC_TYPE_UID_T])
AC_MSG_CHECKING(max length of uid_t) AC_CACHE_CHECK([max length of uid_t], sudo_cv_uid_t_len, [
AC_CACHE_VAL(sudo_cv_uid_t_len, rm -f conftestdata
[rm -f conftestdata
AC_RUN_IFELSE([AC_LANG_SOURCE([[ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -423,7 +417,6 @@ int main() {
}]])], [sudo_cv_uid_t_len=`cat conftestdata`], [sudo_cv_uid_t_len=10], [sudo_cv_uid_t_len=10]) }]])], [sudo_cv_uid_t_len=`cat conftestdata`], [sudo_cv_uid_t_len=10], [sudo_cv_uid_t_len=10])
]) ])
rm -f conftestdata rm -f conftestdata
AC_MSG_RESULT($sudo_cv_uid_t_len)
AC_DEFINE_UNQUOTED(MAX_UID_T_LEN, $sudo_cv_uid_t_len, [Define to the max length of a uid_t in string context (excluding the NUL).]) AC_DEFINE_UNQUOTED(MAX_UID_T_LEN, $sudo_cv_uid_t_len, [Define to the max length of a uid_t in string context (excluding the NUL).])
]) ])