From owner-freebsd-questions Mon Jan 25 10:35:04 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA20812 for freebsd-questions-outgoing; Mon, 25 Jan 1999 10:35:04 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from base486.home.org (imdave.pr.mcs.net [205.164.3.77]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA20771 for ; Mon, 25 Jan 1999 10:34:53 -0800 (PST) (envelope-from imdave@mcs.net) Received: from mcs.net (netscape@base586.home.org [10.0.0.2]) by base486.home.org (8.9.2/8.9.2) with ESMTP id MAA24739; Mon, 25 Jan 1999 12:33:56 -0600 (CST) Message-ID: <36ACB90E.6DFB907D@mcs.net> Date: Mon, 25 Jan 1999 12:33:50 -0600 From: Dave Bodenstab Organization: Dave's Home Machine X-Mailer: Mozilla 4.07 [en] (X11; U; FreeBSD 2.2.5-RELEASE i386) MIME-Version: 1.0 To: Sebestyen Zoltan CC: FreeBSD Questions Subject: Re: PostgreSQL 6.4.2 on FreeBSD. References: Content-Type: multipart/mixed; boundary="------------107D44C27111AE8A1E7BC50F" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 /* 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 +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