[freetds] [PATCH] VMS update for 0.62

Craig A. Berry craigberry at mac.com
Sat Jan 3 11:02:54 EST 2004


The attached patch gets the VMS port ready for the 0.62 release.
Configuration now detects whether the necessary conversions are
available for the system-supplied iconv, and if not, it uses the
homegrown replacement. There are a number of small bug fixes to the
build procedure and updates to build new files (e.g., utf8_2.c). The
files affected by the patch are all in the vms/ directory so there is no
risk to other platforms.




-------------- next part --------------
--- vms/configure.com;-0	Tue May 20 06:34:41 2003
+++ vms/configure.com	Fri Jan  2 19:04:02 2004
@@ -34,6 +34,20 @@
 $ versionstring = f$element(1, "=", f$edit(versionline, "COLLAPSE"))
 $ gosub check_crtl
 $!
+$! The system-supplied iconv() is fine, but unless the internationalization
+$! kit has been installed, we may not have the conversions we need.  Check
+$! for their presence and use the homegrown iconv() if necessary.
+$!
+$ IF F$SEARCH("SYS$I18N_ICONV:UCS-2_ISO8859-1.ICONV") .NES. "" -
+    .AND. F$SEARCH("SYS$I18N_ICONV:ISO8859-1_UCS-2.ICONV") .NES. ""
+$ THEN
+$   d_have_iconv = "1"
+$   SAY "Using system-supplied iconv()"
+$ ELSE
+$   d_have_iconv = "0"
+$   SAY "Using replacement iconv()"
+$ ENDIF
+$!
 $! Generate config.h
 $!
 $ open/write vmsconfigtmp vmsconfigtmp.com
@@ -51,6 +65,8 @@
 $ write vmsconfigtmp "eve_global_replace(""@D_STRTOK_R@"",""''d_strtok_r'"");"
 $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@VERSION@"",""""""''versionstring'"""""");"
+$ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
+$ write vmsconfigtmp "eve_global_replace(""@D_HAVE_ICONV@"",""''d_have_iconv'"");"
 $ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");"
 $ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);"
 $ write vmsconfigtmp "quit;"
@@ -67,21 +83,29 @@
 $ else
 $   asprintfobj = "[.src.replacements]asprintf$(OBJ),"
 $ endif
-$
+$!
 $ if d_vasprintf .eqs. "1" 
 $ then
 $   vasprintfobj = " "
 $ else
 $   vasprintfobj = "[.src.replacements]vasprintf$(OBJ),"
 $ endif
-$
+$!
 $ if d_strtok_r .eqs. "1" 
 $ then
 $   strtok_robj = " "
 $ else
 $   strtok_robj = "[.src.replacements]strtok_r$(OBJ),"
 $ endif
-$
+$!
+$ if d_have_iconv .eqs. "1" 
+$ then
+$   libiconvobj = " "
+$ else
+$   libiconvobj = "[.src.replacements]libiconv$(OBJ),"
+$   copy/noconfirm/nolog [.src.replacements]iconv.c [.src.replacements]libiconv.c
+$ endif
+$!
 $ open/write vmsconfigtmp vmsconfigtmp.com
 $ write vmsconfigtmp "$ define/user_mode/nolog SYS$OUTPUT _NLA0:"
 $ write vmsconfigtmp "$ edit/tpu/nodisplay/noinitialization -"
@@ -95,6 +119,8 @@
 $ write vmsconfigtmp "eve_global_replace(""@VASPRINTFOBJ@"",""''vasprintfobj'"");"
 $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
 $ write vmsconfigtmp "eve_global_replace(""@STRTOK_ROBJ@"",""''strtok_robj'"");"
+$ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
+$ write vmsconfigtmp "eve_global_replace(""@LIBICONVOBJ@"",""''libiconvobj'"");"
 $ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");"
 $ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);"
 $ write vmsconfigtmp "quit;"
--- vms/config_h.vms;-0	Fri Dec  5 16:00:59 2003
+++ vms/config_h.vms	Fri Jan  2 22:23:15 2004
@@ -98,7 +98,7 @@
 #define HAVE_GETUID 1
 
 /* Define if you have the iconv() function. */
-#define HAVE_ICONV 1
+#define HAVE_ICONV @D_HAVE_ICONV@
 
 /* Define to 1 if you have a 64-bit integral type. */
 #define HAVE_INT64 1
@@ -182,10 +182,14 @@
 #define HAVE_VASPRINTF @D_VASPRINTF@
 
 /* Define to 1 if you have the `vsnprintf' function. */
-#undef HAVE_VSNPRINTF
+#define HAVE_VSNPRINTF 0
 
 /* Define as const if the declaration of iconv() needs const. */
-#define ICONV_CONST
+#if HAVE_ICONV
+#  define ICONV_CONST
+#else
+#  define ICONV_CONST const
+#endif
 
 /* Define to value of INADDR_NONE if not provided by your system header files.
    */
@@ -264,6 +268,8 @@
 #include <limits.h>
 #define MAXPATHLEN PATH_MAX
 
+#define _PATH_DEVNULL "_NLA0:"
+
 /* FIXME: There are numerous signed/unsigned mismatches in the code
  * that should really be corrected, but this hushes the compiler for now.
  */
@@ -287,9 +293,21 @@
 #pragma extern_prefix "freetds_" (strtok_r)
 #endif /* !HAVE_STRTOK_R */
 
+#pragma extern_prefix restore
+
+#define tds_sysdep_intptr_type int	/* 32-bit int */
+
+#include <stddef.h> /* we need size_t for replacements */
 #include "replacements.h"
 
-#pragma extern_prefix restore
+/* If the CRTL ever complies with UNIX98 and defines socklen_t in
+ * sys/socket.h, this _may_ prevent a conflicting definition but
+ * still get us what we need in the meantime.
+ */
+#if !defined __SOCKLEN_T
+#   define __SOCKLEN_T 1
+    typedef __size_t socklen_t;
+#endif
 
 /* We only support unixODBC, so we do have this */
 #define HAVE_SQLGETPRIVATEPROFILESTRING 1
--- vms/descrip_mms.template;-0	Fri Dec  5 16:00:59 2003
+++ vms/descrip_mms.template	Fri Jan  2 19:04:03 2004
@@ -71,7 +71,7 @@
 CINCLUDE = [],[.include],[.src.tds]$(ODBC_INC)
 
 .IFDEF __DEBUG__
-CDBGFLAGS = /DEBUG/NOOPTIMIZE/LIST/SHOW=ALL
+CDBGFLAGS = /DEBUG/NOOPTIMIZE/LIST=$(MMS$TARGET_NAME)/SHOW=ALL
 LDBGFLAGS = /DEBUG/MAP
 .ELSE
 CDBGFLAGS =
@@ -93,6 +93,7 @@
 ASPRINTFOBJ = @ASPRINTFOBJ@
 VASPRINTFOBJ = @VASPRINTFOBJ@
 STRTOK_ROBJ = @STRTOK_ROBJ@
+LIBICONVOBJ = @LIBICONVOBJ@
 
 TDSOBJS = [.src.tds]challenge$(OBJ), [.src.tds]config$(OBJ), [.src.tds]convert$(OBJ), \
 	[.src.tds]data$(OBJ), [.src.tds]des$(OBJ), [.src.tds]getmac$(OBJ), \
@@ -101,7 +102,7 @@
 	[.src.tds]query$(OBJ), [.src.tds]read$(OBJ), [.src.tds]tdsstring$(OBJ), \
 	[.src.tds]threadsafe$(OBJ), [.src.tds]token$(OBJ), [.src.tds]util$(OBJ), \
 	[.src.tds]vstrbuild$(OBJ), [.src.tds]write$(OBJ), \
-	$(ASPRINTFOBJ) $(VASPRINTFOBJ) $(STRTOK_ROBJ) \
+	$(ASPRINTFOBJ) $(VASPRINTFOBJ) $(STRTOK_ROBJ) $(LIBICONVOBJ) \
 	[.vms]getpass$(OBJ)
 
 CTLIBOBJS = [.src.ctlib]blk$(OBJ), [.src.ctlib]cs$(OBJ), [.src.ctlib]ct$(OBJ), \
@@ -115,17 +116,19 @@
 TDSPOOLOBJS = [.src.pool]config$(OBJ), [.src.pool]main$(OBJ), [.src.pool]member$(OBJ), \
 	[.src.pool]stream$(OBJ), [.src.pool]user$(OBJ), [.src.pool]util$(OBJ)
 
-TDSODBCOBJS = [.src.odbc]connectparams$(OBJ), [.src.odbc]convert_sql2string$(OBJ), \
+TDSODBCOBJS = [.src.odbc]connectparams$(OBJ), \
 	[.src.odbc]convert_tds2sql$(OBJ), [.src.odbc]descriptor$(OBJ), [.src.odbc]error$(OBJ), \
 	[.src.odbc]native$(OBJ), [.src.odbc]odbc$(OBJ), [.src.odbc]odbc_checks$(OBJ), \
 	[.src.odbc]odbc_util$(OBJ) [.src.odbc]prepare_query$(OBJ), [.src.odbc]sql2tds$(OBJ)
 
 # This is the top-level target
 
-all : []libtds$(OLB) []libct$(OLB) []libsybdb$(OLB) []libtdssrv$(OLB) \
-		$(TDSODBCSHR) buildchecks apps
+all : []libtds$(OLB) []libct$(OLB) []libsybdb$(OLB) []libtdssrv$(OLB) $(TDSODBCSHR) buildchecks apps
 	@ write sys$output " "
-	@ write sys$output " Everything is up to date.  '$(MMS)$(MMSQUALIFIERS) check' to run test suite."
+        @ QUALIFIERS := $(MMSQUALIFIERS)
+        @ QUALIFIERS = QUALIFIERS - """" - """"
+        @ write sys$output " "
+        @ write sys$output " Everything is up to date. '$(MMS)''QUALIFIERS' check' to run test suite."
 
 
 # Configuration dependencies
@@ -141,6 +144,24 @@
 
 $(TDSSRVOBJS) : $(CONFIGS)
 
+[.src.pool]config$(OBJ) : [.src.pool]config.c
+	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
+	
+[.src.pool]main$(OBJ) : [.src.pool]main.c
+	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
+	
+[.src.pool]member$(OBJ) : [.src.pool]member.c
+	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
+	
+[.src.pool]stream$(OBJ) : [.src.pool]stream.c
+	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
+	
+[.src.pool]user$(OBJ) : [.src.pool]user.c
+	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
+	
+[.src.pool]util$(OBJ) : [.src.pool]util.c
+	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
+	
 $(TDSPOOLOBJS) : $(CONFIGS)
 
 $(TDSODBCOBJS) : $(CONFIGS)
@@ -190,6 +211,25 @@
 	@ write historyh "void add_history(const char *s);"
 	@ close historyh
 
+# Work around MMS bug that confuses these with files in different
+# directories having the same names.
+
+[.src.tds]util$(OBJ) : [.src.tds]util.c
+
+[.src.tds]config$(OBJ) : [.src.tds]config.c
+
+[.src.tds]convert$(OBJ) : [.src.tds]convert.c
+
+[.src.dblib]rpc$(OBJ) : [.src.dblib]rpc.c
+
+[.src.tds]login$(OBJ) : [.src.tds]login.c
+
+[.src.server]login$(OBJ) : [.src.server]login.c
+
+[.src.tds]query$(OBJ) : [.src.tds]query.c
+
+[.src.server]query$(OBJ) : [.src.server]query.c
+
 # Build the libraries
 
 []libtds$(OLB) : libtds$(OLB)( $(TDSOBJS) )
@@ -214,43 +254,23 @@
 # Build the utility programs and the pool server
 
 apps : freebcp$(E) tsql$(E) tdspool$(E)
+	@ continue
 
 freebcp$(E) : [.src.apps]freebcp$(OBJ) []libsybdb$(OLB) []libtds$(OLB)
-	link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE),[]libsybdb$(OLB)/library, \ 
-		[]libtds$(OLB)/library
+	link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE),[]libsybdb$(OLB)/library, []libtds$(OLB)/library
 
 [.src.apps]freebcp$(OBJ) : [.src.apps]freebcp.c
 
 tsql$(E) : [.src.apps]tsql$(OBJ) []libsybdb$(OLB) []libtds$(OLB)
-	link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE),[]libsybdb$(OLB)/library, \
-		[]libtds$(OLB)/library
+	link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE),[]libsybdb$(OLB)/library, []libtds$(OLB)/library
 
 [.src.apps]tsql$(OBJ) : [.src.apps]tsql.c
 	@ define/nolog/user_mode readline [.include]
 	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE)) $(MMS$SOURCE)
 
 tdspool$(E) : $(TDSPOOLOBJS) []libtdssrv$(OLB) []libtds$(OLB)
-	link$(LINKFLAGS)/exe=$(MMS$TARGET) $(TDSPOOLOBJS), \
-		[]libtdssrv$(OLB)/library, []libtds$(OLB)/library
+	link$(LINKFLAGS)/exe=$(MMS$TARGET) $(TDSPOOLOBJS), []libtdssrv$(OLB)/library, []libtds$(OLB)/library
 
-[.src.pool]config$(OBJ) : [.src.pool]config.c
-	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
-	
-[.src.pool]main$(OBJ) : [.src.pool]main.c
-	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
-	
-[.src.pool]member$(OBJ) : [.src.pool]member.c
-	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
-	
-[.src.pool]stream$(OBJ) : [.src.pool]stream.c
-	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
-	
-[.src.pool]user$(OBJ) : [.src.pool]user.c
-	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
-	
-[.src.pool]util$(OBJ) : [.src.pool]util.c
-	$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE)
-	
 # Run the test suite
 
 check : buildchecks PWD libtdscheck ctlibcheck dblibcheck $(tdsodbccheck)
@@ -276,6 +296,7 @@
 	@ run/nodebug []dataread$(E)
 	@ run/nodebug []flags$(E)
 	@ run/nodebug []utf8_1$(E)
+	@ run/nodebug []utf8_2$(E)
 	@ set default [---]
 
 
@@ -347,19 +368,24 @@
 	@ run/nodebug []getdata$(E)
 	@ run/nodebug []type$(E)
 	@ run/nodebug []transaction$(E)
+	@ run/nodebug []genparams$(E)
+	@ run/nodebug []preperror$(E)
 	@ set default [---]
 
 buildchecks : libtdstests ctlibtests dblibtests $(ODBCTESTS)
+	@ continue
 
 libtdstests : [.src.tds.unittests]dynamic1$(E) [.src.tds.unittests]t0001$(E) [.src.tds.unittests]t0002$(E) \
 	[.src.tds.unittests]t0003$(E) [.src.tds.unittests]t0004$(E) [.src.tds.unittests]t0005$(E) \
 	[.src.tds.unittests]t0006$(E) [.src.tds.unittests]t0007$(E) [.src.tds.unittests]t0008$(E) \
 	[.src.tds.unittests]convert$(E) [.src.tds.unittests]dataread$(E) [.src.tds.unittests]flags$(E) \
-	[.src.tds.unittests]utf8_1$(E)
+	[.src.tds.unittests]utf8_1$(E) [.src.tds.unittests]utf8_2$(E)
+	@ continue
 
 ctlibtests : [.src.ctlib.unittests]t0001$(E) [.src.ctlib.unittests]t0002$(E) [.src.ctlib.unittests]t0003$(E) \
 	[.src.ctlib.unittests]t0004$(E) [.src.ctlib.unittests]t0005$(E) [.src.ctlib.unittests]t0006$(E) \
 	[.src.ctlib.unittests]t0007$(E) [.src.ctlib.unittests]t0008$(E) [.src.ctlib.unittests]t0009$(E)
+	@ continue
 
 dblibtests : [.src.dblib.unittests]rpc$(E)  [.src.dblib.unittests]t0001$(E) [.src.dblib.unittests]t0002$(E) \
 	[.src.dblib.unittests]t0003$(E) [.src.dblib.unittests]t0004$(E) [.src.dblib.unittests]t0005$(E) \
@@ -370,6 +396,7 @@
 	[.src.dblib.unittests]t0018$(E) [.src.dblib.unittests]t0019$(E) [.src.dblib.unittests]t0020$(E) \
 	[.src.dblib.unittests]t0021$(E) [.src.dblib.unittests]t0022$(E) [.src.dblib.unittests]t0023$(E) \
 	[.src.dblib.unittests]dbmorecmds$(E)
+	@ continue
 
 odbctests : [.src.odbc.unittests]t0001$(E) [.src.odbc.unittests]t0002$(E) [.src.odbc.unittests]t0003$(E) \
 	[.src.odbc.unittests]t0004$(E) [.src.odbc.unittests]connect$(E) [.src.odbc.unittests]print$(E) \
@@ -378,7 +405,8 @@
 	[.src.odbc.unittests]binary_test$(E) [.src.odbc.unittests]moreandcount$(E) \
 	[.src.odbc.unittests]earlybind$(E) [.src.odbc.unittests]putdata$(E) [.src.odbc.unittests]params$(E) \
 	[.src.odbc.unittests]raiseerror$(E) [.src.odbc.unittests]getdata$(E) [.src.odbc.unittests]type$(E) \
-	[.src.odbc.unittests]transaction$(E) 
+	[.src.odbc.unittests]transaction$(E) [.src.odbc.unittests]genparams$(E) [.src.odbc.unittests]preperror$(E) 
+	@ continue
 
 # libtds test detailed dependencies
 
@@ -463,6 +491,12 @@
 [.src.tds.unittests]utf8_1$(OBJ) : [.src.tds.unittests]utf8_1.c
 	$(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE)
 
+[.src.tds.unittests]utf8_2$(E) : [.src.tds.unittests]utf8_2$(OBJ) [.src.tds.unittests]common$(OBJ)
+	link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library
+
+[.src.tds.unittests]utf8_2$(OBJ) : [.src.tds.unittests]utf8_2.c
+	$(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE)
+
 # ctlib test detailed dependencies
 
 [.src.ctlib.unittests]t0001$(E) : [.src.ctlib.unittests]t0001$(OBJ) [.src.ctlib.unittests]common$(OBJ)
@@ -802,6 +836,17 @@
 [.src.odbc.unittests]common$(OBJ) : [.src.odbc.unittests]common.c [.src.odbc.unittests]common.h
 	$(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE)
 
+[.src.odbc.unittests]genparams$(E) : [.src.odbc.unittests]genparams$(OBJ) [.src.odbc.unittests]common$(OBJ)
+	link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]genparams$(OBJ) : [.src.odbc.unittests]genparams.c [.src.odbc.unittests]common.h
+	$(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE)
+
+[.src.odbc.unittests]preperror$(E) : [.src.odbc.unittests]preperror$(OBJ) [.src.odbc.unittests]common$(OBJ)
+	link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]preperror$(OBJ) : [.src.odbc.unittests]preperror.c [.src.odbc.unittests]common.h
+	$(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE)
 
 # Clean up
 
@@ -822,4 +867,5 @@
 	@ if f$search("[]descrip.mms") .nes. "" then delete/noconfirm []descrip.mms;*
 	@ if f$search("[.include]freetds_sysconfdir.h") .nes. "" then delete/noconfirm [.include]freetds_sysconfdir.h;*
 	@ if f$search("[.include]tds_sysdep_public.h") .nes. "" then delete/noconfirm [.include]tds_sysdep_public.h;*
+	@ if f$search("[.src.replacements]libiconv.c") .nes. "" then delete/noconfirm [.src.replacements]libiconv.c;*
 


More information about the FreeTDS mailing list