Subject: Re: OSS audio emulation [ossaudio(3)] is still source-incompatible
To: None <tech-userlevel@netbsd.org>
From: Frederick Bruckman <fb@enteract.com>
List: tech-userlevel
Date: 05/06/2001 00:59:21
On Sat, 5 May 2001, Greg A. Woods wrote:

> I've seen several programs now that expect to find OPEN_SOUND_SYSTEM
> defined in <sys/soundcard.h>.  For example this autoconf macro:
>
> 	AC_DEFUN(AC_HAVE_OSS,
> 	[AC_CACHE_CHECK([for Open Sound System], ac_cv_oss,
> 	  AC_TRY_COMPILE([#include <sys/soundcard.h>],[OPEN_SOUND_SYSTEM;],
> 	    ac_cv_oss="yes", ac_cv_oss="no"))
> 	if $test "$ac_cv_oss" = "yes" -a -e /dev/dsp; then
> 	  AC_DEFINE(HAVE_OSS,1)
> 	  AC_DEFINE(OSS_DEVICE,"/dev/dsp")
> 	fi])

That looks familiar! I just patched one of those for a squeak-3.0 package.
One of these days, someone needs to collect all the configure hacks
in pkgsrc into "automake", so that "aclocal" really works for NetBSD.

> Why doesn't NetBSD's OSS emulation "just work" with this?  Yes I know
> it's an evil ugly API in some ways, but if the NetBSD emulation layer is
> intended as a compatibility layer shouldn't it strive to actually be
> compatible?

Yeah, I've wondered about that, too. I've reviewed the cvs logs, and
the reason "soundcard.h" can't go in "sys/soundcard.h" is sound:
"/usr/includes/sys" comes from "syssrc/sys/includes". "syssrc" is
seperable from the rest of the sources, and it's just not right to
have to keep one file there in sync with "basesrc/lib/libossaudio/".

A possible solution might be to have "sys/soundcard.h" simply
_include_ "soundcard.h". That would give us true source compatibility,
without incurring any extra maintenance effort.

> I haven't yet looked about the amount of effort necessary, but it seems
> at least on the surface that if the program has to be patched it may as
> well be ported all the way to use the native interface and at least then
> the original author would have some reason to take the changes back....

I don't know about that. One patch to a macro and and one patch to the
"includes" is pretty easy to get past, but certain authors don't take
kindly to having their source peppered with conditional compiles where
there where none before. (No, I won't name names.) The thing is,
NetBSD audio is evidently different enough from FreeBSD audio and Sun
audio that you're not doing anyone any favors.


Frederick