Hello,
While trying to install libdca-0.0.5 I get the error O_BINARY not defined.
after a little investigation it seems that ./configure searches for the io.h file in linux-headers.
Finds it and thus defines HAVE_IO_H 1 in config.h
The offending code is in files libdca-0.0.5/src/dcadec.c and libdca-0.0.5/src/extract_dca.c
where it tries to use the setmode function, to binary reading from stdin.
I would understand this being done on windows/cygwin but why on linux/Unix??
Am I missing something??
I had to patch the configure.ac and the above metioned source files to get it compiled.. and working.
Did anyone else have this problem?
Attaching patch....
Index: libdca-0.0.5/configure.ac
===================================================================
--- libdca-0.0.5.orig/configure.ac
+++ libdca-0.0.5/configure.ac
@@ -32,7 +32,6 @@ if test x"$GCC" = x"yes"; then
TRY_CFLAGS=`echo "$OPT_CFLAGS $CFLAGS"|sed "s/-O[0-9]*//g"`
changequote([,])
TRY_CFLAGS="$TRY_CFLAGS -O3"
- AC_TRY_CFLAGS([$TRY_CFLAGS],[OPT_CFLAGS=$TRY_CFLAGS; CFLAGS=""])
AC_ARG_ENABLE([debug],
[ --enable-debug debug mode configuration])
--- libdca-0.0.5.orig/configure.ac 2007-04-11 00:28:07.000000000 +1200
+++ libdca-0.0.5/configure.ac 2008-06-03 16:25:54.000000000 +1200
@@ -54,6 +54,10 @@
i686-*) TRY_CFLAGS="$OPT_CFLAGS -mtune=pentiumpro";;
k6-*) TRY_CFLAGS="$OPT_CFLAGS -mtune=k6";;
esac
+ echo "$host_os"
+ if test x"$host_os" = x"linux-gnu"; then
+ AC_DEFINE([LINUX],,[using for O_BINARY problem])
+ fi
AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS=$TRY_CFLAGS]);;
sparc-* | sparc64-*)
TRY_CFLAGS="$OPT_CFLAGS -mtune=ultrasparc"
--- libdca-0.0.5.orig/src/dcadec.c 2007-04-08 21:03:48.000000000 +1200
+++ libdca-0.0.5/src/dcadec.c 2008-06-03 16:15:52.000000000 +1200
@@ -605,10 +605,12 @@
{
uint32_t accel;
+#ifndef LINUX
#ifdef HAVE_IO_H
setmode (fileno (stdin), O_BINARY);
setmode (fileno (stdout), O_BINARY);
#endif
+#endif
fprintf (stderr, PACKAGE"-"VERSION
" - by Gildas Bazin <[email protected]>\n");
--- libdca-0.0.5.orig/src/extract_dca.c 2007-04-08 21:07:09.000000000 +1200
+++ libdca-0.0.5/src/extract_dca.c 2008-06-03 16:16:37.000000000 +1200
@@ -379,10 +379,13 @@
int main (int argc, char ** argv)
{
+
+#ifndef LINUX
#ifdef HAVE_IO_H
setmode (fileno (stdin), O_BINARY);
setmode (fileno (stdout), O_BINARY);
#endif
+#endif
handle_args (argc, argv);