Tom Lane <t...@sss.pgh.pa.us> wrote: > I suppose that at least some of the *BSD herd really do predefine some > of the symbols being attributed to them here, but I would like to see > something authoritative about which and what.
Documentation follows, but first the summary: FreeBSD: __FreeBSD__ NetBSD: __NetBSD__ OpenBSD: __OpenBSD__ I believe those #defines also tell you what the release is. I didn't look into their encoding schemes just now, but can if you want. (OS X aka Darwin is harder: they seem to like __APPLE__, but to determine the OS version the best I can see is __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__, which is quite horrid.) Re BSDi, I have no idea really but based on Google searching I'd bet on __bsdi__. Per Wikipedia BSDi was discontinued in 2003 and support ended in 2004. I submit that anyone still using it is not likely to be updating their PostgreSQL installation, so +1 from me for dropping support for it unless a volunteer using it comes forward. FYI (and you may know this, but I didn't learn until recently) GCC will tell you quite easily what #defines are predefined, and all those platforms use gcc: $ cc -E -dM - < /dev/null | grep FreeBSD #define __FreeBSD_cc_version 700003 #define __VERSION__ "4.2.1 20070719 [FreeBSD]" #define __FreeBSD__ 7 But you wanted something authoritative, so here's what I found: FreeBSD ======= http://www.freebsd.org/doc/en/books/porters-handbook/porting-versions.html "__FreeBSD__ is defined in all versions of FreeBSD." NetBSD ====== >From the NetBSD-1.1 release notes (November, 1995): "* implement new cpp predefine strategy define __NetBSD__, ..." This is still the current behaviour, although the current release is 5.0.2 from February 2010. OpenBSD ======= http://www.openbsd.org/porting.html "Generic Porting Hints * __OpenBSD__ should be used sparingly, if at all. Constructs that look like #if defined(__NetBSD__) || defined(__FreeBSD__) are often inappropriate. Don't add blindly __OpenBSD__ to it. Instead, try to figure out what's going on, and what actual feature is needed." Regards, Giles -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers