]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgfortran/mk-kinds-h.sh
c99_functions.c (log10l): New log10l function for systems where this is not available.
[thirdparty/gcc.git] / libgfortran / mk-kinds-h.sh
CommitLineData
32aa3bff
FXC
1#!/bin/sh
2
3compile="$1"
4
5# Possible types must be listed in ascending order
6possible_integer_kinds="1 2 4 8 16"
7possible_real_kinds="4 8 10 16"
8
9
10largest=""
11for 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$$.*
30done
31
32echo "#define GFC_INTEGER_LARGEST GFC_INTEGER_${largest}"
33echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}"
34echo ""
35
36
37largest_ctype=""
38for 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$$.*
55done
56
57case $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 ;;
62esac
63echo "#define GFC_REAL_LARGEST $largest_ctype"
64
65exit 0