[PATCH] Two VMS configuration nits

"Craig A. Berry" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
There are two attached patches.  One avoids a redefinition of a symbol in the VMS-specific Makefile equivalent which bothers one VMS make utility (MMS) but not another (MMK).  The other enables the replacement socketpair for older VMS systems that don’t have their own.  These are against master but should be quite safe for the 0.95 branch as well.

Thanks to Norm Lastovica for problem reports and testing.
________________________________________
Craig A. Berry
mailto:[email protected]

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
0001-Don-t-redefine-CDEFINE-in-vms-descrip_mms.template.patch (application/octet-stream, 1.4 KB)
From 12efa68e360283d68043bb8dba1b1d46098fb553 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <[email protected]>
Date: Thu, 11 Jun 2015 09:42:35 -0500
Subject: [PATCH 1/2] Don't redefine CDEFINE in vms/descrip_mms.template.

MMK was ok with it but MMS wasn't.
---
 vms/descrip_mms.template | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index e344651..e0e0155 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -70,24 +70,25 @@ CC = CC/DECC
 .SUFFIXES :
 .SUFFIXES : $(E) $(OLB) $(OBJ) .C .H
 
+@ENABLE_THREAD_SAFE@
+.IFDEF ENABLE_THREAD_SAFE
+PTHREAD_CDEFINE = ,"_THREAD_SAFE"=1
+PTHREAD_LINK_FLAGS = /THREADS=UPCALLS
+.ELSE
+PTHREAD_CDEFINE =
+PTHREAD_LINK_FLAGS =
+.ENDIF
+
 .IFDEF ODBC
-CDEFINE = "$(TDSVER)","UNIXODBC"
+CDEFINE = "$(TDSVER)","UNIXODBC"$(PTHREAD_CDEFINE)
 CODBCFLAGS = /NAMES=(AS_IS,SHORTENED)
 .ELSE
-CDEFINE = $(TDSVER)
+CDEFINE = $(TDSVER)$(PTHREAD_CDEFINE)
 CODBCFLAGS = /NAMES=SHORTENED
 .ENDIF
 CPREFIX = ALL
 CINCLUDE = "./","./include"$(ODBC_INC)
 
-@ENABLE_THREAD_SAFE@
-.IFDEF ENABLE_THREAD_SAFE
-CDEFINE = $(CDEFINE),"_THREAD_SAFE"=1
-PTHREAD_LINK_FLAGS = /THREADS=UPCALLS
-.ELSE
-PTHREAD_LINK_FLAGS = 
-.ENDIF
-
 .IFDEF __DEBUG__
 CDBGFLAGS = /DEBUG/NOOPTIMIZE/LIST=$(MMS$TARGET_NAME)/SHOW=(EXPANSION,INCLUDE)
 LDBGFLAGS = /DEBUG/MAP
-- 
2.2.1
0002-Use-replacement-socketpair-on-pre-8.2-VMS-systems.patch (application/octet-stream, 3.9 KB)
From 2baf90111ca57d282023cfc673d404bd9d3ebd7c Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <[email protected]>
Date: Thu, 11 Jun 2015 10:51:57 -0500
Subject: [PATCH 2/2] Use replacement socketpair on pre-8.2 VMS systems.

---
 vms/config_h.vms         |  3 ++-
 vms/configure.com        | 22 ++++++++++++++++++++++
 vms/descrip_mms.template |  3 ++-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/vms/config_h.vms b/vms/config_h.vms
index 3f97063..1f731d2 100644
--- a/vms/config_h.vms
+++ b/vms/config_h.vms
@@ -170,7 +170,8 @@
 #undef HAVE_SETHOSTENT_R
 
 /* Define to 1 if you have the `socketpair' function. */
-#if __CRTL_VER >= 80200000
+/* Must be undefined, not defined to 0, when not present. */
+#if @D_SOCKETPAIR@
 #define HAVE_SOCKETPAIR 1
 #endif
 
diff --git a/vms/configure.com b/vms/configure.com
index c58c154..d8aa863 100644
--- a/vms/configure.com
+++ b/vms/configure.com
@@ -52,6 +52,17 @@ $   d_have_iconv = "0"
 $   SAY "Using replacement iconv()"
 $ ENDIF
 $!
+$! Set socketpair (available with VMS 8.2 and later)
+$!
+$ IF F$EXTRACT(1,3,F$EDIT(F$GETSYI("VERSION"),"TRIM")) .GES. "8.2"
+$ THEN
+$   d_socketpair = "1"
+$   SAY "Using system-supplied socketpair()"
+$ ELSE
+$   d_socketpair = "0"
+$   SAY "Using replacement socketpair()"
+$ ENDIF
+$!
 $! Generate config.h
 $!
 $ open/write vmsconfigtmp vmsconfigtmp.com
@@ -73,6 +84,8 @@ $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@D_HAVE_ICONV@"",""''d_have_iconv'"");"
 $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@D_SNPRINTF@"",""''d_snprintf'"");"
+$ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
+$ write vmsconfigtmp "eve_global_replace(""@D_SOCKETPAIR@"",""''d_socketpair'"");"
 $ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");"
 $ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);"
 $ write vmsconfigtmp "quit;"
@@ -119,6 +132,13 @@ $ else
 $   snprintfobj = "[.src.replacements]snprintf$(OBJ),"
 $ endif
 $!
+$ if d_socketpair .eqs. "1"
+$ then
+$   socketpairobj = " "
+$ else
+$   socketpairobj = "[.src.replacements]socketpair$(OBJ),"
+$ endif
+$!
 $ if P1 .eqs. "--disable-thread-safe"
 $ then
 $   enable_thread_safe = " "
@@ -144,6 +164,8 @@ $ write vmsconfigtmp "eve_global_replace(""@LIBICONVOBJ@"",""''libiconvobj'"");"
 $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@SNPRINTFOBJ@"",""''snprintfobj'"");"
 $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
+$ write vmsconfigtmp "eve_global_replace(""@SOCKETPAIROBJ@"",""''socketpairobj'"");"
+$ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@ENABLE_THREAD_SAFE@"",""''enable_thread_safe'"");"
 $ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");"
 $ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);"
diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index e0e0155..2355b4a 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -114,6 +114,7 @@ VASPRINTFOBJ = @VASPRINTFOBJ@
 STRTOK_ROBJ = @STRTOK_ROBJ@
 LIBICONVOBJ = @LIBICONVOBJ@
 SNPRINTFOBJ = @SNPRINTFOBJ@
+SOCKETPAIROBJ = @SOCKETPAIROBJ@
 
 TDSOBJS = [.src.tds]bulk$(OBJ), [.src.tds]challenge$(OBJ), [.src.tds]config$(OBJ), \
 	[.src.tds]convert$(OBJ), [.src.tds]data$(OBJ), [.src.tds]des$(OBJ), [.src.tds]getmac$(OBJ), \
@@ -126,7 +127,7 @@ TDSOBJS = [.src.tds]bulk$(OBJ), [.src.tds]challenge$(OBJ), [.src.tds]config$(OBJ
 	[.src.tds]stream$(OBJ), \
 	[.src.replacements]strlcpy$(OBJ), [.src.replacements]getpassarg$(OBJ), \
 	[.src.replacements]sleep$(OBJ), \
-	$(ASPRINTFOBJ) $(VASPRINTFOBJ) $(SNPRINTFOBJ) $(STRTOK_ROBJ) $(LIBICONVOBJ) \
+	$(ASPRINTFOBJ) $(VASPRINTFOBJ) $(SNPRINTFOBJ) $(STRTOK_ROBJ) $(LIBICONVOBJ) $(SOCKETPAIROBJ) \
 	[.vms]getpass$(OBJ)
 
 CTLIBOBJS = [.src.ctlib]blk$(OBJ), [.src.ctlib]cs$(OBJ), [.src.ctlib]ct$(OBJ), \
-- 
2.2.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.