Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jan 1998 01:54:05 +0100
From:      Eivind Eklund <eivind@yes.no>
To:        Ted Buswell <tbuswell@mediaone.net>
Cc:        questions@FreeBSD.ORG
Subject:   Re: determine OS version at compile time.
Message-ID:  <19980123015405.36649@follo.net>
In-Reply-To: <199801220224.VAA09579@tbuswell.ne.mediaone.net>; from Ted Buswell on Wed, Jan 21, 1998 at 09:24:27PM -0500
References:  <199801220224.VAA09579@tbuswell.ne.mediaone.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 21, 1998 at 09:24:27PM -0500, Ted Buswell wrote:
> 
> What's the best way to determine the version of the operating system
> that a given file is being compiled for?
> I'd like to do something like:
> 
> #if defined(__FreeBSD__)
> #if (FREEBSD_MAJOR > 2) && (FREEBSD_MINOR > 2) && (FREEBSD_PATCH < 5)
> ...
> #else
> ...
> #endif
> #endif

Go for <osreldate.h>.  It is upgraded with each major interface
change, and with each OS release.  Its format should be fairly obvious
(100000major + 10000minor + 1000patch + post-release-interface-changes).

Eivind.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980123015405.36649>