1
0
forked from aniani/vim

patch 8.2.0594: MS-Windows: cannot build with WINVER set to 0x0501

Problem:    MS-Windows: cannot build with WINVER set to 0x0501.
Solution:   Only use inet_ntop() when available. (Ozaki Kiichi, closes #5946)
This commit is contained in:
Bram Moolenaar
2020-04-18 18:24:18 +02:00
parent a494f56f88
commit b6fb0516ec
7 changed files with 35 additions and 9 deletions

View File

@@ -625,6 +625,9 @@ endif
ifeq ($(CHANNEL),yes) ifeq ($(CHANNEL),yes)
DEFINES += -DFEAT_JOB_CHANNEL -DFEAT_IPV6 DEFINES += -DFEAT_JOB_CHANNEL -DFEAT_IPV6
ifeq ($(shell expr "$(WINVER)" \>= 0x600),1)
DEFINES += -DHAVE_INET_NTOP
endif
endif endif
ifeq ($(TERMINAL),yes) ifeq ($(TERMINAL),yes)

View File

@@ -317,6 +317,10 @@ MSVCRT_NAME = vcruntime$(MSVCRT_VER)
CPU = ix86 CPU = ix86
!endif !endif
### Set the default $(WINVER) to make it work with VC++7.0 (VS.NET)
!ifndef WINVER
WINVER = 0x0501
!endif
# Flag to turn on Win64 compatibility warnings for VC7.x and VC8. # Flag to turn on Win64 compatibility warnings for VC7.x and VC8.
WP64CHECK = /Wp64 WP64CHECK = /Wp64
@@ -468,6 +472,9 @@ SOUND_LIB = winmm.lib
CHANNEL_PRO = proto/channel.pro CHANNEL_PRO = proto/channel.pro
CHANNEL_OBJ = $(OBJDIR)/channel.obj CHANNEL_OBJ = $(OBJDIR)/channel.obj
CHANNEL_DEFS = -DFEAT_JOB_CHANNEL -DFEAT_IPV6 CHANNEL_DEFS = -DFEAT_JOB_CHANNEL -DFEAT_IPV6
! if $(WINVER) >= 0x600
CHANNEL_DEFS = $(CHANNEL_DEFS) -DHAVE_INET_NTOP
! endif
NETBEANS_LIB = WSock32.lib Ws2_32.lib NETBEANS_LIB = WSock32.lib Ws2_32.lib
!endif !endif
@@ -493,11 +500,6 @@ CON_LIB = oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib \
CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib
!endif !endif
### Set the default $(WINVER) to make it work with VC++7.0 (VS.NET)
!ifndef WINVER
WINVER = 0x0501
!endif
# If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal # If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal
# default, use these lines. # default, use these lines.
#VIMRCLOC = somewhere #VIMRCLOC = somewhere

11
src/auto/configure vendored
View File

@@ -7872,6 +7872,17 @@ $as_echo "$vim_cv_ipv6_networking" >&6; }
if test "x$vim_cv_ipv6_networking" = "xyes"; then if test "x$vim_cv_ipv6_networking" = "xyes"; then
$as_echo "#define FEAT_IPV6 1" >>confdefs.h $as_echo "#define FEAT_IPV6 1" >>confdefs.h
for ac_func in inet_ntop
do :
ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop"
if test "x$ac_cv_func_inet_ntop" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_INET_NTOP 1
_ACEOF
fi
done
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } $as_echo_n "checking for gethostbyname in -lnsl... " >&6; }

View File

@@ -998,7 +998,9 @@ channel_open(
{ {
const char *dst = hostname; const char *dst = hostname;
const void *src = NULL; const void *src = NULL;
# ifdef HAVE_INET_NTOP
char buf[NUMBUFLEN]; char buf[NUMBUFLEN];
# endif
if (addr->ai_family == AF_INET6) if (addr->ai_family == AF_INET6)
{ {
@@ -1014,12 +1016,16 @@ channel_open(
sai->sin_port = htons(port); sai->sin_port = htons(port);
src = &sai->sin_addr; src = &sai->sin_addr;
} }
# ifdef HAVE_INET_NTOP
if (src != NULL) if (src != NULL)
{ {
dst = inet_ntop(addr->ai_family, src, buf, sizeof(buf)); dst = inet_ntop(addr->ai_family, src, buf, sizeof(buf));
if (dst != NULL && STRCMP(hostname, dst) != 0) if (dst == NULL)
dst = hostname;
else if (STRCMP(hostname, dst) != 0)
ch_log(channel, "Resolved %s to %s", hostname, dst); ch_log(channel, "Resolved %s to %s", hostname, dst);
} }
# endif
ch_log(channel, "Trying to connect to %s port %d", dst, port); ch_log(channel, "Trying to connect to %s port %d", dst, port);

View File

@@ -174,6 +174,7 @@
#undef HAVE_GETTIMEOFDAY #undef HAVE_GETTIMEOFDAY
#undef HAVE_GETWD #undef HAVE_GETWD
#undef HAVE_ICONV #undef HAVE_ICONV
#undef HAVE_INET_NTOP
#undef HAVE_LOCALTIME_R #undef HAVE_LOCALTIME_R
#undef HAVE_LSTAT #undef HAVE_LSTAT
#undef HAVE_MEMSET #undef HAVE_MEMSET

View File

@@ -2077,6 +2077,7 @@ if test "$enable_channel" = "yes"; then
if test "x$vim_cv_ipv6_networking" = "xyes"; then if test "x$vim_cv_ipv6_networking" = "xyes"; then
AC_DEFINE(FEAT_IPV6) AC_DEFINE(FEAT_IPV6)
AC_CHECK_FUNCS(inet_ntop)
else else
dnl On Solaris we need the nsl library. dnl On Solaris we need the nsl library.
AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(nsl, gethostbyname)

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
594,
/**/ /**/
593, 593,
/**/ /**/