patch 9.0.2153: no support to build on OpenVMS

Problem:  no support to build on OpenVMS
Solution: Add OpenVMS X86_64 platform port

closes: #13623

Co-authored-by: errael <errael@raelity.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/INSTALLvms.txt b/src/INSTALLvms.txt
index c235151..97406ab 100644
--- a/src/INSTALLvms.txt
+++ b/src/INSTALLvms.txt
@@ -1,7 +1,7 @@
 INSTALLvms.txt - Installation of Vim on OpenVMS
 
-Maintainer:   Zoltan Arpadffy <arpadffy@polarhome.com>
-Last change:  2008 Jan 06
+Maintainer:   Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
+Last change:  2023 Nov 29
 
 This file contains instructions for compiling Vim on Openvms.
 If you already have an executable version of Vim, you don't need this.
@@ -40,6 +40,9 @@
 
      where X.X is the version number.
 
+You may want to clone the latest source code from https://github/vim/vim
+Or the last tested on OpenVMS from http://polarhome.com/vim/files/source/vms/
+
 1.2. Expand the three archives.
 
 1.3. Apply patches if they exist.  (Patch files are found in the ftp
@@ -81,7 +84,7 @@
 			  NORMAL  - A default selection of features enabled
 				    (OpenVMS default)
 			  HUGE	  - All possible features enabled.
-			  Uncommented - will default to NORMAL
+			  Uncommented - will default to HUGE
 	Default		: MODEL = NORMAL
 
 	Parameter name	: GUI
@@ -117,7 +120,7 @@
 	Default		: CCVER = YES
 
 	Parameter name	: DEBUG
-	Description	: Building a debug version
+	Description	: Building a debug version (DVIM.EXE)
 	Options:	: YES - debug version will be built
 			  Uncommented - building normal executable
 	Default		: Uncommented
@@ -163,6 +166,36 @@
 			  Uncommented - build without support.
 	Default		: Uncommented
 
+	Parameter name	: VIM_RUBY
+	Description	: Add Ruby support
+	Options:	: YES - Build with support
+			  Uncommented - build without support.
+	Default		: Uncommented
+
+	Parameter name	: VIM_LUA
+	Description	: Add Lua support
+	Options:	: YES - Build with support
+			  Uncommented - build without support.
+	Default		: Uncommented     
+
+	Parameter name	: VIM_MZSCHEME
+	Description	: Add support for FEATURE_MZSCHEM
+	Options:	: YES - Build with support
+			  Uncommented - build without FEATURE_MZSCHEM.
+	Default		: Uncommented
+
+	Parameter name	: VIM_ICONV
+	Description	: Build with using the ICONV library 
+	Options:	: YES - Build with support
+			  Uncommented - build without support.
+	Default		: Uncommented     
+
+	Parameter name	: MODIFIED_BY
+	Description	: Add note if you modified the code
+	Options:	: YES - Build with adding the MODIFIED_BY define
+			  Uncommented - build without the define
+	Default		: Uncommented
+
      You can edit the *_INC and *_LIB qualifiers, but it is really
      not recommended for beginners.
 
@@ -184,6 +217,11 @@
 
 	mms /descrip=Make_vms.mms clean
 
+     The build will stop if any error or warning is encontered. In some cases
+     the warnings can be ignored. Use:
+
+     mms /descrip=Make_vms.mms /ignore=warning
+
 4. Compilation VAXC
 
 4.1. VAXC compiler is not fully ANSI C compatible in pre-processor directives
diff --git a/src/Make_vms.mms b/src/Make_vms.mms
index 8dd5454..4c20601 100644
--- a/src/Make_vms.mms
+++ b/src/Make_vms.mms
@@ -2,9 +2,9 @@
 # Makefile for Vim on OpenVMS
 #
 # Maintainer:   Zoltan Arpadffy <arpadffy@polarhome.com>
-# Last change:  2021 Dec 20
+# Last change:  2023 Nov 27
 #
-# This script has been tested on VMS 6.2 to 8.4 on DEC Alpha, VAX and IA64
+# This script has been tested on VMS 6.2 to 9.2 on VAX, ALPHA, IA64 and X86_64
 # with MMS and MMK
 #
 # The following could be built:
@@ -81,7 +81,11 @@
 # VIM_MZSCHEME = YES
 
 # Use ICONV
-# VIM_ICONV  = YES
+# VIM_ICONV = YES
+
+# If you modified the source code and plan to distribute the build
+# please, let the users know that.
+# MODIFIED_BY = "name surname <your@email.com>"
 
 ######################################################################
 # Directory, library and include files configuration section.
@@ -104,12 +108,14 @@
 OPTIMIZE= /noopt
 CCVER	=
 .ENDIF
-.ELSE		     # AXP and IA64 with DECC
+.ELSE		     # AXP, IA64, X86 with DECC
 CC_DEF  = cc
 PREFIX  = /prefix=all/name=(upper,short)
 OPTIMIZE= /opt
+.IFDEF MMSX86_64 # This is needed because of getline function name used in stucts like ex_cmds.h  
+ARCH_DEF= ,__CRTL_VER_OVERRIDE=80400000
 .ENDIF
-
+.ENDIF
 
 LD_DEF  = link
 C_INC   = [.proto]
@@ -162,9 +168,9 @@
 # please note: directory should end with . in order to /trans=conc work
 # This value for GTK_DIR is an example.
 GTK_DIR  = DKA0:[WORK.GTK1210.]
-DEFS     = "HAVE_CONFIG_H","FEAT_GUI_GTK"
+DEFS     = ,"HAVE_CONFIG_H","FEAT_GUI_GTK"
 LIBS     = ,OS_VMS_GTK.OPT/OPT
-GUI_FLAG = /float=ieee/ieee=denorm
+GUI_FLAG = /float=ieee/ieee=denorm/WARNINGS=(DISABLE=MACROREDEF)
 GUI_SRC  = gui.c gui_gtk.c gui_gtk_f.c gui_gtk_x11.c gui_beval.c pty.c
 GUI_OBJ  = gui.obj gui_gtk.obj gui_gtk_f.obj gui_gtk_x11.obj gui_beval.obj pty.obj
 GUI_INC  = ,"/gtk_root/gtk","/gtk_root/glib"
@@ -174,15 +180,15 @@
 .ELSE
 MOTIF	 = YES
 .IFDEF XPM
-DEFS     = "HAVE_CONFIG_H","FEAT_GUI_MOTIF","HAVE_XPM"
+DEFS     = ,"HAVE_CONFIG_H","FEAT_GUI_MOTIF","HAVE_XPM"
 XPM_INC  = ,[.xpm.include]
 XPM_LIB  = ,OS_VMS_XPM.OPT/OPT
 .ELSE
-DEFS     = "HAVE_CONFIG_H","FEAT_GUI_MOTIF"
+DEFS     = ,"HAVE_CONFIG_H","FEAT_GUI_MOTIF"
 XPM_INC  =
 .ENDIF
 LIBS     = ,OS_VMS_MOTIF.OPT/OPT
-GUI_FLAG =
+GUI_FLAG = /WARNINGS=(DISABLE=MACROREDEF)
 GUI_SRC  = gui.c gui_motif.c gui_x11.c gui_beval.c gui_xmdlg.c gui_xmebw.c
 GUI_OBJ  = gui.obj gui_motif.obj gui_x11.obj gui_beval.obj gui_xmdlg.obj gui_xmebw.obj
 GUI_INC  =
@@ -195,7 +201,7 @@
 
 .ELSE
 # Character terminal only executable
-DEFS	 = "HAVE_CONFIG_H"
+DEFS	 = ,"HAVE_CONFIG_H"
 LIBS	 =
 .ENDIF
 
@@ -269,12 +275,18 @@
 XDIFF_OBJ = xdiffi.obj,xemit.obj,xprepare.obj,xutils.obj,xhistogram.obj,xpatience.obj
 XDIFF_INC = ,[.xdiff]
 
+.IFDEF MODIFIED_BY 
+DEF_MODIFIED = YES
+.ELSE
+DEF_MODIFIED = NO
+.ENDIF
+
 ######################################################################
 # End of configuration section.
 # Please, do not change anything below without programming experience.
 ######################################################################
 
-MODEL_DEF = "FEAT_$(MODEL)",
+MODEL_DEF = "FEAT_$(MODEL)"
 
 # These go into pathdef.c
 VIMUSER = "''F$EDIT(F$GETJPI(" ","USERNAME"),"TRIM")'"
@@ -284,7 +296,7 @@
 
 ALL_CFLAGS = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) -
  $(TCL_DEF)$(RUBY_DEF)$(LUA_DEF)$(XIM_DEF)$(TAG_DEF)$(MZSCH_DEF) -
- $(ICONV_DEF)) -
+ $(ICONV_DEF)$(ARCH_DEF)) -
  $(CFLAGS)$(GUI_FLAG) -
  /include=($(C_INC)$(GUI_INC_DIR)$(GUI_INC)$(PERL_INC)$(PYTHON_INC) -
  $(TCL_INC)$(XDIFF_INC)$(XPM_INC))
@@ -295,7 +307,7 @@
 # Otherwise should not be any other difference.
 ALL_CFLAGS_VER = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) -
  $(TCL_DEF)$(RUBY_DEF)$(LUA_DEF)$(XIM_DEF)$(TAG_DEF)$(MZSCH_DEF) -
- $(ICONV_DEF)) -
+ $(ICONV_DEF)$(ARCH_DEF)) -
  $(CFLAGS)$(GUI_FLAG) -
  /include=($(C_INC)$(GUI_INC_DIR)$(GUI_INC_VER)$(PERL_INC)$(PYTHON_INC) -
  $(TCL_INC)$(XDIFF_INC)$(XPM_INC))
@@ -314,6 +326,7 @@
 	buffer.c \
 	bufwrite.c \
 	change.c \
+	channel.c \
 	charset.c \
 	cindent.c \
 	clientserver.c \
@@ -354,6 +367,7 @@
 	if_xcmdsrv.c \
 	indent.c \
 	insexpand.c \
+	job.c \
 	json.c \
 	list.c \
 	locale.c \
@@ -381,6 +395,7 @@
 	popupmenu.c \
 	popupwin.c \
 	profiler.c \
+	pty.c \
 	quickfix.c \
 	regexp.c \
 	register.c \
@@ -390,6 +405,7 @@
 	session.c \
 	sha256.c \
 	sign.c \
+	sound.c \
 	spell.c \
 	spellfile.c \
 	spellsuggest.c \
@@ -397,6 +413,7 @@
 	syntax.c \
 	tag.c \
 	term.c \
+	terminal.c \
 	termlib.c \
 	testing.c \
 	textformat.c \
@@ -439,6 +456,7 @@
 	buffer.obj \
 	bufwrite.obj \
 	change.obj \
+	channel.obj \
 	charset.obj \
 	cindent.obj \
 	clientserver.obj \
@@ -480,6 +498,7 @@
 	if_xcmdsrv.obj \
 	indent.obj \
 	insexpand.obj \
+	job.obj \
 	json.obj \
 	list.obj \
 	locale.obj \
@@ -507,6 +526,7 @@
 	popupmenu.obj \
 	popupwin.obj \
 	profiler.obj \
+	pty.obj \
 	quickfix.obj \
 	regexp.obj \
 	register.obj \
@@ -516,6 +536,7 @@
 	session.obj \
 	sha256.obj \
 	sign.obj \
+	sound.obj \
 	spell.obj \
 	spellfile.obj \
 	spellsuggest.obj \
@@ -523,6 +544,7 @@
 	syntax.obj \
 	tag.obj \
 	term.obj \
+	terminal.obj \
 	termlib.obj \
 	testing.obj \
 	textformat.obj \
@@ -560,6 +582,11 @@
 
 [.auto]config.h : $(CONFIG_H)
 	copy/nolog $(CONFIG_H) [.auto]config.h
+	-@ open/append ac [.auto]config.h
+        -@ hash[0,8]=35
+	-@ quotes[0,8]=34
+        -@ if ""$(DEF_MODIFIED)"" .EQS. "YES" then write ac ''hash',"define MODIFIED_BY ",''quotes',$(MODIFIED_BY),''quotes'
+	-@ close ac
 
 mmk_compat :
 	-@ open/write pd pathdef.c
@@ -772,6 +799,7 @@
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
  errors.h globals.h
+channel.obj : channel.c vim.h [.auto]config.h feature.h
 cindent.obj : cindent.c vim.h [.auto]config.h feature.h os_unix.h \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
@@ -921,6 +949,7 @@
  errors.h globals.h if_mzsch.h
 indent.obj : indent.c vim.h [.auto]config.h feature.h os_unix.h
 insexpand.obj : insexpand.c vim.h [.auto]config.h feature.h os_unix.h
+job.obj : job.c vim.h [.auto]config.h feature.h os_unix.h
 json.obj : json.c vim.h [.auto]config.h feature.h os_unix.h   \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \
  [.proto]gui_beval.pro option.h ex_cmds.h proto.h errors.h globals.h
@@ -1015,6 +1044,7 @@
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
  errors.h globals.h
+pty.obj : pty.c vim.h [.auto]config.h feature.h os_unix.h
 profiler.obj : profiler.c vim.h [.auto]config.h feature.h os_unix.h \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
@@ -1055,6 +1085,7 @@
  ascii.h keymap.h termdefs.h macros.h option.h structs.h regexp.h gui.h \
  beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \
  errors.h globals.h
+sound.obj : sound.c vim.h [.auto]config.h feature.h 
 spell.obj : spell.c vim.h [.auto]config.h feature.h os_unix.h \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
@@ -1081,6 +1112,7 @@
 term.obj : term.c vim.h [.auto]config.h feature.h os_unix.h   \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \
  [.proto]gui_beval.pro option.h ex_cmds.h proto.h errors.h globals.h
+terminal.obj : terminal.c vim.h [.auto]config.h feature.h os_unix.h
 termlib.obj : termlib.c vim.h [.auto]config.h feature.h os_unix.h   \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \
  [.proto]gui_beval.pro option.h ex_cmds.h proto.h errors.h globals.h
diff --git a/src/crypt.c b/src/crypt.c
index d5d216b..09e9011 100644
--- a/src/crypt.c
+++ b/src/crypt.c
@@ -1308,7 +1308,7 @@
     return sodium_init();
 }
 
-    uint32_t
+    UINT32_T
 crypt_sodium_randombytes_random(void)
 {
     return randombytes_random();
diff --git a/src/gui.h b/src/gui.h
index 7bcbfa3..0a1d274 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -12,15 +12,9 @@
 #endif
 
 #ifdef FEAT_GUI_GTK
-# ifdef VMS // undef MIN and MAX because Intrinsic.h redefines them anyway
-#  ifdef MAX
-#   undef MAX
-#  endif
-#  ifdef MIN
-#   undef MIN
-#  endif
+# ifdef VMS
 #  include "gui_gtk_vms.h"
-# endif // VMS
+# endif
 # include <X11/Intrinsic.h>
 # pragma GCC diagnostic push
 # pragma GCC diagnostic ignored "-Wstrict-prototypes"
diff --git a/src/macros.h b/src/macros.h
index cc2d11f..caacd3a 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -278,6 +278,10 @@
      static inline int isnan(double x)
 	{ return x != x; }
 #   endif
+#   if defined(VMS) && defined(X86_64)
+     static inline int isinf(double x)
+        { return !isnan(x) && !finite(x); }
+#   endif
 #   ifndef HAVE_ISINF
      static inline int isinf(double x)
 	{ return !isnan(x) && isnan(x - x); }
diff --git a/src/map.c b/src/map.c
index 98785e7..b7bb46c 100644
--- a/src/map.c
+++ b/src/map.c
@@ -3114,7 +3114,7 @@
 		    {
 			if (p[0] != ',')
 			{
-			    snprintf(args->os_errbuf, args->os_errbuflen,
+			    vim_snprintf(args->os_errbuf, args->os_errbuflen,
 				    _(e_langmap_extra_characters_after_semicolon_str),
 				    p);
 			    return args->os_errbuf;
diff --git a/src/optionstr.c b/src/optionstr.c
index d8e22c0..ad1dc81 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -233,7 +233,7 @@
 {
     if (errbuf == NULL)
 	return "";
-    snprintf((char *)errbuf, errbuflen, _(e_illegal_character_str),
+    vim_snprintf((char *)errbuf, errbuflen, _(e_illegal_character_str),
 		    (char *)transchar(c));
     return errbuf;
 }
@@ -1541,7 +1541,7 @@
 	    {
 		if (args->os_errbuf != NULL)
 		{
-		    snprintf((char *)args->os_errbuf, args->os_errbuflen,
+		    vim_snprintf((char *)args->os_errbuf, args->os_errbuflen,
 			    _(e_illegal_character_after_chr), *--s);
 		    return args->os_errbuf;
 		}
@@ -4069,7 +4069,7 @@
 	    {
 		if (args->os_errbuf != NULL)
 		{
-		    snprintf(args->os_errbuf, args->os_errbuflen,
+		    vim_snprintf(args->os_errbuf, args->os_errbuflen,
 			    _(e_missing_number_after_angle_str_angle),
 			    transchar_byte(*(s - 1)));
 		    errmsg = args->os_errbuf;
diff --git a/src/os_vms_conf.h b/src/os_vms_conf.h
index 7de117c..c1e1ea1 100644
--- a/src/os_vms_conf.h
+++ b/src/os_vms_conf.h
@@ -1,7 +1,14 @@
 /*
  * os_vms_conf.h.  Replaces auto/config.h for VMS
+ *
  */
 
+#if defined(__VMS) || defined(__vms)
+#if !defined(VMS)
+#define VMS
+#endif
+#endif
+
 #define CASE_INSENSITIVE_FILENAME   // Open VMS is case insensitive
 #define SPACE_IN_FILENAME	    // There could be space between user and passwd
 #define FNAME_ILLEGAL "|*#?%"       // Illegal characters in a file name
@@ -25,9 +32,6 @@
 // Define when __DATE__ " " __TIME__ can be used
 #define HAVE_DATE_TIME
 
-// Defined to the size of an int
-#define VIM_SIZEOF_INT  4
-
 // #undef USEBCOPY
 #define USEMEMMOVE
 // #undef USEMEMCPY
@@ -138,8 +142,11 @@
 #undef  HAVE_LSTAT
 #undef  HAVE_STDINT_H
 
+// Default features
+#define FEAT_IPV6
+
 // Hardware specific
-#ifdef  VAX
+#if defined(__VAX) || defined(VAX)
 #undef  HAVE_GETTIMEOFDAY
 #undef  HAVE_USLEEP
 #undef  HAVE_STRCASECMP
@@ -148,27 +155,39 @@
 #undef  HAVE_ISNAN
 #undef  HAVE_XOS_R_H
 #define HAVE_NO_LONG_LONG
+#define VIM_SIZEOF_INT  4
 #define VIM_SIZEOF_LONG 4
 #define LONG_LONG_MIN  (-2147483647-1)
 #define LONG_LONG_MAX  (2147483647)
 #define ULONG_LONG_MAX (4294967295U)
-#else // AXP and IA64
+
+#else // ALPHA, IA64, X86_64
 #define HAVE_GETTIMEOFDAY
 #define HAVE_USLEEP
 #define HAVE_STRCASECMP
 #define HAVE_STRINGS_H
 #define HAVE_SIGSETJMP
 #define HAVE_ISNAN
-#define HAVE_XOS_R_H
-#define HAVE_NO_LONG_LONG
+#undef  HAVE_XOS_R_H
+#undef  HAVE_NO_LONG_LONG
+#define VIM_SIZEOF_INT  4
 #define VIM_SIZEOF_LONG 8
 #define LONG_LONG_MIN  (-9223372036854775807-1)
 #define LONG_LONG_MAX  (9223372036854775807)
 #define ULONG_LONG_MAX (18446744073709551615U)
+
+#if defined(__x86_64) || defined(__x86_64__)
+#if !defined(X86_64)
+#define X86_64
+#endif
+#define HAVE_ISNAN
+#define HAVE_ISINF
+#define HAVE_XOS_R_H
+#endif
 #endif
 
 // Compiler specific
-#ifdef  VAXC
+#if defined(VAXC) || defined(__VAXC)
 #undef  HAVE_SELECT
 #undef  HAVE_FCNTL_H
 #undef  HAVE_UNISTD_H
@@ -202,7 +221,7 @@
 #define XUSE_MTSAFE_API
 #define HAVE_X11
 #define WANT_X11
-#ifdef HAVE_XPM
+#ifdef  HAVE_XPM
 #define HAVE_X11_XPM_H
 #endif
 #define USE_FONTSET
diff --git a/src/proto/crypt.pro b/src/proto/crypt.pro
index e3ef693..f710800 100644
--- a/src/proto/crypt.pro
+++ b/src/proto/crypt.pro
@@ -30,5 +30,5 @@
 int crypt_sodium_munlock(void *const addr, const size_t len);
 void crypt_sodium_randombytes_buf(void *const buf, const size_t size);
 int crypt_sodium_init(void);
-uint32_t crypt_sodium_randombytes_random(void);
+UINT32_T crypt_sodium_randombytes_random(void);
 /* vim: set ft=c : */
diff --git a/src/term.c b/src/term.c
index b414e42..0fdb33e 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2983,7 +2983,7 @@
     OUT_STR(tgoto((char *)T_CDL, 0, line_count));
 }
 
-#if defined(UNIX) || defined(PROTO)
+#if defined(UNIX) || defined(VMS) || defined(PROTO)
     void
 term_enable_mouse(int enable)
 {
diff --git a/src/version.c b/src/version.c
index 86505b1..dc39b5c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2153,
+/**/
     2152,
 /**/
     2151,
diff --git a/src/vim.h b/src/vim.h
index 7d0d128..2d5ae99 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -439,7 +439,12 @@
  * The vimlong_T has sizeof(vimlong_T) >= 2 * sizeof(int).
  * One use is simple handling of overflow in int calculations.
  */
+#if defined(VMS) && defined(VAX)
+// unsupported compiler
+typedef long      vimlong_T;
+#else
 typedef long long vimlong_T;
+#endif
 
 #ifndef UNIX		    // For Unix this is included in os_unix.h
 # include <stdio.h>
@@ -499,6 +504,10 @@
 # include <wctype.h>
 #endif
 #include <stdarg.h>
+// older compilers do not define va_copy
+#ifndef va_copy
+# define va_copy(dst, src)	((dst) = (src))
+#endif
 
 // for offsetof()
 #include <stddef.h>
diff --git a/src/xdiff/xmacros.h b/src/xdiff/xmacros.h
index f58cf08..028ca6e 100644
--- a/src/xdiff/xmacros.h
+++ b/src/xdiff/xmacros.h
@@ -24,7 +24,7 @@
 #define XMACROS_H
 
 
-#ifdef __hpux
+#if defined(__hpux) || defined(VMS)
 # ifndef SIZE_MAX
 #  define SIZE_MAX ((size_t)(-1))
 # endif