Skip to Content.
Sympa Menu

freetds - [freetds] [PATCH] VMS build update

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Craig A. Berry" <craigberry AT mac.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] [PATCH] VMS build update
  • Date: Sat, 06 Nov 2004 15:16:43 -0600

The attached patch against last night's snapshot gets it building
cleanly again on VMS. The bulk of it is just building new files
introduced since the last time I updated the VMS-specific build procedures.

There are a couple of other little nits, too: some casting in bsqldb.c
and defncopy.c to quiet my picky compiler, and a small hack in
src/tds/config.c to allow the successful location of SYBASE/interfaces
on VMS.

--- src/apps/bsqldb.c;-0 Fri Nov 5 03:06:46 2004
+++ src/apps/bsqldb.c Sat Nov 6 09:19:38 2004
@@ -132,21 +132,21 @@ main(int argc, char *argv[])
* Override stdin, stdout, and stderr, as required
*/
if (options.input_filename) {
- if (freopen(options.input_filename, "r", stdin) < 0) {
+ if ((int)freopen(options.input_filename, "r", stdin) < 0) {
fprintf(stderr, "%s: unable to open %s: %s\n",
options.appname, options.input_filename, strerror(errno));
exit(1);
}
}

if (options.output_filename) {
- if (freopen(options.output_filename, "w", stdout) < 0) {
+ if ((int)freopen(options.output_filename, "w", stdout) < 0) {
fprintf(stderr, "%s: unable to open %s: %s\n",
options.appname, options.output_filename, strerror(errno));
exit(1);
}
}

if (options.error_filename) {
- if (freopen(options.error_filename, "w", stderr) < 0) {
+ if ((int)freopen(options.error_filename, "w", stderr) < 0) {
fprintf(stderr, "%s: unable to open %s: %s\n",
options.appname, options.error_filename, strerror(errno));
exit(1);
}
@@ -157,7 +157,7 @@ main(int argc, char *argv[])
} else {
static const char null_device[] = "/dev/null";
options.verbose = fopen(null_device, "w");
- if (options.verbose < 0) {
+ if ((int)options.verbose < 0) {
fprintf(stderr, "%s:%d unable to open %s for verbose
operation: %s\n",
options.appname, __LINE__,
null_device, strerror(errno));
exit(1);
--- src/apps/defncopy.c;-0 Fri Nov 5 03:06:46 2004
+++ src/apps/defncopy.c Sat Nov 6 09:42:55 2004
@@ -122,14 +122,14 @@ main(int argc, char *argv[])
* Override stdin, stdout, and stderr, as required
*/
if (options.input_filename) {
- if (freopen(options.input_filename, "r", stdin) < 0) {
+ if ((int)freopen(options.input_filename, "r", stdin) < 0) {
fprintf(stderr, "%s: unable to open %s: %s\n",
options.appname, options.input_filename, strerror(errno));
exit(1);
}
}

if (options.output_filename) {
- if (freopen(options.output_filename, "w", stdout) < 0) {
+ if ((int)freopen(options.output_filename, "w", stdout) < 0) {
fprintf(stderr, "%s: unable to open %s: %s\n",
options.appname, options.output_filename, strerror(errno));
exit(1);
}
@@ -140,7 +140,7 @@ main(int argc, char *argv[])
} else {
static const char null_device[] = "/dev/null";
options.verbose = fopen(null_device, "w");
- if (options.verbose < 0) {
+ if ((int)options.verbose < 0) {
fprintf(stderr, "%s:%d unable to open %s for verbose
operation: %s\n",
options.appname, __LINE__,
null_device, strerror(errno));
exit(1);
--- src/tds/config.c;-0 Tue Nov 2 09:18:47 2004
+++ src/tds/config.c Sat Nov 6 09:12:25 2004
@@ -924,7 +924,12 @@ tds_read_interfaces(const char *server,
*/
if (!founded) {
const char *sybase = getenv("SYBASE");
-
+#ifdef __VMS
+ /* We've got to be in unix syntax for later slash-joined
concatenation. */
+ #include <unixlib.h>
+ const char *unixspec = decc$translate_vms(sybase);
+ if ( (int)unixspec != 0 && (int)unixspec != -1 ) sybase =
unixspec;
+#endif
if (!sybase || !sybase[0])
#ifndef WIN32
sybase = "/etc/freetds";
--- vms/config_h.vms;-0 Sat Jan 3 13:32:05 2004
+++ vms/config_h.vms Sat Nov 6 14:45:48 2004
@@ -28,6 +28,16 @@
#define HAVE_ATOLL 1
#endif

+/* Define to 1 if you have the `basename' function. */
+#ifndef __CRTL_VER
+#define __CRTL_VER __VMS_VER
+#endif
+#if __CRTL_VER >= 70000000
+#define HAVE_BASENAME 1
+#else
+#define HAVE_BASENAME 0
+#endif
+
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1

--- vms/descrip_mms.template;-0 Thu Jan 8 23:25:24 2004
+++ vms/descrip_mms.template Sat Nov 6 11:28:36 2004
@@ -30,6 +30,8 @@

# To build in debug, do MM(K|S)/MACRO="__DEBUG__"=1

+# To build with MSDBLIB-compatbile dblib structures, do
MM(K|S)/MACRO="MSDBLIB"=1
+
.IFDEF TDSVER
.ELSE
TDSVER = TDS50
@@ -57,6 +59,14 @@ DBOPENOBJ = [.src.dblib]dbopen$(OBJ),
DBOPENOBJ =
.ENDIF

+.IFDEF MSDBLIB
+MSDBLIB_DEFINE = define
+MSDBLIB_TRUE = 1
+.ELSE
+MSDBLIB_DEFINE = undef
+MSDBLIB_TRUE =
+.ENDIF
+
CC = CC/DECC

.SUFFIXES :
@@ -64,8 +74,10 @@ CC = CC/DECC

.IFDEF ODBC
CDEFINE = "$(TDSVER)","HAVE_CONFIG_H"=1,"UNIXODBC"
+CODBCFLAGS = /NAMES=AS_IS
.ELSE
CDEFINE = $(TDSVER),HAVE_CONFIG_H=1
+CODBCFLAGS =
.ENDIF
CPREFIX = ALL
CINCLUDE = [],[.include],[.src.tds]$(ODBC_INC)
@@ -78,7 +90,7 @@ CDBGFLAGS =
LDBGFLAGS = /NOTRACE
.ENDIF

-CFLAGS =
/DEFINE=($(CDEFINE))/PREFIX=($(CPREFIX))/FLOAT=IEEE/IEEE=DENORM/NAMES=AS_IS/OBJECT=$(MMS$TARGET_NAME)$(OBJ)
$(CDBGFLAGS)
+CFLAGS =
/DEFINE=($(CDEFINE))/PREFIX=($(CPREFIX))/FLOAT=IEEE/IEEE=DENORM/OBJECT=$(MMS$TARGET_NAME)$(OBJ)
$(CODBCFLAGS) $(CDBGFLAGS)
LINKFLAGS = $(LDBGFLAGS)

.c$(OBJ) :
@@ -102,6 +114,7 @@ TDSOBJS = [.src.tds]challenge$(OBJ), [.s
[.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), \
+ [.src.tds]md5$(OBJ), [.src.tds]net$(OBJ), \
$(ASPRINTFOBJ) $(VASPRINTFOBJ) $(STRTOK_ROBJ) $(LIBICONVOBJ) \
[.vms]getpass$(OBJ)

@@ -193,6 +206,10 @@ $(TDSODBCOBJS) : $(CONFIGS)
@ write vmsconfigtmp
"eve_global_replace(""@tds_sysdep_real32_type@"",""float"");"
@ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
@ write vmsconfigtmp
"eve_global_replace(""@tds_sysdep_real64_type@"",""double"");"
+ @ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
+ @ write vmsconfigtmp
"eve_global_replace(""@tds_sysdep_intptr_type@"",""int"");"
+ @ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));"
+ @ write vmsconfigtmp
"eve_global_replace(""@msdblib_define@"",""#$(MSDBLIB_DEFINE) MSDBLIB
$(MSDBLIB_TRUE)"");"
@ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE,
""output_file"");"
@ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);"
@ write vmsconfigtmp "quit;"
@@ -253,7 +270,7 @@ $(TDSODBCSHR) : []libtdsodbc$(OLB)

# Build the utility programs and the pool server

-apps : freebcp$(E) tsql$(E) tdspool$(E)
+apps : freebcp$(E) tsql$(E) bsqldb$(E) defncopy$(E) tdspool$(E)
@ continue

freebcp$(E) : [.src.apps]freebcp$(OBJ) []libsybdb$(OLB) []libtds$(OLB)
@@ -268,6 +285,16 @@ tsql$(E) : [.src.apps]tsql$(OBJ) []libsy
@ define/nolog/user_mode readline [.include]
$(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE)) $(MMS$SOURCE)

+bsqldb$(E) : [.src.apps]bsqldb$(OBJ) []libsybdb$(OLB) []libtds$(OLB)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE),[]libsybdb$(OLB)/library, []libtds$(OLB)/library
+
+[.src.apps]bsqldb$(OBJ) : [.src.apps]bsqldb.c
+
+defncopy$(E) : [.src.apps]defncopy$(OBJ) []libsybdb$(OLB) []libtds$(OLB)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE),[]libsybdb$(OLB)/library, []libtds$(OLB)/library
+
+[.src.apps]defncopy$(OBJ) : [.src.apps]defncopy.c
+
tdspool$(E) : $(TDSPOOLOBJS) []libtdssrv$(OLB) []libtds$(OLB)
link$(LINKFLAGS)/exe=$(MMS$TARGET) $(TDSPOOLOBJS),
[]libtdssrv$(OLB)/library, []libtds$(OLB)/library

@@ -341,6 +368,7 @@ dblibcheck :
@ run/nodebug []t0023$(E)
@ run/nodebug []rpc$(E)
@ run/nodebug []dbmorecmds$(E)
+ @ run/nodebug []bcp$(E)
@ set default [---]

tdsodbccheck :
@@ -363,12 +391,20 @@ tdsodbccheck :
@ run/nodebug []earlybind$(E)
@ run/nodebug []putdata$(E)
@ run/nodebug []params$(E)
- @ run/nodebug []raiseerror$(E)
+ @ run/nodebug []raiserror$(E)
@ run/nodebug []getdata$(E)
@ run/nodebug []type$(E)
@ run/nodebug []transaction$(E)
@ run/nodebug []genparams$(E)
@ run/nodebug []preperror$(E)
+ @ run/nodebug []prepare_results$(E)
+ @ run/nodebug []testodbc$(E)
+ @ run/nodebug []data$(E)
+ @ run/nodebug []error$(E)
+ @ run/nodebug []rebindpar$(E)
+ @ run/nodebug []convert_error$(E)
+ @ run/nodebug []typeinfo$(E)
+ @ run/nodebug []const_params$(E)
@ set default [---]

buildchecks : libtdstests ctlibtests dblibtests $(ODBCTESTS)
@@ -394,7 +430,7 @@ dblibtests : [.src.dblib.unittests]rpc$(
[.src.dblib.unittests]t0015$(E) [.src.dblib.unittests]t0016$(E)
[.src.dblib.unittests]t0017$(E) \
[.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)
+ [.src.dblib.unittests]dbmorecmds$(E) [.src.dblib.unittests]bcp$(E)
@ continue

odbctests : [.src.odbc.unittests]t0001$(E) [.src.odbc.unittests]t0002$(E)
[.src.odbc.unittests]t0003$(E) \
@@ -403,8 +439,12 @@ odbctests : [.src.odbc.unittests]t0001$(
[.src.odbc.unittests]lang_error$(E) [.src.odbc.unittests]tables$(E) \
[.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]genparams$(E) [.src.odbc.unittests]preperror$(E)
+ [.src.odbc.unittests]raiserror$(E) [.src.odbc.unittests]getdata$(E)
[.src.odbc.unittests]type$(E) \
+ [.src.odbc.unittests]transaction$(E)
[.src.odbc.unittests]genparams$(E) [.src.odbc.unittests]preperror$(E) \
+ [.src.odbc.unittests]prepare_results$(E)
[.src.odbc.unittests]testodbc$(E) \
+ [.src.odbc.unittests]data$(E) [.src.odbc.unittests]error$(E)
[.src.odbc.unittests]rebindpar$(E) \
+ [.src.odbc.unittests]convert_error$(E)
[.src.odbc.unittests]typeinfo$(E) \
+ [.src.odbc.unittests]const_params$(E)
@ continue

# libtds test detailed dependencies
@@ -701,6 +741,12 @@ odbctests : [.src.odbc.unittests]t0001$(
[.src.dblib.unittests]dbmorecmds$(OBJ) : [.src.dblib.unittests]dbmorecmds.c
[.src.dblib.unittests]common.h
$(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)

+[.src.dblib.unittests]bcp$(E) : [.src.dblib.unittests]bcp$(OBJ)
[.src.dblib.unittests]common$(OBJ)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library
+
+[.src.dblib.unittests]bcp$(OBJ) : [.src.dblib.unittests]bcp.c
[.src.dblib.unittests]common.h
+ $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)
+
[.src.dblib.unittests]common$(OBJ) : [.src.dblib.unittests]common.c
[.src.dblib.unittests]common.h
$(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)

@@ -802,10 +848,10 @@ odbctests : [.src.odbc.unittests]t0001$(
[.src.odbc.unittests]params$(OBJ) : [.src.odbc.unittests]params.c
[.src.odbc.unittests]common.h
$(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)

-[.src.odbc.unittests]raiseerror$(E) : [.src.odbc.unittests]raiseerror$(OBJ)
[.src.odbc.unittests]common$(OBJ)
+[.src.odbc.unittests]raiserror$(E) : [.src.odbc.unittests]raiserror$(OBJ)
[.src.odbc.unittests]common$(OBJ)
link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[.vms]libodbc.opt/options

-[.src.odbc.unittests]raiseerror$(OBJ) : [.src.odbc.unittests]raiseerror.c
[.src.odbc.unittests]common.h
+[.src.odbc.unittests]raiserror$(OBJ) : [.src.odbc.unittests]raiserror.c
[.src.odbc.unittests]common.h
$(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)

[.src.odbc.unittests]getdata$(E) : [.src.odbc.unittests]getdata$(OBJ)
[.src.odbc.unittests]common$(OBJ)
@@ -841,6 +887,54 @@ odbctests : [.src.odbc.unittests]t0001$(
[.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)

+[.src.odbc.unittests]prepare_results$(E) :
[.src.odbc.unittests]prepare_results$(OBJ) [.src.odbc.unittests]common$(OBJ)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]prepare_results$(OBJ) :
[.src.odbc.unittests]prepare_results.c [.src.odbc.unittests]common.h
+ $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)
+
+[.src.odbc.unittests]testodbc$(E) : [.src.odbc.unittests]testodbc$(OBJ)
[.src.odbc.unittests]common$(OBJ)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]testodbc$(OBJ) : [.src.odbc.unittests]testodbc.c
[.src.odbc.unittests]common.h
+ $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)
+
+[.src.odbc.unittests]data$(E) : [.src.odbc.unittests]data$(OBJ)
[.src.odbc.unittests]common$(OBJ)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]data$(OBJ) : [.src.odbc.unittests]data.c
[.src.odbc.unittests]common.h
+ $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)
+
+[.src.odbc.unittests]error$(E) : [.src.odbc.unittests]error$(OBJ)
[.src.odbc.unittests]common$(OBJ)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]error$(OBJ) : [.src.odbc.unittests]error.c
[.src.odbc.unittests]common.h
+ $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)
+
+[.src.odbc.unittests]rebindpar$(E) : [.src.odbc.unittests]rebindpar$(OBJ)
[.src.odbc.unittests]common$(OBJ)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]rebindpar$(OBJ) : [.src.odbc.unittests]rebindpar.c
[.src.odbc.unittests]common.h
+ $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)
+
+[.src.odbc.unittests]convert_error$(E) :
[.src.odbc.unittests]convert_error$(OBJ) [.src.odbc.unittests]common$(OBJ)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]convert_error$(OBJ) :
[.src.odbc.unittests]convert_error.c [.src.odbc.unittests]common.h
+ $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)
+
+[.src.odbc.unittests]typeinfo$(E) : [.src.odbc.unittests]typeinfo$(OBJ)
[.src.odbc.unittests]common$(OBJ)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]typeinfo$(OBJ) : [.src.odbc.unittests]typeinfo.c
[.src.odbc.unittests]common.h
+ $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)
+
+[.src.odbc.unittests]const_params$(E) :
[.src.odbc.unittests]const_params$(OBJ) [.src.odbc.unittests]common$(OBJ)
+ link$(LINKFLAGS)/exe=$(MMS$TARGET)
$(MMS$SOURCE_LIST),[.vms]libodbc.opt/options
+
+[.src.odbc.unittests]const_params$(OBJ) :
[.src.odbc.unittests]const_params.c [.src.odbc.unittests]common.h
+ $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE))
$(CDBGFLAGS) $(MMS$SOURCE)
+
# Clean up

distclean :
--- vms/README.vms;-0 Tue May 20 06:34:41 2003
+++ vms/README.vms Sat Nov 6 14:46:39 2004
@@ -48,6 +48,16 @@ Example:
$ MMK/MACRO="TDSVER"="TDS80"


+MSDBLIB
+
+Enables Microsoft behavior in the db-lib API where it diverges from
+Sybase's. See additional documentation in the [.doc] directory.
+
+Example:
+
+ $ MMK/MACRO="MSDBLIB"=1
+
+
ODBC

This macro instructs the build to include ODBC support. At
@@ -92,12 +102,13 @@ As more ODBC functions are implemented,
needs to be updated to point to the real functions instead of the aliases to
the stub for unimplemented functions.

-The build currently compiles with the /NAMES=AS_IS switch, which results in
-mixed-case symbol names. This was necessary to get the code working with
-unixODBC but may cause problems when calling the FreeTDS libraries from
-other languages. There are a variety of approaches that could be taken to
-work around this but for now you'll have to roll your own.
+The build currently compiles with the /NAMES=AS_IS switch when the ODBC
+macro is enabled; this results in mixed-case symbol names. Mixed-case
+symbols were necessary to get the code working with unixODBC but may cause
+problems when calling the FreeTDS libraries from other languages. There
+are a variety of approaches that could be taken to work around this but for
+now you'll have to roll your own.


-Last updated: 2-Feb-2003 Craig A. Berry <craigberry AT mac.com>
+Last updated: 6-NOV-2004 Craig A. Berry <craigberry AT mac.com>
$Id: README.vms,v 1.2 2003/05/20 11:34:41 freddy77 Exp $



Archive powered by MHonArc 2.6.24.

Top of Page