* Makefile.am (gfor_helper_src): Split selected_kind.f90.
(gfor_built_src): Add selected_int_kind.inc selected_real_kind.inc.
(selected_int_kind.inc selected_real_kind.inc): New rules.
* Makefile.in: Regenerate.
* mk-sik-inc.sh, mk-srk-inc.sh: New files.
* intrinsics/selected_int_kind.f90: Split from selected_kind.f90,
include table of detected kinds.
* intrinsics/selected_real_kind.f90: Similarly.
From-SVN: r86801
+2004-08-30 Richard Henderson <rth@redhat.com>
+
+ * Makefile.am (gfor_helper_src): Split selected_kind.f90.
+ (gfor_built_src): Add selected_int_kind.inc selected_real_kind.inc.
+ (selected_int_kind.inc selected_real_kind.inc): New rules.
+ * Makefile.in: Regenerate.
+ * mk-sik-inc.sh, mk-srk-inc.sh: New files.
+ * intrinsics/selected_int_kind.f90: Split from selected_kind.f90,
+ include table of detected kinds.
+ * intrinsics/selected_real_kind.f90: Similarly.
+
2004-08-29 Steven G. Kargl <kargls@comcast.net>
Paul Brook <paul@codesourcery.com>
intrinsics/random.c \
intrinsics/reshape_generic.c \
intrinsics/reshape_packed.c \
-intrinsics/selected_kind.f90 \
+intrinsics/selected_int_kind.f90 \
+intrinsics/selected_real_kind.f90 \
intrinsics/system_clock.c \
intrinsics/transpose_generic.c \
intrinsics/unpack_generic.c \
$(i_matmul_c) $(i_matmull_c) $(i_transpose_c) $(i_shape_c) $(i_eoshift1_c) \
$(i_eoshift3_c) $(i_cshift1_c) $(i_reshape_c) $(in_pack_c) $(in_unpack_c) \
$(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \
- $(i_pow_c)
+ $(i_pow_c) \
+ selected_int_kind.inc selected_real_kind.inc
# We only use these if libm doesn't contain complex math functions.
I_M4_DEPS0=$(I_M4_DEPS) m4/iforeach.m4
I_M4_DEPS1=$(I_M4_DEPS) m4/ifunction.m4
+selected_int_kind.inc: $(srcdir)/mk-sik-inc.sh
+ $(SHELL) $(srcdir)/mk-sik-inc.sh '$(F77COMPILE)' > $@
+
+selected_real_kind.inc: $(srcdir)/mk-srk-inc.sh
+ $(SHELL) $(srcdir)/mk-srk-inc.sh '$(F77COMPILE)' > $@
+
## A 'normal' build shouldn't need to regenerate these
## so we only include them in maintainer mode
env.lo erf.lo eoshift0.lo eoshift2.lo etime.lo getXid.lo \
ishftc.lo pack_generic.lo size.lo spread_generic.lo \
string_intrinsics.lo rand.lo random.lo reshape_generic.lo \
- reshape_packed.lo selected_kind.lo system_clock.lo \
- transpose_generic.lo unpack_generic.lo in_pack_generic.lo \
- in_unpack_generic.lo normalize.lo
+ reshape_packed.lo selected_int_kind.lo selected_real_kind.lo \
+ system_clock.lo transpose_generic.lo unpack_generic.lo \
+ in_pack_generic.lo in_unpack_generic.lo normalize.lo
am__objects_34 =
am__objects_35 = _abs_c4.lo _abs_c8.lo _abs_i4.lo _abs_i8.lo \
_abs_r4.lo _abs_r8.lo _exp_r4.lo _exp_r8.lo _exp_c4.lo \
intrinsics/random.c \
intrinsics/reshape_generic.c \
intrinsics/reshape_packed.c \
-intrinsics/selected_kind.f90 \
+intrinsics/selected_int_kind.f90 \
+intrinsics/selected_real_kind.f90 \
intrinsics/system_clock.c \
intrinsics/transpose_generic.c \
intrinsics/unpack_generic.c \
$(i_matmul_c) $(i_matmull_c) $(i_transpose_c) $(i_shape_c) $(i_eoshift1_c) \
$(i_eoshift3_c) $(i_cshift1_c) $(i_reshape_c) $(in_pack_c) $(in_unpack_c) \
$(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \
- $(i_pow_c)
+ $(i_pow_c) \
+ selected_int_kind.inc selected_real_kind.inc
# We only use these if libm doesn't contain complex math functions.
.f90.lo:
$(LTF77COMPILE) -c -o $@ $<
-selected_kind.o: intrinsics/selected_kind.f90
- $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o selected_kind.o `test -f 'intrinsics/selected_kind.f90' || echo '$(srcdir)/'`intrinsics/selected_kind.f90
+selected_int_kind.o: intrinsics/selected_int_kind.f90
+ $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o selected_int_kind.o `test -f 'intrinsics/selected_int_kind.f90' || echo '$(srcdir)/'`intrinsics/selected_int_kind.f90
-selected_kind.obj: intrinsics/selected_kind.f90
- $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o selected_kind.obj `if test -f 'intrinsics/selected_kind.f90'; then $(CYGPATH_W) 'intrinsics/selected_kind.f90'; else $(CYGPATH_W) '$(srcdir)/intrinsics/selected_kind.f90'; fi`
+selected_int_kind.obj: intrinsics/selected_int_kind.f90
+ $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o selected_int_kind.obj `if test -f 'intrinsics/selected_int_kind.f90'; then $(CYGPATH_W) 'intrinsics/selected_int_kind.f90'; else $(CYGPATH_W) '$(srcdir)/intrinsics/selected_int_kind.f90'; fi`
-selected_kind.lo: intrinsics/selected_kind.f90
- $(LIBTOOL) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o selected_kind.lo `test -f 'intrinsics/selected_kind.f90' || echo '$(srcdir)/'`intrinsics/selected_kind.f90
+selected_int_kind.lo: intrinsics/selected_int_kind.f90
+ $(LIBTOOL) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o selected_int_kind.lo `test -f 'intrinsics/selected_int_kind.f90' || echo '$(srcdir)/'`intrinsics/selected_int_kind.f90
+
+selected_real_kind.o: intrinsics/selected_real_kind.f90
+ $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o selected_real_kind.o `test -f 'intrinsics/selected_real_kind.f90' || echo '$(srcdir)/'`intrinsics/selected_real_kind.f90
+
+selected_real_kind.obj: intrinsics/selected_real_kind.f90
+ $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o selected_real_kind.obj `if test -f 'intrinsics/selected_real_kind.f90'; then $(CYGPATH_W) 'intrinsics/selected_real_kind.f90'; else $(CYGPATH_W) '$(srcdir)/intrinsics/selected_real_kind.f90'; fi`
+
+selected_real_kind.lo: intrinsics/selected_real_kind.f90
+ $(LIBTOOL) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o selected_real_kind.lo `test -f 'intrinsics/selected_real_kind.f90' || echo '$(srcdir)/'`intrinsics/selected_real_kind.f90
_abs_c4.o: generated/_abs_c4.f90
$(F77) $(AM_FFLAGS) $(FFLAGS) -c -o _abs_c4.o `test -f 'generated/_abs_c4.f90' || echo '$(srcdir)/'`generated/_abs_c4.f90
uninstall-toolexeclibLTLIBRARIES
+selected_int_kind.inc: $(srcdir)/mk-sik-inc.sh
+ $(SHELL) $(srcdir)/mk-sik-inc.sh '$(F77COMPILE)' > $@
+
+selected_real_kind.inc: $(srcdir)/mk-srk-inc.sh
+ $(SHELL) $(srcdir)/mk-srk-inc.sh '$(F77COMPILE)' > $@
+
@MAINTAINER_MODE_TRUE@$(i_all_c): m4/all.m4 $(I_M4_DEPS1)
@MAINTAINER_MODE_TRUE@ m4 -Dfile=$@ -I$(srcdir)/m4 all.m4 > $@
--- /dev/null
+! Copyright 2003, 2004 Free Software Foundation, Inc.
+! Contributed by Kejia Zhao <kejia_zh@yahoo.com.cn>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfor).
+!
+!GNU libgfor is free software; you can redistribute it and/or
+!modify it under the terms of the GNU Lesser General Public
+!License as published by the Free Software Foundation; either
+!version 2.1 of the License, or (at your option) any later version.
+!
+!GNU libgfor is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+!GNU Lesser General Public License for more details.
+!
+!You should have received a copy of the GNU Lesser General Public
+!License along with libgfor; see the file COPYING. If not,
+!write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+!Boston, MA 02111-1307, USA.
+!
+
+function selected_int_kind (r)
+ implicit none
+ integer, intent (in) :: r
+ integer :: selected_int_kind
+ integer :: i
+ ! Integer kind_range table
+ type :: int_info
+ integer :: kind
+ integer :: range
+ end type int_info
+
+ include "selected_int_kind.inc"
+
+ do i = 1, c
+ if (r <= int_infos (i) % range) then
+ selected_int_kind = int_infos (i) % kind
+ return
+ end if
+ end do
+ selected_int_kind = -1
+ return
+end function
+++ /dev/null
-! Copyright 2003 Free Software Foundation, Inc.
-! Contributed by Kejia Zhao <kejia_zh@yahoo.com.cn>
-!
-!This file is part of the GNU Fortran 95 runtime library (libgfor).
-!
-!GNU libgfor is free software; you can redistribute it and/or
-!modify it under the terms of the GNU Lesser General Public
-!License as published by the Free Software Foundation; either
-!version 2.1 of the License, or (at your option) any later version.
-!
-!GNU libgfor is distributed in the hope that it will be useful,
-!but WITHOUT ANY WARRANTY; without even the implied warranty of
-!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-!GNU Lesser General Public License for more details.
-!
-!You should have received a copy of the GNU Lesser General Public
-!License along with libgfor; see the file COPYING. If not,
-!write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-!Boston, MA 02111-1307, USA.
-!
-
-function selected_int_kind (r)
- implicit none
- integer, intent (in) :: r
- integer :: selected_int_kind
- integer :: i
- ! Integer kind_range table
- integer, parameter :: c = 4
- type :: int_info
- integer :: kind
- integer :: range
- end type int_info
- type (int_info), parameter :: int_infos (c) = &
- (/int_info (1, range (0_1)), &
- int_info (2, range (0_2)), &
- int_info (4, range (0_4)), &
- int_info (8, range (0_8))/)
-
- do i = 1, c
- if (r <= int_infos (i) % range) then
- selected_int_kind = int_infos (i) % kind
- return
- end if
- end do
- selected_int_kind = -1
- return
-end function
-
-function selected_real_kind (p, r)
- implicit none
- integer, optional, intent (in) :: p, r
- integer :: selected_real_kind
- integer :: i, p2, r2
- logical :: found_p, found_r
- ! Real kind_precision_range table
- integer, parameter :: c = 2
- type :: real_info
- integer :: kind
- integer :: precision
- integer :: range
- end type real_info
- type (real_info) :: real_infos (c) = &
- (/real_info (4, precision (0.0_4), range (0.0_4)), &
- real_info (8, precision (0.0_8), range (0.0_8))/)
-
- selected_real_kind = 0
- p2 = 0
- r2 = 0
- found_p = .false.
- found_r = .false.
-
- if (present (p)) p2 = p
- if (present (r)) r2 = r
-
- ! Assumes each type has a greater precision and range than previous one.
-
- do i = 1, c
- if (p2 <= real_infos (i) % precision) found_p = .true.
- if (r2 <= real_infos (i) % range) found_r = .true.
- if (found_p .and. found_r) then
- selected_real_kind = real_infos (i) % kind
- return
- end if
- end do
-
- if (.not. (found_p)) selected_real_kind = selected_real_kind - 1
- if (.not. (found_r)) selected_real_kind = selected_real_kind - 2
-
- return
-end function
--- /dev/null
+! Copyright 2003, 2004 Free Software Foundation, Inc.
+! Contributed by Kejia Zhao <kejia_zh@yahoo.com.cn>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfor).
+!
+!GNU libgfor is free software; you can redistribute it and/or
+!modify it under the terms of the GNU Lesser General Public
+!License as published by the Free Software Foundation; either
+!version 2.1 of the License, or (at your option) any later version.
+!
+!GNU libgfor is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+!GNU Lesser General Public License for more details.
+!
+!You should have received a copy of the GNU Lesser General Public
+!License along with libgfor; see the file COPYING. If not,
+!write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+!Boston, MA 02111-1307, USA.
+!
+
+function selected_real_kind (p, r)
+ implicit none
+ integer, optional, intent (in) :: p, r
+ integer :: selected_real_kind
+ integer :: i, p2, r2
+ logical :: found_p, found_r
+ ! Real kind_precision_range table
+ type :: real_info
+ integer :: kind
+ integer :: precision
+ integer :: range
+ end type real_info
+
+ include "selected_real_kind.inc"
+
+ selected_real_kind = 0
+ p2 = 0
+ r2 = 0
+ found_p = .false.
+ found_r = .false.
+
+ if (present (p)) p2 = p
+ if (present (r)) r2 = r
+
+ ! Assumes each type has a greater precision and range than previous one.
+
+ do i = 1, c
+ if (p2 <= real_infos (i) % precision) found_p = .true.
+ if (r2 <= real_infos (i) % range) found_r = .true.
+ if (found_p .and. found_r) then
+ selected_real_kind = real_infos (i) % kind
+ return
+ end if
+ end do
+
+ if (.not. (found_p)) selected_real_kind = selected_real_kind - 1
+ if (.not. (found_r)) selected_real_kind = selected_real_kind - 2
+
+ return
+end function
--- /dev/null
+#!/bin/sh
+
+compile="$1"
+kinds=""
+possible_kinds="1 2 4 8 16"
+c=0
+
+for k in $possible_kinds; do
+ echo " integer (kind=$k) :: x" > tmp$$.f90
+ echo " end" >> tmp$$.f90
+ if $compile -c tmp$$.f90 > /dev/null 2>&1; then
+ kinds="$kinds $k"
+ c=`expr $c + 1`
+ fi
+ rm -f tmp$$.*
+done
+
+echo " integer, parameter :: c = $c"
+echo " type (int_info), parameter :: int_infos(c) = (/ &"
+
+i=0
+for k in $kinds; do
+ echo -n " int_info ($k, range(0_$k))"
+ i=`expr $i + 1`
+ if [ $i -lt $c ]; then
+ echo ", &"
+ else
+ echo " /)"
+ fi
+done
+
+exit 0
--- /dev/null
+#!/bin/sh
+
+compile="$1"
+kinds=""
+possible_kinds="4 8 10 16"
+c=0
+
+for k in $possible_kinds; do
+ echo " real (kind=$k) :: x" > tmp$$.f90
+ echo " end" >> tmp$$.f90
+ if $compile -c tmp$$.f90 > /dev/null 2>&1; then
+ kinds="$kinds $k"
+ c=`expr $c + 1`
+ fi
+ rm -f tmp$$.*
+done
+
+echo " integer, parameter :: c = $c"
+echo " type (real_info), parameter :: real_infos(c) = (/ &"
+
+i=0
+for k in $kinds; do
+ echo -n " real_info ($k, precision(0.0_$k), range(0.0_$k))"
+ i=`expr $i + 1`
+ if [ $i -lt $c ]; then
+ echo ", &"
+ else
+ echo " /)"
+ fi
+done
+
+exit 0