blob: d9f2137f89d8d6b11139b272b00a2ac9a3af25a4 [file] [log] [blame]
Richard Henderson625be282004-08-30 14:34:37 -07001#!/bin/sh
2
Tobias Burnus2e764ae2020-07-26 07:20:24 +02003if test "$#" -ne 2; then
4 echo "Usage $0 real_kinds compile"
5 exit 1
6fi
7
8# Possible kinds must be listed in ascending order
9possible_real_kinds="$1"
10compile="$2"
11
Richard Henderson625be282004-08-30 14:34:37 -070012kinds=""
Richard Henderson625be282004-08-30 14:34:37 -070013c=0
14
Tobias Burnus2e764ae2020-07-26 07:20:24 +020015for k in $possible_real_kinds; do
Richard Henderson625be282004-08-30 14:34:37 -070016 echo " real (kind=$k) :: x" > tmp$$.f90
Tobias Burnus76663512008-09-10 19:18:08 +020017 echo " x = 1.0_$k" >> tmp$$.f90
Richard Henderson625be282004-08-30 14:34:37 -070018 echo " end" >> tmp$$.f90
Steven Bosscher4349e292008-01-16 09:13:39 +000019 if $compile -S tmp$$.f90 > /dev/null 2>&1; then
Richard Henderson625be282004-08-30 14:34:37 -070020 kinds="$kinds $k"
21 c=`expr $c + 1`
22 fi
23 rm -f tmp$$.*
24done
25
26echo " integer, parameter :: c = $c"
27echo " type (real_info), parameter :: real_infos(c) = (/ &"
28
29i=0
30for k in $kinds; do
Eric Botcazou130abd12004-09-01 19:51:42 +020031 # echo -n is not portable
Tobias Burnus01349042010-06-25 21:40:37 +020032 str=" real_info ($k, precision(0.0_$k), range(0.0_$k), radix(0.0_$k))"
Richard Henderson625be282004-08-30 14:34:37 -070033 i=`expr $i + 1`
34 if [ $i -lt $c ]; then
Eric Botcazou130abd12004-09-01 19:51:42 +020035 echo "$str, &"
Richard Henderson625be282004-08-30 14:34:37 -070036 else
Eric Botcazou130abd12004-09-01 19:51:42 +020037 echo "$str /)"
Richard Henderson625be282004-08-30 14:34:37 -070038 fi
39done
40
41exit 0