OSDN Git Service

2010-08-28 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / libgfortran / mk-kinds-h.sh
index 6e893ff..0b8dbc5 100755 (executable)
@@ -13,6 +13,7 @@ largest=""
 smallest=""
 for k in $possible_integer_kinds; do
   echo "  integer (kind=$k) :: i" > tmp$$.f90
+  echo "  i = 1_$k" >> tmp$$.f90
   echo "  end" >> tmp$$.f90
   if $compile -S tmp$$.f90 > /dev/null 2>&1; then
     s=`expr 8 \* $k`
@@ -43,16 +44,25 @@ echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}"
 echo "#define GFC_DEFAULT_CHAR ${smallest}"
 echo ""
 
+REAL_10_FOUND=
 
 for k in $possible_real_kinds; do
   echo "  real (kind=$k) :: x" > tmp$$.f90
+  echo "  x = 1.0_$k" >> tmp$$.f90
   echo "  end" >> tmp$$.f90
   if $compile -S tmp$$.f90 > /dev/null 2>&1; then
     case $k in
       4) ctype="float" ; suffix="f" ;;
       8) ctype="double" ; suffix="" ;;
-      10) ctype="long double" ; suffix="l" ;;
-      16) ctype="long double" ; suffix="l" ;;
+      10) ctype="long double" ; suffix="l" ; REAL_10_FOUND=1 ;;
+      16) ctype="long double"
+         suffix="l"
+         # Disable REAL(16) if it is just __float128
+         # until the library is fixed
+         if [ -n "$REAL_10_FOUND" ]; then
+           continue
+         fi
+         ;;
       *) echo "$0: Unknown type" >&2 ; exit 1 ;;
     esac
 
@@ -80,6 +90,12 @@ for k in $possible_real_kinds; do
     echo "#define HAVE_GFC_REAL_${k}"
     echo "#define HAVE_GFC_COMPLEX_${k}"
     echo "#define GFC_REAL_${k}_HUGE ${huge}${suffix}"
+    echo "#define GFC_REAL_${k}_LITERAL_SUFFIX ${suffix}"
+    if [ "x$suffix" = "x" ]; then
+      echo "#define GFC_REAL_${k}_LITERAL(X) (X)"
+    else
+      echo "#define GFC_REAL_${k}_LITERAL(X) (X ## ${suffix})"
+    fi
     echo "#define GFC_REAL_${k}_DIGITS ${digits}"
     echo "#define GFC_REAL_${k}_RADIX ${radix}"
     echo ""