blob: 835b26601483babf65aeaefa5d46a80a4e473203 [file] [log] [blame]
Brad Bishop34ae6002019-04-08 15:21:03 -04001From 54b1c2e27bf81f94c727b4923d4ed592110e2796 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: 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
10diff --git a/alsa/stdioemu.c b/alsa/stdioemu.c
11index f7f9ab5..b673fe3 100644
12--- a/alsa/stdioemu.c
13+++ b/alsa/stdioemu.c
Brad Bishop316dfdd2018-06-25 12:45:53 -040014@@ -37,7 +37,9 @@
15 #endif
16
17 #include <stdio.h>
Brad Bishop34ae6002019-04-08 15:21:03 -040018-
Brad Bishop316dfdd2018-06-25 12:45:53 -040019+#ifdef HAVE_LIBIO_H
Brad Bishop34ae6002019-04-08 15:21:03 -040020+#include <libio.h>
Brad Bishop316dfdd2018-06-25 12:45:53 -040021+#endif
Brad Bishop316dfdd2018-06-25 12:45:53 -040022 struct fd_cookie {
23 int fd;
Brad Bishop34ae6002019-04-08 15:21:03 -040024 };
25@@ -98,7 +100,11 @@ static FILE *fake_fopen(const char *path, const char *mode, int flags)
Brad Bishop316dfdd2018-06-25 12:45:53 -040026
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 Bishop34ae6002019-04-08 15:21:03 -040037diff --git a/configure.ac b/configure.ac
38index 583b95f..60a1025 100644
39--- a/configure.ac
40+++ b/configure.ac
Brad Bishop316dfdd2018-06-25 12:45:53 -040041@@ -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)