[svn-r10882] Purpose:

Bug fix/improvement

Description:
Added another step to fortran type detection.  This should help on some
bizarre platforms.

Solution:
Formerly, H5fortran_detect.f90 was included in the distribution.  Now
it is generated by H5test_kind.f90 (written by Elena).

Platforms tested:
verbena, modi4, copper
This commit is contained in:
James Laird 2005-06-08 16:05:07 -05:00
parent 24ccb5da13
commit 602a9ce693
5 changed files with 106 additions and 168 deletions

View File

@ -590,8 +590,7 @@
./fortran/src/H5f90i.h
./fortran/src/H5f90kit.c
./fortran/src/H5f90proto.h
./fortran/src/H5fortran_detect.f90
./fortran/src/H5fortran_detect_gen.f90
./fortran/src/H5test_kind.f90
./fortran/src/H5fortran_flags.f90
./fortran/src/H5match_types.c
./fortran/src/HDF5.f90

View File

@ -1,95 +0,0 @@
program int_kind
write(*,*) " /*generating header file*/ "
call i01()
call i02()
call i04()
call i08()
end program int_kind
subroutine i01()
implicit none
integer( 1 ) :: a
integer :: a_size
a_size = bit_size(a)
if (a_size .eq. 8) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_1"
endif
if (a_size .eq. 16) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_2"
endif
if (a_size .eq. 32) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_4"
endif
if (a_size .eq. 64) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_8"
endif
if (a_size .eq. 128) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_16"
endif
return
end subroutine
subroutine i02()
implicit none
integer( 2 ) :: a
integer :: a_size
a_size = bit_size(a)
if (a_size .eq. 8) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_1"
endif
if (a_size .eq. 16) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_2"
endif
if (a_size .eq. 32) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_4"
endif
if (a_size .eq. 64) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_8"
endif
if (a_size .eq. 128) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_16"
endif
return
end subroutine
subroutine i04()
implicit none
integer( 4 ) :: a
integer :: a_size
a_size = bit_size(a)
if (a_size .eq. 8) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_1"
endif
if (a_size .eq. 16) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_2"
endif
if (a_size .eq. 32) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_4"
endif
if (a_size .eq. 64) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_8"
endif
if (a_size .eq. 128) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_16"
endif
return
end subroutine
subroutine i08()
implicit none
integer( 8 ) :: a
integer :: a_size
a_size = bit_size(a)
if (a_size .eq. 8) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_1"
endif
if (a_size .eq. 16) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_2"
endif
if (a_size .eq. 32) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_4"
endif
if (a_size .eq. 64) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_8"
endif
if (a_size .eq. 128) then
write(*,*) "#define H5_FORTRAN_HAS_INTEGER_16"
endif
return
end subroutine

View File

@ -55,7 +55,8 @@ DISTCLEANFILES=h5fc libhdf5_fortran.settings
# H5fortran_types.f90 and H5f90i.h are automatically generaed by
# H5match_types, and must be cleaned explicitly. H5fort_type_defines.h
# is generated by H5fortran_detect
MOSTLYCLEANFILES=H5fortran_types.f90 H5f90i_gen.h H5fort_type_defines.h
MOSTLYCLEANFILES=H5fortran_types.f90 H5f90i_gen.h H5fort_type_defines.h \
H5fortran_detect.f90
# Fortran module files can have different extensions and different names
# (e.g., different capitalizations) on different platforms. Write rules
@ -101,29 +102,33 @@ endif
# and matching them to C types. This is accomplished using helper
# programs.
# It's a bit tricky to make sure that Automake builds things in the right
# order (especially when using 'gmake -j ...'
# H5fortran_detect.f90 needs to be compiled into H5fortran_detect.
# This program is run, and its output is saved in H5fort_type_defines.h
# order (especially when using 'gmake -j ...')
# H5test_kind is compiled and run to produce H5fortran_detect.f90.
# H5fortran_detect is compiled and run to produce H5fort_type_defines.h.
# H5match_types.c then includes this file and can be compiled into
# H5match_types. When H5match_types is run, it creates H5f90i_gen.h
# and H5fortran_types.f90, which are needed by the Fortran library.
# and H5fortran_types.f90, which are included in the Fortran library.
# These are the helper programs we need to build.
noinst_PROGRAMS = H5match_types H5fortran_detect
noinst_PROGRAMS = H5match_types H5fortran_detect H5test_kind
# Tell Automake to create H5f90i_gen.h before it does anything else.
# When it creates H5f90i_gen.h, it will create H5fortran_types.f90 as
# a side effect.
# Tell Automake to create H5f90i_gen.h before it builds the library
# sources. When it creates H5f90i_gen.h, it will create
# H5fortran_types.f90 as a side effect.
BUILT_SOURCES = H5f90i_gen.h
# Specify what Automake needs to create: first the H5fort_type_defines.h
#Specify what Automake needs to create: first the H5fort_type_defines.h
# header, then H5match_types which includes that header, then
# it needs to run H5match_types.
H5fortran_types.f90 H5f90i_gen.h: H5match_types.c
$(MAKE) $(AM_MAKEFLAGS) H5fort_type_defines.h
H5fortran_types.f90 H5f90i_gen.h: H5match_types.c H5fort_type_defines.h
$(MAKE) $(AM_MAKEFLAGS) H5match_types$(EXEEXT)
$(RUNSERIAL) ./H5match_types$(EXEEXT)
# JAMES: does it need to work like this? $(MAKE) $(AM_MAKEFLAGS) H5fort_type_defines.h
# JAMES $(MAKE) $(AM_MAKEFLAGS) H5match_types$(EXEEXT)
# JAMES $(RUNSERIAL) ./H5match_types$(EXEEXT)
# H5fort_type_defines.h is created by running H5fortran_detect.
# Obviously, H5fortran_detect needs to be built first.
H5fort_type_defines.h: H5fortran_detect$(EXEEXT)
@ -131,10 +136,16 @@ H5fort_type_defines.h: H5fortran_detect$(EXEEXT)
# Automake knows how to build fortran programs if we tell it the source
# files.
# H5fortran_detect_gen.f90 is generated by running H5fortran_detect.f90.
# Only developers should need to do so.
H5fortran_detect_SOURCES = H5fortran_detect.f90
# H5test_kind.f90 generates H5fortran_detect.f90.
H5fortran_detect.f90: H5test_kind$(EXEEXT)
$(RUNSERIAL) ./H5test_kind$(EXEEXT) > H5fortran_detect.f90
# H5test_kind.f90 is included in the distribution, and Automake knows
# how to compile a fortran program given its sources.
H5test_kind_SOURCES = H5test_kind.f90
# Mark this directory as part of the Fortran API
HDF_FORTRAN=yes
@ -142,27 +153,29 @@ HDF_FORTRAN=yes
# determining this automagically (like we do with the C files). So, when
# doing a parallel make, some modules could be made way before the
# modules they depend upon are actually made. *sigh*
H5fortran_flags.lo: $(srcdir)/H5fortran_flags.f90
H5f90global.lo: $(srcdir)/H5f90global.f90 H5fortran_flags.lo H5fortran_types.lo
H5fortran_types.lo: H5fortran_types.f90
H5_ff.lo: $(srcdir)/H5_ff.f90 H5f90global.lo
H5Aff.lo: $(srcdir)/H5Aff.f90 H5f90global.lo
H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo
H5Eff.lo: $(srcdir)/H5Eff.f90 H5f90global.lo
H5Fff.lo: $(srcdir)/H5Fff.f90 H5f90global.lo
H5Gff.lo: $(srcdir)/H5Gff.f90 H5f90global.lo
H5Iff.lo: $(srcdir)/H5Iff.f90 H5f90global.lo
H5Pff.lo: $(srcdir)/H5Pff.f90 H5f90global.lo
H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo
H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo
H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo
H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo
HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5Aff.lo \
H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo \
H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo
H5FDmpioff.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo
HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5Aff.lo \
H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo \
H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo H5FDmpioff.lo
H5fortran_flags.lo: $(srcdir)/H5fortran_flags.f90
H5f90global.lo: $(srcdir)/H5f90global.f90 H5fortran_flags.lo H5fortran_types.lo
H5fortran_types.lo: H5fortran_types.f90
H5fortran_detect.lo: H5fortran_detect.f90
H5test_kind.lo: $(srcdir)/H5test_kind.f90
H5_ff.lo: $(srcdir)/H5_ff.f90 H5f90global.lo
H5Aff.lo: $(srcdir)/H5Aff.f90 H5f90global.lo
H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo
H5Eff.lo: $(srcdir)/H5Eff.f90 H5f90global.lo
H5Fff.lo: $(srcdir)/H5Fff.f90 H5f90global.lo
H5Gff.lo: $(srcdir)/H5Gff.f90 H5f90global.lo
H5Iff.lo: $(srcdir)/H5Iff.f90 H5f90global.lo
H5Pff.lo: $(srcdir)/H5Pff.f90 H5f90global.lo
H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo
H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo
H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo
H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo
HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5Aff.lo \
H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo \
H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo
H5FDmpioff.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo
HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5Aff.lo \
H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo \
H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo H5FDmpioff.lo
include $(top_srcdir)/config/conclude.am

View File

@ -32,7 +32,7 @@
SOURCES = $(libhdf5_fortran_la_SOURCES) $(H5fortran_detect_SOURCES) H5match_types.c
SOURCES = $(libhdf5_fortran_la_SOURCES) $(H5fortran_detect_SOURCES) H5match_types.c $(H5test_kind_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@ -60,7 +60,8 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/h5fc.in $(srcdir)/libhdf5_fortran.settings.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
noinst_PROGRAMS = H5match_types$(EXEEXT) H5fortran_detect$(EXEEXT)
noinst_PROGRAMS = H5match_types$(EXEEXT) H5fortran_detect$(EXEEXT) \
H5test_kind$(EXEEXT)
subdir = fortran/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
@ -102,6 +103,9 @@ H5fortran_detect_LDADD = $(LDADD)
H5match_types_SOURCES = H5match_types.c
H5match_types_OBJECTS = H5match_types.$(OBJEXT)
H5match_types_LDADD = $(LDADD)
am_H5test_kind_OBJECTS = H5test_kind.$(OBJEXT)
H5test_kind_OBJECTS = $(am_H5test_kind_OBJECTS)
H5test_kind_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
am__depfiles_maybe = depfiles
@ -119,9 +123,10 @@ FCLD = $(FC)
FCLINK = $(LIBTOOL) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libhdf5_fortran_la_SOURCES) $(H5fortran_detect_SOURCES) \
H5match_types.c
H5match_types.c $(H5test_kind_SOURCES)
DIST_SOURCES = $(am__libhdf5_fortran_la_SOURCES_DIST) \
$(H5fortran_detect_SOURCES) H5match_types.c
$(H5fortran_detect_SOURCES) H5match_types.c \
$(H5test_kind_SOURCES)
settingsDATA_INSTALL = $(INSTALL_DATA)
DATA = $(settings_DATA)
ETAGS = etags
@ -367,7 +372,9 @@ DISTCLEANFILES = h5fc libhdf5_fortran.settings
# H5fortran_types.f90 and H5f90i.h are automatically generaed by
# H5match_types, and must be cleaned explicitly. H5fort_type_defines.h
# is generated by H5fortran_detect
MOSTLYCLEANFILES = H5fortran_types.f90 H5f90i_gen.h H5fort_type_defines.h
MOSTLYCLEANFILES = H5fortran_types.f90 H5f90i_gen.h H5fort_type_defines.h \
H5fortran_detect.f90
# Install libhdf5_fortran.settings in lib directory
settingsdir = $(libdir)
@ -378,17 +385,19 @@ settings_DATA = libhdf5_fortran.settings
# is configured for parallel mode
@BUILD_PARALLEL_CONDITIONAL_TRUE@H5FC_NAME = h5pfc
# Tell Automake to create H5f90i_gen.h before it does anything else.
# When it creates H5f90i_gen.h, it will create H5fortran_types.f90 as
# a side effect.
# Tell Automake to create H5f90i_gen.h before it builds the library
# sources. When it creates H5f90i_gen.h, it will create
# H5fortran_types.f90 as a side effect.
BUILT_SOURCES = H5f90i_gen.h
# Automake knows how to build fortran programs if we tell it the source
# files.
# H5fortran_detect_gen.f90 is generated by running H5fortran_detect.f90.
# Only developers should need to do so.
H5fortran_detect_SOURCES = H5fortran_detect.f90
# H5test_kind.f90 is included in the distribution, and Automake knows
# how to compile a fortran program given its sources.
H5test_kind_SOURCES = H5test_kind.f90
# Mark this directory as part of the Fortran API
HDF_FORTRAN = yes
@ -484,6 +493,9 @@ H5fortran_detect$(EXEEXT): $(H5fortran_detect_OBJECTS) $(H5fortran_detect_DEPEND
H5match_types$(EXEEXT): $(H5match_types_OBJECTS) $(H5match_types_DEPENDENCIES)
@rm -f H5match_types$(EXEEXT)
$(LINK) $(H5match_types_LDFLAGS) $(H5match_types_OBJECTS) $(H5match_types_LDADD) $(LIBS)
H5test_kind$(EXEEXT): $(H5test_kind_OBJECTS) $(H5test_kind_DEPENDENCIES)
@rm -f H5test_kind$(EXEEXT)
$(FCLINK) $(H5test_kind_LDFLAGS) $(H5test_kind_OBJECTS) $(H5test_kind_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -776,45 +788,54 @@ uninstall-local:
install-exec-local:
$(INSTALL) h5fc $(bindir)/$(H5FC_NAME)
# Specify what Automake needs to create: first the H5fort_type_defines.h
#Specify what Automake needs to create: first the H5fort_type_defines.h
# header, then H5match_types which includes that header, then
# it needs to run H5match_types.
H5fortran_types.f90 H5f90i_gen.h: H5match_types.c
$(MAKE) $(AM_MAKEFLAGS) H5fort_type_defines.h
H5fortran_types.f90 H5f90i_gen.h: H5match_types.c H5fort_type_defines.h
$(MAKE) $(AM_MAKEFLAGS) H5match_types$(EXEEXT)
$(RUNSERIAL) ./H5match_types$(EXEEXT)
# JAMES: does it need to work like this? $(MAKE) $(AM_MAKEFLAGS) H5fort_type_defines.h
# JAMES $(MAKE) $(AM_MAKEFLAGS) H5match_types$(EXEEXT)
# JAMES $(RUNSERIAL) ./H5match_types$(EXEEXT)
# H5fort_type_defines.h is created by running H5fortran_detect.
# Obviously, H5fortran_detect needs to be built first.
H5fort_type_defines.h: H5fortran_detect$(EXEEXT)
$(RUNSERIAL) ./H5fortran_detect$(EXEEXT) > H5fort_type_defines.h
# H5test_kind.f90 generates H5fortran_detect.f90.
H5fortran_detect.f90: H5test_kind$(EXEEXT)
$(RUNSERIAL) ./H5test_kind$(EXEEXT) > H5fortran_detect.f90
# Hardcode the dependencies of these files. There isn't a known way of
# determining this automagically (like we do with the C files). So, when
# doing a parallel make, some modules could be made way before the
# modules they depend upon are actually made. *sigh*
H5fortran_flags.lo: $(srcdir)/H5fortran_flags.f90
H5f90global.lo: $(srcdir)/H5f90global.f90 H5fortran_flags.lo H5fortran_types.lo
H5fortran_types.lo: H5fortran_types.f90
H5_ff.lo: $(srcdir)/H5_ff.f90 H5f90global.lo
H5Aff.lo: $(srcdir)/H5Aff.f90 H5f90global.lo
H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo
H5Eff.lo: $(srcdir)/H5Eff.f90 H5f90global.lo
H5Fff.lo: $(srcdir)/H5Fff.f90 H5f90global.lo
H5Gff.lo: $(srcdir)/H5Gff.f90 H5f90global.lo
H5Iff.lo: $(srcdir)/H5Iff.f90 H5f90global.lo
H5Pff.lo: $(srcdir)/H5Pff.f90 H5f90global.lo
H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo
H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo
H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo
H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo
HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5Aff.lo \
H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo \
H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo
H5FDmpioff.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo
HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5Aff.lo \
H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo \
H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo H5FDmpioff.lo
H5fortran_flags.lo: $(srcdir)/H5fortran_flags.f90
H5f90global.lo: $(srcdir)/H5f90global.f90 H5fortran_flags.lo H5fortran_types.lo
H5fortran_types.lo: H5fortran_types.f90
H5fortran_detect.lo: H5fortran_detect.f90
H5test_kind.lo: $(srcdir)/H5test_kind.f90
H5_ff.lo: $(srcdir)/H5_ff.f90 H5f90global.lo
H5Aff.lo: $(srcdir)/H5Aff.f90 H5f90global.lo
H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo
H5Eff.lo: $(srcdir)/H5Eff.f90 H5f90global.lo
H5Fff.lo: $(srcdir)/H5Fff.f90 H5f90global.lo
H5Gff.lo: $(srcdir)/H5Gff.f90 H5f90global.lo
H5Iff.lo: $(srcdir)/H5Iff.f90 H5f90global.lo
H5Pff.lo: $(srcdir)/H5Pff.f90 H5f90global.lo
H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo
H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo
H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo
H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo
HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5Aff.lo \
H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo \
H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo
H5FDmpioff.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo
HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5Aff.lo \
H5Dff.lo H5Eff.lo H5Fff.lo H5Gff.lo H5Iff.lo \
H5Pff.lo H5Rff.lo H5Sff.lo H5Tff.lo H5Zff.lo H5FDmpioff.lo
# lib/progs/tests targets recurse into subdirectories. build-* targets
# build files in this directory.