Makefile.am: Add install-pdf target as copied from automake v1.10 rules.
[official-gcc.git] / libgfortran / mk-kinds-h.sh
blob98328b6323a7f7dc6f8176ea8bd3f68589d8a00f
1 #!/bin/sh
3 compile="$1"
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"
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"
18 if [ $s -eq 128 ]; then
19 prefix="__"
20 else
21 prefix=""
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_LOGICAL_${k}"
28 echo "#define HAVE_GFC_INTEGER_${k}"
30 rm -f tmp$$.*
31 done
33 echo "#define GFC_INTEGER_LARGEST GFC_INTEGER_${largest}"
34 echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}"
35 echo ""
38 largest_ctype=""
39 for k in $possible_real_kinds; do
40 echo " real (kind=$k) :: x" > tmp$$.f90
41 echo " end" >> tmp$$.f90
42 if $compile -c tmp$$.f90 > /dev/null 2>&1; then
43 case $k in
44 4) ctype="float" ;;
45 8) ctype="double" ;;
46 10) ctype="long double" ;;
47 16) ctype="long double" ;;
48 *) echo "$0: Unknown type" >&2 ; exit 1 ;;
49 esac
50 largest_ctype="$ctype"
51 echo "typedef ${ctype} GFC_REAL_${k};"
52 echo "typedef complex ${ctype} GFC_COMPLEX_${k};"
53 echo "#define HAVE_GFC_REAL_${k}"
54 echo "#define HAVE_GFC_COMPLEX_${k}"
56 rm -f tmp$$.*
57 done
59 case $largest_ctype in
60 float) echo "#define GFC_REAL_LARGEST_FORMAT \"\"" ;;
61 double) echo "#define GFC_REAL_LARGEST_FORMAT \"l\"" ;;
62 "long double") echo "#define GFC_REAL_LARGEST_FORMAT \"L\"" ;;
63 *) echo "$0: Unknown type" >&2 ; exit 1 ;;
64 esac
65 echo "#define GFC_REAL_LARGEST $largest_ctype"
67 exit 0