[Top][All Lists]

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

Re: fortran tests similar with C tests ?

From: Patrice Dumas
Subject: Re: fortran tests similar with C tests ?
Date: Sat, 16 Oct 2004 02:14:41 +0200
User-agent: Mutt/1.4.1i

> 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. 

> Dive into fortran.m4 and complete the missing bits.

I don't know for sure what to do, but I made a macro that checks for
fortran type length. I called it AC_FC_CHECK_SIZEOF and AC_F77_CHECK_SIZEOF.
I tried to mimick the code I found in other autoconf macros.

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.

Basically it writes to a binary file, using the binary representation, a 1 in 
a variable with the checked type, surrounded by 2 'a'. After that it reread
the file and computes the distance between the 2 'a'. Then it writes the 
result in another file. It will fail if there is a 'a' in binary format in 
the binary headers of the binary file, if there is a 'a' or a newline in the 
binary representation of 1 for a given type. There might be better solutions...


Attachment: typesize.m4
Description: Text document

reply via email to

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