pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Unix build
7+ messages / 3 participants
[nested] [flat]

* Unix build
@ 2002-10-07 19:24  Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Eisentraut @ 2002-10-07 19:24 UTC (permalink / raw)
  To: pgsql-odbc

I managed to find a Libtool version that works, so here's the
independent build infrastructure for ODBC on Unix.

The patch also removes all the non-multibyte code.  This goes together
with the build system change, because there no longer is a way to turn
on multibyte explicitly.  You should make the required changes to the
Windows build files.

The following files need to be checked into CVS: configure.ac and
Makefile.am.  GNUmakefile can be removed.  I recommend that you do not
check in all the files generated by auto* (see below).  It can get
pretty messy to keep track of them.

* Prerequisites

Autoconf 2.52 or higher
Automake 1.6.* (Lower versions are rejected, version 1.7 untested.)
Libtool 1.4.2a (CVS from stable branch, maybe 1.4.2 works as well)
PostgreSQL source tree (7.3 branch)

* Bootstrapping

First, copy libtool.m4 into source directory.  Be sure to pick the one
from the right Libtool version.  Then run

aclocal -I . -I $PGSRC/config
libtoolize --force --copy
autoconf
autoheader
automake --add-missing --copy

You can run 'make maintainer-clean' to remove all the files this generates.

* Building

./configure
make
make install

configure has the same options that the PostgreSQL configure used to
have for ODBC, namely --with-iodbc, --with-unixodbc, and
--with-odbcinst=DIR.

* Version Number

The previous build infrastructure set a shared library version number
of 0.27.  I've used this as a package version number, but it does not
correspond to version.h in any way.  This needs to be thought out.

* Making a Source Distribution

'make dist' makes a file psqlodbc-0.27.tar.gz.  It's even better to
use 'make distcheck', which runs a number of tests to see if the
distribution is internally consistent.

The distribution does not contain any Windows-specific files (*.def,
maybe others).  If it is desired to include them, edit Makefile.am.

-- 
Peter Eisentraut   peter_e@gmx.net

Attachments:

odbc-patch (text/plain, 20.1K) download diff -Pru ../cvs-psqlodbc/Makefile.am ./Makefile.am --- ../cvs-psqlodbc/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ ./Makefile.am 2002-10-02 10:42:08.000000000 +0200 @@ -0,0 +1,52 @@ +#------------------------------------------------------------------------- +# +# Makefile.am for psqlodbc (PostgreSQL ODBC driver) +# +# $Header$ +# +#------------------------------------------------------------------------- + +AUTOMAKE_OPTIONS = 1.6 foreign + +lib_LTLIBRARIES = psqlodbc.la + +psqlodbc_la_LDFLAGS = -module -no-undefined -avoid-version + +psqlodbc_la_SOURCES = \ + info.c bind.c columninfo.c connection.c convert.c drvconn.c \ + environ.c execute.c lobj.c win_md5.c misc.c options.c \ + pgtypes.c psqlodbc.c qresult.c results.c socket.c parse.c \ + statement.c tuple.c tuplelist.c dlg_specific.c odbcapi.c \ + multibyte.c \ + gpps.c + +psqlodbc_la_SOURCES += \ + bind.h columninfo.h connection.h convert.h descriptor.h \ + dlg_specific.h environ.h gpps.h iodbc.h isql.h isqlext.h \ + lobj.h md5.h misc.h multibyte.h pgapifunc.h pgtypes.h \ + psqlodbc.h qresult.h resource.h socket.h statement.h tuple.h \ + tuplelist.h version.h + +EXTRA_psqlodbc_la_SOURCES = md5.c + +if with_unixodbc +psqlodbc_la_LIBADD = -lodbcinst +else +if with_iodbc +psqlodbc_la_LIBADD = -liodbcinst +else +AM_CPPFLAGS = -DODBCINSTDIR='"$(odbcinst_ini_dir)"' +endif +endif + +dist_pkgdata_DATA = odbc.sql odbc-drop.sql +BUILT_SOURCES = odbc-drop.sql + +EXTRA_DIST = license.txt notice.txt readme.txt odbcinst.ini libtool.m4 +MAINTAINERCLEANFILES = odbc-drop.sql \ + Makefile.in config.guess config.h.in config.sub configure \ + install-sh missing mkinstalldirs aclocal.m4 ltmain.sh \ + libtool.m4 depcomp + +$(srcdir)/odbc-drop.sql: $(srcdir)/odbc.sql + sed -n '/^CREATE OR REPLACE FUNCTION/s/CREATE OR REPLACE FUNCTION \([^ (][^ (]*([^)]*)\).*/DROP FUNCTION \1;/p' $(srcdir)/odbc.sql >$(srcdir)/odbc-drop.sql diff -Pru ../cvs-psqlodbc/configure.ac ./configure.ac --- ../cvs-psqlodbc/configure.ac 1970-01-01 01:00:00.000000000 +0100 +++ ./configure.ac 2002-10-07 14:03:05.000000000 +0200 @@ -0,0 +1,47 @@ +# Process this file with autoconf to produce a configure script. +AC_INIT(psqlodbc, 0.27, [pgsql-odbc@postgresql.org]) +AC_PREREQ(2.52) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([bind.c]) +AM_CONFIG_HEADER([config.h]) +AM_MAINTAINER_MODE + + +PGAC_ARG_BOOL(with, unixodbc, no, + [ --with-unixodbc build ODBC driver for unixODBC], + [AC_DEFINE(WITH_UNIXODBC, 1, + [Define to 1 to build with unixODBC support (--with-unixodbc)])]) + +PGAC_ARG_BOOL(with, iodbc, no, + [ --with-iodbc build ODBC driver for iODBC], + [AC_DEFINE(WITH_IODBC, 1, + [Define to 1 to build with iODBC support (--with-iodbc)])]) + +if test "$with_unixodbc" = yes && test "$with_iodbc" = yes; then + AC_MSG_ERROR([ODBC driver cannot be built for both unixODBC and iODBC]) +fi + +AM_CONDITIONAL(with_unixodbc, [test $with_unixodbc = yes]) +AM_CONDITIONAL(with_iodbc, [test $with_iodbc = yes]) + +# Allow for overriding the default location of the odbcinst.ini +# file which is normally ${sysconfdir} (i.e., ${prefix}/etc). +PGAC_ARG_REQ(with, odbcinst, + [ --with-odbcinst=DIR default directory for odbcinst.ini [sysconfdir]], + [odbcinst_ini_dir=$withval], + [odbcinst_ini_dir="\${sysconfdir}"]) +AC_SUBST([odbcinst_ini_dir]) + +AC_PROG_CC + +AC_LIBTOOL_WIN32_DLL +AC_DISABLE_STATIC +AC_LIBTOOL_DLOPEN +AC_PROG_LIBTOOL + +AC_CHECK_HEADERS([locale.h]) +AC_CHECK_TYPES(uint8) +PGAC_VAR_INT_TIMEZONE + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff -Pru ../cvs-psqlodbc/connection.c ./connection.c --- ../cvs-psqlodbc/connection.c 2002-09-23 10:08:20.000000000 +0200 +++ ./connection.c 2002-09-30 16:18:08.000000000 +0200 @@ -30,9 +30,7 @@ #include "lobj.h" #include "dlg_specific.h" -#ifdef MULTIBYTE #include "multibyte.h" -#endif #include "pgapifunc.h" #include "md5.h" @@ -294,10 +292,8 @@ rv->result_uncommitted = 0; rv->schema_support = 0; rv->isolation = SQL_TXN_READ_COMMITTED; -#ifdef MULTIBYTE rv->client_encoding = NULL; rv->server_encoding = NULL; -#endif /* MULTIBYTE */ rv->current_schema = NULL; @@ -502,14 +498,12 @@ self->status = CONN_NOT_CONNECTED; self->transact_status = CONN_IN_AUTOCOMMIT; CC_conninfo_init(&(self->connInfo)); -#ifdef MULTIBYTE if (self->client_encoding) free(self->client_encoding); self->client_encoding = NULL; if (self->server_encoding) free(self->server_encoding); self->server_encoding = NULL; -#endif /* MULTIBYTE */ if (self->current_schema) free(self->current_schema); self->current_schema = NULL; @@ -623,10 +617,7 @@ char msgbuffer[ERROR_MSG_LENGTH]; char salt[5], notice[512]; static char *func = "CC_connect"; - -#ifdef MULTIBYTE char *encoding; -#endif /* MULTIBYTE */ mylog("%s: entering...\n", func); @@ -654,7 +645,6 @@ ci->drivers.bools_as_char, TABLE_NAME_STORAGE_LEN); -#ifdef MULTIBYTE encoding = check_client_encoding(ci->conn_settings); if (encoding && strcmp(encoding, "OTHER")) self->client_encoding = strdup(encoding); @@ -670,11 +660,6 @@ ci->drivers.extra_systable_prefixes, ci->drivers.conn_settings, encoding ? encoding : ""); -#else - qlog(" extra_systable_prefixes='%s', conn_settings='%s'\n", - ci->drivers.extra_systable_prefixes, - ci->drivers.conn_settings); -#endif if (self->status != CONN_NOT_CONNECTED) { @@ -960,7 +945,6 @@ /* * Multibyte handling is available ? */ -#ifdef MULTIBYTE if (PG_VERSION_GE(self, 6.4)) { CC_lookup_characterset(self); @@ -1002,7 +986,6 @@ return 0; } #endif /* UNICODE_SUPPORT */ -#endif /* MULTIBYTE */ ci->updatable_cursors = 0; #ifdef DRIVER_CURSOR_IMPLEMENT if (!ci->drivers.use_declarefetch && diff -Pru ../cvs-psqlodbc/connection.h ./connection.h --- ../cvs-psqlodbc/connection.h 2002-09-23 10:08:20.000000000 +0200 +++ ./connection.h 2002-10-02 10:51:57.000000000 +0200 @@ -154,7 +154,6 @@ typedef ProtocolVersion MsgType; -#define PG_PROTOCOL(m,n) (((m) << 16) | (n)) #define CANCEL_REQUEST_CODE PG_PROTOCOL(1234,5678) typedef struct CancelRequestPacket @@ -315,10 +314,8 @@ char unicode; char result_uncommitted; char schema_support; -#ifdef MULTIBYTE char *client_encoding; char *server_encoding; -#endif /* MULTIBYTE */ int ccsc; int be_pid; /* pid returned by backend */ int be_key; /* auth code needed to send cancel */ diff -Pru ../cvs-psqlodbc/convert.c ./convert.c --- ../cvs-psqlodbc/convert.c 2002-09-23 10:08:20.000000000 +0200 +++ ./convert.c 2002-09-30 18:40:45.000000000 +0200 @@ -23,9 +23,7 @@ #include <string.h> #include <ctype.h> -#ifdef MULTIBYTE #include "multibyte.h" -#endif #include <time.h> #ifdef HAVE_LOCALE_H @@ -1233,9 +1231,7 @@ BOOL proc_no_param; unsigned int declare_pos; UInt4 flags; -#ifdef MULTIBYTE encoded_str encstr; -#endif /* MULTIBYTE */ } QueryParse; static int @@ -1254,9 +1250,7 @@ q->proc_no_param = TRUE; q->declare_pos = 0; q->flags = 0; -#ifdef MULTIBYTE make_encoded_str(&q->encstr, SC_get_conn(stmt), q->statement); -#endif /* MULTIBYTE */ return q->stmt_len; } @@ -1649,11 +1643,8 @@ || ';' == wstmt[0]; } -#ifdef MULTIBYTE #define my_strchr(conn, s1,c1) pg_mbschr(conn->ccsc, s1,c1) -#else -#define my_strchr(conn, s1,c1) strchr(s1,c1) -#endif + /* * This function inserts parameters into an SQL statements. * It will also modify a SELECT statement for use with declare/fetch cursors. @@ -1880,7 +1871,6 @@ CVT_APPEND_DATA(qb, qp->statement + qp->from_pos + 5, qp->where_pos - qp->from_pos - 5); } } -#ifdef MULTIBYTE oldchar = encoded_byte_check(&qp->encstr, qp->opos); if (ENCODE_STATUS(qp->encstr) != 0) { @@ -1891,9 +1881,6 @@ /* * From here we are guaranteed to handle a 1-byte character. */ -#else - oldchar = qp->statement[qp->opos]; -#endif if (qp->in_escape) /* escape check */ { @@ -2710,10 +2697,8 @@ retval = inner_process_tokens(qp, qb); if (retval == SQL_ERROR) return retval; -#ifdef MULTIBYTE if (ENCODE_STATUS(qp->encstr) != 0) continue; -#endif if (qp->in_dquote || qp->in_quote || qp->in_escape) continue; @@ -3161,10 +3146,7 @@ out = 0, max; char *p = NULL; -#ifdef MULTIBYTE encoded_str encstr; -#endif - if (used == SQL_NTS) max = strlen(si); @@ -3175,13 +3157,10 @@ p = dst; p[0] = '\0'; } -#ifdef MULTIBYTE encoded_str_constr(&encstr, ccsc, si); -#endif for (i = 0; i < max && si[i]; i++) { -#ifdef MULTIBYTE encoded_nextchar(&encstr); if (ENCODE_STATUS(encstr) != 0) { @@ -3190,7 +3169,6 @@ out++; continue; } -#endif if (convlf && si[i] == '\r' && si[i + 1] == '\n') continue; else if (si[i] == '\'' || si[i] == '\\') diff -Pru ../cvs-psqlodbc/dlg_specific.c ./dlg_specific.c --- ../cvs-psqlodbc/dlg_specific.c 2002-07-26 10:45:54.000000000 +0200 +++ ./dlg_specific.c 2002-09-30 16:19:28.000000000 +0200 @@ -21,9 +21,7 @@ #include "convert.h" -#ifdef MULTIBYTE #include "multibyte.h" -#endif #include "pgapifunc.h" #ifndef BOOL @@ -535,16 +533,10 @@ ci->fake_oid_index, ci->show_system_tables); -#ifdef MULTIBYTE check_client_encoding(ci->conn_settings); qlog(" conn_settings='%s',conn_encoding='%s'\n", ci->conn_settings, check_client_encoding(ci->conn_settings)); -#else - qlog(" conn_settings='%s'\n", - ci->conn_settings); -#endif - qlog(" translation_dll='%s',translation_option='%s'\n", ci->translation_dll, ci->translation_option); diff -Pru ../cvs-psqlodbc/dlg_wingui.c ./dlg_wingui.c --- ../cvs-psqlodbc/dlg_wingui.c 2002-09-23 10:08:21.000000000 +0200 +++ ./dlg_wingui.c 2002-09-30 16:19:44.000000000 +0200 @@ -22,9 +22,7 @@ #include "convert.h" -#ifdef MULTIBYTE #include "multibyte.h" -#endif #include "pgapifunc.h" #ifndef BOOL diff -Pru ../cvs-psqlodbc/gpps.c ./gpps.c --- ../cvs-psqlodbc/gpps.c 2001-11-05 18:46:38.000000000 +0100 +++ ./gpps.c 2002-09-30 16:22:28.000000000 +0200 @@ -26,10 +26,7 @@ #include <stdio.h> #include <unistd.h> #include <ctype.h> - -#if HAVE_PWD_H #include <pwd.h> -#endif #include <sys/types.h> #include <string.h> diff -Pru ../cvs-psqlodbc/info.c ./info.c --- ../cvs-psqlodbc/info.c 2002-09-23 10:08:21.000000000 +0200 +++ ./info.c 2002-09-30 16:17:15.000000000 +0200 @@ -37,9 +37,7 @@ #include "misc.h" #include "pgtypes.h" #include "pgapifunc.h" -#ifdef MULTIBYTE #include "multibyte.h" -#endif /* Trigger related stuff for SQLForeign Keys */ @@ -1517,9 +1515,7 @@ int i, outlen; const char *in; BOOL escape_in = FALSE; -#ifdef MULTIBYTE encoded_str encstr; -#endif if (srclen == SQL_NULL_DATA) { @@ -1530,19 +1526,15 @@ srclen = strlen(src); if (srclen <= 0) return STRCPY_FAIL; -#ifdef MULTIBYTE encoded_str_constr(&encstr, ccsc, src); -#endif for (i = 0, in = src, outlen = 0; i < srclen && outlen < dst_len; i++, in++) { -#ifdef MULTIBYTE encoded_nextchar(&encstr); if (ENCODE_STATUS(encstr) != 0) { dest[outlen++] = *in; continue; } -#endif if (escape_in) { switch (*in) @@ -2975,7 +2967,6 @@ } -#ifdef MULTIBYTE /* * Multibyte support stuff for SQLForeignKeys(). * There may be much more effective way in the @@ -3199,7 +3190,6 @@ } return ret; } -#endif /* MULTIBYTE */ RETCODE SQL_API PGAPI_ForeignKeys( @@ -3244,10 +3234,8 @@ *fkey_text; ConnectionClass *conn; -#ifdef MULTIBYTE BOOL pkey_alloced, fkey_alloced; -#endif /* MULTIBYTE */ int i, j, k, @@ -3346,10 +3334,8 @@ make_string(szFkTableName, cbFkTableName, fk_table_needed); conn = SC_get_conn(stmt); -#ifdef MULTIBYTE pkey_text = fkey_text = NULL; pkey_alloced = fkey_alloced = FALSE; -#endif /* MULTIBYTE */ /* * Case #2 -- Get the foreign keys in the specified table (fktab) that @@ -3618,21 +3604,15 @@ num_keys = 0; break; } -#ifdef MULTIBYTE pkey_text = getClientColumnName(conn, relid2, pkey_ptr, &pkey_alloced); -#else - pkey_text = pkey_ptr; -#endif /* MULTIBYTE */ mylog("%s: pkey_ptr='%s', pkey='%s'\n", func, pkey_text, pkey); if (strcmp(pkey_text, pkey)) { num_keys = 0; break; } -#ifdef MULTIBYTE if (pkey_alloced) free(pkey_text); -#endif /* MULTIBYTE */ /* Get to next primary key */ for (k = 0; k < 2; k++) pkey_ptr += strlen(pkey_ptr) + 1; @@ -3686,13 +3666,9 @@ { row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField)); -#ifdef MULTIBYTE pkey_text = getClientColumnName(conn, relid2, pkey_ptr, &pkey_alloced); fkey_text = getClientColumnName(conn, relid1, fkey_ptr, &fkey_alloced); -#else - pkey_text = pkey_ptr; - fkey_text = fkey_ptr; -#endif /* MULTIBYTE */ + mylog("%s: pk_table = '%s', pkey_ptr = '%s'\n", func, pk_table_fetched, pkey_text); set_tuplefield_null(&row->tuple[0]); set_tuplefield_string(&row->tuple[1], GET_SCHEMA_NAME(schema_fetched)); @@ -3717,14 +3693,12 @@ #endif /* ODBCVER >= 0x0300 */ QR_add_tuple(res, row); -#ifdef MULTIBYTE if (fkey_alloced) free(fkey_text); fkey_alloced = FALSE; if (pkey_alloced) free(pkey_text); pkey_alloced = FALSE; -#endif /* MULTIBYTE */ /* next primary/foreign key */ for (i = 0; i < 2; i++) { @@ -3994,13 +3968,9 @@ for (k = 0; k < num_keys; k++) { -#ifdef MULTIBYTE pkey_text = getClientColumnName(conn, relid1, pkey_ptr, &pkey_alloced); fkey_text = getClientColumnName(conn, relid2, fkey_ptr, &fkey_alloced); -#else - pkey_text = pkey_ptr; - fkey_text = fkey_ptr; -#endif /* MULTIBYTE */ + mylog("pkey_ptr = '%s', fk_table = '%s', fkey_ptr = '%s'\n", pkey_text, fk_table_fetched, fkey_text); row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField)); @@ -4034,14 +4004,12 @@ #endif /* ODBCVER >= 0x0300 */ QR_add_tuple(res, row); -#ifdef MULTIBYTE if (pkey_alloced) free(pkey_text); pkey_alloced = FALSE; if (fkey_alloced) free(fkey_text); fkey_alloced = FALSE; -#endif /* MULTIBYTE */ /* next primary/foreign key */ for (j = 0; j < 2; j++) @@ -4060,12 +4028,10 @@ PGAPI_FreeStmt(htbl_stmt, SQL_DROP); return SQL_ERROR; } -#ifdef MULTIBYTE if (pkey_alloced) free(pkey_text); if (fkey_alloced) free(fkey_text); -#endif /* MULTIBYTE */ PGAPI_FreeStmt(htbl_stmt, SQL_DROP); diff -Pru ../cvs-psqlodbc/misc.c ./misc.c --- ../cvs-psqlodbc/misc.c 2002-09-23 10:08:21.000000000 +0200 +++ ./misc.c 2002-09-30 16:11:22.000000000 +0200 @@ -19,9 +19,7 @@ #include <string.h> #ifndef WIN32 -#if HAVE_PWD_H #include <pwd.h> -#endif #include <sys/types.h> #include <unistd.h> #else diff -Pru ../cvs-psqlodbc/parse.c ./parse.c --- ../cvs-psqlodbc/parse.c 2002-09-23 10:08:21.000000000 +0200 +++ ./parse.c 2002-09-30 16:15:40.000000000 +0200 @@ -34,19 +34,13 @@ #include "pgtypes.h" #include "pgapifunc.h" -#ifdef MULTIBYTE #include "multibyte.h" -#endif #define FLD_INCR 32 #define TAB_INCR 8 #define COL_INCR 16 -#ifdef MULTIBYTE char *getNextToken(int ccsc, char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric); -#else -char *getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric); -#endif /* MULTIBYTE */ void getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k); char searchColInfo(COL_INFO *col_info, FIELD_INFO *fi); @@ -76,18 +70,14 @@ char * getNextToken( -#ifdef MULTIBYTE int ccsc, /* client encoding */ -#endif /* MULTIBYTE */ char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric) { int i = 0; int out = 0; char qc, in_escape = FALSE; -#ifdef MULTIBYTE encoded_str encstr; -#endif if (smax <= 1) return NULL; @@ -114,20 +104,16 @@ if (numeric) *numeric = FALSE; -#ifdef MULTIBYTE encoded_str_constr(&encstr, ccsc, &s[i]); -#endif /* get the next token */ while (s[i] != '\0' && out < smax) { -#ifdef MULTIBYTE encoded_nextchar(&encstr); if (ENCODE_STATUS(encstr) != 0) { token[out++] = s[i++]; continue; } -#endif if (isspace((unsigned char) s[i]) || s[i] == ',') break; /* Handle quoted stuff */ @@ -148,14 +134,12 @@ i++; /* dont return the quote */ while (s[i] != '\0' && out != smax) { -#ifdef MULTIBYTE encoded_nextchar(&encstr); if (ENCODE_STATUS(encstr) != 0) { token[out++] = s[i++]; continue; } -#endif if (s[i] == qc && !in_escape) break; if (s[i] == '\\' && !in_escape) @@ -360,11 +344,7 @@ stmt->from_pos = -1; stmt->where_pos = -1; -#ifdef MULTIBYTE while (pptr = ptr, (ptr = getNextToken(conn->ccsc, pptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL) -#else - while (pptr = ptr, (ptr = getNextToken(pptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL) -#endif { unquoted = !(quote || dquote); @@ -707,20 +687,16 @@ if (!dquote) { char *ptr; -#ifdef MULTIBYTE encoded_str encstr; make_encoded_str(&encstr, conn, ti[stmt->ntab]->name); -#endif /* MULTIBYTE */ /* lower case table name */ for (ptr = ti[stmt->ntab]->name; *ptr; ptr++) { -#ifdef MULTIBYTE encoded_nextchar(&encstr); if (ENCODE_STATUS(encstr) != 0) ptr++; else -#endif /* MULTIBYTE */ *ptr = tolower((unsigned char) *ptr); } } diff -Pru ../cvs-psqlodbc/pgtypes.c ./pgtypes.c --- ../cvs-psqlodbc/pgtypes.c 2002-09-23 10:08:21.000000000 +0200 +++ ./pgtypes.c 2002-09-30 16:14:09.000000000 +0200 @@ -702,9 +702,7 @@ if (conn->unicode || conn->ms_jet) return attlen; #if (ODBCVER >= 0x0300) -#ifdef MULTIBYTE return attlen; -#endif /* MULTIBYTE */ #endif /* ODBCVER */ return p; } @@ -996,12 +994,10 @@ Int4 prec = pgtype_column_size(stmt, type, col, handle_unknown_size_as), maxvarc; if (conn->unicode) return prec * 2; -#ifdef MULTIBYTE /* after 7.2 */ if (PG_VERSION_GE(conn, 7.2)) coef = 3; else -#endif /* MULTIBYTE */ if ((conn->connInfo).lf_conversion) /* CR -> CR/LF */ coef = 2; @@ -1075,12 +1071,10 @@ case PG_TYPE_BPCHAR: if (conn->unicode) return prec * 2; -#ifdef MULTIBYTE /* after 7.2 */ if (PG_VERSION_GE(conn, 7.2)) coef = 3; else -#endif /* MULTIBYTE */ if ((conn->connInfo).lf_conversion) /* CR -> CR/LF */ coef = 2; diff -Pru ../cvs-psqlodbc/psqlodbc.h ./psqlodbc.h --- ../cvs-psqlodbc/psqlodbc.h 2002-09-23 10:08:21.000000000 +0200 +++ ./psqlodbc.h 2002-09-30 16:20:54.000000000 +0200 @@ -13,7 +13,7 @@ #define __PSQLODBC_H__ #ifndef WIN32 -#include "pg_config.h" +#include "config.h" #else #include <windows.h> #endif @@ -117,9 +117,8 @@ #endif /* WIN32 */ /* Limits */ -#ifdef WIN32 #define BLCKSZ 4096 -#endif +#define MAXPGPATH 1024 #define MAX_MESSAGE_LEN 65536 /* This puts a limit on * query size but I don't */ diff -Pru ../cvs-psqlodbc/setup.c ./setup.c --- ../cvs-psqlodbc/setup.c 2002-07-26 10:45:54.000000000 +0200 +++ ./setup.c 2002-10-07 14:32:26.000000000 +0200 @@ -32,10 +32,6 @@ /* Constants */ #define MIN(x,y) ((x) < (y) ? (x) : (y)) -#ifdef WIN32 -#define MAXPGPATH (255+1) -#endif - #define MAXKEYLEN (15+1) /* Max keyword length */ #define MAXDESC (255+1) /* Max description length */ #define MAXDSNAME (32+1) /* Max data source name length */
^ permalink raw reply [nested|flat] 7+ messages in thread

* Re: Unix build
@ 2002-10-08 07:05  Dave Page <dpage@vale-housing.co.uk>
  0 siblings, 1 reply; 7+ messages in thread

From: Dave Page @ 2002-10-08 07:05 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; pgsql-odbc; +Cc: Hiroshi Inoue <Inoue@tpf.co.jp>

Thanks for this Peter.

Hiroshi: I'm a little busy right now, is this something you have time to
look at or shall I add it to my todo list?

Regards, Dave.

> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e@gmx.net] 
> Sent: 07 October 2002 20:24
> To: pgsql-odbc@postgresql.org
> Subject: [ODBC] Unix build
> 
> 
> I managed to find a Libtool version that works, so here's the 
> independent build infrastructure for ODBC on Unix.
> 
> The patch also removes all the non-multibyte code.  This goes 
> together with the build system change, because there no 
> longer is a way to turn on multibyte explicitly.  You should 
> make the required changes to the Windows build files.
> 
> The following files need to be checked into CVS: configure.ac 
> and Makefile.am.  GNUmakefile can be removed.  I recommend 
> that you do not check in all the files generated by auto* 
> (see below).  It can get pretty messy to keep track of them.
> 
> * Prerequisites
> 
> Autoconf 2.52 or higher
> Automake 1.6.* (Lower versions are rejected, version 1.7 
> untested.) Libtool 1.4.2a (CVS from stable branch, maybe 
> 1.4.2 works as well) PostgreSQL source tree (7.3 branch)
> 
> * Bootstrapping
> 
> First, copy libtool.m4 into source directory.  Be sure to 
> pick the one from the right Libtool version.  Then run
> 
> aclocal -I . -I $PGSRC/config
> libtoolize --force --copy
> autoconf
> autoheader
> automake --add-missing --copy
> 
> You can run 'make maintainer-clean' to remove all the files 
> this generates.
> 
> * Building
> 
> ./configure
> make
> make install
> 
> configure has the same options that the PostgreSQL configure 
> used to have for ODBC, namely --with-iodbc, --with-unixodbc, 
> and --with-odbcinst=DIR.
> 
> * Version Number
> 
> The previous build infrastructure set a shared library 
> version number of 0.27.  I've used this as a package version 
> number, but it does not correspond to version.h in any way.  
> This needs to be thought out.
> 
> * Making a Source Distribution
> 
> 'make dist' makes a file psqlodbc-0.27.tar.gz.  It's even 
> better to use 'make distcheck', which runs a number of tests 
> to see if the distribution is internally consistent.
> 
> The distribution does not contain any Windows-specific files 
> (*.def, maybe others).  If it is desired to include them, 
> edit Makefile.am.
> 
> -- 
> Peter Eisentraut   peter_e@gmx.net
> 



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Unix build
@ 2002-10-08 09:58  Hiroshi Inoue <Inoue@tpf.co.jp>
  parent: Dave Page <dpage@vale-housing.co.uk>
  0 siblings, 0 replies; 7+ messages in thread

From: Hiroshi Inoue @ 2002-10-08 09:58 UTC (permalink / raw)
  To: Dave Page <dpage@vale-housing.co.uk>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-odbc

Dave Page wrote:
> 
> Thanks for this Peter.
> 
> Hiroshi: I'm a little busy right now, is this something you have time to
> look at or shall I add it to my todo list?

I'm also pretty busy now. It would take some time for me to
look at.

regards,
Hiroshi Inoue
	http://w2422.nsk.ne.jp/~inoue/



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Unix build
@ 2002-10-08 09:59  Dave Page <dpage@vale-housing.co.uk>
  0 siblings, 0 replies; 7+ messages in thread

From: Dave Page @ 2002-10-08 09:59 UTC (permalink / raw)
  To: Hiroshi Inoue <Inoue@tpf.co.jp>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-odbc



> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp] 
> Sent: 08 October 2002 10:59
> To: Dave Page
> Cc: Peter Eisentraut; pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] Unix build
> 
> 
> Dave Page wrote:
> > 
> > Thanks for this Peter.
> > 
> > Hiroshi: I'm a little busy right now, is this something you 
> have time 
> > to look at or shall I add it to my todo list?
> 
> I'm also pretty busy now. It would take some time for me to look at.

OK, I'll add it to my list.

Regards, Dave.



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Unix build
@ 2002-10-15 10:17  Dave Page <dpage@vale-housing.co.uk>
  0 siblings, 1 reply; 7+ messages in thread

From: Dave Page @ 2002-10-15 10:17 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; pgsql-odbc



> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e@gmx.net] 
> Sent: 07 October 2002 20:24
> To: pgsql-odbc@postgresql.org
> Subject: [ODBC] Unix build
> 
> 
> I managed to find a Libtool version that works, so here's the
> independent build infrastructure for ODBC on Unix.

<...>

Hi Peter, 

I finally got a chance to play with this, and ran into a few potential
issues, though I did end up with a libpsqlodbc.so (I can't easily check
it though as I don't use ODBC on unix).

Software wise, I have:

autoconf 2.53
automake 1.6.3
libtool 1.4.2 (snapshot download link was broken, and I didn't have time
to figure out how to install the cvs version)
PostgreSQL 7.3b2

I moved the current psqlODBC source into $PGSRC/src/interfaces/odbc, ran
the PostgreSQL configure script and then followed your instructions. The
only odd message I got was from libtoolize: 'You should update your
`aclocal.m4' by running aclocal.'. Noting your instructions, I tried the
libtool.m4 from my system, and the PostgreSQL source and found no
difference.

Build logs showing the errors are below. I suspect some of them may be
caused by Windows specific sources being compiled.

Any ideas?

Thanks, Dave.

root@snake:/usr/local/src/postgresql-7.3b2/src/interfaces/odbc# make
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o info.o info.c
info.c: In function `PGAPI_ProcedureColumns':
info.c:4192: warning: int format, long int arg (arg 3)
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o bind.o bind.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o columninfo.o
columninfo.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o connection.o
connection.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o convert.o convert.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o drvconn.o drvconn.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o environ.o environ.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o execute.o execute.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o lobj.o lobj.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o md5.o md5.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o misc.o misc.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o options.o options.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o pgtypes.o pgtypes.c
pgtypes.c: In function `getNumericColumnSize':
pgtypes.c:587: warning: unused variable `max_column_size'
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o psqlodbc.o
psqlodbc.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o qresult.o qresult.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o results.o results.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o socket.o socket.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o parse.o parse.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o statement.o
statement.c 
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o tuple.o tuple.c 
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o tuplelist.o
tuplelist.c 
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o dlg_specific.o
dlg_specific.c 
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o odbcapi.o odbcapi.c

ar crs libpsqlodbc.a info.o bind.o columninfo.o connection.o convert.o
drvconn.o environ.o execute.o lobj.o md5.o misc.o options.o pgtypes.o
psqlodbc.o qresult.o results.o socket.o parse.o statement.o tuple.o
tuplelist.o dlg_specific.o odbcapi.o

ranlib libpsqlodbc.a

gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -shared
-Wl,-soname,libpsqlodbc.so.0 -Wl,-Bsymbolic info.o bind.o columninfo.o
connection.o convert.o drvconn.o environ.o execute.o lobj.o md5.o misc.o
options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o parse.o
statement.o tuple.o tuplelist.o dlg_specific.o odbcapi.o  -lnsl -lm
-Wl,-rpath,/usr/local/pgsql/lib -o libpsqlodbc.so.0.27
info.o: In function `reallyEscapeCatalogEscapes':
info.o(.text+0x255f): undefined reference to `encoded_str_constr'
info.o(.text+0x258c): undefined reference to `encoded_nextchar'
connection.o: In function `CC_connect':
connection.o(.text+0xde7): undefined reference to `pg_CS_code'
connection.o(.text+0xded): undefined reference to `pg_CS_name'
connection.o(.text+0xe54): undefined reference to `pg_CS_code'
connection.o(.text+0xe5a): undefined reference to `pg_CS_name'
connection.o(.text+0xeb4): undefined reference to `pg_CS_code'
connection.o(.text+0x1b1d): undefined reference to
`CC_lookup_characterset'
convert.o: In function `QP_initialize':
convert.o(.text+0x1cbc): undefined reference to `encoded_str_constr'
convert.o: In function `inner_process_tokens':
convert.o(.text+0x2932): undefined reference to `encoded_byte_check'
convert.o: In function `convert_escape':
convert.o(.text+0x4432): undefined reference to `pg_mbschr'

convert.o: In function `convert_special_chars':
convert.o(.text+0x502c): undefined reference to `encoded_str_constr'
convert.o(.text+0x5059): undefined reference to `encoded_nextchar'
parse.o: In function `getNextToken':
parse.o(.text+0x136): undefined reference to `encoded_str_constr'
parse.o(.text+0x158): undefined reference to `encoded_nextchar'
parse.o(.text+0x242): undefined reference to `encoded_nextchar'
parse.o: In function `parse_statement':
parse.o(.text+0x13bc): undefined reference to `encoded_str_constr'
parse.o(.text+0x13e5): undefined reference to `encoded_nextchar'
dlg_specific.o: In function `getDSNinfo':
dlg_specific.o(.text+0x1c32): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1c77): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1cbc): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1d01): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1d46): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1d88): more undefined references to
`GetPrivateProfileString' follow
dlg_specific.o: In function `getDSNinfo':
dlg_specific.o(.text+0x227b): undefined reference to `pg_CS_code'
dlg_specific.o(.text+0x2281): undefined reference to `pg_CS_name'
dlg_specific.o(.text+0x2299): undefined reference to `pg_CS_code'
dlg_specific.o(.text+0x229f): undefined reference to `pg_CS_name'

dlg_specific.o: In function `writeDriverCommoninfo':

dlg_specific.o(.text+0x23b6): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x23e9): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x241c): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x244f): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x2482): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x24b5): more undefined references to
`WritePrivateProfileString' follow
dlg_specific.o: In function `getCommonDefaults':
dlg_specific.o(.text+0x2a06): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2a72): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2ad3): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2b30): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2ba7): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2c01): more undefined references to
`GetPrivateProfileString' follow
rm -f libpsqlodbc.so.0
ln -s libpsqlodbc.so.0.27 libpsqlodbc.so.0
rm -f libpsqlodbc.so
ln -s libpsqlodbc.so.0.27 libpsqlodbc.so
sed -n '/^CREATE OR REPLACE FUNCTION/s/CREATE OR REPLACE FUNCTION \([^
(][^ (]*([^)]*)\).*/DROP FUNCTION \1;/p' odbc.sql >odbc-drop.sql




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Unix build
@ 2002-10-15 18:54  Peter Eisentraut <peter_e@gmx.net>
  parent: Dave Page <dpage@vale-housing.co.uk>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Eisentraut @ 2002-10-15 18:54 UTC (permalink / raw)
  To: Dave Page <dpage@vale-housing.co.uk>; +Cc: pgsql-odbc

Dave Page writes:

> I moved the current psqlODBC source into $PGSRC/src/interfaces/odbc, ran
> the PostgreSQL configure script and then followed your instructions. The
> only odd message I got was from libtoolize: 'You should update your
> `aclocal.m4' by running aclocal.'. Noting your instructions, I tried the
> libtool.m4 from my system, and the PostgreSQL source and found no
> difference.

You should use the one from the libtool installation (under
$PREFIX/share/aclocal).  It's not possibly the same as the one in the
PostgreSQL source tree.  Make sure you run aclocal as specified.  The -I .
should be before -I $PGSRC/config.  Also make sure you use the libtoolize
from the same Libtool version that provided libtool.m4.

> Build logs showing the errors are below. I suspect some of them may be
> caused by Windows specific sources being compiled.

It sure looks like the GNUmakefile is still there and hence all the new
stuff is completely ignored.

-- 
Peter Eisentraut   peter_e@gmx.net




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Unix build
@ 2002-10-16 09:15  Dave Page <dpage@vale-housing.co.uk>
  0 siblings, 0 replies; 7+ messages in thread

From: Dave Page @ 2002-10-16 09:15 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-odbc



> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e@gmx.net] 
> Sent: 15 October 2002 19:55
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: RE: [ODBC] Unix build
> 
> 
> Dave Page writes:
> 
> > I moved the current psqlODBC source into 
> $PGSRC/src/interfaces/odbc, 
> > ran the PostgreSQL configure script and then followed your 
> > instructions. The only odd message I got was from libtoolize: 'You 
> > should update your `aclocal.m4' by running aclocal.'. Noting your 
> > instructions, I tried the libtool.m4 from my system, and the 
> > PostgreSQL source and found no difference.
> 
> You should use the one from the libtool installation (under 
> $PREFIX/share/aclocal).  It's not possibly the same as the 
> one in the PostgreSQL source tree.  Make sure you run aclocal 
> as specified.  The -I . should be before -I $PGSRC/config.  
> Also make sure you use the libtoolize from the same Libtool 
> version that provided libtool.m4.

Yes, I'm currently using /usr/share/aclocal/libtool.m4. Still get the
error|warning but otherwise it seems to work.

> > Build logs showing the errors are below. I suspect some of 
> them may be 
> > caused by Windows specific sources being compiled.
> 
> It sure looks like the GNUmakefile is still there and hence 
> all the new stuff is completely ignored.

Yeah, that would be the problem.

Thanks, Dave.



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2002-10-16 09:15 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-07 19:24 Unix build Peter Eisentraut <peter_e@gmx.net>
2002-10-08 07:05 Re: Unix build Dave Page <dpage@vale-housing.co.uk>
2002-10-08 09:58 ` Hiroshi Inoue <Inoue@tpf.co.jp>
2002-10-08 09:59 Re: Unix build Dave Page <dpage@vale-housing.co.uk>
2002-10-15 10:17 Re: Unix build Dave Page <dpage@vale-housing.co.uk>
2002-10-15 18:54 ` Peter Eisentraut <peter_e@gmx.net>
2002-10-16 09:15 Re: Unix build Dave Page <dpage@vale-housing.co.uk>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox