[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] ia64 long double alignment test
From: |
Brett Cundal |
Subject: |
Re: [Help-smalltalk] ia64 long double alignment test |
Date: |
Mon, 7 Jun 2004 14:58:04 -0700 |
User-agent: |
Mutt/1.5.5.1+cvs20040105i |
On Thu, Jun 03, 2004 at 09:00:29AM -0700, Brett Cundal wrote:
> Heya,
>
> I've received some assistance in trying to track down the cause for
> the build failures on most 64-bit archs, and I think I may have
> tracked it down at least for ia64.
>
> There's a test in aclocal.m4 (included from config/align.m4) which
> attempts to determine the alignment of double and long double
> types. This test gives the following result on ia64:
[snip]
> So the test appears to be bad. I found the following test:
[snip]
> Does this test work? I don't have access to any 64-bit archs to test
> this.
I've discovered that the answer to this is no... The code I had
doesn't work at all. It tests for something different, if it works at
all.
Here's the fix I've implemented and will test on all the arches Debian
supports:
# GST_CHECK_ALIGNOF(TYPE, [INCLUDES = DEFAULT-INCLUDES])
# -----------------------------------------------------
AC_DEFUN([GST_CHECK_ALIGNMENT],
[AS_LITERAL_IF([$1], [],
[AC_FATAL([$0: requires literal arguments])])dnl
AC_CHECK_TYPE([$1], [], [], [$2])
AC_CACHE_CHECK([alignment of $1], AS_TR_SH([gst_cv_$1_alignment]),
[if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
_AC_COMPUTE_INT([offsetof (struct { char x; $1 y; }, y)],
[AS_TR_SH([gst_cv_$1_alignment])],
[AC_INCLUDES_DEFAULT([$2])
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member -
(char *) 0)
#endif],
[AC_MSG_FAILURE([cannot compute alignment of ($1),
77])])
else
AS_TR_SH([gst_cv_$1_alignment])=0
fi])dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP($1_alignment),
$AS_TR_SH([gst_cv_$1_alignment]),
[The normal alignment of `$1', in bytes.])
])# GST_CHECK_ALIGNMENT
This is lifted from a patch for an upcoming release of auoconf, so I'm
pretty confident it does the trick. I've mucked it up a bit to get it
to set the same defines as the old code, so that I wouldn't have to
patch everything that uses the results of the old test. This is the
core of the test:
offsetof (struct { char x; $1 y; }, y);
This is simple enough that even I can understand it, and it looks
correct to me.
Anyhow, submitting this fix upstream. I'm not 100% sure it works, but
I'm pretty sure - and I am 100% sure that the existing align.m4 is
broken.
-- Brett
signature.asc
Description: Digital signature