autoconf
[Top][All Lists]
Advanced

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

Re: fortran tests similar with C tests ?


From: Steven G. Johnson
Subject: Re: fortran tests similar with C tests ?
Date: Fri, 05 Nov 2004 14:13:17 -0500
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113

Patrice Dumas wrote:
It should not: the architecture is made for these tests to be
implementable independently of the language.

Currently, if I'm not wrong AC_CHECK_SIZEOF checks for C, as it
uses _AC_COMPUTE_INT([(long int) (sizeof ($1))].
This wont work for fortran and even less in a fortran only environment.

You're right, Patrice, the test doesn't carry over directly. I think that Akim was hoping that Fortran could use an _AC_COMPUTE_INT-style of test.

That would rely, however, on (a) having an expression analogous to sizeof(type) in Fortran and (b) implementing AC_LANG_BOOL_COMPILE_TRY in Fortran.

(a) I don't know how to do, but maybe there is a way (you could try asking on comp.lang.fortran)?

(b) is conceivable, with some re-architecting. You can maybe use the same trick as is used in C, that (all?) Fortran compilers give an error if you declare an array with a non-positive size. e.g. you can transform a boolean expression of the form a >= b into a program that declares an array of dimension a - b. I haven't tried this with many compilers, though, so I don't know how portable it is...also, it's not very useful until you solve (a).

My trick is rather complicated and fragile, but I had no better idea. It is unsuitable for cross compiling as it uses AC_RUN_IFELSE. It doesn't
check first that the type is a valid type, but I am not sure that this
is an issue.

AC_RUN_IFELSE may ultimately be the only way to do things. (It was how the C macro used to check sizes, before people figured out the array-declaration trick.)

You assume that your type is a numeric type (you assign it to 1). It will fail, for example, to get sizeof(logical).

Does the Fortran standard require that unformatted writes store the data consecutively (i.e. no padding)?

Cordially,
Steven G. Johnson





reply via email to

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