Skip to content

Commit

Permalink
Cleaned up the OpenBSD port, thanks to Peter Valchev
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Lantinga committed Jul 8, 2001
1 parent b1f443a commit 8417a33
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 94 deletions.
73 changes: 54 additions & 19 deletions configure.in
Expand Up @@ -245,13 +245,25 @@ CheckOSS()
if test x$enable_audio = xyes -a x$enable_oss = xyes; then
AC_MSG_CHECKING(for OSS audio support)
have_oss=no
AC_TRY_COMPILE([
#include <sys/soundcard.h>
],[
int arg = SNDCTL_DSP_SETFRAGMENT;
],[
have_oss=yes
])
if test x$have_oss != xyes; then
AC_TRY_COMPILE([
#include <sys/soundcard.h>
],[
int arg = SNDCTL_DSP_SETFRAGMENT;
],[
have_oss=yes
])
fi
if test x$have_oss != xyes; then
AC_TRY_COMPILE([
#include <soundcard.h>
],[
int arg = SNDCTL_DSP_SETFRAGMENT;
],[
have_oss=yes
CFLAGS="$CFLAGS -DOSS_USE_SOUNDCARD_H"
])
fi
AC_MSG_RESULT($have_oss)
if test x$have_oss = xyes; then
CFLAGS="$CFLAGS -DOSS_SUPPORT"
Expand Down Expand Up @@ -286,10 +298,10 @@ dnl Check whether we want to use OpenBSD native audio or not
CheckOPENBSDAUDIO()
{
AC_ARG_ENABLE(openbsdaudio,
[ --enable-openbsdaudio OpenBSD native audio support [default=no]],
, enable_openbsdaudio=no)
[ --enable-openbsdaudio OpenBSD native audio support [default=yes]],
, enable_openbsdaudio=yes)
if test x$enable_audio = xyes -a x$enable_openbsdaudio = xyes; then
SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
CFLAGS="$CFLAGS -DOBSD_SUPPORT"
AUDIO_SUBDIRS="$AUDIO_SUBDIRS openbsd"
AUDIO_DRIVERS="$AUDIO_DRIVERS openbsd/libaudio_openbsd.la"
fi
Expand Down Expand Up @@ -994,6 +1006,20 @@ CheckPTHREAD()
CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
fi

# Check to see if pthread semaphore support is missing
if test x$enable_pthread_sem = xyes; then
AC_MSG_CHECKING(for pthread semaphores)
have_pthread_sem=no
AC_TRY_COMPILE([
#include <pthread.h>
#include <semaphore.h>
],[
],[
have_pthread_sem=yes
])
AC_MSG_RESULT($have_pthread_sem)
fi

# Check to see if this is broken glibc 2.0 pthreads
case "$target" in
*-*-linux*)
Expand Down Expand Up @@ -1196,7 +1222,7 @@ case "$target" in
fi
COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
else
COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
Expand Down Expand Up @@ -1303,7 +1329,7 @@ case "$target" in
COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
else
COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
Expand Down Expand Up @@ -1353,7 +1379,7 @@ case "$target" in
COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
else
COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
Expand All @@ -1373,6 +1399,7 @@ case "$target" in
ARCH=openbsd
CheckDummyVideo
CheckDiskAudio
CheckOPENBSDAUDIO
CheckNASM
CheckOSS
CheckARTSC
Expand All @@ -1385,7 +1412,15 @@ case "$target" in
# Set up files for the main() stub
COPY_ARCH_SRC(src/main, linux, SDL_main.c)
# Set up files for the audio library
CheckOPENBSDAUDIO
# We use the OSS and native API's, not the Sun audio API
#if test x$enable_audio = xyes; then
# AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
# AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
#fi
# OpenBSD needs linking with ossaudio emulation library
if test x$have_oss = xyes; then
SYSTEM_LIBS="$SYSTEM_LIBS -lossaudio"
fi
# Set up files for the joystick library
# (No joystick support yet)
if test x$enable_joystick = xyes; then
Expand All @@ -1402,7 +1437,7 @@ case "$target" in
COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
else
COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
Expand Down Expand Up @@ -1528,7 +1563,7 @@ case "$target" in
if test x$enable_audio = xyes; then
AUDIO_SUBDIRS="$AUDIO_SUBDIRS dmedia"
AUDIO_DRIVERS="$AUDIO_DRIVERS dmedia/libaudio_dmedia.la"
LIBS="$LIBS -laudio"
SYSTEM_LIBS="$SYSTEM_LIBS -laudio"
fi
# Set up files for the joystick library
# (No joystick support yet)
Expand All @@ -1548,7 +1583,7 @@ case "$target" in
COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
if test x$enable_pthread_sem != xyes; then
if test x$have_pthread_sem != xyes; then
COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
else
COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
Expand Down Expand Up @@ -1937,7 +1972,7 @@ case "$target" in
COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
else
COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
Expand Down Expand Up @@ -1989,7 +2024,7 @@ if test $ARCH = solaris; then
fi

if test $ARCH = openbsd; then
SDL_RLD_FLAGS="-L${X11BASE}/lib -Wl,-rpath,\${exec_prefix}/lib -Wl,-rpath,${X11BASE}/lib"
SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib $SYSTEM_LIBS"
fi

dnl Output the video drivers we use
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_syswm.h
Expand Up @@ -49,7 +49,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
#else

/* This is the structure for custom window manager events */
#if (defined(unix) || defined(__unix__) || defined(_AIX)) && \
#if (defined(unix) || defined(__unix__) || defined(_AIX) || defined(__OpenBSD__)) && \
(!defined(DISABLE_X11) && !defined(__CYGWIN32__))
/* AIX is unix, of course, but the native compiler CSet doesn't define unix */
#include <X11/Xlib.h>
Expand Down
6 changes: 3 additions & 3 deletions src/audio/SDL_audio.c
Expand Up @@ -40,16 +40,16 @@ static char rcsid =

/* Available audio drivers */
static AudioBootStrap *bootstrap[] = {
#ifdef OBSD_SUPPORT
&OBSD_bootstrap,
#endif
#ifdef OSS_SUPPORT
&DSP_bootstrap,
&DMA_bootstrap,
#endif
#ifdef ALSA_SUPPORT
&ALSA_bootstrap,
#endif
#ifdef __OpenBSD__
&OBSD_bootstrap,
#endif
#if (defined(unix) && !defined(__CYGWIN32__)) && \
!defined(OSS_SUPPORT) && !defined(ALSA_SUPPORT)
&AUDIO_bootstrap,
Expand Down
6 changes: 5 additions & 1 deletion src/audio/SDL_audiodev.c
Expand Up @@ -39,7 +39,11 @@ static char rcsid =
#include "SDL_audiodev_c.h"

#ifndef _PATH_DEV_DSP
#define _PATH_DEV_DSP "/dev/dsp"
#ifdef __OpenBSD__
#define _PATH_DEV_DSP "/dev/audio"
#else
#define _PATH_DEV_DSP "/dev/dsp"
#endif
#endif
#ifndef _PATH_DEV_DSP24
#define _PATH_DEV_DSP24 "/dev/sound/dsp"
Expand Down
6 changes: 3 additions & 3 deletions src/audio/SDL_sysaudio.h
Expand Up @@ -99,16 +99,16 @@ typedef struct AudioBootStrap {
SDL_AudioDevice *(*create)(int devindex);
} AudioBootStrap;

#ifdef OBSD_SUPPORT
extern AudioBootStrap OBSD_bootstrap;
#endif
#ifdef OSS_SUPPORT
extern AudioBootStrap DSP_bootstrap;
extern AudioBootStrap DMA_bootstrap;
#endif
#ifdef ALSA_SUPPORT
extern AudioBootStrap ALSA_bootstrap;
#endif
#ifdef __OpenBSD__
extern AudioBootStrap OBSD_bootstrap;
#endif
#if (defined(unix) && !defined(__CYGWIN32__)) && \
!defined(OSS_SUPPORT) && !defined(ALSA_SUPPORT)
extern AudioBootStrap AUDIO_bootstrap;
Expand Down
6 changes: 6 additions & 0 deletions src/audio/dma/SDL_dmaaudio.c
Expand Up @@ -39,7 +39,13 @@ static char rcsid =
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#ifdef OSS_USE_SOUNDCARD_H
/* This is installed on some systems */
#include <soundcard.h>
#else
/* This is recommended by OSS */
#include <sys/soundcard.h>
#endif

#ifndef MAP_FAILED
#define MAP_FAILED ((Uint8 *)-1)
Expand Down
6 changes: 6 additions & 0 deletions src/audio/dsp/SDL_dspaudio.c
Expand Up @@ -37,7 +37,13 @@ static char rcsid =
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#ifdef OSS_USE_SOUNDCARD_H
/* This is installed on some systems */
#include <soundcard.h>
#else
/* This is recommended by OSS */
#include <sys/soundcard.h>
#endif

#include "SDL_audio.h"
#include "SDL_error.h"
Expand Down

0 comments on commit 8417a33

Please sign in to comment.