5 # Possible types must be listed in ascending order
6 possible_integer_kinds="1 2 4 8 16"
7 possible_real_kinds="4 8 10 16"
12 for k in $possible_integer_kinds; do
13 echo " integer (kind=$k) :: i" > tmp$$.f90
14 echo " end" >> tmp$$.f90
15 if $compile -c tmp$$.f90 > /dev/null 2>&1; then
19 if [ $s -eq 128 ]; then
25 if [ "$smallest" = "" ]; then
29 echo "typedef ${prefix}int${s}_t GFC_INTEGER_${k};"
30 echo "typedef ${prefix}uint${s}_t GFC_UINTEGER_${k};"
31 echo "typedef GFC_INTEGER_${k} GFC_LOGICAL_${k};"
32 echo "#define HAVE_GFC_LOGICAL_${k}"
33 echo "#define HAVE_GFC_INTEGER_${k}"
39 echo "#define GFC_INTEGER_LARGEST GFC_INTEGER_${largest}"
40 echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}"
41 echo "#define GFC_DEFAULT_CHAR ${smallest}"
45 for k in $possible_real_kinds; do
46 echo " real (kind=$k) :: x" > tmp$$.f90
47 echo " end" >> tmp$$.f90
48 if $compile -c tmp$$.f90 > /dev/null 2>&1; then
50 4) ctype="float" ; suffix="f" ;;
51 8) ctype="double" ; suffix="" ;;
52 10) ctype="long double" ; suffix="l" ;;
53 16) ctype="long double" ; suffix="l" ;;
54 *) echo "$0: Unknown type" >&2 ; exit 1 ;;
57 # Check for the value of HUGE
58 echo "print *, huge(0._$k) ; end" > tmq$$.f90
59 huge=`$compile -c -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
60 | sed 's/ *TRANSFER *// ; s/_.*//'`
63 # Check for the value of DIGITS
64 echo "print *, digits(0._$k) ; end" > tmq$$.f90
65 digits=`$compile -c -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
66 | sed 's/ *TRANSFER *//'`
69 # Check for the value of RADIX
70 echo "print *, radix(0._$k) ; end" > tmq$$.f90
71 radix=`$compile -c -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
72 | sed 's/ *TRANSFER *//'`
75 # Output the information we've gathered
76 echo "typedef ${ctype} GFC_REAL_${k};"
77 echo "typedef complex ${ctype} GFC_COMPLEX_${k};"
78 echo "#define HAVE_GFC_REAL_${k}"
79 echo "#define HAVE_GFC_COMPLEX_${k}"
80 echo "#define GFC_REAL_${k}_HUGE ${huge}${suffix}"
81 echo "#define GFC_REAL_${k}_DIGITS ${digits}"
82 echo "#define GFC_REAL_${k}_RADIX ${radix}"