diff --git a/src/backend/parser/scan.c b/src/backend/parser/scan.c index 8b29019c7f..8785f35d83 100644 --- a/src/backend/parser/scan.c +++ b/src/backend/parser/scan.c @@ -1,7 +1,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.10 1998/01/27 03:25:07 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.11 1998/02/02 00:03:39 scrappy Exp $ */ #define FLEX_SCANNER @@ -539,7 +539,7 @@ char *yytext; * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.10 1998/01/27 03:25:07 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.11 1998/02/02 00:03:39 scrappy Exp $ * *------------------------------------------------------------------------- */ diff --git a/src/backend/port/isinf.c b/src/backend/port/isinf.c index ca5d22bfe5..6e9d83e600 100644 --- a/src/backend/port/isinf.c +++ b/src/backend/port/isinf.c @@ -1,15 +1,63 @@ -/* $Id: isinf.c,v 1.1 1998/01/15 20:54:37 scrappy Exp $ */ +/* $Id: isinf.c,v 1.2 1998/02/02 00:03:46 scrappy Exp $ */ -#include #include - #include "config.h" +#if HAVE_FPCLASS +# if HAVE_IEEEFP_H +# include +# endif +int +isinf(double d) +{ + fpclass_t type = fpclass(d); + switch (type) + { + case FP_SNAN: + case FP_QNAN: + case FP_NINF: + case FP_PINF: + return (1); + default: + break; + } + return (0); +} +#endif + +#if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D) +# if HAVE_FP_CLASS_H +# include +# endif +int +isinf(x) +double x; +{ +#if HAVE_FP_CLASS + int fpclass = fp_class(x); +#else + int fpclass = fp_class_d(x); +#endif + + if (fpclass == FP_POS_INF) + return (1); + if (fpclass == FP_NEG_INF) + return (-1); + return (0); +} +#endif + +#if defined(HAVE_CLASS) int isinf(double x) { - if((fpclass(x) == FP_PINF) || (fpclass(x) == FP_NINF)) return 1; - else return 0; -} + int fpclass = class(x); + if (fpclass == FP_PLUS_INF) + return (1); + if (fpclass == FP_MINUS_INF) + return (-1); + return (0); +} +#endif diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index a157c992c3..71b324a5c3 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.27 1998/01/13 19:28:32 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.28 1998/02/02 00:03:54 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -1507,130 +1507,3 @@ double x; } #endif /* !HAVE_CBRT */ - -#ifndef HAVE_ISINF - -#if defined(aix) - -#ifdef CLASS_CONFLICT -/* we want the math symbol */ -#undef class -#endif /* CLASS_CONFICT */ - -/* The gcc doesn't support isinf() (without libgcc?) so we - * have to do it - Gerhard Reitofer - */ -#ifdef __GNUC__ - -static int -isinf(double x) -{ - if (x == HUGE_VAL) - return(1); - if (x == -HUGE_VAL) - return(-1); - return(0); -} - -#else /* __GNUC__ */ - -static int -isinf(double x) -{ - int fpclass = class(x); - - if (fpclass == FP_PLUS_INF) - return (1); - if (fpclass == FP_MINUS_INF) - return (-1); - return (0); -} - -#endif /* __GNUC__ */ - -#endif /* aix */ - -#if defined(ultrix4) -#include -static int -isinf(x) -double x; -{ - int fpclass = fp_class_d(x); - - if (fpclass == FP_POS_INF) - return (1); - if (fpclass == FP_NEG_INF) - return (-1); - return (0); -} - -#endif /* ultrix4 */ - -#if defined(alpha) -#include -static int -isinf(x) -double x; -{ - int fpclass = fp_class(x); - - if (fpclass == FP_POS_INF) - return (1); - if (fpclass == FP_NEG_INF) - return (-1); - return (0); -} - -#endif /* alpha */ - -#if defined(sparc_solaris) || defined(i386_solaris) || defined(svr4) || \ - defined(sco) -#include -static int -isinf(d) -double d; -{ - fpclass_t type = fpclass(d); - - switch (type) - { - case FP_SNAN: - case FP_QNAN: - case FP_NINF: - case FP_PINF: - return (1); - default: - break; - } - - return (0); -} - -#endif /* sparc_solaris */ - -#if defined(irix5) -#include -static int -isinf(d) -double d; -{ - fpclass_t type = fpclass(d); - - switch (type) - { - case FP_SNAN: - case FP_QNAN: - case FP_NINF: - case FP_PINF: - return (1); - default: - break; - } - - return (0); -} - -#endif /* irix5 */ - -#endif /* !HAVE_ISINF */ diff --git a/src/configure b/src/configure index 0d6a528daf..01a56d0d08 100755 --- a/src/configure +++ b/src/configure @@ -2821,7 +2821,7 @@ else fi done -for ac_hdr in readline/history.h +for ac_hdr in readline/history.h ieeefp.h fp_class.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -3459,7 +3459,7 @@ fi fi -for ac_func in tzset vfork memmove sigsetjmp kill sysconf +for ac_func in tzset vfork memmove sigsetjmp kill sysconf fpclass do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:3466: checking for $ac_func" >&5 @@ -3514,7 +3514,7 @@ else fi done -for ac_func in sigprocmask waitpid setsid fcvt +for ac_func in fp_class fp_class_d class do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:3521: checking for $ac_func" >&5 @@ -3569,13 +3569,68 @@ else fi done +for ac_func in sigprocmask waitpid setsid fcvt +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3576: checking for $ac_func" >&5 +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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + echo $ac_n "checking for isinf""... $ac_c" 1>&6 -echo "configure:3574: checking for isinf" >&5 +echo "configure:3629: checking for isinf" >&5 if eval "test \"`echo '$''{'ac_cv_func_isinf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_isinf=yes" else @@ -3623,12 +3678,12 @@ fi echo $ac_n "checking for getrusage""... $ac_c" 1>&6 -echo "configure:3627: checking for getrusage" >&5 +echo "configure:3682: checking for getrusage" >&5 if eval "test \"`echo '$''{'ac_cv_func_getrusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_getrusage=yes" else @@ -3676,12 +3731,12 @@ fi echo $ac_n "checking for srandom""... $ac_c" 1>&6 -echo "configure:3680: checking for srandom" >&5 +echo "configure:3735: checking for srandom" >&5 if eval "test \"`echo '$''{'ac_cv_func_srandom'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_srandom=yes" else @@ -3729,12 +3784,12 @@ fi echo $ac_n "checking for gethostname""... $ac_c" 1>&6 -echo "configure:3733: checking for gethostname" >&5 +echo "configure:3788: checking for gethostname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostname=yes" else @@ -3782,12 +3837,12 @@ fi echo $ac_n "checking for random""... $ac_c" 1>&6 -echo "configure:3786: checking for random" >&5 +echo "configure:3841: checking for random" >&5 if eval "test \"`echo '$''{'ac_cv_func_random'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_random=yes" else @@ -3835,12 +3890,12 @@ fi echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:3839: checking for inet_aton" >&5 +echo "configure:3894: checking for inet_aton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else @@ -3888,12 +3943,12 @@ fi echo $ac_n "checking for strerror""... $ac_c" 1>&6 -echo "configure:3892: checking for strerror" >&5 +echo "configure:3947: checking for strerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else @@ -3942,12 +3997,12 @@ fi echo $ac_n "checking for strdup""... $ac_c" 1>&6 -echo "configure:3946: checking for strdup" >&5 +echo "configure:4001: checking for strdup" >&5 if eval "test \"`echo '$''{'ac_cv_func_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strdup=yes" else @@ -3995,12 +4050,12 @@ fi echo $ac_n "checking for strtol""... $ac_c" 1>&6 -echo "configure:3999: checking for strtol" >&5 +echo "configure:4054: checking for strtol" >&5 if eval "test \"`echo '$''{'ac_cv_func_strtol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strtol=yes" else @@ -4047,12 +4102,12 @@ STRDUP='strtol.o' fi echo $ac_n "checking for strcasecmp""... $ac_c" 1>&6 -echo "configure:4051: checking for strcasecmp" >&5 +echo "configure:4106: checking for strcasecmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strcasecmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strcasecmp=yes" else @@ -4100,12 +4155,12 @@ fi echo $ac_n "checking for cbrt""... $ac_c" 1>&6 -echo "configure:4104: checking for cbrt" >&5 +echo "configure:4159: checking for cbrt" >&5 if eval "test \"`echo '$''{'ac_cv_func_cbrt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_cbrt=yes" else @@ -4149,7 +4204,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for cbrt in -lm""... $ac_c" 1>&6 -echo "configure:4153: checking for cbrt in -lm" >&5 +echo "configure:4208: checking for cbrt in -lm" >&5 ac_lib_var=`echo m'_'cbrt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4157,7 +4212,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4194,12 +4249,12 @@ fi fi echo $ac_n "checking for rint""... $ac_c" 1>&6 -echo "configure:4198: checking for rint" >&5 +echo "configure:4253: checking for rint" >&5 if eval "test \"`echo '$''{'ac_cv_func_rint'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_rint=yes" else @@ -4243,7 +4298,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for rint in -lm""... $ac_c" 1>&6 -echo "configure:4247: checking for rint in -lm" >&5 +echo "configure:4302: checking for rint in -lm" >&5 ac_lib_var=`echo m'_'rint | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4251,7 +4306,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4289,7 +4344,7 @@ fi echo $ac_n "checking setting USE_LOCALE""... $ac_c" 1>&6 -echo "configure:4293: checking setting USE_LOCALE" >&5 +echo "configure:4348: checking setting USE_LOCALE" >&5 if test "$USE_LOCALE" = "yes" then echo "$ac_t""enabled" 1>&6 @@ -4301,14 +4356,14 @@ else echo "$ac_t""disabled" 1>&6 fi echo $ac_n "checking setting DEF_PGPORT""... $ac_c" 1>&6 -echo "configure:4305: checking setting DEF_PGPORT" >&5 +echo "configure:4360: checking setting DEF_PGPORT" >&5 cat >> confdefs.h <&6 echo $ac_n "checking setting HBA""... $ac_c" 1>&6 -echo "configure:4312: checking setting HBA" >&5 +echo "configure:4367: checking setting HBA" >&5 if test "$NOHBA" = "no" then echo "$ac_t""enabled" 1>&6 diff --git a/src/configure.in b/src/configure.in index db68300621..c29a37306b 100644 --- a/src/configure.in +++ b/src/configure.in @@ -433,7 +433,7 @@ AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(limits.h unistd.h termios.h values.h sys/select.h) AC_CHECK_HEADERS(sys/resource.h netdb.h arpa/inet.h) AC_CHECK_HEADERS(readline.h history.h dld.h crypt.h endian.h float.h) -AC_CHECK_HEADERS(readline/history.h) +AC_CHECK_HEADERS(readline/history.h ieeefp.h fp_class.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -465,7 +465,8 @@ AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(tzset vfork memmove sigsetjmp kill sysconf) +AC_CHECK_FUNCS(tzset vfork memmove sigsetjmp kill sysconf fpclass) +AC_CHECK_FUNCS(fp_class fp_class_d class) AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt) AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF), diff --git a/src/include/config.h.in b/src/include/config.h.in index 521790528f..a40161eac8 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -14,6 +14,12 @@ * The following is set using configure. */ +/* Set to 1 if you have */ +#undef HAVE_FP_CLASS_H + +/* Set to 1 if you have */ +#undef HAVE_IEEEFP_H + /* Set to 1 if you have */ #undef HAVE_ARPA_INET_H @@ -53,6 +59,18 @@ /* Set to 1 if you have */ #undef HAVE_DLD_H +/* Set to 1 if you have fp_class() */ +#undef HAVE_FP_CLASS + +/* Set to 1 if you have class() */ +#undef HAVE_CLASS + +/* Set to 1 if you have fp_class_d() */ +#undef HAVE_FP_CLASS_D + +/* Set to 1 if you have fpclass() */ +#undef HAVE_FPCLASS + /* Set to 1 if you have isinf() */ #undef HAVE_ISINF #ifndef HAVE_ISINF