[libdvdcss-devel] build: use an alternative method for making O_BINARY use conditional.
Diego Elio Pettenò
git at videolan.org
Wed Feb 27 08:03:58 CET 2013
libdvdcss | branch: master | Diego Elio Pettenò <flameeyes at flameeyes.eu> | Wed Feb 27 07:52:56 2013 +0100| [2af9a1e3d10677c2aca1d798b2df4dd8044c258b] | committer: Diego Elio Pettenò
build: use an alternative method for making O_BINARY use conditional.
Instead of creating a new mode altogether, check for the definition of
O_BINARY in the headers, and if missing define it to zero.
Signed-off-by: Diego Elio Pettenò <flameeyes at flameeyes.eu>
> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=2af9a1e3d10677c2aca1d798b2df4dd8044c258b
---
configure.ac | 18 ++++++++++++++++--
src/device.c | 2 +-
src/device.h | 3 ---
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7e9c162..a736aac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,11 +52,25 @@ AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
-AC_CHECK_HEADERS(unistd.h sys/param.h sys/uio.h limits.h pwd.h errno.h)
+AC_CHECK_HEADERS([unistd.h sys/param.h sys/uio.h limits.h pwd.h]dnl
+ [errno.h sys/types.h sys/stat.h fcntl.h io.h])
+
+AC_CHECK_DECL([O_BINARY], [],
+ [AC_DEFINE([O_BINARY], [0], [Define O_BINARY if missing])],
+ [
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #if HAVE_SYS_STAT_H
+ # include <sys/stat.h>
+ #endif
+ #if HAVE_FCNTL_H
+ # include <fcntl.h>
+ #endif
+ ])
AC_SYS_LARGEFILE
-AC_CHECK_HEADERS([sys/stat.h sys/types.h io.h])
AC_CACHE_CHECK(
[for posix mkdir()],
[css_cv_mkdir_posix], [
diff --git a/src/device.c b/src/device.c
index 6a2a7df..f78ffc0 100644
--- a/src/device.c
+++ b/src/device.c
@@ -480,7 +480,7 @@ int _dvdcss_close ( dvdcss_t dvdcss )
*****************************************************************************/
static int libc_open ( dvdcss_t dvdcss, char const *psz_device )
{
- dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, LIBC_OPEN_MODE );
+ dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY );
if( dvdcss->i_fd == -1 )
{
diff --git a/src/device.h b/src/device.h
index ab3ade1..4119b70 100644
--- a/src/device.h
+++ b/src/device.h
@@ -46,9 +46,6 @@ struct iovec
#if !defined(WIN32) && !defined(__OS2__)
# define DVDCSS_RAW_OPEN
-# define LIBC_OPEN_MODE 0
-#else
-# define LIBC_OPEN_MODE O_BINARY
#endif
More information about the libdvdcss-devel
mailing list