Date: Mon, 25 Jan 1999 12:33:50 -0600 From: Dave Bodenstab <imdave@mcs.net> To: Sebestyen Zoltan <szoli@netvisor.hu> Cc: FreeBSD Questions <freebsd-questions@FreeBSD.ORG> Subject: Re: PostgreSQL 6.4.2 on FreeBSD. Message-ID: <36ACB90E.6DFB907D@mcs.net> References: <Pine.LNX.3.96.990125123717.14042C-100000@linux.intranet.netvisor.hu>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------107D44C27111AE8A1E7BC50F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sebestyen Zoltan wrote:
>
> The other topic
> that I'm interested in is how to get the int8 support working on BSD.
>
Here are the patches I've used to enable int8 support.
I've also sent them to the postgresql folks, but they
didn't show up in the 6.4.2 release. :-(
Of course, you'll also need the patches that are included
with the FreeBSD port, but if you've done a `make' they
should already be applied in the `work' subdirectory.
If there's no port for 6.4.2 yet, you'll need to apply the
patches yourself from the prevous port to 6.4.2.
Since my patches modify configure.in, you'll need to
install autoconf and regenerate the configure script.
Dave Bodenstab
imdave@mcs.net
--------------107D44C27111AE8A1E7BC50F
Content-Type: text/plain; charset=us-ascii; name="postgres642.patch"
Content-Disposition: inline; filename="postgres642.patch"
Content-Transfer-Encoding: 7bit
--- ./src/backend/port/snprintf.c 1998/12/25 02:20:41 64.2
+++ ./src/backend/port/snprintf.c 1999/01/19 00:37:40 64.2.1.1
@@ -49,7 +49,7 @@
#include <sys/param.h>
/* IRIX doesn't do 'long long' in va_arg(), so use a typedef */
-#ifdef HAVE_LONG_LONG_INT_64
+#if defined(HAVE_LONG_INT_64) || defined(HAVE_LONG_LONG_INT) || defined(HAVE_QUAD_INT_64)
typedef long long long_long;
typedef unsigned long long ulong_long;
#endif
--- ./src/include/utils/int8.h 1998/09/11 17:16:11 64.2
+++ ./src/include/utils/int8.h 1999/01/19 00:37:41 64.2.1.1
@@ -35,11 +35,18 @@
#define INT64_FORMAT "%lld"
#else
+#ifdef HAVE_QUAD_INT_64
+/* We have working support for "long long", use that */
+typedef long long int64;
+
+#define INT64_FORMAT "%qd"
+#else
/* Won't actually work, but fall back to long int so that int8.c compiles */
typedef long int int64;
#define INT64_FORMAT "%ld"
#define INT64_IS_BUSTED
+#endif
#endif
#endif
--- ./src/include/config.h.in 1998/12/13 20:08:24 64.2
+++ ./src/include/config.h.in 1999/01/19 00:37:41 64.2.1.1
@@ -267,6 +267,9 @@
/* Set to 1 if type "long long int" works and is 64 bits */
#undef HAVE_LONG_LONG_INT_64
+/* Set to 1 if type "long long" works and is 64 bits */
+#undef HAVE_QUAD_INT_64
+
/* Define as the base type of the last arg to accept */
#undef SOCKET_SIZE_TYPE
--- ./src/configure.in 1998/12/13 20:08:20 64.2
+++ ./src/configure.in 1999/01/19 00:37:39 64.2.1.1
@@ -688,6 +688,43 @@
AC_MSG_RESULT(no),
AC_MSG_RESULT(assuming not on target machine))
+AC_MSG_CHECKING(whether 'long long' is 64 bits)
+AC_TRY_RUN([#include <stdio.h>
+typedef long long int64;
+#define INT64_FORMAT "%qd"
+
+int64 a = 20000001;
+int64 b = 40000005;
+
+int does_int64_work()
+{
+ int64 c,d,e;
+ char buf[100];
+
+ if (sizeof(int64) != 8)
+ return 0; /* doesn't look like the right size */
+
+ /* we do perfunctory checks on multiply, divide, sprintf, sscanf */
+ c = a * b;
+ sprintf(buf, INT64_FORMAT, c);
+ if (strcmp(buf, "800000140000005") != 0)
+ return 0; /* either multiply or sprintf is busted */
+ if (sscanf(buf, INT64_FORMAT, &d) != 1)
+ return 0;
+ if (d != c)
+ return 0;
+ e = d / b;
+ if (e != a)
+ return 0;
+ return 1;
+}
+main() {
+ exit(! does_int64_work());
+}],
+ [AC_DEFINE(HAVE_QUAD_INT_64) AC_MSG_RESULT(yes)],
+ AC_MSG_RESULT(no),
+ AC_MSG_RESULT(assuming not on target machine))
+
dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
--------------107D44C27111AE8A1E7BC50F--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36ACB90E.6DFB907D>
