7 # Possible types must be listed in ascending order
8 possible_integer_kinds
="1 2 4 8 16"
9 possible_real_kinds
="4 8 10 16"
14 for k
in $possible_integer_kinds; do
15 echo " integer (kind=$k) :: i" > tmp$$.f90
16 echo " i = 1_$k" >> tmp$$.f90
17 echo " end" >> tmp$$.f90
18 if $compile -S tmp$$.f90
> /dev
/null
2>&1; then
22 if [ $s -eq 128 ]; then
28 if [ "$smallest" = "" ]; then
32 echo "typedef ${prefix}int${s}_t GFC_INTEGER_${k};"
33 echo "typedef ${prefix}uint${s}_t GFC_UINTEGER_${k};"
34 echo "typedef GFC_INTEGER_${k} GFC_LOGICAL_${k};"
35 echo "#define HAVE_GFC_LOGICAL_${k}"
36 echo "#define HAVE_GFC_INTEGER_${k}"
42 echo "#define GFC_INTEGER_LARGEST GFC_INTEGER_${largest}"
43 echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}"
44 echo "#define GFC_DEFAULT_CHAR ${smallest}"
49 for k
in $possible_real_kinds; do
50 echo " real (kind=$k) :: x" > tmp$$.f90
51 echo " x = 1.0_$k" >> tmp$$.f90
52 echo " end" >> tmp$$.f90
53 if $compile -S tmp$$.f90
> /dev
/null
2>&1; then
55 4) ctype
="float" ; suffix
="f" ;;
56 8) ctype
="double" ; suffix
="" ;;
57 10) ctype
="long double" ; suffix
="l" ; REAL_10_FOUND
=1 ;;
58 16) ctype
="long double"
60 # Disable REAL(16) if it is just __float128
61 # until the library is fixed
62 if [ -n "$REAL_10_FOUND" ]; then
66 *) echo "$0: Unknown type" >&2 ; exit 1 ;;
69 # Check for the value of HUGE
70 echo "print *, huge(0._$k) ; end" > tmq$$.f90
71 huge
=`$compile -S -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
72 | sed 's/ *TRANSFER *//' | sed 's/_.*//'`
75 # Check for the value of DIGITS
76 echo "print *, digits(0._$k) ; end" > tmq$$.f90
77 digits
=`$compile -S -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
78 | sed 's/ *TRANSFER *//'`
81 # Check for the value of RADIX
82 echo "print *, radix(0._$k) ; end" > tmq$$.f90
83 radix
=`$compile -S -fdump-parse-tree tmq$$.f90 | grep TRANSFER \
84 | sed 's/ *TRANSFER *//'`
87 # Output the information we've gathered
88 echo "typedef ${ctype} GFC_REAL_${k};"
89 echo "typedef complex ${ctype} GFC_COMPLEX_${k};"
90 echo "#define HAVE_GFC_REAL_${k}"
91 echo "#define HAVE_GFC_COMPLEX_${k}"
92 echo "#define GFC_REAL_${k}_HUGE ${huge}${suffix}"
93 echo "#define GFC_REAL_${k}_LITERAL_SUFFIX ${suffix}"
94 if [ "x$suffix" = "x" ]; then
95 echo "#define GFC_REAL_${k}_LITERAL(X) (X)"
97 echo "#define GFC_REAL_${k}_LITERAL(X) (X ## ${suffix})"
99 echo "#define GFC_REAL_${k}_DIGITS ${digits}"
100 echo "#define GFC_REAL_${k}_RADIX ${radix}"