mk-sik-inc.sh 616 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. compile="$1"
  3. kinds=""
  4. possible_kinds="1 2 4 8 16"
  5. c=0
  6. for k in $possible_kinds; do
  7. echo " integer (kind=$k) :: x" > tmp$$.f90
  8. echo " x = 1_$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 (int_info), parameter :: int_infos(c) = (/ &"
  18. i=0
  19. for k in $kinds; do
  20. # echo -n is not portable
  21. str=" int_info ($k, range(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