Brad Bishop | 34ae600 | 2019-04-08 15:21:03 -0400 | [diff] [blame] | 1 | From 54b1c2e27bf81f94c727b4923d4ed592110e2796 Mon Sep 17 00:00:00 2001 |
| 2 | From: Martin Jansa <Martin.Jansa@gmail.com> |
| 3 | Date: Sun, 29 May 2011 21:05:15 +0200 |
| 4 | |
| 5 | --- |
| 6 | alsa/stdioemu.c | 8 +++++++- |
| 7 | configure.ac | 6 ++++++ |
| 8 | 2 files changed, 13 insertions(+), 1 deletion(-) |
| 9 | |
| 10 | diff --git a/alsa/stdioemu.c b/alsa/stdioemu.c |
| 11 | index f7f9ab5..b673fe3 100644 |
| 12 | --- a/alsa/stdioemu.c |
| 13 | +++ b/alsa/stdioemu.c |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 14 | @@ -37,7 +37,9 @@ |
| 15 | #endif |
| 16 | |
| 17 | #include <stdio.h> |
Brad Bishop | 34ae600 | 2019-04-08 15:21:03 -0400 | [diff] [blame] | 18 | - |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 19 | +#ifdef HAVE_LIBIO_H |
Brad Bishop | 34ae600 | 2019-04-08 15:21:03 -0400 | [diff] [blame] | 20 | +#include <libio.h> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 21 | +#endif |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 22 | struct fd_cookie { |
| 23 | int fd; |
Brad Bishop | 34ae600 | 2019-04-08 15:21:03 -0400 | [diff] [blame] | 24 | }; |
| 25 | @@ -98,7 +100,11 @@ static FILE *fake_fopen(const char *path, const char *mode, int flags) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 26 | |
| 27 | if (open_mode && fdc->fd > 0) { |
| 28 | result = fopencookie (fdc,"w", fns); |
| 29 | +#ifdef HAVE_FILENO |
| 30 | result->_fileno = fdc->fd; /* ugly patchy slimy kludgy hack */ |
| 31 | +#else |
| 32 | + result->__filedes = fdc->fd; |
| 33 | +#endif |
| 34 | } |
| 35 | return result; |
| 36 | } |
Brad Bishop | 34ae600 | 2019-04-08 15:21:03 -0400 | [diff] [blame] | 37 | diff --git a/configure.ac b/configure.ac |
| 38 | index 583b95f..60a1025 100644 |
| 39 | --- a/configure.ac |
| 40 | +++ b/configure.ac |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 41 | @@ -35,6 +35,12 @@ if test "$with_aoss" = "yes"; then |
| 42 | LIBS="$OLD_LIBS" |
| 43 | fi |
| 44 | |
| 45 | +AC_CHECK_HEADERS_ONCE([libio.h]) |
| 46 | + |
| 47 | +AC_CHECK_MEMBER([struct _IO_FILE._fileno], |
| 48 | + [AC_DEFINE([HAVE_FILENO], [1],[Define if _fileno exists.])], |
| 49 | + [],[]) |
| 50 | + |
| 51 | AC_OUTPUT(Makefile alsa/Makefile alsa/aoss alsa/aoss.old \ |
| 52 | oss-redir/Makefile test/Makefile \ |
| 53 | alsa/testaoss test/testaoss) |