2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +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 :
printf %s "(cached) " >&6
else $as_nop
rm -f conftestdata
rm -f conftestdata
if test "$cross_compiling" = yes
then :
sudo_cv_uid_t_len=10
@ -18638,10 +18639,9 @@ fi
fi
rm -f conftestdata
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_uid_t_len" >&5
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
@ -20771,14 +20771,15 @@ done
fi
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; }
if test ${sudo_cv_func_fnmatch+y}
then :
printf %s "(cached) " >&6
else $as_nop
rm -f conftestdata; > conftestdata
if test "$cross_compiling" = yes
if test "$cross_compiling" = yes
then :
sudo_cv_func_fnmatch=no
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
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" "$sudo_cv_func_fnmatch" >&6; }
if test $sudo_cv_func_fnmatch = yes
if test $sudo_cv_func_fnmatch = yes
then :
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"
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for isblank" >&5
printf %s "checking for isblank... " >&6; }
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 "checking for optreset... " >&6; }
if test ${sudo_cv_optreset+y}
if test ${sudo_cv_optreset+y}
then :
printf %s "(cached) " >&6
else $as_nop
@ -21488,13 +21489,12 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
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
printf "%s\n" "#define HAVE_OPTRESET 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_optreset" >&5
printf "%s\n" "$sudo_cv_optreset" >&6; }
fi
@ -23419,7 +23419,7 @@ else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __progname" >&5
printf %s "checking for __progname... " >&6; }
if test ${sudo_cv___progname+y}
if test ${sudo_cv___progname+y}
then :
printf %s "(cached) " >&6
else $as_nop
@ -23444,13 +23444,12 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
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
printf "%s\n" "#define HAVE___PROGNAME 1" >>confdefs.h
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
COMPAT_EXP="${COMPAT_EXP}${_sym}
@ -23494,7 +23493,6 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv___func__" >&5
printf "%s\n" "$sudo_cv___func__" >&6; }
if test "$sudo_cv___func__" = "yes"; then
@ -23503,7 +23501,7 @@ if test "$sudo_cv___func__" = "yes"; then
elif test -n "$GCC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __FUNCTION__" >&5
printf %s "checking for __FUNCTION__... " >&6; }
if test ${sudo_cv___FUNCTION__+y}
if test ${sudo_cv___FUNCTION__+y}
then :
printf %s "(cached) " >&6
else $as_nop
@ -23528,8 +23526,7 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
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; }
if test "$sudo_cv___FUNCTION__" = "yes"; then
printf "%s\n" "#define HAVE___FUNC__ 1" >>confdefs.h
@ -28831,14 +28828,15 @@ if test x"$ax_cv_check_ldflags___pie" = xyes
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; }
if test ${sudo_cv_working_pie+y}
then :
printf %s "(cached) " >&6
else $as_nop
rm -f conftestdata; > conftestdata
if test "$cross_compiling" = yes
if test "$cross_compiling" = yes
then :
sudo_cv_working_pie=no
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
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" "$sudo_cv_working_pie" >&6; }
if test $sudo_cv_working_pie = yes
if test $sudo_cv_working_pie = yes
then :
enable_pie=yes
fi
fi
if test "$enable_pie" = "yes"; then
PIE_CFLAGS="-fPIE"

View File

@ -2811,13 +2811,11 @@ AC_CHECK_FUNCS([clock_gettime], [], [
AC_CHECK_FUNCS([getopt_long], [], [
AC_LIBOBJ(getopt_long)
SUDO_APPEND_COMPAT_EXP(sudo_getopt_long sudo_getopt_long_only)
AC_MSG_CHECKING([for optreset])
AC_CACHE_VAL(sudo_cv_optreset, [
AC_CACHE_CHECK([for optreset], sudo_cv_optreset, [
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
AC_DEFINE(HAVE_OPTRESET)
fi
AC_MSG_RESULT($sudo_cv_optreset)
])
AC_CHECK_FUNCS([closefrom], [], [AC_LIBOBJ(closefrom)
SUDO_APPEND_COMPAT_EXP(sudo_closefrom)
@ -3253,30 +3251,24 @@ dnl
AC_CHECK_FUNCS([getprogname], [
AC_CHECK_FUNCS([setprogname], [], [SUDO_APPEND_COMPAT_EXP(sudo_setprogname)])
], [
AC_MSG_CHECKING([for __progname])
AC_CACHE_VAL(sudo_cv___progname, [
AC_CACHE_CHECK([for __progname], 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])])
if test "$sudo_cv___progname" = "yes"; then
AC_DEFINE(HAVE___PROGNAME)
fi
AC_MSG_RESULT($sudo_cv___progname)
SUDO_APPEND_COMPAT_EXP(sudo_getprogname)
SUDO_APPEND_COMPAT_EXP(sudo_setprogname)
])
dnl
dnl Check for __func__ or __FUNCTION__
dnl
AC_MSG_CHECKING([for __func__])
AC_CACHE_VAL(sudo_cv___func__, [
AC_CACHE_CHECK([for __func__], sudo_cv___func__, [
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
AC_DEFINE(HAVE___FUNC__)
elif test -n "$GCC"; then
AC_MSG_CHECKING([for __FUNCTION__])
AC_CACHE_VAL(sudo_cv___FUNCTION__, [
AC_CACHE_CHECK([for __FUNCTION__], sudo_cv___FUNCTION__, [
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
AC_DEFINE(HAVE___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 check for working fnmatch(3)
dnl
AC_DEFUN([SUDO_FUNC_FNMATCH],
[AC_MSG_CHECKING([for working fnmatch with FNM_CASEFOLD])
AC_CACHE_VAL(sudo_cv_func_fnmatch,
[rm -f conftestdata; > conftestdata
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])
rm -f core core.* *.core])
AC_MSG_RESULT($sudo_cv_func_fnmatch)
AS_IF([test $sudo_cv_func_fnmatch = yes], [$1], [$2])])
AC_DEFUN([SUDO_FUNC_FNMATCH], [
AC_CACHE_CHECK([for working fnmatch with FNM_CASEFOLD],
sudo_cv_func_fnmatch, [
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])
])
AS_IF([test $sudo_cv_func_fnmatch = yes], [$1], [$2])
])
dnl
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 A better check would be to verify that ASLR works with PIE.
dnl
AC_DEFUN([SUDO_WORKING_PIE],
[AC_MSG_CHECKING([for working PIE support])
AC_CACHE_VAL(sudo_cv_working_pie,
[rm -f conftestdata; > conftestdata
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],
[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])])
AC_DEFUN([SUDO_WORKING_PIE], [
AC_CACHE_CHECK([for working PIE support], sudo_cv_working_pie, [
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], [sudo_cv_working_pie=no])
])
AS_IF([test $sudo_cv_working_pie = yes], [$1], [$2])
])
dnl
dnl check for isblank(3)
@ -399,9 +394,8 @@ dnl only for backward compatibility.
dnl
AC_DEFUN([SUDO_UID_T_LEN],
[AC_REQUIRE([AC_TYPE_UID_T])
AC_MSG_CHECKING(max length of uid_t)
AC_CACHE_VAL(sudo_cv_uid_t_len,
[rm -f conftestdata
AC_CACHE_CHECK([max length of uid_t], sudo_cv_uid_t_len, [
rm -f conftestdata
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.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])
])
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).])
])