From 54fe6cef48102c73c5dac3ea15d18eb216c76359 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <craigberry@mac.com>
Date: Sun, 13 Mar 2016 10:20:10 -0500
Subject: [PATCH 4/5] Build with standard stat structure on VMS.

This gets us large file support, is available on any VMS release
in the last decade and more, and gives stat other modern features
such as 64-bit ino_t.
---
 vms/libssh2_make_example.dcl | 3 ++-
 vms/libssh2_make_lib.dcl     | 7 ++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/vms/libssh2_make_example.dcl b/vms/libssh2_make_example.dcl
index d8191f3..af4116d 100644
--- a/vms/libssh2_make_example.dcl
+++ b/vms/libssh2_make_example.dcl
@@ -29,6 +29,7 @@ $ this = f$search("exadir:*.c;0")
 $ if this .eqs. "" then goto EndLoop
 $!
 $ what = f$parse( this,,,"name")
+$ if what .eqs. "x11" then goto loop ! not portable yet
 $ call Make
 $!
 $ goto Loop
@@ -84,7 +85,7 @@ $ define objdir 'objdir'
 $ define exadir 'exadir'
 $!
 $ cc_include = "/include=([],[-.include])"
-$ cc_flags   = "/name=shortened/show=all"
+$ cc_flags   = "/name=shortened/show=all/define=(_USE_STD_STAT=1)"
 $ link_opts  = "objdir:libssh2_''thisid'.opt"
 $!
 $!
diff --git a/vms/libssh2_make_lib.dcl b/vms/libssh2_make_lib.dcl
index 6d8b13b..56d168f 100644
--- a/vms/libssh2_make_lib.dcl
+++ b/vms/libssh2_make_lib.dcl
@@ -46,7 +46,8 @@ $!
 $ define objdir 'objdir'
 $ define srcdir 'srcdir'
 $!
-$ cc_include = "/include=([],[-.include])"
+$ cc_include = "/include=([],[-.include],""/gnv$zlib_include"")"
+$ cc_define = "/DEFINE=(_USE_STD_STAT=1)"
 $ link_opts  = "objdir:libssh2_''thisid'.opt"
 $!
 $ pipe search [-.include]libssh2.h libssh2_version_major/nohead | (read sys$input l ; l = f$element(2," ",f$edit(l,"trim,compress")) ; - 
@@ -137,7 +138,7 @@ $CaseLoop:
 $!
 $ if case .eq. 0 
 $ then!camel case names 
-$   cc_flags = "/names=(shortened,as_is)"
+$   cc_flags = "/names=(shortened,as_is)''cc_define'"
 $   objlib = "libssh2_asis.olb"
 $ endif
 $!
@@ -149,7 +150,7 @@ $      rename [.cxx_repository]cxx$demangler_db.; *.lowercase
 $      purge  [.cxx_repository]cxx$demangler_db.lowercase
 $   endif
 $!
-$   cc_flags = "/names=(shortened)"
+$   cc_flags = "/names=(shortened)''cc_define'"
 $   objlib = "libssh2_up.olb"
 $ endif
 $!
-- 
2.2.1


