[PATCH] assorted VMS build fixes

"Craig A. Berry" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
I tested 1.0rc1 on VMS and we weren’t far off but a few things were needed to build.  Patches attached and commit messages here inline for convenience:

commit 93304ab677b3da08b2818e6e67fd211759c65ee9
Author: Craig A. Berry <[email protected]>
Date:   Thu Apr 21 16:56:57 2016 -0500

    Be careful cleaning up .map files in VMS build.

    We were cleaning up linker map files in the whole build directory
    tree, but there are now .map files in the documentation that we
    should leave alone.

commit fe7ea92c4fd1547d3bd1f4d5c18cb82989c486a5
Author: Craig A. Berry <[email protected]>
Date:   Thu Apr 21 16:54:42 2016 -0500

    Build sec_negotiate and strlcat replacements on VMS.

commit 2698e4111ca463bebc0760311387aa5e804a2b04
Author: Craig A. Berry <[email protected]>
Date:   Thu Apr 21 16:50:03 2016 -0500

    Make TDSVER optional on VMS as on other platforms.

commit 97853e13221e7ec47a2f1715f7008e51fc078dc3
Author: Craig A. Berry <[email protected]>
Date:   Thu Apr 21 16:47:39 2016 -0500

    Daemonize based on HAVE_FORK, not _WIN32.

    Because fork() is the missing feature and VMS is also missing it.

commit 01b82baa85a5318524e2a210e4983df8b725c5b9
Author: Craig A. Berry <[email protected]>
Date:   Thu Apr 21 16:46:03 2016 -0500

    Meet boolean expectations with boolean expressions in pool.

    We were sending pointers as booleans, which a picky compiler may
    warn about.



________________________________________
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-Meet-boolean-expectations-with-boolean-expressions-i.patch (application/octet-stream, 1 KB)
From 01b82baa85a5318524e2a210e4983df8b725c5b9 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <[email protected]>
Date: Thu, 21 Apr 2016 16:46:03 -0500
Subject: [PATCH 1/5] Meet boolean expectations with boolean expressions in
 pool.

We were sending pointers as booleans, which a picky compiler may
warn about.
---
 src/pool/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pool/main.c b/src/pool/main.c
index 62d91d2..2cca075 100644
--- a/src/pool/main.c
+++ b/src/pool/main.c
@@ -120,9 +120,9 @@ pool_init(const char *name)
 		fprintf(stderr, "%s\n", err);
 		exit(EXIT_FAILURE);
 	}
-	check_field(name, pool->user,   "user");
-	check_field(name, pool->server, "server");
-	check_field(name, pool->port,   "port");
+	check_field(name, pool->user != NULL,   "user");
+	check_field(name, pool->server != NULL, "server");
+	check_field(name, pool->port != 0,   "port");
 
 	if (pool->max_open_conn < pool->min_open_conn) {
 		fprintf(stderr, "Max connections less than minimum\n");
-- 
2.2.1
0002-Daemonize-based-on-HAVE_FORK-not-_WIN32.patch (application/octet-stream, 1.1 KB)
From 97853e13221e7ec47a2f1715f7008e51fc078dc3 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <[email protected]>
Date: Thu, 21 Apr 2016 16:47:39 -0500
Subject: [PATCH 2/5] Daemonize based on HAVE_FORK, not _WIN32.

Because fork() is the missing feature and VMS is also missing it.
---
 src/pool/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pool/main.c b/src/pool/main.c
index 2cca075..d645276 100644
--- a/src/pool/main.c
+++ b/src/pool/main.c
@@ -366,7 +366,7 @@ int
 main(int argc, char **argv)
 {
 	int opt;
-#ifndef _WIN32
+#ifdef HAVE_FORK
 	bool daemonize = false;
 #  define DAEMON_OPT "d"
 #else
@@ -386,7 +386,7 @@ main(int argc, char **argv)
 		case 'l':
 			logfile_name = optarg;
 			break;
-#ifndef _WIN32
+#ifdef HAVE_FORK
 		case 'd':
 			daemonize = true;
 			break;
@@ -401,7 +401,7 @@ main(int argc, char **argv)
 		return EXIT_FAILURE;
 	}
 	pool = pool_init(argv[optind]);
-#ifndef _WIN32
+#ifdef HAVE_FORK
 	if (daemonize) {
 		if (daemon(0, 0) < 0) {
 			fprintf(stderr, "Failed to daemonize %s\n", argv[0]);
-- 
2.2.1
0003-Make-TDSVER-optional-on-VMS-as-on-other-platforms.patch (application/octet-stream, 2.4 KB)
From 2698e4111ca463bebc0760311387aa5e804a2b04 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <[email protected]>
Date: Thu, 21 Apr 2016 16:50:03 -0500
Subject: [PATCH 3/5] Make TDSVER optional on VMS as on other platforms.

---
 vms/descrip_mms.template | 45 +++++++++++++++++++++++++++++++++++----------
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index d8caa32..9863dfe 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -20,8 +20,8 @@
 
 # OpenVMS description file for FreeTDS
 
-# To override default TDS version of 5.0 specify /MACRO="TDSVER=TDSxx"
-# where xx is one of 42, 46, 50, 70, or 80.
+# To override default TDS version of "auto" specify /MACRO="TDSVER=TDSxx=1"
+# where xx is one of 42, 46, 50, 70, 71, 72, 73, or 74.
 
 # To build with ODBC support do MM(K|S)/MACRO="ODBC"=1
 # This presupposes the existence of an ODBC library in the location pointed to
@@ -32,10 +32,6 @@
 
 # To build with MSDBLIB-compatbile dblib structures, do MM(K|S)/MACRO="MSDBLIB"=1
 
-.IFDEF TDSVER
-.ELSE
-TDSVER = TDS50
-.ENDIF
 
 OBJ = .OBJ
 E = .EXE
@@ -72,20 +68,49 @@ CC = CC/DECC
 
 @ENABLE_THREAD_SAFE@
 .IFDEF ENABLE_THREAD_SAFE
-PTHREAD_CDEFINE = ,"_THREAD_SAFE"=1
+PTHREAD_CDEFINE = "_THREAD_SAFE"=1
 PTHREAD_LINK_FLAGS = /THREADS=UPCALLS
 .ELSE
 PTHREAD_CDEFINE =
 PTHREAD_LINK_FLAGS =
 .ENDIF
 
+CDEFINE =
+
+.IFDEF TDSVER
+CDEFINE = $(TDSVER)
+.ENDIF
+
 .IFDEF ODBC
-CDEFINE = "$(TDSVER)","UNIXODBC"$(PTHREAD_CDEFINE)
+ODBC_CDEFINE = "UNIXODBC"
 CODBCFLAGS = /NAMES=(AS_IS,SHORTENED)
 .ELSE
-CDEFINE = $(TDSVER)$(PTHREAD_CDEFINE)
+ODBC_CDEFINE =
 CODBCFLAGS = /NAMES=SHORTENED
 .ENDIF
+
+.IFDEF ODBC_CDEFINE
+.IFDEF CDEFINE
+CDEFINE = $(CDEFINE),$(ODBC_CDEFINE)
+.ELSE
+CDEFINE = $(ODBC_CDEFINE)
+.ENDIF
+.ENDIF
+
+.IFDEF PTHREAD_CDEFINE
+.IFDEF CDEFINE
+CDEFINE = $(CDEFINE),$(PTHREAD_CDEFINE)
+.ELSE
+CDEFINE = $(PTHREAD_CDEFINE)
+.ENDIF
+.ENDIF
+
+.IFDEF CDEFINE
+CDEFINE_QUAL = /DEFINE=($(CDEFINE))
+.ELSE
+CDEFINE_QUAL =
+.ENDIF
+
 CPREFIX = ALL
 CINCLUDE = "./","./include"$(ODBC_INC)
 
@@ -97,7 +122,7 @@ CDBGFLAGS =
 LDBGFLAGS = /NOTRACE
 .ENDIF
 
-CFLAGS = /DEFINE=($(CDEFINE))/PREFIX=($(CPREFIX))/FLOAT=IEEE/IEEE=DENORM/OBJECT=$(MMS$TARGET_NAME)$(OBJ) $(CODBCFLAGS) $(CDBGFLAGS)
+CFLAGS = $(CDEFINE_QUAL)/PREFIX=($(CPREFIX))/FLOAT=IEEE/IEEE=DENORM/OBJECT=$(MMS$TARGET_NAME)$(OBJ) $(CODBCFLAGS) $(CDBGFLAGS)
 LINKFLAGS = $(LDBGFLAGS)$(PTHREAD_LINK_FLAGS)
 
 .c$(OBJ) :
-- 
2.2.1
0004-Build-sec_negotiate-and-strlcat-replacements-on-VMS.patch (application/octet-stream, 1.2 KB)
From fe7ea92c4fd1547d3bd1f4d5c18cb82989c486a5 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <[email protected]>
Date: Thu, 21 Apr 2016 16:54:42 -0500
Subject: [PATCH 4/5] Build sec_negotiate and strlcat replacements on VMS.

---
 vms/descrip_mms.template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index 9863dfe..ade2e4b 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -149,9 +149,9 @@ TDSOBJS = [.src.tds]bulk$(OBJ), [.src.tds]challenge$(OBJ), [.src.tds]config$(OBJ
 	[.src.tds]threadsafe$(OBJ), [.src.tds]token$(OBJ), [.src.tds]util$(OBJ), \
 	[.src.tds]vstrbuild$(OBJ), [.src.tds]write$(OBJ), [.src.tds]md5$(OBJ), \
 	[.src.tds]net$(OBJ), [.src.tds]tls$(OBJ), [.src.tds]log$(OBJ), [.src.tds]packet$(OBJ), \
-	[.src.tds]stream$(OBJ), [.src.tds]random$(OBJ), \
+	[.src.tds]stream$(OBJ), [.src.tds]random$(OBJ), [.src.tds]sec_negotiate$(OBJ), \
 	[.src.replacements]strlcpy$(OBJ), [.src.replacements]getpassarg$(OBJ), \
-	[.src.replacements]sleep$(OBJ), \
+	[.src.replacements]sleep$(OBJ), [.src.replacements]strlcat$(OBJ), \
 	$(ASPRINTFOBJ) $(VASPRINTFOBJ) $(SNPRINTFOBJ) $(STRTOK_ROBJ) $(LIBICONVOBJ) $(SOCKETPAIROBJ) \
 	[.vms]getpass$(OBJ)
 
-- 
2.2.1
0005-Be-careful-cleaning-up-.map-files-in-VMS-build.patch (application/octet-stream, 1.3 KB)
From 93304ab677b3da08b2818e6e67fd211759c65ee9 Mon Sep 17 00:00:00 2001
From: "Craig A. Berry" <[email protected]>
Date: Thu, 21 Apr 2016 16:56:57 -0500
Subject: [PATCH 5/5] Be careful cleaning up .map files in VMS build.

We were cleaning up linker map files in the whole build directory
tree, but there are now .map files in the documentation that we
should leave alone.
---
 vms/descrip_mms.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index ade2e4b..63a7f4d 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -1513,7 +1513,7 @@ odbctests : [.src.odbc.unittests]t0001$(E) [.src.odbc.unittests]t0002$(E) [.src.
 distclean :
 	@ if f$search("[...]*$(OBJ)") .nes. "" then delete/noconfirm [...]*$(OBJ);*
 	@ if f$search("[...]*.LIS") .nes. "" then delete/noconfirm [...]*.LIS;*
-	@ if f$search("[...]*.MAP") .nes. "" then delete/noconfirm [...]*.MAP;*
+	@ if f$search("[...]*.MAP") .nes. "" then delete/noconfirm [...]*.MAP;*/exclude=[.doc...]*.MAP
 	@ if f$search("[...unittests]*$(E)") .nes. "" then delete/noconfirm [...unittests]*$(E);*
 	@ if f$search("[.src.odbc._libs]*$(E)") .nes. "" then delete/noconfirm [.src.odbc._libs]*$(E);*
 	@ if f$search("[...unittests]*.ini") .nes. "" then delete/noconfirm [...unittests]*.ini;*
-- 
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.