More cross-platform build fixes

This commit is contained in:
Federico Di Gregorio 2009-03-02 09:19:23 +01:00
parent 5c0cfa86bf
commit 4077711050
2 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2009-03-02 Federico Di Gregorio <fog@initd.org>
* psycopg/config.h: applied patch from Jason Erickson to build
with MSVC. Solaris version of isinf() is now a macro.
2009-02-27 Federico Di Gregorio <fog@initd.org> 2009-02-27 Federico Di Gregorio <fog@initd.org>
* psycopg/config.h: added check to provide compatible isinf() * psycopg/config.h: added check to provide compatible isinf()

View File

@ -127,6 +127,15 @@ static struct tm *localtime_r(time_t *t, struct tm *tm)
} }
/* remove the inline keyword, since it doesn't work unless C++ file */ /* remove the inline keyword, since it doesn't work unless C++ file */
#define inline #define inline
/* Hmmm, MSVC doesn't have a isnan/isinf function, but has _isnan function */
#if defined (_MSC_VER)
#define isnan(x) (_isnan(x))
/* The following line was hacked together from simliar code by Bjorn Reese
* in libxml2 code */
#define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) ? 1 \
: ((_fpclass(x) == _FPCLASS_NINF) ? -1 : 0))
#endif
#endif #endif
#if (defined(__FreeBSD__) && __FreeBSD_version < 503000) || (defined(_WIN32) && !defined(__GNUC__)) || defined(__sun__) || defined(sun) #if (defined(__FreeBSD__) && __FreeBSD_version < 503000) || (defined(_WIN32) && !defined(__GNUC__)) || defined(__sun__) || defined(sun)
@ -142,10 +151,10 @@ static double round(double num)
#define PQfreemem free #define PQfreemem free
#endif #endif
/* resolve missing isinf() function for Solaris **/ /* resolve missing isinf() function for Solaris */
#if defined (__SVR4) && defined (__sun) #if defined (__SVR4) && defined (__sun)
#include <ieeefp.h> #include <ieeefp.h>
int isinf(double x) { return !finite(x) && x==x; } #define isinf(x) (!finite((x)) && (x)==(x))
#endif #endif
#endif /* !defined(PSYCOPG_CONFIG_H) */ #endif /* !defined(PSYCOPG_CONFIG_H) */