From f4e3af15a1f6ebc80db3948866d28c8bb6ef6433 Mon Sep 17 00:00:00 2001
From: Brad Smith <[EMAIL REDACTED]>
Date: Mon, 17 Oct 2022 07:23:40 -0400
Subject: [PATCH] Simplify OSS test by removing OpenBSD specific location of
the soundcard.h header
OpenBSD has long since stopped using OSS. Remove checking for OpenBSD specific header.
---
cmake/sdlchecks.cmake | 12 ++----------
configure | 34 +---------------------------------
configure.ac | 16 +---------------
include/SDL_config.h.cmake | 1 -
include/SDL_config.h.in | 1 -
src/audio/dsp/SDL_dspaudio.c | 6 ------
test/configure | 1 -
7 files changed, 4 insertions(+), 67 deletions(-)
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 3164530208a4..c1100fdc928c 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -59,21 +59,13 @@ macro(CheckOSS)
check_c_source_compiles("
#include <sys/soundcard.h>
int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SYS_SOUNDCARD_H)
- if(NOT HAVE_OSS_SYS_SOUNDCARD_H)
- check_c_source_compiles("
- #include <soundcard.h>
- int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SOUNDCARD_H)
- endif()
- if(HAVE_OSS_SYS_SOUNDCARD_H OR HAVE_OSS_SOUNDCARD_H)
+ if(HAVE_OSS_SYS_SOUNDCARD_H)
set(HAVE_OSS TRUE)
file(GLOB OSS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dsp/*.c)
- if(HAVE_OSS_SOUNDCARD_H)
- set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1)
- endif()
set(SDL_AUDIO_DRIVER_OSS 1)
list(APPEND SOURCE_FILES ${OSS_SOURCES})
- if(NETBSD OR OPENBSD)
+ if(NETBSD)
list(APPEND EXTRA_LIBS ossaudio)
endif()
set(HAVE_SDL_AUDIO TRUE)
diff --git a/configure b/configure
index 8e139dd08181..b686dd0aac81 100755
--- a/configure
+++ b/configure
@@ -21007,10 +21007,6 @@ fi
# it on if you really want, though.
if test x$enable_oss = xmaybe; then
enable_oss=yes
- case "$host" in
- *-*-openbsd*)
- enable_oss=no;;
- esac
fi
if test x$enable_audio = xyes -a x$enable_oss = xyes; then
@@ -21036,33 +21032,6 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
have_oss=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
- fi
- if test x$have_oss != xyes; then
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <soundcard.h>
-
-int
-main (void)
-{
-
- int arg = SNDCTL_DSP_SETFRAGMENT;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"
-then :
-
- have_oss=yes
-
-printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1" >>confdefs.h
-
-
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
@@ -21078,7 +21047,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h
# We may need to link with ossaudio emulation library
case "$host" in
- *-*-openbsd*|*-*-netbsd*)
+ *-*-netbsd*)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
esac
fi
@@ -32564,4 +32533,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
-
diff --git a/configure.ac b/configure.ac
index 2708c1f7672a..612602fb7319 100644
--- a/configure.ac
+++ b/configure.ac
@@ -933,10 +933,6 @@ CheckOSS()
# it on if you really want, though.
if test x$enable_oss = xmaybe; then
enable_oss=yes
- case "$host" in
- *-*-openbsd*)
- enable_oss=no;;
- esac
fi
if test x$enable_audio = xyes -a x$enable_oss = xyes; then
@@ -949,16 +945,6 @@ CheckOSS()
int arg = SNDCTL_DSP_SETFRAGMENT;
]])], [have_oss=yes],[])
fi
- if test x$have_oss != xyes; then
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <soundcard.h>
- ]], [[
- int arg = SNDCTL_DSP_SETFRAGMENT;
- ]])], [
- have_oss=yes
- AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
- ],[])
- fi
AC_MSG_RESULT($have_oss)
if test x$have_oss = xyes; then
SUMMARY_audio="${SUMMARY_audio} oss"
@@ -968,7 +954,7 @@ CheckOSS()
# We may need to link with ossaudio emulation library
case "$host" in
- *-*-openbsd*|*-*-netbsd*)
+ *-*-netbsd*)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
esac
fi
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 6daeadfa0c75..c9ee9df9977e 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -309,7 +309,6 @@
#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@
#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
-#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
#cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE @SDL_AUDIO_DRIVER_PIPEWIRE@
#cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC @SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC@
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 56b53029a77a..f6f2171fa45b 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -297,7 +297,6 @@
#undef SDL_AUDIO_DRIVER_NETBSD
#undef SDL_AUDIO_DRIVER_OPENSLES
#undef SDL_AUDIO_DRIVER_OSS
-#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
#undef SDL_AUDIO_DRIVER_PAUDIO
#undef SDL_AUDIO_DRIVER_PIPEWIRE
#undef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC
diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c
index 531612a29852..8734f7960605 100644
--- a/src/audio/dsp/SDL_dspaudio.c
+++ b/src/audio/dsp/SDL_dspaudio.c
@@ -34,13 +34,7 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
-#if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
-/* This is installed on some systems */
-#include <soundcard.h>
-#else
-/* This is recommended by OSS */
#include <sys/soundcard.h>
-#endif
#include "SDL_timer.h"
#include "SDL_audio.h"
diff --git a/test/configure b/test/configure
index c71abe48977f..f627d92de56c 100755
--- a/test/configure
+++ b/test/configure
@@ -6103,4 +6103,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
-