X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fsignbit.m4;h=56ff825f985c45e461150b80dd15b0949a57ab6a;hb=7ba06c8ff37d8725cb824c64b94be41b9294ffb7;hp=152a32e567d9ef3c23b3cf9c79790badff94df59;hpb=ce8675631414567e50a77fdd43196f5882172ca7;p=gnulib.git diff --git a/m4/signbit.m4 b/m4/signbit.m4 index 152a32e56..56ff825f9 100644 --- a/m4/signbit.m4 +++ b/m4/signbit.m4 @@ -1,5 +1,5 @@ -# signbit.m4 serial 3 -dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. +# signbit.m4 serial 6 +dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -74,7 +74,7 @@ AC_DEFUN([gl_SIGNBIT], [gl_cv_func_copysignf_no_libm=no]) ]) if test $gl_cv_func_copysignf_no_libm = yes; then - AC_DEFINE([HAVE_COPYSIGNF_IN_LIBC], 1, + AC_DEFINE([HAVE_COPYSIGNF_IN_LIBC], [1], [Define if the copysignf function is declared in and available in libc.]) fi fi @@ -94,7 +94,7 @@ AC_DEFUN([gl_SIGNBIT], [gl_cv_func_copysign_no_libm=no]) ]) if test $gl_cv_func_copysign_no_libm = yes; then - AC_DEFINE([HAVE_COPYSIGN_IN_LIBC], 1, + AC_DEFINE([HAVE_COPYSIGN_IN_LIBC], [1], [Define if the copysign function is declared in and available in libc.]) fi fi @@ -114,7 +114,7 @@ AC_DEFUN([gl_SIGNBIT], [gl_cv_func_copysignl_no_libm=no]) ]) if test $gl_cv_func_copysignl_no_libm = yes; then - AC_DEFINE([HAVE_COPYSIGNL_IN_LIBC], 1, + AC_DEFINE([HAVE_COPYSIGNL_IN_LIBC], [1], [Define if the copysignl function is declared in and available in libc.]) fi fi @@ -123,15 +123,33 @@ AC_DEFUN([gl_SIGNBIT], fi ]) -AC_DEFUN([gl_SIGNBIT_TEST_PROGRAM], [ +AC_DEFUN([gl_SIGNBIT_TEST_PROGRAM], [[ +/* Global variables. + Needed because GCC 4 constant-folds __builtin_signbitl (literal) + but cannot constant-fold __builtin_signbitl (variable). */ +float vf; +double vd; +long double vl; +int main () +{ +/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. + So we use -p0f and -p0d instead. */ float p0f = 0.0f; -float m0f = -0.0f; +float m0f = -p0f; double p0d = 0.0; -double m0d = -0.0; +double m0d = -p0d; +/* On HP-UX 10.20, negating 0.0L does not yield -0.0L. + So we use another constant expression instead. + But that expression does not work on other platforms, such as when + cross-compiling to PowerPC on MacOS X 10.5. */ long double p0l = 0.0L; -long double m0l = -0.0L; -int main () -{ +#if defined __hpux || defined __sgi +long double m0l = -LDBL_MIN * LDBL_MIN; +#else +long double m0l = -p0l; +#endif + if (signbit (vf)) + vf++; { float plus_inf = 1.0f / p0f; float minus_inf = -1.0f / p0f; @@ -143,6 +161,8 @@ int main () && signbit (minus_inf))) return 1; } + if (signbit (vd)) + vd++; { double plus_inf = 1.0 / p0d; double minus_inf = -1.0 / p0d; @@ -154,6 +174,8 @@ int main () && signbit (minus_inf))) return 1; } + if (signbit (vl)) + vl++; { long double plus_inf = 1.0L / p0l; long double minus_inf = -1.0L / p0l; @@ -167,7 +189,7 @@ int main () } return 0; } -]) +]]) AC_DEFUN([gl_FLOAT_SIGN_LOCATION], [