From 48cbb249ab74a305463ca5c1c0c1d480a8fce00f Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Wed, 6 Jul 2005 13:18:44 +0000 Subject: [PATCH] * Fix error with the use of expr. On George's suggestion, don't use expr for the comparison -- instead, use test -lt This commit was SVN r6356. --- config/f77_get_fortran_handle_max.m4 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/f77_get_fortran_handle_max.m4 b/config/f77_get_fortran_handle_max.m4 index c63c2c549f..dcfde7c4ff 100644 --- a/config/f77_get_fortran_handle_max.m4 +++ b/config/f77_get_fortran_handle_max.m4 @@ -48,6 +48,7 @@ long cint = INT_MAX; fprintf(fp, "%ld", cint); fclose(fp);]]), [ompi_cint_max=`cat conftest.out`], [ompi_cint_max=0], [ #cross compiling is fun +# try to compute INT_MAX the same way we computed Fortran INTEGER max. ompi_sizeof_cint=`expr $ac_cv_sizeof_int \* 8 - 1` ompi_cint_max=1 while test "$ompi_sizeof_cint" != "0" ; do @@ -60,9 +61,12 @@ if test "$ompi_cint_max" = "0" ; then # wow - something went really wrong. Be conservative OMPI_FORTRAN_HANDLE_MAX=32767 elif test "$ompi_fint_max" = "0" ; then + # we aren't compiling Fortran - just set it to C INT_MAX OMPI_FORTRAN_HANDLE_MAX=$ompi_cint_max else - if expr $ompi_cint_max < $ompi_fint_max ; then + # take the lesser of C INT_MAX and Fortran INTEGER max. + # The resulting value will then be storable in either type. + if test $ompi_cint_max -lt $ompi_fint_max ; then OMPI_FORTRAN_HANDLE_MAX=$ompi_cint_max else OMPI_FORTRAN_HANDLE_MAX=$ompi_fint_max