OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libgfortran/] [mk-kinds-h.sh] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
#!/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_LOGICAL_${k}"
28
    echo "#define HAVE_GFC_INTEGER_${k}"
29
  fi
30
  rm -f tmp$$.*
31
done
32
 
33
echo "#define GFC_INTEGER_LARGEST GFC_INTEGER_${largest}"
34
echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}"
35
echo ""
36
 
37
 
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}"
55
  fi
56
  rm -f tmp$$.*
57
done
58
 
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"
66
 
67
exit 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.