+ * On *BSD and Darwin/OS X, it's a long string giving
+ * a build date, config file name, etc., etc., etc..
+ */
+#ifdef HAVE_OS_X_FRAMEWORKS
+ /*
+ * On Mac OS X, report the Mac OS X version number as
+ * the OS, and put the Darwin information in parentheses.
+ *
+ * XXX - can we get the build name? There's no API to
+ * get it; it's currently in
+ * /System/Library/CoreServices/SystemVersion.plist
+ * but there's no guarantee that it will continue to
+ * be there.
+ */
+ Gestalt(gestaltSystemVersion, &macosx_ver);
+
+ /* The following functions are only available in Mac OS 10.4+ */
+ if(macosx_ver >= 0x1040) {
+ Gestalt(gestaltSystemVersionMajor, &macosx_major_ver);
+ Gestalt(gestaltSystemVersionMinor, &macosx_minor_ver);
+ Gestalt(gestaltSystemVersionBugFix, &macosx_bugfix_ver);
+
+ g_string_append_printf(str, "Mac OS %ld.%ld.%ld",
+ (long)macosx_major_ver,
+ (long)macosx_minor_ver,
+ (long)macosx_bugfix_ver);
+ } else {
+ g_string_append_printf(str, "Mac OS X < 10.4 [%lx]",
+ (long)macosx_ver);
+ /* See Apple's Gestalt Manager Reference for meanings
+ * of the macosx_ver values. */
+ }
+ g_string_append_printf(str, " (%s %s)", name.sysname, name.release);
+#else /* HAVE_OS_X_FRAMEWORKS */
+ /*
+ * XXX - on Linux, are there any APIs to get the distribution
+ * name and version number? I think some distributions have
+ * that.
+ *
+ * At least on Linux Standard Base-compliant distributions,
+ * there's an "lsb_release" command. However:
+ *
+ * http://forums.fedoraforum.org/showthread.php?t=220885
+ *
+ * seems to suggest that if you don't have the redhat-lsb
+ * package installed, you don't have lsb_release, and that
+ * /etc/fedora-release has the release information on
+ * Fedora.
+ *
+ * http://linux.die.net/man/1/lsb_release
+ *
+ * suggests that there's an /etc/distrib-release file, but
+ * it doesn't indicate whether "distrib" is literally
+ * "distrib" or is the name for the distribution, and
+ * also speaks of an /etc/debian_version file.
+ *
+ * "lsb_release" apparently parses /etc/lsb-release, which
+ * has shell-style assignments, assigning to, among other
+ * values, DISTRIB_ID (distributor/distribution name),
+ * DISTRIB_RELEASE (release number of the distribution),
+ * DISTRIB_DESCRIPTION (*might* be name followed by version,
+ * but the manpage for lsb_release seems to indicate that's
+ * not guaranteed), and DISTRIB_CODENAME (code name, e.g.
+ * "licentious" for the Ubuntu Licentious Lemur release).
+ * the lsb_release man page also speaks of the distrib-release
+ * file, but Debian doesn't have one, and Ubuntu 7's
+ * lsb_release command doesn't look for one.
+ *
+ * I've seen references to /etc/redhat-release as well.
+ *
+ * At least on my Ubuntu 7 system, /etc/debian_version
+ * doesn't contain anything interesting (just some Debian
+ * codenames).
+ *
+ * See also
+ *
+ * http://bugs.python.org/issue1322
+ *
+ * http://www.novell.com/coolsolutions/feature/11251.html
+ *
+ * http://linuxmafia.com/faq/Admin/release-files.html
+ *
+ * and the Lib/Platform.py file in recent Python 2.x
+ * releases.