summaryrefslogtreecommitdiffstats
path: root/config/cmake
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2016-05-12 21:57:08 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2016-05-12 21:57:08 (GMT)
commit5871eed008a796f35df53f6dc605dcac7cb428e7 (patch)
tree02132e08569b787b546e5d7dc36e7d86ac4de552 /config/cmake
parent18ad868b231754e4da03c79828e8b18a2d63c80a (diff)
downloadhdf5-5871eed008a796f35df53f6dc605dcac7cb428e7.zip
hdf5-5871eed008a796f35df53f6dc605dcac7cb428e7.tar.gz
hdf5-5871eed008a796f35df53f6dc605dcac7cb428e7.tar.bz2
[svn-r29928] HDFFV-9912:
configure fails to detect valid KINDs on FreeBSD Added the exponential option to SELECTED_REAL_KIND to distinguish KINDs of same precision. Tested: FredBSD, jam, platypus.
Diffstat (limited to 'config/cmake')
-rw-r--r--config/cmake/HDF5UseFortran.cmake97
1 files changed, 53 insertions, 44 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