Skip to Content.
Sympa Menu

freetds - Re: FreeTDS and Debian

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Steve Langasek <vorlon AT netexpress.net>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: FreeTDS and Debian
  • Date: Fri, 26 Jan 2001 09:48:49 -0600 (CST)


Brian,

On Fri, 26 Jan 2001, Brian Bruns wrote:

> The issue with alpha is mostly a set of typedefs that need to have
> autoconf determine which types to use for 8, 16, and 32 bit ints and 4 and
> 8 byte floats...It's on my list for the next release but if someone wants
> to take it on, I wouldn't complain. I'm basically just going to copy
> what glib/gtk does

Ask, and you shall receive. Below is a patch which will check sizes and set
TDS_SMALLINT, TDS_INT, TDS_REAL, and TDS_FLOAT appropriately. I've assumed
here that 'char' will always be our 8-byte int, because I can't think of a
case where that isn't true, and so I don't know what those platforms use in
place of 'char'. The checks for 'real' and 'float' don't do a whole lot
either, but the good news is they don't have to for Linux-Alpha. (Actually,
the only one that has to change for Alpha is TDS_INT, but I might as well try
to design for the future. :)

Regards,
Steve Langasek
postmodern programmer

Index: configure.in
===================================================================
RCS file: /Repository/freetds/configure.in,v
retrieving revision 1.22
diff -u -w -r1.22 configure.in
--- configure.in 2000/11/04 20:41:43 1.22
+++ configure.in 2001/01/26 06:08:16
@@ -31,6 +31,43 @@
AC_HEADER_STDC

dnl ------------------------------------------------------------
+dnl Checks for integers/floats of different sizes
+dnl ------------------------------------------------------------
+AC_CHECK_SIZEOF(char)
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(float)
+AC_CHECK_SIZEOF(double)
+
+case 2 in
+$ac_cv_sizeof_short) smallint=short;;
+$ac_cv_sizeof_int) smallint=int;;
+esac
+case 4 in
+$ac_cv_sizeof_short) int=short;;
+$ac_cv_sizeof_int) int=int;;
+$ac_cv_sizeof_long) int=long;;
+esac
+
+case 4 in
+$ac_cv_sizeof_float) real=float;;
+$ac_cv_sizeof_double) real=double;;
+*) AC_ERROR(No 32-bit float found.)
+esac
+
+case 8 in
+$ac_cv_sizeof_float) float=float;;
+$ac_cv_sizeof_double) float=double;;
+*) AC_ERROR(No 64-bit float found.)
+esac
+
+AC_SUBST(smallint)
+AC_SUBST(int)
+AC_SUBST(real)

+AC_SUBST(float)
+
+dnl ------------------------------------------------------------
dnl Checks for typedefs and structures
dnl ------------------------------------------------------------

@@ -99,7 +136,7 @@
dnl ------------------------------------------------------------
dnl Final output
dnl ------------------------------------------------------------
-AC_OUTPUT(include/tdsver.h \
+AC_OUTPUT(include/tdsver.h include/tds.h \
Makefile \
include/Makefile \
src/Makefile \
Index: include/tds.h
===================================================================
RCS file: /Repository/freetds/include/tds.h,v
retrieving revision 1.66
diff -u -w -r1.66 include/tds.h
--- include/tds.h 2001/01/21 20:47:11 1.66
+++ include/tds.h 2001/01/26 06:08:17
@@ -82,12 +82,12 @@
typedef char TDS_CHAR; /* 8 bit char */
typedef unsigned char TDS_UCHAR; /* 8 bit uchar */
typedef unsigned char TDS_TINYINT; /* 8 bit int */
-typedef short TDS_SMALLINT; /* 16 bit int */
-typedef unsigned short TDS_USMALLINT; /* 16 bit unsigned */
-typedef long TDS_INT; /* 32 bit int */
-typedef unsigned long TDS_UINT; /* 32 bit unsigned */
-typedef float TDS_REAL; /* 32 bit float */
-typedef double TDS_FLOAT; /* 64 bit float */
+typedef @smallint@ TDS_SMALLINT; /* 16 bit int */
+typedef unsigned TDS_SMALLINT TDS_USMALLINT; /* 16 bit unsigned */
+typedef @int@ TDS_INT; /* 32 bit int */
+typedef unsigned TDS_INT TDS_UINT; /* 32 bit unsigned */
+typedef @real@ TDS_REAL; /* 32 bit float */
+typedef @float@ TDS_FLOAT; /* 64 bit float */
typedef struct tdsnumeric
{
unsigned char precision;





Archive powered by MHonArc 2.6.24.

Top of Page