--- a/psycopg/config.h +++ b/psycopg/config.h @@ -141,7 +141,9 @@ #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(sunos_5_8) /* what's this, we have no round function either? */ static double round(double num) { --- a/setup.py +++ b/setup.py @@ -450,6 +450,11 @@ 'typecast_builtins.c', 'typecast_datetime.c', ] +# We need to be able to distinguish solaris 8, 9 and 10. +if os.uname()[0] == 'SunOS': + name = '%s_%s' % (os.uname()[0].lower(), os.uname()[2].replace('.', '_')) + define_macros.append((name, '1')) + parser = configparser.ConfigParser() parser.read('setup.cfg')