summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libgo/config.h.in39
-rwxr-xr-xlibgo/configure17
-rw-r--r--libgo/configure.ac5
-rw-r--r--libgo/runtime/go-nosys.c114
4 files changed, 175 insertions, 0 deletions
diff --git a/libgo/config.h.in b/libgo/config.h.in
index 91b91bfb0a9..10aab607481 100644
--- a/libgo/config.h.in
+++ b/libgo/config.h.in
@@ -3,12 +3,33 @@
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
+/* Define to 1 if you have the `acosl' function. */
+#undef HAVE_ACOSL
+
+/* Define to 1 if you have the `asinl' function. */
+#undef HAVE_ASINL
+
+/* Define to 1 if you have the `atan2l' function. */
+#undef HAVE_ATAN2L
+
+/* Define to 1 if you have the `atanl' function. */
+#undef HAVE_ATANL
+
+/* Define to 1 if you have the `cosl' function. */
+#undef HAVE_COSL
+
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `epoll_create1' function. */
#undef HAVE_EPOLL_CREATE1
+/* Define to 1 if you have the `expl' function. */
+#undef HAVE_EXPL
+
+/* Define to 1 if you have the `expm1l' function. */
+#undef HAVE_EXPM1L
+
/* Define to 1 if you have the `faccessat' function. */
#undef HAVE_FACCESSAT
@@ -42,6 +63,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the `ldexpl' function. */
+#undef HAVE_LDEXPL
+
/* Define to 1 if you have the <linux/ether.h> header file. */
#undef HAVE_LINUX_ETHER_H
@@ -72,6 +96,15 @@
/* Define to 1 if the system has the type `loff_t'. */
#undef HAVE_LOFF_T
+/* Define to 1 if you have the `log10l' function. */
+#undef HAVE_LOG10L
+
+/* Define to 1 if you have the `log1pl' function. */
+#undef HAVE_LOG1PL
+
+/* Define to 1 if you have the `logl' function. */
+#undef HAVE_LOGL
+
/* Define to 1 if you have the `matherr' function. */
#undef HAVE_MATHERR
@@ -126,6 +159,9 @@
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
+/* Define to 1 if you have the `sinl' function. */
+#undef HAVE_SINL
+
/* Define to 1 if you have the `splice' function. */
#undef HAVE_SPLICE
@@ -226,6 +262,9 @@
/* Define to 1 if you have the <sys/vfs.h> header file. */
#undef HAVE_SYS_VFS_H
+/* Define to 1 if you have the `tanl' function. */
+#undef HAVE_TANL
+
/* Define to 1 if you have the `tee' function. */
#undef HAVE_TEE
diff --git a/libgo/configure b/libgo/configure
index 24b05b9271b..1f797d4deeb 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -14649,6 +14649,23 @@ _ACEOF
fi
+LIBS_hold="$LIBS"
+LIBS="$LIBS -lm"
+for ac_func in cosl expl logl sinl tanl acosl asinl atanl atan2l expm1l ldexpl log10l log1pl
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+LIBS="$LIBS_hold"
+
CFLAGS_hold="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS_hold="$LIBS"
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 7da76191404..5125200e2a1 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -489,6 +489,11 @@ AC_CHECK_FUNCS(epoll_create1 faccessat fallocate fchmodat fchownat futimesat ino
AC_TYPE_OFF_T
AC_CHECK_TYPES([loff_t])
+LIBS_hold="$LIBS"
+LIBS="$LIBS -lm"
+AC_CHECK_FUNCS(cosl expl logl sinl tanl acosl asinl atanl atan2l expm1l ldexpl log10l log1pl)
+LIBS="$LIBS_hold"
+
CFLAGS_hold="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS_hold="$LIBS"
diff --git a/libgo/runtime/go-nosys.c b/libgo/runtime/go-nosys.c
index 4a30a57ad25..36bbdd26c35 100644
--- a/libgo/runtime/go-nosys.c
+++ b/libgo/runtime/go-nosys.c
@@ -13,6 +13,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <math.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -239,3 +240,116 @@ unshare (int flags __attribute__ ((unused)))
return -1;
}
#endif
+
+/* Long double math functions. These are needed on old i386 systems
+ that don't have them in libm. The compiler translates calls to
+ these functions on float64 to call an 80-bit floating point
+ function instead, because when optimizing that function can be
+ executed as an x87 instructure. However, when not optimizing, this
+ translates into a call to the math function. So on systems that
+ don't provide these functions, we provide a version that just calls
+ the float64 version. */
+
+#ifndef HAVE_COSL
+long double
+cosl (long double a)
+{
+ return (long double) cos ((double) a);
+}
+#endif
+
+#ifndef HAVE_EXPL
+long double
+expl (long double a)
+{
+ return (long double) exp ((double) a);
+}
+#endif
+
+#ifndef HAVE_LOGL
+long double
+logl (long double a)
+{
+ return (long double) log ((double) a);
+}
+#endif
+
+#ifndef HAVE_SINL
+long double
+sinl (long double a)
+{
+ return (long double) sin ((double) a);
+}
+#endif
+
+#ifndef HAVE_TANL
+long double
+tanl (long double a)
+{
+ return (long double) tan ((double) a);
+}
+#endif
+
+#ifndef HAVE_ACOSL
+long double
+acosl (long double a)
+{
+ return (long double) acos ((double) a);
+}
+#endif
+
+#ifndef HAVE_ASINL
+long double
+asinl (long double a)
+{
+ return (long double) asin ((double) a);
+}
+#endif
+
+#ifndef HAVE_ATANL
+long double
+atanl (long double a)
+{
+ return (long double) atan ((double) a);
+}
+#endif
+
+#ifndef HAVE_ATAN2L
+long double
+atan2l (long double a, long double b)
+{
+ return (long double) atan2 ((double) a, (double) b);
+}
+#endif
+
+#ifndef HAVE_EXPM1L
+long double
+expm1l (long double a)
+{
+ return (long double) expm1 ((double) a);
+}
+#endif
+
+#ifndef HAVE_LDEXPL
+long double
+ldexpl (long double a, int exp)
+{
+ return (long double) ldexp ((double) a, exp);
+}
+#endif
+
+#ifndef HAVE_LOG10L
+long double
+log10l (long double a)
+{
+ return (long double) log10 ((double) a);
+}
+#endif
+
+#ifndef HAVE_LOG1PL
+long double
+log1pl (long double a)
+{
+ return (long double) log1p ((double) a);
+}
+#endif
OpenPOWER on IntegriCloud