diff options
-rw-r--r-- | libgfortran/ChangeLog | 47 | ||||
-rw-r--r-- | libgfortran/acinclude.m4 | 17 | ||||
-rw-r--r-- | libgfortran/config.h.in | 18 | ||||
-rw-r--r-- | libgfortran/config/fpu-aix.h | 92 | ||||
-rw-r--r-- | libgfortran/config/fpu-sysv.h | 91 | ||||
-rwxr-xr-x | libgfortran/configure | 440 | ||||
-rw-r--r-- | libgfortran/configure.ac | 10 | ||||
-rw-r--r-- | libgfortran/configure.host | 10 |
8 files changed, 706 insertions, 19 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index e56e855614e..6d47929b460 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,21 +1,36 @@ +2005-10-20 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + * acinclude.m4 (LIBGFOR_CHECK_FPSETMASK): New check. + * configure.ac: Check for floatingpoint.h, fptrap.h and float.h + headers. Use LIBGFOR_CHECK_FPSETMASK. Check for fp_trap and + fp_enable functions. + * configure.host: Add case for systems with fpsetmask and systems + with fp_trap/fp_enable. + * config/fpu-sysv.h: New file, FPU code using fpsetmask. + * config/fpu-aix.h: New file, FPU code for AIX using fp_trap and + fp_enable. + * aclocal.m4: Regenerate. + * configure: Regenerate. + * config.h.in: Regenerate. + 2005-10-24 Jerry DeLisle <jvdelisle@verizon.net> - PR libgfortran/24224 - * libgfortran.h: Remove array stride error code. - * runtime/error.c: Remove array stride error. - * io/io.h: Change name of 'nml_loop_spec' to 'array_loop_spec' to be - generic. Add pointer to array_loop_spec and rank to gfc_unit - structure. - * io/list_read.c: Revise nml_loop_spec references to array_loop_spec. - * io/transfer.c (init_loop_spec): New function to initialize - an array_loop_spec. - (next_array_record): New function to return the index to the next array - record by incrementing through the array_loop_spec. - (next_record_r): Use new function. - (next_record_w): Use new function. - (finalize_transfer): Free memory allocated for array_loop_spec. - * io/unit.c (get_array_unit_len): Delete this function. Use new - function init_loop_spec to initialize the array_loop_spec. + PR libgfortran/24224 + * libgfortran.h: Remove array stride error code. + * runtime/error.c: Remove array stride error. + * io/io.h: Change name of 'nml_loop_spec' to 'array_loop_spec' to be + generic. Add pointer to array_loop_spec and rank to gfc_unit + structure. + * io/list_read.c: Revise nml_loop_spec references to array_loop_spec. + * io/transfer.c (init_loop_spec): New function to initialize + an array_loop_spec. + (next_array_record): New function to return the index to the next array + record by incrementing through the array_loop_spec. + (next_record_r): Use new function. + (next_record_w): Use new function. + (finalize_transfer): Free memory allocated for array_loop_spec. + * io/unit.c (get_array_unit_len): Delete this function. Use new + function init_loop_spec to initialize the array_loop_spec. 2005-10-24 Paul Thomas <pault@gcc.gnu.org> diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4 index a94dafafacb..857733a2e35 100644 --- a/libgfortran/acinclude.m4 +++ b/libgfortran/acinclude.m4 @@ -384,3 +384,20 @@ esac])]) if test x"$have_working_stat" = xyes; then AC_DEFINE(HAVE_WORKING_STAT, 1, [Define if target has a reliable stat.]) fi]) + +dnl Checks for fpsetmask function. +AC_DEFUN([LIBGFOR_CHECK_FPSETMASK], [ + AC_CACHE_CHECK([whether fpsetmask is present], have_fpsetmask, [ + AC_TRY_LINK([ +#if HAVE_FLOATINGPOINT_H +# include <floatingpoint.h> +#endif /* HAVE_FLOATINGPOINT_H */ +#if HAVE_IEEEFP_H +# include <ieeefp.h> +#endif /* HAVE_IEEEFP_H */],[fpsetmask(0);], + eval "have_fpsetmask=yes", eval "have_fpsetmask=no") + ]) + if test x"$have_fpsetmask" = xyes; then + AC_DEFINE(HAVE_FPSETMASK, 1, [Define if you have fpsetmask.]) + fi +]) diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in index 8d6f6d4b204..13fc81fdb32 100644 --- a/libgfortran/config.h.in +++ b/libgfortran/config.h.in @@ -294,6 +294,12 @@ /* libm includes finite */ #undef HAVE_FINITE +/* Define to 1 if you have the <floatingpoint.h> header file. */ +#undef HAVE_FLOATINGPOINT_H + +/* Define to 1 if you have the <float.h> header file. */ +#undef HAVE_FLOAT_H + /* libm includes floor */ #undef HAVE_FLOOR @@ -303,6 +309,18 @@ /* libm includes floorl */ #undef HAVE_FLOORL +/* Define if you have fpsetmask. */ +#undef HAVE_FPSETMASK + +/* Define to 1 if you have the <fptrap.h> header file. */ +#undef HAVE_FPTRAP_H + +/* fp_enable is present */ +#undef HAVE_FP_ENABLE + +/* fp_trap is present */ +#undef HAVE_FP_TRAP + /* libm includes frexp */ #undef HAVE_FREXP diff --git a/libgfortran/config/fpu-aix.h b/libgfortran/config/fpu-aix.h new file mode 100644 index 00000000000..f2fa0a587b7 --- /dev/null +++ b/libgfortran/config/fpu-aix.h @@ -0,0 +1,92 @@ +/* AIX FPU-related code. + Copyright 2005 Free Software Foundation, Inc. + Contributed by Francois-Xavier Coudert <coudert@clipper.ens.fr> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 General Public License for more details. + +You should have received a copy of the GNU General Public +License along with libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + + +/* FPU-related code for AIX. */ +#ifdef HAVE_FPTRAP_H +#include <fptrap.h> +#endif + +#ifdef HAVE_FLOAT_H +#include <float.h> +#endif + +void +set_fpu (void) +{ + fptrap_t mode = 0; + + if (options.fpe & GFC_FPE_INVALID) +#ifdef TRP_INVALID + mode |= TRP_INVALID; +#else + st_printf ("Fortran runtime warning: IEEE 'invalid operation' " + "exception not supported.\n"); +#endif + + if (options.fpe & GFC_FPE_DENORMAL) + st_printf ("Fortran runtime warning: IEEE 'denormal number' " + "exception not supported.\n"); + + if (options.fpe & GFC_FPE_ZERO) +#ifdef TRP_DIV_BY_ZERO + mode |= TRP_DIV_BY_ZERO; +#else + st_printf ("Fortran runtime warning: IEEE 'division by zero' " + "exception not supported.\n"); +#endif + + if (options.fpe & GFC_FPE_OVERFLOW) +#ifdef TRP_OVERFLOW + mode |= TRP_OVERFLOW; +#else + st_printf ("Fortran runtime warning: IEEE 'overflow' " + "exception not supported.\n"); +#endif + + if (options.fpe & GFC_FPE_UNDERFLOW) +#ifdef TRP_UNDERFLOW + mode |= TRP_UNDERFLOW; +#else + st_printf ("Fortran runtime warning: IEEE 'underflow' " + "exception not supported.\n"); +#endif + + if (options.fpe & GFC_FPE_PRECISION) +#ifdef TRP_UNDERFLOW + mode |= TRP_UNDERFLOW; +#else + st_printf ("Fortran runtime warning: IEEE 'loss of precision' " + "exception not supported.\n"); +#endif + + fp_trap(FP_TRAP_SYNC); + fp_enable(mode); +} diff --git a/libgfortran/config/fpu-sysv.h b/libgfortran/config/fpu-sysv.h new file mode 100644 index 00000000000..c2f28c4d17b --- /dev/null +++ b/libgfortran/config/fpu-sysv.h @@ -0,0 +1,91 @@ +/* SysV FPU-related code (for systems not otherwise supported). + Copyright 2005 Free Software Foundation, Inc. + Contributed by Francois-Xavier Coudert <coudert@clipper.ens.fr> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 General Public License for more details. + +You should have received a copy of the GNU General Public +License along with libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + + +/* FPU-related code for SysV platforms with fpsetmask(). */ +#ifdef HAVE_IEEEFP_H +#include <ieeefp.h> +#endif + +void +set_fpu (void) +{ + int cw = 0; + + if (options.fpe & GFC_FPE_INVALID) +#ifdef FP_X_INV + cw |= FP_X_INV; +#else + st_printf ("Fortran runtime warning: IEEE 'invalid operation' " + "exception not supported.\n"); +#endif + + if (options.fpe & GFC_FPE_DENORMAL) +#ifdef FP_X_DNML + cw |= FP_X_DNML; +#else + st_printf ("Fortran runtime warning: IEEE 'denormal number' " + "exception not supported.\n"); +#endif + + if (options.fpe & GFC_FPE_ZERO) +#ifdef FP_X_DZ + cw |= FP_X_DZ; +#else + st_printf ("Fortran runtime warning: IEEE 'division by zero' " + "exception not supported.\n"); +#endif + + if (options.fpe & GFC_FPE_OVERFLOW) +#ifdef FP_X_OFL + cw |= FP_X_OFL; +#else + st_printf ("Fortran runtime warning: IEEE 'overflow' " + "exception not supported.\n"); +#endif + + if (options.fpe & GFC_FPE_UNDERFLOW) +#ifdef FP_X_UFL + cw |= FP_X_UFL; +#else + st_printf ("Fortran runtime warning: IEEE 'underflow' " + "exception not supported.\n"); +#endif + + if (options.fpe & GFC_FPE_PRECISION) +#ifdef FP_X_IMP + cw |= FP_X_IMP; +#else + st_printf ("Fortran runtime warning: IEEE 'loss of precision' " + "exception not supported.\n"); +#endif + + fpsetmask(cw); +} diff --git a/libgfortran/configure b/libgfortran/configure index b3cc868364c..fd7ee1ffa75 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -6508,7 +6508,159 @@ done -for ac_header in sys/mman.h sys/types.h sys/stat.h ieeefp.h fenv.h +for ac_header in sys/mman.h sys/types.h sys/stat.h floatingpoint.h ieeefp.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------------------ ## +## Report this to the GNU Fortran Runtime Library lists. ## +## ------------------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + +for ac_header in fenv.h fptrap.h float.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -19587,6 +19739,292 @@ _ACEOF fi +# Check for SysV fpsetmask + + echo "$as_me:$LINENO: checking whether fpsetmask is present" >&5 +echo $ECHO_N "checking whether fpsetmask is present... $ECHO_C" >&6 +if test "${have_fpsetmask+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if HAVE_FLOATINGPOINT_H +# include <floatingpoint.h> +#endif /* HAVE_FLOATINGPOINT_H */ +#if HAVE_IEEEFP_H +# include <ieeefp.h> +#endif /* HAVE_IEEEFP_H */ +int +main () +{ +fpsetmask(0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "have_fpsetmask=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "have_fpsetmask=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $have_fpsetmask" >&5 +echo "${ECHO_T}$have_fpsetmask" >&6 + if test x"$have_fpsetmask" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FPSETMASK 1 +_ACEOF + + fi + + +# Check for AIX fp_trap and fp_enable +echo "$as_me:$LINENO: checking for fp_trap" >&5 +echo $ECHO_N "checking for fp_trap... $ECHO_C" >&6 +if test "${ac_cv_func_fp_trap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define fp_trap to an innocuous variant, in case <limits.h> declares fp_trap. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define fp_trap innocuous_fp_trap + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char fp_trap (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef fp_trap + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char fp_trap (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_fp_trap) || defined (__stub___fp_trap) +choke me +#else +char (*f) () = fp_trap; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != fp_trap; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_fp_trap=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_fp_trap=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_fp_trap" >&5 +echo "${ECHO_T}$ac_cv_func_fp_trap" >&6 +if test $ac_cv_func_fp_trap = yes; then + have_fp_trap=yes +cat >>confdefs.h <<\_ACEOF +#define HAVE_FP_TRAP 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for fp_enable" >&5 +echo $ECHO_N "checking for fp_enable... $ECHO_C" >&6 +if test "${ac_cv_func_fp_enable+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define fp_enable to an innocuous variant, in case <limits.h> declares fp_enable. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define fp_enable innocuous_fp_enable + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char fp_enable (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef fp_enable + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char fp_enable (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_fp_enable) || defined (__stub___fp_enable) +choke me +#else +char (*f) () = fp_enable; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != fp_enable; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_fp_enable=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_fp_enable=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_fp_enable" >&5 +echo "${ECHO_T}$ac_cv_func_fp_enable" >&6 +if test $ac_cv_func_fp_enable = yes; then + have_fp_enable=yes +cat >>confdefs.h <<\_ACEOF +#define HAVE_FP_ENABLE 1 +_ACEOF + +fi + + # Runs configure.host to set up necessary host-dependent shell variables. # We then display a message about it, and propagate them through the # build chain. diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index 59354c9e188..73b34c0d2d2 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -158,7 +158,8 @@ AC_TYPE_OFF_T AC_STDC_HEADERS AC_HAVE_HEADERS(stdlib.h stdio.h string.h stddef.h math.h unistd.h signal.h) AC_CHECK_HEADERS(time.h sys/params.h sys/time.h sys/times.h sys/resource.h) -AC_CHECK_HEADERS(sys/mman.h sys/types.h sys/stat.h ieeefp.h fenv.h) +AC_CHECK_HEADERS(sys/mman.h sys/types.h sys/stat.h floatingpoint.h ieeefp.h) +AC_CHECK_HEADERS(fenv.h fptrap.h float.h) AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])]) AC_CHECK_MEMBERS([struct stat.st_blksize]) @@ -346,6 +347,13 @@ AC_CHECK_LIB([m],[finite],[AC_DEFINE([HAVE_FINITE],[1],[libm includes finite])]) # Check for GNU libc feenableexcept AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])]) +# Check for SysV fpsetmask +LIBGFOR_CHECK_FPSETMASK + +# Check for AIX fp_trap and fp_enable +AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])]) +AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])]) + # Runs configure.host to set up necessary host-dependent shell variables. # We then display a message about it, and propagate them through the # build chain. diff --git a/libgfortran/configure.host b/libgfortran/configure.host index c7cc16e17d2..73da57172d6 100644 --- a/libgfortran/configure.host +++ b/libgfortran/configure.host @@ -18,7 +18,7 @@ # DEFAULTS -fpu_host=fpu-generic +fpu_host='fpu-generic' # HOST-SPECIFIC OVERRIDES case "${host_cpu}" in @@ -30,3 +30,11 @@ esac if test "x${have_feenableexcept}" = "xyes"; then fpu_host='fpu-glibc' fi + +if test "x${have_fpsetmask}" = "xyes"; then + fpu_host='fpu-sysv' +fi + +if test "x${have_fp_enable}" = "xyes" && test "x${have_fp_trap}" = "xyes"; then + fpu_host='fpu-aix' +fi |