*BSD News Article 64675


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!spool.mu.edu!agate!howland.reston.ans.net!EU.net!Germany.EU.net!Dortmund.Germany.EU.net!interface-business.de!usenet
From: j@ida.interface-business.de (J Wunsch)
Newsgroups: comp.unix.bsd.netbsd.misc
Subject: Re: vim for NetBSD 1.1 - diffs
Date: 20 Mar 1996 11:18:14 GMT
Organization: interface business GmbH, Dresden
Lines: 51
Message-ID: <4iophm$e9f@innocence.interface-business.de>
References: <4i8avj$4f@teal.csn.net> <4iedl5$a55@skate.demon.co.uk>
Reply-To: joerg_wunsch@interface-business.de (Joerg Wunsch)
NNTP-Posting-Host: ida.interface-business.de
X-Newsreader: knews 0.9.3

plunky@skate.demon.co.uk (Iain Hibbert) writes:

>    I only say this, because I find it irritating trying to compile
> programs that compile OK on FreeBSD, but they used __FreeBSD__ for
> such patches instead of a more generic word..

To our defense, we aren't *encouraging* this (ab)use of __FreeBSD__
either.  Alas, the really generic way of finding out about whether a
particular system is a 4.4BSD descendant is horrible:

This is the appropriate part of the FreeBSD handbook:

===================================================================
The preferred way to tell 4.3BSD/Reno and newer versions of the BSD
code apart is by using the `BSD' macro defined in <sys/param.h>.
Hopefully that file is already included; if not, add the code:

     #ifdef _HAVE_PARAM_H
     #include <sys/param.h>
     #endif

to the proper place in the .c file and add -D_HAVE_PARAM_H to the
CFLAGS in the Makefile.

Then, you may use:

     #if (defined(BSD) && (BSD >= 199103))

to detect if the code is being compiled on a 4.3 Net2 code base or
newer (e.g. FreeBSD 1.x, 4.3/Reno, NetBSD 0.9, 386BSD, BSD/386 1.1 and
below).

Use:

     #if (defined(BSD) && (BSD >= 199306))

to detect if the code is being compiled on a 4.4 code base or newer
(e.g. FreeBSD 2.x, 4.4, NetBSD 1.0, BSD/386 2.0 or above).
===================================================================


This is really dreadful.  In particular, the _HAVE_PARAM_H must be
passed from the command line to keep the code generic.

Btw., for the case mentioned here, the >= 199103 would be the right
test, Net-2 did already have termios.

-- 
J"org Wunsch					       Unix support engineer
joerg_wunsch@interface-business.de       http://www.interface-business.de/~j