diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-03-17 06:59:31 +0000 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-03-17 06:59:31 +0000 |
commit | 2fa61afb4e8d575c3d5facf4072e91187945e163 (patch) | |
tree | ad36239fc1d157696a11ccf98915cad1fa56af58 | |
parent | 75fd3688f52f3d9574cf7204fd74c9eb9f2a639b (diff) | |
download | xine-lib-2fa61afb4e8d575c3d5facf4072e91187945e163.tar.gz xine-lib-2fa61afb4e8d575c3d5facf4072e91187945e163.tar.bz2 |
Clean up configure checks for OSS support. Check for the various soundcard.h headers, and then include the best one that has been found on the system. Check for definition of SNDCTL_DSP_SETFRAGMENT in those headers. Check for the correct request parameter type for ioctl(), as also modern Linux uses unsigned long. Don't list all the big endian machines (as they aren't reliable to list anyway, some of them might work with both endians), use WORDS_BIGENDIAN instead.
CVS patchset: 8697
CVS date: 2007/03/17 06:59:31
-rw-r--r-- | configure.ac | 38 | ||||
-rw-r--r-- | m4/ioctl_request.m4 | 52 | ||||
-rw-r--r-- | src/audio_out/audio_oss_out.c | 39 |
3 files changed, 85 insertions, 44 deletions
diff --git a/configure.ac b/configure.ac index b0bb4c3f1..f2ca16e17 100644 --- a/configure.ac +++ b/configure.ac @@ -1457,27 +1457,25 @@ dnl --------------------------------------------- dnl OSS style audio interface dnl --------------------------------------------- AC_ARG_ENABLE([oss], - AC_HELP_STRING([--disable-oss], [do not build OSS support]), - [with_oss=$enableval], [with_oss=yes]) - -if test "x$with_oss" = "xyes"; then - AC_MSG_CHECKING(for OSS audio support) - have_ossaudio=no - AC_TRY_COMPILE([ - #ifdef __NetBSD__ - #include <soundcard.h> - #else - #include <sys/soundcard.h> - #endif - ],[ - int arg = SNDCTL_DSP_SETFRAGMENT; - ],[ - have_ossaudio=yes - ]) - AC_MSG_RESULT($have_ossaudio) -else - have_ossaudio=no + AS_HELP_STRING([--disable-oss], [Do not build OSS audio output support])) + +if test "x$enable_oss" != "xno"; then + AC_CHECK_HEADERS([sys/soundcard.h machine/soundcard.h soundcard.h], [break]) + AC_CHECK_DECL([SNDCTL_DSP_SETFRAGMENT], [have_ossaudio=yes], [], [ + #ifdef HAVE_SYS_SOUNDCARD_H + # include <sys/soundcard.h> + #endif + #ifdef HAVE_MACHINE_SOUNDCARD_H + # include <sys/soundcard.h> + #endif + #ifdef HAVE_SOUNDCARD_H + # include <soundcard.h> + #endif + ]) + + AC_IOCTL_REQUEST fi + AM_CONDITIONAL(HAVE_OSS, test "x$have_ossaudio" = "xyes") diff --git a/m4/ioctl_request.m4 b/m4/ioctl_request.m4 new file mode 100644 index 000000000..e5ea6d346 --- /dev/null +++ b/m4/ioctl_request.m4 @@ -0,0 +1,52 @@ +dnl Simple macro to find the type of the ioctl request parameter +dnl Copyright (c) 2007 xine project +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +dnl 02110-1301, USA. +dnl +dnl As a special exception, the xine project, as copyright owner of the +dnl macro gives unlimited permission to copy, distribute and modify the +dnl configure scripts that are the output of Autoconf when processing the +dnl Macro. You need not follow the terms of the GNU General Public +dnl License when using or distributing such scripts, even though portions +dnl of the text of the Macro appear in them. The GNU General Public +dnl License (GPL) does govern all other use of the material that +dnl constitutes the Autoconf Macro. +dnl +dnl This special exception to the GPL applies to versions of the +dnl Autoconf Macro released by the xine project. When you make and +dnl distribute a modified version of the Autoconf Macro, you may extend +dnl this special exception to the GPL to apply to your modified version as +dnl well. + + +dnl Usage AC_IOCTL_REQUEST +AC_DEFUN([AC_IOCTL_REQUEST], [ + AC_CACHE_CHECK([type of request parameter for ioctl()], + ac_cv_ioctl_request, + [for ac_ioctl_request_type in "unsigned long" "int" + do + AC_TRY_LINK([ + #include <sys/ioctl.h> + int ioctl(int fd, $ac_ioctl_request_type request, ...); + ], [], [ac_cv_ioctl_request=$ac_ioctl_request_type]) + done]) + + if test "x$ac_cv_ioctl_request" = "x"; then + AC_MSG_ERROR([Unable to determine the type for ioctl() request parameter]) + fi + + AC_DEFINE_UNQUOTED([IOCTL_REQUEST_TYPE], $ac_cv_ioctl_request, [Type of the request parameter for ioctl()]) +]) diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 12a52b997..793b47650 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_oss_out.c,v 1.119 2007/03/16 17:13:57 dgp85 Exp $ + * $Id: audio_oss_out.c,v 1.120 2007/03/17 06:59:31 dgp85 Exp $ * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -48,20 +48,19 @@ #include <fcntl.h> #include <math.h> #include <unistd.h> -#if defined(__OpenBSD__) -# include <soundcard.h> -#elif defined (__FreeBSD__) -# if __FreeBSD__ < 4 -# include <machine/soundcard.h> -# else -# include <sys/soundcard.h> -# endif -#else -# include <sys/soundcard.h> -#endif #include <sys/ioctl.h> #include <inttypes.h> +#ifdef HAVE_SYS_SOUNDCARD_H +# include <sys/soundcard.h> +#endif +#ifdef HAVE_MACHINE_SOUNDCARD_H +# include <sys/soundcard.h> +#endif +#ifdef HAVE_SOUNDCARD_H +# include <soundcard.h> +#endif + #define LOG_MODULE "audio_oss_out" #define LOG_VERBOSE /* @@ -86,8 +85,7 @@ #endif #ifndef AFMT_S16_NE -# if defined(sparc) || defined(__sparc__) || defined(PPC) -/* Big endian machines */ +# ifdef WORDS_BIGENDIAN # define AFMT_S16_NE AFMT_S16_BE # else # define AFMT_S16_NE AFMT_S16_LE @@ -115,13 +113,6 @@ #define OSS_SYNC_SOFTSYNC 3 #define OSS_SYNC_PROBEBUFFER 4 -/* On FreeBSD the request type is unsigned long rather than int */ -#ifdef __FreeBSD__ -typedef unsigned long ioctl_request_t; -#else -typedef int ioctl_request_t; -#endif - typedef struct oss_driver_s { ao_driver_t ao_driver; @@ -532,7 +523,7 @@ static int ao_oss_get_property (ao_driver_t *this_gen, int property) { if(!this->mixer.mute) { if(this->mixer.fd != -1) { - ioctl_request_t cmd = 0; + IOCTL_REQUEST_TYPE cmd = 0; int v; ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); @@ -571,7 +562,7 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) if(!this->mixer.mute) { if(this->mixer.fd != -1) { - ioctl_request_t cmd = 0; + IOCTL_REQUEST_TYPE cmd = 0; int v; ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); @@ -600,7 +591,7 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) if(this->mixer.mute) { if(this->mixer.fd != -1) { - ioctl_request_t cmd = 0; + IOCTL_REQUEST_TYPE cmd = 0; int v = 0; ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); |