[PATCH] Online define haskell functions for telldir and seekdir if they are supported
Nathan
nathan.huesken at posteo.de
Tue Jan 29 23:30:37 CET 2013
---
System/Posix/Directory.hsc | 4 ++++
System/Posix/Directory/ByteString.hsc | 4 ++++
System/Posix/Directory/Common.hsc | 8 ++++++++
configure.ac | 2 ++
4 files changed, 18 insertions(+)
diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc
index 71a70ce..d0ef4c0 100644
--- a/System/Posix/Directory.hsc
+++ b/System/Posix/Directory.hsc
@@ -29,8 +29,12 @@ module System.Posix.Directory (
rewindDirStream,
closeDirStream,
DirStreamOffset,
+#ifdef HAVE_TELLDIR
tellDirStream,
+#endif
+#ifdef HAVE_SEEKDIR
seekDirStream,
+#endif
-- * The working dirctory
getWorkingDirectory,
diff --git a/System/Posix/Directory/ByteString.hsc b/System/Posix/Directory/ByteString.hsc
index 3ac642b..bb9100c 100644
--- a/System/Posix/Directory/ByteString.hsc
+++ b/System/Posix/Directory/ByteString.hsc
@@ -29,8 +29,12 @@ module System.Posix.Directory.ByteString (
rewindDirStream,
closeDirStream,
DirStreamOffset,
+#ifdef HAVE_TELLDIR
tellDirStream,
+#endif
+#ifdef HAVE_SEEKDIR
seekDirStream,
+#endif
-- * The working dirctory
getWorkingDirectory,
diff --git a/System/Posix/Directory/Common.hsc b/System/Posix/Directory/Common.hsc
index a608be3..7e2dfc6 100644
--- a/System/Posix/Directory/Common.hsc
+++ b/System/Posix/Directory/Common.hsc
@@ -22,8 +22,12 @@ module System.Posix.Directory.Common (
DirStream(..), CDir, CDirent, DirStreamOffset(..),
rewindDirStream,
closeDirStream,
+#ifdef HAVE_SEEKDIR
seekDirStream,
+#endif
+#ifdef HAVE_TELLDIR
tellDirStream,
+#endif
changeWorkingDirectoryFd,
) where
@@ -57,13 +61,16 @@ foreign import ccall unsafe "closedir"
newtype DirStreamOffset = DirStreamOffset COff
+#ifdef HAVE_SEEKDIR
seekDirStream :: DirStream -> DirStreamOffset -> IO ()
seekDirStream (DirStream dirp) (DirStreamOffset off) =
c_seekdir dirp off
foreign import ccall unsafe "seekdir"
c_seekdir :: Ptr CDir -> COff -> IO ()
+#endif
+#ifdef HAVE_TELLDIR
tellDirStream :: DirStream -> IO DirStreamOffset
tellDirStream (DirStream dirp) = do
off <- c_telldir dirp
@@ -71,6 +78,7 @@ tellDirStream (DirStream dirp) = do
foreign import ccall unsafe "telldir"
c_telldir :: Ptr CDir -> IO COff
+#endif
changeWorkingDirectoryFd :: Fd -> IO ()
changeWorkingDirectoryFd (Fd fd) =
diff --git a/configure.ac b/configure.ac
index 818303b..50763a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,8 @@ AC_CHECK_FUNCS([nanosleep])
AC_CHECK_FUNCS([ptsname])
AC_CHECK_FUNCS([setitimer])
AC_CHECK_FUNCS([readdir_r])
+dnl not available on android so check for it
+AC_CHECK_FUNCS([telldir seekdir])
AC_CHECK_MEMBERS([struct stat.st_atim])
AC_CHECK_MEMBERS([struct stat.st_mtim])
--
1.7.10.4
--------------000201040506040705090207--
More information about the ghc-devs
mailing list