autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: defined(IRIX)


From: Philip Willoughby
Subject: Re: defined(IRIX)
Date: Fri, 27 Sep 2002 13:39:25 +0100 (BST)

Today, Thomas Dickey wrote:

>On Fri, Sep 27, 2002 at 08:58:18AM +0200, Akim Demaille wrote:
>>
>> | # PGAC_CHECK_ALIGNOF(TYPE, [INCLUDES = DEFAULT-INCLUDES])
>> | # -----------------------------------------------------
>> | # Find the alignment requirement of the given type. Define the result
>> | # as ALIGNOF_TYPE.  This macro works even when cross compiling.
>> | # (Modelled after AC_CHECK_SIZEOF.)
>> |
>> | AC_DEFUN([PGAC_CHECK_ALIGNOF],
>> | [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([pgac_cv_alignof_$1])],
>> | [if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
>> |   _AC_COMPUTE_INT([((char*) & pgac_struct.field) - ((char*) & 
>> pgac_struct)],
>> |                   [AS_TR_SH([pgac_cv_alignof_$1])],
>> |                   [AC_INCLUDES_DEFAULT([$2])
>> | struct { char filler; $1 field; } pgac_struct;],
>> |                   [AC_MSG_ERROR([cannot compute alignment of $1, 77])])
>> | else
>> |   AS_TR_SH([pgac_cv_alignof_$1])=0
>> | fi])dnl
>> | AC_DEFINE_UNQUOTED(AS_TR_CPP(alignof_$1),
>> |                    [$AS_TR_SH([pgac_cv_alignof_$1])],
>> |                    [The alignment requirement of a `$1'])
>> | ])# PGAC_CHECK_ALIGNOF
>>
>> This guy seems swallowable...  It's impressively already in 2.5x style :)
>
>There is form, but no content.  This can be done using AC_TRY_RUN (or other
>runtime check), is otherwise no better than a random guess.  Alignment problems
>don't show up in compiling, but at runtime.

This code will work providing the compiler knows how to align the type
you're testing -- and since if it doesn't nothing's going to work anyway,
this seems like a reasonable test to me.  Add in the fact that PostgreSQL
manifestly does build correctly, and I think we can say it has content...

Regards,

Philip Willoughby

Systems Programmer, Department of Computing, Imperial College, London, UK
-- 
echo address@hidden | tr "bizndfohces" "pwgd9ociaku"

Why reinvent the wheel? . . . . . . . . . Because we can make it rounder...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]