From owner-freebsd-questions Thu Jan 22 16:54:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA08617 for questions-outgoing; Thu, 22 Jan 1998 16:54:31 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from ns1.yes.no (ns1.yes.no [195.119.24.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA08602 for ; Thu, 22 Jan 1998 16:54:18 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [194.198.43.36]) by ns1.yes.no (8.8.7/8.8.7) with ESMTP id AAA20753; Fri, 23 Jan 1998 00:54:06 GMT Received: (from eivind@localhost) by bitbox.follo.net (8.8.6/8.8.6) id BAA09496; Fri, 23 Jan 1998 01:54:05 +0100 (MET) Message-ID: <19980123015405.36649@follo.net> Date: Fri, 23 Jan 1998 01:54:05 +0100 From: Eivind Eklund To: Ted Buswell Cc: questions@FreeBSD.ORG Subject: Re: determine OS version at compile time. References: <199801220224.VAA09579@tbuswell.ne.mediaone.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.88e In-Reply-To: <199801220224.VAA09579@tbuswell.ne.mediaone.net>; from Ted Buswell on Wed, Jan 21, 1998 at 09:24:27PM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk 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 . 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.