]>
Commit | Line | Data |
---|---|---|
32aa3bff FXC |
1 | #!/bin/sh |
2 | ||
3 | compile="$1" | |
4 | ||
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" | |
8 | ||
9 | ||
10 | largest="" | |
11 | for k in $possible_integer_kinds; do | |
12 | echo " integer (kind=$k) :: i" > tmp$$.f90 | |
13 | echo " end" >> tmp$$.f90 | |
14 | if $compile -c tmp$$.f90 > /dev/null 2>&1; then | |
15 | s=`expr 8 \* $k` | |
16 | largest="$k" | |
17 | ||
18 | if [ $s -eq 128 ]; then | |
19 | prefix="__" | |
20 | else | |
21 | prefix="" | |
22 | fi | |
23 | ||
24 | echo "typedef ${prefix}int${s}_t GFC_INTEGER_${k};" | |
25 | echo "typedef ${prefix}uint${s}_t GFC_UINTEGER_${k};" | |
26 | echo "typedef GFC_INTEGER_${k} GFC_LOGICAL_${k};" | |
27 | echo "#define HAVE_GFC_INTEGER_${k}" | |
28 | fi | |
29 | rm -f tmp$$.* | |
30 | done | |
31 | ||
32 | echo "#define GFC_INTEGER_LARGEST GFC_INTEGER_${largest}" | |
33 | echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}" | |
34 | echo "" | |
35 | ||
36 | ||
37 | largest_ctype="" | |
38 | for k in $possible_real_kinds; do | |
39 | echo " real (kind=$k) :: x" > tmp$$.f90 | |
40 | echo " end" >> tmp$$.f90 | |
41 | if $compile -c tmp$$.f90 > /dev/null 2>&1; then | |
42 | case $k in | |
43 | 4) ctype="float" ;; | |
44 | 8) ctype="double" ;; | |
45 | 10) ctype="long double" ;; | |
46 | 16) ctype="long double" ;; | |
47 | *) echo "$0: Unknown type" >&2 ; exit 1 ;; | |
48 | esac | |
49 | largest_ctype="$ctype" | |
50 | echo "typedef ${ctype} GFC_REAL_${k};" | |
51 | echo "typedef complex ${ctype} GFC_COMPLEX_${k};" | |
52 | echo "#define HAVE_GFC_REAL_${k}" | |
53 | fi | |
54 | rm -f tmp$$.* | |
55 | done | |
56 | ||
57 | case $largest_ctype in | |
58 | float) echo "#define GFC_REAL_LARGEST_FORMAT \"\"" ;; | |
59 | double) echo "#define GFC_REAL_LARGEST_FORMAT \"l\"" ;; | |
60 | "long double") echo "#define GFC_REAL_LARGEST_FORMAT \"L\"" ;; | |
61 | *) echo "$0: Unknown type" >&2 ; exit 1 ;; | |
62 | esac | |
63 | echo "#define GFC_REAL_LARGEST $largest_ctype" | |
64 | ||
65 | exit 0 |