slumos
10/31/2003 2:00:00 AM
Daniel Berger <djberge@qwest.com> writes:
> Hi all,
>
> Solaris 9
> gcc 3.3.1
> Ruby 1.8.1 p2
> Sunblade 100, UltraSparc IIe
>
> As usual, I'm playing with things I don't truly understand. Anyway, I
> thought I'd try building 1.8.1 p2 as 64 bit since I've upgraded my
> compiler since last time.
>
> After running configure, I manually added "-m64 -mcpu=ultrasparc" into
> the CC line of the Makefile. I seemed to get further this time, and
> died with a different error:
>
> gcc -m64 -mcpu=ultrasparc -g -O2 -I. -I. -c io.c
> io.c: In function `rb_read_pending':
> io.c:259: error: structure has no member named `_cnt'
It's because FILE on 64-bit Solaris is opaque. This patch is against
1.8.0, but hopefully somebody can adapt it. The patch to defines.h in
here is for a different problem and should probably be reviewed.
Steve
diff -u ruby-1.8.0/configure.in ruby-1.8.0.suncc/configure.in
--- ruby-1.8.0/configure.in 2003-07-29 18:57:26.000000000 -0700
+++ ruby-1.8.0.suncc/configure.in 2003-09-03 11:41:07.373229000 -0700
@@ -561,6 +561,9 @@
fi
fi
+AC_CHECK_HEADERS(stdio_ext.h)
+AC_CHECK_FUNCS(__fpending)
+
AC_DEFUN(RUBY_CHECK_IO_NEED,
[AC_CACHE_CHECK(whether need to [$1], [$2],
[AC_TRY_RUN([
diff -u ruby-1.8.0/defines.h ruby-1.8.0.suncc/defines.h
--- ruby-1.8.0/defines.h 2003-08-01 03:57:18.000000000 -0700
+++ ruby-1.8.0.suncc/defines.h 2003-09-03 12:24:45.552186000 -0700
@@ -141,6 +141,8 @@
{
# if defined(__sparc_v9__) || defined(__arch64__)
asm volatile ("flushw" : :);
+# elif defined(__sparcv9) /* Sun compiler */
+ asm ("flushw");
# elif defined(linux) || defined(__linux__)
asm volatile ("ta 0x83");
# else /* Solaris, OpenBSD, NetBSD, etc. */
diff -u ruby-1.8.0/io.c ruby-1.8.0.suncc/io.c
--- ruby-1.8.0/io.c 2003-08-03 22:28:50.000000000 -0700
+++ ruby-1.8.0.suncc/io.c 2003-09-03 11:42:07.958468000 -0700
@@ -132,6 +132,9 @@
#elif defined(FILE_READEND)
# define READ_DATA_PENDING(fp) ((fp)->FILE_READPTR < (fp)->FILE_READEND)
# define READ_DATA_PENDING_COUNT(fp) ((fp)->FILE_READEND - (fp)->FILE_READPTR)
+#elif defined(HAVE___FPENDING)
+# define READ_DATA_PENDING(fp) (__fpending(fp) > 0)
+# define READ_DATA_PENDING_COUNT(fp) (__fpending(fp))
#elif defined(__BEOS__)
# define READ_DATA_PENDING(fp) (fp->_state._eof == 0)
#elif defined(__VMS)
diff -u ruby-1.8.0/rubyio.h ruby-1.8.0.suncc/rubyio.h
--- ruby-1.8.0/rubyio.h 2003-04-14 02:04:43.000000000 -0700
+++ ruby-1.8.0.suncc/rubyio.h 2003-09-03 11:40:20.359152000 -0700
@@ -16,6 +16,10 @@
#include <stdio.h>
#include <errno.h>
+#ifdef HAVE_STDIO_EXT_H
+#include <stdio_ext.h>
+#endif
+
typedef struct OpenFile {
FILE *f; /* stdio ptr for read/write */
FILE *f2; /* additional ptr for rw pipes */