1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add fallback implementation for setenv()

This fixes the code compilation on Windows with MSVC and Kerberos, as
a missing implementation of setenv() causes a compilation failure of the
GSSAPI code.  This was only reproducible when building the code with
Kerberos, something that buildfarm animal hamerkop has fixed recently.

This issue only happens on 12 and 13, as this code has been introduced
in b0b39f7.  HEAD is already able to compile properly thanks to
7ca37fb0, and this commit is a minimal cherry-pick of it.

Thanks to Tom Lane for the discussion.

Discussion: https://postgr.es/m/YLDtm5WGjPxm6ua4@paquier.xyz
Backpatch-through: 12
This commit is contained in:
Michael Paquier
2021-06-01 09:27:25 +09:00
parent fe6f63286a
commit e2f21ff606
8 changed files with 80 additions and 3 deletions

19
configure vendored
View File

@ -15858,12 +15858,29 @@ case $host_os in
# Windows uses a specialised env handler
mingw*)
$as_echo "#define HAVE_SETENV 1" >>confdefs.h
$as_echo "#define HAVE_UNSETENV 1" >>confdefs.h
ac_cv_func_setenv=yes
ac_cv_func_unsetenv=yes
;;
*)
ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv"
ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv"
if test "x$ac_cv_func_setenv" = xyes; then :
$as_echo "#define HAVE_SETENV 1" >>confdefs.h
else
case " $LIBOBJS " in
*" setenv.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS setenv.$ac_objext"
;;
esac
fi
ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv"
if test "x$ac_cv_func_unsetenv" = xyes; then :
$as_echo "#define HAVE_UNSETENV 1" >>confdefs.h