--- a/psycopg/config.h 2011-08-17 14:33:28.962430000 +0100 +++ b/psycopg/config.h 2011-08-18 14:46:36.965344000 +0100 @@ -141,7 +141,7 @@ #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(sunos_5_10)) || (defined(sun) && ! defined(sunos_5_10)) /* what's this, we have no round function either? */ static double round(double num) { --- a/setup.py 2011-08-17 14:33:28.962430000 +0100 +++ b/setup.py 2011-08-18 14:41:11.027547000 +0100 @@ -362,7 +362,7 @@ self.include_dirs.append(".") if self.static_libpq: - if not hasattr(self, 'link_objects'): + if not hasattr(self, 'link_objects') or self.link_objects is None: self.link_objects = [] self.link_objects.append( os.path.join(pg_config_helper.query("libdir"), "libpq.a")) @@ -448,6 +448,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')