--- /dev/null
+--- firebird-1.5.0.4290/src/jrd/common.h.orig 2004-05-28 23:36:22.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/common.h 2004-05-28 23:44:49.000000000 +0200
+@@ -131,6 +131,18 @@
+ #define IMPLEMENTATION isc_info_db_impl_linux_sparc /* 65 */
+ #endif /* sparc */
+
++#ifdef __powerpc__
++#define IMPLEMENTATION isc_info_db_impl_linux_ppc
++#endif
++
++#ifdef __alpha__
++#define IMPLEMENTATION isc_info_db_impl_linux_alpha
++#endif
++
++#ifdef __x86_64__
++#define IMPLEMENTATION isc_info_db_impl_linux_amd64
++#endif
++
+ #define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
+ #define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
+ #define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
+--- firebird-1.5.0.4290/src/jrd/ibase.h.orig 2003-12-28 00:06:25.000000000 +0100
++++ firebird-1.5.0.4290/src/jrd/ibase.h 2004-05-28 23:48:49.000000000 +0200
+@@ -1573,6 +1573,10 @@
+
+ isc_info_db_impl_linux_sparc = 65,
+
++ isc_info_db_impl_linux_ppc = 66,
++ isc_info_db_impl_linux_alpha = 67,
++ isc_info_db_impl_linux_amd64 = 68,
++
+ isc_info_db_impl_last_value /* Leave this LAST! */
+ };
+
+--- firebird-1.5.0.4290/src/jrd/pag.cpp.orig 2004-05-28 22:16:09.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/pag.cpp 2004-05-28 23:58:59.000000000 +0200
+@@ -180,6 +180,15 @@
+ #ifdef __sparc__
+ #define CLASS 20
+ #endif
++#ifdef __powerpc__
++#define CLASS 30
++#endif
++#ifdef __alpha__
++#define CLASS 31
++#endif
++#ifdef __x86_64__
++#define CLASS 32
++#endif
+ #endif
+
+ #ifdef FREEBSD
+--- firebird-1.5.0.4290/src/remote/xdr.cpp.orig 2004-05-29 00:05:08.000000000 +0200
++++ firebird-1.5.0.4290/src/remote/xdr.cpp 2004-05-29 00:06:09.000000000 +0200
+@@ -39,10 +39,10 @@
+ // The simpliest way to check it is to issue
+ // "select abs(2.0/3.0) from rdb$database" from correct client
+ // It will return big strange value in case of invalid define
+-#if defined(i386) || defined(I386) || defined(_M_IX86)
++#if defined(i386) || defined(I386) || defined(_M_IX86) || defined(__alpha__) || defined(__x86_64__)
+ #define SWAP_DOUBLE
+ #else
+-#if !defined(sparc) && !defined(__sparc__) && !defined(PowerPC)
++#if !defined(sparc) && !defined(__sparc__) && !defined(PowerPC) && !defined(__powerpc__)
+ #error "Define SWAP_DOUBLE for your platform correctly !"
+ #endif
+ #endif
--- /dev/null
+--- firebird-1.5.0.4290/src/extern/editline/editline.c.orig 2003-11-13 08:28:47.000000000 +0100
++++ firebird-1.5.0.4290/src/extern/editline/editline.c 2004-05-28 12:17:26.000000000 +0200
+@@ -5,6 +5,11 @@
+ #include "editline.h"
+ #include <signal.h>
+ #include <ctype.h>
++#include <unistd.h>
++#include <stdlib.h>
++#if defined(USE_TERMCAP)
++#include <termcap.h>
++#endif
+
+ /*
+ ** Manifest constants.
+@@ -104,14 +109,6 @@
+ ** Declarations.
+ */
+ STATIC CHAR *editinput();
+-extern int read();
+-extern int write();
+-#if defined(USE_TERMCAP)
+-extern char *getenv();
+-extern char *tgetstr();
+-extern int tgetent();
+-extern int tgetnum();
+-#endif /* defined(USE_TERMCAP) */
+ \f
+ /*
+ ** TTY input/output functions.
+--- firebird-1.5.0.4290/src/jrd/gdsold.h.orig 2003-06-05 12:12:45.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/gdsold.h 2004-05-28 16:25:57.000000000 +0200
+@@ -253,7 +253,7 @@
+ FRBRD **,
+ short);
+
+-ISC_STATUS GDS_EXPORT gds__ftof(char *,
++SLONG /*ISC_STATUS*/ GDS_EXPORT gds__ftof(char *,
+ unsigned short,
+ char *,
+ unsigned short);
+@@ -270,7 +270,7 @@
+
+ ISC_STATUS GDS_EXPORT gds__print_status(ISC_STATUS *);
+
+-ISC_STATUS GDS_EXPORT gds__sqlcode(ISC_STATUS *);
++SLONG /*ISC_STATUS*/ GDS_EXPORT gds__sqlcode(ISC_STATUS *);
+
+ ISC_STATUS GDS_EXPORT gds__ddl(ISC_STATUS *,
+ FRBRD **,
+--- firebird-1.5.0.4290/src/jrd/gdsold.h.orig 2004-05-28 16:26:27.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/gdsold.h 2004-05-28 16:48:17.000000000 +0200
+@@ -307,7 +307,7 @@
+ char *,
+ char *);
+
+-ISC_STATUS GDS_EXPORT gds__event_block(char **,
++SLONG /*ISC_STATUS*/ GDS_EXPORT gds__event_block(char **,
+ char **,
+ unsigned short, ...);
+
+--- firebird-1.5.0.4290/src/jrd/cvt.cpp.orig 2003-08-11 23:42:58.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/cvt.cpp 2004-05-28 23:14:53.000000000 +0200
+@@ -192,6 +192,9 @@
+ static const SQUAD quad_min_int = { LONG_MIN, 0 };
+ static const SQUAD quad_max_int = { LONG_MAX, -1 };
+ #endif
++#else
++#define quad_min_int LONG_MIN
++#define quad_max_int LONG_MAX
+ #endif
+
+ static const TEXT *const months[] = {
+@@ -898,7 +901,7 @@
+ length =
+ CVT_make_string(desc, ttype_ascii, &p, (VARY *) buffer,
+ sizeof(buffer), err);
+- scale -= decompose(p, length, dtype_quad, &value.high, err);
++ scale -= decompose(p, length, dtype_quad, (SLONG *) & value, err);
+ break;
+
+ case dtype_blob:
+@@ -950,7 +953,8 @@
+ else
+ do {
+ if (value > QUAD_LIMIT || value < -QUAD_LIMIT)
+- (*err) (gds_arith_except, 0);
++ reinterpret_cast < pfn_cvt_private_cludge >
++ (err) (gds_arith_except, 0);
+ value *= 10;
+ } while (++scale);
+ #endif
+--- firebird-1.5.0.4290/src/jrd/ail.cpp.orig 2003-04-16 12:17:24.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/ail.cpp 2004-05-28 23:25:25.000000000 +0200
+@@ -552,8 +552,8 @@
+ reinterpret_cast < UCHAR * >(journal_name), CLUMP_ADD, 0);
+ PAG_add_clump(HEADER_PAGE, HDR_backup_info, d_len, data, CLUMP_ADD, 1);
+ WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal,
+- reinterpret_cast < long *>(&seqno),
+- reinterpret_cast < long *>(&offset), FALSE);
++ reinterpret_cast < SLONG *>(&seqno),
++ reinterpret_cast < SLONG *>(&offset), FALSE);
+ }
+
+
+@@ -995,8 +995,8 @@
+ h_length,
+ data,
+ d_length,
+- reinterpret_cast < long *>(seqno),
+- reinterpret_cast < long *>(offset));
++ reinterpret_cast < SLONG *>(seqno),
++ reinterpret_cast < SLONG *>(offset));
+ THREAD_ENTER;
+ }
+
+--- firebird-1.5.0.4290/src/jrd/blb.cpp.orig 2003-04-10 08:49:10.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/blb.cpp 2004-05-28 23:27:47.000000000 +0200
+@@ -241,7 +241,7 @@
+ if (BLF_create_blob(tdbb,
+ transaction,
+ &blob->blb_filter,
+- reinterpret_cast < long *>(blob_id),
++ reinterpret_cast < SLONG *>(blob_id),
+ bpb_length,
+ bpb,
+ reinterpret_cast < long (*)() > (blob_filter),
+@@ -1088,7 +1088,7 @@
+ if (BLF_open_blob(tdbb,
+ transaction,
+ &control,
+- reinterpret_cast < long *>(blob_id),
++ reinterpret_cast < SLONG *>(blob_id),
+ bpb_length,
+ bpb,
+ reinterpret_cast < long (*)() > (blob_filter),
+--- firebird-1.5.0.4290/src/jrd/cch.cpp.orig 2003-05-16 22:35:06.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/cch.cpp 2004-05-28 23:30:26.000000000 +0200
+@@ -5542,8 +5542,8 @@
+ if (dbb->dbb_wal)
+ WAL_flush(status,
+ dbb->dbb_wal,
+- reinterpret_cast < long *>(&page->pag_seqno),
+- reinterpret_cast < long *>(&page->pag_offset), TRUE);
++ reinterpret_cast < SLONG *>(&page->pag_seqno),
++ reinterpret_cast < SLONG *>(&page->pag_offset), TRUE);
+
+ #ifdef DEBUG_SAVE_BDB_PAGE
+ /* Save page number into page->pag_offset before computing the checksum */
+--- firebird-1.5.0.4290/src/jrd/common.h.orig 2004-05-28 22:16:09.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/common.h 2004-05-28 23:36:22.000000000 +0200
+@@ -97,11 +97,18 @@
+ #ifdef LINUX
+ #define QUADFORMAT "ll"
+ #define QUADCONST(n) (n##LL)
++#if SIZEOF_LONG == 8
++ /* EKU: Firebird requires (S)LONG to be 32 bit */
++#define SLONGFORMAT "d"
++#define ULONGFORMAT "u"
++#define XLONGFORMAT "X"
++#define xLONGFORMAT "x"
++#else
+ #define SLONGFORMAT "ld"
+ #define ULONGFORMAT "lu"
+ #define XLONGFORMAT "lX"
+ #define xLONGFORMAT "lx"
+-
++#endif
+
+ #define __LINE__IS_INT
+
+--- firebird-1.5.0.4290/src/jrd/jrd.cpp.orig 2004-01-28 10:28:39.000000000 +0100
++++ firebird-1.5.0.4290/src/jrd/jrd.cpp 2004-05-28 23:56:05.000000000 +0200
+@@ -2693,7 +2693,7 @@
+ reinterpret_cast < BID > (array_id),
+ sdl,
+ param_length,
+- reinterpret_cast < long *>(param),
++ reinterpret_cast < SLONG *>(param),
+ slice_length, slice);
+ }
+ catch (const std::exception&)
+@@ -2885,7 +2885,7 @@
+ reinterpret_cast < BID > (array_id),
+ sdl,
+ param_length,
+- reinterpret_cast < long *>(param), slice_length, slice);
++ reinterpret_cast < SLONG *>(param), slice_length, slice);
+ }
+ catch (const std::exception&)
+ {
+--- firebird-1.5.0.4290/src/jrd/rec.cpp.orig 2003-04-03 15:52:36.000000000 +0200
++++ firebird-1.5.0.4290/src/jrd/rec.cpp 2004-05-29 00:00:16.000000000 +0200
+@@ -1061,8 +1061,8 @@
+ WALR_get(tdbb->tdbb_status_vector,
+ reinterpret_cast < walrs * >(WALRS_handle), wal_buff,
+ reinterpret_cast < USHORT * >(&len),
+- reinterpret_cast < long *>(&seqno),
+- reinterpret_cast < long *>(&offset));
++ reinterpret_cast < SLONG *>(&seqno),
++ reinterpret_cast < SLONG *>(&offset));
+ if (ret_val == -1) /* done processing */
+ break;
+ else if (ret_val != FB_SUCCESS) {
+--- firebird-1.5.0.4290/src/remote/xdr.cpp.orig 2004-05-28 22:16:09.000000000 +0200
++++ firebird-1.5.0.4290/src/remote/xdr.cpp 2004-05-29 00:05:08.000000000 +0200
+@@ -754,10 +754,10 @@
+ switch (xdrs->x_op)
+ {
+ case XDR_ENCODE:
+- return PUTLONG(xdrs, reinterpret_cast < long *>(ip));
++ return PUTLONG(xdrs, reinterpret_cast < SLONG *>(ip));
+
+ case XDR_DECODE:
+- if (!GETLONG(xdrs, reinterpret_cast < long *>(ip)))
++ if (!GETLONG(xdrs, reinterpret_cast < SLONG *>(ip)))
+ return FALSE;
+ return TRUE;
+
+--- firebird-1.5.0.4290/src/jrd/evl.cpp.orig 2003-12-22 18:43:39.000000000 +0100
++++ firebird-1.5.0.4290/src/jrd/evl.cpp 2004-05-29 00:44:05.000000000 +0200
+@@ -1652,7 +1652,7 @@
+ asb_impure = (IASB) ((SCHAR *) request + asb->nod_impure);
+ if (SORT_put(tdbb->tdbb_status_vector,
+ reinterpret_cast<scb*>(asb_impure->iasb_sort_handle),
+- reinterpret_cast<unsigned long**>(&data)))
++ reinterpret_cast<ULONG**>(&data)))
+ {
+ ERR_punt();
+ }