* configure.in: Check whether printf family supports printing

long doubles or not and define PRINTF_HAS_LONG_DOUBLE if so.
	* acconfig.h: Provide default undef for PRINTF_HAS_LONG_DOUBLE.
	* configure: Regenerate.
	* valprint.c (print_floating): Use PRINTF_HAS_LONG_DOUBLE.
	* c-exp.y (parse_number): Use PRINTF_HAS_LONG_DOUBLE.
	* configure.in: Fix have_gregset and have_fpregset autoconf
	variable names so that they match the pattern required to
	cache them.
This commit is contained in:
Fred Fish 1996-03-31 01:04:37 +00:00
parent 452ad97eb9
commit 07b77f5ca4
6 changed files with 140 additions and 55 deletions

View file

@ -1,3 +1,15 @@
Sat Mar 30 11:00:22 1996 Fred Fish <fnf@cygnus.com>
* configure.in: Check whether printf family supports printing
long doubles or not and define PRINTF_HAS_LONG_DOUBLE if so.
* acconfig.h: Provide default undef for PRINTF_HAS_LONG_DOUBLE.
* configure: Regenerate.
* valprint.c (print_floating): Use PRINTF_HAS_LONG_DOUBLE.
* c-exp.y (parse_number): Use PRINTF_HAS_LONG_DOUBLE.
* configure.in: Fix have_gregset and have_fpregset autoconf
variable names so that they match the pattern required to
cache them.
Fri Mar 29 21:39:56 1996 Fred Fish <fnf@cygnus.com>
* core-aout.c (fetch_core_registers): Cast core_reg_size to int

View file

@ -4,3 +4,6 @@
/* Define if gregset_t type is available. */
#undef HAVE_GREGSET_T
/* Define if the "%Lg" format works to print long doubles. */
#undef PRINTF_HAS_LONG_DOUBLE

View file

@ -942,7 +942,18 @@ parse_number (p, len, parsed_float, putithere)
else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
sscanf (p, "%lg", &putithere->typed_val_float.dval);
else
sscanf (p, "%Lg", &putithere->typed_val_float.dval);
{
#ifdef PRINTF_HAS_LONG_DOUBLE
sscanf (p, "%Lg", &putithere->typed_val_float.dval);
#else
/* Scan it into a double, then assign it to the long double.
This at least wins with values representable in the range
of doubles. */
double temp;
sscanf (p, "%lg", &temp);
putithere->typed_val_float.dval = temp;
#endif
}
/* See if it has `f' or `l' suffix (float or long double). */

View file

@ -35,6 +35,9 @@
/* Define if gregset_t type is available. */
#undef HAVE_GREGSET_T
/* Define if the "%Lg" format works to print long doubles. */
#undef PRINTF_HAS_LONG_DOUBLE
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE

127
gdb/configure vendored
View file

@ -1283,7 +1283,7 @@ fi
echo $ac_n "checking for gregset_t type""... $ac_c" 1>&6
if eval "test \"`echo '$''{'gdb_have_gregset_t'+set}'`\" = set"; then
if eval "test \"`echo '$''{'gdb_cv_have_gregset_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
@ -1297,17 +1297,17 @@ gregset_t *gregsetp = 0
EOF
if { (eval echo configure:1299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
gdb_have_gregset_t=yes
gdb_cv_have_gregset_t=yes
else
rm -rf conftest*
gdb_have_gregset_t=no
gdb_cv_have_gregset_t=no
fi
rm -f conftest*
fi
echo "$ac_t""$gdb_have_gregset_t" 1>&6
if test $gdb_have_gregset_t = yes; then
echo "$ac_t""$gdb_cv_have_gregset_t" 1>&6
if test $gdb_cv_have_gregset_t = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_GREGSET_T 1
EOF
@ -1315,7 +1315,7 @@ EOF
fi
echo $ac_n "checking for fpregset_t type""... $ac_c" 1>&6
if eval "test \"`echo '$''{'gdb_have_fpregset_t'+set}'`\" = set"; then
if eval "test \"`echo '$''{'gdb_cv_have_fpregset_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
@ -1329,17 +1329,17 @@ fpregset_t *fpregsetp = 0
EOF
if { (eval echo configure:1331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
gdb_have_fpregset_t=yes
gdb_cv_have_fpregset_t=yes
else
rm -rf conftest*
gdb_have_fpregset_t=no
gdb_cv_have_fpregset_t=no
fi
rm -f conftest*
fi
echo "$ac_t""$gdb_have_fpregset_t" 1>&6
if test $gdb_have_fpregset_t = yes; then
echo "$ac_t""$gdb_cv_have_fpregset_t" 1>&6
if test $gdb_cv_have_fpregset_t = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_FPREGSET_T 1
EOF
@ -1347,7 +1347,7 @@ EOF
fi
echo $ac_n "checking for long double""... $ac_c" 1>&6
echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1379,6 +1379,43 @@ EOF
fi
echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6
if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
gdb_cv_printf_has_long_double=no
else
cat > conftest.$ac_ext <<EOF
#line 1392 "configure"
#include "confdefs.h"
int main () {
char buf[16];
long double f = 3.141592653;
sprintf (buf, "%Lg", f);
return (strncmp ("3.14159", buf, 7));
}
EOF
{ (eval echo configure:1402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
gdb_cv_printf_has_long_double=yes
else
gdb_cv_printf_has_long_double=no
fi
fi
rm -fr conftest*
fi
if test $gdb_cv_printf_has_long_double = yes; then
cat >> confdefs.h <<\EOF
#define PRINTF_HAS_LONG_DOUBLE 1
EOF
fi
echo "$ac_t""$gdb_cv_printf_has_long_double" 1>&6
for ac_func in valloc getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
@ -1386,7 +1423,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1390 "configure"
#line 1427 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1408,7 +1445,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1438,7 +1475,7 @@ else
ac_cv_func_mmap=no
else
cat > conftest.$ac_ext <<EOF
#line 1442 "configure"
#line 1479 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test. */
@ -1507,7 +1544,7 @@ main()
}
EOF
{ (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
{ (eval echo configure:1548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_func_mmap=yes
else
@ -1675,12 +1712,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
#line 1679 "configure"
#line 1716 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1684: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1721: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1747,7 +1784,7 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1751 "configure"
#line 1788 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1755,7 +1792,7 @@ int t() {
${x_direct_test_function}()
; return 0; }
EOF
if { (eval echo configure:1759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@ -1876,7 +1913,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1880 "configure"
#line 1917 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1884,7 +1921,7 @@ int t() {
IceConnectionNumber()
; return 0; }
EOF
if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1920,7 +1957,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1924 "configure"
#line 1961 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1928,7 +1965,7 @@ int t() {
dnet_ntoa()
; return 0; }
EOF
if { (eval echo configure:1932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1955,7 +1992,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1959 "configure"
#line 1996 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1963,7 +2000,7 @@ int t() {
dnet_ntoa()
; return 0; }
EOF
if { (eval echo configure:1967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:2004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1995,7 +2032,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1999 "configure"
#line 2036 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -2003,7 +2040,7 @@ int t() {
t_accept()
; return 0; }
EOF
if { (eval echo configure:2007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:2044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2034,7 +2071,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2038 "configure"
#line 2075 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -2042,7 +2079,7 @@ int t() {
socket()
; return 0; }
EOF
if { (eval echo configure:2046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:2083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2139,12 +2176,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2143 "configure"
#line 2180 "configure"
#include "confdefs.h"
#include <tclInt.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2148: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2185: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -2197,7 +2234,7 @@ if test "$cross_compiling" = yes; then
else
cat > conftest.$ac_ext <<EOF
#line 2201 "configure"
#line 2238 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -2212,7 +2249,7 @@ main() {
return 0;
}
EOF
{ (eval echo configure:2216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
{ (eval echo configure:2253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
tclmajor=`cat tclmajor`
tclminor=`cat tclminor`
@ -2357,13 +2394,13 @@ else
ac_cv_c_tclib="-l$installedtcllibroot"
else
cat > conftest.$ac_ext <<EOF
#line 2361 "configure"
#line 2398 "configure"
#include "confdefs.h"
Tcl_AppInit()
{ exit(0); }
EOF
{ (eval echo configure:2367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
{ (eval echo configure:2404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_tcllib="-l$installedtcllibroot"
else
@ -2473,12 +2510,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2477 "configure"
#line 2514 "configure"
#include "confdefs.h"
#include <tk.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -2538,7 +2575,7 @@ if test "$cross_compiling" = yes; then
else
cat > conftest.$ac_ext <<EOF
#line 2542 "configure"
#line 2579 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -2553,7 +2590,7 @@ cat > conftest.$ac_ext <<EOF
return 0;
}
EOF
{ (eval echo configure:2557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
{ (eval echo configure:2594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
tkmajor=`cat tkmajor`
tkminor=`cat tkminor`
@ -2719,13 +2756,13 @@ else
ac_cv_c_tklib="-l$installedtklibroot"
else
cat > conftest.$ac_ext <<EOF
#line 2723 "configure"
#line 2760 "configure"
#include "confdefs.h"
Tcl_AppInit()
{ exit(0); }
EOF
{ (eval echo configure:2729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
{ (eval echo configure:2766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_tklib="-l$installedtklibroot"
else
@ -2766,7 +2803,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2770 "configure"
#line 2807 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -2774,7 +2811,7 @@ int t() {
main()
; return 0; }
EOF
if { (eval echo configure:2778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:2815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2804,7 +2841,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2808 "configure"
#line 2845 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -2812,7 +2849,7 @@ int t() {
main()
; return 0; }
EOF
if { (eval echo configure:2816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:2853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else

View file

@ -41,20 +41,20 @@ AC_CHECK_HEADERS(limits.h memory.h string.h strings.h unistd.h termios.h termio.
AC_HEADER_STAT
AC_MSG_CHECKING([for gregset_t type])
AC_CACHE_VAL(gdb_have_gregset_t,
AC_CACHE_VAL(gdb_cv_have_gregset_t,
[AC_TRY_LINK([#include <sys/procfs.h>],[gregset_t *gregsetp = 0],
gdb_have_gregset_t=yes, gdb_have_gregset_t=no)])
AC_MSG_RESULT($gdb_have_gregset_t)
if test $gdb_have_gregset_t = yes; then
gdb_cv_have_gregset_t=yes, gdb_cv_have_gregset_t=no)])
AC_MSG_RESULT($gdb_cv_have_gregset_t)
if test $gdb_cv_have_gregset_t = yes; then
AC_DEFINE(HAVE_GREGSET_T)
fi
AC_MSG_CHECKING([for fpregset_t type])
AC_CACHE_VAL(gdb_have_fpregset_t,
AC_CACHE_VAL(gdb_cv_have_fpregset_t,
[AC_TRY_LINK([#include <sys/procfs.h>],[fpregset_t *fpregsetp = 0],
gdb_have_fpregset_t=yes, gdb_have_fpregset_t=no)])
AC_MSG_RESULT($gdb_have_fpregset_t)
if test $gdb_have_fpregset_t = yes; then
gdb_cv_have_fpregset_t=yes, gdb_cv_have_fpregset_t=no)])
AC_MSG_RESULT($gdb_cv_have_fpregset_t)
if test $gdb_cv_have_fpregset_t = yes; then
AC_DEFINE(HAVE_FPREGSET_T)
fi
@ -62,7 +62,7 @@ dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
dnl because autoconf complains about cross-compilation issues. However, this
dnl code uses the same variables as the macro for compatibility.
AC_MSG_CHECKING(for long double)
AC_MSG_CHECKING(for long double support in compiler)
AC_CACHE_VAL(ac_cv_c_long_double,
[AC_TRY_COMPILE(, [long double foo;],
ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
@ -71,6 +71,25 @@ if test $ac_cv_c_long_double = yes; then
AC_DEFINE(HAVE_LONG_DOUBLE)
fi
dnl See if the compiler and runtime support printing long doubles
AC_MSG_CHECKING(for long double support in printf)
AC_CACHE_VAL(gdb_cv_printf_has_long_double,
[AC_TRY_RUN([
int main () {
char buf[16];
long double f = 3.141592653;
sprintf (buf, "%Lg", f);
return (strncmp ("3.14159", buf, 7));
}],
gdb_cv_printf_has_long_double=yes,
gdb_cv_printf_has_long_double=no,
gdb_cv_printf_has_long_double=no)])
if test $gdb_cv_printf_has_long_double = yes; then
AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
fi
AC_MSG_RESULT($gdb_cv_printf_has_long_double)
AC_FUNC_MMAP
dnl Handle optional features that can be enabled.