mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 09:57:41 +00:00
Fix test for unsetenv() returning void with clang 16.
Clang has dropped support for K&R function definitions so rewrite the test to require a unsetenv() prototype in stdlib.h. Fixes GitHub issue #302.
This commit is contained in:
parent
07003d9020
commit
1eb4392e14
19
configure
vendored
19
configure
vendored
@ -23317,39 +23317,29 @@ printf %s "checking whether unsetenv returns void... " >&6; }
|
||||
if test ${sudo_cv_func_unsetenv_void+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e) if test "$cross_compiling" = yes
|
||||
then :
|
||||
sudo_cv_func_unsetenv_void=no
|
||||
else case e in #(
|
||||
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int unsetenv();
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
return unsetenv("FOO") != 0;
|
||||
return unsetenv("FOO");
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
sudo_cv_func_unsetenv_void=no
|
||||
else case e in #(
|
||||
e) sudo_cv_func_unsetenv_void=yes ;;
|
||||
esac
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
|
||||
esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_func_unsetenv_void" >&5
|
||||
@ -23372,7 +23362,8 @@ else case e in #(
|
||||
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int putenv(const char *string) {return 0;}
|
||||
int putenv(const char *string) {return 0;}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
18
m4/sudo.m4
18
m4/sudo.m4
@ -342,16 +342,12 @@ dnl check unsetenv() return value
|
||||
dnl
|
||||
AC_DEFUN([SUDO_FUNC_UNSETENV_VOID],
|
||||
[AC_CACHE_CHECK([whether unsetenv returns void], [sudo_cv_func_unsetenv_void],
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
||||
[AC_INCLUDES_DEFAULT
|
||||
int unsetenv();
|
||||
], [
|
||||
[return unsetenv("FOO") != 0;]
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [
|
||||
[return unsetenv("FOO");]
|
||||
])
|
||||
],
|
||||
[sudo_cv_func_unsetenv_void=no],
|
||||
[sudo_cv_func_unsetenv_void=yes],
|
||||
[sudo_cv_func_unsetenv_void=no])])
|
||||
[sudo_cv_func_unsetenv_void=yes])])
|
||||
if test $sudo_cv_func_unsetenv_void = yes; then
|
||||
AC_DEFINE(UNSETENV_VOID, 1,
|
||||
[Define to 1 if the 'unsetenv' function returns void instead of 'int'.])
|
||||
@ -362,10 +358,10 @@ dnl
|
||||
dnl check putenv() argument for const
|
||||
dnl
|
||||
AC_DEFUN([SUDO_FUNC_PUTENV_CONST],
|
||||
[AC_CACHE_CHECK([whether putenv takes a const argument],
|
||||
sudo_cv_func_putenv_const,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
|
||||
int putenv(const char *string) {return 0;}], [])],
|
||||
[AC_CACHE_CHECK([whether putenv takes a const argument], [sudo_cv_func_putenv_const],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
|
||||
int putenv(const char *string) {return 0;}
|
||||
], [])],
|
||||
[sudo_cv_func_putenv_const=yes],
|
||||
[sudo_cv_func_putenv_const=no])
|
||||
])
|
||||
|
Loading…
x
Reference in New Issue
Block a user