Subject: Re: Dealing with Linux-only functions in a package
To: None <pkgsrc-users@Netbsd.org>
From: Christian Biere <christianbiere@gmx.de>
List: pkgsrc-users
Date: 10/20/2006 21:15:53
Steven M. Bellovin wrote:
> I'm trying to put together a package for memtest86+.  One routine uses the
> inb_p, outb_p, and outb functions that it gets from <sys/io.h> on Linux.
> The question is what to do when compiling on NetBSD.

Have you asked the original developers? I think the fix is obvious:
Add a compile-time check for the header file and the functions. If
they are not available use GCC's inline assembler. Those functions
should be one-liners and map directly to x86 assembler instructions.

> OTOH, it seems unclean to do a source copy, since if the
> package is compiled on a Linux box the original version works just fine.

I'd say there's nothing which guarantees that anything from sys/io.h
or any other header file works without the OS being loaded. So in my
opinion, always including the code is the cleaner solution.

-- 
Christian