blob: 835b26601483babf65aeaefa5d46a80a4e473203 [file] [log] [blame]
From 54b1c2e27bf81f94c727b4923d4ed592110e2796 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Sun, 29 May 2011 21:05:15 +0200
---
alsa/stdioemu.c | 8 +++++++-
configure.ac | 6 ++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/alsa/stdioemu.c b/alsa/stdioemu.c
index f7f9ab5..b673fe3 100644
--- a/alsa/stdioemu.c
+++ b/alsa/stdioemu.c
@@ -37,7 +37,9 @@
#endif
#include <stdio.h>
-
+#ifdef HAVE_LIBIO_H
+#include <libio.h>
+#endif
struct fd_cookie {
int fd;
};
@@ -98,7 +100,11 @@ static FILE *fake_fopen(const char *path, const char *mode, int flags)
if (open_mode && fdc->fd > 0) {
result = fopencookie (fdc,"w", fns);
+#ifdef HAVE_FILENO
result->_fileno = fdc->fd; /* ugly patchy slimy kludgy hack */
+#else
+ result->__filedes = fdc->fd;
+#endif
}
return result;
}
diff --git a/configure.ac b/configure.ac
index 583b95f..60a1025 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,12 @@ if test "$with_aoss" = "yes"; then
LIBS="$OLD_LIBS"
fi
+AC_CHECK_HEADERS_ONCE([libio.h])
+
+AC_CHECK_MEMBER([struct _IO_FILE._fileno],
+ [AC_DEFINE([HAVE_FILENO], [1],[Define if _fileno exists.])],
+ [],[])
+
AC_OUTPUT(Makefile alsa/Makefile alsa/aoss alsa/aoss.old \
oss-redir/Makefile test/Makefile \
alsa/testaoss test/testaoss)