Subject: Re: LiS (Linux Streams) for NetBSD
To: None <steven_grunza@ieee.org>
From: Brook Milligan <brook@biology.nmsu.edu>
List: current-users
Date: 04/03/2000 14:02:05
I'm looking into porting/adapting LiS for NetBSD. What is the proper way
to detect that NetBSD is the current operating system? Some of the header
files included with LiS re-define constants in our /usr/include/ directory.
If there is a string always defined by cc during compiles on NetBSD then
something like the following would work:
#ifndef NETBSD
//original #defines and #includes, etc
#endif // #ifndef NETBSD
I don't know about LiS at all, but isn't the best way to go about this
to put the whole thing under control of a proper configure script
(perhaps generated by autoconf)? We don't really want to proliferate
lots of #ifdef THIS/#ifdef THAT that isolate NetBSD when in fact the
problem is with the design of the application software. Instead, test
for the features needed and include the relevant header files as
appropriate.
My experience with Linux-developed stuff is that they often declare
system functions within application-specific headers, something that
represents just plain bad design. Encourage better design, don't
proliferate worse.
Not knowing the exact situation I can't offer much. But in general my
suggestion would be something along the lines of:
#if HAVE_HEADERXXX_H
#include <header.h>
#else
void linux_function_foo_that_should_be_in_header_h (int);
#endif
Alternatively, maybe those declarations aren't really needed in Linux
either and are there for some arcane historical reason.
In any case, give preference to the standard headers (which pretty
much means the NetBSD setup).
Cheers,
Brook