This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran, committed] Check for powf in math library
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: GCC Fortran mailing list <fortran at gcc dot gnu dot org>,patch <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 26 Sep 2004 16:52:55 +0200
- Subject: [gfortran, committed] Check for powf in math library
This adds a configure test for powf to our series of checks for a C99 library.
For the case it is not found, I added a powf function to
intrinsics/c99_functions.c.
Built and tested (on i686-pc-linux, so I could only check the case where the
function is present), committed under the obviously correct rule.
- Tobi
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/ChangeLog,v
retrieving revision 1.93
diff -u -p -r1.93 ChangeLog
--- ChangeLog 24 Sep 2004 16:49:02 -0000 1.93
+++ ChangeLog 26 Sep 2004 14:43:48 -0000
@@ -1,3 +1,11 @@
+2004-09-26 Tobias Schlueter <tobis.schlueter@physik.uni-muenchen.de>
+
+ PR libfortran/16137
+ * config.h.in (HAVE_POWF): Undefine.
+ * configure.ac: Check for 'powf' in library.
+ * configure: Regenerate.
+ * intrinsics/c99_functions.c (powf): New function.
+
2004-09-24 Tobias Schlueter <tobis.schlueter@physik.uni-muenchen.de>
* intrinsics/etime.c (etime_): New function.
Index: config.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/config.h.in,v
retrieving revision 1.8
diff -u -p -r1.8 config.h.in
--- config.h.in 18 Sep 2004 23:55:21 -0000 1.8
+++ config.h.in 26 Sep 2004 14:43:48 -0000
@@ -114,6 +114,9 @@
/* libm includes nextafterf */
#undef HAVE_NEXTAFTERF
+/* libm includes powf */
+# undef HAVE_POWF
+
/* libm includes round */
#undef HAVE_ROUND
Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/configure.ac,v
retrieving revision 1.10
diff -u -p -r1.10 configure.ac
--- configure.ac 18 Sep 2004 23:55:22 -0000 1.10
+++ configure.ac 26 Sep 2004 14:43:48 -0000
@@ -184,6 +184,7 @@ AC_CHECK_LIB([m],[logf],[AC_DEFINE([HAVE
AC_CHECK_LIB([m],[log10f],[AC_DEFINE([HAVE_LOG10F],[1],[libm includes log10f])])
AC_CHECK_LIB([m],[nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1],[libm includes
nextafter])])
AC_CHECK_LIB([m],[nextafterf],[AC_DEFINE([HAVE_NEXTAFTERF],[1],[libm includes
nextafterf])])
+AC_CHECK_LIB([m],[powf],[AC_DEFINE([HAVE_POWF],[1],[libm includes powf])])
AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],[libm includes round])])
AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],[libm includes roundf])])
AC_CHECK_LIB([m],[scalbnf],[AC_DEFINE([HAVE_SCALBNF],[1],[libm includes
scalbnf])])
Index: intrinsics/c99_functions.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/intrinsics/c99_functions.c,v
retrieving revision 1.4
diff -u -p -r1.4 c99_functions.c
--- intrinsics/c99_functions.c 9 Aug 2004 21:09:41 -0000 1.4
+++ intrinsics/c99_functions.c 26 Sep 2004 14:43:48 -0000
@@ -245,6 +245,15 @@ nextafterf(float x, float y)
}
#endif
+
+#ifndef HAVE_POWF
+float
+powf(float x, float y)
+{
+ return (float) pow(x, y);
+}
+#endif
+
/* Note that if HAVE_FPCLASSIFY is not defined, then NaN is not handled */
/* Algorithm by Steven G. Kargl. */