From 6e4d9244f73b5859d90a34a8562300974c6baf29 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 8 Dec 2004 00:43:40 +0100 Subject: [PATCH] configure.ac: Check for ieeefp.h. * configure.ac: Check for ieeefp.h. Check for fabsf in libm. * configure: Regenerate. * config.h.in: Likewise. * c99_protos.h: New file. * libgfortran.h: Include c99_protos.h and conditionally ieeefp.h. * intrinsics/c99_functions.c (fabsf): New function. From-SVN: r91832 --- libgfortran/ChangeLog | 9 +++ libgfortran/c99_protos.h | 126 +++++++++++++++++++++++++++++++++ libgfortran/config.h.in | 6 ++ libgfortran/configure | 80 ++++++++++++++++++++- libgfortran/configure.ac | 3 +- libgfortran/intrinsics/c99_functions.c | 8 +++ libgfortran/libgfortran.h | 5 ++ 7 files changed, 235 insertions(+), 2 deletions(-) create mode 100644 libgfortran/c99_protos.h diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index ec9792a..1372c7c 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,12 @@ +2004-12-07 Eric Botcazou + + * configure.ac: Check for ieeefp.h. Check for fabsf in libm. + * configure: Regenerate. + * config.h.in: Likewise. + * c99_protos.h: New file. + * libgfortran.h: Include c99_protos.h and conditionally ieeefp.h. + * intrinsics/c99_functions.c (fabsf): New function. + 2004-12-06 Richard Henderson * intrinsics/cshift0.c, intrinsics/eoshift0.c, intrinsics/eoshift2.c, diff --git a/libgfortran/c99_protos.h b/libgfortran/c99_protos.h new file mode 100644 index 0000000..18fc36b --- /dev/null +++ b/libgfortran/c99_protos.h @@ -0,0 +1,126 @@ +/* Declarations of various C99 functions + Copyright (C) 2004 Free Software Foundation, Inc. + +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 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. + +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 Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with libgfortran; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +#ifndef C99_PROTOS_H +#define C99_PROTOS_H + +#ifndef HAVE_ACOSF +extern float acosf(float); +#endif + +#ifndef HAVE_ASINF +extern float asinf(float); +#endif + +#ifndef HAVE_ATAN2F +extern float atan2f(float, float); +#endif + +#ifndef HAVE_ATANF +extern float atanf(float); +#endif + +#ifndef HAVE_CEILF +extern float ceilf(float); +#endif + +#ifndef HAVE_COPYSIGNF +extern float copysignf(float, float); +#endif + +#ifndef HAVE_COSF +extern float cosf(float); +#endif + +#ifndef HAVE_COSHF +extern float coshf(float); +#endif + +#ifndef HAVE_EXPF +extern float expf(float); +#endif + +#ifndef HAVE_FABSF +extern float fabsf(float); +#endif + +#ifndef HAVE_FLOORF +extern float floorf(float); +#endif + +#ifndef HAVE_FREXPF +extern float frexpf(float, int *); +#endif + +#ifndef HAVE_HYPOTF +extern float hypotf(float, float); +#endif + +#ifndef HAVE_LOGF +extern float logf(float); +#endif + +#ifndef HAVE_LOG10F +extern float log10f(float); +#endif + +#ifndef HAVE_SCALBNF +extern float scalbnf(float, int); +#endif + +#ifndef HAVE_SINF +extern float sinf(float); +#endif + +#ifndef HAVE_SINHF +extern float sinhf(float); +#endif + +#ifndef HAVE_SQRTF +extern float sqrtf(float); +#endif + +#ifndef HAVE_TANF +extern float tanf(float); +#endif + +#ifndef HAVE_TANHF +extern float tanhf(float); +#endif + +#ifndef HAVE_NEXTAFTERF +extern float nextafterf(float, float); +#endif + +#ifndef HAVE_POWF +extern float powf(float, float); +#endif + +#ifndef HAVE_ROUND +extern double round(double); +#endif + +#ifndef HAVE_ROUNDF +extern float roundf(float); +#endif + +#endif /* C99_PROTOS_H */ + diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in index 4f121f7..a705e84 100644 --- a/libgfortran/config.h.in +++ b/libgfortran/config.h.in @@ -45,6 +45,9 @@ /* libm includes expf */ #undef HAVE_EXPF +/* libm includes fabsf */ +#undef HAVE_FABSF + /* libm includes finite */ #undef HAVE_FINITE @@ -75,6 +78,9 @@ /* libm includes hypotf */ #undef HAVE_HYPOTF +/* Define to 1 if you have the header file. */ +#undef HAVE_IEEEFP_H + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H diff --git a/libgfortran/configure b/libgfortran/configure index 8be542a..485391d 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -6450,7 +6450,8 @@ done -for ac_header in sys/mman.h sys/types.h sys/stat.h + +for ac_header in sys/mman.h sys/types.h sys/stat.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 @@ -8195,6 +8196,83 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for fabsf in -lm" >&5 +echo $ECHO_N "checking for fabsf in -lm... $ECHO_C" >&6 +if test "${ac_cv_lib_m_fabsf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +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. */ + +/* 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 fabsf (); +int +main () +{ +fabsf (); + ; + 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_lib_m_fabsf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_m_fabsf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_m_fabsf" >&5 +echo "${ECHO_T}$ac_cv_lib_m_fabsf" >&6 +if test $ac_cv_lib_m_fabsf = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FABSF 1 +_ACEOF + +fi + echo "$as_me:$LINENO: checking for floorf in -lm" >&5 echo $ECHO_N "checking for floorf in -lm... $ECHO_C" >&6 if test "${ac_cv_lib_m_floorf+set}" = set; then diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index 4a90ed1..6fd3f50 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -148,7 +148,7 @@ AC_TYPE_OFF_T AC_STDC_HEADERS AC_HAVE_HEADERS(stdlib.h stdio.h string.h stddef.h math.h unistd.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) +AC_CHECK_HEADERS(sys/mman.h sys/types.h sys/stat.h ieeefp.h) AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])]) AC_CHECK_MEMBERS([struct stat.st_blksize]) @@ -177,6 +177,7 @@ AC_CHECK_LIB([m],[copysignf],[AC_DEFINE([HAVE_COPYSIGNF],[1],[libm includes copy AC_CHECK_LIB([m],[cosf],[AC_DEFINE([HAVE_COSF],[1],[libm includes cosf])]) AC_CHECK_LIB([m],[coshf],[AC_DEFINE([HAVE_COSHF],[1],[libm includes coshf])]) AC_CHECK_LIB([m],[expf],[AC_DEFINE([HAVE_EXPF],[1],[libm includes expf])]) +AC_CHECK_LIB([m],[fabsf],[AC_DEFINE([HAVE_FABSF],[1],[libm includes fabsf])]) AC_CHECK_LIB([m],[floorf],[AC_DEFINE([HAVE_FLOORF],[1],[libm includes floorf])]) AC_CHECK_LIB([m],[frexpf],[AC_DEFINE([HAVE_FREXPF],[1],[libm includes frexpf])]) AC_CHECK_LIB([m],[hypotf],[AC_DEFINE([HAVE_HYPOTF],[1],[libm includes hypotf])]) diff --git a/libgfortran/intrinsics/c99_functions.c b/libgfortran/intrinsics/c99_functions.c index 617e0d5..e3e0d6c 100644 --- a/libgfortran/intrinsics/c99_functions.c +++ b/libgfortran/intrinsics/c99_functions.c @@ -97,6 +97,14 @@ expf(float x) } #endif +#ifndef HAVE_FABSF +float +fabsf(float x) +{ + return (float) fabs(x); +} +#endif + #ifndef HAVE_FLOORF float floorf(float x) diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 508a5df..3732707 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */ #endif #include "config.h" +#include "c99_protos.h" #if HAVE_COMPLEX_H # include @@ -39,6 +40,10 @@ Boston, MA 02111-1307, USA. */ #define complex __complex__ #endif +#if HAVE_IEEEFP_H +#include +#endif + #if HAVE_STDINT_H #include #endif -- 2.7.4