mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-28 04:47:42 +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}
|
if test ${sudo_cv_func_unsetenv_void+y}
|
||||||
then :
|
then :
|
||||||
printf %s "(cached) " >&6
|
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 #(
|
else case e in #(
|
||||||
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
$ac_includes_default
|
$ac_includes_default
|
||||||
int unsetenv();
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return unsetenv("FOO") != 0;
|
return unsetenv("FOO");
|
||||||
|
|
||||||
;
|
;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_run "$LINENO"
|
if ac_fn_c_try_compile "$LINENO"
|
||||||
then :
|
then :
|
||||||
sudo_cv_func_unsetenv_void=no
|
sudo_cv_func_unsetenv_void=no
|
||||||
else case e in #(
|
else case e in #(
|
||||||
e) sudo_cv_func_unsetenv_void=yes ;;
|
e) sudo_cv_func_unsetenv_void=yes ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
|
||||||
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_func_unsetenv_void" >&5
|
{ 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
|
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
$ac_includes_default
|
$ac_includes_default
|
||||||
int putenv(const char *string) {return 0;}
|
int putenv(const char *string) {return 0;}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
|
18
m4/sudo.m4
18
m4/sudo.m4
@ -342,16 +342,12 @@ dnl check unsetenv() return value
|
|||||||
dnl
|
dnl
|
||||||
AC_DEFUN([SUDO_FUNC_UNSETENV_VOID],
|
AC_DEFUN([SUDO_FUNC_UNSETENV_VOID],
|
||||||
[AC_CACHE_CHECK([whether unsetenv returns void], [sudo_cv_func_unsetenv_void],
|
[AC_CACHE_CHECK([whether unsetenv returns void], [sudo_cv_func_unsetenv_void],
|
||||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [
|
||||||
[AC_INCLUDES_DEFAULT
|
[return unsetenv("FOO");]
|
||||||
int unsetenv();
|
|
||||||
], [
|
|
||||||
[return unsetenv("FOO") != 0;]
|
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
[sudo_cv_func_unsetenv_void=no],
|
[sudo_cv_func_unsetenv_void=no],
|
||||||
[sudo_cv_func_unsetenv_void=yes],
|
[sudo_cv_func_unsetenv_void=yes])])
|
||||||
[sudo_cv_func_unsetenv_void=no])])
|
|
||||||
if test $sudo_cv_func_unsetenv_void = yes; then
|
if test $sudo_cv_func_unsetenv_void = yes; then
|
||||||
AC_DEFINE(UNSETENV_VOID, 1,
|
AC_DEFINE(UNSETENV_VOID, 1,
|
||||||
[Define to 1 if the 'unsetenv' function returns void instead of 'int'.])
|
[Define to 1 if the 'unsetenv' function returns void instead of 'int'.])
|
||||||
@ -362,10 +358,10 @@ dnl
|
|||||||
dnl check putenv() argument for const
|
dnl check putenv() argument for const
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN([SUDO_FUNC_PUTENV_CONST],
|
AC_DEFUN([SUDO_FUNC_PUTENV_CONST],
|
||||||
[AC_CACHE_CHECK([whether putenv takes a const argument],
|
[AC_CACHE_CHECK([whether putenv takes a const argument], [sudo_cv_func_putenv_const],
|
||||||
sudo_cv_func_putenv_const,
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
|
||||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
|
int putenv(const char *string) {return 0;}
|
||||||
int putenv(const char *string) {return 0;}], [])],
|
], [])],
|
||||||
[sudo_cv_func_putenv_const=yes],
|
[sudo_cv_func_putenv_const=yes],
|
||||||
[sudo_cv_func_putenv_const=no])
|
[sudo_cv_func_putenv_const=no])
|
||||||
])
|
])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user