diff options
-rw-r--r-- | config/cmake/HDF5UseFortran.cmake | 97 | ||||
-rw-r--r-- | m4/aclocal_fc.m4 | 105 |
2 files changed, 110 insertions, 92 deletions
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index c3e5a24..75bd17c 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -140,55 +140,64 @@ endif(FORTRAN_HAVE_STORAGE_SIZE) #----------------------------------------------------------------------------- FORTRAN_RUN("REAL and INTEGER KINDs" - " - PROGRAM main + " + PROGRAM main IMPLICIT NONE - INTEGER :: ik, k, lastkind, max_decimal_prec - INTEGER :: num_rkinds, num_ikinds - num_ikinds = 0 - lastkind=SELECTED_INT_KIND(1) + INTEGER :: ik, jk, k, max_decimal_prec + INTEGER :: num_rkinds = 1, num_ikinds = 1 + INTEGER, DIMENSION(1:10) :: list_ikinds = -1 + INTEGER, DIMENSION(1:10) :: list_rkinds = -1 + ! Find integer KINDs - DO ik=2,36 - k = SELECTED_INT_KIND(ik) - IF (k .NE. lastkind) THEN - num_ikinds = num_ikinds + 1 - WRITE(*,'(I0)',ADVANCE='NO') lastkind - lastkind = k - IF(k.GT.0) WRITE(*,'(A)',ADVANCE='NO') ',' - ENDIF - IF (k .LE. 0) EXIT + list_ikinds(num_ikinds)=SELECTED_INT_KIND(1) + DO ik = 2, 36 + k = SELECTED_INT_KIND(ik) + IF(k.LT.0) EXIT + IF(k.GT.list_ikinds(num_ikinds))THEN + num_ikinds = num_ikinds + 1 + list_ikinds(num_ikinds) = k + ENDIF + ENDDO + + DO k = 1, num_ikinds + WRITE(*,'(I0)', ADVANCE='NO') list_ikinds(k) + IF(k.NE.num_ikinds)THEN + WRITE(*,'(A)',ADVANCE='NO') ',' + ELSE + WRITE(*,'()') + ENDIF ENDDO - IF (lastkind.NE.-1) THEN - num_ikinds = num_ikinds + 1 - WRITE(*,'(I0)') lastkind - ELSE - WRITE(*,'()') - ENDIF + ! Find real KINDs - num_rkinds = 0 - lastkind=SELECTED_REAL_KIND(1) - max_decimal_prec = 1 - DO ik=2,36 - k = SELECTED_REAL_KIND(ik) - IF (k .NE. lastkind) THEN - num_rkinds = num_rkinds + 1 - WRITE(*,'(I0)',ADVANCE='NO') lastkind - lastkind = k - IF(k.GT.0) WRITE(*,'(A)',ADVANCE='NO') ',' - max_decimal_prec = ik - ENDIF - IF (k .LE. 0) EXIT + list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1) + max_decimal_prec = 1 + + prec: DO ik = 2, 36 + exp: DO jk = 1, 17000 + k = SELECTED_REAL_KIND(ik,jk) + IF(k.LT.0) EXIT exp + IF(k.GT.list_rkinds(num_rkinds))THEN + num_rkinds = num_rkinds + 1 + list_rkinds(num_rkinds) = k + ENDIF + max_decimal_prec = ik + ENDDO exp + ENDDO prec + + DO k = 1, num_rkinds + WRITE(*,'(I0)', ADVANCE='NO') list_rkinds(k) + IF(k.NE.num_rkinds)THEN + WRITE(*,'(A)',ADVANCE='NO') ',' + ELSE + WRITE(*,'()') + ENDIF ENDDO - IF (lastkind.NE.-1)THEN - num_rkinds = num_rkinds + 1 - WRITE(*,'(I0)') lastkind - ELSE - WRITE(*,'()') - ENDIF - WRITE(*,'(I0)') max_decimal_prec - WRITE(*,'(I0)') num_ikinds - WRITE(*,'(I0)') num_rkinds - END + + WRITE(*,'(I0)') max_decimal_prec + WRITE(*,'(I0)') num_ikinds + WRITE(*,'(I0)') num_rkinds + + END PROGRAM main " XX YY diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index 6d32f10..0672e87 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -325,54 +325,63 @@ rm -f pac_fconftest.out AC_RUN_IFELSE([ AC_LANG_SOURCE([ PROGRAM main - IMPLICIT NONE - INTEGER :: ik, k, lastkind, max_decimal_prec - INTEGER :: num_rkinds, num_ikinds - num_ikinds = 0 - lastkind=SELECTED_INT_KIND(1) - OPEN(8, FILE='pac_fconftest.out', form='formatted') - ! Find integer KINDs - DO ik=2,36 - k = SELECTED_INT_KIND(ik) - IF (k .NE. lastkind) THEN - num_ikinds = num_ikinds + 1 - WRITE(8,'(I0)',ADVANCE='NO') lastkind - lastkind = k - IF(k.GT.0) WRITE(8,'(A)',ADVANCE='NO') ',' - ENDIF - IF (k .LE. 0) EXIT - ENDDO - IF (lastkind.NE.-1) THEN - num_ikinds = num_ikinds + 1 - WRITE(8,'(I0)') lastkind - ELSE - WRITE(8,'()') - ENDIF - ! Find real KINDs - num_rkinds = 0 - lastkind=SELECTED_REAL_KIND(1) - max_decimal_prec = 1 - DO ik=2,36 - k = SELECTED_REAL_KIND(ik) - IF (k .NE. lastkind) THEN - num_rkinds = num_rkinds + 1 - WRITE(8,'(I0)',ADVANCE='NO') lastkind - lastkind = k - IF(k.GT.0) WRITE(8,'(A)',ADVANCE='NO') ',' - max_decimal_prec = ik - ENDIF - IF (k .LE. 0) EXIT - ENDDO - IF (lastkind.NE.-1)THEN - num_rkinds = num_rkinds + 1 - WRITE(8,'(I0)') lastkind - ELSE - WRITE(8,'()') - ENDIF - WRITE(8,'(I0)') max_decimal_prec - WRITE(8,'(I0)') num_ikinds - WRITE(8,'(I0)') num_rkinds - END + IMPLICIT NONE + INTEGER :: ik, jk, k, max_decimal_prec + INTEGER :: num_rkinds = 1, num_ikinds = 1 + INTEGER, DIMENSION(1:10) :: list_ikinds = -1 + INTEGER, DIMENSION(1:10) :: list_rkinds = -1 + + OPEN(8, FILE='pac_fconftest.out', FORM='formatted') + + ! Find integer KINDs + list_ikinds(num_ikinds)=SELECTED_INT_KIND(1) + DO ik = 2, 36 + k = SELECTED_INT_KIND(ik) + IF(k.LT.0) EXIT + IF(k.GT.list_ikinds(num_ikinds))THEN + num_ikinds = num_ikinds + 1 + list_ikinds(num_ikinds) = k + ENDIF + ENDDO + + DO k = 1, num_ikinds + WRITE(8,'(I0)', ADVANCE='NO') list_ikinds(k) + IF(k.NE.num_ikinds)THEN + WRITE(8,'(A)',ADVANCE='NO') ',' + ELSE + WRITE(8,'()') + ENDIF + ENDDO + + ! Find real KINDs + list_rkinds(num_rkinds)=SELECTED_REAL_KIND(1) + max_decimal_prec = 1 + + prec: DO ik = 2, 36 + exp: DO jk = 1, 17000 + k = SELECTED_REAL_KIND(ik,jk) + IF(k.LT.0) EXIT exp + IF(k.GT.list_rkinds(num_rkinds))THEN + num_rkinds = num_rkinds + 1 + list_rkinds(num_rkinds) = k + ENDIF + max_decimal_prec = ik + ENDDO exp + ENDDO prec + + DO k = 1, num_rkinds + WRITE(8,'(I0)', ADVANCE='NO') list_rkinds(k) + IF(k.NE.num_rkinds)THEN + WRITE(8,'(A)',ADVANCE='NO') ',' + ELSE + WRITE(8,'()') + ENDIF + ENDDO + + WRITE(8,'(I0)') max_decimal_prec + WRITE(8,'(I0)') num_ikinds + WRITE(8,'(I0)') num_rkinds + END PROGRAM main ]) ],[ if test -s pac_fconftest.out ; then |