mk-srk-inc.sh 653 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. compile="$1"
  3. kinds=""
  4. possible_kinds="4 8 10 16"
  5. c=0
  6. for k in $possible_kinds; do
  7. echo " real (kind=$k) :: x" > tmp$$.f90
  8. echo " x = 1.0_$k" >> tmp$$.f90
  9. echo " end" >> tmp$$.f90
  10. if $compile -S tmp$$.f90 > /dev/null 2>&1; then
  11. kinds="$kinds $k"
  12. c=`expr $c + 1`
  13. fi
  14. rm -f tmp$$.*
  15. done
  16. echo " integer, parameter :: c = $c"
  17. echo " type (real_info), parameter :: real_infos(c) = (/ &"
  18. i=0
  19. for k in $kinds; do
  20. # echo -n is not portable
  21. str=" real_info ($k, precision(0.0_$k), range(0.0_$k), radix(0.0_$k))"
  22. i=`expr $i + 1`
  23. if [ $i -lt $c ]; then
  24. echo "$str, &"
  25. else
  26. echo "$str /)"
  27. fi
  28. done
  29. exit 0