> 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...
Pat
# _AC_FC_CHECK_SIZEOF (TYPE, [IGNORED], [INCLUDES = DEFAULT-INCLUDES])
# --------------------------------------------------------------------
#
# Determine the size of types for the Fortran.
# First the binary representation of TYPE is written to conftest.unf between
# two a. After that conftest.unf is reread and the distance between 2 'a' gives
# the type length. In the end the detected size is put in conftest.res.
#
# It will fail if there is a 'a' in binary format in the header of
# conftest.unf, if there is a 'a' or a newline in the binary representation.
AC_DEFUN([_AC_FC_CHECK_SIZEOF],
[_AC_FORTRAN_ASSERT()dnl
AC_CACHE_CHECK([for $[]_AC_FC[] size of $1],
[ac_cv_[]_AC_LANG_ABBREV[]_sizeof_$1],
[AC_RUN_IFELSE([AC_LANG_SOURCE([[ program typesize]
$1 [ttype
integer j,k,stat,length
character string*30
logical intype
ttype = 1
open (10,FORM='UNFORMATTED',FILE='conftest.unf',STATUS='NEW',
+IOSTAT=stat,ERR=100)
if (stat .ne. 0) goto 100
write(10) 'a',ttype,'a'
close(10,IOSTAT=stat,ERR=100)
if (stat .ne. 0) goto 100
1000 format (A)
open (10,FILE='conftest.unf',STATUS='OLD',IOSTAT=stat,ERR=100)
if (stat .ne. 0) goto 100
length = 0
intype = .false.
do 20 k=1,6
read (10, 1000, END=110), string
110 continue
do 10 j=1,len(string)
if (intype) then
if (string(j:j) .eq. 'a') then
goto 120
else
length = length + 1
endif
else
if (string(j:j) .eq. 'a') then
intype = .true.
endif
endif
10 continue
20 continue
120 close(10,IOSTAT=stat,ERR=100)
if (stat .ne. 0) goto 100
1100 format (I4)
if (length .gt. 0) then
open (10,FILE='conftest.res',STATUS='NEW',IOSTAT=stat,ERR=100)
if (stat .ne. 0) goto 100
write (10, 1100), length
close(10)
endif
100 continue
stop
end]
])],
[ if test -f 'conftest.res'; then
AS_TR_SH(ac_cv_[]_AC_LANG_ABBREV[]_sizeof_$1)=`cat conftest.res`
rm -f conftest.res
else AS_TR_SH(ac_cv_[]_AC_LANG_ABBREV[]_sizeof_$1)=0
fi
],
[
AS_TR_SH(ac_cv_[]_AC_LANG_ABBREV[]_sizeof_$1)=0
], [])
rm -f conftest.unf])
AC_DEFINE_UNQUOTED(AS_TR_CPP([]_AC_FC[]_sizeof_$1),
$AS_TR_SH(ac_cv_[]_AC_LANG_ABBREV[]_sizeof_$1),
[The size of `$1', detected.])
AS_TR_SH([]_AC_FC[]_sizeof_$1)=$AS_TR_SH(ac_cv_[]_AC_LANG_ABBREV[]_sizeof_$1)
])# _AC_FC_CHECK_SIZEOF
# AC_F77_CHECK_SIZEOF
# -------------------
AC_DEFUN([AC_F77_CHECK_SIZEOF],
[AC_REQUIRE([AC_PROG_F77])dnl
AC_LANG_PUSH(Fortran 77)dnl
_AC_FC_CHECK_SIZEOF([$1],[$2],[$3])
AC_LANG_POP(Fortran 77)dnl
])# AC_F77_CHECK_SIZEOF
# AC_FC_CHECK_SIZEOF
# ------------------
AC_DEFUN([AC_FC_CHECK_SIZEOF],
[AC_REQUIRE([AC_PROG_FC])dnl
AC_LANG_PUSH(Fortran)dnl
_AC_FC_CHECK_SIZEOF([$1],[$2],[$3])
AC_LANG_POP(Fortran)dnl
])# AC_FC_CHECK_SIZEOF
_______________________________________________
Autoconf mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/autoconf