diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-21 13:46:34 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-21 13:46:34 +0000 |
commit | 413929725e50d50f5b4a7d98ebdfd5fcf562a820 (patch) | |
tree | 8af2198385df0e740a9f5be20efa8808ecd8d2d7 /libquadmath | |
parent | 0d13a5a5bf762999d502807642b4bbe73932010b (diff) | |
download | gcc-413929725e50d50f5b4a7d98ebdfd5fcf562a820.tar.gz |
2012-11-21 Tobias Burnus <burnus@net-b.de>
PR libquadmath/55225
* math/lgammaq.c (lgammaq): Use local variable if
math.h does not provide signgam.
* acinclude.m4 (LIBQUAD_CHECK_MATH_H_SIGNGAM): New check.
* configure.ac: Use it.
* configure: Regenerate.
* config.h.in: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193695 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libquadmath')
-rw-r--r-- | libquadmath/ChangeLog | 10 | ||||
-rw-r--r-- | libquadmath/acinclude.m4 | 17 | ||||
-rw-r--r-- | libquadmath/config.h.in | 3 | ||||
-rwxr-xr-x | libquadmath/configure | 37 | ||||
-rw-r--r-- | libquadmath/configure.ac | 1 | ||||
-rw-r--r-- | libquadmath/math/lgammaq.c | 8 |
6 files changed, 75 insertions, 1 deletions
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog index 6f731ca84ad..b97a45868b3 100644 --- a/libquadmath/ChangeLog +++ b/libquadmath/ChangeLog @@ -1,3 +1,13 @@ +2012-11-21 Tobias Burnus <burnus@net-b.de> + + PR libquadmath/55225 + * math/lgammaq.c (lgammaq): Use local variable if + math.h does not provide signgam. + * acinclude.m4 (LIBQUAD_CHECK_MATH_H_SIGNGAM): New check. + * configure.ac: Use it. + * configure: Regenerate. + * config.h.in: Regenerate. + 2012-11-15 Tobias Burnus <burnus@net-b.de> Joseph Myers <joseph@codesourcery.com> diff --git a/libquadmath/acinclude.m4 b/libquadmath/acinclude.m4 index 38e0808ad93..ab73fb52e05 100644 --- a/libquadmath/acinclude.m4 +++ b/libquadmath/acinclude.m4 @@ -10,3 +10,20 @@ AC_DEFUN([AM_PROG_LIBTOOL]) AC_DEFUN([AC_LIBTOOL_DLOPEN]) AC_DEFUN([AC_PROG_LD]) ]) + +dnl Check whether POSIX's signgam is defined in math.h. +AC_DEFUN([LIBQUAD_CHECK_MATH_H_SIGNGAM], [ + AC_CACHE_CHECK([whether the math.h includes POSIX's signgam], + libgfor_cv_have_math_h_signgam, [ + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <math.h> +void foo(void) { signgam = 1; }]], [])], + libgfor_cv_have_math_h_signgam=yes, + libgfor_cv_have_math_h_signgam=no) + CFLAGS="$save_CFLAGS"]) + if test $libgfor_cv_have_math_h_signgam = yes; then + AC_DEFINE(HAVE_MATH_H_SIGNGAM, 1, + [Define to 1 if the math.h includes POSIX's signgam.]) + fi]) diff --git a/libquadmath/config.h.in b/libquadmath/config.h.in index ea3f10c2786..9d18cc3ee35 100644 --- a/libquadmath/config.h.in +++ b/libquadmath/config.h.in @@ -45,6 +45,9 @@ /* Define to 1 if you have the <locale.h> header file. */ #undef HAVE_LOCALE_H +/* Define to 1 if the math.h includes POSIX's signgam. */ +#undef HAVE_MATH_H_SIGNGAM + /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H diff --git a/libquadmath/configure b/libquadmath/configure index 16776719d01..0ea6e07455d 100755 --- a/libquadmath/configure +++ b/libquadmath/configure @@ -11947,6 +11947,43 @@ fi done + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the math.h includes POSIX's signgam" >&5 +$as_echo_n "checking whether the math.h includes POSIX's signgam... " >&6; } +if test "${libgfor_cv_have_math_h_signgam+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <math.h> +void foo(void) { signgam = 1; } +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libgfor_cv_have_math_h_signgam=yes +else + libgfor_cv_have_math_h_signgam=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgfor_cv_have_math_h_signgam" >&5 +$as_echo "$libgfor_cv_have_math_h_signgam" >&6; } + if test $libgfor_cv_have_math_h_signgam = yes; then + +$as_echo "#define HAVE_MATH_H_SIGNGAM 1" >>confdefs.h + + fi + # If available, sqrtl and cbrtl speed up the calculation - # but they are not required if test x$gcc_no_link != xyes; then diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac index d3bfb040cd0..c547da8dc20 100644 --- a/libquadmath/configure.ac +++ b/libquadmath/configure.ac @@ -113,6 +113,7 @@ AC_SUBST(toolexecdir) AC_SUBST(toolexeclibdir) AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h) +LIBQUAD_CHECK_MATH_H_SIGNGAM # If available, sqrtl and cbrtl speed up the calculation - # but they are not required diff --git a/libquadmath/math/lgammaq.c b/libquadmath/math/lgammaq.c index 485939af1b4..eef62dbc91f 100644 --- a/libquadmath/math/lgammaq.c +++ b/libquadmath/math/lgammaq.c @@ -69,7 +69,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "quadmath-imp.h" -#include <math.h> /* For extern int signgam. */ + +#ifdef HAVE_MATH_H_SIGNGAM +#include <math.h> /* For POSIX's extern int signgam. */ +#endif static const __float128 PIQ = 3.1415926535897932384626433832795028841972E0Q; static const __float128 MAXLGM = 1.0485738685148938358098967157129705071571E4928Q; @@ -759,6 +762,9 @@ lgammaq (__float128 x) { __float128 p, q, w, z, nx; int i, nn; +#ifndef HAVE_MATH_H_SIGNGAM + int signgam; +#endif signgam = 1; |