unix 2.7.3 → 2.8.8.0
raw patch · 75 files changed
Files
- System/Posix/ByteString/FilePath.hsc +54/−8
- System/Posix/Directory.hsc +20/−41
- System/Posix/Directory/ByteString.hsc +22/−43
- System/Posix/Directory/Common.hsc +327/−7
- System/Posix/Directory/Fd.hsc +7/−0
- System/Posix/Directory/Internals.hsc +52/−0
- System/Posix/Directory/PosixPath.hsc +143/−0
- System/Posix/DynamicLinker.hsc +4/−10
- System/Posix/DynamicLinker/ByteString.hsc +2/−8
- System/Posix/DynamicLinker/Common.hsc +0/−4
- System/Posix/DynamicLinker/Module.hsc +12/−7
- System/Posix/DynamicLinker/Module/ByteString.hsc +0/−4
- System/Posix/DynamicLinker/Prim.hsc +26/−6
- System/Posix/Env.hsc +6/−42
- System/Posix/Env/ByteString.hsc +9/−25
- System/Posix/Env/Internal.hsc +32/−0
- System/Posix/Env/PosixString.hsc +195/−0
- System/Posix/Error.hs +0/−5
- System/Posix/Fcntl.hsc +82/−7
- System/Posix/Files.hsc +162/−18
- System/Posix/Files/ByteString.hsc +147/−15
- System/Posix/Files/Common.hsc +764/−12
- System/Posix/Files/PosixString.hsc +567/−0
- System/Posix/IO.hsc +63/−13
- System/Posix/IO/ByteString.hsc +63/−13
- System/Posix/IO/Common.hsc +141/−63
- System/Posix/IO/PosixString.hsc +116/−0
- System/Posix/PosixPath/FilePath.hsc +172/−0
- System/Posix/PosixString.hs +70/−0
- System/Posix/Process.hsc +14/−4
- System/Posix/Process/ByteString.hsc +15/−4
- System/Posix/Process/Common.hsc +261/−5
- System/Posix/Process/Internals.hs +0/−78
- System/Posix/Process/Internals.hsc +94/−0
- System/Posix/Process/PosixString.hsc +139/−0
- System/Posix/Resource.hsc +43/−10
- System/Posix/Semaphore.hsc +55/−16
- System/Posix/SharedMem.hsc +10/−9
- System/Posix/Signals.hsc +266/−13
- System/Posix/Temp.hsc +19/−8
- System/Posix/Temp/ByteString.hsc +19/−8
- System/Posix/Temp/PosixString.hsc +143/−0
- System/Posix/Terminal.hsc +11/−26
- System/Posix/Terminal/ByteString.hsc +5/−23
- System/Posix/Terminal/Common.hsc +555/−119
- System/Posix/Terminal/PosixString.hsc +217/−0
- System/Posix/Time.hs +0/−5
- System/Posix/Unistd.hsc +1/−4
- System/Posix/User.hsc +349/−135
- System/Posix/User/ByteString.hsc +604/−0
- System/Posix/User/Common.hsc +79/−0
- cbits/HsUnix.c +18/−13
- cbits/execvpe.c +4/−2
- changelog.md +134/−9
- config.guess +1750/−1682
- config.sub +68/−34
- configure +8028/−6414
- configure.ac +132/−9
- include/HsUnix.h +13/−0
- include/HsUnixConfig.h.in +265/−77
- include/execvpe.h +0/−12
- jsbits/time.js +41/−0
- tests/DirEnt.hsc +38/−0
- tests/FileExtendedStatus.hs +166/−0
- tests/FileStatus.hs +1/−1
- tests/FileStatusByteString.hs +1/−1
- tests/ReadDirStream.hs +55/−0
- tests/Semaphore001.hs +1/−1
- tests/Semaphore002.hs +15/−0
- tests/SemaphoreInterrupt.hs +32/−0
- tests/T13660.hs +72/−0
- tests/Test.hs +0/−242
- tests/Test.hsc +301/−0
- unix.buildinfo.in +0/−1
- unix.cabal +174/−15
System/Posix/ByteString/FilePath.hsc view
@@ -1,8 +1,5 @@-#if __GLASGOW_HASKELL__ >= 709-{-# LANGUAGE Safe #-}-#else {-# LANGUAGE Trustworthy #-}-#endif+{-# LANGUAGE TypeApplications #-} ----------------------------------------------------------------------------- -- |@@ -29,7 +26,8 @@ throwErrnoPathIf_, throwErrnoPathIfNull, throwErrnoPathIfMinus1,- throwErrnoPathIfMinus1_+ throwErrnoPathIfMinus1_,+ throwErrnoTwoPathsIfMinus1_ ) where import Foreign hiding ( void )@@ -42,15 +40,23 @@ throwErrnoPathIfMinus1_ ) import Control.Monad-import Data.ByteString+import Control.Exception+import Data.ByteString.Internal (c_strlen)+import GHC.Foreign as GHC ( peekCStringLen )+import GHC.IO.Encoding ( getFileSystemEncoding )+import GHC.IO.Exception+import Data.ByteString as B import Data.ByteString.Char8 as BC import Prelude hiding (FilePath)+#if !MIN_VERSION_base(4, 11, 0)+import Data.Monoid ((<>))+#endif -- | A literal POSIX file path type RawFilePath = ByteString withFilePath :: RawFilePath -> (CString -> IO a) -> IO a-withFilePath = useAsCString+withFilePath path = useAsCStringSafe path peekFilePath :: CString -> IO RawFilePath peekFilePath = packCString@@ -91,7 +97,8 @@ throwErrnoPath loc path = do errno <- getErrno- ioError (errnoToIOError loc errno Nothing (Just (BC.unpack path)))+ path' <- either (const (BC.unpack path)) id <$> try @IOException (decodeWithBasePosix path)+ ioError (errnoToIOError loc errno Nothing (Just path')) -- | as 'throwErrnoIf', but exceptions include the given path when -- appropriate.@@ -125,3 +132,42 @@ -- throwErrnoPathIfMinus1_ :: (Eq a, Num a) => String -> RawFilePath -> IO a -> IO () throwErrnoPathIfMinus1_ = throwErrnoPathIf_ (== -1)++-- | as 'throwErrnoTwoPathsIfMinus1_', but exceptions include two paths when appropriate.+--+throwErrnoTwoPathsIfMinus1_ :: (Eq a, Num a) => String -> RawFilePath -> RawFilePath -> IO a -> IO ()+throwErrnoTwoPathsIfMinus1_ loc path1 path2 action = do+ path1' <- either (const (BC.unpack path1)) id <$> try @IOException (decodeWithBasePosix path1)+ path2' <- either (const (BC.unpack path2)) id <$> try @IOException (decodeWithBasePosix path2)+ throwErrnoIfMinus1_ (loc <> " '" <> path1' <> "' to '" <> path2' <> "'") action++-- | This mimics the filepath decoder base uses on unix,+-- with the small distinction that we're not truncating at NUL bytes (because we're not at+-- the outer FFI layer).+decodeWithBasePosix :: RawFilePath -> IO String+decodeWithBasePosix ba = B.useAsCStringLen ba $ \fp -> peekFilePathPosix fp+ where+ peekFilePathPosix :: CStringLen -> IO String+ peekFilePathPosix fp = getFileSystemEncoding >>= \enc -> GHC.peekCStringLen enc fp++-- | Wrapper around 'useAsCString', checking the encoded 'FilePath' for internal NUL octets as these are+-- disallowed in POSIX filepaths. See https://gitlab.haskell.org/ghc/ghc/-/issues/13660+useAsCStringSafe :: RawFilePath -> (CString -> IO a) -> IO a+useAsCStringSafe path f = useAsCString path $ \ptr -> do+ let len = B.length path+ clen <- c_strlen ptr+ if clen == fromIntegral len+ then f ptr+ else do+ path' <- either (const (BC.unpack path)) id <$> try @IOException (decodeWithBasePosix path)+ ioError (err path')+ where+ err path' =+ IOError+ { ioe_handle = Nothing+ , ioe_type = InvalidArgument+ , ioe_location = "checkForInteriorNuls"+ , ioe_description = "POSIX filepaths must not contain internal NUL octets."+ , ioe_errno = Nothing+ , ioe_filename = Just path'+ }
System/Posix/Directory.hsc view
@@ -1,10 +1,6 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- |@@ -35,6 +31,7 @@ DirStream, openDirStream, readDirStream,+ readDirStreamMaybe, rewindDirStream, closeDirStream, DirStreamOffset,@@ -51,7 +48,8 @@ changeWorkingDirectoryFd, ) where -import System.IO.Error+import Control.Monad ((>=>))+import Data.Maybe import System.Posix.Error import System.Posix.Types import Foreign@@ -87,38 +85,21 @@ -- | @readDirStream dp@ calls @readdir@ to obtain the -- next directory entry (@struct dirent@) for the open directory -- stream @dp@, and returns the @d_name@ member of that--- structure.+-- structure.+--+-- Note that this function returns an empty filepath if the end of the+-- directory stream is reached. For a safer alternative use+-- 'readDirStreamMaybe'. readDirStream :: DirStream -> IO FilePath-readDirStream (DirStream dirp) =- alloca $ \ptr_dEnt -> loop ptr_dEnt- where- loop ptr_dEnt = do- resetErrno- r <- c_readdir dirp ptr_dEnt- if (r == 0)- then do dEnt <- peek ptr_dEnt- if (dEnt == nullPtr)- then return []- else do- entry <- (d_name dEnt >>= peekFilePath)- c_freeDirEnt dEnt- return entry- else do errno <- getErrno- if (errno == eINTR) then loop ptr_dEnt else do- let (Errno eo) = errno- if (eo == 0)- then return []- else throwErrno "readDirStream"---- traversing directories-foreign import ccall unsafe "__hscore_readdir"- c_readdir :: Ptr CDir -> Ptr (Ptr CDirent) -> IO CInt--foreign import ccall unsafe "__hscore_free_dirent"- c_freeDirEnt :: Ptr CDirent -> IO ()+readDirStream = fmap (fromMaybe "") . readDirStreamMaybe -foreign import ccall unsafe "__hscore_d_name"- d_name :: Ptr CDirent -> IO CString+-- | @readDirStreamMaybe dp@ calls @readdir@ to obtain the+-- next directory entry (@struct dirent@) for the open directory+-- stream @dp@. It returns the @d_name@ member of that+-- structure wrapped in a @Just d_name@ if an entry was read and @Nothing@ if+-- the end of the directory stream was reached.+readDirStreamMaybe :: DirStream -> IO (Maybe FilePath)+readDirStreamMaybe = readDirStreamWith (dirEntName >=> peekFilePath) -- | @getWorkingDirectory@ calls @getcwd@ to obtain the name@@ -147,18 +128,16 @@ -- the current working directory to @dir@. changeWorkingDirectory :: FilePath -> IO () changeWorkingDirectory path =- modifyIOError (`ioeSetFileName` path) $- withFilePath path $ \s ->- throwErrnoIfMinus1Retry_ "changeWorkingDirectory" (c_chdir s)+ withFilePath path $ \s ->+ throwErrnoPathIfMinus1Retry_ "changeWorkingDirectory" path (c_chdir s) foreign import ccall unsafe "chdir" c_chdir :: CString -> IO CInt removeDirectory :: FilePath -> IO () removeDirectory path =- modifyIOError (`ioeSetFileName` path) $- withFilePath path $ \s ->- throwErrnoIfMinus1Retry_ "removeDirectory" (c_rmdir s)+ withFilePath path $ \s ->+ throwErrnoPathIfMinus1Retry_ "removeDirectory" path (c_rmdir s) foreign import ccall unsafe "rmdir" c_rmdir :: CString -> IO CInt
System/Posix/Directory/ByteString.hsc view
@@ -1,10 +1,6 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- |@@ -35,6 +31,7 @@ DirStream, openDirStream, readDirStream,+ readDirStreamMaybe, rewindDirStream, closeDirStream, DirStreamOffset,@@ -45,13 +42,14 @@ seekDirStream, #endif - -- * The working dirctory+ -- * The working directory getWorkingDirectory, changeWorkingDirectory, changeWorkingDirectoryFd, ) where -import System.IO.Error+import Control.Monad ((>=>))+import Data.Maybe import System.Posix.Types import Foreign import Foreign.C@@ -63,7 +61,7 @@ -- | @createDirectory dir mode@ calls @mkdir@ to -- create a new directory, @dir@, with permissions based on--- @mode@.+-- @mode@. createDirectory :: RawFilePath -> FileMode -> IO () createDirectory name mode = withFilePath name $ \s ->@@ -88,38 +86,21 @@ -- | @readDirStream dp@ calls @readdir@ to obtain the -- next directory entry (@struct dirent@) for the open directory -- stream @dp@, and returns the @d_name@ member of that--- structure.+-- structure.+--+-- Note that this function returns an empty filepath if the end of the+-- directory stream is reached. For a safer alternative use+-- 'readDirStreamMaybe'. readDirStream :: DirStream -> IO RawFilePath-readDirStream (DirStream dirp) =- alloca $ \ptr_dEnt -> loop ptr_dEnt- where- loop ptr_dEnt = do- resetErrno- r <- c_readdir dirp ptr_dEnt- if (r == 0)- then do dEnt <- peek ptr_dEnt- if (dEnt == nullPtr)- then return BC.empty- else do- entry <- (d_name dEnt >>= peekFilePath)- c_freeDirEnt dEnt- return entry- else do errno <- getErrno- if (errno == eINTR) then loop ptr_dEnt else do- let (Errno eo) = errno- if (eo == 0)- then return BC.empty- else throwErrno "readDirStream"---- traversing directories-foreign import ccall unsafe "__hscore_readdir"- c_readdir :: Ptr CDir -> Ptr (Ptr CDirent) -> IO CInt--foreign import ccall unsafe "__hscore_free_dirent"- c_freeDirEnt :: Ptr CDirent -> IO ()+readDirStream = fmap (fromMaybe BC.empty) . readDirStreamMaybe -foreign import ccall unsafe "__hscore_d_name"- d_name :: Ptr CDirent -> IO CString+-- | @readDirStreamMaybe dp@ calls @readdir@ to obtain the+-- next directory entry (@struct dirent@) for the open directory+-- stream @dp@. It returns the @d_name@ member of that+-- structure wrapped in a @Just d_name@ if an entry was read and @Nothing@ if+-- the end of the directory stream was reached.+readDirStreamMaybe :: DirStream -> IO (Maybe RawFilePath)+readDirStreamMaybe = readDirStreamWith (dirEntName >=> peekFilePath) -- | @getWorkingDirectory@ calls @getcwd@ to obtain the name@@ -148,18 +129,16 @@ -- the current working directory to @dir@. changeWorkingDirectory :: RawFilePath -> IO () changeWorkingDirectory path =- modifyIOError (`ioeSetFileName` (BC.unpack path)) $- withFilePath path $ \s ->- throwErrnoIfMinus1Retry_ "changeWorkingDirectory" (c_chdir s)+ withFilePath path $ \s ->+ throwErrnoPathIfMinus1Retry_ "changeWorkingDirectory" path (c_chdir s) foreign import ccall unsafe "chdir" c_chdir :: CString -> IO CInt removeDirectory :: RawFilePath -> IO () removeDirectory path =- modifyIOError (`ioeSetFileName` BC.unpack path) $- withFilePath path $ \s ->- throwErrnoIfMinus1Retry_ "removeDirectory" (c_rmdir s)+ withFilePath path $ \s ->+ throwErrnoPathIfMinus1Retry_ "removeDirectory" path (c_rmdir s) foreign import ccall unsafe "rmdir" c_rmdir :: CString -> IO CInt
System/Posix/Directory/Common.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709-{-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif+{-# LANGUAGE CPP, Safe, CApiFFI, MultiWayIf, PatternSynonyms #-} ----------------------------------------------------------------------------- -- |@@ -19,9 +15,46 @@ ----------------------------------------------------------------------------- #include "HsUnix.h"+#include "HsUnixConfig.h"+##include "HsUnixConfig.h" module System.Posix.Directory.Common (- DirStream(..), CDir, CDirent, DirStreamOffset(..),+ DirStream(..),+ CDir,+ CDirent,+ DirStreamOffset(..),++ DirStreamWithPath(..),+ fromDirStreamWithPath,+ toDirStreamWithPath,+ DirEnt(..),+ dirEntName,+ dirEntType,+ DirType( DirType+ , UnknownType+ , NamedPipeType+ , CharacterDeviceType+ , DirectoryType+ , BlockDeviceType+ , RegularFileType+ , SymbolicLinkType+ , SocketType+ , WhiteoutType+ ),+ isUnknownType,+ isNamedPipeType,+ isCharacterDeviceType,+ isDirectoryType,+ isBlockDeviceType,+ isRegularFileType,+ isSymbolicLinkType,+ isSocketType,+ isWhiteoutType,+ getRealDirType,+ unsafeOpenDirStreamFd,+ readDirStreamWith,+ readDirStreamWithPtr,+ rewindDirStream, closeDirStream, #ifdef HAVE_SEEKDIR@@ -33,15 +66,292 @@ changeWorkingDirectoryFd, ) where +import Control.Exception (mask_)+import Control.Monad (void, when) import System.Posix.Types-import Foreign+import Foreign hiding (void) import Foreign.C +#if !defined(HAVE_FCHDIR)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif++import System.Posix.Files.Common+ newtype DirStream = DirStream (Ptr CDir) +-- | @since 2.8.6.0+newtype DirStreamWithPath a = DirStreamWithPath (a, Ptr CDir)++-- | Convert a 'DirStreamWithPath' to a 'DirStream'.+-- Note that the underlying pointer is shared by both values, hence any+-- modification to the resulting 'DirStream' will also modify the original+-- 'DirStreamWithPath'.+--+-- @since 2.8.6.0+fromDirStreamWithPath :: DirStreamWithPath a -> DirStream+fromDirStreamWithPath (DirStreamWithPath (_, ptr)) = DirStream ptr++-- | Construct a 'DirStreamWithPath' from a 'DirStream'.+-- Note that the underlying pointer is shared by both values, hence any+-- modification to the pointer of the resulting 'DirStreamWithPath' will also+-- modify the original 'DirStream'.+--+-- @since 2.8.6.0+toDirStreamWithPath :: a -> DirStream -> DirStreamWithPath a+toDirStreamWithPath path (DirStream ptr) = DirStreamWithPath (path, ptr)++-- | @since 2.8.6.0+newtype DirEnt = DirEnt (Ptr CDirent)++-- We provide a hand-written instance here since GeneralizedNewtypeDeriving and+-- DerivingVia are not allowed in Safe Haskell.+instance Storable DirEnt where+ sizeOf _ = sizeOf (undefined :: Ptr CDirent)+ {-# INLINE sizeOf #-}++ alignment _ = alignment (undefined :: Ptr CDirent)+ {-# INLINE alignment #-}++ peek ptr = DirEnt <$> peek (castPtr ptr)+ {-# INLINE peek #-}++ poke ptr (DirEnt dEnt) = poke (castPtr ptr) dEnt+ {-# INLINE poke#-}+ data {-# CTYPE "DIR" #-} CDir data {-# CTYPE "struct dirent" #-} CDirent +-- | The value of the @d_type@ field of a @dirent@ struct.+-- Note that the possible values of that type depend on the filesystem that is+-- queried. From @readdir(3)@:+--+-- > Currently, only some filesystems (among them: Btrfs, ext2, ext3, and ext4)+-- > have full support for returning the file type in d_type. All applications+-- > must properly handle a return of DT_UNKNOWN.+--+-- For example, JFS is a filesystem that does not support @d_type@;+-- See https://github.com/haskell/ghcup-hs/issues/766+--+-- Furthermore, @dirent@ or the constants represented by the associated pattern+-- synonyms of this type may not be provided by the underlying platform. In that+-- case none of those patterns will match and the application must handle that+-- case accordingly.+--+-- @since 2.8.6.0+newtype DirType = DirType CChar+ deriving (Eq, Ord, Show)++-- | The 'DirType' refers to an entry of unknown type.+pattern UnknownType :: DirType+pattern UnknownType = DirType (CONST_DT_UNKNOWN)++-- | The 'DirType' refers to an entry that is a named pipe.+pattern NamedPipeType :: DirType+pattern NamedPipeType = DirType (CONST_DT_FIFO)++-- | The 'DirType' refers to an entry that is a character device.+pattern CharacterDeviceType :: DirType+pattern CharacterDeviceType = DirType (CONST_DT_CHR)++-- | The 'DirType' refers to an entry that is a directory.+pattern DirectoryType :: DirType+pattern DirectoryType = DirType (CONST_DT_DIR)++-- | The 'DirType' refers to an entry that is a block device.+pattern BlockDeviceType :: DirType+pattern BlockDeviceType = DirType (CONST_DT_BLK)++-- | The 'DirType' refers to an entry that is a regular file.+pattern RegularFileType :: DirType+pattern RegularFileType = DirType (CONST_DT_REG)++-- | The 'DirType' refers to an entry that is a symbolic link.+pattern SymbolicLinkType :: DirType+pattern SymbolicLinkType = DirType (CONST_DT_LNK)++-- | The 'DirType' refers to an entry that is a socket.+pattern SocketType :: DirType+pattern SocketType = DirType (CONST_DT_SOCK)++-- | The 'DirType' refers to an entry that is a whiteout.+pattern WhiteoutType :: DirType+pattern WhiteoutType = DirType (CONST_DT_WHT)++-- | Checks if this 'DirType' refers to an entry of unknown type.+--+-- @since 2.8.6.0+isUnknownType :: DirType -> Bool+-- | Checks if this 'DirType' refers to a block device entry.+--+-- @since 2.8.6.0+isBlockDeviceType :: DirType -> Bool+-- | Checks if this 'DirType' refers to a character device entry.+--+-- @since 2.8.6.0+isCharacterDeviceType :: DirType -> Bool+-- | Checks if this 'DirType' refers to a named pipe entry.+--+-- @since 2.8.6.0+isNamedPipeType :: DirType -> Bool+-- | Checks if this 'DirType' refers to a regular file entry.+--+-- @since 2.8.6.0+isRegularFileType :: DirType -> Bool+-- | Checks if this 'DirType' refers to a directory entry.+--+-- @since 2.8.6.0+isDirectoryType :: DirType -> Bool+-- | Checks if this 'DirType' refers to a symbolic link entry.+--+-- @since 2.8.6.0+isSymbolicLinkType :: DirType -> Bool+-- | Checks if this 'DirType' refers to a socket entry.+--+-- @since 2.8.6.0+isSocketType :: DirType -> Bool+-- | Checks if this 'DirType' refers to a whiteout entry.+--+-- @since 2.8.6.0+isWhiteoutType :: DirType -> Bool++isUnknownType dtype = dtype == UnknownType+isBlockDeviceType dtype = dtype == BlockDeviceType+isCharacterDeviceType dtype = dtype == CharacterDeviceType+isNamedPipeType dtype = dtype == NamedPipeType+isRegularFileType dtype = dtype == RegularFileType+isDirectoryType dtype = dtype == DirectoryType+isSymbolicLinkType dtype = dtype == SymbolicLinkType+isSocketType dtype = dtype == SocketType+isWhiteoutType dtype = dtype == WhiteoutType++-- | @since 2.8.6.0+getRealDirType :: IO FileStatus -> DirType -> IO DirType+getRealDirType _ BlockDeviceType = return BlockDeviceType+getRealDirType _ CharacterDeviceType = return CharacterDeviceType+getRealDirType _ NamedPipeType = return NamedPipeType+getRealDirType _ RegularFileType = return RegularFileType+getRealDirType _ DirectoryType = return DirectoryType+getRealDirType _ SymbolicLinkType = return SymbolicLinkType+getRealDirType _ SocketType = return SocketType+getRealDirType _ WhiteoutType = return WhiteoutType+getRealDirType getFileStatus _ = do+ stat <- getFileStatus+ return $ if | isRegularFile stat -> RegularFileType+ | isDirectory stat -> DirectoryType+ | isSymbolicLink stat -> SymbolicLinkType+ | isBlockDevice stat -> BlockDeviceType+ | isCharacterDevice stat -> CharacterDeviceType+ | isNamedPipe stat -> NamedPipeType+ | isSocket stat -> SocketType+ | otherwise -> UnknownType++-- | Call @fdopendir@ to obtain a directory stream for @fd@. @fd@ must not be+-- otherwise used after this.+--+-- On success, it is owned by the returned 'DirStream', which should be closed+-- via 'closeDirStream' when no longer needed. On error, the file descriptor+-- is automatically closed and then an exception is thrown. There is no code+-- path in which the file descriptor remains open and yet not owned by a+-- returned 'DirStream'.+--+-- The input file descriptor must not have been used with @threadWaitRead@ or+-- @threadWaitWrite@.+--+-- @since 2.8.6.0+unsafeOpenDirStreamFd :: Fd -> IO DirStream+unsafeOpenDirStreamFd (Fd fd) = mask_ $ do+ ptr <- c_fdopendir fd+ when (ptr == nullPtr) $ do+ errno <- getErrno+ void $ c_close fd+ ioError (errnoToIOError "openDirStreamFd" errno Nothing Nothing)+ return $ DirStream ptr++-- We need c_close here, because 'closeFd' throws exceptions on error,+-- but we want to silently close the (presumably directory) descriptor.+foreign import ccall unsafe "HsUnix.h close"+ c_close :: CInt -> IO CInt++-- NOTE: It is /critical/ to use "capi" and "dirent.h" here, because system+-- headers on e.g. macOS alias this function, and linking directly to the+-- "fdopendir" symbol in libc leads to a crash!+--+foreign import capi unsafe "dirent.h fdopendir"+ c_fdopendir :: CInt -> IO (Ptr CDir)+++-- | @readDirStreamWith f dp@ calls @readdir@ to obtain the next directory entry+-- (@struct dirent@) for the open directory stream @dp@. If an entry is read,+-- it passes the pointer to that structure to the provided function @f@ for+-- processing. It returns the result of that function call wrapped in a @Just@+-- if an entry was read and @Nothing@ if the end of the directory stream was+-- reached.+--+-- __NOTE:__ The lifetime of the pointer wrapped in the `DirEnt` is limited to+-- invocation of the callback and it will be freed automatically after. Do not+-- pass it to the outside world!+--+-- @since 2.8.6.0+readDirStreamWith :: (DirEnt -> IO a) -> DirStream -> IO (Maybe a)+readDirStreamWith f dstream = alloca+ (\ptr_dEnt -> readDirStreamWithPtr ptr_dEnt f dstream)++-- | A version of 'readDirStreamWith' that takes a pre-allocated pointer in+-- addition to the other arguments. This pointer is used to store the pointer+-- to the next directory entry, if there is any. This function is intended for+-- use cases where you need to read a lot of directory entries and want to+-- reuse the pointer for each of them. Using for example 'readDirStream' or+-- 'readDirStreamWith' in this scenario would allocate a new pointer for each+-- call of these functions.+--+-- __NOTE__: You are responsible for releasing the pointer after you are done.+--+-- @since 2.8.6.0+readDirStreamWithPtr :: Ptr DirEnt -> (DirEnt -> IO a) -> DirStream -> IO (Maybe a)+readDirStreamWithPtr ptr_dEnt f dstream@(DirStream dirp) = do+ resetErrno+ r <- c_readdir dirp (castPtr ptr_dEnt)+ if (r == 0)+ then do dEnt@(DirEnt dEntPtr) <- peek ptr_dEnt+ if (dEntPtr == nullPtr)+ then return Nothing+ else do+ res <- f dEnt+ c_freeDirEnt dEntPtr+ return (Just res)+ else do errno <- getErrno+ if (errno == eINTR)+ then readDirStreamWithPtr ptr_dEnt f dstream+ else do+ let (Errno eo) = errno+ if (eo == 0)+ then return Nothing+ else throwErrno "readDirStream"++-- | @since 2.8.6.0+dirEntName :: DirEnt -> IO CString+dirEntName (DirEnt dEntPtr) = d_name dEntPtr++foreign import ccall unsafe "__hscore_d_name"+ d_name :: Ptr CDirent -> IO CString++-- | @since 2.8.6.0+dirEntType :: DirEnt -> IO DirType+dirEntType (DirEnt dEntPtr) = DirType <$> d_type dEntPtr++foreign import ccall unsafe "__hscore_d_type"+ d_type :: Ptr CDirent -> IO CChar++-- traversing directories+foreign import ccall unsafe "__hscore_readdir"+ c_readdir :: Ptr CDir -> Ptr (Ptr CDirent) -> IO CInt++foreign import ccall unsafe "__hscore_free_dirent"+ c_freeDirEnt :: Ptr CDirent -> IO ()++ -- | @rewindDirStream dp@ calls @rewinddir@ to reposition -- the directory stream @dp@ at the beginning of the directory. rewindDirStream :: DirStream -> IO ()@@ -80,9 +390,19 @@ c_telldir :: Ptr CDir -> IO CLong #endif +#if defined(HAVE_FCHDIR)+ changeWorkingDirectoryFd :: Fd -> IO () changeWorkingDirectoryFd (Fd fd) = throwErrnoIfMinus1Retry_ "changeWorkingDirectoryFd" (c_fchdir fd) foreign import ccall unsafe "fchdir" c_fchdir :: CInt -> IO CInt++#else++{-# WARNING changeWorkingDirectoryFd "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_FCHDIR@)" #-}+changeWorkingDirectoryFd :: Fd -> IO ()+changeWorkingDirectoryFd _ = ioError (ioeSetLocation unsupportedOperation "changeWorkingDirectoryFd")++#endif // HAVE_FCHDIR
+ System/Posix/Directory/Fd.hsc view
@@ -0,0 +1,7 @@+#include "HsUnix.h"++module System.Posix.Directory.Fd (+ unsafeOpenDirStreamFd+) where++import System.Posix.Directory.Common
+ System/Posix/Directory/Internals.hsc view
@@ -0,0 +1,52 @@+-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.Directory.Internals+-- Copyright : (c) The University of Glasgow 2022+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- POSIX directory support (internal module, no PVP guarantees)+--+-----------------------------------------------------------------------------++module System.Posix.Directory.Internals (+ DirStream(..),+ CDir,+ CDirent,+ DirStreamOffset(..),++ DirStreamWithPath(..),+ fromDirStreamWithPath,+ toDirStreamWithPath,+ DirEnt(..),+ dirEntName,+ dirEntType,+ DirType( DirType+ , UnknownType+ , NamedPipeType+ , CharacterDeviceType+ , DirectoryType+ , BlockDeviceType+ , RegularFileType+ , SymbolicLinkType+ , SocketType+ , WhiteoutType+ ),+ isUnknownType,+ isNamedPipeType,+ isCharacterDeviceType,+ isDirectoryType,+ isBlockDeviceType,+ isRegularFileType,+ isSymbolicLinkType,+ isSocketType,+ isWhiteoutType,+ getRealDirType,+ readDirStreamWith,+ readDirStreamWithPtr,+ ) where++import System.Posix.Directory.Common
+ System/Posix/Directory/PosixPath.hsc view
@@ -0,0 +1,143 @@+{-# LANGUAGE CApiFFI #-}+{-# LANGUAGE NondecreasingIndentation #-}++-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.Directory.PosixPath+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- PosixPath based POSIX directory support+--+-----------------------------------------------------------------------------++#include "HsUnix.h"++-- hack copied from System.Posix.Files+#if !defined(PATH_MAX)+# define PATH_MAX 4096+#endif++module System.Posix.Directory.PosixPath (+ -- * Creating and removing directories+ createDirectory, removeDirectory,++ -- * Reading directories+ Common.DirStream,+ openDirStream,+ readDirStream,+ readDirStreamMaybe,+ Common.rewindDirStream,+ Common.closeDirStream,+ Common.DirStreamOffset,+#ifdef HAVE_TELLDIR+ Common.tellDirStream,+#endif+#ifdef HAVE_SEEKDIR+ Common.seekDirStream,+#endif++ -- * The working directory+ getWorkingDirectory,+ changeWorkingDirectory,+ Common.changeWorkingDirectoryFd,+ ) where++import Control.Monad ((>=>))+import Data.Maybe+import System.Posix.Types+import Foreign+import Foreign.C++import System.OsPath.Posix+import qualified System.Posix.Directory.Common as Common+import System.Posix.PosixPath.FilePath++-- | @createDirectory dir mode@ calls @mkdir@ to+-- create a new directory, @dir@, with permissions based on+-- @mode@.+createDirectory :: PosixPath -> FileMode -> IO ()+createDirectory name mode =+ withFilePath name $ \s ->+ throwErrnoPathIfMinus1Retry_ "createDirectory" name (c_mkdir s mode)+ -- POSIX doesn't allow mkdir() to return EINTR, but it does on+ -- OS X (#5184), so we need the Retry variant here.++foreign import ccall unsafe "mkdir"+ c_mkdir :: CString -> CMode -> IO CInt++-- | @openDirStream dir@ calls @opendir@ to obtain a+-- directory stream for @dir@.+openDirStream :: PosixPath -> IO Common.DirStream+openDirStream name =+ withFilePath name $ \s -> do+ dirp <- throwErrnoPathIfNullRetry "openDirStream" name $ c_opendir s+ return (Common.DirStream dirp)++foreign import capi unsafe "HsUnix.h opendir"+ c_opendir :: CString -> IO (Ptr Common.CDir)++-- | @readDirStream dp@ calls @readdir@ to obtain the+-- next directory entry (@struct dirent@) for the open directory+-- stream @dp@, and returns the @d_name@ member of that+-- structure.+--+-- Note that this function returns an empty filepath if the end of the+-- directory stream is reached. For a safer alternative use+-- 'readDirStreamMaybe'.+readDirStream :: Common.DirStream -> IO PosixPath+readDirStream = fmap (fromMaybe mempty) . readDirStreamMaybe++-- | @readDirStreamMaybe dp@ calls @readdir@ to obtain the+-- next directory entry (@struct dirent@) for the open directory+-- stream @dp@. It returns the @d_name@ member of that+-- structure wrapped in a @Just d_name@ if an entry was read and @Nothing@ if+-- the end of the directory stream was reached.+readDirStreamMaybe :: Common.DirStream -> IO (Maybe PosixPath)+readDirStreamMaybe = Common.readDirStreamWith+ (Common.dirEntName >=> peekFilePath)+++-- | @getWorkingDirectory@ calls @getcwd@ to obtain the name+-- of the current working directory.+getWorkingDirectory :: IO PosixPath+getWorkingDirectory = go (#const PATH_MAX)+ where+ go bytes = do+ r <- allocaBytes bytes $ \buf -> do+ buf' <- c_getcwd buf (fromIntegral bytes)+ if buf' /= nullPtr+ then do s <- peekFilePath buf+ return (Just s)+ else do errno <- getErrno+ if errno == eRANGE+ -- we use Nothing to indicate that we should+ -- try again with a bigger buffer+ then return Nothing+ else throwErrno "getWorkingDirectory"+ maybe (go (2 * bytes)) return r++foreign import ccall unsafe "getcwd"+ c_getcwd :: Ptr CChar -> CSize -> IO (Ptr CChar)++-- | @changeWorkingDirectory dir@ calls @chdir@ to change+-- the current working directory to @dir@.+changeWorkingDirectory :: PosixPath -> IO ()+changeWorkingDirectory path =+ withFilePath path $ \s ->+ throwErrnoPathIfMinus1Retry_ "changeWorkingDirectory" path (c_chdir s)++foreign import ccall unsafe "chdir"+ c_chdir :: CString -> IO CInt++removeDirectory :: PosixPath -> IO ()+removeDirectory path =+ withFilePath path $ \s ->+ throwErrnoPathIfMinus1Retry_ "removeDirectory" path (c_rmdir s)++foreign import ccall unsafe "rmdir"+ c_rmdir :: CString -> IO CInt
System/Posix/DynamicLinker.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.DynamicLinker@@ -56,17 +52,15 @@ #include "HsUnix.h" import Control.Exception ( bracket )-import Control.Monad ( liftM ) import Foreign import System.Posix.Internals ( withFilePath ) dlopen :: FilePath -> [RTLDFlags] -> IO DL-dlopen path flags = do- withFilePath path $ \ p -> do- liftM DLHandle $ throwDLErrorIf "dlopen" (== nullPtr) $ c_dlopen p (packRTLDFlags flags)+dlopen path flags = withFilePath path $ \p -> DLHandle <$>+ throwDLErrorIf "dlopen" (== nullPtr) (c_dlopen p (packRTLDFlags flags)) -withDL :: String -> [RTLDFlags] -> (DL -> IO a) -> IO a+withDL :: FilePath -> [RTLDFlags] -> (DL -> IO a) -> IO a withDL file flags f = bracket (dlopen file flags) (dlclose) f -withDL_ :: String -> [RTLDFlags] -> (DL -> IO a) -> IO ()+withDL_ :: FilePath -> [RTLDFlags] -> (DL -> IO a) -> IO () withDL_ file flags f = withDL file flags f >> return ()
System/Posix/DynamicLinker/ByteString.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- |@@ -57,14 +53,12 @@ #include "HsUnix.h" import Control.Exception ( bracket )-import Control.Monad ( liftM ) import Foreign import System.Posix.ByteString.FilePath dlopen :: RawFilePath -> [RTLDFlags] -> IO DL-dlopen path flags = do- withFilePath path $ \ p -> do- liftM DLHandle $ throwDLErrorIf "dlopen" (== nullPtr) $ c_dlopen p (packRTLDFlags flags)+dlopen path flags = withFilePath path $ \p -> DLHandle <$>+ throwDLErrorIf "dlopen" (== nullPtr) (c_dlopen p (packRTLDFlags flags)) withDL :: RawFilePath -> [RTLDFlags] -> (DL -> IO a) -> IO a withDL file flags f = bracket (dlopen file flags) (dlclose) f
System/Posix/DynamicLinker/Common.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.DynamicLinker.Common
System/Posix/DynamicLinker/Module.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.DynamicLinker.Module@@ -60,6 +56,7 @@ #include "HsUnix.h" +import Prelude hiding (head, tail) import System.Posix.DynamicLinker import System.Posix.DynamicLinker.Common import Foreign.Ptr ( Ptr, nullPtr, FunPtr )@@ -105,9 +102,10 @@ withModule mdir file flags p = do let modPath = case mdir of Nothing -> file- Just dir -> dir ++ if ((head (reverse dir)) == '/')- then file- else ('/':file)+ Just dir -> dir ++ case unsnoc dir of+ Just (_, '/') -> file+ Just{} -> '/' : file+ Nothing -> error "System.Posix.DynamicLinker.Module.withModule: directory should not be Just \"\", pass Nothing instead" modu <- moduleOpen modPath flags result <- p modu moduleClose modu@@ -119,3 +117,10 @@ -> (Module -> IO a) -> IO () withModule_ dir file flags p = withModule dir file flags p >>= \ _ -> return ()++-- Dual to 'Data.List.uncons'.+unsnoc :: [a] -> Maybe ([a], a)+unsnoc = foldr go Nothing+ where+ go x Nothing = Just ([], x)+ go x (Just (xs, lst)) = Just (x : xs, lst)
System/Posix/DynamicLinker/Module/ByteString.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- |
System/Posix/DynamicLinker/Prim.hsc view
@@ -1,7 +1,6 @@+{-# LANGUAGE CApiFFI #-} {-# LANGUAGE Trustworthy #-}-#if __GLASGOW_HASKELL__ >= 709-{-# OPTIONS_GHC -fno-warn-trustworthy-safe #-}-#endif+{-# OPTIONS_GHC -Wno-trustworthy-safe #-} ----------------------------------------------------------------------------- -- |@@ -43,11 +42,16 @@ import Foreign.C.Types import Foreign.C.String ( CString ) +#if !defined(HAVE_DLFCN_H)+import Control.Exception ( throw )+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif -- |On some hosts (e.g. SuSe and Ubuntu Linux) @RTLD_NEXT@ (and -- @RTLD_DEFAULT@) are not visible without setting the macro -- @_GNU_SOURCE@. Since we don\'t want to define this macro, you can use--- the function 'haveRtldNext' to check wether the flag `Next` is+-- the function 'haveRtldNext' to check whether the flag `Next` is -- available. Ideally, this will be optimized by the compiler so that it -- should be as efficient as an @#ifdef@. --@@ -81,20 +85,36 @@ | RTLD_LOCAL deriving (Show, Read) -foreign import ccall unsafe "dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())+#if defined(HAVE_DLFCN_H)+foreign import capi safe "dlfcn.h dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())+foreign import capi unsafe "dlfcn.h dlsym" c_dlsym :: Ptr () -> CString -> IO (FunPtr a)+foreign import capi unsafe "dlfcn.h dlerror" c_dlerror :: IO CString+foreign import capi safe "dlfcn.h dlclose" c_dlclose :: (Ptr ()) -> IO CInt+#else+foreign import ccall safe "dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ()) foreign import ccall unsafe "dlsym" c_dlsym :: Ptr () -> CString -> IO (FunPtr a) foreign import ccall unsafe "dlerror" c_dlerror :: IO CString-foreign import ccall unsafe "dlclose" c_dlclose :: (Ptr ()) -> IO CInt+foreign import ccall safe "dlclose" c_dlclose :: (Ptr ()) -> IO CInt+#endif // HAVE_DLFCN_H packRTLDFlags :: [RTLDFlags] -> CInt packRTLDFlags flags = foldl (\ s f -> (packRTLDFlag f) .|. s) 0 flags packRTLDFlag :: RTLDFlags -> CInt+#if defined(HAVE_DLFCN_H)+ packRTLDFlag RTLD_LAZY = #const RTLD_LAZY packRTLDFlag RTLD_NOW = #const RTLD_NOW packRTLDFlag RTLD_GLOBAL = #const RTLD_GLOBAL packRTLDFlag RTLD_LOCAL = #const RTLD_LOCAL +#else++{-# WARNING packRTLDFlag+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_DLFCN_H@)" #-}+packRTLDFlag _ = throw (ioeSetLocation unsupportedOperation "packRTLDFlag")++#endif // HAVE_DLFCN_H -- |Flags for 'System.Posix.DynamicLinker.dlsym'. Notice that 'Next' -- might not be available on your particular platform! Use
System/Posix/Env.hsc view
@@ -1,9 +1,5 @@ {-# LANGUAGE CApiFFI #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Env@@ -32,21 +28,15 @@ #include "HsUnix.h" +import Foreign hiding (void) import Foreign.C.Error (throwErrnoIfMinus1_) import Foreign.C.Types import Foreign.C.String-import Foreign.Marshal.Array-import Foreign.Ptr-import Foreign.Storable import Control.Monad import Data.Maybe (fromMaybe) import System.Posix.Internals -#if !MIN_VERSION_base(4,7,0)--- needed for backported local 'newFilePath' binding in 'putEnv'-import GHC.IO.Encoding (getFileSystemEncoding)-import qualified GHC.Foreign as GHC (newCString)-#endif+import qualified System.Posix.Env.Internal as Internal -- |'getEnv' looks up a variable in the environment. @@ -56,7 +46,7 @@ getEnv name = do litstring <- withFilePath name c_getenv if litstring /= nullPtr- then liftM Just $ peekFilePath litstring+ then Just <$> peekFilePath litstring else return Nothing -- |'getEnvDefault' is a wrapper around 'getEnv' where the@@ -67,34 +57,13 @@ String {- ^ variable name -} -> String {- ^ fallback value -} -> IO String {- ^ variable value or fallback value -}-getEnvDefault name fallback = liftM (fromMaybe fallback) (getEnv name)+getEnvDefault name fallback = fromMaybe fallback <$> getEnv name foreign import ccall unsafe "getenv" c_getenv :: CString -> IO CString getEnvironmentPrim :: IO [String]-getEnvironmentPrim = do- c_environ <- getCEnviron- -- environ can be NULL- if c_environ == nullPtr- then return []- else do- arr <- peekArray0 nullPtr c_environ- mapM peekFilePath arr--getCEnviron :: IO (Ptr CString)-#if HAVE__NSGETENVIRON--- You should not access @char **environ@ directly on Darwin in a bundle/shared library.--- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html-getCEnviron = nsGetEnviron >>= peek--foreign import ccall unsafe "_NSGetEnviron"- nsGetEnviron :: IO (Ptr (Ptr CString))-#else-getCEnviron = peek c_environ_p-foreign import ccall unsafe "&environ"- c_environ_p :: Ptr (Ptr CString)-#endif+getEnvironmentPrim = Internal.getEnvironmentPrim >>= mapM peekFilePath -- |'getEnvironment' retrieves the entire environment as a -- list of @(key,value)@ pairs.@@ -150,11 +119,6 @@ -- According to SUSv2, the string passed to putenv -- becomes part of the environment. #7342 throwErrnoIfMinus1_ "putenv" (c_putenv s)-#if !MIN_VERSION_base(4,7,0)- where- newFilePath :: FilePath -> IO CString- newFilePath fp = getFileSystemEncoding >>= \enc -> GHC.newCString enc fp-#endif foreign import ccall unsafe "putenv" c_putenv :: CString -> IO CInt@@ -199,7 +163,7 @@ #else -- Fallback to 'environ[0] = NULL'. clearEnv = do- c_environ <- getCEnviron+ c_environ <- Internal.getCEnviron unless (c_environ == nullPtr) $ poke c_environ nullPtr #endif
System/Posix/Env/ByteString.hsc view
@@ -42,8 +42,10 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as BC import Data.ByteString (ByteString)-import Data.ByteString.Internal (ByteString (PS), memcpy)+import Data.ByteString.Internal (ByteString (PS)) +import qualified System.Posix.Env.Internal as Internal+ -- |'getEnv' looks up a variable in the environment. getEnv ::@@ -52,7 +54,7 @@ getEnv name = do litstring <- B.useAsCString name c_getenv if litstring /= nullPtr- then liftM Just $ B.packCString litstring+ then Just <$> B.packCString litstring else return Nothing -- |'getEnvDefault' is a wrapper around 'getEnv' where the@@ -63,31 +65,13 @@ ByteString {- ^ variable name -} -> ByteString {- ^ fallback value -} -> IO ByteString {- ^ variable value or fallback value -}-getEnvDefault name fallback = liftM (fromMaybe fallback) (getEnv name)+getEnvDefault name fallback = fromMaybe fallback <$> getEnv name foreign import ccall unsafe "getenv" c_getenv :: CString -> IO CString getEnvironmentPrim :: IO [ByteString]-getEnvironmentPrim = do- c_environ <- getCEnviron- arr <- peekArray0 nullPtr c_environ- mapM B.packCString arr--getCEnviron :: IO (Ptr CString)-#if HAVE__NSGETENVIRON--- You should not access @char **environ@ directly on Darwin in a bundle/shared library.--- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html-getCEnviron = nsGetEnviron >>= peek--foreign import ccall unsafe "_NSGetEnviron"- nsGetEnviron :: IO (Ptr (Ptr CString))-#else-getCEnviron = peek c_environ_p--foreign import ccall unsafe "&environ"- c_environ_p :: Ptr (Ptr CString)-#endif+getEnvironmentPrim = Internal.getEnvironmentPrim >>= mapM B.packCString -- |'getEnvironment' retrieves the entire environment as a -- list of @(key,value)@ pairs.@@ -104,7 +88,7 @@ -- |'setEnvironment' resets the entire environment to the given list of -- @(key,value)@ pairs. ----- @since 2.7.3+-- @since 2.8.0.0 setEnvironment :: [(ByteString,ByteString)] {- ^ @[(key,value)]@ -} -> IO ()@@ -149,7 +133,7 @@ -- -- hence we must not free the buffer buf <- mallocBytes (l+1)- memcpy buf (p `plusPtr` o) l+ copyBytes buf (p `plusPtr` o) l pokeByteOff buf l (0::Word8) throwErrnoIfMinus1_ "putenv" (c_putenv (castPtr buf)) @@ -199,7 +183,7 @@ alloca $ \ p_argc -> alloca $ \ p_argv -> do getProgArgv p_argc p_argv- p <- fromIntegral `liftM` peek p_argc+ p <- fromIntegral <$> peek p_argc argv <- peek p_argv peekArray (p - 1) (advancePtr argv 1) >>= mapM B.packCString
+ System/Posix/Env/Internal.hsc view
@@ -0,0 +1,32 @@+module System.Posix.Env.Internal where++#include "HsUnix.h"++import Foreign+import Foreign.C++getEnvironmentPrim :: IO [Ptr CChar]+getEnvironmentPrim = do+ c_environ <- getCEnviron+ if c_environ == nullPtr+ then return []+ else do+ peekArray0 nullPtr c_environ++getCEnviron :: IO (Ptr CString)+#if HAVE__NSGETENVIRON+-- You should not access @char **environ@ directly on Darwin in a bundle/shared library.+-- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html+getCEnviron = nsGetEnviron >>= peek++foreign import ccall unsafe "_NSGetEnviron"+ nsGetEnviron :: IO (Ptr (Ptr CString))+#else+getCEnviron = _getCEnviron++-- N.B. we cannot import `environ` directly in Haskell as it may be a weak symbol+-- which requires special treatment by the compiler, which GHC is not equipped to+-- provide. See GHC #24011.+foreign import ccall unsafe "__hsunix_get_environ"+ _getCEnviron :: IO (Ptr CString)+#endif
+ System/Posix/Env/PosixString.hsc view
@@ -0,0 +1,195 @@+{-# LANGUAGE CApiFFI #-}+{-# LANGUAGE PackageImports #-}++-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.Env.PosixString+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- POSIX environment support+--+-----------------------------------------------------------------------------++module System.Posix.Env.PosixString (+ -- * Environment Variables+ getEnv+ , getEnvDefault+ , getEnvironmentPrim+ , getEnvironment+ , setEnvironment+ , putEnv+ , setEnv+ , unsetEnv+ , clearEnv++ -- * Program arguments+ , getArgs+) where++#include "HsUnix.h"++import Control.Monad+import Foreign+import Foreign.C+import Data.Maybe ( fromMaybe )++import GHC.IO.Encoding.UTF8 ( mkUTF8 )+import GHC.IO.Encoding.Failure ( CodingFailureMode(..) )+import System.Posix.Env ( clearEnv )+import System.OsPath.Posix+import System.OsString.Internal.Types+#if MIN_VERSION_filepath(1, 5, 0)+import qualified "os-string" System.OsString.Data.ByteString.Short as B+#else+import qualified "filepath" System.OsPath.Data.ByteString.Short as B+#endif+import Data.ByteString.Short.Internal ( copyToPtr )++import qualified System.Posix.Env.Internal as Internal++-- |'getEnv' looks up a variable in the environment.++getEnv ::+ PosixString {- ^ variable name -} ->+ IO (Maybe PosixString) {- ^ variable value -}+getEnv (PS name) = do+ litstring <- B.useAsCString name c_getenv+ if litstring /= nullPtr+ then (Just . PS) <$> B.packCString litstring+ else return Nothing++-- |'getEnvDefault' is a wrapper around 'getEnv' where the+-- programmer can specify a fallback as the second argument, which will be+-- used if the variable is not found in the environment.++getEnvDefault ::+ PosixString {- ^ variable name -} ->+ PosixString {- ^ fallback value -} ->+ IO PosixString {- ^ variable value or fallback value -}+getEnvDefault name fallback = fromMaybe fallback <$> getEnv name++foreign import ccall unsafe "getenv"+ c_getenv :: CString -> IO CString++getEnvironmentPrim :: IO [PosixString]+getEnvironmentPrim = Internal.getEnvironmentPrim >>= mapM (fmap PS . B.packCString)++-- |'getEnvironment' retrieves the entire environment as a+-- list of @(key,value)@ pairs.++getEnvironment :: IO [(PosixString,PosixString)] {- ^ @[(key,value)]@ -}+getEnvironment = do+ env <- getEnvironmentPrim+ return $ map (dropEq . (B.break ((==) _equal)) . getPosixString) env+ where+ dropEq (x,y)+ | B.head y == _equal = (PS x, PS (B.tail y))+ | otherwise = error $ "getEnvironment: insane variable " ++ _toStr x++-- |'setEnvironment' resets the entire environment to the given list of+-- @(key,value)@ pairs.+setEnvironment ::+ [(PosixString,PosixString)] {- ^ @[(key,value)]@ -} ->+ IO ()+setEnvironment env = do+ clearEnv+ forM_ env $ \(key,value) ->+ setEnv key value True {-overwrite-}++-- |The 'unsetEnv' function deletes all instances of the variable name+-- from the environment.++unsetEnv :: PosixString {- ^ variable name -} -> IO ()+#if HAVE_UNSETENV+# if !UNSETENV_RETURNS_VOID+unsetEnv (PS name) = B.useAsCString name $ \ s ->+ throwErrnoIfMinus1_ "unsetenv" (c_unsetenv s)++-- POSIX.1-2001 compliant unsetenv(3)+foreign import capi unsafe "HsUnix.h unsetenv"+ c_unsetenv :: CString -> IO CInt+# else+unsetEnv name = B.useAsCString name c_unsetenv++-- pre-POSIX unsetenv(3) returning @void@+foreign import capi unsafe "HsUnix.h unsetenv"+ c_unsetenv :: CString -> IO ()+# endif+#else+unsetEnv name = putEnv (name <> PosixString (B.pack "="))+#endif++-- |'putEnv' function takes an argument of the form @name=value@+-- and is equivalent to @setEnv(key,value,True{-overwrite-})@.+putEnv :: PosixString {- ^ "key=value" -} -> IO ()+putEnv (PS sbs) = do+ buf <- mallocBytes (l+1)+ copyToPtr sbs 0 buf (fromIntegral l)+ pokeByteOff buf l (0::Word8)+ throwErrnoIfMinus1_ "putenv" (c_putenv buf)+ where l = B.length sbs+++foreign import ccall unsafe "putenv"+ c_putenv :: CString -> IO CInt++{- |The 'setEnv' function inserts or resets the environment variable name in+ the current environment list. If the variable @name@ does not exist in the+ list, it is inserted with the given value. If the variable does exist,+ the argument @overwrite@ is tested; if @overwrite@ is @False@, the variable is+ not reset, otherwise it is reset to the given value.+-}++setEnv ::+ PosixString {- ^ variable name -} ->+ PosixString {- ^ variable value -} ->+ Bool {- ^ overwrite -} ->+ IO ()+#ifdef HAVE_SETENV+setEnv (PS key) (PS value) ovrwrt = do+ B.useAsCString key $ \ keyP ->+ B.useAsCString value $ \ valueP ->+ throwErrnoIfMinus1_ "setenv" $+ c_setenv keyP valueP (fromIntegral (fromEnum ovrwrt))++foreign import ccall unsafe "setenv"+ c_setenv :: CString -> CString -> CInt -> IO CInt+#else+setEnv key value True = putEnv (key++"="++value)+setEnv key value False = do+ res <- getEnv key+ case res of+ Just _ -> return ()+ Nothing -> putEnv (key++"="++value)+#endif++-- | Computation 'getArgs' returns a list of the program's command+-- line arguments (not including the program name), as 'PosixString's.+--+-- Unlike 'System.Environment.getArgs', this function does no Unicode+-- decoding of the arguments; you get the exact bytes that were passed+-- to the program by the OS. To interpret the arguments as text, some+-- Unicode decoding should be applied.+--+getArgs :: IO [PosixString]+getArgs =+ alloca $ \ p_argc ->+ alloca $ \ p_argv -> do+ getProgArgv p_argc p_argv+ p <- fromIntegral <$> peek p_argc+ argv <- peek p_argv+ peekArray (p - 1) (advancePtr argv 1) >>= mapM (fmap PS . B.packCString)++foreign import ccall unsafe "getProgArgv"+ getProgArgv :: Ptr CInt -> Ptr (Ptr CString) -> IO ()++_equal :: Word8+_equal = 0x3d++_toStr :: B.ShortByteString -> String+_toStr = either (error . show) id . decodeWith (mkUTF8 TransliterateCodingFailure) . PosixString
System/Posix/Error.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Error
System/Posix/Fcntl.hsc view
@@ -1,9 +1,5 @@ {-# LANGUAGE CApiFFI #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Fcntl@@ -20,23 +16,34 @@ ----------------------------------------------------------------------------- #include "HsUnix.h"+#include <fcntl.h> module System.Posix.Fcntl ( -- * File allocation Advice(..), fileAdvise, fileAllocate,+ -- * File caching+ fileGetCaching,+ fileSetCaching, ) where -#if HAVE_POSIX_FALLOCATE || HAVE_POSIX_FADVISE import Foreign.C-#endif import System.Posix.Types -#if !HAVE_POSIX_FALLOCATE+#if !HAVE_POSIX_FALLOCATE || !HAVE_O_DIRECT import System.IO.Error ( ioeSetLocation ) import GHC.IO.Exception ( unsupportedOperation ) #endif +#if HAVE_O_DIRECT+import Data.Bits (complement, (.&.), (.|.))+import System.Posix.Internals (c_fcntl_read)+#endif++#if HAVE_O_DIRECT || HAVE_F_NOCACHE+import System.Posix.Internals (c_fcntl_write)+#endif+ -- ----------------------------------------------------------------------------- -- File control @@ -104,4 +111,72 @@ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_POSIX_FALLOCATE@)" #-} fileAllocate _ _ _ = ioError (ioeSetLocation unsupportedOperation "fileAllocate")+#endif++-- -----------------------------------------------------------------------------+-- File caching++-- | Performs the @fcntl(2)@ operation on a file-desciptor to get the cache mode.+--+-- If the cache mode is 'False', then cache effects for file system reads and+-- writes are minimised or otherwise eliminated. If the cache mode is 'True',+-- then cache effects occur like normal.+--+-- On Linux, FreeBSD, and NetBSD this checks whether the @O_DIRECT@ file flag is+-- set.+--+-- Throws 'IOError' (\"unsupported operation\") if platform does not support+-- getting the cache mode.+--+-- Use @#if HAVE_O_DIRECT@ CPP guard to detect availability. Use @#include+-- "HsUnix.h"@ to bring @HAVE_O_DIRECT@ into scope.+--+-- @since 2.8.7.0+fileGetCaching :: Fd -> IO Bool+#if HAVE_O_DIRECT+fileGetCaching (Fd fd) = do+ r <- throwErrnoIfMinus1 "fileGetCaching" (c_fcntl_read fd #{const F_GETFL})+ return ((r .&. opt_val) == 0)+ where+ opt_val = #{const O_DIRECT}+#else+{-# WARNING fileGetCaching+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_O_DIRECT@)" #-}+fileGetCaching _ = ioError (ioeSetLocation unsupportedOperation "fileGetCaching")+#endif++-- | Performs the @fcntl(2)@ operation on a file-desciptor to set the cache+-- mode.+--+-- If the cache mode is 'False', then cache effects for file system reads and+-- writes are minimised or otherwise eliminated. If the cache mode is 'True',+-- then cache effects occur like normal.+--+-- On Linux, FreeBSD, and NetBSD this sets the @O_DIRECT@ file flag. On OSX,+-- this sets the @F_NOCACHE@ @fcntl@ flag.+--+-- Throws 'IOError' (\"unsupported operation\") if platform does not support+-- setting the cache mode.+--+-- Use @#if HAVE_O_DIRECT || HAVE_F_NOCACHE@ CPP guard to detect availability.+-- Use @#include "HsUnix.h"@ to bring @HAVE_O_DIRECT@ and @HAVE_F_NOCACHE@ into+-- scope.+--+-- @since 2.8.7.0+fileSetCaching :: Fd -> Bool -> IO ()+#if HAVE_O_DIRECT+fileSetCaching (Fd fd) val = do+ r <- throwErrnoIfMinus1 "fileSetCaching" (c_fcntl_read fd #{const F_GETFL})+ let r' | val = fromIntegral r .&. complement opt_val+ | otherwise = fromIntegral r .|. opt_val+ throwErrnoIfMinus1_ "fileSetCaching" (c_fcntl_write fd #{const F_SETFL} r')+ where+ opt_val = #{const O_DIRECT}+#elif HAVE_F_NOCACHE+fileSetCaching (Fd fd) val = do+ throwErrnoIfMinus1_ "fileSetCaching" (c_fcntl_write fd #{const F_NOCACHE} (if val then 0 else 1))+#else+{-# WARNING fileSetCaching+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_O_DIRECT || HAVE_F_NOCACHE @)" #-}+fileSetCaching _ _ = ioError (ioeSetLocation unsupportedOperation "fileSetCaching") #endif
System/Posix/Files.hsc view
@@ -1,9 +1,6 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif {-# LANGUAGE CApiFFI #-}+{-# LANGUAGE PatternSynonyms #-} ----------------------------------------------------------------------------- -- |@@ -52,7 +49,7 @@ fileAccess, fileExist, -- * File status- FileStatus,+ FileStatus(..), -- ** Obtaining file status getFileStatus, getFdStatus, getSymbolicLinkStatus, -- ** Querying file status@@ -63,6 +60,73 @@ isBlockDevice, isCharacterDevice, isNamedPipe, isRegularFile, isDirectory, isSymbolicLink, isSocket, + fileBlockSize,+ fileBlocks,++ -- * Extended file status+ ExtendedFileStatus(..),+ CAttributes(..),+ haveStatx,+ -- ** Obtaining extended file status+ getExtendedFileStatus,+ -- ** Flags+ StatxFlags(..),+ defaultStatxFlags,+ pattern EmptyPath,+ pattern NoAutoMount,+ pattern SymlinkNoFollow,+ pattern SyncAsStat,+ pattern ForceSync,+ pattern DontSync,+ -- ** Mask+ StatxMask(..),+ defaultStatxMask,+ pattern StatxType,+ pattern StatxMode,+ pattern StatxNlink,+ pattern StatxUid,+ pattern StatxGid,+ pattern StatxAtime,+ pattern StatxMtime,+ pattern StatxCtime,+ pattern StatxIno,+ pattern StatxSize,+ pattern StatxBlocks,+ pattern StatxBasicStats,+ pattern StatxBtime,+ pattern StatxMntId,+ pattern StatxAll,+ -- ** Querying extended file status+ fileBlockSizeX,+ linkCountX,+ fileOwnerX,+ fileGroupX,+ fileModeX,+ fileIDX,+ fileSizeX,+ fileBlocksX,+ accessTimeHiResX,+ creationTimeHiResX,+ statusChangeTimeHiResX,+ modificationTimeHiResX,+ deviceIDX,+ specialDeviceIDX,+ mountIDX,+ fileCompressedX,+ fileImmutableX,+ fileAppendX,+ fileNoDumpX,+ fileEncryptedX,+ fileVerityX,+ fileDaxX,+ isBlockDeviceX,+ isCharacterDeviceX,+ isNamedPipeX,+ isRegularFileX,+ isDirectoryX,+ isSymbolicLinkX,+ isSocketX,+ -- * Creation createNamedPipe, createDevice,@@ -103,8 +167,24 @@ import System.Posix.Error import System.Posix.Internals +#if !MIN_VERSION_base(4, 11, 0)+import Data.Monoid ((<>))+#endif+ import Data.Time.Clock.POSIX (POSIXTime) +#if !defined(HAVE_MKNOD) || !defined(HAVE_CHOWN)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif++-- throwErrnoTwoPathsIfMinus1_+--+-- | For operations that require two paths (e.g., renaming a file)+throwErrnoTwoPathsIfMinus1_ :: (Eq a, Num a) => String -> FilePath -> FilePath -> IO a -> IO ()+throwErrnoTwoPathsIfMinus1_ loc path1 path2 =+ throwErrnoIfMinus1_ (loc <> " '" <> path1 <> "' to '" <> path2 <> "'")+ -- ----------------------------------------------------------------------------- -- chmod() @@ -174,6 +254,25 @@ throwErrnoPathIfMinus1Retry_ "getFileStatus" path (c_stat s p) return (FileStatus fp) +-- | Gets extended file status information.+--+-- The target file to open is identified in one of the following ways:+--+-- - If @pathname@ begins with a slash, then it is an absolute pathname that identifies the target file. In this case, @dirfd@ is ignored+-- - If @pathname@ is a string that begins with a character other than a slash and @dirfd@ is a file descriptor that refers to a+-- directory, then pathname is a relative pathname that is interpreted relative to the directory referred to by dirfd.+-- (See @openat(2)@ for an explanation of why this is useful.)+-- - If @pathname@ is an empty string and the 'EmptyPath' flag is specified in flags (see below), then the target file is+-- the one referred to by the file descriptor @dirfd@.+--+-- Note: calls @statx@.+getExtendedFileStatus :: Maybe Fd -- ^ Optional directory file descriptor (@dirfd@)+ -> FilePath -- ^ @pathname@ to open+ -> StatxFlags -- ^ flags+ -> StatxMask -- ^ mask+ -> IO ExtendedFileStatus+getExtendedFileStatus mfd path flags masks = withFilePath path $ \s -> getExtendedFileStatus_ mfd s flags masks+ -- | Acts as 'getFileStatus' except when the 'FilePath' refers to a symbolic -- link. In that case the @FileStatus@ information of the symbolic link itself -- is returned instead of that of the file it points to.@@ -202,6 +301,13 @@ withFilePath name $ \s -> throwErrnoPathIfMinus1_ "createNamedPipe" name (c_mkfifo s mode) +#if !defined(HAVE_MKNOD)++{-# WARNING createDevice "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_MKNOD@)" #-}+createDevice :: FilePath -> FileMode -> DeviceID -> IO ()+createDevice _ _ _ = ioError (ioeSetLocation unsupportedOperation "createDevice")++#else -- | @createDevice path mode dev@ creates either a regular or a special file -- depending on the value of @mode@ (and @dev@). @mode@ will normally be either -- 'blockSpecialMode' or 'characterSpecialMode'. May fail with@@ -218,6 +324,8 @@ foreign import capi unsafe "HsUnix.h mknod" c_mknod :: CString -> CMode -> CDev -> IO CInt +#endif // HAVE_MKNOD+ -- ----------------------------------------------------------------------------- -- Hard links @@ -229,7 +337,7 @@ createLink name1 name2 = withFilePath name1 $ \s1 -> withFilePath name2 $ \s2 ->- throwErrnoPathIfMinus1_ "createLink" name1 (c_link s1 s2)+ throwErrnoTwoPathsIfMinus1_ "createLink" name1 name2 (c_link s1 s2) -- | @removeLink path@ removes the link named @path@. --@@ -242,18 +350,18 @@ -- ----------------------------------------------------------------------------- -- Symbolic Links --- | @createSymbolicLink file1 file2@ creates a symbolic link named @file2@--- which points to the file @file1@.+-- | @createSymbolicLink name1 name2@ creates a symbolic link named @name2@+-- which points to the file @name1@. -- -- Symbolic links are interpreted at run-time as if the contents of the link -- had been substituted into the path being followed to find a file or directory. -- -- Note: calls @symlink@. createSymbolicLink :: FilePath -> FilePath -> IO ()-createSymbolicLink file1 file2 =- withFilePath file1 $ \s1 ->- withFilePath file2 $ \s2 ->- throwErrnoPathIfMinus1_ "createSymbolicLink" file2 (c_symlink s1 s2)+createSymbolicLink name1 name2 =+ withFilePath name1 $ \s1 ->+ withFilePath name2 $ \s2 ->+ throwErrnoTwoPathsIfMinus1_ "createSymbolicLink" name1 name2 (c_symlink s1 s2) foreign import ccall unsafe "symlink" c_symlink :: CString -> CString -> IO CInt@@ -291,7 +399,7 @@ rename name1 name2 = withFilePath name1 $ \s1 -> withFilePath name2 $ \s2 ->- throwErrnoPathIfMinus1_ "rename" name1 (c_rename s1 s2)+ throwErrnoTwoPathsIfMinus1_ "rename" name1 name2 (c_rename s1 s2) foreign import ccall unsafe "rename" c_rename :: CString -> CString -> IO CInt@@ -299,6 +407,8 @@ -- ----------------------------------------------------------------------------- -- chown() +#if defined(HAVE_CHOWN)+ -- | @setOwnerAndGroup path uid gid@ changes the owner and group of @path@ to -- @uid@ and @gid@, respectively. --@@ -313,6 +423,14 @@ foreign import ccall unsafe "chown" c_chown :: CString -> CUid -> CGid -> IO CInt +#else++{-# WARNING setOwnerAndGroup "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_CHOWN@)" #-}+setOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO ()+setOwnerAndGroup _ _ _ = ioError (ioeSetLocation unsupportedOperation "setOwnerAndGroup")++#endif // HAVE_CHOWN+ #if HAVE_LCHOWN -- | Acts as 'setOwnerAndGroup' but does not follow symlinks (and thus -- changes permissions on the link itself).@@ -345,13 +463,21 @@ -- | Like 'setFileTimes' but timestamps can have sub-second resolution. ----- Note: calls @utimensat@ or @utimes@.+-- Note: calls @utimensat@ or @utimes@. Support for high resolution timestamps+-- is filesystem dependent with the following limitations: --+-- - HFS+ volumes on OS X truncate the sub-second part of the timestamp.+-- -- @since 2.7.0.0 setFileTimesHiRes :: FilePath -> POSIXTime -> POSIXTime -> IO ()-#ifdef HAVE_UTIMENSAT+#if defined(javascript_HOST_ARCH) setFileTimesHiRes name atime mtime = withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "setFileTimesHiRes" name+ (js_utimes s (realToFrac atime) (realToFrac mtime))+#elif defined(HAVE_UTIMENSAT)+setFileTimesHiRes name atime mtime =+ withFilePath name $ \s -> withArray [toCTimeSpec atime, toCTimeSpec mtime] $ \times -> throwErrnoPathIfMinus1_ "setFileTimesHiRes" name $ c_utimensat (#const AT_FDCWD) s times 0@@ -366,13 +492,21 @@ -- This operation is not supported on all platforms. On these platforms, -- this function will raise an exception. ----- Note: calls @utimensat@ or @lutimes@.+-- Note: calls @utimensat@ or @lutimes@. Support for high resolution timestamps+-- is filesystem dependent with the following limitations: --+-- - HFS+ volumes on OS X truncate the sub-second part of the timestamp.+-- -- @since 2.7.0.0 setSymbolicLinkTimesHiRes :: FilePath -> POSIXTime -> POSIXTime -> IO ()-#if HAVE_UTIMENSAT+#if defined(javascript_HOST_ARCH) setSymbolicLinkTimesHiRes name atime mtime = withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "setSymbolicLinkTimesHiRes" name $+ js_lutimes s (realToFrac atime) (realToFrac mtime)+#elif HAVE_UTIMENSAT+setSymbolicLinkTimesHiRes name atime mtime =+ withFilePath name $ \s -> withArray [toCTimeSpec atime, toCTimeSpec mtime] $ \times -> throwErrnoPathIfMinus1_ "setSymbolicLinkTimesHiRes" name $ c_utimensat (#const AT_FDCWD) s times (#const AT_SYMLINK_NOFOLLOW)@@ -383,6 +517,9 @@ throwErrnoPathIfMinus1_ "setSymbolicLinkTimesHiRes" name $ c_lutimes s times #else+{-# WARNING setSymbolicLinkTimesHiRes+ "System.Posix.Files.setSymbolicLinkTImesHiRes: not available on this platform"+ #-} setSymbolicLinkTimesHiRes = error "setSymbolicLinkTimesHiRes: not available on this platform" #endif@@ -404,11 +541,18 @@ -- -- @since 2.7.0.0 touchSymbolicLink :: FilePath -> IO ()-#if HAVE_LUTIMES+#if defined(javascript_HOST_ARCH) touchSymbolicLink name = withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "touchSymbolicLink" name (js_lutimes s (-1) (-1))+#elif HAVE_LUTIMES+touchSymbolicLink name =+ withFilePath name $ \s -> throwErrnoPathIfMinus1_ "touchSymbolicLink" name (c_lutimes s nullPtr) #else+{-#+ WARNING touchSymbolicLink "System.Posix.Files.touchSymbolicLink: not available on this platform"+ #-} touchSymbolicLink = error "touchSymbolicLink: not available on this platform" #endif
System/Posix/Files/ByteString.hsc view
@@ -1,9 +1,6 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif {-# LANGUAGE CApiFFI #-}+{-# LANGUAGE PatternSynonyms #-} ----------------------------------------------------------------------------- -- |@@ -63,6 +60,73 @@ isBlockDevice, isCharacterDevice, isNamedPipe, isRegularFile, isDirectory, isSymbolicLink, isSocket, + fileBlockSize,+ fileBlocks,++ -- * Extended file status+ ExtendedFileStatus(..),+ CAttributes(..),+ haveStatx,+ -- ** Obtaining extended file status+ getExtendedFileStatus,+ -- ** Flags+ StatxFlags(..),+ defaultStatxFlags,+ pattern EmptyPath,+ pattern NoAutoMount,+ pattern SymlinkNoFollow,+ pattern SyncAsStat,+ pattern ForceSync,+ pattern DontSync,+ -- ** Mask+ StatxMask(..),+ defaultStatxMask,+ pattern StatxType,+ pattern StatxMode,+ pattern StatxNlink,+ pattern StatxUid,+ pattern StatxGid,+ pattern StatxAtime,+ pattern StatxMtime,+ pattern StatxCtime,+ pattern StatxIno,+ pattern StatxSize,+ pattern StatxBlocks,+ pattern StatxBasicStats,+ pattern StatxBtime,+ pattern StatxMntId,+ pattern StatxAll,+ -- ** Querying extended file status+ fileBlockSizeX,+ linkCountX,+ fileOwnerX,+ fileGroupX,+ fileModeX,+ fileIDX,+ fileSizeX,+ fileBlocksX,+ accessTimeHiResX,+ creationTimeHiResX,+ statusChangeTimeHiResX,+ modificationTimeHiResX,+ deviceIDX,+ specialDeviceIDX,+ mountIDX,+ fileCompressedX,+ fileImmutableX,+ fileAppendX,+ fileNoDumpX,+ fileEncryptedX,+ fileVerityX,+ fileDaxX,+ isBlockDeviceX,+ isCharacterDeviceX,+ isNamedPipeX,+ isRegularFileX,+ isDirectoryX,+ isSymbolicLinkX,+ isSocketX,+ -- * Creation createNamedPipe, createDevice,@@ -110,6 +174,11 @@ import Data.Time.Clock.POSIX (POSIXTime) +#if !defined(HAVE_MKNOD) || !defined(HAVE_CHOWN)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif+ -- ----------------------------------------------------------------------------- -- chmod() @@ -180,6 +249,25 @@ throwErrnoPathIfMinus1Retry_ "getFileStatus" path (c_stat s p) return (FileStatus fp) +-- | Gets extended file status information.+--+-- The target file to open is identified in one of the following ways:+--+-- - If @pathname@ begins with a slash, then it is an absolute pathname that identifies the target file. In this case, @dirfd@ is ignored+-- - If @pathname@ is a string that begins with a character other than a slash and @dirfd@ is a file descriptor that refers to a+-- directory, then pathname is a relative pathname that is interpreted relative to the directory referred to by dirfd.+-- (See @openat(2)@ for an explanation of why this is useful.)+-- - If @pathname@ is an empty string and the 'EmptyPath' flag is specified in flags (see below), then the target file is+-- the one referred to by the file descriptor @dirfd@.+--+-- Note: calls @statx@.+getExtendedFileStatus :: Maybe Fd -- ^ Optional directory file descriptor (@dirfd@)+ -> RawFilePath -- ^ @pathname@ to open+ -> StatxFlags -- ^ flags+ -> StatxMask -- ^ mask+ -> IO ExtendedFileStatus+getExtendedFileStatus mfd path flags masks = withFilePath path $ \s -> getExtendedFileStatus_ mfd s flags masks+ -- | Acts as 'getFileStatus' except when the 'RawFilePath' refers to a symbolic -- link. In that case the @FileStatus@ information of the symbolic link itself -- is returned instead of that of the file it points to.@@ -208,6 +296,14 @@ withFilePath name $ \s -> throwErrnoPathIfMinus1_ "createNamedPipe" name (c_mkfifo s mode) +#if !defined(HAVE_MKNOD)++{-# WARNING createDevice "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_MKNOD@)" #-}+createDevice :: RawFilePath -> FileMode -> DeviceID -> IO ()+createDevice _ _ _ = ioError (ioeSetLocation unsupportedOperation "createDevice")++#else+ -- | @createDevice path mode dev@ creates either a regular or a special file -- depending on the value of @mode@ (and @dev@). @mode@ will normally be either -- 'blockSpecialMode' or 'characterSpecialMode'. May fail with@@ -224,6 +320,8 @@ foreign import capi unsafe "HsUnix.h mknod" c_mknod :: CString -> CMode -> CDev -> IO CInt +#endif // HAVE_MKNOD+ -- ----------------------------------------------------------------------------- -- Hard links @@ -235,7 +333,7 @@ createLink name1 name2 = withFilePath name1 $ \s1 -> withFilePath name2 $ \s2 ->- throwErrnoPathIfMinus1_ "createLink" name1 (c_link s1 s2)+ throwErrnoTwoPathsIfMinus1_ "createLink" name1 name2 (c_link s1 s2) -- | @removeLink path@ removes the link named @path@. --@@ -256,10 +354,10 @@ -- -- Note: calls @symlink@. createSymbolicLink :: RawFilePath -> RawFilePath -> IO ()-createSymbolicLink file1 file2 =- withFilePath file1 $ \s1 ->- withFilePath file2 $ \s2 ->- throwErrnoPathIfMinus1_ "createSymbolicLink" file2 (c_symlink s1 s2)+createSymbolicLink name1 name2 =+ withFilePath name1 $ \s1 ->+ withFilePath name2 $ \s2 ->+ throwErrnoTwoPathsIfMinus1_ "createSymbolicLink" name1 name2 (c_symlink s1 s2) foreign import ccall unsafe "symlink" c_symlink :: CString -> CString -> IO CInt@@ -297,7 +395,7 @@ rename name1 name2 = withFilePath name1 $ \s1 -> withFilePath name2 $ \s2 ->- throwErrnoPathIfMinus1_ "rename" name1 (c_rename s1 s2)+ throwErrnoTwoPathsIfMinus1_ "rename" name1 name2 (c_rename s1 s2) foreign import ccall unsafe "rename" c_rename :: CString -> CString -> IO CInt@@ -305,6 +403,8 @@ -- ----------------------------------------------------------------------------- -- chown() +#if defined(HAVE_CHOWN)+ -- | @setOwnerAndGroup path uid gid@ changes the owner and group of @path@ to -- @uid@ and @gid@, respectively. --@@ -319,6 +419,14 @@ foreign import ccall unsafe "chown" c_chown :: CString -> CUid -> CGid -> IO CInt +#else++{-# WARNING setOwnerAndGroup "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_CHOWN@)" #-}+setOwnerAndGroup :: RawFilePath -> UserID -> GroupID -> IO ()+setOwnerAndGroup _ _ _ = ioError (ioeSetLocation unsupportedOperation "setOwnerAndGroup")++#endif // HAVE_CHOWN+ #if HAVE_LCHOWN -- | Acts as 'setOwnerAndGroup' but does not follow symlinks (and thus -- changes permissions on the link itself).@@ -351,11 +459,20 @@ -- | Like 'setFileTimes' but timestamps can have sub-second resolution. ----- Note: calls @utimensat@ or @utimes@.+-- Note: calls @utimensat@ or @utimes@. Support for high resolution timestamps+-- is filesystem dependent with the following limitations:+--+-- - HFS+ volumes on OS X truncate the sub-second part of the timestamp.+-- setFileTimesHiRes :: RawFilePath -> POSIXTime -> POSIXTime -> IO ()-#ifdef HAVE_UTIMENSAT+#if defined(javascript_HOST_ARCH) setFileTimesHiRes name atime mtime = withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "setFileTimesHiRes" name $+ js_utimes s (realToFrac atime) (realToFrac mtime)+#elif defined(HAVE_UTIMENSAT)+setFileTimesHiRes name atime mtime =+ withFilePath name $ \s -> withArray [toCTimeSpec atime, toCTimeSpec mtime] $ \times -> throwErrnoPathIfMinus1_ "setFileTimesHiRes" name $ c_utimensat (#const AT_FDCWD) s times 0@@ -370,11 +487,20 @@ -- This operation is not supported on all platforms. On these platforms, -- this function will raise an exception. ----- Note: calls @utimensat@ or @lutimes@.+-- Note: calls @utimensat@ or @lutimes@. Support for high resolution timestamps+-- is filesystem dependent with the following limitations:+--+-- - HFS+ volumes on OS X truncate the sub-second part of the timestamp.+-- setSymbolicLinkTimesHiRes :: RawFilePath -> POSIXTime -> POSIXTime -> IO ()-#if HAVE_UTIMENSAT+#if defined(javascript_HOST_ARCH) setSymbolicLinkTimesHiRes name atime mtime = withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "setSymbolicLinkTimesHiRes" name $+ js_lutimes s (realToFrac atime) (realToFrac mtime)+#elif HAVE_UTIMENSAT+setSymbolicLinkTimesHiRes name atime mtime =+ withFilePath name $ \s -> withArray [toCTimeSpec atime, toCTimeSpec mtime] $ \times -> throwErrnoPathIfMinus1_ "setSymbolicLinkTimesHiRes" name $ c_utimensat (#const AT_FDCWD) s times (#const AT_SYMLINK_NOFOLLOW)@@ -385,6 +511,7 @@ throwErrnoPathIfMinus1_ "setSymbolicLinkTimesHiRes" name $ c_lutimes s times #else+{-# WARNING setSymbolicLinkTimesHiRes "setSymbolicLinkTimesHiRes: not available on this platform" #-} setSymbolicLinkTimesHiRes = error "setSymbolicLinkTimesHiRes: not available on this platform" #endif@@ -404,11 +531,16 @@ -- -- Note: calls @lutimes@. touchSymbolicLink :: RawFilePath -> IO ()-#if HAVE_LUTIMES+#if defined(javascript_HOST_ARCH) touchSymbolicLink name = withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "touchSymbolicLink" name (js_lutimes s (-1) (-1))+#elif HAVE_LUTIMES+touchSymbolicLink name =+ withFilePath name $ \s -> throwErrnoPathIfMinus1_ "touchSymbolicLink" name (c_lutimes s nullPtr) #else+{-# WARNING touchSymbolicLink "touchSymbolicLink: not available on this platform" #-} touchSymbolicLink = error "touchSymbolicLink: not available on this platform" #endif
System/Posix/Files/Common.hsc view
@@ -1,4 +1,9 @@+{-# LANGUAGE CApiFFI #-}+{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE Trustworthy #-}+{-# LANGUAGE PatternSynonyms #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE NumDecimals #-} ----------------------------------------------------------------------------- -- |@@ -56,6 +61,69 @@ isBlockDevice, isCharacterDevice, isNamedPipe, isRegularFile, isDirectory, isSymbolicLink, isSocket, + fileBlockSize,+ fileBlocks,++ -- * Extended file status+ StatxFlags(..),+ pattern EmptyPath,+ pattern NoAutoMount,+ pattern SymlinkNoFollow,+ pattern SyncAsStat,+ pattern ForceSync,+ pattern DontSync,+ defaultStatxFlags,+ StatxMask(..),+ pattern StatxType,+ pattern StatxMode,+ pattern StatxNlink,+ pattern StatxUid,+ pattern StatxGid,+ pattern StatxAtime,+ pattern StatxMtime,+ pattern StatxCtime,+ pattern StatxBtime,+ pattern StatxIno,+ pattern StatxSize,+ pattern StatxBlocks,+ pattern StatxMntId,+ pattern StatxBasicStats,+ pattern StatxAll,+ defaultStatxMask,+ ExtendedFileStatus(..),+ CAttributes(..),+ getExtendedFileStatus_,+ fileBlockSizeX,+ linkCountX,+ fileOwnerX,+ fileGroupX,+ fileModeX,+ fileIDX,+ fileSizeX,+ fileBlocksX,+ accessTimeHiResX,+ creationTimeHiResX,+ statusChangeTimeHiResX,+ modificationTimeHiResX,+ deviceIDX,+ specialDeviceIDX,+ mountIDX,+ fileCompressedX,+ fileImmutableX,+ fileAppendX,+ fileNoDumpX,+ fileEncryptedX,+ fileVerityX,+ fileDaxX,+ isBlockDeviceX,+ isCharacterDeviceX,+ isNamedPipeX,+ isRegularFileX,+ isDirectoryX,+ isSymbolicLinkX,+ isSocketX,+ haveStatx,+ -- * Setting file sizes setFdSize, @@ -71,6 +139,11 @@ toCTimeSpec, c_utimensat, #endif+#if defined(javascript_HOST_ARCH)+ js_futimes,+ js_utimes,+ js_lutimes,+#endif CTimeVal(..), toCTimeVal, c_utimes,@@ -84,6 +157,11 @@ import Data.Bits import Data.Int import Data.Ratio+import Data.Word+#ifdef HAVE_STATX+import Data.Time.Clock (secondsToNominalDiffTime)+import Data.Fixed (Fixed(..))+#endif import Data.Time.Clock.POSIX (POSIXTime) import System.Posix.Internals import Foreign.C@@ -94,6 +172,11 @@ import Foreign.Ptr import Foreign.Storable +#if !defined(HAVE_FCHMOD) || !defined(HAVE_CHOWN) || !defined(HAVE_STATX)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif+ -- ----------------------------------------------------------------------------- -- POSIX file modes @@ -204,6 +287,8 @@ socketMode :: FileMode socketMode = (#const S_IFSOCK) +#if defined(HAVE_FCHMOD)+ -- | @setFdMode fd mode@ acts like 'setFileMode' but uses a file descriptor -- @fd@ instead of a 'FilePath'. --@@ -215,6 +300,14 @@ foreign import ccall unsafe "fchmod" c_fchmod :: CInt -> CMode -> IO CInt +#else++{-# WARNING setFdMode "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_FCHMOD@)" #-}+setFdMode :: Fd -> FileMode -> IO ()+setFdMode _ _ = ioError (ioeSetLocation unsupportedOperation "setFdMode")++#endif // HAVE_FCHMOD+ -- | @setFileCreationMask mode@ sets the file mode creation mask to @mode@. -- Modes set by this operation are subtracted from files and directories upon -- creation. The previous file creation mask is returned.@@ -231,7 +324,12 @@ -- 'FileStatus' type. -- -- Note: see @chmod@.-newtype FileStatus = FileStatus (ForeignPtr CStat)+--+-- Limitations: Support for high resolution timestamps is filesystem dependent:+--+-- - HFS+ volumes on OS X only support whole-second times.+--+newtype FileStatus = FileStatus (ForeignPtr CStat) -- ^ The constructor is considered internal and may change. -- | ID of the device on which this file resides. deviceID :: FileStatus -> DeviceID@@ -250,17 +348,28 @@ -- | Size of the file in bytes. If this file is a symbolic link the size is -- the length of the pathname it contains. fileSize :: FileStatus -> FileOffset+-- | Number of blocks allocated for this file, in units of+-- 512-bytes. Returns @Nothing@ if @st_blocks@ is not supported on this+-- platform.+fileBlocks :: FileStatus -> Maybe CBlkCnt+-- | Gives the preferred block size for efficient filesystem I/O in+-- bytes. Returns @Nothing@ if @st_blocksize@ is not supported on this+-- platform.+fileBlockSize :: FileStatus -> Maybe CBlkSize -- | Time of last access. accessTime :: FileStatus -> EpochTime--- | Time of last access in sub-second resolution.+-- | Time of last access in sub-second resolution. Depends on the timestamp resolution of the+-- underlying filesystem. accessTimeHiRes :: FileStatus -> POSIXTime -- | Time of last modification. modificationTime :: FileStatus -> EpochTime--- | Time of last modification in sub-second resolution.+-- | Time of last modification in sub-second resolution. Depends on the timestamp resolution of the+-- underlying filesystem. modificationTimeHiRes :: FileStatus -> POSIXTime -- | Time of last status change (i.e. owner, group, link count, mode, etc.). statusChangeTime :: FileStatus -> EpochTime -- | Time of last status change (i.e. owner, group, link count, mode, etc.) in sub-second resolution.+-- Depends on the timestamp resolution of the underlying filesystem. statusChangeTimeHiRes :: FileStatus -> POSIXTime deviceID (FileStatus stat) =@@ -286,6 +395,19 @@ statusChangeTime (FileStatus stat) = unsafePerformIO $ withForeignPtr stat $ (#peek struct stat, st_ctime) +#ifdef HAVE_STRUCT_STAT_ST_BLOCKS+fileBlocks (FileStatus stat) =+ Just $ unsafePerformIO $ withForeignPtr stat $ (#peek struct stat, st_blocks)+#else+fileBlocks _ = Nothing+#endif+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE+fileBlockSize (FileStatus stat) =+ Just $ unsafePerformIO $ withForeignPtr stat $ (#peek struct stat, st_blksize)+#else+fileBlockSize _ = Nothing+#endif+ accessTimeHiRes (FileStatus stat) = unsafePerformIO $ withForeignPtr stat $ \stat_ptr -> do sec <- (#peek struct stat, st_atime) stat_ptr :: IO EpochTime@@ -420,16 +542,16 @@ #endif #ifdef HAVE_UTIMENSAT-foreign import ccall unsafe "utimensat"+foreign import capi unsafe "sys/stat.h utimensat" c_utimensat :: CInt -> CString -> Ptr CTimeSpec -> CInt -> IO CInt #endif #if HAVE_FUTIMENS-foreign import ccall unsafe "futimens"+foreign import capi unsafe "sys/stat.h futimens" c_futimens :: CInt -> Ptr CTimeSpec -> IO CInt #endif -data CTimeVal = CTimeVal CLong CLong+data CTimeVal = CTimeVal (#type time_t) (#type suseconds_t) instance Storable CTimeVal where sizeOf _ = #size struct timeval@@ -448,29 +570,45 @@ (sec, frac) = if (frac' < 0) then (sec' - 1, frac' + 1) else (sec', frac') (sec', frac') = properFraction $ toRational t -foreign import ccall unsafe "utimes"+foreign import capi unsafe "sys/time.h utimes" c_utimes :: CString -> Ptr CTimeVal -> IO CInt #ifdef HAVE_LUTIMES-foreign import ccall unsafe "lutimes"+foreign import capi unsafe "sys/time.h lutimes" c_lutimes :: CString -> Ptr CTimeVal -> IO CInt #endif #if HAVE_FUTIMES-foreign import ccall unsafe "futimes"+foreign import capi unsafe "sys/time.h futimes" c_futimes :: CInt -> Ptr CTimeVal -> IO CInt #endif +#if defined(javascript_HOST_ARCH)+foreign import ccall unsafe "js_futimes"+ js_futimes :: CInt -> CDouble -> CDouble -> IO CInt+foreign import ccall unsafe "js_lutimes"+ js_lutimes :: CFilePath -> CDouble -> CDouble -> IO CInt+foreign import ccall unsafe "js_utimes"+ js_utimes :: CFilePath -> CDouble -> CDouble -> IO CInt+#endif+ -- | Like 'setFileTimesHiRes' but uses a file descriptor instead of a path. -- This operation is not supported on all platforms. On these platforms, -- this function will raise an exception. ----- Note: calls @futimens@ or @futimes@.+-- Note: calls @futimens@ or @futimes@. Support for high resolution timestamps+-- is filesystem dependent with the following limitations: --+-- - HFS+ volumes on OS X truncate the sub-second part of the timestamp.+--+-- -- @since 2.7.0.0 setFdTimesHiRes :: Fd -> POSIXTime -> POSIXTime -> IO ()-#if HAVE_FUTIMENS+#if defined(javascript_HOST_ARCH) setFdTimesHiRes (Fd fd) atime mtime =+ throwErrnoIfMinus1_ "setFdTimesHiRes" (js_futimes fd (realToFrac atime) (realToFrac mtime))+#elif HAVE_FUTIMENS+setFdTimesHiRes (Fd fd) atime mtime = withArray [toCTimeSpec atime, toCTimeSpec mtime] $ \times -> throwErrnoIfMinus1_ "setFdTimesHiRes" (c_futimens fd times) #elif HAVE_FUTIMES@@ -478,6 +616,7 @@ withArray [toCTimeVal atime, toCTimeVal mtime] $ \times -> throwErrnoIfMinus1_ "setFdTimesHiRes" (c_futimes fd times) #else+{-# WARNING setFdTimesHiRes "setFdTimesHiRes: not available on this platform" #-} setFdTimesHiRes = error "setSymbolicLinkTimesHiRes: not available on this platform" #endif@@ -490,10 +629,15 @@ -- -- @since 2.7.0.0 touchFd :: Fd -> IO ()-#if HAVE_FUTIMES+#if defined(javascript_HOST_ARCH) touchFd (Fd fd) =+ -- (-1) indicates that current time must be used+ throwErrnoIfMinus1_ "touchFd" (js_futimes fd (-1) (-1))+#elif HAVE_FUTIMES+touchFd (Fd fd) = throwErrnoIfMinus1_ "touchFd" (c_futimes fd nullPtr) #else+{-# WARNING touchFd "touchFd: not available on this platform" #-} touchFd = error "touchFd: not available on this platform" #endif@@ -501,6 +645,8 @@ -- ----------------------------------------------------------------------------- -- fchown() +#if defined(HAVE_CHOWN)+ -- | Acts as 'setOwnerAndGroup' but uses a file descriptor instead of a -- 'FilePath'. --@@ -512,6 +658,14 @@ foreign import ccall unsafe "fchown" c_fchown :: CInt -> CUid -> CGid -> IO CInt +#else++{-# WARNING setFdOwnerAndGroup "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_CHOWN@)" #-}+setFdOwnerAndGroup :: Fd -> UserID -> GroupID -> IO ()+setFdOwnerAndGroup _ _ _ = ioError (ioeSetLocation unsupportedOperation "setFdOwnerAndGroup")++#endif // HAVE_CHOWN+ -- ----------------------------------------------------------------------------- -- ftruncate() @@ -603,3 +757,601 @@ foreign import ccall unsafe "fpathconf" c_fpathconf :: CInt -> CInt -> IO CLong+++-- -----------------------------------------------------------------------------+-- statx+--++newtype {-# CTYPE "__u64" #-} CAttributes = CAttributes Word64+ deriving (Read, Show, Eq, Ord, Storable, Num, Bits)++-- | Statx flags.+--+-- See the pattern synonyms for possible flags. These are combined via `(<>)`.+-- Flags can be tested via `(.&.)`.+--+-- The following flags influence pathname-based lookup:+--+-- - 'EmptyPath'+-- - 'NoAutoMount'+-- - 'SymlinkNoFollow'+--+-- The following flags can be used to control what sort of synchronization the kernel will do when querying a file on a remote filesystem:+--+-- - 'SyncAsStat'+-- - 'ForceSync'+-- - 'DontSync'+newtype StatxFlags = StatxFlags CInt deriving (Read, Show, Eq, Ord, Integral, Num, Enum, Bits, Real)++-- | ORs the flags.+instance Semigroup StatxFlags where+ a <> b = a .|. b++instance Monoid StatxFlags where+ mappend = (<>)+ mempty = 0++-- | If pathname to 'getExtendedFileStatus' is an empty string, operate on the file referred to by+-- the 'Maybe Fd' argument.+--+-- In this case, it can refer to any type of file, not just a directory.+pattern EmptyPath :: StatxFlags+#ifdef AT_EMPTY_PATH+pattern EmptyPath = StatxFlags (#const AT_EMPTY_PATH)+#else+pattern EmptyPath = StatxFlags 0+#endif++-- | Don't automount the terminal ("basename") component of pathname if it is a directory that is an automount point.+-- This allows the caller to gather attributes of an automount point (rather than the location it would mount).+-- This flag can be used in tools that scan directories to prevent mass-automounting of a directory of automount points.+-- This flag has no effect if the mount point has already been mounted over.+pattern NoAutoMount :: StatxFlags+#ifdef AT_NO_AUTOMOUNT+pattern NoAutoMount = StatxFlags (#const AT_NO_AUTOMOUNT)+#else+pattern NoAutoMount = StatxFlags 0+#endif++-- | If pathname is a symbolic link, do not dereference it: instead return information about the link itself, like @lstat(2)@.+pattern SymlinkNoFollow :: StatxFlags+#ifdef AT_SYMLINK_NOFOLLOW+pattern SymlinkNoFollow = StatxFlags (#const AT_SYMLINK_NOFOLLOW)+#else+pattern SymlinkNoFollow = StatxFlags 0+#endif++-- | Do whatever @stat(2)@ does. This is the default and is very much filesystem-specific.+pattern SyncAsStat :: StatxFlags+#ifdef AT_STATX_SYNC_AS_STAT+pattern SyncAsStat = StatxFlags (#const AT_STATX_SYNC_AS_STAT)+#else+pattern SyncAsStat = StatxFlags 0+#endif++-- | Force the attributes to be synchronized with the server.+-- This may require that a network filesystem perform a data writeback to get the timestamps correct.+pattern ForceSync :: StatxFlags+#ifdef AT_STATX_FORCE_SYNC+pattern ForceSync = StatxFlags (#const AT_STATX_FORCE_SYNC)+#else+pattern ForceSync = StatxFlags 0+#endif++-- | Don't synchronize anything, but rather just take whatever the system has cached if possible.+-- This may mean that the information returned is approximate, but, on a network filesystem,+-- it may not involve a round trip to the server - even if no lease is held.+pattern DontSync :: StatxFlags+#ifdef AT_STATX_DONT_SYNC+pattern DontSync = StatxFlags (#const AT_STATX_DONT_SYNC)+#else+pattern DontSync = StatxFlags 0+#endif++defaultStatxFlags :: StatxFlags+defaultStatxFlags = mempty++-- | Mask argument to 'statx'. It's used to tell the kernel which fields the caller is interested in.+--+-- See the pattern synonyms for possible masks. These are combined via @(<>)@.+-- Masks can be tested via `(.&.)`.+newtype StatxMask = StatxMask CInt deriving (Read, Show, Eq, Ord, Integral, Num, Enum, Bits, Real)++-- | ORs the masks.+instance Semigroup StatxMask where+ a <> b = a .|. b++instance Monoid StatxMask where+ mappend = (<>)+ mempty = 0++-- | Want @stx_mode & S_IFMT@.+pattern StatxType :: StatxMask+#ifdef STATX_TYPE+pattern StatxType = StatxMask (#const STATX_TYPE)+#else+pattern StatxType = StatxMask 0+#endif++-- | Want @stx_mode & ~S_IFMT@.+pattern StatxMode :: StatxMask+#ifdef STATX_MODE+pattern StatxMode = StatxMask (#const STATX_MODE)+#else+pattern StatxMode = StatxMask 0+#endif++-- | Want @stx_nlink@.+pattern StatxNlink :: StatxMask+#ifdef STATX_NLINK+pattern StatxNlink = StatxMask (#const STATX_NLINK)+#else+pattern StatxNlink = StatxMask 0+#endif++-- | Want @stx_uid@.+pattern StatxUid :: StatxMask+#ifdef STATX_UID+pattern StatxUid = StatxMask (#const STATX_UID)+#else+pattern StatxUid = StatxMask 0+#endif++-- | Want @stx_gid@.+pattern StatxGid :: StatxMask+#ifdef STATX_GID+pattern StatxGid = StatxMask (#const STATX_GID)+#else+pattern StatxGid = StatxMask 0+#endif++-- | Want @stx_atime@.+pattern StatxAtime :: StatxMask+#ifdef STATX_ATIME+pattern StatxAtime = StatxMask (#const STATX_ATIME)+#else+pattern StatxAtime = StatxMask 0+#endif++-- | Want @stx_mtime@.+pattern StatxMtime :: StatxMask+#ifdef STATX_MTIME+pattern StatxMtime = StatxMask (#const STATX_MTIME)+#else+pattern StatxMtime = StatxMask 0+#endif++-- | Want @stx_ctime@.+pattern StatxCtime :: StatxMask+#ifdef STATX_CTIME+pattern StatxCtime = StatxMask (#const STATX_CTIME)+#else+pattern StatxCtime = StatxMask 0+#endif++-- | Want @stx_btime@.+pattern StatxBtime :: StatxMask+#ifdef STATX_BTIME+pattern StatxBtime = StatxMask (#const STATX_BTIME)+#else+pattern StatxBtime = StatxMask 0+#endif++-- | Want @stx_mnt_id@.+pattern StatxMntId :: StatxMask+#ifdef HAVE_STATX_MNT_ID+pattern StatxMntId = StatxMask (#const STATX_MNT_ID)+#else+pattern StatxMntId = StatxMask 0+#endif++-- | Want @stx_ino@.+pattern StatxIno :: StatxMask+#ifdef STATX_INO+pattern StatxIno = StatxMask (#const STATX_INO)+#else+pattern StatxIno = StatxMask 0+#endif++-- | Want @stx_size@.+pattern StatxSize :: StatxMask+#ifdef STATX_SIZE+pattern StatxSize = StatxMask (#const STATX_SIZE)+#else+pattern StatxSize = StatxMask 0+#endif++-- | Want @stx_blocks@.+pattern StatxBlocks :: StatxMask+#ifdef STATX_BLOCKS+pattern StatxBlocks = StatxMask (#const STATX_BLOCKS)+#else+pattern StatxBlocks = StatxMask 0+#endif++-- | Want all of the above.+pattern StatxBasicStats :: StatxMask+#ifdef STATX_BASIC_STATS+pattern StatxBasicStats = StatxMask (#const STATX_BASIC_STATS)+#else+pattern StatxBasicStats = StatxMask 0+#endif++-- | Want all currently available fields.+pattern StatxAll :: StatxMask+#ifdef STATX_ALL+pattern StatxAll = StatxMask (#const STATX_ALL)+#else+pattern StatxAll = StatxMask 0+#endif+++defaultStatxMask :: StatxMask+defaultStatxMask = mempty++newtype ExtendedFileStatus = ExtendedFileStatus (ForeignPtr CStatx) -- ^ The constructor is considered internal and may change.++-- | The "preferred" block size for efficient filesystem I/O.+-- (Writing to a file in smaller chunks may cause an inefficient read-modify-rewrite.)+fileBlockSizeX :: ExtendedFileStatus -> CBlkSize+#if HAVE_STATX+-- | Further status information about the file.+fileAttributesX :: ExtendedFileStatus -> CAttributes+#endif+-- | The number of hard links on a file.+linkCountX :: ExtendedFileStatus -> CNlink+-- | Te user ID of the owner of the file.+fileOwnerX :: ExtendedFileStatus -> UserID+-- | The ID of the group owner of the file.+fileGroupX :: ExtendedFileStatus -> GroupID+-- | The file type and mode. See @inode(7)@ for details.+fileModeX :: ExtendedFileStatus -> FileMode+-- | The inode number of the file.+fileIDX :: ExtendedFileStatus -> FileID+-- | The size of the file (if it is a regular file or a symbolic link) in bytes.+-- The size of a symbolic link is the length of the pathname it contains,+-- without a terminating null byte.+fileSizeX :: ExtendedFileStatus -> Word64+-- | The number of blocks allocated to the file on the medium, in 512-byte units.+-- (This may be smaller than stx_size/512 when the file has holes.)+fileBlocksX :: ExtendedFileStatus -> Word64+#if HAVE_STATX+-- | A mask indicating which bits in 'fileAttributesX' are supported by the VFS and the filesystem.+fileAttributesMaskX :: ExtendedFileStatus -> CAttributes+#endif+-- | The file's last access timestamp.+accessTimeHiResX :: ExtendedFileStatus -> POSIXTime+-- | The file's creation timestamp.+creationTimeHiResX :: ExtendedFileStatus -> POSIXTime+-- | The file's last status change timestamp.+statusChangeTimeHiResX :: ExtendedFileStatus -> POSIXTime+-- | The file's last modification timestamp.+modificationTimeHiResX :: ExtendedFileStatus -> POSIXTime+-- | ID of the device on which this file resides.+deviceIDX :: ExtendedFileStatus -> DeviceID+-- | Describes the device that this file represents.+specialDeviceIDX :: ExtendedFileStatus -> DeviceID+-- | The mount ID of the mount containing the file. This is the same number+-- reported by name_to_handle_at(2) and corresponds to the number in the+-- first field in one of the records in /proc/self/mountinfo.+mountIDX :: ExtendedFileStatus -> Word64+-- | The file is compressed by the filesystem and may take extra resources to access.+-- This is an extended attribute.+fileCompressedX :: ExtendedFileStatus -> Bool+-- | The file cannot be modified: it cannot be deleted or renamed, no hard links can+-- be created to this file and no data can be written to it. See @chattr(1)@.+-- This is an extended attribute.+fileImmutableX :: ExtendedFileStatus -> Bool+-- | The file can only be opened in append mode for writing. Random access writing is not permitted. See @chattr(1)@.+-- This is an extended attribute.+fileAppendX :: ExtendedFileStatus -> Bool+-- | File is not a candidate for backup when a backup program such as @dump(8)@ is run. See @chattr(1)@.+-- This is an extended attribute.+fileNoDumpX :: ExtendedFileStatus -> Bool+-- | A key is required for the file to be encrypted by the filesystem.+-- This is an extended attribute.+fileEncryptedX :: ExtendedFileStatus -> Bool+-- | The file has fs-verity enabled. It cannot be written to, and all reads from it+-- will be verified against a cryptographic hash that covers the entire file (e.g., via a Merkle tree).+-- This is an extended attribute.+-- Since Linux 5.5.+fileVerityX :: ExtendedFileStatus -> Bool+-- | The file is in the DAX (cpu direct access) state.+-- This is an extended attribute.+-- Since Linux 5.8.+fileDaxX :: ExtendedFileStatus -> Bool++-- | Checks if this file is a block device.+isBlockDeviceX :: ExtendedFileStatus -> Bool+-- | Checks if this file is a character device.+isCharacterDeviceX :: ExtendedFileStatus -> Bool+-- | Checks if this file is a named pipe device.+isNamedPipeX :: ExtendedFileStatus -> Bool+-- | Checks if this file is a regular file device.+isRegularFileX :: ExtendedFileStatus -> Bool+-- | Checks if this file is a directory device.+isDirectoryX :: ExtendedFileStatus -> Bool+-- | Checks if this file is a symbolic link device.+isSymbolicLinkX :: ExtendedFileStatus -> Bool+-- | Checks if this file is a socket device.+isSocketX :: ExtendedFileStatus -> Bool++isBlockDeviceX statx =+ (fileModeX statx `intersectFileModes` fileTypeModes) == blockSpecialMode+isCharacterDeviceX statx =+ (fileModeX statx `intersectFileModes` fileTypeModes) == characterSpecialMode+isNamedPipeX statx =+ (fileModeX statx `intersectFileModes` fileTypeModes) == namedPipeMode+isRegularFileX statx =+ (fileModeX statx `intersectFileModes` fileTypeModes) == regularFileMode+isDirectoryX statx =+ (fileModeX statx `intersectFileModes` fileTypeModes) == directoryMode+isSymbolicLinkX statx =+ (fileModeX statx `intersectFileModes` fileTypeModes) == symbolicLinkMode+isSocketX statx =+ (fileModeX statx `intersectFileModes` fileTypeModes) == socketMode++#if HAVE_STATX+testFlag :: ExtendedFileStatus -> CAttributes -> Bool+testFlag ex flag =+ let attributes = fileAttributesX ex+ attributes_mask = fileAttributesMaskX ex+ in (attributes .&. attributes_mask .&. flag) /= 0++#ifdef STATX_ATTR_COMPRESSED+fileCompressedX ex = testFlag ex (#const STATX_ATTR_COMPRESSED)+#else+{-# WARNING fileCompressedX "fileCompressedX: not available on this platform, will default to 'False' (CPP guard: @#if STATX_ATTR_COMPRESSED@)" #-}+fileCompressedX _ = False+#endif+#ifdef STATX_ATTR_IMMUTABLE+fileImmutableX ex = testFlag ex (#const STATX_ATTR_IMMUTABLE)+#else+{-# WARNING fileImmutableX "fileImmutableX: not available on this platform, will default to 'False' (CPP guard: @#if STATX_ATTR_IMMUTABLE@)" #-}+fileImmutableX _ = False+#endif+#ifdef STATX_ATTR_APPEND+fileAppendX ex = testFlag ex (#const STATX_ATTR_APPEND)+#else+{-# WARNING fileAppendX "fileAppendX: not available on this platform, will default to 'False' (CPP guard: @#if STATX_ATTR_APPEND@)" #-}+fileAppendX _ = False+#endif+#ifdef STATX_ATTR_NODUMP+fileNoDumpX ex = testFlag ex (#const STATX_ATTR_NODUMP)+#else+{-# WARNING fileNoDumpX "fileNoDumpX: not available on this platform, will default to 'False' (CPP guard: @#if STATX_ATTR_NODUMP@)" #-}+fileNoDumpX _ = False+#endif+#ifdef STATX_ATTR_ENCRYPTED+fileEncryptedX ex = testFlag ex (#const STATX_ATTR_ENCRYPTED)+#else+{-# WARNING fileEncryptedX "fileEncryptedX: not available on this platform, will default to 'False' (CPP guard: @#if STATX_ATTR_ENCRYPTED@)" #-}+fileEncryptedX _ = False+#endif+#ifdef STATX_ATTR_VERITY+fileVerityX ex = testFlag ex (#const STATX_ATTR_VERITY)+#else+{-# WARNING fileVerityX "fileVerityX: not available on this platform, will default to 'False' (CPP guard: @#if STATX_ATTR_VERITY@)" #-}+fileVerityX _ = False+#endif+#ifdef STATX_ATTR_DAX+fileDaxX ex = testFlag ex (#const STATX_ATTR_DAX)+#else+{-# WARNING fileDaxX "fileDaxX: not available on this platform, will default to 'False' (CPP guard: @#if STATX_ATTR_DAX@)" #-}+fileDaxX _ = False+#endif++#ifdef HAVE_SYS_SYSMACROS_H+deviceIDX (ExtendedFileStatus statx) = unsafePerformIO $ do+ major <- withForeignPtr statx $ (#peek struct statx, stx_dev_major) :: IO CUInt+ minor <- withForeignPtr statx $ (#peek struct statx, stx_dev_minor) :: IO CUInt+ c_makedev major minor+#else+{-# WARNING deviceIDX "deviceIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_SYS_SYSMACROS_H@)" #-}+deviceIDX _ = error "deviceIDX not available on this platform"+#endif+#ifdef HAVE_SYS_SYSMACROS_H+specialDeviceIDX (ExtendedFileStatus statx) = unsafePerformIO $ do+ major <- withForeignPtr statx $ (#peek struct statx, stx_rdev_major) :: IO CUInt+ minor <- withForeignPtr statx $ (#peek struct statx, stx_rdev_minor) :: IO CUInt+ c_makedev major minor+#else+{-# WARNING specialDeviceIDX "specialDeviceIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_SYS_SYSMACROS_H@)" #-}+specialDeviceIDX _ = error "specialDeviceIDX not available on this platform"+#endif+#ifdef HAVE_STATX_MNT_ID+mountIDX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_mnt_id)+#else+{-# WARNING mountIDX "mountIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX_MNT_ID@)" #-}+mountIDX _ = error "mountIDX not available on this platform"+#endif+fileBlockSizeX (ExtendedFileStatus statx) = unsafePerformIO $ do+ r <- withForeignPtr statx $ (#peek struct statx, stx_blksize) :: IO Word32+ return $ CBlkSize (fromIntegral r)+fileAttributesX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_attributes)+#ifdef STATX_NLINK+linkCountX (ExtendedFileStatus statx) = unsafePerformIO $ do+ links <- withForeignPtr statx $ (#peek struct statx, stx_nlink) :: IO Word32+ return $ CNlink (fromIntegral links)+#else+{-# WARNING linkCountX "linkCountX: not available on this platform, will throw error (CPP guard: @#if STATX_NLINK@)" #-}+linkCountX _ = error "linkCountX not available on this platform"+#endif+#ifdef STATX_UID+fileOwnerX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_uid)+#else+{-# WARNING fileOwnerX "fileOwnerX: not available on this platform, will throw error (CPP guard: @#if STATX_UID@)" #-}+fileOwnerX _ = error "fileOwnerX not available on this platform"+#endif+#ifdef STATX_GID+fileGroupX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_gid)+#else+{-# WARNING fileGroupX "fileGroupX: not available on this platform, will throw error (CPP guard: @#if STATX_GID@)" #-}+fileGroupX _ = error "fileGroupX not available on this platform"+#endif+#ifdef STATX_MODE+fileModeX (ExtendedFileStatus statx) = unsafePerformIO $ do+ r <- withForeignPtr statx $ (#peek struct statx, stx_mode) :: IO Word16+ return $ CMode $ fromIntegral r+#else+{-# WARNING fileModeX "fileModeX: not available on this platform, will throw error (CPP guard: @#if STATX_MODE@)" #-}+fileModeX _ = error "fileModeX not available on this platform"+#endif+#ifdef STATX_INO+fileIDX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_ino)+#else+{-# WARNING fileIDX "fileIDX: not available on this platform, will throw error (CPP guard: @#if STATX_INO@)" #-}+fileIDX _ = error "fileIDX not available on this platform"+#endif+#ifdef STATX_SIZE+fileSizeX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_size) :: Word64+#else+{-# WARNING fileSizeX "fileSizeX: not available on this platform, will throw error (CPP guard: @#if STATX_SIZE@)" #-}+fileSizeX _ = error "fileSizeX not available on this platform"+#endif+#ifdef STATX_BLOCKS+fileBlocksX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_blocks) :: Word64+#else+{-# WARNING fileBlocksX "fileBlocksX: not available on this platform, will throw error (CPP guard: @#if STATX_BLOCKS@)" #-}+fileBlocksX _ = error "fileBlocksX not available on this platform"+#endif+fileAttributesMaskX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_attributes_mask)+#ifdef STATX_ATIME+accessTimeHiResX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ \statx_ptr -> do+ sec <- (#peek struct statx, stx_atime.tv_sec) statx_ptr :: IO EpochTime+ nsec <- (#peek struct statx, stx_atime.tv_nsec) statx_ptr :: IO (#type int)+ return $ timeHiResToNominalDiffTime sec nsec+#else+{-# WARNING accessTimeHiResX "accessTimeHiResX: not available on this platform, will throw error (CPP guard: @#if STATX_ATIME@)" #-}+accessTimeHiResX _ = error "accessTimeHiResX not available on this platform"+#endif+#ifdef STATX_BTIME+creationTimeHiResX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ \statx_ptr -> do+ sec <- (#peek struct statx, stx_btime.tv_sec) statx_ptr :: IO EpochTime+ nsec <- (#peek struct statx, stx_btime.tv_nsec) statx_ptr :: IO (#type int)+ return $ timeHiResToNominalDiffTime sec nsec+#else+{-# WARNING creationTimeHiResX "creationTimeHiResX: not available on this platform, will throw error (CPP guard: @#if STATX_BTIME@)" #-}+creationTimeHiResX _ = error "creationTimeHiResX not available on this platform"+#endif+#ifdef STATX_CTIME+statusChangeTimeHiResX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ \statx_ptr -> do+ sec <- (#peek struct statx, stx_ctime.tv_sec) statx_ptr :: IO EpochTime+ nsec <- (#peek struct statx, stx_ctime.tv_nsec) statx_ptr :: IO (#type int)+ return $ timeHiResToNominalDiffTime sec nsec+#else+{-# WARNING statusChangeTimeHiResX "statusChangeTimeHiResX: not available on this platform, will throw error (CPP guard: @#if STATX_CTIME@)" #-}+statusChangeTimeHiResX _ = error "statusChangeTimeHiResX not available on this platform"+#endif+#ifdef STATX_MTIME+modificationTimeHiResX (ExtendedFileStatus statx) =+ unsafePerformIO $ withForeignPtr statx $ \statx_ptr -> do+ sec <- (#peek struct statx, stx_mtime.tv_sec) statx_ptr :: IO EpochTime+ nsec <- (#peek struct statx, stx_mtime.tv_nsec) statx_ptr :: IO (#type int)+ return $ timeHiResToNominalDiffTime sec nsec+#else+{-# WARNING modificationTimeHiResX "modificationTimeHiResX: not available on this platform, will throw error (CPP guard: @#if STATX_MTIME@)" #-}+modificationTimeHiResX _ = error "modificationTimeHiResX not available on this platform"+#endif++timeHiResToNominalDiffTime :: EpochTime -> Int32 -> POSIXTime+timeHiResToNominalDiffTime (CTime sec) nsec = secondsToNominalDiffTime $ MkFixed $ toInteger sec * 1e12 + toInteger nsec * 1e3++#else+{-# WARNING linkCountX "linkCountX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+linkCountX _ = error "linkCountX not available on this platform"+{-# WARNING fileBlockSizeX "fileBlockSizeX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+fileBlockSizeX _ = error "fileBlockSizeX not available on this platform"+{-# WARNING deviceIDX "deviceIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+deviceIDX _ = error "deviceIDX not available on this platform"+{-# WARNING specialDeviceIDX "specialDeviceIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+specialDeviceIDX _ = error "specialDeviceIDX not available on this platform"+{-# WARNING mountIDX "mountIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+mountIDX _ = error "mountIDX not available on this platform"+{-# WARNING fileOwnerX "fileOwnerX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+fileOwnerX _ = error "fileOwnerX not available on this platform"+{-# WARNING fileGroupX "fileGroupX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+fileGroupX _ = error "fileGroupX not available on this platform"+{-# WARNING fileModeX "fileModeX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+fileModeX _ = error "fileModeX not available on this platform"+{-# WARNING fileIDX "fileIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+fileIDX _ = error "fileIDX not available on this platform"+{-# WARNING fileSizeX "fileSizeX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+fileSizeX _ = error "fileSizeX not available on this platform"+{-# WARNING fileBlocksX "fileBlocksX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+fileBlocksX _ = error "fileBlocksX not available on this platform"+{-# WARNING accessTimeHiResX "accessTimeHiResX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+accessTimeHiResX _ = error "accessTimeHiResX not available on this platform"+{-# WARNING creationTimeHiResX "creationTimeHiResX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+creationTimeHiResX _ = error "creationTimeHiResX not available on this platform"+{-# WARNING statusChangeTimeHiResX "statusChangeTimeHiResX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+statusChangeTimeHiResX _ = error "statusChangeTimeHiResX not available on this platform"+{-# WARNING modificationTimeHiResX "modificationTimeHiResX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX@)" #-}+modificationTimeHiResX _ = error "modificationTimeHiResX not available on this platform"+{-# WARNING fileCompressedX "fileCompressedX: not available on this platform, will default to 'False' (CPP guard: @#if HAVE_STATX@)" #-}+fileCompressedX _ = False+{-# WARNING fileImmutableX "fileImmutableX: not available on this platform, will default to 'False' (CPP guard: @#if HAVE_STATX@)" #-}+fileImmutableX _ = False+{-# WARNING fileAppendX "fileAppendX: not available on this platform, will default to 'False' (CPP guard: @#if HAVE_STATX@)" #-}+fileAppendX _ = False+{-# WARNING fileNoDumpX "fileNoDumpX: not available on this platform, will default to 'False' (CPP guard: @#if HAVE_STATX@)" #-}+fileNoDumpX _ = False+{-# WARNING fileEncryptedX "fileEncryptedX: not available on this platform, will default to 'False' (CPP guard: @#if HAVE_STATX@)" #-}+fileEncryptedX _ = False+{-# WARNING fileVerityX "fileVerityX: not available on this platform, will default to 'False' (CPP guard: @#if HAVE_STATX@)" #-}+fileVerityX _ = False+{-# WARNING fileDaxX "fileDaxX: not available on this platform, will default to 'False' (CPP guard: @#if HAVE_STATX@)" #-}+fileDaxX _ = False+#endif++data {-# CTYPE "struct statx" #-} CStatx++#ifdef HAVE_STATX+foreign import capi unsafe "sys/stat.h statx"+ c_statx :: CInt -> CFilePath -> CInt -> CInt -> Ptr CStatx -> IO CInt++#ifdef HAVE_SYS_SYSMACROS_H+foreign import capi unsafe "sys/sysmacros.h makedev"+ c_makedev :: CUInt -> CUInt -> IO CDev+#endif+#endif+++getExtendedFileStatus_ :: Maybe Fd -- ^ Optional directory file descriptor+ -> CString -- ^ Pathname to open+ -> StatxFlags+ -> StatxMask+ -> IO ExtendedFileStatus+#ifdef HAVE_STATX+getExtendedFileStatus_ fdMay str (StatxFlags flags) (StatxMask masks) = do+ fp <- mallocForeignPtrBytes (#const sizeof(struct statx))+ withForeignPtr fp $ \p ->+ throwErrnoIfMinus1_ "getExtendedFileStatus_" (c_statx c_fd str flags masks p)+ return (ExtendedFileStatus fp)+ where+ c_fd = maybe (#const AT_FDCWD) (\ (Fd fd) -> fd) fdMay+#else+{-# WARNING getExtendedFileStatus_ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_STATX@)" #-}+getExtendedFileStatus_ _ _ _ _ = ioError (ioeSetLocation unsupportedOperation "getExtendedFileStatus")+#endif++-- | Whether 'statx' is available on this platform and 'getExtendedFileStatus' and+-- related functions will work.+haveStatx :: Bool+#ifdef HAVE_STATX+haveStatx = True+#else+haveStatx = False+#endif
+ System/Posix/Files/PosixString.hsc view
@@ -0,0 +1,567 @@+{-# LANGUAGE CApiFFI #-}+{-# LANGUAGE PatternSynonyms #-}++-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.Files.PosixString+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- Functions defined by the POSIX standards for manipulating and querying the+-- file system. Names of underlying POSIX functions are indicated whenever+-- possible. A more complete documentation of the POSIX functions together+-- with a more detailed description of different error conditions are usually+-- available in the system's manual pages or from+-- <http://www.unix.org/version3/online.html> (free registration required).+--+-- When a function that calls an underlying POSIX function fails, the errno+-- code is converted to an 'IOError' using 'Foreign.C.Error.errnoToIOError'.+-- For a list of which errno codes may be generated, consult the POSIX+-- documentation for the underlying function.+--+-----------------------------------------------------------------------------++#include "HsUnix.h"++module System.Posix.Files.PosixString (+ -- * File modes+ -- FileMode exported by System.Posix.Types+ unionFileModes, intersectFileModes,+ nullFileMode,+ ownerReadMode, ownerWriteMode, ownerExecuteMode, ownerModes,+ groupReadMode, groupWriteMode, groupExecuteMode, groupModes,+ otherReadMode, otherWriteMode, otherExecuteMode, otherModes,+ setUserIDMode, setGroupIDMode,+ stdFileMode, accessModes,+ fileTypeModes,+ blockSpecialMode, characterSpecialMode, namedPipeMode, regularFileMode,+ directoryMode, symbolicLinkMode, socketMode,++ -- ** Setting file modes+ setFileMode, setFdMode, setFileCreationMask,++ -- ** Checking file existence and permissions+ fileAccess, fileExist,++ -- * File status+ FileStatus,+ -- ** Obtaining file status+ getFileStatus, getFdStatus, getSymbolicLinkStatus,+ -- ** Querying file status+ deviceID, fileID, fileMode, linkCount, fileOwner, fileGroup,+ specialDeviceID, fileSize, accessTime, modificationTime,+ statusChangeTime,+ accessTimeHiRes, modificationTimeHiRes, statusChangeTimeHiRes,+ isBlockDevice, isCharacterDevice, isNamedPipe, isRegularFile,+ isDirectory, isSymbolicLink, isSocket,++ -- * Extended file status+ ExtendedFileStatus(..),+ CAttributes(..),+ haveStatx,+ -- ** Obtaining extended file status+ getExtendedFileStatus,+ -- ** Flags+ StatxFlags(..),+ defaultStatxFlags,+ pattern EmptyPath,+ pattern NoAutoMount,+ pattern SymlinkNoFollow,+ pattern SyncAsStat,+ pattern ForceSync,+ pattern DontSync,+ -- ** Mask+ StatxMask(..),+ defaultStatxMask,+ pattern StatxType,+ pattern StatxMode,+ pattern StatxNlink,+ pattern StatxUid,+ pattern StatxGid,+ pattern StatxAtime,+ pattern StatxMtime,+ pattern StatxCtime,+ pattern StatxIno,+ pattern StatxSize,+ pattern StatxBlocks,+ pattern StatxBasicStats,+ pattern StatxBtime,+ pattern StatxMntId,+ pattern StatxAll,+ -- ** Querying extended file status+ fileBlockSizeX,+ linkCountX,+ fileOwnerX,+ fileGroupX,+ fileModeX,+ fileIDX,+ fileSizeX,+ fileBlocksX,+ accessTimeHiResX,+ creationTimeHiResX,+ statusChangeTimeHiResX,+ modificationTimeHiResX,+ deviceIDX,+ specialDeviceIDX,+ mountIDX,+ fileCompressedX,+ fileImmutableX,+ fileAppendX,+ fileNoDumpX,+ fileEncryptedX,+ fileVerityX,+ fileDaxX,+ isBlockDeviceX,+ isCharacterDeviceX,+ isNamedPipeX,+ isRegularFileX,+ isDirectoryX,+ isSymbolicLinkX,+ isSocketX,++ -- * Creation+ createNamedPipe,+ createDevice,++ -- * Hard links+ createLink, removeLink,++ -- * Symbolic links+ createSymbolicLink, readSymbolicLink,++ -- * Renaming files+ rename,++ -- * Changing file ownership+ setOwnerAndGroup, setFdOwnerAndGroup,+#if HAVE_LCHOWN+ setSymbolicLinkOwnerAndGroup,+#endif++ -- * Changing file timestamps+ setFileTimes, setFileTimesHiRes,+ setSymbolicLinkTimesHiRes,+ touchFile, touchFd, touchSymbolicLink,++ -- * Setting file sizes+ setFileSize, setFdSize,++ -- * Find system-specific limits for a file+ PathVar(..), getPathVar, getFdPathVar,+ ) where++import System.Posix.Types+import System.Posix.Internals hiding (withFilePath, peekFilePathLen)+import qualified System.Posix.Files.Common as Common+import Foreign+import Foreign.C hiding (+ throwErrnoPath,+ throwErrnoPathIf,+ throwErrnoPathIf_,+ throwErrnoPathIfNull,+ throwErrnoPathIfMinus1,+ throwErrnoPathIfMinus1_ )++import System.OsPath.Types+import System.Posix.Files hiding (getFileStatus, getExtendedFileStatus, getSymbolicLinkStatus, createNamedPipe, createDevice, createLink, removeLink, createSymbolicLink, readSymbolicLink, rename, setOwnerAndGroup, setSymbolicLinkOwnerAndGroup, setFileTimes, setSymbolicLinkTimesHiRes, touchFile, touchSymbolicLink, setFileSize, getPathVar, setFileMode, fileAccess, fileExist, setFdTimesHiRes, setFileTimesHiRes)+import System.Posix.Files.Common (getExtendedFileStatus_)+import System.Posix.PosixPath.FilePath++import Data.Time.Clock.POSIX (POSIXTime)++#if !defined(HAVE_MKNOD) || !defined(HAVE_CHOWN)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif++-- -----------------------------------------------------------------------------+-- chmod()++-- | @setFileMode path mode@ changes permission of the file given by @path@+-- to @mode@. This operation may fail with 'throwErrnoPathIfMinus1_' if @path@+-- doesn't exist or if the effective user ID of the current process is not that+-- of the file's owner.+--+-- Note: calls @chmod@.+setFileMode :: PosixPath -> FileMode -> IO ()+setFileMode name m =+ withFilePath name $ \s -> do+ throwErrnoPathIfMinus1_ "setFileMode" name (c_chmod s m)+++-- -----------------------------------------------------------------------------+-- access()++-- | @fileAccess name read write exec@ checks if the file (or other file system+-- object) @name@ can be accessed for reading, writing and\/or executing. To+-- check a permission set the corresponding argument to 'True'.+--+-- Note: calls @access@.+fileAccess :: PosixPath -> Bool -> Bool -> Bool -> IO Bool+fileAccess name readOK writeOK execOK = access name flags+ where+ flags = read_f .|. write_f .|. exec_f+ read_f = if readOK then (#const R_OK) else 0+ write_f = if writeOK then (#const W_OK) else 0+ exec_f = if execOK then (#const X_OK) else 0++-- | Checks for the existence of the file.+--+-- Note: calls @access@.+fileExist :: PosixPath -> IO Bool+fileExist name =+ withFilePath name $ \s -> do+ r <- c_access s (#const F_OK)+ if (r == 0)+ then return True+ else do err <- getErrno+ if (err == eNOENT)+ then return False+ else throwErrnoPath "fileExist" name++access :: PosixPath -> CMode -> IO Bool+access name flags =+ withFilePath name $ \s -> do+ r <- c_access s (fromIntegral flags)+ if (r == 0)+ then return True+ else do err <- getErrno+ if (err == eACCES || err == eROFS || err == eTXTBSY ||+ err == ePERM)+ then return False+ else throwErrnoPath "fileAccess" name+++-- | @getFileStatus path@ calls gets the @FileStatus@ information (user ID,+-- size, access times, etc.) for the file @path@.+--+-- Note: calls @stat@.+getFileStatus :: PosixPath -> IO FileStatus+getFileStatus path = do+ fp <- mallocForeignPtrBytes (#const sizeof(struct stat))+ withForeignPtr fp $ \p ->+ withFilePath path $ \s ->+ throwErrnoPathIfMinus1Retry_ "getFileStatus" path (c_stat s p)+ return (Common.FileStatus fp)++-- | Gets extended file status information.+--+-- The target file to open is identified in one of the following ways:+--+-- - If @pathname@ begins with a slash, then it is an absolute pathname that identifies the target file. In this case, @dirfd@ is ignored+-- - If @pathname@ is a string that begins with a character other than a slash and @dirfd@ is a file descriptor that refers to a+-- directory, then pathname is a relative pathname that is interpreted relative to the directory referred to by dirfd.+-- (See @openat(2)@ for an explanation of why this is useful.)+-- - If @pathname@ is an empty string and the 'EmptyPath' flag is specified in flags (see below), then the target file is+-- the one referred to by the file descriptor @dirfd@.+--+-- Note: calls @statx@.+getExtendedFileStatus :: Maybe Fd -- ^ Optional directory file descriptor (@dirfd@)+ -> PosixPath -- ^ @pathname@ to open+ -> StatxFlags -- ^ flags+ -> StatxMask -- ^ mask+ -> IO ExtendedFileStatus+getExtendedFileStatus mfd path flags masks = withFilePath path $ \s -> getExtendedFileStatus_ mfd s flags masks++-- | Acts as 'getFileStatus' except when the 'PosixPath' refers to a symbolic+-- link. In that case the @FileStatus@ information of the symbolic link itself+-- is returned instead of that of the file it points to.+--+-- Note: calls @lstat@.+getSymbolicLinkStatus :: PosixPath -> IO FileStatus+getSymbolicLinkStatus path = do+ fp <- mallocForeignPtrBytes (#const sizeof(struct stat))+ withForeignPtr fp $ \p ->+ withFilePath path $ \s ->+ throwErrnoPathIfMinus1_ "getSymbolicLinkStatus" path (c_lstat s p)+ return (Common.FileStatus fp)++foreign import capi unsafe "HsUnix.h lstat"+ c_lstat :: CString -> Ptr CStat -> IO CInt++-- | @createNamedPipe fifo mode@+-- creates a new named pipe, @fifo@, with permissions based on+-- @mode@. May fail with 'throwErrnoPathIfMinus1_' if a file named @name@+-- already exists or if the effective user ID of the current process doesn't+-- have permission to create the pipe.+--+-- Note: calls @mkfifo@.+createNamedPipe :: PosixPath -> FileMode -> IO ()+createNamedPipe name mode = do+ withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "createNamedPipe" name (c_mkfifo s mode)++#if !defined(HAVE_MKNOD)++{-# WARNING createDevice "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_MKNOD@)" #-}+createDevice :: PosixPath -> FileMode -> DeviceID -> IO ()+createDevice _ _ _ = ioError (ioeSetLocation unsupportedOperation "createDevice")++#else+-- | @createDevice path mode dev@ creates either a regular or a special file+-- depending on the value of @mode@ (and @dev@). @mode@ will normally be either+-- 'blockSpecialMode' or 'characterSpecialMode'. May fail with+-- 'throwErrnoPathIfMinus1_' if a file named @name@ already exists or if the+-- effective user ID of the current process doesn't have permission to create+-- the file.+--+-- Note: calls @mknod@.+createDevice :: PosixPath -> FileMode -> DeviceID -> IO ()+createDevice path mode dev =+ withFilePath path $ \s ->+ throwErrnoPathIfMinus1_ "createDevice" path (c_mknod s mode dev)++foreign import capi unsafe "HsUnix.h mknod"+ c_mknod :: CString -> CMode -> CDev -> IO CInt++#endif // HAVE_MKNOD++-- -----------------------------------------------------------------------------+-- Hard links++-- | @createLink old new@ creates a new path, @new@, linked to an existing file,+-- @old@.+--+-- Note: calls @link@.+createLink :: PosixPath -> PosixPath -> IO ()+createLink name1 name2 =+ withFilePath name1 $ \s1 ->+ withFilePath name2 $ \s2 ->+ throwErrnoTwoPathsIfMinus1_ "createLink" name1 name2 (c_link s1 s2)++-- | @removeLink path@ removes the link named @path@.+--+-- Note: calls @unlink@.+removeLink :: PosixPath -> IO ()+removeLink name =+ withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "removeLink" name (c_unlink s)++-- -----------------------------------------------------------------------------+-- Symbolic Links++-- | @createSymbolicLink file1 file2@ creates a symbolic link named @file2@+-- which points to the file @file1@.+--+-- Symbolic links are interpreted at run-time as if the contents of the link+-- had been substituted into the path being followed to find a file or directory.+--+-- Note: calls @symlink@.+createSymbolicLink :: PosixPath -> PosixPath -> IO ()+createSymbolicLink name1 name2 =+ withFilePath name1 $ \s1 ->+ withFilePath name2 $ \s2 ->+ throwErrnoTwoPathsIfMinus1_ "createSymbolicLink" name1 name2 (c_symlink s1 s2)++foreign import ccall unsafe "symlink"+ c_symlink :: CString -> CString -> IO CInt++-- ToDo: should really use SYMLINK_MAX, but not everyone supports it yet,+-- and it seems that the intention is that SYMLINK_MAX is no larger than+-- PATH_MAX.+#if !defined(PATH_MAX)+-- PATH_MAX is not defined on systems with unlimited path length.+-- Ugly. Fix this.+#define PATH_MAX 4096+#endif++-- | Reads the @PosixPath@ pointed to by the symbolic link and returns it.+--+-- Note: calls @readlink@.+readSymbolicLink :: PosixPath -> IO PosixPath+readSymbolicLink file =+ allocaArray0 (#const PATH_MAX) $ \buf -> do+ withFilePath file $ \s -> do+ len <- throwErrnoPathIfMinus1 "readSymbolicLink" file $+ c_readlink s buf (#const PATH_MAX)+ peekFilePathLen (buf,fromIntegral len)++foreign import ccall unsafe "readlink"+ c_readlink :: CString -> CString -> CSize -> IO CInt++-- -----------------------------------------------------------------------------+-- Renaming files++-- | @rename old new@ renames a file or directory from @old@ to @new@.+--+-- Note: calls @rename@.+rename :: PosixPath -> PosixPath -> IO ()+rename name1 name2 =+ withFilePath name1 $ \s1 ->+ withFilePath name2 $ \s2 ->+ throwErrnoTwoPathsIfMinus1_ "rename" name1 name2 (c_rename s1 s2)++foreign import ccall unsafe "rename"+ c_rename :: CString -> CString -> IO CInt++-- -----------------------------------------------------------------------------+-- chown()++#if defined(HAVE_CHOWN)++-- | @setOwnerAndGroup path uid gid@ changes the owner and group of @path@ to+-- @uid@ and @gid@, respectively.+--+-- If @uid@ or @gid@ is specified as -1, then that ID is not changed.+--+-- Note: calls @chown@.+setOwnerAndGroup :: PosixPath -> UserID -> GroupID -> IO ()+setOwnerAndGroup name uid gid = do+ withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "setOwnerAndGroup" name (c_chown s uid gid)++foreign import ccall unsafe "chown"+ c_chown :: CString -> CUid -> CGid -> IO CInt++#else++{-# WARNING setOwnerAndGroup "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_CHOWN@)" #-}+setOwnerAndGroup :: PosixPath -> UserID -> GroupID -> IO ()+setOwnerAndGroup _ _ _ = ioError (ioeSetLocation unsupportedOperation "setOwnerAndGroup")++#endif // HAVE_CHOWN++#if HAVE_LCHOWN+-- | Acts as 'setOwnerAndGroup' but does not follow symlinks (and thus+-- changes permissions on the link itself).+--+-- Note: calls @lchown@.+setSymbolicLinkOwnerAndGroup :: PosixPath -> UserID -> GroupID -> IO ()+setSymbolicLinkOwnerAndGroup name uid gid = do+ withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "setSymbolicLinkOwnerAndGroup" name+ (c_lchown s uid gid)++foreign import ccall unsafe "lchown"+ c_lchown :: CString -> CUid -> CGid -> IO CInt+#endif++-- -----------------------------------------------------------------------------+-- Setting file times++-- | @setFileTimes path atime mtime@ sets the access and modification times+-- associated with file @path@ to @atime@ and @mtime@, respectively.+--+-- Note: calls @utime@.+setFileTimes :: PosixPath -> EpochTime -> EpochTime -> IO ()+setFileTimes name atime mtime = do+ withFilePath name $ \s ->+ allocaBytes (#const sizeof(struct utimbuf)) $ \p -> do+ (#poke struct utimbuf, actime) p atime+ (#poke struct utimbuf, modtime) p mtime+ throwErrnoPathIfMinus1_ "setFileTimes" name (c_utime s p)++-- | Like 'setFileTimes' but timestamps can have sub-second resolution.+--+-- Note: calls @utimensat@ or @utimes@. Support for high resolution timestamps+-- is filesystem dependent with the following limitations:+--+-- - HFS+ volumes on OS X truncate the sub-second part of the timestamp.+--+setFileTimesHiRes :: PosixPath -> POSIXTime -> POSIXTime -> IO ()+#if defined(javascript_HOST_ARCH)+setFileTimesHiRes name atime mtime =+ withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "setFileTimesHiRes" name $+ Common.js_utimes s (realToFrac atime) (realToFrac mtime)+#elif defined(HAVE_UTIMENSAT)+setFileTimesHiRes name atime mtime =+ withFilePath name $ \s ->+ withArray [Common.toCTimeSpec atime, Common.toCTimeSpec mtime] $ \times ->+ throwErrnoPathIfMinus1_ "setFileTimesHiRes" name $+ Common.c_utimensat (#const AT_FDCWD) s times 0+#else+setFileTimesHiRes name atime mtime =+ withFilePath name $ \s ->+ withArray [Common.toCTimeVal atime, Common.toCTimeVal mtime] $ \times ->+ throwErrnoPathIfMinus1_ "setFileTimesHiRes" name (Common.c_utimes s times)+#endif++-- | Like 'setFileTimesHiRes' but does not follow symbolic links.+-- This operation is not supported on all platforms. On these platforms,+-- this function will raise an exception.+--+-- Note: calls @utimensat@ or @lutimes@. Support for high resolution timestamps+-- is filesystem dependent with the following limitations:+--+-- - HFS+ volumes on OS X truncate the sub-second part of the timestamp.+--+setSymbolicLinkTimesHiRes :: PosixPath -> POSIXTime -> POSIXTime -> IO ()+#if HAVE_UTIMENSAT+setSymbolicLinkTimesHiRes name atime mtime =+ withFilePath name $ \s ->+ withArray [Common.toCTimeSpec atime, Common.toCTimeSpec mtime] $ \times ->+ throwErrnoPathIfMinus1_ "setSymbolicLinkTimesHiRes" name $+ Common.c_utimensat (#const AT_FDCWD) s times (#const AT_SYMLINK_NOFOLLOW)+#elif HAVE_LUTIMES+setSymbolicLinkTimesHiRes name atime mtime =+ withFilePath name $ \s ->+ withArray [Common.toCTimeVal atime, Common.toCTimeVal mtime] $ \times ->+ throwErrnoPathIfMinus1_ "setSymbolicLinkTimesHiRes" name $+ Common.c_lutimes s times+#else+setSymbolicLinkTimesHiRes =+ error "setSymbolicLinkTimesHiRes: not available on this platform"+#endif++-- | @touchFile path@ sets the access and modification times associated with+-- file @path@ to the current time.+--+-- Note: calls @utime@.+touchFile :: PosixPath -> IO ()+touchFile name = do+ withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "touchFile" name (c_utime s nullPtr)++-- | Like 'touchFile' but does not follow symbolic links.+-- This operation is not supported on all platforms. On these platforms,+-- this function will raise an exception.+--+-- Note: calls @lutimes@.+touchSymbolicLink :: PosixPath -> IO ()+#if HAVE_LUTIMES+touchSymbolicLink name =+ withFilePath name $ \s ->+ throwErrnoPathIfMinus1_ "touchSymbolicLink" name (Common.c_lutimes s nullPtr)+#else+touchSymbolicLink =+ error "touchSymbolicLink: not available on this platform"+#endif++-- -----------------------------------------------------------------------------+-- Setting file sizes++-- | Truncates the file down to the specified length. If the file was larger+-- than the given length before this operation was performed the extra is lost.+--+-- Note: calls @truncate@.+setFileSize :: PosixPath -> FileOffset -> IO ()+setFileSize file off =+ withFilePath file $ \s ->+ throwErrnoPathIfMinus1_ "setFileSize" file (c_truncate s off)++foreign import capi unsafe "HsUnix.h truncate"+ c_truncate :: CString -> COff -> IO CInt++-- -----------------------------------------------------------------------------+-- pathconf()/fpathconf() support++-- | @getPathVar var path@ obtains the dynamic value of the requested+-- configurable file limit or option associated with file or directory @path@.+-- For defined file limits, @getPathVar@ returns the associated+-- value. For defined file options, the result of @getPathVar@+-- is undefined, but not failure.+--+-- Note: calls @pathconf@.+getPathVar :: PosixPath -> PathVar -> IO Limit+getPathVar name v = do+ withFilePath name $ \ nameP ->+ throwErrnoPathIfMinus1 "getPathVar" name $+ c_pathconf nameP (Common.pathVarConst v)++foreign import ccall unsafe "pathconf"+ c_pathconf :: CString -> CInt -> IO CLong
System/Posix/IO.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.IO@@ -31,7 +27,7 @@ -- ** Opening and closing files OpenMode(..), OpenFileFlags(..), defaultFileFlags,- openFd, createFile,+ openFd, openFdAt, createFile, createFileAt, closeFd, -- ** Reading\/writing data@@ -67,6 +63,13 @@ ) where +import Foreign ( allocaBytes, castPtr )+import Foreign.C ( peekCStringLen, withCStringLen )++import GHC.IO.Exception ( IOErrorType(EOF) )++import System.IO.Error ( ioeSetErrorString, mkIOError )+ import System.Posix.Types import System.Posix.Error import System.Posix.IO.Common@@ -76,18 +79,65 @@ -- for information on how to use the 'FileMode' type. openFd :: FilePath -> OpenMode- -> Maybe FileMode -- ^Just x => creates the file with the given modes, Nothing => the file must exist. -> OpenFileFlags -> IO Fd-openFd name how maybe_mode flags = do- withFilePath name $ \str -> do- throwErrnoPathIfMinus1Retry "openFd" name $- open_ str how maybe_mode flags+openFd = openFdAt Nothing +-- | Open a file relative to an optional directory file descriptor.+--+-- Directory file descriptors can be used to avoid some race conditions when+-- navigating changing directory trees, or to retain access to a portion of the+-- directory tree that would otherwise become inaccessible after dropping+-- privileges.+openFdAt :: Maybe Fd -- ^ Optional directory file descriptor+ -> FilePath -- ^ Pathname to open+ -> OpenMode -- ^ Read-only, read-write or write-only+ -> OpenFileFlags -- ^ Append, exclusive, truncate, etc.+ -> IO Fd+openFdAt fdMay name how flags =+ withFilePath name $ \str ->+ throwErrnoPathIfMinus1Retry "openFdAt" name $+ openat_ fdMay str how flags+ -- |Create and open this file in WriteOnly mode. A special case of -- 'openFd'. See 'System.Posix.Files' for information on how to use -- the 'FileMode' type.- createFile :: FilePath -> FileMode -> IO Fd-createFile name mode- = openFd name WriteOnly (Just mode) defaultFileFlags{ trunc=True }+createFile = createFileAt Nothing++-- | Create and open a file for write-only, with default flags,+-- relative an optional directory file-descriptor.+--+-- Directory file descriptors can be used to avoid some race conditions when+-- navigating changing directory trees, or to retain access to a portion of the+-- directory tree that would otherwise become inaccessible after dropping+-- privileges.+createFileAt :: Maybe Fd -- ^ Optional directory file descriptor+ -> FilePath -- ^ Pathname to create+ -> FileMode -- ^ File permission bits (before umask)+ -> IO Fd+createFileAt fdMay name mode+ = openFdAt fdMay name WriteOnly defaultFileFlags{ trunc=True, creat=(Just mode) }++{-# DEPRECATED fdRead "This function is scheduled to be dropped in favor of 'System.Posix.IO.ByteString.fdRead', because decoding e.g. UTF-8 streams partially is unsafe." #-} -- deprecated in 2.8.0.0+-- | Read data from an 'Fd' and convert it to a 'String' using the locale encoding.+-- Throws an exception if this is an invalid descriptor, or EOF has been+-- reached.+fdRead :: Fd+ -> ByteCount -- ^How many bytes to read+ -> IO (String, ByteCount) -- ^The bytes read, how many bytes were read.+fdRead _fd 0 = return ("", 0)+fdRead fd nbytes =+ allocaBytes (fromIntegral nbytes) $ \ buf -> do+ rc <- fdReadBuf fd buf nbytes+ case rc of+ 0 -> ioError (ioeSetErrorString (mkIOError EOF "fdRead" Nothing Nothing) "EOF")+ n -> do+ s <- peekCStringLen (castPtr buf, fromIntegral n)+ return (s, n)++-- | Write a 'String' to an 'Fd' using the locale encoding.+fdWrite :: Fd -> String -> IO ByteCount+fdWrite fd str =+ withCStringLen str $ \ (buf,len) ->+ fdWriteBuf fd (castPtr buf) (fromIntegral len)
System/Posix/IO/ByteString.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709-{-# LANGUAGE Safe #-}-#else {-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.IO.ByteString@@ -31,7 +27,7 @@ -- ** Opening and closing files OpenMode(..), OpenFileFlags(..), defaultFileFlags,- openFd, createFile,+ openFd, openFdAt, createFile, createFileAt, closeFd, -- ** Reading\/writing data@@ -67,6 +63,16 @@ ) where +import Data.ByteString ( ByteString, empty )+import qualified Data.ByteString.Internal as BI+import qualified Data.ByteString.Unsafe as BU++import Foreign ( castPtr )++import GHC.IO.Exception ( IOErrorType(EOF) )++import System.IO.Error ( ioeSetErrorString, mkIOError )+ import System.Posix.Types import System.Posix.IO.Common @@ -76,18 +82,62 @@ -- for information on how to use the 'FileMode' type. openFd :: RawFilePath -> OpenMode- -> Maybe FileMode -- ^Just x => creates the file with the given modes, Nothing => the file must exist. -> OpenFileFlags -> IO Fd-openFd name how maybe_mode flags = do- withFilePath name $ \str -> do- throwErrnoPathIfMinus1Retry "openFd" name $- open_ str how maybe_mode flags+openFd = openFdAt Nothing +-- | Open a file relative to an optional directory file descriptor.+--+-- Directory file descriptors can be used to avoid some race conditions when+-- navigating changing directory trees, or to retain access to a portion of the+-- directory tree that would otherwise become inaccessible after dropping+-- privileges.+openFdAt :: Maybe Fd -- ^ Optional directory file descriptor+ -> RawFilePath -- ^ Pathname to open+ -> OpenMode -- ^ Read-only, read-write or write-only+ -> OpenFileFlags -- ^ Append, exclusive, truncate, etc.+ -> IO Fd+openFdAt fdMay name how flags =+ withFilePath name $ \str ->+ throwErrnoPathIfMinus1Retry "openFdAt" name $+ openat_ fdMay str how flags+ -- |Create and open this file in WriteOnly mode. A special case of -- 'openFd'. See 'System.Posix.Files' for information on how to use -- the 'FileMode' type.- createFile :: RawFilePath -> FileMode -> IO Fd-createFile name mode- = openFd name WriteOnly (Just mode) defaultFileFlags{ trunc=True }+createFile = createFileAt Nothing++-- | Create and open a file for write-only, with default flags,+-- relative an optional directory file-descriptor.+--+-- Directory file descriptors can be used to avoid some race conditions when+-- navigating changing directory trees, or to retain access to a portion of the+-- directory tree that would otherwise become inaccessible after dropping+-- privileges.+createFileAt :: Maybe Fd -- ^ Optional directory file descriptor+ -> RawFilePath -- ^ Pathname to create+ -> FileMode -- ^ File permission bits (before umask)+ -> IO Fd+createFileAt fdMay name mode+ = openFdAt fdMay name WriteOnly defaultFileFlags{ trunc=True, creat=(Just mode) }++-- | Read data from an 'Fd' and return it as a 'ByteString'.+-- Throws an exception if this is an invalid descriptor, or EOF has been+-- reached.+fdRead :: Fd+ -> ByteCount -- ^How many bytes to read+ -> IO ByteString -- ^The bytes read+fdRead _fd 0 = return empty+fdRead fd nbytes =+ BI.createUptoN (fromIntegral nbytes) $ \ buf -> do+ rc <- fdReadBuf fd buf nbytes+ case rc of+ 0 -> ioError (ioeSetErrorString (mkIOError EOF "fdRead" Nothing Nothing) "EOF")+ n -> return (fromIntegral n)++-- | Write a 'ByteString' to an 'Fd'.+fdWrite :: Fd -> ByteString -> IO ByteCount+fdWrite fd bs =+ BU.unsafeUseAsCStringLen bs $ \ (buf,len) ->+ fdWriteBuf fd (castPtr buf) (fromIntegral len)
System/Posix/IO/Common.hsc view
@@ -1,11 +1,7 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-} {-# LANGUAGE RecordWildCards #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- |@@ -28,14 +24,13 @@ -- ** Opening and closing files OpenMode(..), OpenFileFlags(..), defaultFileFlags,- open_,+ openat_, closeFd, -- ** Reading\/writing data -- |Programmers using the 'fdRead' and 'fdWrite' API should be aware that -- EAGAIN exceptions may occur for non-blocking IO! - fdRead, fdWrite, fdReadBuf, fdWriteBuf, -- ** Seeking@@ -79,8 +74,22 @@ import GHC.IO.Exception import Data.Typeable (cast) +#if !defined(HAVE_PIPE)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif+ #include "HsUnix.h" +#if !defined(HAVE_PIPE)++createPipe :: IO (Fd, Fd)+{-# WARNING createPipe+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PIPE@)" #-}+createPipe = ioError (ioeSetLocation unsupportedOperation "createPipe")++#else+ -- ----------------------------------------------------------------------------- -- Pipes -- |The 'createPipe' function creates a pair of connected file@@ -101,6 +110,22 @@ foreign import ccall unsafe "pipe" c_pipe :: Ptr CInt -> IO CInt +#endif // HAVE_PIPE++#if !defined(HAVE_DUP)++dup :: Fd -> IO Fd+{-# WARNING dup+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_DUP@)" #-}+dup _ = ioError (ioeSetLocation unsupportedOperation "dup")++dupTo :: Fd -> Fd -> IO Fd+{-# WARNING dupTo+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_DUP@)" #-}+dupTo _ _ = ioError (ioeSetLocation unsupportedOperation "dupTo")++#else+ -- ----------------------------------------------------------------------------- -- Duplicating file descriptors @@ -120,6 +145,8 @@ foreign import ccall unsafe "dup2" c_dup2 :: CInt -> CInt -> IO CInt +#endif // HAVE_DUP+ -- ----------------------------------------------------------------------------- -- Opening and closing files @@ -129,20 +156,41 @@ stdError = Fd (#const STDERR_FILENO) data OpenMode = ReadOnly | WriteOnly | ReadWrite+ deriving (Read, Show, Eq, Ord) -- |Correspond to some of the int flags from C's fcntl.h. data OpenFileFlags = OpenFileFlags {- append :: Bool, -- ^ O_APPEND- exclusive :: Bool, -- ^ O_EXCL- noctty :: Bool, -- ^ O_NOCTTY- nonBlock :: Bool, -- ^ O_NONBLOCK- trunc :: Bool -- ^ O_TRUNC+ append :: Bool, -- ^ O_APPEND+ exclusive :: Bool, -- ^ O_EXCL, result is undefined if O_CREAT is False+ --+ -- __NOTE__: Result is undefined if 'creat' is 'Nothing'.+ noctty :: Bool, -- ^ O_NOCTTY+ nonBlock :: Bool, -- ^ O_NONBLOCK+ trunc :: Bool, -- ^ O_TRUNC+ nofollow :: Bool, -- ^ O_NOFOLLOW+ --+ -- @since 2.8.0.0+ creat :: Maybe FileMode, -- ^ O_CREAT+ --+ -- @since 2.8.0.0+ cloexec :: Bool, -- ^ O_CLOEXEC+ --+ -- @since 2.8.0.0+ directory :: Bool, -- ^ O_DIRECTORY+ --+ -- @since 2.8.0.0+ sync :: Bool -- ^ O_SYNC+ --+ -- @since 2.8.0.0 }+ deriving (Read, Show, Eq, Ord) --- |Default values for the 'OpenFileFlags' type. False for each of--- append, exclusive, noctty, nonBlock, and trunc.+-- | Default values for the 'OpenFileFlags' type.+--+-- Each field of 'OpenFileFlags' is either 'False' or 'Nothing'+-- respectively. defaultFileFlags :: OpenFileFlags defaultFileFlags = OpenFileFlags {@@ -150,48 +198,71 @@ exclusive = False, noctty = False, nonBlock = False,- trunc = False+ trunc = False,+ nofollow = False,+ creat = Nothing,+ cloexec = False,+ directory = False,+ sync = False } --- |Open and optionally create this file. See 'System.Posix.Files'--- for information on how to use the 'FileMode' type.-open_ :: CString- -> OpenMode- -> Maybe FileMode -- ^Just x => creates the file with the given modes, Nothing => the file must exist.- -> OpenFileFlags- -> IO Fd-open_ str how maybe_mode (OpenFileFlags appendFlag exclusiveFlag nocttyFlag- nonBlockFlag truncateFlag) = do- fd <- c_open str all_flags mode_w- return (Fd fd)+-- |Open and optionally create a file relative to an optional+-- directory file descriptor.+openat_ :: Maybe Fd -- ^ Optional directory file descriptor+ -> CString -- ^ Pathname to open+ -> OpenMode -- ^ Read-only, read-write or write-only+ -> OpenFileFlags -- ^ Append, exclusive, etc.+ -> IO Fd+openat_ fdMay str how (OpenFileFlags appendFlag exclusiveFlag nocttyFlag+ nonBlockFlag truncateFlag nofollowFlag+ creatFlag cloexecFlag directoryFlag+ syncFlag) =+ Fd <$> c_openat c_fd str all_flags mode_w where+ c_fd = maybe (#const AT_FDCWD) (\ (Fd fd) -> fd) fdMay all_flags = creat .|. flags .|. open_mode + -- We have to use Base.o_* instead of raw #const O_*+ -- due of the fact target platforms at stage1 could have+ -- them overridden.+ -- For example GHC JS Backend provides its own constants+ -- which should be used at the target of cross compilation+ -- into Node.JS environment. flags =- (if appendFlag then (#const O_APPEND) else 0) .|.- (if exclusiveFlag then (#const O_EXCL) else 0) .|.- (if nocttyFlag then (#const O_NOCTTY) else 0) .|.- (if nonBlockFlag then (#const O_NONBLOCK) else 0) .|.- (if truncateFlag then (#const O_TRUNC) else 0)+ (if appendFlag then (Base.o_APPEND) else 0) .|.+ (if exclusiveFlag then (Base.o_EXCL) else 0) .|.+ (if nocttyFlag then (Base.o_NOCTTY) else 0) .|.+ (if nonBlockFlag then (Base.o_NONBLOCK) else 0) .|.+ (if truncateFlag then (Base.o_TRUNC) else 0) .|.+ (if nofollowFlag then (#const O_NOFOLLOW) else 0) .|.+ (if cloexecFlag then (#const O_CLOEXEC) else 0) .|.+ (if directoryFlag then (#const O_DIRECTORY) else 0) .|.+ (if syncFlag then (#const O_SYNC) else 0) - (creat, mode_w) = case maybe_mode of+ (creat, mode_w) = case creatFlag of Nothing -> (0,0)- Just x -> ((#const O_CREAT), x)+ Just x -> ((Base.o_CREAT), x) open_mode = case how of- ReadOnly -> (#const O_RDONLY)- WriteOnly -> (#const O_WRONLY)- ReadWrite -> (#const O_RDWR)+ ReadOnly -> (Base.o_RDONLY)+ WriteOnly -> (Base.o_WRONLY)+ ReadWrite -> (Base.o_RDWR) -foreign import capi unsafe "HsUnix.h open"- c_open :: CString -> CInt -> CMode -> IO CInt+foreign import capi unsafe "HsUnix.h openat"+ c_openat :: CInt -> CString -> CInt -> CMode -> IO CInt -- |Close this file descriptor. May throw an exception if this is an -- invalid descriptor. closeFd :: Fd -> IO () closeFd (Fd fd) = throwErrnoIfMinus1_ "closeFd" (c_close fd)+-- Here we don't to retry on EINTR because according to+-- http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html+-- "with errno set to [EINTR] [...] the state of fildes is unspecified"+-- and on Linux, already the first close() removes the FD from the process's+-- FD table so closing a second time is invalid+-- (see http://man7.org/linux/man-pages/man2/close.2.html#NOTES). foreign import ccall unsafe "HsUnix.h close" c_close :: CInt -> IO CInt@@ -200,7 +271,15 @@ -- Converting file descriptors to/from Handles -- | Extracts the 'Fd' from a 'Handle'. This function has the side effect--- of closing the 'Handle' and flushing its write buffer, if necessary.+-- of closing the 'Handle' (and flushing its write buffer, if necessary),+-- without closing the underlying 'Fd'.+--+-- __Warning:__ This means you take over ownership of the underlying 'Fd'.+-- 'hClose` on the 'Handle' will no longer have any effect.+-- This will break common patterns to avoid file descriptor leaks,+-- such as using 'hClose' in the cleanup action of @Control.Exception.bracket@,+-- making it a silent no-op.+-- Be sure to close the returned 'Fd' yourself to not leak it. handleToFd :: Handle -> IO Fd -- | Converts an 'Fd' into a 'Handle' that can be used with the@@ -242,8 +321,8 @@ fdOption2Int :: FdOption -> CInt fdOption2Int CloseOnExec = (#const FD_CLOEXEC)-fdOption2Int AppendOnWrite = (#const O_APPEND)-fdOption2Int NonBlockingRead = (#const O_NONBLOCK)+fdOption2Int AppendOnWrite = (Base.o_APPEND)+fdOption2Int NonBlockingRead = (Base.o_NONBLOCK) fdOption2Int SynchronousWrites = (#const O_SYNC) -- | May throw an exception if this is an invalid descriptor.@@ -292,6 +371,25 @@ type FileLock = (LockRequest, SeekMode, FileOffset, FileOffset) +#if !defined(HAVE_F_GETLK)++getLock :: Fd -> FileLock -> IO (Maybe (ProcessID, FileLock))+{-# WARNING getLock+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_F_GETLK@)" #-}+getLock _ _ = ioError (ioeSetLocation unsupportedOperation "getLock")++setLock :: Fd -> FileLock -> IO ()+{-# WARNING setLock+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_F_GETLK@)" #-}+setLock _ _ = ioError (ioeSetLocation unsupportedOperation "setLock")++waitToSetLock :: Fd -> FileLock -> IO ()+{-# WARNING waitToSetLock+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_F_GETLK@)" #-}+waitToSetLock _ _ = ioError (ioeSetLocation unsupportedOperation "waitToSetLock")++#else+ -- | May throw an exception if this is an invalid descriptor. getLock :: Fd -> FileLock -> IO (Maybe (ProcessID, FileLock)) getLock (Fd fd) lock =@@ -351,24 +449,10 @@ throwErrnoIfMinus1_ "waitToSetLock" (Base.c_fcntl_lock fd (#const F_SETLKW) p_flock) --- -------------------------------------------------------------------------------- fd{Read,Write}+#endif // HAVE_F_GETLK --- | Read data from an 'Fd' and convert it to a 'String' using the locale encoding.--- Throws an exception if this is an invalid descriptor, or EOF has been--- reached.-fdRead :: Fd- -> ByteCount -- ^How many bytes to read- -> IO (String, ByteCount) -- ^The bytes read, how many bytes were read.-fdRead _fd 0 = return ("", 0)-fdRead fd nbytes = do- allocaBytes (fromIntegral nbytes) $ \ buf -> do- rc <- fdReadBuf fd buf nbytes- case rc of- 0 -> ioError (ioeSetErrorString (mkIOError EOF "fdRead" Nothing Nothing) "EOF")- n -> do- s <- peekCStringLen (castPtr buf, fromIntegral n)- return (s, n)+-- -----------------------------------------------------------------------------+-- fd{Read,Write}Buf -- | Read data from an 'Fd' into memory. This is exactly equivalent -- to the POSIX @read@ function.@@ -384,12 +468,6 @@ foreign import ccall safe "read" c_safe_read :: CInt -> Ptr CChar -> CSize -> IO CSsize---- | Write a 'String' to an 'Fd' using the locale encoding.-fdWrite :: Fd -> String -> IO ByteCount-fdWrite fd str =- withCStringLen str $ \ (buf,len) ->- fdWriteBuf fd (castPtr buf) (fromIntegral len) -- | Write data from memory to an 'Fd'. This is exactly equivalent -- to the POSIX @write@ function.
+ System/Posix/IO/PosixString.hsc view
@@ -0,0 +1,116 @@+-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.IO.PosixString+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- POSIX IO support. These types and functions correspond to the unix+-- functions open(2), close(2), etc. For more portable functions+-- which are more like fopen(3) and friends from stdio.h, see+-- "System.IO".+--+-----------------------------------------------------------------------------++#include "HsUnix.h"++module System.Posix.IO.PosixString (+ -- * Input \/ Output++ -- ** Standard file descriptors+ stdInput, stdOutput, stdError,++ -- ** Opening and closing files+ OpenMode(..),+ OpenFileFlags(..), defaultFileFlags,+ openFd, openFdAt, createFile, createFileAt,+ closeFd,++ -- ** Reading\/writing data+ -- |Programmers using the 'fdRead' and 'fdWrite' API should be aware that+ -- EAGAIN exceptions may occur for non-blocking IO!++ fdRead, fdWrite,+ fdReadBuf, fdWriteBuf,++ -- ** Seeking+ fdSeek,++ -- ** File options+ FdOption(..),+ queryFdOption,+ setFdOption,++ -- ** Locking+ FileLock,+ LockRequest(..),+ getLock, setLock,+ waitToSetLock,++ -- ** Pipes+ createPipe,++ -- ** Duplicating file descriptors+ dup, dupTo,++ -- ** Converting file descriptors to\/from Handles+ handleToFd,+ fdToHandle,++ ) where++import System.Posix.Types+import System.Posix.IO.Common+import System.Posix.IO.ByteString ( fdRead, fdWrite )+import System.OsPath.Types++import System.Posix.PosixPath.FilePath++++-- |Open and optionally create this file. See 'System.Posix.Files'+-- for information on how to use the 'FileMode' type.+openFd :: PosixPath+ -> OpenMode+ -> OpenFileFlags+ -> IO Fd+openFd = openFdAt Nothing++-- | Open a file relative to an optional directory file descriptor.+--+-- Directory file descriptors can be used to avoid some race conditions when+-- navigating changing directory trees, or to retain access to a portion of the+-- directory tree that would otherwise become inaccessible after dropping+-- privileges.+openFdAt :: Maybe Fd -- ^ Optional directory file descriptor+ -> PosixPath -- ^ Pathname to open+ -> OpenMode -- ^ Read-only, read-write or write-only+ -> OpenFileFlags -- ^ Append, exclusive, truncate, etc.+ -> IO Fd+openFdAt fdMay name how flags =+ withFilePath name $ \str ->+ throwErrnoPathIfMinus1Retry "openFdAt" name $+ openat_ fdMay str how flags++-- |Create and open this file in WriteOnly mode. A special case of+-- 'openFd'. See 'System.Posix.Files' for information on how to use+-- the 'FileMode' type.+createFile :: PosixPath -> FileMode -> IO Fd+createFile = createFileAt Nothing++-- | Create and open a file for write-only, with default flags,+-- relative an optional directory file-descriptor.+--+-- Directory file descriptors can be used to avoid some race conditions when+-- navigating changing directory trees, or to retain access to a portion of the+-- directory tree that would otherwise become inaccessible after dropping+-- privileges.+createFileAt :: Maybe Fd -- ^ Optional directory file descriptor+ -> PosixPath -- ^ Pathname to create+ -> FileMode -- ^ File permission bits (before umask)+ -> IO Fd+createFileAt fdMay name mode+ = openFdAt fdMay name WriteOnly defaultFileFlags{ trunc=True, creat=(Just mode) }
+ System/Posix/PosixPath/FilePath.hsc view
@@ -0,0 +1,172 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE PatternSynonyms #-}+{-# LANGUAGE PackageImports #-}++-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.PosixPath.FilePath+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- Internal stuff: support for ByteString FilePaths+--+-----------------------------------------------------------------------------++module System.Posix.PosixPath.FilePath (+ withFilePath, peekFilePath, peekFilePathLen,+ throwErrnoPathIfMinus1Retry,+ throwErrnoPathIfMinus1Retry_,+ throwErrnoPathIfNullRetry,+ throwErrnoPathIfRetry,+ throwErrnoPath,+ throwErrnoPathIf,+ throwErrnoPathIf_,+ throwErrnoPathIfNull,+ throwErrnoPathIfMinus1,+ throwErrnoPathIfMinus1_,+ throwErrnoTwoPathsIfMinus1_+ ) where++import Foreign hiding ( void )+import Foreign.C hiding (+ throwErrnoPath,+ throwErrnoPathIf,+ throwErrnoPathIf_,+ throwErrnoPathIfNull,+ throwErrnoPathIfMinus1,+ throwErrnoPathIfMinus1_ )++import System.OsPath.Types+import Data.ByteString.Internal (c_strlen)+import Control.Monad+import Control.Exception+import System.OsPath.Posix as PS+#if MIN_VERSION_filepath(1, 5, 0)+import "os-string" System.OsString.Data.ByteString.Short as BSS+#else+import "filepath" System.OsPath.Data.ByteString.Short as BSS+#endif+import Prelude hiding (FilePath)+import System.OsString.Internal.Types (PosixString(..), pattern PS)+import GHC.IO.Exception++#if !MIN_VERSION_base(4, 11, 0)+import Data.Monoid ((<>))+#endif+++withFilePath :: PosixPath -> (CString -> IO a) -> IO a+withFilePath path = useAsCStringSafe path++peekFilePath :: CString -> IO PosixPath+peekFilePath = fmap PosixString . packCString++peekFilePathLen :: CStringLen -> IO PosixPath+peekFilePathLen = fmap PosixString . packCStringLen+++throwErrnoPathIfMinus1Retry :: (Eq a, Num a)+ => String -> PosixPath -> IO a -> IO a+throwErrnoPathIfMinus1Retry loc path f = do+ throwErrnoPathIfRetry (== -1) loc path f++throwErrnoPathIfMinus1Retry_ :: (Eq a, Num a)+ => String -> PosixPath -> IO a -> IO ()+throwErrnoPathIfMinus1Retry_ loc path f =+ void $ throwErrnoPathIfRetry (== -1) loc path f++throwErrnoPathIfNullRetry :: String -> PosixPath -> IO (Ptr a) -> IO (Ptr a)+throwErrnoPathIfNullRetry loc path f =+ throwErrnoPathIfRetry (== nullPtr) loc path f++throwErrnoPathIfRetry :: (a -> Bool) -> String -> PosixPath -> IO a -> IO a+throwErrnoPathIfRetry pr loc rpath f =+ do+ res <- f+ if pr res+ then do+ err <- getErrno+ if err == eINTR+ then throwErrnoPathIfRetry pr loc rpath f+ else throwErrnoPath loc rpath+ else return res++-- | as 'throwErrno', but exceptions include the given path when appropriate.+--+throwErrnoPath :: String -> PosixPath -> IO a+throwErrnoPath loc path =+ do+ errno <- getErrno+ path' <- either (const (_toStr path)) id <$> try @IOException (PS.decodeFS path)+ ioError (errnoToIOError loc errno Nothing (Just path'))++-- | as 'throwErrnoIf', but exceptions include the given path when+-- appropriate.+--+throwErrnoPathIf :: (a -> Bool) -> String -> PosixPath -> IO a -> IO a+throwErrnoPathIf cond loc path f =+ do+ res <- f+ if cond res then throwErrnoPath loc path else return res++-- | as 'throwErrnoIf_', but exceptions include the given path when+-- appropriate.+--+throwErrnoPathIf_ :: (a -> Bool) -> String -> PosixPath -> IO a -> IO ()+throwErrnoPathIf_ cond loc path f = void $ throwErrnoPathIf cond loc path f++-- | as 'throwErrnoIfNull', but exceptions include the given path when+-- appropriate.+--+throwErrnoPathIfNull :: String -> PosixPath -> IO (Ptr a) -> IO (Ptr a)+throwErrnoPathIfNull = throwErrnoPathIf (== nullPtr)++-- | as 'throwErrnoIfMinus1', but exceptions include the given path when+-- appropriate.+--+throwErrnoPathIfMinus1 :: (Eq a, Num a) => String -> PosixPath -> IO a -> IO a+throwErrnoPathIfMinus1 = throwErrnoPathIf (== -1)++-- | as 'throwErrnoIfMinus1_', but exceptions include the given path when+-- appropriate.+--+throwErrnoPathIfMinus1_ :: (Eq a, Num a) => String -> PosixPath -> IO a -> IO ()+throwErrnoPathIfMinus1_ = throwErrnoPathIf_ (== -1)++-- | as 'throwErrnoTwoPathsIfMinus1_', but exceptions include two paths when appropriate.+--+throwErrnoTwoPathsIfMinus1_ :: (Eq a, Num a) => String -> PosixPath -> PosixPath -> IO a -> IO ()+throwErrnoTwoPathsIfMinus1_ loc path1 path2 action = do+ path1' <- either (const (_toStr path1)) id <$> try @IOException (PS.decodeFS path1)+ path2' <- either (const (_toStr path2)) id <$> try @IOException (PS.decodeFS path2)+ throwErrnoIfMinus1_ (loc <> " '" <> path1' <> "' to '" <> path2' <> "'") action++_toStr :: PosixPath -> String+_toStr = fmap PS.toChar . PS.unpack++-- | Wrapper around 'useAsCString', checking the encoded 'FilePath' for internal NUL octets as these are+-- disallowed in POSIX filepaths. See https://gitlab.haskell.org/ghc/ghc/-/issues/13660+useAsCStringSafe :: PosixPath -> (CString -> IO a) -> IO a+useAsCStringSafe pp@(PS path) f = useAsCString path $ \ptr -> do+ let len = BSS.length path+ clen <- c_strlen ptr+ if clen == fromIntegral len+ then f ptr+ else do+ path' <- either (const (_toStr pp)) id <$> try @IOException (PS.decodeFS pp)+ ioError (err path')+ where+ err path' =+ IOError+ { ioe_handle = Nothing+ , ioe_type = InvalidArgument+ , ioe_location = "checkForInteriorNuls"+ , ioe_description = "POSIX filepaths must not contain internal NUL octets."+ , ioe_errno = Nothing+ , ioe_filename = Just path'+ }
+ System/Posix/PosixString.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE CPP #-}+-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.PosixString+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- <http://pubs.opengroup.org/onlinepubs/9699919799/ POSIX.1-2008>+-- support with 'ByteString' file paths and environment strings.+--+-- This module exports exactly the same API as "System.Posix", except+-- that all file paths and environment strings are represented by+-- 'ByteString' instead of 'String'. The "System.Posix" API+-- implicitly translates all file paths and environment strings using+-- the locale encoding, whereas this version of the API does no+-- encoding or decoding and works directly in terms of raw bytes.+--+-- Note that if you do need to interpret file paths or environment+-- strings as text, then some Unicode encoding or decoding should be+-- applied first.+--+-----------------------------------------------------------------------------++module System.Posix.PosixString (+ System.OsString.Posix.PosixString,+ System.OsPath.Posix.PosixPath,+ module System.Posix.Types,+ module System.Posix.Signals,+ module System.Posix.Directory.PosixPath,+ module System.Posix.Files.PosixString,+ module System.Posix.Unistd,+ module System.Posix.IO.PosixString,+ module System.Posix.Env.PosixString,+ module System.Posix.Process.PosixString,+ module System.Posix.Temp.PosixString,+ -- module System.Posix.Terminal.ByteString,+ module System.Posix.Time,+ module System.Posix.User,+ module System.Posix.Resource,+ module System.Posix.Semaphore,+ module System.Posix.SharedMem,+-- module System.Posix.DynamicLinker.ByteString,+-- XXX 'Module' type clashes with GHC+-- module System.Posix.DynamicLinker.Module.ByteString+ ) where++import System.OsPath.Posix+import System.OsString.Posix+import System.Posix.Types+import System.Posix.Signals+import System.Posix.Directory.PosixPath+import System.Posix.Files.PosixString+import System.Posix.Unistd+import System.Posix.Process.PosixString+import System.Posix.IO.PosixString+import System.Posix.Env.PosixString+import System.Posix.Temp.PosixString+-- import System.Posix.Terminal.ByteString+import System.Posix.Time+import System.Posix.User+import System.Posix.Resource+import System.Posix.Semaphore+import System.Posix.SharedMem+-- XXX: bad planning, we have two constructors called "Default"+-- import System.Posix.DynamicLinker.ByteString hiding (Default)+--import System.Posix.DynamicLinker.Module.ByteString
System/Posix/Process.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Process@@ -76,6 +72,11 @@ import System.Posix.Process.Common import System.Posix.Internals ( withFilePath ) +#if !defined(HAVE_EXECV)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif+ -- | @'executeFile' cmd args env@ calls one of the -- @execv*@ family, depending on whether or not the current -- PATH is to be searched for the command, and whether or not an@@ -89,6 +90,14 @@ -> [String] -- ^ Arguments -> Maybe [(String, String)] -- ^ Environment -> IO a+#if !defined(HAVE_EXECV)++{-# WARNING executeFile+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_EXECV@)" #-}+executeFile _ _ _ _ = ioError (ioeSetLocation unsupportedOperation "executeFile")++#else+ executeFile path search args Nothing = do withFilePath path $ \s -> withMany withFilePath (path:args) $ \cstrs ->@@ -123,3 +132,4 @@ foreign import ccall unsafe "execve" c_execve :: CString -> Ptr CString -> Ptr CString -> IO CInt +#endif // HAVE_EXECV
System/Posix/Process/ByteString.hsc view
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- |@@ -88,6 +84,11 @@ import System.Posix.ByteString.FilePath +#if !defined(HAVE_EXECV)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif+ -- | @'executeFile' cmd args env@ calls one of the -- @execv*@ family, depending on whether or not the current -- PATH is to be searched for the command, and whether or not an@@ -101,6 +102,14 @@ -> [ByteString] -- ^ Arguments -> Maybe [(ByteString, ByteString)] -- ^ Environment -> IO a+#if !defined(HAVE_EXECV)++{-# WARNING executeFile+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_EXECV@)" #-}+executeFile _ _ _ _ = ioError (ioeSetLocation unsupportedOperation "executeFile")++#else+ executeFile path search args Nothing = do withFilePath path $ \s -> withMany withFilePath (path:args) $ \cstrs ->@@ -134,3 +143,5 @@ foreign import ccall unsafe "execve" c_execve :: CString -> Ptr CString -> Ptr CString -> IO CInt++#endif // HAVE_EXECV
System/Posix/Process/Common.hsc view
@@ -44,6 +44,7 @@ -- ** Process times ProcessTimes(..), getProcessTimes,+ clocksPerSec, -- ** Scheduling priority nice,@@ -81,8 +82,22 @@ import Control.Exception.Base ( bracket, getMaskingState, MaskingState(..) ) -- used by forkProcess import GHC.TopHandler ( runIO )-import GHC.IO ( unsafeUnmask, uninterruptibleMask_ ) +#if defined(HAVE_GETPID)+import GHC.IO ( unsafeUnmask, uninterruptibleMask_ )+#else+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif++#if !defined(HAVE_GETPID)++getProcessID :: IO ProcessID+{-# WARNING getProcessID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getProcessID = ioError (ioeSetLocation unsupportedOperation "getProcessID")++#else -- ----------------------------------------------------------------------------- -- Process environment @@ -94,7 +109,18 @@ foreign import ccall unsafe "getpid" c_getpid :: IO CPid --- | 'getProcessID' calls @getppid@ to obtain the 'ProcessID' for+#endif // HAVE_GETPID++#if !defined(HAVE_GETPID)++getParentProcessID :: IO ProcessID+{-# WARNING getParentProcessID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getParentProcessID = ioError (ioeSetLocation unsupportedOperation "getParentProcessID")++#else++-- | 'getParentProcessID' calls @getppid@ to obtain the 'ProcessID' for -- the parent of the current process. getParentProcessID :: IO ProcessID getParentProcessID = c_getppid@@ -102,6 +128,17 @@ foreign import ccall unsafe "getppid" c_getppid :: IO CPid +#endif // HAVE_GETPID++#if !defined(HAVE_GETPID)++getProcessGroupID :: IO ProcessGroupID+{-# WARNING getProcessGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getProcessGroupID = ioError (ioeSetLocation unsupportedOperation "getProcessGroupID")++#else+ -- | 'getProcessGroupID' calls @getpgrp@ to obtain the -- 'ProcessGroupID' for the current process. getProcessGroupID :: IO ProcessGroupID@@ -110,6 +147,17 @@ foreign import ccall unsafe "getpgrp" c_getpgrp :: IO CPid +#endif // HAVE_GETPID++#if !defined(HAVE_GETPID)++getProcessGroupIDOf :: ProcessID -> IO ProcessGroupID+{-# WARNING getProcessGroupIDOf+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getProcessGroupIDOf _ = ioError (ioeSetLocation unsupportedOperation "getProcessGroupIDOf")++#else+ -- | @'getProcessGroupIDOf' pid@ calls @getpgid@ to obtain the -- 'ProcessGroupID' for process @pid@. getProcessGroupIDOf :: ProcessID -> IO ProcessGroupID@@ -119,6 +167,8 @@ foreign import ccall unsafe "getpgid" c_getpgid :: CPid -> IO CPid +#endif // HAVE_GETPID+ {- To be added in the future, after the deprecation period for the existing createProcessGroup has elapsed:@@ -132,6 +182,15 @@ return pgid -} +#if !defined(HAVE_GETPID)++createProcessGroupFor :: ProcessID -> IO ProcessGroupID+{-# WARNING createProcessGroupFor+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+createProcessGroupFor _ = ioError (ioeSetLocation unsupportedOperation "createProcessGroupFor")++#else+ -- | @'createProcessGroupFor' pid@ calls @setpgid@ to make -- process @pid@ a new process group leader. createProcessGroupFor :: ProcessID -> IO ProcessGroupID@@ -139,12 +198,25 @@ throwErrnoIfMinus1_ "createProcessGroupFor" (c_setpgid pid 0) return pid +#endif // HAVE_GETPID++#if !defined(HAVE_GETPID)++joinProcessGroup :: ProcessGroupID -> IO ()+{-# WARNING joinProcessGroup+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+joinProcessGroup _ = ioError (ioeSetLocation unsupportedOperation "joinProcessGroup")++#else+ -- | @'joinProcessGroup' pgid@ calls @setpgid@ to set the -- 'ProcessGroupID' of the current process to @pgid@. joinProcessGroup :: ProcessGroupID -> IO () joinProcessGroup pgid = throwErrnoIfMinus1_ "joinProcessGroup" (c_setpgid 0 pgid) +#endif // HAVE_GETPID+ {- To be added in the future, after the deprecation period for the existing setProcessGroupID has elapsed:@@ -156,6 +228,15 @@ throwErrnoIfMinus1_ "setProcessGroupID" (c_setpgid 0 pgid) -} +#if !defined(HAVE_GETPID)++setProcessGroupIDOf :: ProcessID -> ProcessGroupID -> IO ()+{-# WARNING setProcessGroupIDOf+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+setProcessGroupIDOf _ _ = ioError (ioeSetLocation unsupportedOperation "setProcessGroupIDOf")++#else+ -- | @'setProcessGroupIDOf' pid pgid@ calls @setpgid@ to set the -- 'ProcessGroupIDOf' for process @pid@ to @pgid@. setProcessGroupIDOf :: ProcessID -> ProcessGroupID -> IO ()@@ -165,6 +246,17 @@ foreign import ccall unsafe "setpgid" c_setpgid :: CPid -> CPid -> IO CInt +#endif // HAVE_GETPID++#if !defined(HAVE_GETPID)++createSession :: IO ProcessGroupID+{-# WARNING createSession+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+createSession = ioError (ioeSetLocation unsupportedOperation "createSession")++#else+ -- | 'createSession' calls @setsid@ to create a new session -- with the current process as session leader. createSession :: IO ProcessGroupID@@ -173,6 +265,8 @@ foreign import ccall unsafe "setsid" c_setsid :: IO CPid +#endif // HAVE_GETPID+ -- ----------------------------------------------------------------------------- -- Process times @@ -186,6 +280,8 @@ , childSystemTime :: ClockTick } +#if defined(HAVE_TIMES)+ -- | 'getProcessTimes' calls @times@ to obtain time-accounting -- information for the current process and its children. getProcessTimes :: IO ProcessTimes@@ -208,10 +304,46 @@ foreign import capi unsafe "HsUnix.h times" c_times :: Ptr CTms -> IO CClock +-- | Returns the value from the @CLOCK_PER_SEC@ macro, which is required by POSIX.+clocksPerSec :: ClockTick+#ifdef HAVE_CLOCKS_PER_SEC+clocksPerSec = c_clocks_per_sec++foreign import capi unsafe "HsUnix.h __hsunix_clocks_per_second"+ c_clocks_per_sec :: CClock+#else+{-# WARNING clocksPerSec+ "CLOCK_PER_SEC not defined, defaulting to the value 1000000 as indicated by POSIX (CPP guard: @#if HAVE_CLOCKS_PER_SEC@)" #-}+clocksPerSec = 1000000+#endif // HAVE_CLOCKS_PER_SEC++#else++getProcessTimes :: IO ProcessTimes+{-# WARNING getProcessTimes+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TIMES@)" #-}+getProcessTimes = ioError (ioeSetLocation unsupportedOperation "getProcessTimes")++clocksPerSec :: ClockTick+{-# WARNING clocksPerSec+ "CLOCK_PER_SEC not defined, defaulting to the value 1000000 as indicated by POSIX (CPP guard: @#if HAVE_CLOCKS_PER_SEC@)" #-}+clocksPerSec = 1000000++#endif // HAVE_TIMES+ -- ----------------------------------------------------------------------------- -- Process scheduling priority +#if !defined(HAVE_GETPID)+ nice :: Int -> IO ()+{-# WARNING nice+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+nice _ = ioError (ioeSetLocation unsupportedOperation "nice")++#else++nice :: Int -> IO () nice prio = do resetErrno res <- c_nice (fromIntegral prio)@@ -222,10 +354,28 @@ foreign import ccall unsafe "nice" c_nice :: CInt -> IO CInt +#endif // HAVE_GETPID+ getProcessPriority :: ProcessID -> IO Int getProcessGroupPriority :: ProcessGroupID -> IO Int getUserPriority :: UserID -> IO Int +#if !defined(HAVE_GETPID)++{-# WARNING getProcessPriority+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getProcessPriority _ = ioError (ioeSetLocation unsupportedOperation "getProcessPriority")++{-# WARNING getProcessGroupPriority+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getProcessGroupPriority _ = ioError (ioeSetLocation unsupportedOperation "getProcessGroupPriority")++{-# WARNING getUserPriority+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getUserPriority _ = ioError (ioeSetLocation unsupportedOperation "getUserPriority")++#else+ getProcessPriority pid = do r <- throwErrnoIfMinus1 "getProcessPriority" $ c_getpriority (#const PRIO_PROCESS) (fromIntegral pid)@@ -244,10 +394,28 @@ foreign import ccall unsafe "getpriority" c_getpriority :: CInt -> CInt -> IO CInt +#endif // HAVE_GETPID+ setProcessPriority :: ProcessID -> Int -> IO () setProcessGroupPriority :: ProcessGroupID -> Int -> IO () setUserPriority :: UserID -> Int -> IO () +#if !defined(HAVE_GETPID)++{-# WARNING setProcessPriority+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+setProcessPriority _ _ = ioError (ioeSetLocation unsupportedOperation "setProcessPriority")++{-# WARNING setProcessGroupPriority+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+setProcessGroupPriority _ _ = ioError (ioeSetLocation unsupportedOperation "setProcessGroupPriority")++{-# WARNING setUserPriority+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+setUserPriority _ _ = ioError (ioeSetLocation unsupportedOperation "setUserPriority")++#else+ setProcessPriority pid val = throwErrnoIfMinus1_ "setProcessPriority" $ c_setpriority (#const PRIO_PROCESS) (fromIntegral pid) (fromIntegral val)@@ -263,6 +431,8 @@ foreign import ccall unsafe "setpriority" c_setpriority :: CInt -> CInt -> CInt -> IO CInt +#endif // HAVE_GETPID+ -- ----------------------------------------------------------------------------- -- Forking, execution @@ -279,9 +449,27 @@ threads are not copied into the child process, it's easy to go wrong: e.g. by accessing some shared resource that was held by another thread in the parent.++GHC note: 'forkProcess' is not currently very well supported when using multiple+capabilities (@+RTS -N@), although it is supported with @-threaded@ as+long as only one capability is being used. -} +#if !defined(HAVE_GETPID)+ forkProcess :: IO () -> IO ProcessID+{-# WARNING forkProcess+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+forkProcess _ = ioError (ioeSetLocation unsupportedOperation "forkProcess")++forkProcessWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ProcessID+{-# WARNING forkProcessWithUnmask+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+forkProcessWithUnmask _ = ioError (ioeSetLocation unsupportedOperation "forkProcessWithUnmask")++#else++forkProcess :: IO () -> IO ProcessID forkProcess action = do -- wrap action to re-establish caller's masking state, as -- 'forkProcessPrim' starts in 'MaskedInterruptible' state by@@ -305,6 +493,17 @@ forkProcessWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ProcessID forkProcessWithUnmask action = forkProcess (action unsafeUnmask) +#endif // HAVE_GETPID++#if !defined(HAVE_GETPID)++getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus)+{-# WARNING getProcessStatus+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getProcessStatus _ _ _ = ioError (ioeSetLocation unsupportedOperation "getProcessStatus")++#else+ -- ----------------------------------------------------------------------------- -- Waiting for process termination @@ -328,6 +527,20 @@ foreign import ccall interruptible "waitpid" c_waitpid :: CPid -> Ptr CInt -> CInt -> IO CPid +#endif // HAVE_GETPID++#if !defined(HAVE_GETPID)++getGroupProcessStatus :: Bool+ -> Bool+ -> ProcessGroupID+ -> IO (Maybe (ProcessID, ProcessStatus))+{-# WARNING getGroupProcessStatus+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getGroupProcessStatus _ _ _ = ioError (ioeSetLocation unsupportedOperation "getGroupProcessStatus")++#else+ -- | @'getGroupProcessStatus' blk stopped pgid@ calls @waitpid@, -- returning @'Just' (pid, tc)@, the 'ProcessID' and 'ProcessStatus' -- for any process in group @pgid@ if one is available, or 'Nothing'@@ -351,6 +564,17 @@ _ -> do ps <- readWaitStatus wstatp return (Just (pid, ps)) +#endif // HAVE_GETPID++#if !defined(HAVE_GETPID)++getAnyProcessStatus :: Bool -> Bool -> IO (Maybe (ProcessID, ProcessStatus))+{-# WARNING getAnyProcessStatus+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+getAnyProcessStatus _ _ = ioError (ioeSetLocation unsupportedOperation "getAnyProcessStatus")++#else+ -- | @'getAnyProcessStatus' blk stopped@ calls @waitpid@, returning -- @'Just' (pid, tc)@, the 'ProcessID' and 'ProcessStatus' for any -- child process if a child process has exited, or 'Nothing' if@@ -364,6 +588,10 @@ getAnyProcessStatus :: Bool -> Bool -> IO (Maybe (ProcessID, ProcessStatus)) getAnyProcessStatus block stopped = getGroupProcessStatus block stopped 1 +#endif // HAVE_GETPID++#if defined(HAVE_GETPID)+ waitOptions :: Bool -> Bool -> CInt -- block stopped waitOptions False False = (#const WNOHANG)@@ -378,14 +606,26 @@ wstat <- peek wstatp decipherWaitStatus wstat +#endif // HAVE_GETPID+ -- ----------------------------------------------------------------------------- -- Exiting -- | @'exitImmediately' status@ calls @_exit@ to terminate the process -- with the indicated exit @status@.--- The operation never returns.-exitImmediately :: ExitCode -> IO ()-exitImmediately exitcode = c_exit (exitcode2Int exitcode)+-- The operation never returns. Since it does not use the Haskell exception+-- system and it cannot be caught.+--+-- Note: Prior to @unix-2.8.0.0@ the type-signature of 'exitImmediately' was+-- @ExitCode -> IO ()@.+--+-- @since 2.8.0.0+exitImmediately :: ExitCode -> IO a+exitImmediately status = do+ _ <- c_exit (exitcode2Int status)+ -- The above will exit the program, but need the following to satisfy+ -- the type signature.+ exitImmediately status where exitcode2Int ExitSuccess = 0 exitcode2Int (ExitFailure n) = fromIntegral n@@ -393,6 +633,20 @@ foreign import ccall unsafe "exit" c_exit :: CInt -> IO () +#if !defined(HAVE_GETPID)++createProcessGroup :: ProcessID -> IO ProcessGroupID+{-# WARNING createProcessGroup+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+createProcessGroup _ = ioError (ioeSetLocation unsupportedOperation "createProcessGroup")++setProcessGroupID :: ProcessID -> ProcessGroupID -> IO ()+{-# WARNING setProcessGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+setProcessGroupID _ _ = ioError (ioeSetLocation unsupportedOperation "setProcessGroupID")++#else+ -- ----------------------------------------------------------------------------- -- Deprecated or subject to change @@ -418,3 +672,5 @@ throwErrnoIfMinus1_ "setProcessGroupID" (c_setpgid pid pgid) -- -----------------------------------------------------------------------------++#endif // HAVE_GETPID
− System/Posix/Process/Internals.hs
@@ -1,78 +0,0 @@-{-# LANGUAGE CApiFFI #-}-{-# LANGUAGE Trustworthy #-}--module System.Posix.Process.Internals (- pPrPr_disableITimers, c_execvpe,- decipherWaitStatus, ProcessStatus(..) ) where--import Foreign-import Foreign.C-import System.Exit-import System.IO.Error-import GHC.Conc (Signal)---- | The exit status of a process-data ProcessStatus- = Exited ExitCode -- ^ the process exited by calling- -- @exit()@ or returning from @main@- | Terminated Signal Bool -- ^ the process was terminated by a- -- signal, the @Bool@ is @True@ if a core- -- dump was produced- --- -- @since 2.7.0.0- | Stopped Signal -- ^ the process was stopped by a signal- deriving (Eq, Ord, Show)---- this function disables the itimer, which would otherwise cause confusing--- signals to be sent to the new process.-foreign import capi unsafe "Rts.h stopTimer"- pPrPr_disableITimers :: IO ()--foreign import ccall unsafe "__hsunix_execvpe"- c_execvpe :: CString -> Ptr CString -> Ptr CString -> IO CInt--decipherWaitStatus :: CInt -> IO ProcessStatus-decipherWaitStatus wstat =- if c_WIFEXITED wstat /= 0- then do- let exitstatus = c_WEXITSTATUS wstat- if exitstatus == 0- then return (Exited ExitSuccess)- else return (Exited (ExitFailure (fromIntegral exitstatus)))- else do- if c_WIFSIGNALED wstat /= 0- then do- let termsig = c_WTERMSIG wstat- let coredumped = c_WCOREDUMP wstat /= 0- return (Terminated termsig coredumped)- else do- if c_WIFSTOPPED wstat /= 0- then do- let stopsig = c_WSTOPSIG wstat- return (Stopped stopsig)- else do- ioError (mkIOError illegalOperationErrorType- "waitStatus" Nothing Nothing)---foreign import capi unsafe "HsUnix.h WIFEXITED"- c_WIFEXITED :: CInt -> CInt--foreign import capi unsafe "HsUnix.h WEXITSTATUS"- c_WEXITSTATUS :: CInt -> CInt--foreign import capi unsafe "HsUnix.h WIFSIGNALED"- c_WIFSIGNALED :: CInt -> CInt--foreign import capi unsafe "HsUnix.h WTERMSIG"- c_WTERMSIG :: CInt -> CInt--foreign import capi unsafe "HsUnix.h WIFSTOPPED"- c_WIFSTOPPED :: CInt -> CInt--foreign import capi unsafe "HsUnix.h WSTOPSIG"- c_WSTOPSIG :: CInt -> CInt--foreign import capi unsafe "HsUnix.h WCOREDUMP"- c_WCOREDUMP :: CInt -> CInt-
+ System/Posix/Process/Internals.hsc view
@@ -0,0 +1,94 @@+{-# LANGUAGE CApiFFI #-}+{-# LANGUAGE Trustworthy #-}++#include "HsUnix.h"++module System.Posix.Process.Internals (+ pPrPr_disableITimers, c_execvpe,+ decipherWaitStatus, ProcessStatus(..) ) where++import Foreign+import Foreign.C+import System.Exit+import System.IO.Error+import GHC.Conc (Signal)++#if !defined(HAVE_GETPID)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif++-- | The exit status of a process+data ProcessStatus+ = Exited ExitCode -- ^ the process exited by calling+ -- @exit()@ or returning from @main@+ | Terminated Signal Bool -- ^ the process was terminated by a+ -- signal, the @Bool@ is @True@ if a core+ -- dump was produced+ --+ -- @since 2.7.0.0+ | Stopped Signal -- ^ the process was stopped by a signal+ deriving (Eq, Ord, Show)++-- this function disables the itimer, which would otherwise cause confusing+-- signals to be sent to the new process.+foreign import capi unsafe "Rts.h stopTimer"+ pPrPr_disableITimers :: IO ()++foreign import ccall unsafe "__hsunix_execvpe"+ c_execvpe :: CString -> Ptr CString -> Ptr CString -> IO CInt++#if !defined(HAVE_GETPID)++{-# WARNING decipherWaitStatus "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_GETPID@)" #-}+decipherWaitStatus :: CInt -> IO ProcessStatus+decipherWaitStatus _ = ioError (ioeSetLocation unsupportedOperation "decipherWaitStatus")++#else++decipherWaitStatus :: CInt -> IO ProcessStatus+decipherWaitStatus wstat =+ if c_WIFEXITED wstat /= 0+ then do+ let exitstatus = c_WEXITSTATUS wstat+ if exitstatus == 0+ then return (Exited ExitSuccess)+ else return (Exited (ExitFailure (fromIntegral exitstatus)))+ else do+ if c_WIFSIGNALED wstat /= 0+ then do+ let termsig = c_WTERMSIG wstat+ let coredumped = c_WCOREDUMP wstat /= 0+ return (Terminated termsig coredumped)+ else do+ if c_WIFSTOPPED wstat /= 0+ then do+ let stopsig = c_WSTOPSIG wstat+ return (Stopped stopsig)+ else do+ ioError (mkIOError illegalOperationErrorType+ "waitStatus" Nothing Nothing)+++foreign import capi unsafe "HsUnix.h WIFEXITED"+ c_WIFEXITED :: CInt -> CInt++foreign import capi unsafe "HsUnix.h WEXITSTATUS"+ c_WEXITSTATUS :: CInt -> CInt++foreign import capi unsafe "HsUnix.h WIFSIGNALED"+ c_WIFSIGNALED :: CInt -> CInt++foreign import capi unsafe "HsUnix.h WTERMSIG"+ c_WTERMSIG :: CInt -> CInt++foreign import capi unsafe "HsUnix.h WIFSTOPPED"+ c_WIFSTOPPED :: CInt -> CInt++foreign import capi unsafe "HsUnix.h WSTOPSIG"+ c_WSTOPSIG :: CInt -> CInt++foreign import capi unsafe "HsUnix.h WCOREDUMP"+ c_WCOREDUMP :: CInt -> CInt++#endif // HAVE_GETPID
+ System/Posix/Process/PosixString.hsc view
@@ -0,0 +1,139 @@+{-# LANGUAGE PackageImports #-}+-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.Process.PosixString+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- POSIX process support. See also the System.Cmd and System.Process+-- modules in the process package.+--+-----------------------------------------------------------------------------++module System.Posix.Process.PosixString (+ -- * Processes++ -- ** Forking and executing+ forkProcess,+ forkProcessWithUnmask,+ executeFile,++ -- ** Exiting+ exitImmediately,++ -- ** Process environment+ getProcessID,+ getParentProcessID,++ -- ** Process groups+ getProcessGroupID,+ getProcessGroupIDOf,+ createProcessGroupFor,+ joinProcessGroup,+ setProcessGroupIDOf,++ -- ** Sessions+ createSession,++ -- ** Process times+ ProcessTimes(..),+ getProcessTimes,++ -- ** Scheduling priority+ nice,+ getProcessPriority,+ getProcessGroupPriority,+ getUserPriority,+ setProcessPriority,+ setProcessGroupPriority,+ setUserPriority,++ -- ** Process status+ ProcessStatus(..),+ getProcessStatus,+ getAnyProcessStatus,+ getGroupProcessStatus,++ -- ** Deprecated+ createProcessGroup,+ setProcessGroupID,++ ) where++#include "HsUnix.h"++import Foreign+import System.Posix.Process.Internals+import System.Posix.Process (ProcessTimes(..), setProcessGroupID, createProcessGroup, getGroupProcessStatus, getAnyProcessStatus, getProcessStatus, setUserPriority, setProcessGroupPriority, setProcessPriority, getUserPriority, getProcessGroupPriority, getProcessPriority, nice, getProcessTimes, createSession, setProcessGroupIDOf, joinProcessGroup, createProcessGroupFor, getProcessGroupIDOf, getProcessGroupID, getParentProcessID, getProcessID, exitImmediately, forkProcessWithUnmask, forkProcess)++import Foreign.C hiding (+ throwErrnoPath,+ throwErrnoPathIf,+ throwErrnoPathIf_,+ throwErrnoPathIfNull,+ throwErrnoPathIfMinus1,+ throwErrnoPathIfMinus1_ )++import System.OsPath.Types+import System.OsString.Internal.Types (PosixString(..))+#if MIN_VERSION_filepath(1, 5, 0)+import qualified "os-string" System.OsString.Data.ByteString.Short as BC+#else+import qualified "filepath" System.OsPath.Data.ByteString.Short as BC+#endif++import System.Posix.PosixPath.FilePath++-- | @'executeFile' cmd args env@ calls one of the+-- @execv*@ family, depending on whether or not the current+-- PATH is to be searched for the command, and whether or not an+-- environment is provided to supersede the process's current+-- environment. The basename (leading directory names suppressed) of+-- the command is passed to @execv*@ as @arg[0]@;+-- the argument list passed to 'executeFile' therefore+-- begins with @arg[1]@.+executeFile :: PosixPath -- ^ Command+ -> Bool -- ^ Search PATH?+ -> [PosixString] -- ^ Arguments+ -> Maybe [(PosixString, PosixString)] -- ^ Environment+ -> IO a+executeFile path search args Nothing = do+ withFilePath path $ \s ->+ withMany withFilePath (path:args) $ \cstrs ->+ withArray0 nullPtr cstrs $ \arr -> do+ pPrPr_disableITimers+ if search+ then throwErrnoPathIfMinus1_ "executeFile" path (c_execvp s arr)+ else throwErrnoPathIfMinus1_ "executeFile" path (c_execv s arr)+ return undefined -- never reached++executeFile path search args (Just env) = do+ withFilePath path $ \s ->+ withMany withFilePath (path:args) $ \cstrs ->+ withArray0 nullPtr cstrs $ \arg_arr ->+ let env' = map (\ (PosixString name, PosixString val) -> PosixString $ name `BC.append` (_equal `BC.cons` val)) env in+ withMany withFilePath env' $ \cenv ->+ withArray0 nullPtr cenv $ \env_arr -> do+ pPrPr_disableITimers+ if search+ then throwErrnoPathIfMinus1_ "executeFile" path+ (c_execvpe s arg_arr env_arr)+ else throwErrnoPathIfMinus1_ "executeFile" path+ (c_execve s arg_arr env_arr)+ return undefined -- never reached++foreign import ccall unsafe "execvp"+ c_execvp :: CString -> Ptr CString -> IO CInt++foreign import ccall unsafe "execv"+ c_execv :: CString -> Ptr CString -> IO CInt++foreign import ccall unsafe "execve"+ c_execve :: CString -> Ptr CString -> Ptr CString -> IO CInt++_equal :: Word8+_equal = 0x3d
System/Posix/Resource.hsc view
@@ -1,9 +1,10 @@ {-# LANGUAGE CApiFFI #-}-#if __GLASGOW_HASKELL__ >= 709-{-# LANGUAGE Safe #-}-#else+#if __GLASGOW_HASKELL__ >= 905 {-# LANGUAGE Trustworthy #-}+#else+{-# LANGUAGE Safe #-} #endif+ ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Resource@@ -31,6 +32,14 @@ import Foreign import Foreign.C +#if !defined(HAVE_STRUCT_RLIMIT)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif+#if __GLASGOW_HASKELL__ >= 905+import GHC.Exts ( considerAccessible )+#endif+ -- ----------------------------------------------------------------------------- -- Resource limits @@ -44,18 +53,32 @@ #ifdef RLIMIT_AS | ResourceTotalMemory #endif- deriving Eq+ deriving (Eq, Show) data ResourceLimits = ResourceLimits { softLimit, hardLimit :: ResourceLimit }- deriving Eq+ deriving (Eq, Show) data ResourceLimit = ResourceLimitInfinity | ResourceLimitUnknown | ResourceLimit Integer- deriving Eq+ deriving (Eq, Show) +#if !defined(HAVE_STRUCT_RLIMIT)++getResourceLimit :: Resource -> IO ResourceLimits+{-# WARNING getResourceLimit+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_STRUCT_RLIMIT@)" #-}+getResourceLimit _ = ioError (ioeSetLocation unsupportedOperation "getResourceLimit")++setResourceLimit :: Resource -> ResourceLimits -> IO ()+{-# WARNING setResourceLimit+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_STRUCT_RLIMIT@)" #-}+setResourceLimit _ _ = ioError (ioeSetLocation unsupportedOperation "setResourceLimit")++#else+ data {-# CTYPE "struct rlimit" #-} RLimit foreign import capi unsafe "HsUnix.h getrlimit"@@ -100,13 +123,21 @@ unpackRLimit (#const RLIM_INFINITY) = ResourceLimitInfinity unpackRLimit other #if defined(RLIM_SAVED_MAX)- | ((#const RLIM_SAVED_MAX) :: CRLim) /= (#const RLIM_INFINITY) &&- other == (#const RLIM_SAVED_MAX) = ResourceLimitUnknown+ | ((#const RLIM_SAVED_MAX) :: CRLim) /= (#const RLIM_INFINITY)+ , other == (#const RLIM_SAVED_MAX)+ = ResourceLimitUnknown #endif #if defined(RLIM_SAVED_CUR)- | ((#const RLIM_SAVED_CUR) :: CRLim) /= (#const RLIM_INFINITY) &&- other == (#const RLIM_SAVED_CUR) = ResourceLimitUnknown+ | ((#const RLIM_SAVED_CUR) :: CRLim) /= (#const RLIM_INFINITY)+ , other == (#const RLIM_SAVED_CUR)+#if __GLASGOW_HASKELL__ >= 905+ , considerAccessible #endif+ = ResourceLimitUnknown+ -- (*) This pattern match is redundant if RLIM_SAVED_MAX and RLIM_SAVED_CUR+ -- are both defined and are equal. This redundancy is only detected by GHC+ -- starting from version 9.5, so we use 'considerAccessible'.+#endif | otherwise = ResourceLimit (fromIntegral other) packRLimit :: ResourceLimit -> Bool -> CRLim@@ -164,3 +195,5 @@ showRLim ResourceLimitUnknown = "unknown" showRLim (ResourceLimit other) = show other -}++#endif // HAVE_STRUCT_RLIMIT
System/Posix/Semaphore.hsc view
@@ -1,9 +1,6 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif {-# LANGUAGE CApiFFI #-}+{-# LANGUAGE InterruptibleFFI #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Semaphore@@ -20,23 +17,37 @@ module System.Posix.Semaphore (OpenSemFlags(..), Semaphore(),- semOpen, semUnlink, semWait, semTryWait, semThreadWait,+ semOpen, semUnlink, semWait, semWaitInterruptible, semTryWait, semThreadWait, semPost, semGetValue) where +#include "HsUnix.h" #include <semaphore.h> #include <fcntl.h> import Foreign.C import Foreign.ForeignPtr hiding (newForeignPtr) import Foreign.Concurrent-import Foreign.Marshal import Foreign.Ptr-import Foreign.Storable import System.Posix.Types+import qualified System.Posix.Internals as Base import Control.Concurrent import Data.Bits+#if !defined(HAVE_SEM_GETVALUE)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#else+import Foreign.Marshal+import Foreign.Storable+#endif +#if __GLASGOW_HASKELL__ >= 902+import System.Posix.Internals (hostIsThreaded)+#else+hostIsThreaded :: Bool+hostIsThreaded = False+#endif+ data OpenSemFlags = OpenSemFlags { semCreate :: Bool, -- ^ If true, create the semaphore if it -- does not yet exist.@@ -51,11 +62,11 @@ -- value. semOpen :: String -> OpenSemFlags -> FileMode -> Int -> IO Semaphore semOpen name flags mode value =- let cflags = (if semCreate flags then #{const O_CREAT} else 0) .|.- (if semExclusive flags then #{const O_EXCL} else 0)+ let cflags = (if semCreate flags then Base.o_CREAT else 0) .|.+ (if semExclusive flags then Base.o_EXCL else 0) semOpen' cname = do sem <- throwErrnoPathIfNull "semOpen" name $- sem_open cname (toEnum cflags) mode (toEnum value)+ sem_open cname (toEnum (fromIntegral cflags)) mode (toEnum value) fptr <- newForeignPtr sem (finalize sem) return $ Semaphore fptr finalize sem = throwErrnoPathIfMinus1_ "semOpen" name $@@ -77,6 +88,20 @@ where semWait' sem = throwErrnoIfMinus1Retry_ "semWait" $ sem_wait sem +-- | Lock the semaphore, blocking until it becomes available.+--+-- Unlike 'semWait', this wait operation can be interrupted with+-- an asynchronous exception (e.g. a call to 'throwTo' from another thread).+semWaitInterruptible :: Semaphore -> IO Bool+semWaitInterruptible (Semaphore fptr) = withForeignPtr fptr semWait'+ where semWait' sem =+ do res <- sem_wait_interruptible sem+ if res == 0 then return True+ else do errno <- getErrno+ if errno == eINTR+ then return False+ else throwErrno "semWaitInterrruptible"+ -- | Attempt to lock the semaphore without blocking. Immediately return -- False if it is not available. semTryWait :: Semaphore -> IO Bool@@ -94,9 +119,15 @@ -- semWait, this will block only the current thread rather than the -- entire process. semThreadWait :: Semaphore -> IO ()-semThreadWait sem = do res <- semTryWait sem- (if res then return ()- else ( do { yield; semThreadWait sem } ))+semThreadWait sem+ -- N.B. semWait can be safely used in the case of the threaded runtime, where+ -- the safe foreign call will be performed in its own thread, thereby not+ -- blocking the process.+ | hostIsThreaded = semWait sem+ | otherwise = do+ res <- semTryWait sem+ if res then return ()+ else do yield >> semThreadWait sem -- | Unlock the semaphore. semPost :: Semaphore -> IO ()@@ -106,27 +137,35 @@ -- | Return the semaphore's current value. semGetValue :: Semaphore -> IO Int+#ifdef HAVE_SEM_GETVALUE semGetValue (Semaphore fptr) = withForeignPtr fptr semGetValue' where semGetValue' sem = alloca (semGetValue_ sem) + semGetValue_ :: Ptr () -> Ptr CInt -> IO Int semGetValue_ sem ptr = do throwErrnoIfMinus1Retry_ "semGetValue" $ sem_getvalue sem ptr cint <- peek ptr return $ fromEnum cint +foreign import capi safe "semaphore.h sem_getvalue"+ sem_getvalue :: Ptr () -> Ptr CInt -> IO Int+#else+{-# WARNING semGetValue "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SEM_GETVALUE@)" #-}+semGetValue _ = ioError (ioeSetLocation unsupportedOperation "semGetValue")+#endif+ foreign import capi safe "semaphore.h sem_open" sem_open :: CString -> CInt -> CMode -> CUInt -> IO (Ptr ()) foreign import capi safe "semaphore.h sem_close" sem_close :: Ptr () -> IO CInt foreign import capi safe "semaphore.h sem_unlink" sem_unlink :: CString -> IO CInt- foreign import capi safe "semaphore.h sem_wait" sem_wait :: Ptr () -> IO CInt+foreign import capi interruptible "semaphore.h sem_wait"+ sem_wait_interruptible :: Ptr () -> IO CInt foreign import capi safe "semaphore.h sem_trywait" sem_trywait :: Ptr () -> IO CInt foreign import capi safe "semaphore.h sem_post" sem_post :: Ptr () -> IO CInt-foreign import capi safe "semaphore.h sem_getvalue"- sem_getvalue :: Ptr () -> Ptr CInt -> IO Int
@@ -1,8 +1,4 @@-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.SharedMem@@ -24,10 +20,13 @@ #include "HsUnix.h" #include <sys/types.h>+#if defined(HAVE_SHM_OPEN) || defined(HAVE_SHM_UNLINK) #include <sys/mman.h>+#endif #include <fcntl.h> import System.Posix.Types+import qualified System.Posix.Internals as Base #if defined(HAVE_SHM_OPEN) || defined(HAVE_SHM_UNLINK) import Foreign.C #endif@@ -52,14 +51,14 @@ shmOpen name flags mode = do cflags0 <- return 0 cflags1 <- return $ cflags0 .|. (if shmReadWrite flags- then #{const O_RDWR}- else #{const O_RDONLY})- cflags2 <- return $ cflags1 .|. (if shmCreate flags then #{const O_CREAT}+ then Base.o_RDWR+ else Base.o_RDONLY)+ cflags2 <- return $ cflags1 .|. (if shmCreate flags then Base.o_CREAT else 0) cflags3 <- return $ cflags2 .|. (if shmExclusive flags- then #{const O_EXCL}+ then Base.o_EXCL else 0)- cflags4 <- return $ cflags3 .|. (if shmTrunc flags then #{const O_TRUNC}+ cflags4 <- return $ cflags3 .|. (if shmTrunc flags then Base.o_TRUNC else 0) withCAString name (shmOpen' cflags4) where shmOpen' cflags cname =@@ -67,6 +66,7 @@ shm_open cname cflags mode return $ Fd fd #else+{-# WARNING shmOpen "System.Posix.SharedMem: shm_open: not available" #-} shmOpen = error "System.Posix.SharedMem:shm_open: not available" #endif @@ -77,6 +77,7 @@ where shmUnlink' cname = throwErrnoIfMinus1_ "shmUnlink" $ shm_unlink cname #else+{-# WARNING shmUnlink "System.Posix.SharedMem:shm_unlink: not available" #-} shmUnlink = error "System.Posix.SharedMem:shm_unlink: not available" #endif
System/Posix/Signals.hsc view
@@ -101,6 +101,10 @@ import Foreign.Marshal import Foreign.Ptr import Foreign.Storable+#if !defined(HAVE_SIGNAL_H) || !defined(HAVE_ALARM)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif import System.IO.Unsafe (unsafePerformIO) import System.Posix.Types import System.Posix.Internals@@ -108,158 +112,255 @@ import System.Posix.Process.Internals import Data.Dynamic +#if defined(javascript_HOST_ARCH)+-- These signals aren't supported by the JS RTS+-- and the header isn't exposed.+##define STG_SIG_DFL (-1)+##define STG_SIG_IGN (-2)+##define STG_SIG_ERR (-3)+##define STG_SIG_HAN (-4)+##define STG_SIG_RST (-5)+#else ##include "rts/Signals.h"+#endif import GHC.Conc hiding (Signal) +#if !defined(HAVE_SIGNAL_H)+import Control.Exception ( throw )+#endif+ -- ----------------------------------------------------------------------------- -- Specific signals nullSignal :: Signal nullSignal = 0 +-- | Process abort signal. sigABRT :: CInt sigABRT = CONST_SIGABRT++-- | Alarm clock. sigALRM :: CInt sigALRM = CONST_SIGALRM++-- | Access to an undefined portion of a memory object. sigBUS :: CInt sigBUS = CONST_SIGBUS++-- | Child process terminated, stopped, or continued. sigCHLD :: CInt sigCHLD = CONST_SIGCHLD++-- | Continue executing, if stopped. sigCONT :: CInt sigCONT = CONST_SIGCONT++-- | Erroneous arithmetic operation. sigFPE :: CInt sigFPE = CONST_SIGFPE++-- | Hangup. sigHUP :: CInt sigHUP = CONST_SIGHUP++-- | Illegal instruction. sigILL :: CInt sigILL = CONST_SIGILL++-- | Terminal interrupt signal. sigINT :: CInt sigINT = CONST_SIGINT++-- | Kill (cannot be caught or ignored). sigKILL :: CInt sigKILL = CONST_SIGKILL++-- | Write on a pipe with no one to read it. sigPIPE :: CInt sigPIPE = CONST_SIGPIPE++-- | Terminal quit signal. sigQUIT :: CInt sigQUIT = CONST_SIGQUIT++-- | Invalid memory reference. sigSEGV :: CInt sigSEGV = CONST_SIGSEGV++-- | Stop executing (cannot be caught or ignored). sigSTOP :: CInt sigSTOP = CONST_SIGSTOP++-- | Termination signal. sigTERM :: CInt sigTERM = CONST_SIGTERM++-- | Terminal stop signal. sigTSTP :: CInt sigTSTP = CONST_SIGTSTP++-- | Background process attempting read. sigTTIN :: CInt sigTTIN = CONST_SIGTTIN++-- | Background process attempting write. sigTTOU :: CInt sigTTOU = CONST_SIGTTOU++-- | User-defined signal 1. sigUSR1 :: CInt sigUSR1 = CONST_SIGUSR1++-- | User-defined signal 2. sigUSR2 :: CInt sigUSR2 = CONST_SIGUSR2+ #if CONST_SIGPOLL != -1+-- | Pollable event. sigPOLL :: CInt sigPOLL = CONST_SIGPOLL #endif++-- | Profiling timer expired. sigPROF :: CInt sigPROF = CONST_SIGPROF++-- | Bad system call. sigSYS :: CInt sigSYS = CONST_SIGSYS++-- | Trace/breakpoint trap. sigTRAP :: CInt sigTRAP = CONST_SIGTRAP++-- | High bandwidth data is available at a socket. sigURG :: CInt sigURG = CONST_SIGURG++-- | Virtual timer expired. sigVTALRM :: CInt sigVTALRM = CONST_SIGVTALRM++-- | CPU time limit exceeded. sigXCPU :: CInt sigXCPU = CONST_SIGXCPU++-- | File size limit exceeded. sigXFSZ :: CInt sigXFSZ = CONST_SIGXFSZ +-- | Alias for 'sigABRT'. internalAbort ::Signal internalAbort = sigABRT +-- | Alias for 'sigALRM'. realTimeAlarm :: Signal realTimeAlarm = sigALRM +-- | Alias for 'sigBUS'. busError :: Signal busError = sigBUS +-- | Alias for 'sigCHLD'. processStatusChanged :: Signal processStatusChanged = sigCHLD +-- | Alias for 'sigCONT'. continueProcess :: Signal continueProcess = sigCONT +-- | Alias for 'sigFPE'. floatingPointException :: Signal floatingPointException = sigFPE +-- | Alias for 'sigHUP'. lostConnection :: Signal lostConnection = sigHUP +-- | Alias for 'sigILL'. illegalInstruction :: Signal illegalInstruction = sigILL +-- | Alias for 'sigINT'. keyboardSignal :: Signal keyboardSignal = sigINT +-- | Alias for 'sigKILL'. killProcess :: Signal killProcess = sigKILL +-- | Alias for 'sigPIPE'. openEndedPipe :: Signal openEndedPipe = sigPIPE +-- | Alias for 'sigQUIT'. keyboardTermination :: Signal keyboardTermination = sigQUIT +-- | Alias for 'sigSEGV'. segmentationViolation :: Signal segmentationViolation = sigSEGV +-- | Alias for 'sigSTOP'. softwareStop :: Signal softwareStop = sigSTOP +-- | Alias for 'sigTERM'. softwareTermination :: Signal softwareTermination = sigTERM +-- | Alias for 'sigTSTP'. keyboardStop :: Signal keyboardStop = sigTSTP +-- | Alias for 'sigTTIN'. backgroundRead :: Signal backgroundRead = sigTTIN +-- | Alias for 'sigTTOU'. backgroundWrite :: Signal backgroundWrite = sigTTOU +-- | Alias for 'sigUSR1'. userDefinedSignal1 :: Signal userDefinedSignal1 = sigUSR1 +-- | Alias for 'sigUSR2'. userDefinedSignal2 :: Signal userDefinedSignal2 = sigUSR2 #if CONST_SIGPOLL != -1+-- | Alias for 'sigPOLL'. pollableEvent :: Signal pollableEvent = sigPOLL #endif +-- | Alias for 'sigPROF'. profilingTimerExpired :: Signal profilingTimerExpired = sigPROF +-- | Alias for 'sigSYS'. badSystemCall :: Signal badSystemCall = sigSYS +-- | Alias for 'sigTRAP'. breakpointTrap :: Signal breakpointTrap = sigTRAP +-- | Alias for 'sigURG'. urgentDataAvailable :: Signal urgentDataAvailable = sigURG +-- | Alias for 'sigVTALRM'. virtualTimerExpired :: Signal virtualTimerExpired = sigVTALRM +-- | Alias for 'sigXCPU'. cpuTimeLimitExceeded :: Signal cpuTimeLimitExceeded = sigXCPU +-- | Alias for 'sigXFSZ'. fileSizeLimitExceeded :: Signal fileSizeLimitExceeded = sigXFSZ @@ -269,25 +370,53 @@ -- | @signalProcess int pid@ calls @kill@ to signal process @pid@ -- with interrupt signal @int@. signalProcess :: Signal -> ProcessID -> IO ()+#if !defined(HAVE_SIGNAL_H)++{-# WARNING signalProcess+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+signalProcess _ _ = ioError (ioeSetLocation unsupportedOperation "signalProcess")++#else+ signalProcess sig pid = throwErrnoIfMinus1_ "signalProcess" (c_kill pid sig) foreign import ccall unsafe "kill" c_kill :: CPid -> CInt -> IO CInt +#endif // HAVE_SIGNAL_H + -- | @signalProcessGroup int pgid@ calls @kill@ to signal -- all processes in group @pgid@ with interrupt signal @int@. signalProcessGroup :: Signal -> ProcessGroupID -> IO ()+#if !defined(HAVE_SIGNAL_H)++{-# WARNING signalProcessGroup+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+signalProcessGroup _ _ = ioError (ioeSetLocation unsupportedOperation "signalProcessGroup")++#else+ signalProcessGroup sig pgid = throwErrnoIfMinus1_ "signalProcessGroup" (c_killpg pgid sig) foreign import ccall unsafe "killpg" c_killpg :: CPid -> CInt -> IO CInt +#endif // HAVE_SIGNAL_H+ -- | @raiseSignal int@ calls @kill@ to signal the current process -- with interrupt signal @int@. raiseSignal :: Signal -> IO ()+#if !defined(HAVE_SIGNAL_H)++{-# WARNING raiseSignal+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+raiseSignal _ = ioError (ioeSetLocation unsupportedOperation "raiseSignal")++#else+ raiseSignal sig = throwErrnoIfMinus1_ "raiseSignal" (c_raise sig) -- See also note in GHC's rts/RtsUtils.c@@ -301,15 +430,28 @@ c_raise :: CInt -> IO CInt #endif +#endif // HAVE_SIGNAL_H type Signal = CInt -- | The actions to perform when a signal is received. data Handler = Default+ -- ^ Sets the disposition of the signal to @SIG_DFL@, which+ -- means we want the default action associated with the+ -- signal. For example, the default action for @SIGTERM@ (and+ -- various other signals) is to terminate the process. | Ignore+ -- ^ Set the disposition of the signal to @SIG_IGN@, which+ -- means we want to /ignore/ the signal. Ignored signals will+ -- not be delivered to the process, and if also /blocked/ will+ -- not be added to the pending set for later delivery (if/when+ -- unblocked). Some signals (e.g. @SIGSTOP@ and @SIGKILL@)+ -- cannot be caught or ignored. -- not yet: | Hold | Catch (IO ())+ -- ^ signal handler is not reset | CatchOnce (IO ())+ -- ^ signal handler is automatically reset (via @SA_RESETHAND@) | CatchInfo (SignalInfo -> IO ()) -- ^ @since 2.7.0.0 | CatchInfoOnce (SignalInfo -> IO ()) -- ^ @since 2.7.0.0 deriving (Typeable)@@ -350,8 +492,16 @@ -> IO Handler -- ^ old handler #ifdef __PARALLEL_HASKELL__+{-# WARNING installHandler "installHandler: not available for Parallel Haskell"+ - #-} installHandler = error "installHandler: not available for Parallel Haskell"+#elif !defined(HAVE_SIGNAL_H)++{-# WARNING installHandler+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+installHandler _ _ _ = ioError (ioeSetLocation unsupportedOperation "installHandler")+ #else installHandler sig handler _maybe_mask = do@@ -447,6 +597,15 @@ #endif /* !__PARALLEL_HASKELL__ */ +#if !defined(HAVE_ALARM)++scheduleAlarm :: Int -> IO Int+{-# WARNING scheduleAlarm+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_ALARM@)" #-}+scheduleAlarm _ = ioError (ioeSetLocation unsupportedOperation "scheduleAlarm")++#else+ -- ----------------------------------------------------------------------------- -- Alarms @@ -460,9 +619,23 @@ foreign import ccall unsafe "alarm" c_alarm :: CUInt -> IO CUInt +#endif // HAVE_ALARM+ -- ----------------------------------------------------------------------------- -- The NOCLDSTOP flag +#if !defined(HAVE_SIGNAL_H)++{-# WARNING setStoppedChildFlag "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+setStoppedChildFlag :: Bool -> IO Bool+setStoppedChildFlag _ = ioError (ioeSetLocation unsupportedOperation "setStoppedChildFlag")++{-# WARNING queryStoppedChildFlag "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+queryStoppedChildFlag :: IO Bool+queryStoppedChildFlag = ioError (ioeSetLocation unsupportedOperation "queryStoppedChildFlag")++#else+ foreign import ccall "&nocldstop" nocldstop :: Ptr Int -- | Tells the system whether or not to set the @SA_NOCLDSTOP@ flag when@@ -479,12 +652,57 @@ rc <- peek nocldstop return (rc == (0::Int)) +#endif+ -- ----------------------------------------------------------------------------- -- Manipulating signal sets +#if defined(HAVE_SIGNAL_H)+ newtype SignalSet = SignalSet (ForeignPtr CSigset) +#else++data SignalSet++#endif // HAVE_SIGNAL_H++#if !defined(HAVE_SIGNAL_H)+ emptySignalSet :: SignalSet+{-# WARNING emptySignalSet+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+emptySignalSet = throw (ioeSetLocation unsupportedOperation "emptySignalSet")++fullSignalSet :: SignalSet+{-# WARNING fullSignalSet+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+fullSignalSet = throw (ioeSetLocation unsupportedOperation "fullSignalSet")++reservedSignals :: SignalSet+{-# WARNING reservedSignals+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+reservedSignals = throw (ioeSetLocation unsupportedOperation "reservedSignals")++infixr `addSignal`, `deleteSignal`+addSignal :: Signal -> SignalSet -> SignalSet+{-# WARNING addSignal+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+addSignal _ _ = throw (ioeSetLocation unsupportedOperation "addSignal")++deleteSignal :: Signal -> SignalSet -> SignalSet+{-# WARNING deleteSignal+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+deleteSignal _ _ = throw (ioeSetLocation unsupportedOperation "deleteSignal")++inSignalSet :: Signal -> SignalSet -> Bool+{-# WARNING inSignalSet+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+inSignalSet _ _ = throw (ioeSetLocation unsupportedOperation "inSignalSet")++#else++emptySignalSet :: SignalSet emptySignalSet = unsafePerformIO $ do fp <- mallocForeignPtrBytes sizeof_sigset_t throwErrnoIfMinus1_ "emptySignalSet" (withForeignPtr fp $ c_sigemptyset)@@ -528,6 +746,32 @@ r <- throwErrnoIfMinus1 "inSignalSet" (c_sigismember p sig) return (r /= 0) +#endif // HAVE_SIGNAL_H++#if !defined(HAVE_SIGNAL_H)++getSignalMask :: IO SignalSet+{-# WARNING getSignalMask+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+getSignalMask = ioError (ioeSetLocation unsupportedOperation "getSignalMask")++setSignalMask :: SignalSet -> IO ()+{-# WARNING setSignalMask+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+setSignalMask _ = ioError (ioeSetLocation unsupportedOperation "setSignalMask")++blockSignals :: SignalSet -> IO ()+{-# WARNING blockSignals+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+blockSignals _ = ioError (ioeSetLocation unsupportedOperation "blockSignals")++unblockSignals :: SignalSet -> IO ()+{-# WARNING unblockSignals+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+unblockSignals _ = ioError (ioeSetLocation unsupportedOperation "unblockSignals")++#else+ -- | @getSignalMask@ calls @sigprocmask@ to determine the -- set of interrupts which are currently being blocked. getSignalMask :: IO SignalSet@@ -559,6 +803,22 @@ unblockSignals :: SignalSet -> IO () unblockSignals set = sigProcMask "unblockSignals" (CONST_SIG_UNBLOCK :: CInt) set +#endif // HAVE_SIGNAL_H++#if !defined(HAVE_SIGNAL_H)++getPendingSignals :: IO SignalSet+{-# WARNING getPendingSignals+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+getPendingSignals = ioError (ioeSetLocation unsupportedOperation "getPendingSignals")++awaitSignal :: Maybe SignalSet -> IO ()+{-# WARNING awaitSignal+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_SIGNAL_H@)" #-}+awaitSignal _ = ioError (ioeSetLocation unsupportedOperation "awaitSignal")++#else+ -- | @getPendingSignals@ calls @sigpending@ to obtain -- the set of interrupts which have been received but are currently blocked. getPendingSignals :: IO SignalSet@@ -594,21 +854,13 @@ -- XXX My manpage says it can also return EFAULT. And why is ignoring -- EINTR the right thing to do? -foreign import ccall unsafe "sigsuspend"- c_sigsuspend :: Ptr CSigset -> IO CInt+#endif // HAVE_SIGNAL_H -#if defined(darwin_HOST_OS) && __GLASGOW_HASKELL__ < 706--- see http://ghc.haskell.org/trac/ghc/ticket/7359#comment:3--- To be removed when support for GHC 7.4.x is dropped-foreign import ccall unsafe "__hscore_sigdelset"- c_sigdelset :: Ptr CSigset -> CInt -> IO CInt+#if defined(HAVE_SIGNAL_H) -foreign import ccall unsafe "__hscore_sigfillset"- c_sigfillset :: Ptr CSigset -> IO CInt+foreign import ccall unsafe "sigsuspend"+ c_sigsuspend :: Ptr CSigset -> IO CInt -foreign import ccall unsafe "__hscore_sigismember"- c_sigismember :: Ptr CSigset -> CInt -> IO CInt-#else foreign import capi unsafe "signal.h sigdelset" c_sigdelset :: Ptr CSigset -> CInt -> IO CInt @@ -617,7 +869,8 @@ foreign import capi unsafe "signal.h sigismember" c_sigismember :: Ptr CSigset -> CInt -> IO CInt-#endif foreign import ccall unsafe "sigpending" c_sigpending :: Ptr CSigset -> IO CInt++#endif // HAVE_SIGNAL_H
System/Posix/Temp.hsc view
@@ -1,9 +1,5 @@ {-# LANGUAGE CApiFFI #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Temp@@ -34,6 +30,19 @@ import System.Posix.Types import System.Posix.Internals (withFilePath, peekFilePath) +#if !defined(HAVE_MKSTEMP)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif++#if !defined(HAVE_MKSTEMP)++{-# WARNING mkstemp "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_MKSTEMP@)" #-}+mkstemp :: String -> IO (FilePath, Handle)+mkstemp _ = ioError (ioeSetLocation unsupportedOperation "mkstemp")++#else+ foreign import capi unsafe "HsUnix.h mkstemp" c_mkstemp :: CString -> IO CInt @@ -53,6 +62,8 @@ h <- fdToHandle (Fd fd) return (name, h) +#endif // HAVE_MKSTEMP+ #if HAVE_MKSTEMPS foreign import capi unsafe "HsUnix.h mkstemps" c_mkstemps :: CString -> CInt -> IO CInt@@ -78,6 +89,7 @@ h <- fdToHandle (Fd fd) return (name, h) #else+{-# WARNING mkstemps "System.Posix.Temp.mkstemps: not available on this platform" #-} mkstemps = error "System.Posix.Temp.mkstemps: not available on this platform" #endif @@ -103,7 +115,7 @@ return name #else name <- mktemp template- h <- createDirectory name (toEnum 0o700)+ _ <- createDirectory name (toEnum 0o700) return name #endif @@ -118,7 +130,6 @@ mktemp :: String -> IO String mktemp template = do withFilePath template $ \ ptr -> do- ptr <- throwErrnoIfNull "mktemp" (c_mktemp ptr)- peekFilePath ptr+ ptr' <- throwErrnoIfNull "mktemp" (c_mktemp ptr)+ peekFilePath ptr' #endif-
System/Posix/Temp/ByteString.hsc view
@@ -1,9 +1,5 @@ {-# LANGUAGE CApiFFI #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Temp.ByteString@@ -39,6 +35,19 @@ import System.Posix.IO import System.Posix.Types +#if !defined(HAVE_MKSTEMP)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif++#if !defined(HAVE_MKSTEMP)++{-# WARNING mkstemp "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_MKSTEMP@)" #-}+mkstemp :: ByteString -> IO (RawFilePath, Handle)+mkstemp _ = ioError (ioeSetLocation unsupportedOperation "mkstemp")++#else+ foreign import capi unsafe "HsUnix.h mkstemp" c_mkstemp :: CString -> IO CInt @@ -58,6 +67,8 @@ h <- fdToHandle (Fd fd) return (name, h) +#endif // HAVE_MKSTEMP+ #if HAVE_MKSTEMPS foreign import capi unsafe "HsUnix.h mkstemps" c_mkstemps :: CString -> CInt -> IO CInt@@ -79,6 +90,7 @@ h <- fdToHandle (Fd fd) return (name, h) #else+{-# WARNING mkstemps "System.Posix.Temp.mkstemps: not available on this platform" #-} mkstemps = error "System.Posix.Temp.mkstemps: not available on this platform" #endif @@ -103,7 +115,7 @@ return name #else name <- mktemp template- h <- createDirectory (BC.unpack name) (toEnum 0o700)+ _ <- createDirectory (BC.unpack name) (toEnum 0o700) return name #endif @@ -118,7 +130,6 @@ mktemp :: ByteString -> IO RawFilePath mktemp template = do withFilePath template $ \ ptr -> do- ptr <- throwErrnoIfNull "mktemp" (c_mktemp ptr)- peekFilePath ptr+ ptr' <- throwErrnoIfNull "mktemp" (c_mktemp ptr)+ peekFilePath ptr' #endif-
+ System/Posix/Temp/PosixString.hsc view
@@ -0,0 +1,143 @@+{-# LANGUAGE CApiFFI #-}+{-# LANGUAGE PackageImports #-}+-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.Temp.PosixString+-- Copyright : (c) Volker Stolz <vs@foldr.org>+-- Deian Stefan <deian@cs.stanford.edu>+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org, vs@foldr.org, deian@cs.stanford.edu+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- POSIX temporary file and directory creation functions.+--+-----------------------------------------------------------------------------++module System.Posix.Temp.PosixString (+ mkstemp, mkstemps, mkdtemp+ ) where++#include "HsUnix.h"++#if MIN_VERSION_filepath(1, 5, 0)+import qualified "os-string" System.OsString.Data.ByteString.Short as BC+#else+import qualified "filepath" System.OsPath.Data.ByteString.Short as BC+#endif+import Data.Word++import Foreign.C++import System.OsPath.Types+import System.IO+import System.Posix.PosixPath.FilePath+import System.OsString.Internal.Types (PosixString(..))+#if !HAVE_MKDTEMP+import System.Posix.Directory.PosixPath (createDirectory)+#endif+import System.Posix.IO.PosixString+import System.Posix.Types++#if !defined(HAVE_MKSTEMP)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif++#if !defined(HAVE_MKSTEMP)++{-# WARNING mkstemp "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_MKSTEMP@)" #-}+mkstemp :: PosixString -> IO (PosixPath, Handle)+mkstemp _ = ioError (ioeSetLocation unsupportedOperation "mkstemp")++#else++foreign import capi unsafe "HsUnix.h mkstemp"+ c_mkstemp :: CString -> IO CInt++-- | Make a unique filename and open it for reading\/writing. The returned+-- 'PosixPath' is the (possibly relative) path of the created file, which is+-- padded with 6 random characters. The argument is the desired prefix of the+-- filepath of the temporary file to be created.+--+-- If you aren't using GHC or Hugs then this function simply wraps mktemp and+-- so shouldn't be considered safe.+mkstemp :: PosixString -> IO (PosixPath, Handle)+mkstemp (PosixString template') = do+ let template = PosixString $ template' `BC.append` (BC.pack [_X,_X,_X,_X,_X,_X])+ withFilePath template $ \ ptr -> do+ fd <- throwErrnoIfMinus1 "mkstemp" (c_mkstemp ptr)+ name <- peekFilePath ptr+ h <- fdToHandle (Fd fd)+ return (name, h)++#endif // HAVE_MKSTEMP++#if HAVE_MKSTEMPS+foreign import capi unsafe "HsUnix.h mkstemps"+ c_mkstemps :: CString -> CInt -> IO CInt+#endif++-- |'mkstemps' - make a unique filename with a given prefix and suffix+-- and open it for reading\/writing (only safe on GHC & Hugs).+-- The returned 'PosixPath' is the (possibly relative) path of+-- the created file, which contains 6 random characters in between+-- the prefix and suffix.+mkstemps :: PosixString -> PosixString -> IO (PosixPath, Handle)+#if HAVE_MKSTEMPS+mkstemps (PosixString prefix) (PosixString suffix) = do+ let template = PosixString $ prefix `BC.append` (BC.pack [_X,_X,_X,_X,_X,_X]) `BC.append` suffix+ lenOfsuf = (fromIntegral $ BC.length suffix) :: CInt+ withFilePath template $ \ ptr -> do+ fd <- throwErrnoIfMinus1 "mkstemps" (c_mkstemps ptr lenOfsuf)+ name <- peekFilePath ptr+ h <- fdToHandle (Fd fd)+ return (name, h)+#else+mkstemps = error "System.Posix.Temp.mkstemps: not available on this platform"+#endif++#if HAVE_MKDTEMP+foreign import capi unsafe "HsUnix.h mkdtemp"+ c_mkdtemp :: CString -> IO CString+#endif++-- | Make a unique directory. The returned 'PosixPath' is the path of the+-- created directory, which is padded with 6 random characters. The argument is+-- the desired prefix of the filepath of the temporary directory to be created.+--+-- If you aren't using GHC or Hugs then this function simply wraps mktemp and+-- so shouldn't be considered safe.+mkdtemp :: PosixString -> IO PosixPath+mkdtemp (PosixString template') = do+ let template = PosixString $ template' `BC.append` (BC.pack [_X,_X,_X,_X,_X,_X])+#if HAVE_MKDTEMP+ withFilePath template $ \ ptr -> do+ _ <- throwErrnoIfNull "mkdtemp" (c_mkdtemp ptr)+ name <- peekFilePath ptr+ return name+#else+ name <- mktemp template+ h <- createDirectory name (toEnum 0o700)+ return name+#endif++#if !HAVE_MKDTEMP++foreign import ccall unsafe "mktemp"+ c_mktemp :: CString -> IO CString++-- | Make a unique file name It is required that the template have six trailing+-- \'X\'s. This function should be considered deprecated.+{-# WARNING mktemp "This function is unsafe; use mkstemp instead" #-}+mktemp :: PosixString -> IO PosixPath+mktemp template = do+ withFilePath template $ \ ptr -> do+ ptr <- throwErrnoIfNull "mktemp" (c_mktemp ptr)+ peekFilePath ptr+#endif++_X :: Word8+_X = 0x58+
System/Posix/Terminal.hsc view
@@ -1,9 +1,5 @@ {-# LANGUAGE CApiFFI #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Terminal@@ -84,7 +80,7 @@ import System.Posix.Internals (peekFilePath) -#if !HAVE_CTERMID+#if !(HAVE_CTERMID && defined(HAVE_TERMIOS_H)) import System.IO.Error ( ioeSetLocation ) import GHC.IO.Exception ( unsupportedOperation ) #endif@@ -111,7 +107,7 @@ -- provide @ctermid(3)@ (use @#if HAVE_CTERMID@ CPP guard to -- detect availability). getControllingTerminalName :: IO FilePath-#if HAVE_CTERMID+#if HAVE_CTERMID && defined(HAVE_TERMIOS_H) getControllingTerminalName = do s <- throwErrnoIfNull "getControllingTerminalName" (c_ctermid nullPtr) peekFilePath s@@ -134,17 +130,12 @@ s <- throwErrnoIfNull "getSlaveTerminalName" (c_ptsname fd) peekFilePath s -# if __GLASGOW_HASKELL__ < 800--- see comment in cbits/HsUnix.c-foreign import ccall unsafe "__hsunix_ptsname"- c_ptsname :: CInt -> IO CString-# else foreign import capi unsafe "HsUnix.h ptsname" c_ptsname :: CInt -> IO CString-# endif #else getSlaveTerminalName _ = ioError (errnoToIOError "getSlaveTerminalName" eNOSYS Nothing Nothing)+{-# WARNING getSlaveTerminalName "getSlaveTerminalName: not available on this platform" #-} #endif -- -----------------------------------------------------------------------------@@ -170,12 +161,12 @@ -> IO CInt #else openPseudoTerminal = do- (Fd master) <- openFd "/dev/ptmx" ReadWrite Nothing+ (Fd master) <- openFd "/dev/ptmx" ReadWrite defaultFileFlags{noctty=True} throwErrnoIfMinus1_ "openPseudoTerminal" (c_grantpt master) throwErrnoIfMinus1_ "openPseudoTerminal" (c_unlockpt master) slaveName <- getSlaveTerminalName (Fd master)- slave <- openFd slaveName ReadWrite Nothing defaultFileFlags{noctty=True}+ slave <- openFd slaveName ReadWrite defaultFileFlags{noctty=True} pushModule slave "ptem" pushModule slave "ldterm" # ifndef __hpux@@ -183,6 +174,10 @@ # endif /* __hpux */ return (Fd master, slave) +# ifndef HAVE_PTSNAME+{-# WARNING openPseudoTerminal "openPseudoTerminal: not available on this platform (neither OPENPTY nor PTSNAME available)" #-}+# endif /* HAVE_PTSNAME */+ -- Push a STREAMS module, for System V systems. pushModule :: Fd -> String -> IO () pushModule (Fd fd) name =@@ -194,26 +189,16 @@ c_push_module :: CInt -> CString -> IO CInt #ifdef HAVE_PTSNAME-# if __GLASGOW_HASKELL__ < 800--- see comment in cbits/HsUnix.c-foreign import ccall unsafe "__hsunix_grantpt"- c_grantpt :: CInt -> IO CInt--foreign import ccall unsafe "__hsunix_unlockpt"- c_unlockpt :: CInt -> IO CInt-# else foreign import capi unsafe "HsUnix.h grantpt" c_grantpt :: CInt -> IO CInt foreign import capi unsafe "HsUnix.h unlockpt" c_unlockpt :: CInt -> IO CInt-# endif #else c_grantpt :: CInt -> IO CInt-c_grantpt _ = return (fromIntegral 0)+c_grantpt _ = pure 0 c_unlockpt :: CInt -> IO CInt-c_unlockpt _ = return (fromIntegral 0)+c_unlockpt _ = pure 0 #endif /* HAVE_PTSNAME */ #endif /* !HAVE_OPENPTY */-
System/Posix/Terminal/ByteString.hsc view
@@ -1,9 +1,5 @@ {-# LANGUAGE CApiFFI #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Terminal.ByteString@@ -92,7 +88,7 @@ import System.Posix.ByteString.FilePath -#if !HAVE_CTERMID+#if !(HAVE_CTERMID && defined(HAVE_TERMIOS_H)) import System.IO.Error ( ioeSetLocation ) import GHC.IO.Exception ( unsupportedOperation ) #endif@@ -119,7 +115,7 @@ -- provide @ctermid(3)@ (use @#if HAVE_CTERMID@ CPP guard to -- detect availability). getControllingTerminalName :: IO RawFilePath-#if HAVE_CTERMID+#if HAVE_CTERMID && defined(HAVE_TERMIOS_H) getControllingTerminalName = do s <- throwErrnoIfNull "getControllingTerminalName" (c_ctermid nullPtr) peekFilePath s@@ -142,15 +138,10 @@ s <- throwErrnoIfNull "getSlaveTerminalName" (c_ptsname fd) peekFilePath s -# if __GLASGOW_HASKELL__ < 800--- see comment in cbits/HsUnix.c-foreign import ccall unsafe "__hsunix_ptsname"- c_ptsname :: CInt -> IO CString-# else foreign import capi unsafe "HsUnix.h ptsname" c_ptsname :: CInt -> IO CString-# endif #else+{-# WARNING getSlaveTerminalName "getSlaveTerminalName: not available on this platform" #-} getSlaveTerminalName _ = ioError (errnoToIOError "getSlaveTerminalName" eNOSYS Nothing Nothing) #endif@@ -178,12 +169,12 @@ -> IO CInt #else openPseudoTerminal = do- (Fd master) <- openFd (B.pack "/dev/ptmx") ReadWrite Nothing+ (Fd master) <- openFd (B.pack "/dev/ptmx") ReadWrite defaultFileFlags{noctty=True} throwErrnoIfMinus1_ "openPseudoTerminal" (c_grantpt master) throwErrnoIfMinus1_ "openPseudoTerminal" (c_unlockpt master) slaveName <- getSlaveTerminalName (Fd master)- slave <- openFd slaveName ReadWrite Nothing defaultFileFlags{noctty=True}+ slave <- openFd slaveName ReadWrite defaultFileFlags{noctty=True} pushModule slave "ptem" pushModule slave "ldterm" # ifndef __hpux@@ -202,20 +193,11 @@ c_push_module :: CInt -> CString -> IO CInt #if HAVE_PTSNAME-# if __GLASGOW_HASKELL__ < 800--- see comment in cbits/HsUnix.c-foreign import ccall unsafe "__hsunix_grantpt"- c_grantpt :: CInt -> IO CInt--foreign import ccall unsafe "__hsunix_unlockpt"- c_unlockpt :: CInt -> IO CInt-# else foreign import capi unsafe "HsUnix.h grantpt" c_grantpt :: CInt -> IO CInt foreign import capi unsafe "HsUnix.h unlockpt" c_unlockpt :: CInt -> IO CInt-# endif #else c_grantpt :: CInt -> IO CInt c_grantpt _ = return (fromIntegral (0::Int))
System/Posix/Terminal/Common.hsc view
@@ -1,4 +1,6 @@ {-# LANGUAGE CApiFFI #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE Trustworthy #-} -----------------------------------------------------------------------------@@ -48,7 +50,82 @@ minInput, withMinInput, - BaudRate(..),+ BaudRate+ ( ..+ , B0+ , B50+ , B75+ , B110+ , B134+ , B150+ , B200+ , B300+ , B600+ , B1200+ , B1800+ , B2400+ , B4800+ , B9600+ , B19200+ , B38400+#ifdef B7200+ , B7200+#endif+#ifdef B14400+ , B14400+#endif+#ifdef B28800+ , B28800+#endif+#ifdef B57600+ , B57600+#endif+#ifdef B76800+ , B76800+#endif+#ifdef B115200+ , B115200+#endif+#ifdef B230400+ , B230400+#endif+#ifdef B460800+ , B460800+#endif+#ifdef B500000+ , B500000+#endif+#ifdef B576000+ , B576000+#endif+#ifdef B921600+ , B921600+#endif+#ifdef B1000000+ , B1000000+#endif+#ifdef B1152000+ , B1152000+#endif+#ifdef B1500000+ , B1500000+#endif+#ifdef B2000000+ , B2000000+#endif+#ifdef B2500000+ , B2500000+#endif+#ifdef B3000000+ , B3000000+#endif+#ifdef B3500000+ , B3500000+#endif+#ifdef B4000000+ , B4000000+#endif+ ), inputSpeed, withInputSpeed, outputSpeed,@@ -84,11 +161,14 @@ import System.Posix.Types import System.Posix.Internals ( CTermios ) -#if !HAVE_TCDRAIN+#if (!defined(HAVE_TCDRAIN)) || (!defined(HAVE_TERMIOS_H))+import Control.Exception ( throw ) import System.IO.Error ( ioeSetLocation ) import GHC.IO.Exception ( unsupportedOperation ) #endif +#if defined(HAVE_TERMIOS_H)+ -- ----------------------------------------------------------------------------- -- Terminal attributes @@ -100,48 +180,101 @@ withTerminalAttributes :: TerminalAttributes -> (Ptr CTermios -> IO a) -> IO a withTerminalAttributes (TerminalAttributes termios) = withForeignPtr termios +#else +data TerminalAttributes++#endif // HAVE_TERMIOS_H++ data TerminalMode -- input flags- = InterruptOnBreak -- BRKINT- | MapCRtoLF -- ICRNL- | IgnoreBreak -- IGNBRK- | IgnoreCR -- IGNCR- | IgnoreParityErrors -- IGNPAR- | MapLFtoCR -- INLCR- | CheckParity -- INPCK- | StripHighBit -- ISTRIP- | StartStopInput -- IXOFF- | StartStopOutput -- IXON- | MarkParityErrors -- PARMRK+ = InterruptOnBreak -- ^ @BRKINT@ - Signal interrupt on break+ | MapCRtoLF -- ^ @ICRNL@ - Map CR to NL on input+ | IgnoreBreak -- ^ @IGNBRK@ - Ignore break condition+ | IgnoreCR -- ^ @IGNCR@ - Ignore CR+ | IgnoreParityErrors -- ^ @IGNPAR@ - Ignore characters with parity errors+ | MapLFtoCR -- ^ @INLCR@ - Map NL to CR on input+ | CheckParity -- ^ @INPCK@ - Enable input parity check+ | StripHighBit -- ^ @ISTRIP@ - Strip character+ | RestartOnAny -- ^ @IXANY@ - Enable any character to restart output+ | StartStopInput -- ^ @IXOFF@ - Enable start/stop input control+ | StartStopOutput -- ^ @IXON@ - Enable start/stop output control+ | MarkParityErrors -- ^ @PARMRK@ - Mark parity errors -- output flags- | ProcessOutput -- OPOST- -- ToDo: ONLCR, OCRNL, ONOCR, ONLRET, OFILL,- -- NLDLY(NL0,NL1), CRDLY(CR0,CR1,CR2,CR2)- -- TABDLY(TAB0,TAB1,TAB2,TAB3)- -- BSDLY(BS0,BS1), VTDLY(VT0,VT1), FFDLY(FF0,FF1)-+ | ProcessOutput -- ^ @OPOST@ - Post-process output+ | MapLFtoCRLF -- ^ @ONLCR@ - (XSI) Map NL to CR-NL on output+ --+ -- @since 2.8.0.0+ | OutputMapCRtoLF -- ^ @OCRNL@ - (XSI) Map CR to NL on output+ --+ -- @since 2.8.0.0+ | NoCRAtColumnZero -- ^ @ONOCR@ - (XSI) No CR output at column 0+ --+ -- @since 2.8.0.0+ | ReturnMeansLF -- ^ @ONLRET@ - (XSI) NL performs CR function+ --+ -- @since 2.8.0.0+#ifdef TAB0+ | TabDelayMask0 -- ^ @TABDLY(TAB0)@ - (XSI) Select horizontal-tab delays: type 0+ --+ -- @since 2.8.0.0+#endif+#ifdef TAB3+ | TabDelayMask3 -- ^ @TABDLY(TAB3)@ - (XSI) Select horizontal-tab delays: type 3+ --+ -- @since 2.8.0.0+#endif -- control flags- | LocalMode -- CLOCAL- | ReadEnable -- CREAD- | TwoStopBits -- CSTOPB- | HangupOnClose -- HUPCL- | EnableParity -- PARENB- | OddParity -- PARODD+ | LocalMode -- ^ @CLOCAL@ - Ignore modem status lines+ | ReadEnable -- ^ @CREAD@ - Enable receiver+ | TwoStopBits -- ^ @CSTOPB@ - Send two stop bits, else one+ | HangupOnClose -- ^ @HUPCL@ - Hang up on last close+ | EnableParity -- ^ @PARENB@ - Parity enable+ | OddParity -- ^ @PARODD@ - Odd parity, else even -- local modes- | EnableEcho -- ECHO- | EchoErase -- ECHOE- | EchoKill -- ECHOK- | EchoLF -- ECHONL- | ProcessInput -- ICANON- | ExtendedFunctions -- IEXTEN- | KeyboardInterrupts -- ISIG- | NoFlushOnInterrupt -- NOFLSH- | BackgroundWriteInterrupt -- TOSTOP+ | EnableEcho -- ^ @ECHO@ - Enable echo+ | EchoErase -- ^ @ECHOE@ - Echo erase character as error-correcting backspace+ | EchoKill -- ^ @ECHOK@ - Echo KILL+ | EchoLF -- ^ @ECHONL@ - Echo NL+ | ProcessInput -- ^ @ICANON@ - Canonical input (erase and kill processing)+ | ExtendedFunctions -- ^ @IEXTEN@ - Enable extended input character processing+ | KeyboardInterrupts -- ^ @ISIG@ - Enable signals+ | NoFlushOnInterrupt -- ^ @NOFLSH@ - Disable flush after interrupt or quit+ | BackgroundWriteInterrupt -- ^ @TOSTOP@ - Send @SIGTTOU@ for background output +#if !defined(HAVE_TERMIOS_H)+ withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes+{-# WARNING withoutMode+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+withoutMode _ _ = throw (ioeSetLocation unsupportedOperation "withoutMode")++withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes+{-# WARNING withMode+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+withMode _ _ = throw (ioeSetLocation unsupportedOperation "withMode")++terminalMode :: TerminalMode -> TerminalAttributes -> Bool+{-# WARNING terminalMode+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+terminalMode _ _ = throw (ioeSetLocation unsupportedOperation "terminalMode")++bitsPerByte :: TerminalAttributes -> Int+{-# WARNING bitsPerByte+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+bitsPerByte _ = throw (ioeSetLocation unsupportedOperation "bitsPerByte")++withBits :: TerminalAttributes -> Int -> TerminalAttributes+{-# WARNING withBits+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+withBits _ _ = throw (ioeSetLocation unsupportedOperation "withBits")++#else++withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes withoutMode termios InterruptOnBreak = clearInputFlag (#const BRKINT) termios withoutMode termios MapCRtoLF = clearInputFlag (#const ICRNL) termios withoutMode termios IgnoreBreak = clearInputFlag (#const IGNBRK) termios@@ -150,10 +283,21 @@ withoutMode termios MapLFtoCR = clearInputFlag (#const INLCR) termios withoutMode termios CheckParity = clearInputFlag (#const INPCK) termios withoutMode termios StripHighBit = clearInputFlag (#const ISTRIP) termios+withoutMode termios RestartOnAny = clearInputFlag (#const IXANY) termios withoutMode termios StartStopInput = clearInputFlag (#const IXOFF) termios withoutMode termios StartStopOutput = clearInputFlag (#const IXON) termios withoutMode termios MarkParityErrors = clearInputFlag (#const PARMRK) termios withoutMode termios ProcessOutput = clearOutputFlag (#const OPOST) termios+withoutMode termios MapLFtoCRLF = clearOutputFlag (#const ONLCR) termios+withoutMode termios OutputMapCRtoLF = clearOutputFlag (#const OCRNL) termios+withoutMode termios NoCRAtColumnZero = clearOutputFlag (#const ONOCR) termios+withoutMode termios ReturnMeansLF = clearOutputFlag (#const ONLRET) termios+#ifdef TAB0+withoutMode termios TabDelayMask0 = clearOutputFlag (#const TAB0) termios+#endif+#ifdef TAB3+withoutMode termios TabDelayMask3 = clearOutputFlag (#const TAB3) termios+#endif withoutMode termios LocalMode = clearControlFlag (#const CLOCAL) termios withoutMode termios ReadEnable = clearControlFlag (#const CREAD) termios withoutMode termios TwoStopBits = clearControlFlag (#const CSTOPB) termios@@ -179,10 +323,21 @@ withMode termios MapLFtoCR = setInputFlag (#const INLCR) termios withMode termios CheckParity = setInputFlag (#const INPCK) termios withMode termios StripHighBit = setInputFlag (#const ISTRIP) termios+withMode termios RestartOnAny = setInputFlag (#const IXANY) termios withMode termios StartStopInput = setInputFlag (#const IXOFF) termios withMode termios StartStopOutput = setInputFlag (#const IXON) termios withMode termios MarkParityErrors = setInputFlag (#const PARMRK) termios withMode termios ProcessOutput = setOutputFlag (#const OPOST) termios+withMode termios MapLFtoCRLF = setOutputFlag (#const ONLCR) termios+withMode termios OutputMapCRtoLF = setOutputFlag (#const OCRNL) termios+withMode termios NoCRAtColumnZero = setOutputFlag (#const ONOCR) termios+withMode termios ReturnMeansLF = setOutputFlag (#const ONLRET) termios+#ifdef TAB0+withMode termios TabDelayMask0 = setOutputFlag (#const TAB0) termios+#endif+#ifdef TAB3+withMode termios TabDelayMask3 = setOutputFlag (#const TAB3) termios+#endif withMode termios LocalMode = setControlFlag (#const CLOCAL) termios withMode termios ReadEnable = setControlFlag (#const CREAD) termios withMode termios TwoStopBits = setControlFlag (#const CSTOPB) termios@@ -208,10 +363,21 @@ terminalMode MapLFtoCR = testInputFlag (#const INLCR) terminalMode CheckParity = testInputFlag (#const INPCK) terminalMode StripHighBit = testInputFlag (#const ISTRIP)+terminalMode RestartOnAny = testInputFlag (#const IXANY) terminalMode StartStopInput = testInputFlag (#const IXOFF) terminalMode StartStopOutput = testInputFlag (#const IXON) terminalMode MarkParityErrors = testInputFlag (#const PARMRK) terminalMode ProcessOutput = testOutputFlag (#const OPOST)+terminalMode MapLFtoCRLF = testOutputFlag (#const ONLCR)+terminalMode OutputMapCRtoLF = testOutputFlag (#const OCRNL)+terminalMode NoCRAtColumnZero = testOutputFlag (#const ONOCR)+terminalMode ReturnMeansLF = testOutputFlag (#const ONLRET)+#ifdef TAB0+terminalMode TabDelayMask0 = testOutputFlag (#const TAB0)+#endif+#ifdef TAB3+terminalMode TabDelayMask3 = testOutputFlag (#const TAB3)+#endif terminalMode LocalMode = testControlFlag (#const CLOCAL) terminalMode ReadEnable = testControlFlag (#const CREAD) terminalMode TwoStopBits = testControlFlag (#const CSTOPB)@@ -256,6 +422,8 @@ mask 8 = (#const CS8) mask _ = error "withBits bit value out of range [5..8]" +#endif // HAVE_TERMIOS_H+ data ControlCharacter = EndOfFile -- VEOF | EndOfLine -- VEOL@@ -267,7 +435,102 @@ | Stop -- VSTOP | Suspend -- VSUSP +#if !defined(HAVE_TERMIOS_H)+ controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char+{-# WARNING controlChar+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+controlChar _ _ = throw (ioeSetLocation unsupportedOperation "controlChar")++withCC :: TerminalAttributes+ -> (ControlCharacter, Char)+ -> TerminalAttributes+{-# WARNING withCC+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+withCC _ _ = throw (ioeSetLocation unsupportedOperation "withCC")++withoutCC :: TerminalAttributes+ -> ControlCharacter+ -> TerminalAttributes+{-# WARNING withoutCC+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+withoutCC _ _ = throw (ioeSetLocation unsupportedOperation "withoutCC")++inputTime :: TerminalAttributes -> Int+{-# WARNING inputTime+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+inputTime _ = throw (ioeSetLocation unsupportedOperation "inputTime")++withTime :: TerminalAttributes -> Int -> TerminalAttributes+{-# WARNING withTime+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+withTime _ _ = throw (ioeSetLocation unsupportedOperation "withTime")++minInput :: TerminalAttributes -> Int+{-# WARNING minInput+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+minInput _ = throw (ioeSetLocation unsupportedOperation "minInput")++withMinInput :: TerminalAttributes -> Int -> TerminalAttributes+{-# WARNING withMinInput+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+withMinInput _ _ = throw (ioeSetLocation unsupportedOperation "withMinInput")++-- | Placeholder implementation+newtype BaudRate = BaudRate Int deriving (Eq, Ord, Show, Enum, Real, Num)++-- | Hang up+pattern B0 :: BaudRate+pattern B0 = BaudRate 0+-- | 50 baud+pattern B50 :: BaudRate+pattern B50 = BaudRate 50+-- | 75 baud+pattern B75 :: BaudRate+pattern B75 = BaudRate 75+-- | 110 baud+pattern B110 :: BaudRate+pattern B110 = BaudRate 110+-- | 134.5 baud+pattern B134 :: BaudRate+pattern B134 = BaudRate 134+-- | 150 baud+pattern B150 :: BaudRate+pattern B150 = BaudRate 150+-- | 200 baud+pattern B200 :: BaudRate+pattern B200 = BaudRate 200+-- | 300 baud+pattern B300 :: BaudRate+pattern B300 = BaudRate 300+-- | 600 baud+pattern B600 :: BaudRate+pattern B600 = BaudRate 600+-- | 1200 baud+pattern B1200 :: BaudRate+pattern B1200 = BaudRate 1200+-- | 1800 baud+pattern B1800 :: BaudRate+pattern B1800 = BaudRate 1800+-- | 2400 baud+pattern B2400 :: BaudRate+pattern B2400 = BaudRate 2400+-- | 4800 baud+pattern B4800 :: BaudRate+pattern B4800 = BaudRate 4800+-- | 9600 baud+pattern B9600 :: BaudRate+pattern B9600 = BaudRate 9600+-- | 19200 baud+pattern B19200 :: BaudRate+pattern B19200 = BaudRate 19200+-- | 38400 baud+pattern B38400 :: BaudRate+pattern B38400 = BaudRate 38400++#else++controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char controlChar termios cc = unsafePerformIO $ do withTerminalAttributes termios $ \p -> do let c_cc = (#ptr struct termios, c_cc) p@@ -316,39 +579,209 @@ let c_cc = (#ptr struct termios, c_cc) p pokeElemOff c_cc (#const VMIN) (fromIntegral count :: CCc) -data BaudRate- = B0- | B50- | B75- | B110- | B134- | B150- | B200- | B300- | B600- | B1200- | B1800- | B2400- | B4800- | B9600- | B19200- | B38400- | B57600- | B115200- deriving (Eq, Show)+-- | Serial line baudrate. The set of supported speeds is system-dependent.+-- Portable use of the provided pattern synonyms that are outside the list+-- mandated by POSIX requires @#ifdef@ guards.+--+-- Applications may need to be prepared to encounter speeds not known at+-- compile time, these can be handled generically via the 'BaudRate'+-- constructor. In other words, the provided pattern synonyms are not+-- necessarily a @COMPLETE@ set.+--+-- All non-zero /pseudo-terminal/ baud rates are functionally equivalent, and+-- the @pty@ driver may accept any speed within a suitable range. Requested+-- speeds may be rounded up or down to fit into the supported range.+--+newtype BaudRate = BaudRate CSpeed deriving (Eq, Ord, Show, Enum, Real, Num) +-- | Hang up+pattern B0 :: BaudRate+pattern B0 = BaudRate (#const B0)+-- | 50 baud+pattern B50 :: BaudRate+pattern B50 = BaudRate (#const B50)+-- | 75 baud+pattern B75 :: BaudRate+pattern B75 = BaudRate (#const B75)+-- | 110 baud+pattern B110 :: BaudRate+pattern B110 = BaudRate (#const B110)+-- | 134.5 baud+pattern B134 :: BaudRate+pattern B134 = BaudRate (#const B134)+-- | 150 baud+pattern B150 :: BaudRate+pattern B150 = BaudRate (#const B150)+-- | 200 baud+pattern B200 :: BaudRate+pattern B200 = BaudRate (#const B200)+-- | 300 baud+pattern B300 :: BaudRate+pattern B300 = BaudRate (#const B300)+-- | 600 baud+pattern B600 :: BaudRate+pattern B600 = BaudRate (#const B600)+-- | 1200 baud+pattern B1200 :: BaudRate+pattern B1200 = BaudRate (#const B1200)+-- | 1800 baud+pattern B1800 :: BaudRate+pattern B1800 = BaudRate (#const B1800)+-- | 2400 baud+pattern B2400 :: BaudRate+pattern B2400 = BaudRate (#const B2400)+-- | 4800 baud+pattern B4800 :: BaudRate+pattern B4800 = BaudRate (#const B4800)+-- | 9600 baud+pattern B9600 :: BaudRate+pattern B9600 = BaudRate (#const B9600)+-- | 19200 baud+pattern B19200 :: BaudRate+pattern B19200 = BaudRate (#const B19200)+-- | 38400 baud+pattern B38400 :: BaudRate+pattern B38400 = BaudRate (#const B38400)++#ifdef B7200+-- | 7200 baud, non-POSIX system-dependent extension+pattern B7200 :: BaudRate+pattern B7200 = BaudRate (#const B7200)+#endif+#ifdef B14400+-- | 14400 baud, non-POSIX system-dependent extension+pattern B14400 :: BaudRate+pattern B14400 = BaudRate (#const B14400)+#endif+#ifdef B28800+-- | 28800 baud, non-POSIX system-dependent extension+pattern B28800 :: BaudRate+pattern B28800 = BaudRate (#const B28800)+#endif+#ifdef B57600+-- | 57600 baud, non-POSIX system-dependent extension+pattern B57600 :: BaudRate+pattern B57600 = BaudRate (#const B57600)+#endif+#ifdef B76800+-- | 76800 baud, non-POSIX system-dependent extension+pattern B76800 :: BaudRate+pattern B76800 = BaudRate (#const B76800)+#endif+#ifdef B115200+-- | 115200 baud, non-POSIX system-dependent extension+pattern B115200 :: BaudRate+pattern B115200 = BaudRate (#const B115200)+#endif+#ifdef B230400+-- | 230400 baud, non-POSIX system-dependent extension+pattern B230400 :: BaudRate+pattern B230400 = BaudRate (#const B230400)+#endif+#ifdef B460800+-- | 460800 baud, non-POSIX system-dependent extension+pattern B460800 :: BaudRate+pattern B460800 = BaudRate (#const B460800)+#endif+#ifdef B500000+-- | 500000 baud, non-POSIX system-dependent extension+pattern B500000 :: BaudRate+pattern B500000 = BaudRate (#const B500000)+#endif+#ifdef B576000+-- | 576000 baud, non-POSIX system-dependent extension+pattern B576000 :: BaudRate+pattern B576000 = BaudRate (#const B576000)+#endif+#ifdef B921600+-- | 921600 baud, non-POSIX system-dependent extension+pattern B921600 :: BaudRate+pattern B921600 = BaudRate (#const B921600)+#endif+#ifdef B1000000+-- | 1000000 baud, non-POSIX system-dependent extension+pattern B1000000 :: BaudRate+pattern B1000000 = BaudRate (#const B1000000)+#endif+#ifdef B1152000+-- | 1152000 baud, non-POSIX system-dependent extension+pattern B1152000 :: BaudRate+pattern B1152000 = BaudRate (#const B1152000)+#endif+#ifdef B1500000+-- | 1500000 baud, non-POSIX system-dependent extension+pattern B1500000 :: BaudRate+pattern B1500000 = BaudRate (#const B1500000)+#endif+#ifdef B2000000+-- | 2000000 baud, non-POSIX system-dependent extension+pattern B2000000 :: BaudRate+pattern B2000000 = BaudRate (#const B2000000)+#endif+#ifdef B2500000+-- | 2500000 baud, non-POSIX system-dependent extension+pattern B2500000 :: BaudRate+pattern B2500000 = BaudRate (#const B2500000)+#endif+#ifdef B3000000+-- | 3000000 baud, non-POSIX system-dependent extension+pattern B3000000 :: BaudRate+pattern B3000000 = BaudRate (#const B3000000)+#endif+#ifdef B3500000+-- | 3500000 baud, non-POSIX system-dependent extension+pattern B3500000 :: BaudRate+pattern B3500000 = BaudRate (#const B3500000)+#endif+#ifdef B4000000+-- | 4000000 baud, non-POSIX system-dependent extension+pattern B4000000 :: BaudRate+pattern B4000000 = BaudRate (#const B4000000)+#endif++#endif // HAVE_TERMIOS_H++#if !defined(HAVE_TERMIOS_H)+ inputSpeed :: TerminalAttributes -> BaudRate+{-# WARNING inputSpeed+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+inputSpeed _ = throw (ioeSetLocation unsupportedOperation "inputSpeed")++withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes+{-# WARNING withInputSpeed+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+withInputSpeed _ _ = throw (ioeSetLocation unsupportedOperation "withInputSpeed")++outputSpeed :: TerminalAttributes -> BaudRate+{-# WARNING outputSpeed+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+outputSpeed _ = throw (ioeSetLocation unsupportedOperation "outputSpeed")++withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes+{-# WARNING withOutputSpeed+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+withOutputSpeed _ _ = throw (ioeSetLocation unsupportedOperation "withOutputSpeed")++getTerminalAttributes :: Fd -> IO TerminalAttributes+{-# WARNING getTerminalAttributes+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+getTerminalAttributes _ = ioError (ioeSetLocation unsupportedOperation "getTerminalAttributes")++#else++inputSpeed :: TerminalAttributes -> BaudRate inputSpeed termios = unsafePerformIO $ do withTerminalAttributes termios $ \p -> do w <- c_cfgetispeed p- return (word2Baud w)+ return (BaudRate w) foreign import capi unsafe "termios.h cfgetispeed" c_cfgetispeed :: Ptr CTermios -> IO CSpeed withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes-withInputSpeed termios br = unsafePerformIO $ do- withNewTermios termios $ \p -> c_cfsetispeed p (baud2Word br)+withInputSpeed termios (BaudRate br) = unsafePerformIO $ do+ withNewTermios termios $ \p -> c_cfsetispeed p br foreign import capi unsafe "termios.h cfsetispeed" c_cfsetispeed :: Ptr CTermios -> CSpeed -> IO CInt@@ -358,14 +791,14 @@ outputSpeed termios = unsafePerformIO $ do withTerminalAttributes termios $ \p -> do w <- c_cfgetospeed p- return (word2Baud w)+ return (BaudRate w) foreign import capi unsafe "termios.h cfgetospeed" c_cfgetospeed :: Ptr CTermios -> IO CSpeed withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes-withOutputSpeed termios br = unsafePerformIO $ do- withNewTermios termios $ \p -> c_cfsetospeed p (baud2Word br)+withOutputSpeed termios (BaudRate br) = unsafePerformIO $ do+ withNewTermios termios $ \p -> c_cfsetospeed p br foreign import capi unsafe "termios.h cfsetospeed" c_cfsetospeed :: Ptr CTermios -> CSpeed -> IO CInt@@ -382,11 +815,35 @@ foreign import capi unsafe "termios.h tcgetattr" c_tcgetattr :: CInt -> Ptr CTermios -> IO CInt +#endif // HAVE_TERMIOS_H+ data TerminalState = Immediately | WhenDrained | WhenFlushed +#if !defined(HAVE_TERMIOS_H)++setTerminalAttributes :: Fd+ -> TerminalAttributes+ -> TerminalState+ -> IO ()+{-# WARNING setTerminalAttributes+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+setTerminalAttributes _ _ _ = ioError (ioeSetLocation unsupportedOperation "setTerminalAttributes")++sendBreak :: Fd -> Int -> IO ()+{-# WARNING sendBreak+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+sendBreak _ _ = ioError (ioeSetLocation unsupportedOperation "sendBreak")++drainOutput :: Fd -> IO ()+{-# WARNING drainOutput+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+drainOutput _ = ioError (ioeSetLocation unsupportedOperation "drainOutput")++#else+ -- | @setTerminalAttributes fd attr ts@ calls @tcsetattr@ to change -- the @TerminalAttributes@ associated with @Fd@ @fd@ to -- @attr@, when the terminal is in the state indicated by @ts@.@@ -435,11 +892,22 @@ drainOutput _ = ioError (ioeSetLocation unsupportedOperation "drainOutput") #endif +#endif // HAVE_TERMIOS_H+ data QueueSelector = InputQueue -- TCIFLUSH | OutputQueue -- TCOFLUSH | BothQueues -- TCIOFLUSH +#if !defined(HAVE_TERMIOS_H)++discardData :: Fd -> QueueSelector -> IO ()+{-# WARNING discardData+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+discardData _ _ = ioError (ioeSetLocation unsupportedOperation "discardData")++#else+ -- | @discardData fd queues@ calls @tcflush@ to discard -- pending input and\/or output for @Fd@ @fd@, -- as indicated by the @QueueSelector@ @queues@.@@ -455,12 +923,33 @@ foreign import capi unsafe "termios.h tcflush" c_tcflush :: CInt -> CInt -> IO CInt +#endif // HAVE_TERMIOS_H+ data FlowAction = SuspendOutput -- ^ TCOOFF | RestartOutput -- ^ TCOON | TransmitStop -- ^ TCIOFF | TransmitStart -- ^ TCION +#if !defined(HAVE_TERMIOS_H)++controlFlow :: Fd -> FlowAction -> IO ()+{-# WARNING controlFlow+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+controlFlow _ _ = ioError (ioeSetLocation unsupportedOperation "controlFlow")++getTerminalProcessGroupID :: Fd -> IO ProcessGroupID+{-# WARNING getTerminalProcessGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+getTerminalProcessGroupID _ = ioError (ioeSetLocation unsupportedOperation "getTerminalProcessGroupID")++setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()+{-# WARNING setTerminalProcessGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TERMIOS_H@)" #-}+setTerminalProcessGroupID _ _ = ioError (ioeSetLocation unsupportedOperation "setTerminalProcessGroupID")++#else+ -- | @controlFlow fd action@ calls @tcflow@ to control the -- flow of data on @Fd@ @fd@, as indicated by -- @action@.@@ -498,6 +987,8 @@ foreign import ccall unsafe "tcsetpgrp" c_tcsetpgrp :: CInt -> CPid -> IO CInt +#endif // HAVE_TERMIOS_H+ -- ----------------------------------------------------------------------------- -- file descriptor queries @@ -517,6 +1008,8 @@ -- Convert Haskell ControlCharacter to Int +#if defined(HAVE_TERMIOS_H)+ cc2Word :: ControlCharacter -> Int cc2Word EndOfFile = (#const VEOF) cc2Word EndOfLine = (#const VEOL)@@ -528,65 +1021,6 @@ cc2Word Start = (#const VSTART) cc2Word Stop = (#const VSTOP) --- Convert Haskell BaudRate to unsigned integral type (Word)--baud2Word :: BaudRate -> CSpeed-baud2Word B0 = (#const B0)-baud2Word B50 = (#const B50)-baud2Word B75 = (#const B75)-baud2Word B110 = (#const B110)-baud2Word B134 = (#const B134)-baud2Word B150 = (#const B150)-baud2Word B200 = (#const B200)-baud2Word B300 = (#const B300)-baud2Word B600 = (#const B600)-baud2Word B1200 = (#const B1200)-baud2Word B1800 = (#const B1800)-baud2Word B2400 = (#const B2400)-baud2Word B4800 = (#const B4800)-baud2Word B9600 = (#const B9600)-baud2Word B19200 = (#const B19200)-baud2Word B38400 = (#const B38400)-#ifdef B57600-baud2Word B57600 = (#const B57600)-#else-baud2Word B57600 = error "B57600 not available on this system"-#endif-#ifdef B115200-baud2Word B115200 = (#const B115200)-#else-baud2Word B115200 = error "B115200 not available on this system"-#endif---- And convert a word back to a baud rate--- We really need some cpp macros here.--word2Baud :: CSpeed -> BaudRate-word2Baud x =- if x == (#const B0) then B0- else if x == (#const B50) then B50- else if x == (#const B75) then B75- else if x == (#const B110) then B110- else if x == (#const B134) then B134- else if x == (#const B150) then B150- else if x == (#const B200) then B200- else if x == (#const B300) then B300- else if x == (#const B600) then B600- else if x == (#const B1200) then B1200- else if x == (#const B1800) then B1800- else if x == (#const B2400) then B2400- else if x == (#const B4800) then B4800- else if x == (#const B9600) then B9600- else if x == (#const B19200) then B19200- else if x == (#const B38400) then B38400-#ifdef B57600- else if x == (#const B57600) then B57600-#endif-#ifdef B115200- else if x == (#const B115200) then B115200-#endif- else error "unknown baud rate"- -- Clear termios i_flag clearInputFlag :: CTcflag -> TerminalAttributes -> TerminalAttributes@@ -725,3 +1159,5 @@ _ <- action p1 return () return $ makeTerminalAttributes fp1++#endif // HAVE_TERMIOS_H
+ System/Posix/Terminal/PosixString.hsc view
@@ -0,0 +1,217 @@+{-# LANGUAGE CApiFFI #-}+-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.Terminal.PosixString+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- POSIX Terminal support+--+-----------------------------------------------------------------------------++module System.Posix.Terminal.PosixString (+ -- * Terminal support++ -- ** Terminal attributes+ TerminalAttributes,+ getTerminalAttributes,+ TerminalState(..),+ setTerminalAttributes,++ TerminalMode(..),+ withoutMode,+ withMode,+ terminalMode,+ bitsPerByte,+ withBits,++ ControlCharacter(..),+ controlChar,+ withCC,+ withoutCC,++ inputTime,+ withTime,+ minInput,+ withMinInput,++ BaudRate(..),+ inputSpeed,+ withInputSpeed,+ outputSpeed,+ withOutputSpeed,++ -- ** Terminal operations+ sendBreak,+ drainOutput,+ QueueSelector(..),+ discardData,+ FlowAction(..),+ controlFlow,++ -- ** Process groups+ getTerminalProcessGroupID,+ setTerminalProcessGroupID,++ -- ** Testing a file descriptor+ queryTerminal,+ getTerminalName,+ getControllingTerminalName,++ -- ** Pseudoterminal operations+ openPseudoTerminal,+ getSlaveTerminalName+ ) where++#include "HsUnix.h"++import Foreign+import System.Posix.Types+import System.Posix.Terminal.Common++#ifndef HAVE_OPENPTY+import Data.ByteString.Char8 as B ( pack, )+import System.Posix.IO.ByteString (defaultFileFlags, openFd, noctty, OpenMode(ReadWrite))+import System.OsString.Internal.Types (PosixString(..))+#if MIN_VERSION_filepath(1,5,0)+import qualified System.OsString.Data.ByteString.Short as SBS+import qualified System.OsString.Data.ByteString.Short as BC+#else+import qualified System.OsPath.Data.ByteString.Short as SBS+import qualified System.OsPath.Data.ByteString.Short as BC+#endif+#endif++import Foreign.C hiding (+ throwErrnoPath,+ throwErrnoPathIf,+ throwErrnoPathIf_,+ throwErrnoPathIfNull,+ throwErrnoPathIfMinus1,+ throwErrnoPathIfMinus1_ )++import System.OsPath.Types+import System.Posix.PosixPath.FilePath++#if !(HAVE_CTERMID && defined(HAVE_TERMIOS_H))+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif++-- | @getTerminalName fd@ calls @ttyname@ to obtain a name associated+-- with the terminal for @Fd@ @fd@. If @fd@ is associated+-- with a terminal, @getTerminalName@ returns the name of the+-- terminal.+getTerminalName :: Fd -> IO PosixPath+getTerminalName (Fd fd) = do+ s <- throwErrnoIfNull "getTerminalName" (c_ttyname fd)+ peekFilePath s++foreign import ccall unsafe "ttyname"+ c_ttyname :: CInt -> IO CString++-- | @getControllingTerminalName@ calls @ctermid@ to obtain+-- a name associated with the controlling terminal for the process. If a+-- controlling terminal exists,+-- @getControllingTerminalName@ returns the name of the+-- controlling terminal.+--+-- Throws 'IOError' (\"unsupported operation\") if platform does not+-- provide @ctermid(3)@ (use @#if HAVE_CTERMID@ CPP guard to+-- detect availability).+getControllingTerminalName :: IO PosixPath+#if HAVE_CTERMID && defined(HAVE_TERMIOS_H)+getControllingTerminalName = do+ s <- throwErrnoIfNull "getControllingTerminalName" (c_ctermid nullPtr)+ peekFilePath s++foreign import capi unsafe "termios.h ctermid"+ c_ctermid :: CString -> IO CString+#else+{-# WARNING getControllingTerminalName+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_CTERMID@)" #-}+getControllingTerminalName = ioError (ioeSetLocation unsupportedOperation "getControllingTerminalName")+#endif++-- | @getSlaveTerminalName@ calls @ptsname@ to obtain the name of the+-- slave terminal associated with a pseudoterminal pair. The file+-- descriptor to pass in must be that of the master.+getSlaveTerminalName :: Fd -> IO PosixPath++#ifdef HAVE_PTSNAME+getSlaveTerminalName (Fd fd) = do+ s <- throwErrnoIfNull "getSlaveTerminalName" (c_ptsname fd)+ peekFilePath s++foreign import capi unsafe "HsUnix.h ptsname"+ c_ptsname :: CInt -> IO CString+#else+{-# WARNING getSlaveTerminalName "getSlaveTerminalName: not available on this platform" #-}+getSlaveTerminalName _ =+ ioError (errnoToIOError "getSlaveTerminalName" eNOSYS Nothing Nothing)+#endif++-- -----------------------------------------------------------------------------+-- openPseudoTerminal needs to be here because it depends on+-- getSlaveTerminalName.++-- | @openPseudoTerminal@ creates a pseudoterminal (pty) pair, and+-- returns the newly created pair as a (@master@, @slave@) tuple.+openPseudoTerminal :: IO (Fd, Fd)++#ifdef HAVE_OPENPTY+openPseudoTerminal =+ alloca $ \p_master ->+ alloca $ \p_slave -> do+ throwErrnoIfMinus1_ "openPty"+ (c_openpty p_master p_slave nullPtr nullPtr nullPtr)+ master <- peek p_master+ slave <- peek p_slave+ return (Fd master, Fd slave)++foreign import ccall unsafe "openpty"+ c_openpty :: Ptr CInt -> Ptr CInt -> CString -> Ptr CTermios -> Ptr a+ -> IO CInt+#else+openPseudoTerminal = do+ (Fd master) <- openFd (B.pack "/dev/ptmx") ReadWrite+ defaultFileFlags{noctty=True}+ throwErrnoIfMinus1_ "openPseudoTerminal" (c_grantpt master)+ throwErrnoIfMinus1_ "openPseudoTerminal" (c_unlockpt master)+ slaveName <- getSlaveTerminalName (Fd master)+ slave <- openFd (SBS.fromShort . getPosixString $ slaveName) ReadWrite defaultFileFlags{noctty=True}+ pushModule slave "ptem"+ pushModule slave "ldterm"+# ifndef __hpux+ pushModule slave "ttcompat"+# endif /* __hpux */+ return (Fd master, slave)++-- Push a STREAMS module, for System V systems.+pushModule :: Fd -> String -> IO ()+pushModule (Fd fd) name =+ withCString name $ \p_name ->+ throwErrnoIfMinus1_ "openPseudoTerminal"+ (c_push_module fd p_name)++foreign import ccall unsafe "__hsunix_push_module"+ c_push_module :: CInt -> CString -> IO CInt++#if HAVE_PTSNAME+foreign import capi unsafe "HsUnix.h grantpt"+ c_grantpt :: CInt -> IO CInt++foreign import capi unsafe "HsUnix.h unlockpt"+ c_unlockpt :: CInt -> IO CInt+#else+c_grantpt :: CInt -> IO CInt+c_grantpt _ = return (fromIntegral (0::Int))++c_unlockpt :: CInt -> IO CInt+c_unlockpt _ = return (fromIntegral (0::Int))+#endif /* HAVE_PTSNAME */+#endif /* !HAVE_OPENPTY */
System/Posix/Time.hs view
@@ -1,10 +1,5 @@ {-# LANGUAGE CApiFFI #-}-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Time
System/Posix/Unistd.hsc view
@@ -1,10 +1,6 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-}-#if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Unistd@@ -156,6 +152,7 @@ -- /GHC Note/: the comment for 'usleep' also applies here. nanosleep :: Integer -> IO () #ifndef HAVE_NANOSLEEP+{-# WARNING nanosleep "nanosleep: not available on this platform" #-} nanosleep = error "nanosleep: not available on this platform" #else nanosleep 0 = return ()
System/Posix/User.hsc view
@@ -1,4 +1,4 @@-{-# LANGUAGE Trustworthy, CApiFFI #-}+{-# LANGUAGE Trustworthy, CApiFFI, PatternSynonyms, ViewPatterns #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.User@@ -25,13 +25,25 @@ getEffectiveUserName, -- *** The group database- GroupEntry(..),+ groupName,+ groupPassword,+ groupID,+ groupMembers,+ pattern GroupEntry, getGroupEntryForID, getGroupEntryForName, getAllGroupEntries, -- *** The user database- UserEntry(..),+ userName,+ userPassword,+ userID,+ userGroupID,+ userGecos,+ homeDirectory,+ userShell,+ pattern UserEntry,+ getUserEntryForID, getUserEntryForName, getAllUserEntries,@@ -53,23 +65,203 @@ import Foreign.Ptr import Foreign.Marshal import Foreign.Storable+import System.Posix.User.Common ( UserEntry, GroupEntry+#if defined(HAVE_PWD_H)+ , unpackUserEntry, unpackGroupEntry, LKUPTYPE(..), CPasswd, CGroup+#endif+ )+import qualified System.Posix.User.Common as User -#if !defined(HAVE_GETPWNAM_R) || !defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)-import Control.Concurrent.MVar ( MVar, newMVar, withMVar )+#if defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)+#if defined(freebsd_HOST_OS)+import Control.Concurrent (runInBoundThread, rtsSupportsBoundThreads) #endif-#ifdef HAVE_GETPWENT+import Control.Concurrent.MVar ( MVar, newMVar, withMVar ) import Control.Exception #endif import Control.Monad import System.IO.Error+import qualified Data.ByteString.Char8 as C8 --- internal types-data {-# CTYPE "struct passwd" #-} CPasswd-data {-# CTYPE "struct group" #-} CGroup+#if !defined(HAVE_PWD_H)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif ++#if !defined(HAVE_PWD_H)++getRealUserID :: IO UserID+{-# WARNING getRealUserID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getRealUserID = ioError (ioeSetLocation unsupportedOperation "getRealUserID")++getRealGroupID :: IO GroupID+{-# WARNING getRealGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getRealGroupID = ioError (ioeSetLocation unsupportedOperation "getRealGroupID")++getEffectiveUserID :: IO UserID+{-# WARNING getEffectiveUserID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getEffectiveUserID = ioError (ioeSetLocation unsupportedOperation "getEffectiveUserID")++getEffectiveGroupID :: IO GroupID+{-# WARNING getEffectiveGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getEffectiveGroupID = ioError (ioeSetLocation unsupportedOperation "getEffectiveGroupID")++getGroups :: IO [GroupID]+{-# WARNING getGroups+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getGroups = ioError (ioeSetLocation unsupportedOperation "getGroups")++setGroups :: [GroupID] -> IO ()+{-# WARNING setGroups+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setGroups _ = ioError (ioeSetLocation unsupportedOperation "setGroups")++getLoginName :: IO String+{-# WARNING getLoginName+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getLoginName = ioError (ioeSetLocation unsupportedOperation "getLoginName")++setUserID :: UserID -> IO ()+{-# WARNING setUserID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setUserID _ = ioError (ioeSetLocation unsupportedOperation "setUserID")++setEffectiveUserID :: UserID -> IO ()+{-# WARNING setEffectiveUserID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setEffectiveUserID _ = ioError (ioeSetLocation unsupportedOperation "setEffectiveUserID")++setGroupID :: GroupID -> IO ()+{-# WARNING setGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setGroupID _ = ioError (ioeSetLocation unsupportedOperation "setGroupID")++setEffectiveGroupID :: GroupID -> IO ()+{-# WARNING setEffectiveGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setEffectiveGroupID _ = ioError (ioeSetLocation unsupportedOperation "setEffectiveGroupID")++getEffectiveUserName :: IO String+{-# WARNING getEffectiveUserName+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getEffectiveUserName = ioError (ioeSetLocation unsupportedOperation "getEffectiveUserName")++#else -- -------------------------------------------------------------------------------- user environemnt+-- Thread safety of passwd/group database access APIs:+--+-- All supported unix platforms have @get(pw|gr)(nam|[ug]id)_r(3)@, which+-- store the result in a caller provided buffer, which solves the most+-- immediate thread-safety issues.+--+-- Things are more complicated for getpwent(3) and getgrent(3).+--+-- * On Linux systems, these read a global open file, opened via+-- setpwent(3) and closed via endpwent(3). Only one thread at+-- a time can safely iterate through the file.+--+-- * On macOS (through Catalina 10.15), there is no getpwent_r(3) or+-- getgrent_r(3), so a lock is also required for safe buffer sharing.+--+-- * On FreeBSD, in the default configuration with passwd lookups configured+-- in nsswitch.conf to use "compat" rather than "files", the getpwnam_r(3)+-- and getpwuid_r(3) functions reset the iterator index used by getpwent(3).+-- A bug [report](https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252094)+-- has been filed to track this long-standing issue. A similar issue affects+-- getgrent(3), this time regardless of the nsswitch.conf setting. This too+-- should be fixed at some point in the future. The state in question is+-- thread-specific, so both issues only affect overlapping use of the @*ent@+-- and @*(nam|[ug]id)_r(3)@ functions in the /same/ thread.+--+-- * Despite rather similar manpages for getpwent(3) and getpwnam(3), ... as+-- on FreeBSD, the above issue is not seen on NetBSD or macOS.+--+-- This is not an issue with 1-to-1 thread models, where the code executing+-- @get(pw|gr)ent@ has exclusive use of its thread, but it is a real issue+-- for Haskell with its many-to-1 green threads, because multiple `forkIO`+-- threads may take turns using the same underlying OS thread, breaking the+-- thread-safety of the @*_r@ functions, which mutate the file-offset of the+-- open file shared with any overlapping execution of @*ent(3)@ in the same+-- thread.+--+-- Consequently, correct portable support for @get(pw|gr)ent(3)@ is rather+-- non-trivial. In the threaded runtime, we can run these functions in a+-- /bound thread/ (via 'forkOS'), thereby avoiding the FreeBSD issues. We+-- still need a lock to serialise multiple threads calling these functions+-- on at least macOS for lack of @_r@ equivalents. While on FreeBSD we could+-- use @getpwent_r(3)@ and @getgrent_r(3)@ in a bound thread without any+-- locks, implementing this special case is likely not worthwhile.+--+-- In the non-threaded runtime, `forkOS` is not available, and so on FreeBSD+-- systems we have to also lock the @*(nam|[ug]id)_r(3)@ functions to avoid+-- concurrent use with @*ent(3)@.+--+-- FWIW, the below Perl one-liners will quickly show whether interleaved calls+-- of getpwuid() or getgrgid() disturb iteration through all the entries. If+-- each line of output is distinct, there is likely no issue. If the same+-- passwd or group entry repeats multiple times, the system is affected.+--+-- > for ($i=0;$i<3;++$i) {getpwuid(0); print join(":",getpwent()),"\n"}+-- > for ($i=0;$i<3;++$i) {getgrgid(0); print join(":",getgrent()),"\n"}+--+-- XXX: It has been suggested, not without some merit, that attempts to+-- enumerate /all/ users or /all/ groups are fundamentally flawed. Modern+-- unix systems have a variety nsswitch backends, some of which instantiate+-- users on demand or may enumerate slowly or not at all. We could shed a+-- lot of complexity by deprecating the "get all" functions and simply+-- always returning an empty list.+-- +#if defined(HAVE_GETPWENT)+pwlock :: MVar ()+pwlock = unsafePerformIO $ newMVar ()+{-# NOINLINE pwlock #-}++lockpw :: LKUPTYPE -> IO a -> IO a+#if defined(freebsd_HOST_OS)+lockpw GETONE+ | rtsSupportsBoundThreads = id+ | otherwise = withMVar pwlock . const+lockpw GETALL+ | rtsSupportsBoundThreads = runInBoundThread . withMVar pwlock . const+ | otherwise = withMVar pwlock . const+#else+lockpw GETONE = id+lockpw GETALL = withMVar pwlock . const+#endif+#else+lockpw _ = id+#endif++#if defined(HAVE_GETGRENT)+grlock :: MVar ()+grlock = unsafePerformIO $ newMVar ()+{-# NOINLINE grlock #-}++lockgr :: LKUPTYPE -> IO a -> IO a+#if defined(freebsd_HOST_OS)+lockgr GETONE+ | rtsSupportsBoundThreads = id+ | otherwise = withMVar grlock . const+lockgr GETALL+ | rtsSupportsBoundThreads = runInBoundThread . withMVar grlock . const+ | otherwise = withMVar grlock . const+#else+lockgr GETONE = id+lockgr GETALL = withMVar grlock . const+#endif+#else+lockgr _ = id+#endif++-- -----------------------------------------------------------------------------+-- user environment+ -- | @getRealUserID@ calls @getuid@ to obtain the real @UserID@ -- associated with the current process. getRealUserID :: IO UserID@@ -127,7 +319,6 @@ c_setgroups :: CInt -> Ptr CGid -> IO CInt - -- | @getLoginName@ calls @getlogin@ to obtain the login name -- associated with the current process. getLoginName :: IO String@@ -186,32 +377,69 @@ pw <- getUserEntryForID euid return (userName pw) +#endif // HAVE_PWD_H+ -- ----------------------------------------------------------------------------- -- The group database (grp.h) -data GroupEntry =- GroupEntry {- groupName :: String, -- ^ The name of this group (gr_name)- groupPassword :: String, -- ^ The password for this group (gr_passwd)- groupID :: GroupID, -- ^ The unique numeric ID for this group (gr_gid)- groupMembers :: [String] -- ^ A list of zero or more usernames that are members (gr_mem)- } deriving (Show, Read, Eq)+groupName :: GroupEntry -> String+groupName (GroupEntry gn _ _ _) = gn +groupPassword :: GroupEntry -> String+groupPassword (GroupEntry _ gp _ _) = gp++groupID :: GroupEntry -> GroupID+groupID (GroupEntry _ _ id' _) = id'++groupMembers :: GroupEntry -> [String]+groupMembers (GroupEntry _ _ _ gm) = gm++-- | Manually constructing 'GroupEntry' in String modules is discouraged. It will truncate+-- Chars to 8bit. Use 'System.Posix.User.ByteString' instead.+pattern GroupEntry :: String -- ^ The name of this group (gr_name)+ -> String -- ^ The password for this group (gr_passwd)+ -> GroupID -- ^ The unique numeric ID for this group (gr_gid)+ -> [String] -- ^ A list of zero or more usernames that are members (gr_mem)+ -> GroupEntry+pattern GroupEntry gn gp gi gm <- User.GroupEntry (C8.unpack -> gn) (C8.unpack -> gp) gi (fmap C8.unpack -> gm) where+ GroupEntry gn gp gi gm = User.GroupEntry (C8.pack gn) (C8.pack gp) gi (C8.pack <$> gm)+{-# COMPLETE GroupEntry #-}++#if !defined(HAVE_PWD_H)++getGroupEntryForID :: GroupID -> IO GroupEntry+{-# WARNING getGroupEntryForID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getGroupEntryForID _ = ioError (ioeSetLocation unsupportedOperation "getGroupEntryForID")++getGroupEntryForName :: String -> IO GroupEntry+{-# WARNING getGroupEntryForName+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getGroupEntryForName _ = ioError (ioeSetLocation unsupportedOperation "getGroupEntryForName")++getAllGroupEntries :: IO [GroupEntry]+{-# WARNING getAllGroupEntries+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getAllGroupEntries = ioError (ioeSetLocation unsupportedOperation "getAllGroupEntries")++#else+ -- | @getGroupEntryForID gid@ calls @getgrgid_r@ to obtain -- the @GroupEntry@ information associated with @GroupID@ -- @gid@. This operation may fail with 'isDoesNotExistError' -- if no such group exists. getGroupEntryForID :: GroupID -> IO GroupEntry #ifdef HAVE_GETGRGID_R-getGroupEntryForID gid =- allocaBytes (#const sizeof(struct group)) $ \pgr ->- doubleAllocWhileERANGE "getGroupEntryForID" "group" grBufSize unpackGroupEntry $- c_getgrgid_r gid pgr+getGroupEntryForID gid = lockgr GETONE $+ allocaBytes (#const sizeof(struct group)) $ \pgr ->+ doubleAllocWhileERANGE "getGroupEntryForID" "group"+ grBufSize unpackGroupEntry $ c_getgrgid_r gid pgr -foreign import capi unsafe "HsUnix.h getgrgid_r"+foreign import capi safe "HsUnix.h getgrgid_r" c_getgrgid_r :: CGid -> Ptr CGroup -> CString -> CSize -> Ptr (Ptr CGroup) -> IO CInt #else+{-# WARNING getGroupEntryForID "System.Posix.User.getGroupEntryForID: not supported" #-} getGroupEntryForID = error "System.Posix.User.getGroupEntryForID: not supported" #endif @@ -221,16 +449,17 @@ -- if no such group exists. getGroupEntryForName :: String -> IO GroupEntry #ifdef HAVE_GETGRNAM_R-getGroupEntryForName name =- allocaBytes (#const sizeof(struct group)) $ \pgr ->- withCAString name $ \ pstr ->- doubleAllocWhileERANGE "getGroupEntryForName" "group" grBufSize unpackGroupEntry $- c_getgrnam_r pstr pgr+getGroupEntryForName name = lockgr GETONE $+ allocaBytes (#const sizeof(struct group)) $ \pgr ->+ withCAString name $ \ pstr ->+ doubleAllocWhileERANGE "getGroupEntryForName" "group"+ grBufSize unpackGroupEntry $ c_getgrnam_r pstr pgr -foreign import capi unsafe "HsUnix.h getgrnam_r"+foreign import capi safe "HsUnix.h getgrnam_r" c_getgrnam_r :: CString -> Ptr CGroup -> CString -> CSize -> Ptr (Ptr CGroup) -> IO CInt #else+{-# WARNING getGroupEntryForName "System.Posix.User.getGroupEntryForName: not supported" #-} getGroupEntryForName = error "System.Posix.User.getGroupEntryForName: not supported" #endif @@ -244,24 +473,21 @@ -- getAllGroupEntries :: IO [GroupEntry] #ifdef HAVE_GETGRENT-getAllGroupEntries =- withMVar lock $ \_ -> bracket_ c_setgrent c_endgrent $ worker []- where worker accum =- do resetErrno- ppw <- throwErrnoIfNullAndError "getAllGroupEntries" $- c_getgrent- if ppw == nullPtr- then return (reverse accum)- else do thisentry <- unpackGroupEntry ppw- worker (thisentry : accum)+getAllGroupEntries = lockgr GETALL $ bracket_ c_setgrent c_endgrent $ worker []+ where+ worker accum = do+ resetErrno+ ppw <- throwErrnoIfNullAndError "getAllGroupEntries" $ c_getgrent+ if ppw == nullPtr+ then return (reverse accum)+ else do thisentry <- unpackGroupEntry ppw+ worker (thisentry : accum) -foreign import ccall unsafe "getgrent"- c_getgrent :: IO (Ptr CGroup)-foreign import ccall unsafe "setgrent"- c_setgrent :: IO ()-foreign import ccall unsafe "endgrent"- c_endgrent :: IO ()+foreign import ccall safe "getgrent" c_getgrent :: IO (Ptr CGroup)+foreign import ccall safe "setgrent" c_setgrent :: IO ()+foreign import ccall safe "endgrent" c_endgrent :: IO () #else+{-# WARNING getAllGroupEntries "System.Posix.User.getAllGroupEntries: not supported" #-} getAllGroupEntries = error "System.Posix.User.getAllGroupEntries: not supported" #endif @@ -274,65 +500,74 @@ #endif #endif -unpackGroupEntry :: Ptr CGroup -> IO GroupEntry-unpackGroupEntry ptr = do- name <- (#peek struct group, gr_name) ptr >>= peekCAString- passwd <- (#peek struct group, gr_passwd) ptr >>= peekCAString- gid <- (#peek struct group, gr_gid) ptr- mem <- (#peek struct group, gr_mem) ptr- members <- peekArray0 nullPtr mem >>= mapM peekCAString- return (GroupEntry name passwd gid members)+#endif // HAVE_PWD_H -- ----------------------------------------------------------------------------- -- The user database (pwd.h) -data UserEntry =- UserEntry {- userName :: String, -- ^ Textual name of this user (pw_name)- userPassword :: String, -- ^ Password -- may be empty or fake if shadow is in use (pw_passwd)- userID :: UserID, -- ^ Numeric ID for this user (pw_uid)- userGroupID :: GroupID, -- ^ Primary group ID (pw_gid)- userGecos :: String, -- ^ Usually the real name for the user (pw_gecos)- homeDirectory :: String, -- ^ Home directory (pw_dir)- userShell :: String -- ^ Default shell (pw_shell)- } deriving (Show, Read, Eq)+userName :: UserEntry -> String+userName (UserEntry n _ _ _ _ _ _) = n ------ getpwuid and getpwnam leave results in a static object. Subsequent--- calls modify the same object, which isn't threadsafe. We attempt to--- mitigate this issue, on platforms that don't provide the safe _r versions------ Also, getpwent/setpwent require a global lock since they maintain--- an internal file position pointer.-#if !defined(HAVE_GETPWNAM_R) || !defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)-lock :: MVar ()-lock = unsafePerformIO $ newMVar ()-{-# NOINLINE lock #-}-#endif+userPassword :: UserEntry -> String+userPassword (UserEntry _ p _ _ _ _ _) = p --- | @getUserEntryForID gid@ calls @getpwuid_r@ to obtain+userID :: UserEntry -> UserID+userID (UserEntry _ _ id' _ _ _ _) = id'++userGroupID :: UserEntry -> GroupID+userGroupID (UserEntry _ _ _ gid _ _ _) = gid++userGecos :: UserEntry -> String+userGecos (UserEntry _ _ _ _ ge _ _) = ge++homeDirectory :: UserEntry -> String+homeDirectory (UserEntry _ _ _ _ _ hd _) = hd++userShell :: UserEntry -> String+userShell (UserEntry _ _ _ _ _ _ us) = us++-- | Manually constructing 'UserEntry' in String modules is discouraged. It will truncate+-- Chars to 8bit. Use 'System.Posix.User.ByteString' instead.+pattern UserEntry :: String -- ^ Textual name of this user (pw_name)+ -> String -- ^ Password -- may be empty or fake if shadow is in use (pw_passwd)+ -> UserID -- ^ Numeric ID for this user (pw_uid)+ -> GroupID -- ^ Primary group ID (pw_gid)+ -> String -- ^ Usually the real name for the user (pw_gecos)+ -> String -- ^ Home directory (pw_dir)+ -> String -- ^ Default shell (pw_shell)+ -> UserEntry+pattern UserEntry un up ui ugi ug hd us <- User.UserEntry (C8.unpack -> un)+ (C8.unpack -> up)+ ui+ ugi+ (C8.unpack -> ug)+ (C8.unpack -> hd)+ (C8.unpack -> us) where+ UserEntry un up ui ugi ug hd us = User.UserEntry (C8.pack un)+ (C8.pack up)+ ui+ ugi+ (C8.pack ug)+ (C8.pack hd)+ (C8.pack us)+{-# COMPLETE UserEntry #-}++-- | @getUserEntryForID uid@ calls @getpwuid_r@ to obtain -- the @UserEntry@ information associated with @UserID@ -- @uid@. This operation may fail with 'isDoesNotExistError' -- if no such user exists. getUserEntryForID :: UserID -> IO UserEntry #ifdef HAVE_GETPWUID_R-getUserEntryForID uid =- allocaBytes (#const sizeof(struct passwd)) $ \ppw ->- doubleAllocWhileERANGE "getUserEntryForID" "user" pwBufSize unpackUserEntry $- c_getpwuid_r uid ppw+getUserEntryForID uid = lockpw GETONE $+ allocaBytes (#const sizeof(struct passwd)) $ \ppw ->+ doubleAllocWhileERANGE "getUserEntryForID" "user"+ pwBufSize unpackUserEntry $ c_getpwuid_r uid ppw -foreign import capi unsafe "HsUnix.h getpwuid_r"+foreign import capi safe "HsUnix.h getpwuid_r" c_getpwuid_r :: CUid -> Ptr CPasswd -> CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt-#elif HAVE_GETPWUID-getUserEntryForID uid = do- withMVar lock $ \_ -> do- ppw <- throwErrnoIfNull "getUserEntryForID" $ c_getpwuid uid- unpackUserEntry ppw--foreign import ccall unsafe "getpwuid"- c_getpwuid :: CUid -> IO (Ptr CPasswd) #else+{-# WARNING getUserEntryForID "System.Posix.User.getUserEntryForID: not supported" #-} getUserEntryForID = error "System.Posix.User.getUserEntryForID: not supported" #endif @@ -342,25 +577,17 @@ -- if no such user exists. getUserEntryForName :: String -> IO UserEntry #if HAVE_GETPWNAM_R-getUserEntryForName name =- allocaBytes (#const sizeof(struct passwd)) $ \ppw ->- withCAString name $ \ pstr ->- doubleAllocWhileERANGE "getUserEntryForName" "user" pwBufSize unpackUserEntry $- c_getpwnam_r pstr ppw+getUserEntryForName name = lockpw GETONE $+ allocaBytes (#const sizeof(struct passwd)) $ \ppw ->+ withCAString name $ \ pstr ->+ doubleAllocWhileERANGE "getUserEntryForName" "user"+ pwBufSize unpackUserEntry $ c_getpwnam_r pstr ppw -foreign import capi unsafe "HsUnix.h getpwnam_r"+foreign import capi safe "HsUnix.h getpwnam_r" c_getpwnam_r :: CString -> Ptr CPasswd -> CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt-#elif HAVE_GETPWNAM-getUserEntryForName name = do- withCAString name $ \ pstr -> do- withMVar lock $ \_ -> do- ppw <- throwErrnoIfNull "getUserEntryForName" $ c_getpwnam pstr- unpackUserEntry ppw--foreign import ccall unsafe "getpwnam"- c_getpwnam :: CString -> IO (Ptr CPasswd) #else+{-# WARNING getUserEntryForName "System.Posix.User.getUserEntryForName: not supported" #-} getUserEntryForName = error "System.Posix.User.getUserEntryForName: not supported" #endif @@ -368,24 +595,21 @@ -- repeatedly calling @getpwent@ getAllUserEntries :: IO [UserEntry] #ifdef HAVE_GETPWENT-getAllUserEntries =- withMVar lock $ \_ -> bracket_ c_setpwent c_endpwent $ worker []- where worker accum =- do resetErrno- ppw <- throwErrnoIfNullAndError "getAllUserEntries" $- c_getpwent- if ppw == nullPtr- then return (reverse accum)- else do thisentry <- unpackUserEntry ppw- worker (thisentry : accum)+getAllUserEntries = lockpw GETALL $ bracket_ c_setpwent c_endpwent $ worker []+ where+ worker accum = do+ resetErrno+ ppw <- throwErrnoIfNullAndError "getAllUserEntries" $ c_getpwent+ if ppw == nullPtr+ then return (reverse accum)+ else do thisentry <- unpackUserEntry ppw+ worker (thisentry : accum) -foreign import capi unsafe "HsUnix.h getpwent"- c_getpwent :: IO (Ptr CPasswd)-foreign import capi unsafe "HsUnix.h setpwent"- c_setpwent :: IO ()-foreign import capi unsafe "HsUnix.h endpwent"- c_endpwent :: IO ()+foreign import ccall safe "getpwent" c_getpwent :: IO (Ptr CPasswd)+foreign import ccall safe "setpwent" c_setpwent :: IO ()+foreign import ccall safe "endpwent" c_endpwent :: IO () #else+{-# WARNING getAllUserEntries "System.Posix.User.getAllUserEntries: not supported" #-} getAllUserEntries = error "System.Posix.User.getAllUserEntries: not supported" #endif @@ -398,7 +622,7 @@ #endif #endif -#ifdef HAVE_SYSCONF+#if defined(HAVE_SYSCONF) && defined(HAVE_PWD_H) foreign import ccall unsafe "sysconf" c_sysconf :: CInt -> IO CLong @@ -412,6 +636,8 @@ return $ if v == (-1) then def else v #endif +#if defined(HAVE_PWD_H)+ -- The following function is used by the getgr*_r, c_getpw*_r -- families of functions. These functions return their result -- in a struct that contains strings and they need a buffer@@ -448,20 +674,6 @@ ioError $ flip ioeSetErrorString ("no such " ++ enttype) $ mkIOError doesNotExistErrorType loc Nothing Nothing -unpackUserEntry :: Ptr CPasswd -> IO UserEntry-unpackUserEntry ptr = do- name <- (#peek struct passwd, pw_name) ptr >>= peekCAString- passwd <- (#peek struct passwd, pw_passwd) ptr >>= peekCAString- uid <- (#peek struct passwd, pw_uid) ptr- gid <- (#peek struct passwd, pw_gid) ptr-#ifdef HAVE_NO_PASSWD_PW_GECOS- gecos <- return "" -- pw_gecos does not exist on android-#else- gecos <- (#peek struct passwd, pw_gecos) ptr >>= peekCAString-#endif- dir <- (#peek struct passwd, pw_dir) ptr >>= peekCAString- shell <- (#peek struct passwd, pw_shell) ptr >>= peekCAString- return (UserEntry name passwd uid gid gecos dir shell) -- Used when a function returns NULL to indicate either an error or -- EOF, depending on whether the global errno is nonzero.@@ -472,3 +684,5 @@ if rc == nullPtr && errno /= eOK then throwErrno loc else return rc++#endif // HAVE_PWD_H
+ System/Posix/User/ByteString.hsc view
@@ -0,0 +1,604 @@+{-# LANGUAGE Trustworthy, CApiFFI, PatternSynonyms, ViewPatterns #-}+-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.User.ByteString+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- POSIX user\/group support+--+-----------------------------------------------------------------------------++module System.Posix.User.ByteString (+ -- * User environment+ -- ** Querying the user environment+ getRealUserID,+ getRealGroupID,+ getEffectiveUserID,+ getEffectiveGroupID,+ getGroups,+ getLoginName,+ getEffectiveUserName,++ -- *** The group database+ GroupEntry(..),++ getGroupEntryForID,+ getGroupEntryForName,+ getAllGroupEntries,++ -- *** The user database+ UserEntry(..),++ getUserEntryForID,+ getUserEntryForName,+ getAllUserEntries,++ -- ** Modifying the user environment+ setUserID,+ setGroupID,+ setEffectiveUserID,+ setEffectiveGroupID,+ setGroups++ ) where++#include "HsUnix.h"++import System.Posix.Types+import System.IO.Unsafe (unsafePerformIO)+import Foreign.C ( CSize(..), CInt(..), CString, CLong(..), getErrno, throwErrno, eOK, throwErrnoIfMinus1_, throwErrnoIfNull, resetErrno, Errno(..), eRANGE, errnoToIOError )+import Foreign.Ptr+import Foreign.Marshal+import Foreign.Storable++import System.Posix.User.Common+#if defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)+#if defined(freebsd_HOST_OS)+import Control.Concurrent (runInBoundThread, rtsSupportsBoundThreads)+#endif+import Control.Concurrent.MVar ( MVar, newMVar, withMVar )+import Control.Exception+#endif+import Control.Monad+import System.IO.Error+import Data.ByteString ( ByteString, packCString, useAsCString )++#if !defined(HAVE_PWD_H)+import System.IO.Error ( ioeSetLocation )+import GHC.IO.Exception ( unsupportedOperation )+#endif+++#if !defined(HAVE_PWD_H)++getRealUserID :: IO UserID+{-# WARNING getRealUserID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getRealUserID = ioError (ioeSetLocation unsupportedOperation "getRealUserID")++getRealGroupID :: IO GroupID+{-# WARNING getRealGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getRealGroupID = ioError (ioeSetLocation unsupportedOperation "getRealGroupID")++getEffectiveUserID :: IO UserID+{-# WARNING getEffectiveUserID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getEffectiveUserID = ioError (ioeSetLocation unsupportedOperation "getEffectiveUserID")++getEffectiveGroupID :: IO GroupID+{-# WARNING getEffectiveGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getEffectiveGroupID = ioError (ioeSetLocation unsupportedOperation "getEffectiveGroupID")++getGroups :: IO [GroupID]+{-# WARNING getGroups+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getGroups = ioError (ioeSetLocation unsupportedOperation "getGroups")++setGroups :: [GroupID] -> IO ()+{-# WARNING setGroups+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setGroups _ = ioError (ioeSetLocation unsupportedOperation "setGroups")++getLoginName :: IO ByteString+{-# WARNING getLoginName+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getLoginName = ioError (ioeSetLocation unsupportedOperation "getLoginName")++setUserID :: UserID -> IO ()+{-# WARNING setUserID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setUserID _ = ioError (ioeSetLocation unsupportedOperation "setUserID")++setEffectiveUserID :: UserID -> IO ()+{-# WARNING setEffectiveUserID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setEffectiveUserID _ = ioError (ioeSetLocation unsupportedOperation "setEffectiveUserID")++setGroupID :: GroupID -> IO ()+{-# WARNING setGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setGroupID _ = ioError (ioeSetLocation unsupportedOperation "setGroupID")++setEffectiveGroupID :: GroupID -> IO ()+{-# WARNING setEffectiveGroupID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+setEffectiveGroupID _ = ioError (ioeSetLocation unsupportedOperation "setEffectiveGroupID")++getEffectiveUserName :: IO ByteString+{-# WARNING getEffectiveUserName+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getEffectiveUserName = ioError (ioeSetLocation unsupportedOperation "getEffectiveUserName")++#else+-- -----------------------------------------------------------------------------+-- Thread safety of passwd/group database access APIs:+--+-- All supported unix platforms have @get(pw|gr)(nam|[ug]id)_r(3)@, which+-- store the result in a caller provided buffer, which solves the most+-- immediate thread-safety issues.+--+-- Things are more complicated for getpwent(3) and getgrent(3).+--+-- * On Linux systems, these read a global open file, opened via+-- setpwent(3) and closed via endpwent(3). Only one thread at+-- a time can safely iterate through the file.+--+-- * On macOS (through Catalina 10.15), there is no getpwent_r(3) or+-- getgrent_r(3), so a lock is also required for safe buffer sharing.+--+-- * On FreeBSD, in the default configuration with passwd lookups configured+-- in nsswitch.conf to use "compat" rather than "files", the getpwnam_r(3)+-- and getpwuid_r(3) functions reset the iterator index used by getpwent(3).+-- A bug [report](https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252094)+-- has been filed to track this long-standing issue. A similar issue affects+-- getgrent(3), this time regardless of the nsswitch.conf setting. This too+-- should be fixed at some point in the future. The state in question is+-- thread-specific, so both issues only affect overlapping use of the @*ent@+-- and @*(nam|[ug]id)_r(3)@ functions in the /same/ thread.+--+-- * Despite rather similar manpages for getpwent(3) and getpwnam(3), ... as+-- on FreeBSD, the above issue is not seen on NetBSD or macOS.+--+-- This is not an issue with 1-to-1 thread models, where the code executing+-- @get(pw|gr)ent@ has exclusive use of its thread, but it is a real issue+-- for Haskell with its many-to-1 green threads, because multiple `forkIO`+-- threads may take turns using the same underlying OS thread, breaking the+-- thread-safety of the @*_r@ functions, which mutate the file-offset of the+-- open file shared with any overlapping execution of @*ent(3)@ in the same+-- thread.+--+-- Consequently, correct portable support for @get(pw|gr)ent(3)@ is rather+-- non-trivial. In the threaded runtime, we can run these functions in a+-- /bound thread/ (via 'forkOS'), thereby avoiding the FreeBSD issues. We+-- still need a lock to serialise multiple threads calling these functions+-- on at least macOS for lack of @_r@ equivalents. While on FreeBSD we could+-- use @getpwent_r(3)@ and @getgrent_r(3)@ in a bound thread without any+-- locks, implementing this special case is likely not worthwhile.+--+-- In the non-threaded runtime, `forkOS` is not available, and so on FreeBSD+-- systems we have to also lock the @*(nam|[ug]id)_r(3)@ functions to avoid+-- concurrent use with @*ent(3)@.+--+-- FWIW, the below Perl one-liners will quickly show whether interleaved calls+-- of getpwuid() or getgrgid() disturb iteration through all the entries. If+-- each line of output is distinct, there is likely no issue. If the same+-- passwd or group entry repeats multiple times, the system is affected.+--+-- > for ($i=0;$i<3;++$i) {getpwuid(0); print join(":",getpwent()),"\n"}+-- > for ($i=0;$i<3;++$i) {getgrgid(0); print join(":",getgrent()),"\n"}+--+-- XXX: It has been suggested, not without some merit, that attempts to+-- enumerate /all/ users or /all/ groups are fundamentally flawed. Modern+-- unix systems have a variety nsswitch backends, some of which instantiate+-- users on demand or may enumerate slowly or not at all. We could shed a+-- lot of complexity by deprecating the "get all" functions and simply+-- always returning an empty list.+--++#if defined(HAVE_GETPWENT)+pwlock :: MVar ()+pwlock = unsafePerformIO $ newMVar ()+{-# NOINLINE pwlock #-}++lockpw :: LKUPTYPE -> IO a -> IO a+#if defined(freebsd_HOST_OS)+lockpw GETONE+ | rtsSupportsBoundThreads = id+ | otherwise = withMVar pwlock . const+lockpw GETALL+ | rtsSupportsBoundThreads = runInBoundThread . withMVar pwlock . const+ | otherwise = withMVar pwlock . const+#else+lockpw GETONE = id+lockpw GETALL = withMVar pwlock . const+#endif+#else+lockpw _ = id+#endif++#if defined(HAVE_GETGRENT)+grlock :: MVar ()+grlock = unsafePerformIO $ newMVar ()+{-# NOINLINE grlock #-}++lockgr :: LKUPTYPE -> IO a -> IO a+#if defined(freebsd_HOST_OS)+lockgr GETONE+ | rtsSupportsBoundThreads = id+ | otherwise = withMVar grlock . const+lockgr GETALL+ | rtsSupportsBoundThreads = runInBoundThread . withMVar grlock . const+ | otherwise = withMVar grlock . const+#else+lockgr GETONE = id+lockgr GETALL = withMVar grlock . const+#endif+#else+lockgr _ = id+#endif++-- -----------------------------------------------------------------------------+-- user environment++-- | @getRealUserID@ calls @getuid@ to obtain the real @UserID@+-- associated with the current process.+getRealUserID :: IO UserID+getRealUserID = c_getuid++foreign import ccall unsafe "getuid"+ c_getuid :: IO CUid++-- | @getRealGroupID@ calls @getgid@ to obtain the real @GroupID@+-- associated with the current process.+getRealGroupID :: IO GroupID+getRealGroupID = c_getgid++foreign import ccall unsafe "getgid"+ c_getgid :: IO CGid++-- | @getEffectiveUserID@ calls @geteuid@ to obtain the effective+-- @UserID@ associated with the current process.+getEffectiveUserID :: IO UserID+getEffectiveUserID = c_geteuid++foreign import ccall unsafe "geteuid"+ c_geteuid :: IO CUid++-- | @getEffectiveGroupID@ calls @getegid@ to obtain the effective+-- @GroupID@ associated with the current process.+getEffectiveGroupID :: IO GroupID+getEffectiveGroupID = c_getegid++foreign import ccall unsafe "getegid"+ c_getegid :: IO CGid++-- | @getGroups@ calls @getgroups@ to obtain the list of+-- supplementary @GroupID@s associated with the current process.+getGroups :: IO [GroupID]+getGroups = do+ ngroups <- c_getgroups 0 nullPtr+ allocaArray (fromIntegral ngroups) $ \arr -> do+ throwErrnoIfMinus1_ "getGroups" (c_getgroups ngroups arr)+ groups <- peekArray (fromIntegral ngroups) arr+ return groups++foreign import ccall unsafe "getgroups"+ c_getgroups :: CInt -> Ptr CGid -> IO CInt+++-- | @setGroups@ calls @setgroups@ to set the list of+-- supplementary @GroupID@s associated with the current process.+setGroups :: [GroupID] -> IO ()+setGroups groups = do+ withArrayLen groups $ \ ngroups arr ->+ throwErrnoIfMinus1_ "setGroups" (c_setgroups (fromIntegral ngroups) arr)++foreign import ccall unsafe "setgroups"+ c_setgroups :: CInt -> Ptr CGid -> IO CInt+++-- | @getLoginName@ calls @getlogin@ to obtain the login name+-- associated with the current process.+getLoginName :: IO ByteString+getLoginName = do+ -- ToDo: use getlogin_r+ str <- throwErrnoIfNull "getLoginName" c_getlogin+ packCString str++foreign import ccall unsafe "getlogin"+ c_getlogin :: IO CString++-- | @setUserID uid@ calls @setuid@ to set the real, effective, and+-- saved set-user-id associated with the current process to @uid@.+setUserID :: UserID -> IO ()+setUserID uid = throwErrnoIfMinus1_ "setUserID" (c_setuid uid)++foreign import ccall unsafe "setuid"+ c_setuid :: CUid -> IO CInt++-- | @setEffectiveUserID uid@ calls @seteuid@ to set the effective+-- user-id associated with the current process to @uid@. This+-- does not update the real user-id or set-user-id.+setEffectiveUserID :: UserID -> IO ()+setEffectiveUserID uid = throwErrnoIfMinus1_ "setEffectiveUserID" (c_seteuid uid)++foreign import ccall unsafe "seteuid"+ c_seteuid :: CUid -> IO CInt++-- | @setGroupID gid@ calls @setgid@ to set the real, effective, and+-- saved set-group-id associated with the current process to @gid@.+setGroupID :: GroupID -> IO ()+setGroupID gid = throwErrnoIfMinus1_ "setGroupID" (c_setgid gid)++foreign import ccall unsafe "setgid"+ c_setgid :: CGid -> IO CInt++-- | @setEffectiveGroupID uid@ calls @setegid@ to set the effective+-- group-id associated with the current process to @gid@. This+-- does not update the real group-id or set-group-id.+setEffectiveGroupID :: GroupID -> IO ()+setEffectiveGroupID gid =+ throwErrnoIfMinus1_ "setEffectiveGroupID" (c_setegid gid)+++foreign import ccall unsafe "setegid"+ c_setegid :: CGid -> IO CInt++-- -----------------------------------------------------------------------------+-- User names++-- | @getEffectiveUserName@ gets the name+-- associated with the effective @UserID@ of the process.+getEffectiveUserName :: IO ByteString+getEffectiveUserName = do+ euid <- getEffectiveUserID+ pw <- getUserEntryForID euid+ return (userName pw)++#endif // HAVE_PWD_H++-- -----------------------------------------------------------------------------+-- The group database (grp.h)+++#if !defined(HAVE_PWD_H)++getGroupEntryForID :: GroupID -> IO GroupEntry+{-# WARNING getGroupEntryForID+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getGroupEntryForID _ = ioError (ioeSetLocation unsupportedOperation "getGroupEntryForID")++getGroupEntryForName :: ByteString -> IO GroupEntry+{-# WARNING getGroupEntryForName+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getGroupEntryForName _ = ioError (ioeSetLocation unsupportedOperation "getGroupEntryForName")++getAllGroupEntries :: IO [GroupEntry]+{-# WARNING getAllGroupEntries+ "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_PWD_H@)" #-}+getAllGroupEntries = ioError (ioeSetLocation unsupportedOperation "getAllGroupEntries")++#else++-- | @getGroupEntryForID gid@ calls @getgrgid_r@ to obtain+-- the @GroupEntry@ information associated with @GroupID@+-- @gid@. This operation may fail with 'isDoesNotExistError'+-- if no such group exists.+getGroupEntryForID :: GroupID -> IO GroupEntry+#ifdef HAVE_GETGRGID_R+getGroupEntryForID gid = lockgr GETONE $+ allocaBytes (#const sizeof(struct group)) $ \pgr ->+ doubleAllocWhileERANGE "getGroupEntryForID" "group"+ grBufSize unpackGroupEntry $ c_getgrgid_r gid pgr++foreign import capi safe "HsUnix.h getgrgid_r"+ c_getgrgid_r :: CGid -> Ptr CGroup -> CString+ -> CSize -> Ptr (Ptr CGroup) -> IO CInt+#else+{-# WARNING getGroupEntryForID "System.Posix.User.getGroupEntryForID: not supported" #-}+getGroupEntryForID = error "System.Posix.User.getGroupEntryForID: not supported"+#endif++-- | @getGroupEntryForName name@ calls @getgrnam_r@ to obtain+-- the @GroupEntry@ information associated with the group called+-- @name@. This operation may fail with 'isDoesNotExistError'+-- if no such group exists.+getGroupEntryForName :: ByteString -> IO GroupEntry+#ifdef HAVE_GETGRNAM_R+getGroupEntryForName name = lockgr GETONE $+ allocaBytes (#const sizeof(struct group)) $ \pgr ->+ useAsCString name $ \ pstr ->+ doubleAllocWhileERANGE "getGroupEntryForName" "group"+ grBufSize unpackGroupEntry $ c_getgrnam_r pstr pgr++foreign import capi safe "HsUnix.h getgrnam_r"+ c_getgrnam_r :: CString -> Ptr CGroup -> CString+ -> CSize -> Ptr (Ptr CGroup) -> IO CInt+#else+{-# WARNING getGroupEntryForName "System.Posix.User.getGroupEntryForName: not supported" #-}+getGroupEntryForName = error "System.Posix.User.getGroupEntryForName: not supported"+#endif++-- | @getAllGroupEntries@ returns all group entries on the system by+-- repeatedly calling @getgrent@++--+-- getAllGroupEntries may fail with isDoesNotExistError on Linux due to+-- this bug in glibc:+-- http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=466647+--+getAllGroupEntries :: IO [GroupEntry]+#ifdef HAVE_GETGRENT+getAllGroupEntries = lockgr GETALL $ bracket_ c_setgrent c_endgrent $ worker []+ where+ worker accum = do+ resetErrno+ ppw <- throwErrnoIfNullAndError "getAllGroupEntries" $ c_getgrent+ if ppw == nullPtr+ then return (reverse accum)+ else do thisentry <- unpackGroupEntry ppw+ worker (thisentry : accum)++foreign import ccall safe "getgrent" c_getgrent :: IO (Ptr CGroup)+foreign import ccall safe "setgrent" c_setgrent :: IO ()+foreign import ccall safe "endgrent" c_endgrent :: IO ()+#else+{-# WARNING getAllGroupEntries "System.Posix.User.getAllGroupEntries: not supported" #-}+getAllGroupEntries = error "System.Posix.User.getAllGroupEntries: not supported"+#endif++#if defined(HAVE_GETGRGID_R) || defined(HAVE_GETGRNAM_R)+grBufSize :: Int+#if defined(HAVE_SYSCONF) && defined(HAVE_SC_GETGR_R_SIZE_MAX)+grBufSize = sysconfWithDefault 1024 (#const _SC_GETGR_R_SIZE_MAX)+#else+grBufSize = 1024+#endif+#endif++#endif // HAVE_PWD_H++-- -----------------------------------------------------------------------------+-- The user database (pwd.h)+++-- | @getUserEntryForID uid@ calls @getpwuid_r@ to obtain+-- the @UserEntry@ information associated with @UserID@+-- @uid@. This operation may fail with 'isDoesNotExistError'+-- if no such user exists.+getUserEntryForID :: UserID -> IO UserEntry+#ifdef HAVE_GETPWUID_R+getUserEntryForID uid = lockpw GETONE $+ allocaBytes (#const sizeof(struct passwd)) $ \ppw ->+ doubleAllocWhileERANGE "getUserEntryForID" "user"+ pwBufSize unpackUserEntry $ c_getpwuid_r uid ppw++foreign import capi safe "HsUnix.h getpwuid_r"+ c_getpwuid_r :: CUid -> Ptr CPasswd ->+ CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt+#else+{-# WARNING getUserEntryForID "System.Posix.User.getUserEntryForID: not supported" #-}+getUserEntryForID = error "System.Posix.User.getUserEntryForID: not supported"+#endif++-- | @getUserEntryForName name@ calls @getpwnam_r@ to obtain+-- the @UserEntry@ information associated with the user login+-- @name@. This operation may fail with 'isDoesNotExistError'+-- if no such user exists.+getUserEntryForName :: ByteString -> IO UserEntry+#if HAVE_GETPWNAM_R+getUserEntryForName name = lockpw GETONE $+ allocaBytes (#const sizeof(struct passwd)) $ \ppw ->+ useAsCString name $ \ pstr ->+ doubleAllocWhileERANGE "getUserEntryForName" "user"+ pwBufSize unpackUserEntry $ c_getpwnam_r pstr ppw++foreign import capi safe "HsUnix.h getpwnam_r"+ c_getpwnam_r :: CString -> Ptr CPasswd+ -> CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt+#else+{-# WARNING getUserEntryForName "System.Posix.User.getUserEntryForName: not supported" #-}+getUserEntryForName = error "System.Posix.User.getUserEntryForName: not supported"+#endif++-- | @getAllUserEntries@ returns all user entries on the system by+-- repeatedly calling @getpwent@+getAllUserEntries :: IO [UserEntry]+#ifdef HAVE_GETPWENT+getAllUserEntries = lockpw GETALL $ bracket_ c_setpwent c_endpwent $ worker []+ where+ worker accum = do+ resetErrno+ ppw <- throwErrnoIfNullAndError "getAllUserEntries" $ c_getpwent+ if ppw == nullPtr+ then return (reverse accum)+ else do thisentry <- unpackUserEntry ppw+ worker (thisentry : accum)++foreign import ccall safe "getpwent" c_getpwent :: IO (Ptr CPasswd)+foreign import ccall safe "setpwent" c_setpwent :: IO ()+foreign import ccall safe "endpwent" c_endpwent :: IO ()+#else+{-# WARNING getAllUserEntries "System.Posix.User.getAllUserEntries: not supported" #-}+getAllUserEntries = error "System.Posix.User.getAllUserEntries: not supported"+#endif++#if defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWNAM_R)+pwBufSize :: Int+#if defined(HAVE_SYSCONF) && defined(HAVE_SC_GETPW_R_SIZE_MAX)+pwBufSize = sysconfWithDefault 1024 (#const _SC_GETPW_R_SIZE_MAX)+#else+pwBufSize = 1024+#endif+#endif++#if defined(HAVE_SYSCONF) && defined(HAVE_PWD_H)+foreign import ccall unsafe "sysconf"+ c_sysconf :: CInt -> IO CLong++-- We need a default value since sysconf can fail and return -1+-- even when the parameter name is defined in unistd.h.+-- One example of this is _SC_GETPW_R_SIZE_MAX under+-- Mac OS X 10.4.9 on i386.+sysconfWithDefault :: Int -> CInt -> Int+sysconfWithDefault def sc =+ unsafePerformIO $ do v <- fmap fromIntegral $ c_sysconf sc+ return $ if v == (-1) then def else v+#endif++#if defined(HAVE_PWD_H)++-- The following function is used by the getgr*_r, c_getpw*_r+-- families of functions. These functions return their result+-- in a struct that contains strings and they need a buffer+-- that they can use to store those strings. We have to be+-- careful to unpack the struct containing the result before+-- the buffer is deallocated.+doubleAllocWhileERANGE+ :: String+ -> String -- entry type: "user" or "group"+ -> Int+ -> (Ptr r -> IO a)+ -> (Ptr b -> CSize -> Ptr (Ptr r) -> IO CInt)+ -> IO a+doubleAllocWhileERANGE loc enttype initlen unpack action =+ alloca $ go initlen+ where+ go len res = do+ r <- allocaBytes len $ \buf -> do+ rc <- action buf (fromIntegral len) res+ if rc /= 0+ then return (Left rc)+ else do p <- peek res+ when (p == nullPtr) $ notFoundErr+ fmap Right (unpack p)+ case r of+ Right x -> return x+ Left rc | Errno rc == eRANGE ->+ -- ERANGE means this is not an error+ -- we just have to try again with a larger buffer+ go (2 * len) res+ Left rc ->+ ioError (errnoToIOError loc (Errno rc) Nothing Nothing)+ notFoundErr =+ ioError $ flip ioeSetErrorString ("no such " ++ enttype)+ $ mkIOError doesNotExistErrorType loc Nothing Nothing++-- Used when a function returns NULL to indicate either an error or+-- EOF, depending on whether the global errno is nonzero.+throwErrnoIfNullAndError :: String -> IO (Ptr a) -> IO (Ptr a)+throwErrnoIfNullAndError loc act = do+ rc <- act+ errno <- getErrno+ if rc == nullPtr && errno /= eOK+ then throwErrno loc+ else return rc++#endif // HAVE_PWD_H
+ System/Posix/User/Common.hsc view
@@ -0,0 +1,79 @@+{-# LANGUAGE Safe #-}+-----------------------------------------------------------------------------+-- |+-- Module : System.Posix.User.Common+-- Copyright : (c) The University of Glasgow 2002+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires POSIX)+--+-- POSIX user\/group support+--+-----------------------------------------------------------------------------++module System.Posix.User.Common where++import Data.ByteString ( ByteString )+import System.Posix.Types++#include "HsUnix.h"+++#if defined(HAVE_PWD_H)+import Foreign.Ptr+import Foreign.Marshal+import Foreign.Storable+import Data.ByteString ( packCString )++-- internal types+data {-# CTYPE "struct passwd" #-} CPasswd+data {-# CTYPE "struct group" #-} CGroup++data LKUPTYPE = GETONE | GETALL++unpackGroupEntry :: Ptr CGroup -> IO GroupEntry+unpackGroupEntry ptr = do+ name <- (#peek struct group, gr_name) ptr >>= packCString+ passwd <- (#peek struct group, gr_passwd) ptr >>= packCString+ gid <- (#peek struct group, gr_gid) ptr+ mem <- (#peek struct group, gr_mem) ptr+ members <- peekArray0 nullPtr mem >>= mapM packCString+ return (GroupEntry name passwd gid members)++unpackUserEntry :: Ptr CPasswd -> IO UserEntry+unpackUserEntry ptr = do+ name <- (#peek struct passwd, pw_name) ptr >>= packCString+ passwd <- (#peek struct passwd, pw_passwd) ptr >>= packCString+ uid <- (#peek struct passwd, pw_uid) ptr+ gid <- (#peek struct passwd, pw_gid) ptr+#ifdef HAVE_NO_PASSWD_PW_GECOS+ gecos <- return "" -- pw_gecos does not exist on android+#else+ gecos <- (#peek struct passwd, pw_gecos) ptr >>= packCString+#endif+ dir <- (#peek struct passwd, pw_dir) ptr >>= packCString+ shell <- (#peek struct passwd, pw_shell) ptr >>= packCString+ return (UserEntry name passwd uid gid gecos dir shell)++#endif // HAVE_PWD_H++data UserEntry =+ UserEntry {+ userName :: ByteString, -- ^ Textual name of this user (pw_name)+ userPassword :: ByteString, -- ^ Password -- may be empty or fake if shadow is in use (pw_passwd)+ userID :: UserID, -- ^ Numeric ID for this user (pw_uid)+ userGroupID :: GroupID, -- ^ Primary group ID (pw_gid)+ userGecos :: ByteString, -- ^ Usually the real name for the user (pw_gecos)+ homeDirectory :: ByteString, -- ^ Home directory (pw_dir)+ userShell :: ByteString -- ^ Default shell (pw_shell)+ } deriving (Show, Read, Eq)++data GroupEntry =+ GroupEntry {+ groupName :: ByteString, -- ^ The name of this group (gr_name)+ groupPassword :: ByteString, -- ^ The password for this group (gr_passwd)+ groupID :: GroupID, -- ^ The unique numeric ID for this group (gr_gid)+ groupMembers :: [ByteString] -- ^ A list of zero or more usernames that are members (gr_mem)+ } deriving (Show, Read, Eq)
cbits/HsUnix.c view
@@ -8,6 +8,8 @@ #include "HsUnix.h" +char **__hsunix_get_environ (void) {return environ;}+ #ifdef HAVE_RTLDNEXT void *__hsunix_rtldNext (void) {return RTLD_NEXT;} #endif@@ -16,16 +18,6 @@ void *__hsunix_rtldDefault (void) {return RTLD_DEFAULT;} #endif -#if HAVE_PTSNAME && (__GLASGOW_HASKELL__ < 800)-// On Linux (and others), <stdlib.h> needs to be included while-// `_XOPEN_SOURCE` is already defined. However, GHCs before GHC 8.0-// didn't do that yet for CApiFFI, so we need this workaround here.--char *__hsunix_ptsname(int fd) { return ptsname(fd); }-int __hsunix_grantpt(int fd) { return grantpt(fd); }-int __hsunix_unlockpt(int fd) { return unlockpt(fd); }-#endif- // push a SVR4 STREAMS module; do nothing if STREAMS not available int __hsunix_push_module(int fd, const char *module) {@@ -36,14 +28,18 @@ #endif } +#ifdef HAVE_CLOCKS_PER_SEC+clock_t __hsunix_clocks_per_second (void) {return CLOCKS_PER_SEC;}+#endif+ /* * GNU glibc 2.23 and later deprecate `readdir_r` in favour of plain old * `readdir` which in some upcoming POSIX standard is going to required to be * re-entrant.- * Eventually we want to drop `readder_r` all together, but want to be+ * Eventually we want to drop `readdir_r` all together, but want to be * compatible with older unixen which may not have a re-entrant `readdir`.- * Solution is to make systems with *known* re-entrant `readir` use that and use- * `readdir_r` whereever we have it and don't *know* that `readdir` is+ * Solution is to make systems with *known* re-entrant `readdir` use that and use+ * `readdir_r` wherever we have it and don't *know* that `readdir` is * re-entrant. */ @@ -106,6 +102,15 @@ char *__hscore_d_name( struct dirent* d ) { return (d->d_name);+}++char __hscore_d_type( struct dirent* d )+{+#ifdef HAVE_STRUCT_DIRENT_D_TYPE+ return (d->d_type);+#else+ return CONST_DT_UNKNOWN;+#endif } void __hscore_free_dirent(struct dirent *dEnt)
cbits/execvpe.c view
@@ -3,7 +3,7 @@ Our low-level exec() variant. - Note: __hsunix_execvpe() is very similiar to the function+ Note: __hsunix_execvpe() is very similar to the function execvpe(3) as provided by glibc 2.11 and later. However, if execvpe(3) is available, we use that instead. @@ -22,7 +22,6 @@ #include <string.h> #include <errno.h> -#define HSUNIX_EXECVPE_H_NO_COMPAT #include "execvpe.h" #if !defined(execvpe) && !HAVE_DECL_EXECVPE@@ -72,6 +71,9 @@ { #if HAVE_EXECVPE return execvpe(name, argv, envp);+#elif !defined(HAVE_EXECV)+ errno = ENOSYS;+ return (-1); #else register int lp, ln; register char *p;
changelog.md view
@@ -1,22 +1,147 @@ # Changelog for [`unix` package](http://hackage.haskell.org/package/unix) -## 2.7.2.3 *Unreleased*+## 2.8.8.0 *May 2025* - * Resource: Fix warning in case of no RLIM_SAVED_{CUR,MAX}+ * fix `dirEntType` always returning `UnknownType` wrt [#347](https://github.com/haskell/unix/issues/347) by @sjshuck - * Future-proof glibc version check+## 2.8.7.0 *May 2025* - * Fix the error handling of posix_fallocate in non-FreeBSD+ * Add portable support for file open with data caching supressed/eliminated wrt [#322](https://github.com/haskell/unix/issues/322)+ * Support for ARM64 Windows when cross-compilation from Linux/Darwin or other unix system is involved+ * Use `Base.o_*` instead of raw `{#const O_*}`, fixing a bug in GHC JS - * Synchronize ByteString and String modules and fix grave bug in 'putEnv'+## 2.8.6.0 *Nov 2024* - * Fix 'semTrywait: invalid argument (Bad file descriptor)' wrt #218+ * add `readDirStreamWith` and `readDirStreamWithPtr` to `System.Posix.Directory.Internals` wrt [#251](https://github.com/haskell/unix/pull/251)+ * Fix CTimeVal definition for platforms where time_t isn't CLong, wrt [#252](https://github.com/haskell/unix/pull/252) - * Improve error messages+## 2.8.5.1 *Apr 2024* - * Improve tests+ * fix building with newer filepath/os-string when `#ifndef HAVE_OPENPTY` - * Don't show repo as modified after configure+## 2.8.5.0 *Dec 2023*++ * allow building with newer filepath/os-string++## 2.8.4.0 *Dec 2023*++ * add `haveStatx`+ * fix `statx.stx_mnt_id` detection on buggy glibc, see [GHC #24072](https://gitlab.haskell.org/ghc/ghc/-/issues/24072)++## 2.8.3.0 *Oct 2023*++ * add `getExtendedFileStatus` (based on `statx`) style functions+ * drop support for GHC < 8.6+ * Don't `foreign import` `environ`, see [GHC #24011](https://gitlab.haskell.org/ghc/ghc/-/issues/24011)++## 2.8.2.1 *Sep 2023*++ * Fix UB bug in `withFilePath` that causes it to error out (introduced in 2.8.2.0) wrt [#295](https://github.com/haskell/unix/issues/295)++## 2.8.2.0 *Sep 2023*++ * Bump bounds to accomodate `base-4.19` and `bytestring-0.12`.++ * Ensure that `FilePath`s don't contain interior `NUL`s.++ * JavaScript backend: add support for `utimes` / `lutimes` / `futimes`.++## 2.8.1.1 *Mar 2023*+ * Fix `System.Posix.Env.ByteString.getEnvironment` segfaulting on empty environment++## 2.8.1.0 *Feb 2023*+ * Fix build if HAVE_ALARM is undefined++ * Add missing autoconf checks for chown/fchdir/fchmod++ * Make TABX constructors and code conditional on underlying #defines++ * Bump bounds to accomodate base-4.18++ * Add semWaitInterruptible++ * semaphore: Teach semThreadWait to use semWait with threaded RTS++ * make the foreign imports of dlopen & dlclose safe++ * do not use capi for dlfcn.h stuff under wasm-wasi++ * Use capi for syscalls that break under musl's handling of 64-bit `time_t`++ * Replace `last` with `unsnoc`++ * Avoid Data.List.{head,tail}++ * Consistently use `throwErrnoPathIf*`++ * Fix WASI build++## 2.8.0.0 *August 2022*+ * Use ByteString for GroupEntry/UserEntry++ * Fix `semTrywait` on darwin++ * Fix vanishing environment variables in `System.Posix.Env.ByteString.putEnv`/`System.Posix.Env.ByteString.getEnv`++ * Add missing `setEnvironment` and `clearEnv` to `System.Posix.Env.ByteString`++ * Add support for filepath-1.4.100.0 with `PosixString` variants++ * Expose `DirStream`, `CDir`, `CDirent` and `DirStreamOffset` (internal API)++ * Add `fdRead`/`fdWrite` with ByteString payload and deprecate String based `fdRead`++ * Add `clocksPerSec`++ * Support wasm32-wasi++ * Implement BaudRate as an `Int` newtype and allow matching via extensible PatternSynonyms++ * Added `readDirStreamMaybe`++ * Warn when functions are used on unsupported platforms++ * Fix the error handling of `posix_fallocate`++ * Export `FileStatus` constructor++ * Various documentation and error message improvements++ * Add openDirStreamFd, openFileAt and createFileAt++ * Add accessors for st_blocks and st_blksize++ * Deal with FreeBSD getpwnam_r(3), ... thread safety. On FreeBSD these+ are not in fact safe for overlapped execution with a sequence of+ getpwent(3) or getgrent(3) calls when multiple "green" threads share+ the same underlying OS thread. The *ent(3) calls now run in bound+ threads or else locks are used to avoid overlapped execution.++ * Make passwd/group FFI functions "safe", these are not low-latency APIs.++ * Drop support for non-thread-safe getpwnam(3) and getpwuid(3). All+ supported platforms have getpwnam_r(3) and getpwuid_r(3). This was+ already the case for the getgr(nam|gid) calls.++ * Added terminal output flags to `System.Posix.Terminal.Common.TerminalMode`++ IXANY, ONLCR, OCRNL, ONOCR, ONLRET, OFDEL, OFILL, NLDLY(NL0,NL1),+ CRDLY(CR0,CR1,CR2,CR2), TABDLY(TAB0,TAB1,TAB2,TAB3) BSDLY(BS0,BS1),+ VTDLY(VT0,VT1), FFDLY(FF0,FF1)++ * Add support for `O_NOFOLLOW`, `O_CLOEXEC`, `O_DIRECTORY` and `O_SYNC`+ (#6, #57)++ * Refactor API of `openFd` removing `Maybe FileMode` argument,+ which now must be passed as part of `OpenFileFlags`+ (e.g. `defaultFileFlags { creat = Just mode }`) (#58)++ * Remove deprecated `execvpe(3)` legacy-emulation CPP macro++ * Generalise return type of `exitImmediately` from `ExitCode -> IO ()` to+ `∀a. ExitCode -> IO a` (#130)++ * Add `Read`, `Show`, `Eq`, and `Ord` typeclass instances to `OpenFileFlags` and `OpenMode`. (#75, #141) ## 2.7.2.2 *May 2017*
config.guess view
@@ -1,1687 +1,1755 @@ #! /bin/sh # Attempt to guess a canonical system name.-# Copyright 1992-2021 Free Software Foundation, Inc.--timestamp='2021-01-25'--# This file is free software; you can redistribute it and/or modify it-# under the terms of the GNU General Public License as published by-# the Free Software Foundation; either version 3 of the License, or-# (at your option) any later version.-#-# This program is distributed in the hope that it will be useful, but-# WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU-# General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, see <https://www.gnu.org/licenses/>.-#-# As a special exception to the GNU General Public License, if you-# distribute this file as part of a program that contains a-# configuration script generated by Autoconf, you may include it under-# the same distribution terms that you use for the rest of that-# program. This Exception is an additional permission under section 7-# of the GNU General Public License, version 3 ("GPLv3").-#-# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.-#-# You can get the latest version of this script from:-# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess-#-# Please send patches to <config-patches@gnu.org>.---me=$(echo "$0" | sed -e 's,.*/,,')--usage="\-Usage: $0 [OPTION]--Output the configuration name of the system \`$me' is run on.--Options:- -h, --help print this help, then exit- -t, --time-stamp print date of last modification, then exit- -v, --version print version number, then exit--Report bugs and patches to <config-patches@gnu.org>."--version="\-GNU config.guess ($timestamp)--Originally written by Per Bothner.-Copyright 1992-2021 Free Software Foundation, Inc.--This is free software; see the source for copying conditions. There is NO-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."--help="-Try \`$me --help' for more information."--# Parse command line-while test $# -gt 0 ; do- case $1 in- --time-stamp | --time* | -t )- echo "$timestamp" ; exit ;;- --version | -v )- echo "$version" ; exit ;;- --help | --h* | -h )- echo "$usage"; exit ;;- -- ) # Stop option processing- shift; break ;;- - ) # Use stdin as input.- break ;;- -* )- echo "$me: invalid option $1$help" >&2- exit 1 ;;- * )- break ;;- esac-done--if test $# != 0; then- echo "$me: too many arguments$help" >&2- exit 1-fi--# CC_FOR_BUILD -- compiler used by this script. Note that the use of a-# compiler to aid in system detection is discouraged as it requires-# temporary files to be created and, as you can see below, it is a-# headache to deal with in a portable fashion.--# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still-# use `HOST_CC' if defined, but it is deprecated.--# Portable tmp directory creation inspired by the Autoconf team.--tmp=-# shellcheck disable=SC2172-trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15--set_cc_for_build() {- # prevent multiple calls if $tmp is already set- test "$tmp" && return 0- : "${TMPDIR=/tmp}"- # shellcheck disable=SC2039- { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } ||- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }- dummy=$tmp/dummy- case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in- ,,) echo "int x;" > "$dummy.c"- for driver in cc gcc c89 c99 ; do- if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then- CC_FOR_BUILD="$driver"- break- fi- done- if test x"$CC_FOR_BUILD" = x ; then- CC_FOR_BUILD=no_compiler_found- fi- ;;- ,,*) CC_FOR_BUILD=$CC ;;- ,*,*) CC_FOR_BUILD=$HOST_CC ;;- esac-}--# This is needed to find uname on a Pyramid OSx when run in the BSD universe.-# (ghazi@noc.rutgers.edu 1994-08-24)-if test -f /.attbin/uname ; then- PATH=$PATH:/.attbin ; export PATH-fi--UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown-UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown-UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown-UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown--case "$UNAME_SYSTEM" in-Linux|GNU|GNU/*)- LIBC=unknown-- set_cc_for_build- cat <<-EOF > "$dummy.c"- #include <features.h>- #if defined(__UCLIBC__)- LIBC=uclibc- #elif defined(__dietlibc__)- LIBC=dietlibc- #elif defined(__GLIBC__)- LIBC=gnu- #else- #include <stdarg.h>- /* First heuristic to detect musl libc. */- #ifdef __DEFINED_va_list- LIBC=musl- #endif- #endif- EOF- eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')"-- # Second heuristic to detect musl libc.- if [ "$LIBC" = unknown ] &&- command -v ldd >/dev/null &&- ldd --version 2>&1 | grep -q ^musl; then- LIBC=musl- fi-- # If the system lacks a compiler, then just pick glibc.- # We could probably try harder.- if [ "$LIBC" = unknown ]; then- LIBC=gnu- fi- ;;-esac--# Note: order is significant - the case branches are not exclusive.--case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in- *:NetBSD:*:*)- # NetBSD (nbsd) targets should (where applicable) match one or- # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently- # switched to ELF, *-*-netbsd* would select the old- # object file format. This provides both forward- # compatibility and a consistent mechanism for selecting the- # object file format.- #- # Note: NetBSD doesn't particularly care about the vendor- # portion of the name. We always set it to "unknown".- UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \- /sbin/sysctl -n hw.machine_arch 2>/dev/null || \- /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \- echo unknown))- case "$UNAME_MACHINE_ARCH" in- aarch64eb) machine=aarch64_be-unknown ;;- armeb) machine=armeb-unknown ;;- arm*) machine=arm-unknown ;;- sh3el) machine=shl-unknown ;;- sh3eb) machine=sh-unknown ;;- sh5el) machine=sh5le-unknown ;;- earmv*)- arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,')- endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p')- machine="${arch}${endian}"-unknown- ;;- *) machine="$UNAME_MACHINE_ARCH"-unknown ;;- esac- # The Operating System including object format, if it has switched- # to ELF recently (or will in the future) and ABI.- case "$UNAME_MACHINE_ARCH" in- earm*)- os=netbsdelf- ;;- arm*|i386|m68k|ns32k|sh3*|sparc|vax)- set_cc_for_build- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \- | grep -q __ELF__- then- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).- # Return netbsd for either. FIX?- os=netbsd- else- os=netbsdelf- fi- ;;- *)- os=netbsd- ;;- esac- # Determine ABI tags.- case "$UNAME_MACHINE_ARCH" in- earm*)- expr='s/^earmv[0-9]/-eabi/;s/eb$//'- abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr")- ;;- esac- # The OS release- # Debian GNU/NetBSD machines have a different userland, and- # thus, need a distinct triplet. However, they do not need- # kernel version information, so it can be replaced with a- # suitable tag, in the style of linux-gnu.- case "$UNAME_VERSION" in- Debian*)- release='-gnu'- ;;- *)- release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2)- ;;- esac- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:- # contains redundant information, the shorter form:- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.- echo "$machine-${os}${release}${abi-}"- exit ;;- *:Bitrig:*:*)- UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//')- echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"- exit ;;- *:OpenBSD:*:*)- UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//')- echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"- exit ;;- *:LibertyBSD:*:*)- UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//')- echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"- exit ;;- *:MidnightBSD:*:*)- echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"- exit ;;- *:ekkoBSD:*:*)- echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"- exit ;;- *:SolidBSD:*:*)- echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"- exit ;;- *:OS108:*:*)- echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"- exit ;;- macppc:MirBSD:*:*)- echo powerpc-unknown-mirbsd"$UNAME_RELEASE"- exit ;;- *:MirBSD:*:*)- echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"- exit ;;- *:Sortix:*:*)- echo "$UNAME_MACHINE"-unknown-sortix- exit ;;- *:Twizzler:*:*)- echo "$UNAME_MACHINE"-unknown-twizzler- exit ;;- *:Redox:*:*)- echo "$UNAME_MACHINE"-unknown-redox- exit ;;- mips:OSF1:*.*)- echo mips-dec-osf1- exit ;;- alpha:OSF1:*:*)- case $UNAME_RELEASE in- *4.0)- UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}')- ;;- *5.*)- UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}')- ;;- esac- # According to Compaq, /usr/sbin/psrinfo has been available on- # OSF/1 and Tru64 systems produced since 1995. I hope that- # covers most systems running today. This code pipes the CPU- # types through head -n 1, so we only detect the type of CPU 0.- ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1)- case "$ALPHA_CPU_TYPE" in- "EV4 (21064)")- UNAME_MACHINE=alpha ;;- "EV4.5 (21064)")- UNAME_MACHINE=alpha ;;- "LCA4 (21066/21068)")- UNAME_MACHINE=alpha ;;- "EV5 (21164)")- UNAME_MACHINE=alphaev5 ;;- "EV5.6 (21164A)")- UNAME_MACHINE=alphaev56 ;;- "EV5.6 (21164PC)")- UNAME_MACHINE=alphapca56 ;;- "EV5.7 (21164PC)")- UNAME_MACHINE=alphapca57 ;;- "EV6 (21264)")- UNAME_MACHINE=alphaev6 ;;- "EV6.7 (21264A)")- UNAME_MACHINE=alphaev67 ;;- "EV6.8CB (21264C)")- UNAME_MACHINE=alphaev68 ;;- "EV6.8AL (21264B)")- UNAME_MACHINE=alphaev68 ;;- "EV6.8CX (21264D)")- UNAME_MACHINE=alphaev68 ;;- "EV6.9A (21264/EV69A)")- UNAME_MACHINE=alphaev69 ;;- "EV7 (21364)")- UNAME_MACHINE=alphaev7 ;;- "EV7.9 (21364A)")- UNAME_MACHINE=alphaev79 ;;- esac- # A Pn.n version is a patched version.- # A Vn.n version is a released version.- # A Tn.n version is a released field test version.- # A Xn.n version is an unreleased experimental baselevel.- # 1.2 uses "1.2" for uname -r.- echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)"- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.- exitcode=$?- trap '' 0- exit $exitcode ;;- Amiga*:UNIX_System_V:4.0:*)- echo m68k-unknown-sysv4- exit ;;- *:[Aa]miga[Oo][Ss]:*:*)- echo "$UNAME_MACHINE"-unknown-amigaos- exit ;;- *:[Mm]orph[Oo][Ss]:*:*)- echo "$UNAME_MACHINE"-unknown-morphos- exit ;;- *:OS/390:*:*)- echo i370-ibm-openedition- exit ;;- *:z/VM:*:*)- echo s390-ibm-zvmoe- exit ;;- *:OS400:*:*)- echo powerpc-ibm-os400- exit ;;- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)- echo arm-acorn-riscix"$UNAME_RELEASE"- exit ;;- arm*:riscos:*:*|arm*:RISCOS:*:*)- echo arm-unknown-riscos- exit ;;- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)- echo hppa1.1-hitachi-hiuxmpp- exit ;;- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.- if test "$( (/bin/universe) 2>/dev/null)" = att ; then- echo pyramid-pyramid-sysv3- else- echo pyramid-pyramid-bsd- fi- exit ;;- NILE*:*:*:dcosx)- echo pyramid-pyramid-svr4- exit ;;- DRS?6000:unix:4.0:6*)- echo sparc-icl-nx6- exit ;;- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)- case $(/usr/bin/uname -p) in- sparc) echo sparc-icl-nx7; exit ;;- esac ;;- s390x:SunOS:*:*)- echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"- exit ;;- sun4H:SunOS:5.*:*)- echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"- exit ;;- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)- echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"- exit ;;- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)- echo i386-pc-auroraux"$UNAME_RELEASE"- exit ;;- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)- set_cc_for_build- SUN_ARCH=i386- # If there is a compiler, see if it is configured for 64-bit objects.- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.- # This test works for both compilers.- if test "$CC_FOR_BUILD" != no_compiler_found; then- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \- grep IS_64BIT_ARCH >/dev/null- then- SUN_ARCH=x86_64- fi- fi- echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"- exit ;;- sun4*:SunOS:6*:*)- # According to config.sub, this is the proper way to canonicalize- # SunOS6. Hard to guess exactly what SunOS6 will be like, but- # it's likely to be more like Solaris than SunOS4.- echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"- exit ;;- sun4*:SunOS:*:*)- case "$(/usr/bin/arch -k)" in- Series*|S4*)- UNAME_RELEASE=$(uname -v)- ;;- esac- # Japanese Language versions have a version number like `4.1.3-JL'.- echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')"- exit ;;- sun3*:SunOS:*:*)- echo m68k-sun-sunos"$UNAME_RELEASE"- exit ;;- sun*:*:4.2BSD:*)- UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null)- test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3- case "$(/bin/arch)" in- sun3)- echo m68k-sun-sunos"$UNAME_RELEASE"- ;;- sun4)- echo sparc-sun-sunos"$UNAME_RELEASE"- ;;- esac- exit ;;- aushp:SunOS:*:*)- echo sparc-auspex-sunos"$UNAME_RELEASE"- exit ;;- # The situation for MiNT is a little confusing. The machine name- # can be virtually everything (everything which is not- # "atarist" or "atariste" at least should have a processor- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"- # to the lowercase version "mint" (or "freemint"). Finally- # the system name "TOS" denotes a system which is actually not- # MiNT. But MiNT is downward compatible to TOS, so this should- # be no problem.- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)- echo m68k-atari-mint"$UNAME_RELEASE"- exit ;;- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)- echo m68k-atari-mint"$UNAME_RELEASE"- exit ;;- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)- echo m68k-atari-mint"$UNAME_RELEASE"- exit ;;- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)- echo m68k-milan-mint"$UNAME_RELEASE"- exit ;;- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)- echo m68k-hades-mint"$UNAME_RELEASE"- exit ;;- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)- echo m68k-unknown-mint"$UNAME_RELEASE"- exit ;;- m68k:machten:*:*)- echo m68k-apple-machten"$UNAME_RELEASE"- exit ;;- powerpc:machten:*:*)- echo powerpc-apple-machten"$UNAME_RELEASE"- exit ;;- RISC*:Mach:*:*)- echo mips-dec-mach_bsd4.3- exit ;;- RISC*:ULTRIX:*:*)- echo mips-dec-ultrix"$UNAME_RELEASE"- exit ;;- VAX*:ULTRIX*:*:*)- echo vax-dec-ultrix"$UNAME_RELEASE"- exit ;;- 2020:CLIX:*:* | 2430:CLIX:*:*)- echo clipper-intergraph-clix"$UNAME_RELEASE"- exit ;;- mips:*:*:UMIPS | mips:*:*:RISCos)- set_cc_for_build- sed 's/^ //' << EOF > "$dummy.c"-#ifdef __cplusplus-#include <stdio.h> /* for printf() prototype */- int main (int argc, char *argv[]) {-#else- int main (argc, argv) int argc; char *argv[]; {-#endif- #if defined (host_mips) && defined (MIPSEB)- #if defined (SYSTYPE_SYSV)- printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);- #endif- #if defined (SYSTYPE_SVR4)- printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);- #endif- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)- printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);- #endif- #endif- exit (-1);- }-EOF- $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&- dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') &&- SYSTEM_NAME=$("$dummy" "$dummyarg") &&- { echo "$SYSTEM_NAME"; exit; }- echo mips-mips-riscos"$UNAME_RELEASE"- exit ;;- Motorola:PowerMAX_OS:*:*)- echo powerpc-motorola-powermax- exit ;;- Motorola:*:4.3:PL8-*)- echo powerpc-harris-powermax- exit ;;- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)- echo powerpc-harris-powermax- exit ;;- Night_Hawk:Power_UNIX:*:*)- echo powerpc-harris-powerunix- exit ;;- m88k:CX/UX:7*:*)- echo m88k-harris-cxux7- exit ;;- m88k:*:4*:R4*)- echo m88k-motorola-sysv4- exit ;;- m88k:*:3*:R3*)- echo m88k-motorola-sysv3- exit ;;- AViiON:dgux:*:*)- # DG/UX returns AViiON for all architectures- UNAME_PROCESSOR=$(/usr/bin/uname -p)- if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110- then- if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \- test "$TARGET_BINARY_INTERFACE"x = x- then- echo m88k-dg-dgux"$UNAME_RELEASE"- else- echo m88k-dg-dguxbcs"$UNAME_RELEASE"- fi- else- echo i586-dg-dgux"$UNAME_RELEASE"- fi- exit ;;- M88*:DolphinOS:*:*) # DolphinOS (SVR3)- echo m88k-dolphin-sysv3- exit ;;- M88*:*:R3*:*)- # Delta 88k system running SVR3- echo m88k-motorola-sysv3- exit ;;- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)- echo m88k-tektronix-sysv3- exit ;;- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)- echo m68k-tektronix-bsd- exit ;;- *:IRIX*:*:*)- echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')"- exit ;;- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id- exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX '- i*86:AIX:*:*)- echo i386-ibm-aix- exit ;;- ia64:AIX:*:*)- if test -x /usr/bin/oslevel ; then- IBM_REV=$(/usr/bin/oslevel)- else- IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"- fi- echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"- exit ;;- *:AIX:2:3)- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then- set_cc_for_build- sed 's/^ //' << EOF > "$dummy.c"- #include <sys/systemcfg.h>-- main()- {- if (!__power_pc())- exit(1);- puts("powerpc-ibm-aix3.2.5");- exit(0);- }-EOF- if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy")- then- echo "$SYSTEM_NAME"- else- echo rs6000-ibm-aix3.2.5- fi- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then- echo rs6000-ibm-aix3.2.4- else- echo rs6000-ibm-aix3.2- fi- exit ;;- *:AIX:*:[4567])- IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }')- if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then- IBM_ARCH=rs6000- else- IBM_ARCH=powerpc- fi- if test -x /usr/bin/lslpp ; then- IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc |- awk -F: '{ print $3 }' | sed s/[0-9]*$/0/)- else- IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"- fi- echo "$IBM_ARCH"-ibm-aix"$IBM_REV"- exit ;;- *:AIX:*:*)- echo rs6000-ibm-aix- exit ;;- ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)- echo romp-ibm-bsd4.4- exit ;;- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and- echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to- exit ;; # report: romp-ibm BSD 4.3- *:BOSX:*:*)- echo rs6000-bull-bosx- exit ;;- DPX/2?00:B.O.S.:*:*)- echo m68k-bull-sysv3- exit ;;- 9000/[34]??:4.3bsd:1.*:*)- echo m68k-hp-bsd- exit ;;- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)- echo m68k-hp-bsd4.4- exit ;;- 9000/[34678]??:HP-UX:*:*)- HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')- case "$UNAME_MACHINE" in- 9000/31?) HP_ARCH=m68000 ;;- 9000/[34]??) HP_ARCH=m68k ;;- 9000/[678][0-9][0-9])- if test -x /usr/bin/getconf; then- sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null)- sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null)- case "$sc_cpu_version" in- 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0- 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1- 532) # CPU_PA_RISC2_0- case "$sc_kernel_bits" in- 32) HP_ARCH=hppa2.0n ;;- 64) HP_ARCH=hppa2.0w ;;- '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20- esac ;;- esac- fi- if test "$HP_ARCH" = ""; then- set_cc_for_build- sed 's/^ //' << EOF > "$dummy.c"-- #define _HPUX_SOURCE- #include <stdlib.h>- #include <unistd.h>-- int main ()- {- #if defined(_SC_KERNEL_BITS)- long bits = sysconf(_SC_KERNEL_BITS);- #endif- long cpu = sysconf (_SC_CPU_VERSION);-- switch (cpu)- {- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;- case CPU_PA_RISC2_0:- #if defined(_SC_KERNEL_BITS)- switch (bits)- {- case 64: puts ("hppa2.0w"); break;- case 32: puts ("hppa2.0n"); break;- default: puts ("hppa2.0"); break;- } break;- #else /* !defined(_SC_KERNEL_BITS) */- puts ("hppa2.0"); break;- #endif- default: puts ("hppa1.0"); break;- }- exit (0);- }-EOF- (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy")- test -z "$HP_ARCH" && HP_ARCH=hppa- fi ;;- esac- if test "$HP_ARCH" = hppa2.0w- then- set_cc_for_build-- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler- # generating 64-bit code. GNU and HP use different nomenclature:- #- # $ CC_FOR_BUILD=cc ./config.guess- # => hppa2.0w-hp-hpux11.23- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess- # => hppa64-hp-hpux11.23-- if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |- grep -q __LP64__- then- HP_ARCH=hppa2.0w- else- HP_ARCH=hppa64- fi- fi- echo "$HP_ARCH"-hp-hpux"$HPUX_REV"- exit ;;- ia64:HP-UX:*:*)- HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')- echo ia64-hp-hpux"$HPUX_REV"- exit ;;- 3050*:HI-UX:*:*)- set_cc_for_build- sed 's/^ //' << EOF > "$dummy.c"- #include <unistd.h>- int- main ()- {- long cpu = sysconf (_SC_CPU_VERSION);- /* The order matters, because CPU_IS_HP_MC68K erroneously returns- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct- results, however. */- if (CPU_IS_PA_RISC (cpu))- {- switch (cpu)- {- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;- default: puts ("hppa-hitachi-hiuxwe2"); break;- }- }- else if (CPU_IS_HP_MC68K (cpu))- puts ("m68k-hitachi-hiuxwe2");- else puts ("unknown-hitachi-hiuxwe2");- exit (0);- }-EOF- $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") &&- { echo "$SYSTEM_NAME"; exit; }- echo unknown-hitachi-hiuxwe2- exit ;;- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)- echo hppa1.1-hp-bsd- exit ;;- 9000/8??:4.3bsd:*:*)- echo hppa1.0-hp-bsd- exit ;;- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)- echo hppa1.0-hp-mpeix- exit ;;- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)- echo hppa1.1-hp-osf- exit ;;- hp8??:OSF1:*:*)- echo hppa1.0-hp-osf- exit ;;- i*86:OSF1:*:*)- if test -x /usr/sbin/sysversion ; then- echo "$UNAME_MACHINE"-unknown-osf1mk- else- echo "$UNAME_MACHINE"-unknown-osf1- fi- exit ;;- parisc*:Lites*:*:*)- echo hppa1.1-hp-lites- exit ;;- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)- echo c1-convex-bsd- exit ;;- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)- if getsysinfo -f scalar_acc- then echo c32-convex-bsd- else echo c2-convex-bsd- fi- exit ;;- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)- echo c34-convex-bsd- exit ;;- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)- echo c38-convex-bsd- exit ;;- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)- echo c4-convex-bsd- exit ;;- CRAY*Y-MP:*:*:*)- echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'- exit ;;- CRAY*[A-Z]90:*:*:*)- echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \- -e 's/\.[^.]*$/.X/'- exit ;;- CRAY*TS:*:*:*)- echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'- exit ;;- CRAY*T3E:*:*:*)- echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'- exit ;;- CRAY*SV1:*:*:*)- echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'- exit ;;- *:UNICOS/mp:*:*)- echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'- exit ;;- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)- FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)- FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')- FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/')- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"- exit ;;- 5000:UNIX_System_V:4.*:*)- FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')- FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/')- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"- exit ;;- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)- echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"- exit ;;- sparc*:BSD/OS:*:*)- echo sparc-unknown-bsdi"$UNAME_RELEASE"- exit ;;- *:BSD/OS:*:*)- echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"- exit ;;- arm:FreeBSD:*:*)- UNAME_PROCESSOR=$(uname -p)- set_cc_for_build- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \- | grep -q __ARM_PCS_VFP- then- echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi- else- echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf- fi- exit ;;- *:FreeBSD:*:*)- UNAME_PROCESSOR=$(/usr/bin/uname -p)- case "$UNAME_PROCESSOR" in- amd64)- UNAME_PROCESSOR=x86_64 ;;- i386)- UNAME_PROCESSOR=i586 ;;- esac- echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"- exit ;;- i*:CYGWIN*:*)- echo "$UNAME_MACHINE"-pc-cygwin- exit ;;- *:MINGW64*:*)- echo "$UNAME_MACHINE"-pc-mingw64- exit ;;- *:MINGW*:*)- echo "$UNAME_MACHINE"-pc-mingw32- exit ;;- *:MSYS*:*)- echo "$UNAME_MACHINE"-pc-msys- exit ;;- i*:PW*:*)- echo "$UNAME_MACHINE"-pc-pw32- exit ;;- *:Interix*:*)- case "$UNAME_MACHINE" in- x86)- echo i586-pc-interix"$UNAME_RELEASE"- exit ;;- authenticamd | genuineintel | EM64T)- echo x86_64-unknown-interix"$UNAME_RELEASE"- exit ;;- IA64)- echo ia64-unknown-interix"$UNAME_RELEASE"- exit ;;- esac ;;- i*:UWIN*:*)- echo "$UNAME_MACHINE"-pc-uwin- exit ;;- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)- echo x86_64-pc-cygwin- exit ;;- prep*:SunOS:5.*:*)- echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"- exit ;;- *:GNU:*:*)- # the GNU system- echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')"- exit ;;- *:GNU/*:*:*)- # other systems with GNU libc and userland- echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC"- exit ;;- *:Minix:*:*)- echo "$UNAME_MACHINE"-unknown-minix- exit ;;- aarch64:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- aarch64_be:Linux:*:*)- UNAME_MACHINE=aarch64_be- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- alpha:Linux:*:*)- case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in- EV5) UNAME_MACHINE=alphaev5 ;;- EV56) UNAME_MACHINE=alphaev56 ;;- PCA56) UNAME_MACHINE=alphapca56 ;;- PCA57) UNAME_MACHINE=alphapca56 ;;- EV6) UNAME_MACHINE=alphaev6 ;;- EV67) UNAME_MACHINE=alphaev67 ;;- EV68*) UNAME_MACHINE=alphaev68 ;;- esac- objdump --private-headers /bin/sh | grep -q ld.so.1- if test "$?" = 0 ; then LIBC=gnulibc1 ; fi- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- arc:Linux:*:* | arceb:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- arm*:Linux:*:*)- set_cc_for_build- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \- | grep -q __ARM_EABI__- then- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- else- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \- | grep -q __ARM_PCS_VFP- then- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi- else- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf- fi- fi- exit ;;- avr32*:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- cris:Linux:*:*)- echo "$UNAME_MACHINE"-axis-linux-"$LIBC"- exit ;;- crisv32:Linux:*:*)- echo "$UNAME_MACHINE"-axis-linux-"$LIBC"- exit ;;- e2k:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- frv:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- hexagon:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- i*86:Linux:*:*)- echo "$UNAME_MACHINE"-pc-linux-"$LIBC"- exit ;;- ia64:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- k1om:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- m32r*:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- m68*:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- mips:Linux:*:* | mips64:Linux:*:*)- set_cc_for_build- IS_GLIBC=0- test x"${LIBC}" = xgnu && IS_GLIBC=1- sed 's/^ //' << EOF > "$dummy.c"- #undef CPU- #undef mips- #undef mipsel- #undef mips64- #undef mips64el- #if ${IS_GLIBC} && defined(_ABI64)- LIBCABI=gnuabi64- #else- #if ${IS_GLIBC} && defined(_ABIN32)- LIBCABI=gnuabin32- #else- LIBCABI=${LIBC}- #endif- #endif-- #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6- CPU=mipsisa64r6- #else- #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6- CPU=mipsisa32r6- #else- #if defined(__mips64)- CPU=mips64- #else- CPU=mips- #endif- #endif- #endif-- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)- MIPS_ENDIAN=el- #else- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)- MIPS_ENDIAN=- #else- MIPS_ENDIAN=- #endif- #endif-EOF- eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')"- test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }- ;;- mips64el:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- openrisc*:Linux:*:*)- echo or1k-unknown-linux-"$LIBC"- exit ;;- or32:Linux:*:* | or1k*:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- padre:Linux:*:*)- echo sparc-unknown-linux-"$LIBC"- exit ;;- parisc64:Linux:*:* | hppa64:Linux:*:*)- echo hppa64-unknown-linux-"$LIBC"- exit ;;- parisc:Linux:*:* | hppa:Linux:*:*)- # Look for CPU level- case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in- PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;- PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;- *) echo hppa-unknown-linux-"$LIBC" ;;- esac- exit ;;- ppc64:Linux:*:*)- echo powerpc64-unknown-linux-"$LIBC"- exit ;;- ppc:Linux:*:*)- echo powerpc-unknown-linux-"$LIBC"- exit ;;- ppc64le:Linux:*:*)- echo powerpc64le-unknown-linux-"$LIBC"- exit ;;- ppcle:Linux:*:*)- echo powerpcle-unknown-linux-"$LIBC"- exit ;;- riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- s390:Linux:*:* | s390x:Linux:*:*)- echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"- exit ;;- sh64*:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- sh*:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- sparc:Linux:*:* | sparc64:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- tile*:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- vax:Linux:*:*)- echo "$UNAME_MACHINE"-dec-linux-"$LIBC"- exit ;;- x86_64:Linux:*:*)- set_cc_for_build- LIBCABI=$LIBC- if test "$CC_FOR_BUILD" != no_compiler_found; then- if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \- grep IS_X32 >/dev/null- then- LIBCABI="$LIBC"x32- fi- fi- echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"- exit ;;- xtensa*:Linux:*:*)- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"- exit ;;- i*86:DYNIX/ptx:4*:*)- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.- # earlier versions are messed up and put the nodename in both- # sysname and nodename.- echo i386-sequent-sysv4- exit ;;- i*86:UNIX_SV:4.2MP:2.*)- # Unixware is an offshoot of SVR4, but it has its own version- # number series starting with 2...- # I am not positive that other SVR4 systems won't match this,- # I just have to hope. -- rms.- # Use sysv4.2uw... so that sysv4* matches it.- echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"- exit ;;- i*86:OS/2:*:*)- # If we were able to find `uname', then EMX Unix compatibility- # is probably installed.- echo "$UNAME_MACHINE"-pc-os2-emx- exit ;;- i*86:XTS-300:*:STOP)- echo "$UNAME_MACHINE"-unknown-stop- exit ;;- i*86:atheos:*:*)- echo "$UNAME_MACHINE"-unknown-atheos- exit ;;- i*86:syllable:*:*)- echo "$UNAME_MACHINE"-pc-syllable- exit ;;- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)- echo i386-unknown-lynxos"$UNAME_RELEASE"- exit ;;- i*86:*DOS:*:*)- echo "$UNAME_MACHINE"-pc-msdosdjgpp- exit ;;- i*86:*:4.*:*)- UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//')- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then- echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"- else- echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"- fi- exit ;;- i*86:*:5:[678]*)- # UnixWare 7.x, OpenUNIX and OpenServer 6.- case $(/bin/uname -X | grep "^Machine") in- *486*) UNAME_MACHINE=i486 ;;- *Pentium) UNAME_MACHINE=i586 ;;- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;- esac- echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"- exit ;;- i*86:*:3.2:*)- if test -f /usr/options/cb.name; then- UNAME_REL=$(sed -n 's/.*Version //p' </usr/options/cb.name)- echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"- elif /bin/uname -X 2>/dev/null >/dev/null ; then- UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //'))- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \- && UNAME_MACHINE=i586- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \- && UNAME_MACHINE=i686- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \- && UNAME_MACHINE=i686- echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"- else- echo "$UNAME_MACHINE"-pc-sysv32- fi- exit ;;- pc:*:*:*)- # Left here for compatibility:- # uname -m prints for DJGPP always 'pc', but it prints nothing about- # the processor, so we play safe by assuming i586.- # Note: whatever this is, it MUST be the same as what config.sub- # prints for the "djgpp" host, or else GDB configure will decide that- # this is a cross-build.- echo i586-pc-msdosdjgpp- exit ;;- Intel:Mach:3*:*)- echo i386-pc-mach3- exit ;;- paragon:*:*:*)- echo i860-intel-osf1- exit ;;- i860:*:4.*:*) # i860-SVR4- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then- echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4- else # Add other i860-SVR4 vendors below as they are discovered.- echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4- fi- exit ;;- mini*:CTIX:SYS*5:*)- # "miniframe"- echo m68010-convergent-sysv- exit ;;- mc68k:UNIX:SYSTEM5:3.51m)- echo m68k-convergent-sysv- exit ;;- M680?0:D-NIX:5.3:*)- echo m68k-diab-dnix- exit ;;- M68*:*:R3V[5678]*:*)- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)- OS_REL=''- test -r /etc/.relid \- && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \- && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \- && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \- && { echo i486-ncr-sysv4; exit; } ;;- NCR*:*:4.2:* | MPRAS*:*:4.2:*)- OS_REL='.3'- test -r /etc/.relid \- && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \- && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \- && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \- && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)- echo m68k-unknown-lynxos"$UNAME_RELEASE"- exit ;;- mc68030:UNIX_System_V:4.*:*)- echo m68k-atari-sysv4- exit ;;- TSUNAMI:LynxOS:2.*:*)- echo sparc-unknown-lynxos"$UNAME_RELEASE"- exit ;;- rs6000:LynxOS:2.*:*)- echo rs6000-unknown-lynxos"$UNAME_RELEASE"- exit ;;- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)- echo powerpc-unknown-lynxos"$UNAME_RELEASE"- exit ;;- SM[BE]S:UNIX_SV:*:*)- echo mips-dde-sysv"$UNAME_RELEASE"- exit ;;- RM*:ReliantUNIX-*:*:*)- echo mips-sni-sysv4- exit ;;- RM*:SINIX-*:*:*)- echo mips-sni-sysv4- exit ;;- *:SINIX-*:*:*)- if uname -p 2>/dev/null >/dev/null ; then- UNAME_MACHINE=$( (uname -p) 2>/dev/null)- echo "$UNAME_MACHINE"-sni-sysv4- else- echo ns32k-sni-sysv- fi- exit ;;- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort- # says <Richard.M.Bartel@ccMail.Census.GOV>- echo i586-unisys-sysv4- exit ;;- *:UNIX_System_V:4*:FTX*)- # From Gerald Hewes <hewes@openmarket.com>.- # How about differentiating between stratus architectures? -djm- echo hppa1.1-stratus-sysv4- exit ;;- *:*:*:FTX*)- # From seanf@swdc.stratus.com.- echo i860-stratus-sysv4- exit ;;- i*86:VOS:*:*)- # From Paul.Green@stratus.com.- echo "$UNAME_MACHINE"-stratus-vos- exit ;;- *:VOS:*:*)- # From Paul.Green@stratus.com.- echo hppa1.1-stratus-vos- exit ;;- mc68*:A/UX:*:*)- echo m68k-apple-aux"$UNAME_RELEASE"- exit ;;- news*:NEWS-OS:6*:*)- echo mips-sony-newsos6- exit ;;- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)- if test -d /usr/nec; then- echo mips-nec-sysv"$UNAME_RELEASE"- else- echo mips-unknown-sysv"$UNAME_RELEASE"- fi- exit ;;- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.- echo powerpc-be-beos- exit ;;- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.- echo powerpc-apple-beos- exit ;;- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.- echo i586-pc-beos- exit ;;- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.- echo i586-pc-haiku- exit ;;- x86_64:Haiku:*:*)- echo x86_64-unknown-haiku- exit ;;- SX-4:SUPER-UX:*:*)- echo sx4-nec-superux"$UNAME_RELEASE"- exit ;;- SX-5:SUPER-UX:*:*)- echo sx5-nec-superux"$UNAME_RELEASE"- exit ;;- SX-6:SUPER-UX:*:*)- echo sx6-nec-superux"$UNAME_RELEASE"- exit ;;- SX-7:SUPER-UX:*:*)- echo sx7-nec-superux"$UNAME_RELEASE"- exit ;;- SX-8:SUPER-UX:*:*)- echo sx8-nec-superux"$UNAME_RELEASE"- exit ;;- SX-8R:SUPER-UX:*:*)- echo sx8r-nec-superux"$UNAME_RELEASE"- exit ;;- SX-ACE:SUPER-UX:*:*)- echo sxace-nec-superux"$UNAME_RELEASE"- exit ;;- Power*:Rhapsody:*:*)- echo powerpc-apple-rhapsody"$UNAME_RELEASE"- exit ;;- *:Rhapsody:*:*)- echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"- exit ;;- arm64:Darwin:*:*)- echo aarch64-apple-darwin"$UNAME_RELEASE"- exit ;;- *:Darwin:*:*)- UNAME_PROCESSOR=$(uname -p)- case $UNAME_PROCESSOR in- unknown) UNAME_PROCESSOR=powerpc ;;- esac- if command -v xcode-select > /dev/null 2> /dev/null && \- ! xcode-select --print-path > /dev/null 2> /dev/null ; then- # Avoid executing cc if there is no toolchain installed as- # cc will be a stub that puts up a graphical alert- # prompting the user to install developer tools.- CC_FOR_BUILD=no_compiler_found- else- set_cc_for_build- fi- if test "$CC_FOR_BUILD" != no_compiler_found; then- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \- grep IS_64BIT_ARCH >/dev/null- then- case $UNAME_PROCESSOR in- i386) UNAME_PROCESSOR=x86_64 ;;- powerpc) UNAME_PROCESSOR=powerpc64 ;;- esac- fi- # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc- if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \- grep IS_PPC >/dev/null- then- UNAME_PROCESSOR=powerpc- fi- elif test "$UNAME_PROCESSOR" = i386 ; then- # uname -m returns i386 or x86_64- UNAME_PROCESSOR=$UNAME_MACHINE- fi- echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"- exit ;;- *:procnto*:*:* | *:QNX:[0123456789]*:*)- UNAME_PROCESSOR=$(uname -p)- if test "$UNAME_PROCESSOR" = x86; then- UNAME_PROCESSOR=i386- UNAME_MACHINE=pc- fi- echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"- exit ;;- *:QNX:*:4*)- echo i386-pc-qnx- exit ;;- NEO-*:NONSTOP_KERNEL:*:*)- echo neo-tandem-nsk"$UNAME_RELEASE"- exit ;;- NSE-*:NONSTOP_KERNEL:*:*)- echo nse-tandem-nsk"$UNAME_RELEASE"- exit ;;- NSR-*:NONSTOP_KERNEL:*:*)- echo nsr-tandem-nsk"$UNAME_RELEASE"- exit ;;- NSV-*:NONSTOP_KERNEL:*:*)- echo nsv-tandem-nsk"$UNAME_RELEASE"- exit ;;- NSX-*:NONSTOP_KERNEL:*:*)- echo nsx-tandem-nsk"$UNAME_RELEASE"- exit ;;- *:NonStop-UX:*:*)- echo mips-compaq-nonstopux- exit ;;- BS2000:POSIX*:*:*)- echo bs2000-siemens-sysv- exit ;;- DS/*:UNIX_System_V:*:*)- echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"- exit ;;- *:Plan9:*:*)- # "uname -m" is not consistent, so use $cputype instead. 386- # is converted to i386 for consistency with other x86- # operating systems.- # shellcheck disable=SC2154- if test "$cputype" = 386; then- UNAME_MACHINE=i386- else- UNAME_MACHINE="$cputype"- fi- echo "$UNAME_MACHINE"-unknown-plan9- exit ;;- *:TOPS-10:*:*)- echo pdp10-unknown-tops10- exit ;;- *:TENEX:*:*)- echo pdp10-unknown-tenex- exit ;;- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)- echo pdp10-dec-tops20- exit ;;- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)- echo pdp10-xkl-tops20- exit ;;- *:TOPS-20:*:*)- echo pdp10-unknown-tops20- exit ;;- *:ITS:*:*)- echo pdp10-unknown-its- exit ;;- SEI:*:*:SEIUX)- echo mips-sei-seiux"$UNAME_RELEASE"- exit ;;- *:DragonFly:*:*)- echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"- exit ;;- *:*VMS:*:*)- UNAME_MACHINE=$( (uname -p) 2>/dev/null)- case "$UNAME_MACHINE" in- A*) echo alpha-dec-vms ; exit ;;- I*) echo ia64-dec-vms ; exit ;;- V*) echo vax-dec-vms ; exit ;;- esac ;;- *:XENIX:*:SysV)- echo i386-pc-xenix- exit ;;- i*86:skyos:*:*)- echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')"- exit ;;- i*86:rdos:*:*)- echo "$UNAME_MACHINE"-pc-rdos- exit ;;- *:AROS:*:*)- echo "$UNAME_MACHINE"-unknown-aros- exit ;;- x86_64:VMkernel:*:*)- echo "$UNAME_MACHINE"-unknown-esx- exit ;;- amd64:Isilon\ OneFS:*:*)- echo x86_64-unknown-onefs- exit ;;- *:Unleashed:*:*)- echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"- exit ;;-esac--# No uname command or uname output not recognized.-set_cc_for_build-cat > "$dummy.c" <<EOF-#ifdef _SEQUENT_-#include <sys/types.h>-#include <sys/utsname.h>-#endif-#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)-#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)-#include <signal.h>-#if defined(_SIZE_T_) || defined(SIGLOST)-#include <sys/utsname.h>-#endif-#endif-#endif-main ()-{-#if defined (sony)-#if defined (MIPSEB)- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,- I don't know.... */- printf ("mips-sony-bsd\n"); exit (0);-#else-#include <sys/param.h>- printf ("m68k-sony-newsos%s\n",-#ifdef NEWSOS4- "4"-#else- ""-#endif- ); exit (0);-#endif-#endif--#if defined (NeXT)-#if !defined (__ARCHITECTURE__)-#define __ARCHITECTURE__ "m68k"-#endif- int version;- version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null);- if (version < 4)- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);- else- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);- exit (0);-#endif--#if defined (MULTIMAX) || defined (n16)-#if defined (UMAXV)- printf ("ns32k-encore-sysv\n"); exit (0);-#else-#if defined (CMU)- printf ("ns32k-encore-mach\n"); exit (0);-#else- printf ("ns32k-encore-bsd\n"); exit (0);-#endif-#endif-#endif--#if defined (__386BSD__)- printf ("i386-pc-bsd\n"); exit (0);-#endif--#if defined (sequent)-#if defined (i386)- printf ("i386-sequent-dynix\n"); exit (0);-#endif-#if defined (ns32000)- printf ("ns32k-sequent-dynix\n"); exit (0);-#endif-#endif--#if defined (_SEQUENT_)- struct utsname un;-- uname(&un);- if (strncmp(un.version, "V2", 2) == 0) {- printf ("i386-sequent-ptx2\n"); exit (0);- }- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */- printf ("i386-sequent-ptx1\n"); exit (0);- }- printf ("i386-sequent-ptx\n"); exit (0);-#endif--#if defined (vax)-#if !defined (ultrix)-#include <sys/param.h>-#if defined (BSD)-#if BSD == 43- printf ("vax-dec-bsd4.3\n"); exit (0);-#else-#if BSD == 199006- printf ("vax-dec-bsd4.3reno\n"); exit (0);-#else- printf ("vax-dec-bsd\n"); exit (0);-#endif-#endif-#else- printf ("vax-dec-bsd\n"); exit (0);-#endif-#else-#if defined(_SIZE_T_) || defined(SIGLOST)- struct utsname un;- uname (&un);- printf ("vax-dec-ultrix%s\n", un.release); exit (0);-#else- printf ("vax-dec-ultrix\n"); exit (0);-#endif-#endif-#endif-#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)-#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)-#if defined(_SIZE_T_) || defined(SIGLOST)- struct utsname *un;- uname (&un);- printf ("mips-dec-ultrix%s\n", un.release); exit (0);-#else- printf ("mips-dec-ultrix\n"); exit (0);-#endif-#endif-#endif--#if defined (alliant) && defined (i860)- printf ("i860-alliant-bsd\n"); exit (0);-#endif-- exit (1);-}-EOF--$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) &&- { echo "$SYSTEM_NAME"; exit; }--# Apollos put the system type in the environment.-test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }--echo "$0: unable to guess system type" >&2--case "$UNAME_MACHINE:$UNAME_SYSTEM" in- mips:Linux | mips64:Linux)- # If we got here on MIPS GNU/Linux, output extra information.- cat >&2 <<EOF--NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize-the system type. Please install a C compiler and try again.-EOF- ;;-esac--cat >&2 <<EOF--This script (version $timestamp), has failed to recognize the-operating system you are using. If your script is old, overwrite *all*-copies of config.guess and config.sub with the latest versions from:-- https://git.savannah.gnu.org/cgit/config.git/plain/config.guess-and- https://git.savannah.gnu.org/cgit/config.git/plain/config.sub-EOF--year=$(echo $timestamp | sed 's,-.*,,')-# shellcheck disable=SC2003-if test "$(expr "$(date +%Y)" - "$year")" -lt 3 ; then- cat >&2 <<EOF--If $0 has already been updated, send the following data and any-information you think might be pertinent to config-patches@gnu.org to-provide the necessary information to handle your system.--config.guess timestamp = $timestamp--uname -m = $( (uname -m) 2>/dev/null || echo unknown)-uname -r = $( (uname -r) 2>/dev/null || echo unknown)-uname -s = $( (uname -s) 2>/dev/null || echo unknown)-uname -v = $( (uname -v) 2>/dev/null || echo unknown)--/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null)-/bin/uname -X = $( (/bin/uname -X) 2>/dev/null)--hostinfo = $( (hostinfo) 2>/dev/null)-/bin/universe = $( (/bin/universe) 2>/dev/null)-/usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null)-/bin/arch = $( (/bin/arch) 2>/dev/null)-/usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null)-/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null)+# Copyright 1992-2022 Free Software Foundation, Inc.++# shellcheck disable=SC2006,SC2268 # see below for rationale++timestamp='2022-05-25'++# This file is free software; you can redistribute it and/or modify it+# under the terms of the GNU General Public License as published by+# the Free Software Foundation, either version 3 of the License, or+# (at your option) any later version.+#+# This program is distributed in the hope that it will be useful, but+# WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+# General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, see <https://www.gnu.org/licenses/>.+#+# As a special exception to the GNU General Public License, if you+# distribute this file as part of a program that contains a+# configuration script generated by Autoconf, you may include it under+# the same distribution terms that you use for the rest of that+# program. This Exception is an additional permission under section 7+# of the GNU General Public License, version 3 ("GPLv3").+#+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.+#+# You can get the latest version of this script from:+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess+#+# Please send patches to <config-patches@gnu.org>.+++# The "shellcheck disable" line above the timestamp inhibits complaints+# about features and limitations of the classic Bourne shell that were+# superseded or lifted in POSIX. However, this script identifies a wide+# variety of pre-POSIX systems that do not have POSIX shells at all, and+# even some reasonably current systems (Solaris 10 as case-in-point) still+# have a pre-POSIX /bin/sh.+++me=`echo "$0" | sed -e 's,.*/,,'`++usage="\+Usage: $0 [OPTION]++Output the configuration name of the system \`$me' is run on.++Options:+ -h, --help print this help, then exit+ -t, --time-stamp print date of last modification, then exit+ -v, --version print version number, then exit++Report bugs and patches to <config-patches@gnu.org>."++version="\+GNU config.guess ($timestamp)++Originally written by Per Bothner.+Copyright 1992-2022 Free Software Foundation, Inc.++This is free software; see the source for copying conditions. There is NO+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."++help="+Try \`$me --help' for more information."++# Parse command line+while test $# -gt 0 ; do+ case $1 in+ --time-stamp | --time* | -t )+ echo "$timestamp" ; exit ;;+ --version | -v )+ echo "$version" ; exit ;;+ --help | --h* | -h )+ echo "$usage"; exit ;;+ -- ) # Stop option processing+ shift; break ;;+ - ) # Use stdin as input.+ break ;;+ -* )+ echo "$me: invalid option $1$help" >&2+ exit 1 ;;+ * )+ break ;;+ esac+done++if test $# != 0; then+ echo "$me: too many arguments$help" >&2+ exit 1+fi++# Just in case it came from the environment.+GUESS=++# CC_FOR_BUILD -- compiler used by this script. Note that the use of a+# compiler to aid in system detection is discouraged as it requires+# temporary files to be created and, as you can see below, it is a+# headache to deal with in a portable fashion.++# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still+# use `HOST_CC' if defined, but it is deprecated.++# Portable tmp directory creation inspired by the Autoconf team.++tmp=+# shellcheck disable=SC2172+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15++set_cc_for_build() {+ # prevent multiple calls if $tmp is already set+ test "$tmp" && return 0+ : "${TMPDIR=/tmp}"+ # shellcheck disable=SC2039,SC3028+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }+ dummy=$tmp/dummy+ case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in+ ,,) echo "int x;" > "$dummy.c"+ for driver in cc gcc c89 c99 ; do+ if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then+ CC_FOR_BUILD=$driver+ break+ fi+ done+ if test x"$CC_FOR_BUILD" = x ; then+ CC_FOR_BUILD=no_compiler_found+ fi+ ;;+ ,,*) CC_FOR_BUILD=$CC ;;+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;+ esac+}++# This is needed to find uname on a Pyramid OSx when run in the BSD universe.+# (ghazi@noc.rutgers.edu 1994-08-24)+if test -f /.attbin/uname ; then+ PATH=$PATH:/.attbin ; export PATH+fi++UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown++case $UNAME_SYSTEM in+Linux|GNU|GNU/*)+ LIBC=unknown++ set_cc_for_build+ cat <<-EOF > "$dummy.c"+ #include <features.h>+ #if defined(__UCLIBC__)+ LIBC=uclibc+ #elif defined(__dietlibc__)+ LIBC=dietlibc+ #elif defined(__GLIBC__)+ LIBC=gnu+ #else+ #include <stdarg.h>+ /* First heuristic to detect musl libc. */+ #ifdef __DEFINED_va_list+ LIBC=musl+ #endif+ #endif+ EOF+ cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`+ eval "$cc_set_libc"++ # Second heuristic to detect musl libc.+ if [ "$LIBC" = unknown ] &&+ command -v ldd >/dev/null &&+ ldd --version 2>&1 | grep -q ^musl; then+ LIBC=musl+ fi++ # If the system lacks a compiler, then just pick glibc.+ # We could probably try harder.+ if [ "$LIBC" = unknown ]; then+ LIBC=gnu+ fi+ ;;+esac++# Note: order is significant - the case branches are not exclusive.++case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in+ *:NetBSD:*:*)+ # NetBSD (nbsd) targets should (where applicable) match one or+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently+ # switched to ELF, *-*-netbsd* would select the old+ # object file format. This provides both forward+ # compatibility and a consistent mechanism for selecting the+ # object file format.+ #+ # Note: NetBSD doesn't particularly care about the vendor+ # portion of the name. We always set it to "unknown".+ UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \+ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \+ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \+ echo unknown)`+ case $UNAME_MACHINE_ARCH in+ aarch64eb) machine=aarch64_be-unknown ;;+ armeb) machine=armeb-unknown ;;+ arm*) machine=arm-unknown ;;+ sh3el) machine=shl-unknown ;;+ sh3eb) machine=sh-unknown ;;+ sh5el) machine=sh5le-unknown ;;+ earmv*)+ arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`+ endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`+ machine=${arch}${endian}-unknown+ ;;+ *) machine=$UNAME_MACHINE_ARCH-unknown ;;+ esac+ # The Operating System including object format, if it has switched+ # to ELF recently (or will in the future) and ABI.+ case $UNAME_MACHINE_ARCH in+ earm*)+ os=netbsdelf+ ;;+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)+ set_cc_for_build+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \+ | grep -q __ELF__+ then+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).+ # Return netbsd for either. FIX?+ os=netbsd+ else+ os=netbsdelf+ fi+ ;;+ *)+ os=netbsd+ ;;+ esac+ # Determine ABI tags.+ case $UNAME_MACHINE_ARCH in+ earm*)+ expr='s/^earmv[0-9]/-eabi/;s/eb$//'+ abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`+ ;;+ esac+ # The OS release+ # Debian GNU/NetBSD machines have a different userland, and+ # thus, need a distinct triplet. However, they do not need+ # kernel version information, so it can be replaced with a+ # suitable tag, in the style of linux-gnu.+ case $UNAME_VERSION in+ Debian*)+ release='-gnu'+ ;;+ *)+ release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`+ ;;+ esac+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:+ # contains redundant information, the shorter form:+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.+ GUESS=$machine-${os}${release}${abi-}+ ;;+ *:Bitrig:*:*)+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`+ GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE+ ;;+ *:OpenBSD:*:*)+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`+ GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE+ ;;+ *:SecBSD:*:*)+ UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`+ GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE+ ;;+ *:LibertyBSD:*:*)+ UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`+ GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE+ ;;+ *:MidnightBSD:*:*)+ GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE+ ;;+ *:ekkoBSD:*:*)+ GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE+ ;;+ *:SolidBSD:*:*)+ GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE+ ;;+ *:OS108:*:*)+ GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE+ ;;+ macppc:MirBSD:*:*)+ GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE+ ;;+ *:MirBSD:*:*)+ GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE+ ;;+ *:Sortix:*:*)+ GUESS=$UNAME_MACHINE-unknown-sortix+ ;;+ *:Twizzler:*:*)+ GUESS=$UNAME_MACHINE-unknown-twizzler+ ;;+ *:Redox:*:*)+ GUESS=$UNAME_MACHINE-unknown-redox+ ;;+ mips:OSF1:*.*)+ GUESS=mips-dec-osf1+ ;;+ alpha:OSF1:*:*)+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.+ trap '' 0+ case $UNAME_RELEASE in+ *4.0)+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`+ ;;+ *5.*)+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`+ ;;+ esac+ # According to Compaq, /usr/sbin/psrinfo has been available on+ # OSF/1 and Tru64 systems produced since 1995. I hope that+ # covers most systems running today. This code pipes the CPU+ # types through head -n 1, so we only detect the type of CPU 0.+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`+ case $ALPHA_CPU_TYPE in+ "EV4 (21064)")+ UNAME_MACHINE=alpha ;;+ "EV4.5 (21064)")+ UNAME_MACHINE=alpha ;;+ "LCA4 (21066/21068)")+ UNAME_MACHINE=alpha ;;+ "EV5 (21164)")+ UNAME_MACHINE=alphaev5 ;;+ "EV5.6 (21164A)")+ UNAME_MACHINE=alphaev56 ;;+ "EV5.6 (21164PC)")+ UNAME_MACHINE=alphapca56 ;;+ "EV5.7 (21164PC)")+ UNAME_MACHINE=alphapca57 ;;+ "EV6 (21264)")+ UNAME_MACHINE=alphaev6 ;;+ "EV6.7 (21264A)")+ UNAME_MACHINE=alphaev67 ;;+ "EV6.8CB (21264C)")+ UNAME_MACHINE=alphaev68 ;;+ "EV6.8AL (21264B)")+ UNAME_MACHINE=alphaev68 ;;+ "EV6.8CX (21264D)")+ UNAME_MACHINE=alphaev68 ;;+ "EV6.9A (21264/EV69A)")+ UNAME_MACHINE=alphaev69 ;;+ "EV7 (21364)")+ UNAME_MACHINE=alphaev7 ;;+ "EV7.9 (21364A)")+ UNAME_MACHINE=alphaev79 ;;+ esac+ # A Pn.n version is a patched version.+ # A Vn.n version is a released version.+ # A Tn.n version is a released field test version.+ # A Xn.n version is an unreleased experimental baselevel.+ # 1.2 uses "1.2" for uname -r.+ OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`+ GUESS=$UNAME_MACHINE-dec-osf$OSF_REL+ ;;+ Amiga*:UNIX_System_V:4.0:*)+ GUESS=m68k-unknown-sysv4+ ;;+ *:[Aa]miga[Oo][Ss]:*:*)+ GUESS=$UNAME_MACHINE-unknown-amigaos+ ;;+ *:[Mm]orph[Oo][Ss]:*:*)+ GUESS=$UNAME_MACHINE-unknown-morphos+ ;;+ *:OS/390:*:*)+ GUESS=i370-ibm-openedition+ ;;+ *:z/VM:*:*)+ GUESS=s390-ibm-zvmoe+ ;;+ *:OS400:*:*)+ GUESS=powerpc-ibm-os400+ ;;+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)+ GUESS=arm-acorn-riscix$UNAME_RELEASE+ ;;+ arm*:riscos:*:*|arm*:RISCOS:*:*)+ GUESS=arm-unknown-riscos+ ;;+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)+ GUESS=hppa1.1-hitachi-hiuxmpp+ ;;+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.+ case `(/bin/universe) 2>/dev/null` in+ att) GUESS=pyramid-pyramid-sysv3 ;;+ *) GUESS=pyramid-pyramid-bsd ;;+ esac+ ;;+ NILE*:*:*:dcosx)+ GUESS=pyramid-pyramid-svr4+ ;;+ DRS?6000:unix:4.0:6*)+ GUESS=sparc-icl-nx6+ ;;+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)+ case `/usr/bin/uname -p` in+ sparc) GUESS=sparc-icl-nx7 ;;+ esac+ ;;+ s390x:SunOS:*:*)+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`+ GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL+ ;;+ sun4H:SunOS:5.*:*)+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`+ GUESS=sparc-hal-solaris2$SUN_REL+ ;;+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`+ GUESS=sparc-sun-solaris2$SUN_REL+ ;;+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)+ GUESS=i386-pc-auroraux$UNAME_RELEASE+ ;;+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)+ set_cc_for_build+ SUN_ARCH=i386+ # If there is a compiler, see if it is configured for 64-bit objects.+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.+ # This test works for both compilers.+ if test "$CC_FOR_BUILD" != no_compiler_found; then+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \+ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \+ grep IS_64BIT_ARCH >/dev/null+ then+ SUN_ARCH=x86_64+ fi+ fi+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`+ GUESS=$SUN_ARCH-pc-solaris2$SUN_REL+ ;;+ sun4*:SunOS:6*:*)+ # According to config.sub, this is the proper way to canonicalize+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but+ # it's likely to be more like Solaris than SunOS4.+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`+ GUESS=sparc-sun-solaris3$SUN_REL+ ;;+ sun4*:SunOS:*:*)+ case `/usr/bin/arch -k` in+ Series*|S4*)+ UNAME_RELEASE=`uname -v`+ ;;+ esac+ # Japanese Language versions have a version number like `4.1.3-JL'.+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`+ GUESS=sparc-sun-sunos$SUN_REL+ ;;+ sun3*:SunOS:*:*)+ GUESS=m68k-sun-sunos$UNAME_RELEASE+ ;;+ sun*:*:4.2BSD:*)+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`+ test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3+ case `/bin/arch` in+ sun3)+ GUESS=m68k-sun-sunos$UNAME_RELEASE+ ;;+ sun4)+ GUESS=sparc-sun-sunos$UNAME_RELEASE+ ;;+ esac+ ;;+ aushp:SunOS:*:*)+ GUESS=sparc-auspex-sunos$UNAME_RELEASE+ ;;+ # The situation for MiNT is a little confusing. The machine name+ # can be virtually everything (everything which is not+ # "atarist" or "atariste" at least should have a processor+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"+ # to the lowercase version "mint" (or "freemint"). Finally+ # the system name "TOS" denotes a system which is actually not+ # MiNT. But MiNT is downward compatible to TOS, so this should+ # be no problem.+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)+ GUESS=m68k-atari-mint$UNAME_RELEASE+ ;;+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)+ GUESS=m68k-atari-mint$UNAME_RELEASE+ ;;+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)+ GUESS=m68k-atari-mint$UNAME_RELEASE+ ;;+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)+ GUESS=m68k-milan-mint$UNAME_RELEASE+ ;;+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)+ GUESS=m68k-hades-mint$UNAME_RELEASE+ ;;+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)+ GUESS=m68k-unknown-mint$UNAME_RELEASE+ ;;+ m68k:machten:*:*)+ GUESS=m68k-apple-machten$UNAME_RELEASE+ ;;+ powerpc:machten:*:*)+ GUESS=powerpc-apple-machten$UNAME_RELEASE+ ;;+ RISC*:Mach:*:*)+ GUESS=mips-dec-mach_bsd4.3+ ;;+ RISC*:ULTRIX:*:*)+ GUESS=mips-dec-ultrix$UNAME_RELEASE+ ;;+ VAX*:ULTRIX*:*:*)+ GUESS=vax-dec-ultrix$UNAME_RELEASE+ ;;+ 2020:CLIX:*:* | 2430:CLIX:*:*)+ GUESS=clipper-intergraph-clix$UNAME_RELEASE+ ;;+ mips:*:*:UMIPS | mips:*:*:RISCos)+ set_cc_for_build+ sed 's/^ //' << EOF > "$dummy.c"+#ifdef __cplusplus+#include <stdio.h> /* for printf() prototype */+ int main (int argc, char *argv[]) {+#else+ int main (argc, argv) int argc; char *argv[]; {+#endif+ #if defined (host_mips) && defined (MIPSEB)+ #if defined (SYSTYPE_SYSV)+ printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);+ #endif+ #if defined (SYSTYPE_SVR4)+ printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);+ #endif+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)+ printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);+ #endif+ #endif+ exit (-1);+ }+EOF+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&+ dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&+ SYSTEM_NAME=`"$dummy" "$dummyarg"` &&+ { echo "$SYSTEM_NAME"; exit; }+ GUESS=mips-mips-riscos$UNAME_RELEASE+ ;;+ Motorola:PowerMAX_OS:*:*)+ GUESS=powerpc-motorola-powermax+ ;;+ Motorola:*:4.3:PL8-*)+ GUESS=powerpc-harris-powermax+ ;;+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)+ GUESS=powerpc-harris-powermax+ ;;+ Night_Hawk:Power_UNIX:*:*)+ GUESS=powerpc-harris-powerunix+ ;;+ m88k:CX/UX:7*:*)+ GUESS=m88k-harris-cxux7+ ;;+ m88k:*:4*:R4*)+ GUESS=m88k-motorola-sysv4+ ;;+ m88k:*:3*:R3*)+ GUESS=m88k-motorola-sysv3+ ;;+ AViiON:dgux:*:*)+ # DG/UX returns AViiON for all architectures+ UNAME_PROCESSOR=`/usr/bin/uname -p`+ if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110+ then+ if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \+ test "$TARGET_BINARY_INTERFACE"x = x+ then+ GUESS=m88k-dg-dgux$UNAME_RELEASE+ else+ GUESS=m88k-dg-dguxbcs$UNAME_RELEASE+ fi+ else+ GUESS=i586-dg-dgux$UNAME_RELEASE+ fi+ ;;+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)+ GUESS=m88k-dolphin-sysv3+ ;;+ M88*:*:R3*:*)+ # Delta 88k system running SVR3+ GUESS=m88k-motorola-sysv3+ ;;+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)+ GUESS=m88k-tektronix-sysv3+ ;;+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)+ GUESS=m68k-tektronix-bsd+ ;;+ *:IRIX*:*:*)+ IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`+ GUESS=mips-sgi-irix$IRIX_REL+ ;;+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.+ GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id+ ;; # Note that: echo "'`uname -s`'" gives 'AIX '+ i*86:AIX:*:*)+ GUESS=i386-ibm-aix+ ;;+ ia64:AIX:*:*)+ if test -x /usr/bin/oslevel ; then+ IBM_REV=`/usr/bin/oslevel`+ else+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE+ fi+ GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV+ ;;+ *:AIX:2:3)+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then+ set_cc_for_build+ sed 's/^ //' << EOF > "$dummy.c"+ #include <sys/systemcfg.h>++ main()+ {+ if (!__power_pc())+ exit(1);+ puts("powerpc-ibm-aix3.2.5");+ exit(0);+ }+EOF+ if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`+ then+ GUESS=$SYSTEM_NAME+ else+ GUESS=rs6000-ibm-aix3.2.5+ fi+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then+ GUESS=rs6000-ibm-aix3.2.4+ else+ GUESS=rs6000-ibm-aix3.2+ fi+ ;;+ *:AIX:*:[4567])+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`+ if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then+ IBM_ARCH=rs6000+ else+ IBM_ARCH=powerpc+ fi+ if test -x /usr/bin/lslpp ; then+ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \+ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`+ else+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE+ fi+ GUESS=$IBM_ARCH-ibm-aix$IBM_REV+ ;;+ *:AIX:*:*)+ GUESS=rs6000-ibm-aix+ ;;+ ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)+ GUESS=romp-ibm-bsd4.4+ ;;+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and+ GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to+ ;; # report: romp-ibm BSD 4.3+ *:BOSX:*:*)+ GUESS=rs6000-bull-bosx+ ;;+ DPX/2?00:B.O.S.:*:*)+ GUESS=m68k-bull-sysv3+ ;;+ 9000/[34]??:4.3bsd:1.*:*)+ GUESS=m68k-hp-bsd+ ;;+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)+ GUESS=m68k-hp-bsd4.4+ ;;+ 9000/[34678]??:HP-UX:*:*)+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`+ case $UNAME_MACHINE in+ 9000/31?) HP_ARCH=m68000 ;;+ 9000/[34]??) HP_ARCH=m68k ;;+ 9000/[678][0-9][0-9])+ if test -x /usr/bin/getconf; then+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`+ case $sc_cpu_version in+ 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0+ 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1+ 532) # CPU_PA_RISC2_0+ case $sc_kernel_bits in+ 32) HP_ARCH=hppa2.0n ;;+ 64) HP_ARCH=hppa2.0w ;;+ '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20+ esac ;;+ esac+ fi+ if test "$HP_ARCH" = ""; then+ set_cc_for_build+ sed 's/^ //' << EOF > "$dummy.c"++ #define _HPUX_SOURCE+ #include <stdlib.h>+ #include <unistd.h>++ int main ()+ {+ #if defined(_SC_KERNEL_BITS)+ long bits = sysconf(_SC_KERNEL_BITS);+ #endif+ long cpu = sysconf (_SC_CPU_VERSION);++ switch (cpu)+ {+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;+ case CPU_PA_RISC2_0:+ #if defined(_SC_KERNEL_BITS)+ switch (bits)+ {+ case 64: puts ("hppa2.0w"); break;+ case 32: puts ("hppa2.0n"); break;+ default: puts ("hppa2.0"); break;+ } break;+ #else /* !defined(_SC_KERNEL_BITS) */+ puts ("hppa2.0"); break;+ #endif+ default: puts ("hppa1.0"); break;+ }+ exit (0);+ }+EOF+ (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`+ test -z "$HP_ARCH" && HP_ARCH=hppa+ fi ;;+ esac+ if test "$HP_ARCH" = hppa2.0w+ then+ set_cc_for_build++ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler+ # generating 64-bit code. GNU and HP use different nomenclature:+ #+ # $ CC_FOR_BUILD=cc ./config.guess+ # => hppa2.0w-hp-hpux11.23+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess+ # => hppa64-hp-hpux11.23++ if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |+ grep -q __LP64__+ then+ HP_ARCH=hppa2.0w+ else+ HP_ARCH=hppa64+ fi+ fi+ GUESS=$HP_ARCH-hp-hpux$HPUX_REV+ ;;+ ia64:HP-UX:*:*)+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`+ GUESS=ia64-hp-hpux$HPUX_REV+ ;;+ 3050*:HI-UX:*:*)+ set_cc_for_build+ sed 's/^ //' << EOF > "$dummy.c"+ #include <unistd.h>+ int+ main ()+ {+ long cpu = sysconf (_SC_CPU_VERSION);+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct+ results, however. */+ if (CPU_IS_PA_RISC (cpu))+ {+ switch (cpu)+ {+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;+ default: puts ("hppa-hitachi-hiuxwe2"); break;+ }+ }+ else if (CPU_IS_HP_MC68K (cpu))+ puts ("m68k-hitachi-hiuxwe2");+ else puts ("unknown-hitachi-hiuxwe2");+ exit (0);+ }+EOF+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&+ { echo "$SYSTEM_NAME"; exit; }+ GUESS=unknown-hitachi-hiuxwe2+ ;;+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)+ GUESS=hppa1.1-hp-bsd+ ;;+ 9000/8??:4.3bsd:*:*)+ GUESS=hppa1.0-hp-bsd+ ;;+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)+ GUESS=hppa1.0-hp-mpeix+ ;;+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)+ GUESS=hppa1.1-hp-osf+ ;;+ hp8??:OSF1:*:*)+ GUESS=hppa1.0-hp-osf+ ;;+ i*86:OSF1:*:*)+ if test -x /usr/sbin/sysversion ; then+ GUESS=$UNAME_MACHINE-unknown-osf1mk+ else+ GUESS=$UNAME_MACHINE-unknown-osf1+ fi+ ;;+ parisc*:Lites*:*:*)+ GUESS=hppa1.1-hp-lites+ ;;+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)+ GUESS=c1-convex-bsd+ ;;+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)+ if getsysinfo -f scalar_acc+ then echo c32-convex-bsd+ else echo c2-convex-bsd+ fi+ exit ;;+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)+ GUESS=c34-convex-bsd+ ;;+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)+ GUESS=c38-convex-bsd+ ;;+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)+ GUESS=c4-convex-bsd+ ;;+ CRAY*Y-MP:*:*:*)+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`+ GUESS=ymp-cray-unicos$CRAY_REL+ ;;+ CRAY*[A-Z]90:*:*:*)+ echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \+ -e 's/\.[^.]*$/.X/'+ exit ;;+ CRAY*TS:*:*:*)+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`+ GUESS=t90-cray-unicos$CRAY_REL+ ;;+ CRAY*T3E:*:*:*)+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`+ GUESS=alphaev5-cray-unicosmk$CRAY_REL+ ;;+ CRAY*SV1:*:*:*)+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`+ GUESS=sv1-cray-unicos$CRAY_REL+ ;;+ *:UNICOS/mp:*:*)+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`+ GUESS=craynv-cray-unicosmp$CRAY_REL+ ;;+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)+ FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`+ FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`+ GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}+ ;;+ 5000:UNIX_System_V:4.*:*)+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`+ FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`+ GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}+ ;;+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)+ GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE+ ;;+ sparc*:BSD/OS:*:*)+ GUESS=sparc-unknown-bsdi$UNAME_RELEASE+ ;;+ *:BSD/OS:*:*)+ GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE+ ;;+ arm:FreeBSD:*:*)+ UNAME_PROCESSOR=`uname -p`+ set_cc_for_build+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \+ | grep -q __ARM_PCS_VFP+ then+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi+ else+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf+ fi+ ;;+ *:FreeBSD:*:*)+ UNAME_PROCESSOR=`/usr/bin/uname -p`+ case $UNAME_PROCESSOR in+ amd64)+ UNAME_PROCESSOR=x86_64 ;;+ i386)+ UNAME_PROCESSOR=i586 ;;+ esac+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL+ ;;+ i*:CYGWIN*:*)+ GUESS=$UNAME_MACHINE-pc-cygwin+ ;;+ *:MINGW64*:*)+ GUESS=$UNAME_MACHINE-pc-mingw64+ ;;+ *:MINGW*:*)+ GUESS=$UNAME_MACHINE-pc-mingw32+ ;;+ *:MSYS*:*)+ GUESS=$UNAME_MACHINE-pc-msys+ ;;+ i*:PW*:*)+ GUESS=$UNAME_MACHINE-pc-pw32+ ;;+ *:SerenityOS:*:*)+ GUESS=$UNAME_MACHINE-pc-serenity+ ;;+ *:Interix*:*)+ case $UNAME_MACHINE in+ x86)+ GUESS=i586-pc-interix$UNAME_RELEASE+ ;;+ authenticamd | genuineintel | EM64T)+ GUESS=x86_64-unknown-interix$UNAME_RELEASE+ ;;+ IA64)+ GUESS=ia64-unknown-interix$UNAME_RELEASE+ ;;+ esac ;;+ i*:UWIN*:*)+ GUESS=$UNAME_MACHINE-pc-uwin+ ;;+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)+ GUESS=x86_64-pc-cygwin+ ;;+ prep*:SunOS:5.*:*)+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`+ GUESS=powerpcle-unknown-solaris2$SUN_REL+ ;;+ *:GNU:*:*)+ # the GNU system+ GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`+ GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL+ ;;+ *:GNU/*:*:*)+ # other systems with GNU libc and userland+ GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`+ GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC+ ;;+ *:Minix:*:*)+ GUESS=$UNAME_MACHINE-unknown-minix+ ;;+ aarch64:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ aarch64_be:Linux:*:*)+ UNAME_MACHINE=aarch64_be+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ alpha:Linux:*:*)+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in+ EV5) UNAME_MACHINE=alphaev5 ;;+ EV56) UNAME_MACHINE=alphaev56 ;;+ PCA56) UNAME_MACHINE=alphapca56 ;;+ PCA57) UNAME_MACHINE=alphapca56 ;;+ EV6) UNAME_MACHINE=alphaev6 ;;+ EV67) UNAME_MACHINE=alphaev67 ;;+ EV68*) UNAME_MACHINE=alphaev68 ;;+ esac+ objdump --private-headers /bin/sh | grep -q ld.so.1+ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ arm*:Linux:*:*)+ set_cc_for_build+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \+ | grep -q __ARM_EABI__+ then+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ else+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \+ | grep -q __ARM_PCS_VFP+ then+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi+ else+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf+ fi+ fi+ ;;+ avr32*:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ cris:Linux:*:*)+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC+ ;;+ crisv32:Linux:*:*)+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC+ ;;+ e2k:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ frv:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ hexagon:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ i*86:Linux:*:*)+ GUESS=$UNAME_MACHINE-pc-linux-$LIBC+ ;;+ ia64:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ k1om:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ m32r*:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ m68*:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ mips:Linux:*:* | mips64:Linux:*:*)+ set_cc_for_build+ IS_GLIBC=0+ test x"${LIBC}" = xgnu && IS_GLIBC=1+ sed 's/^ //' << EOF > "$dummy.c"+ #undef CPU+ #undef mips+ #undef mipsel+ #undef mips64+ #undef mips64el+ #if ${IS_GLIBC} && defined(_ABI64)+ LIBCABI=gnuabi64+ #else+ #if ${IS_GLIBC} && defined(_ABIN32)+ LIBCABI=gnuabin32+ #else+ LIBCABI=${LIBC}+ #endif+ #endif++ #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6+ CPU=mipsisa64r6+ #else+ #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6+ CPU=mipsisa32r6+ #else+ #if defined(__mips64)+ CPU=mips64+ #else+ CPU=mips+ #endif+ #endif+ #endif++ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)+ MIPS_ENDIAN=el+ #else+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)+ MIPS_ENDIAN=+ #else+ MIPS_ENDIAN=+ #endif+ #endif+EOF+ cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`+ eval "$cc_set_vars"+ test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }+ ;;+ mips64el:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ openrisc*:Linux:*:*)+ GUESS=or1k-unknown-linux-$LIBC+ ;;+ or32:Linux:*:* | or1k*:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ padre:Linux:*:*)+ GUESS=sparc-unknown-linux-$LIBC+ ;;+ parisc64:Linux:*:* | hppa64:Linux:*:*)+ GUESS=hppa64-unknown-linux-$LIBC+ ;;+ parisc:Linux:*:* | hppa:Linux:*:*)+ # Look for CPU level+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in+ PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;+ PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;+ *) GUESS=hppa-unknown-linux-$LIBC ;;+ esac+ ;;+ ppc64:Linux:*:*)+ GUESS=powerpc64-unknown-linux-$LIBC+ ;;+ ppc:Linux:*:*)+ GUESS=powerpc-unknown-linux-$LIBC+ ;;+ ppc64le:Linux:*:*)+ GUESS=powerpc64le-unknown-linux-$LIBC+ ;;+ ppcle:Linux:*:*)+ GUESS=powerpcle-unknown-linux-$LIBC+ ;;+ riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ s390:Linux:*:* | s390x:Linux:*:*)+ GUESS=$UNAME_MACHINE-ibm-linux-$LIBC+ ;;+ sh64*:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ sh*:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ sparc:Linux:*:* | sparc64:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ tile*:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ vax:Linux:*:*)+ GUESS=$UNAME_MACHINE-dec-linux-$LIBC+ ;;+ x86_64:Linux:*:*)+ set_cc_for_build+ CPU=$UNAME_MACHINE+ LIBCABI=$LIBC+ if test "$CC_FOR_BUILD" != no_compiler_found; then+ ABI=64+ sed 's/^ //' << EOF > "$dummy.c"+ #ifdef __i386__+ ABI=x86+ #else+ #ifdef __ILP32__+ ABI=x32+ #endif+ #endif+EOF+ cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`+ eval "$cc_set_abi"+ case $ABI in+ x86) CPU=i686 ;;+ x32) LIBCABI=${LIBC}x32 ;;+ esac+ fi+ GUESS=$CPU-pc-linux-$LIBCABI+ ;;+ xtensa*:Linux:*:*)+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC+ ;;+ i*86:DYNIX/ptx:4*:*)+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.+ # earlier versions are messed up and put the nodename in both+ # sysname and nodename.+ GUESS=i386-sequent-sysv4+ ;;+ i*86:UNIX_SV:4.2MP:2.*)+ # Unixware is an offshoot of SVR4, but it has its own version+ # number series starting with 2...+ # I am not positive that other SVR4 systems won't match this,+ # I just have to hope. -- rms.+ # Use sysv4.2uw... so that sysv4* matches it.+ GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION+ ;;+ i*86:OS/2:*:*)+ # If we were able to find `uname', then EMX Unix compatibility+ # is probably installed.+ GUESS=$UNAME_MACHINE-pc-os2-emx+ ;;+ i*86:XTS-300:*:STOP)+ GUESS=$UNAME_MACHINE-unknown-stop+ ;;+ i*86:atheos:*:*)+ GUESS=$UNAME_MACHINE-unknown-atheos+ ;;+ i*86:syllable:*:*)+ GUESS=$UNAME_MACHINE-pc-syllable+ ;;+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)+ GUESS=i386-unknown-lynxos$UNAME_RELEASE+ ;;+ i*86:*DOS:*:*)+ GUESS=$UNAME_MACHINE-pc-msdosdjgpp+ ;;+ i*86:*:4.*:*)+ UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then+ GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL+ else+ GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL+ fi+ ;;+ i*86:*:5:[678]*)+ # UnixWare 7.x, OpenUNIX and OpenServer 6.+ case `/bin/uname -X | grep "^Machine"` in+ *486*) UNAME_MACHINE=i486 ;;+ *Pentium) UNAME_MACHINE=i586 ;;+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;+ esac+ GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}+ ;;+ i*86:*:3.2:*)+ if test -f /usr/options/cb.name; then+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`+ GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL+ elif /bin/uname -X 2>/dev/null >/dev/null ; then+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \+ && UNAME_MACHINE=i586+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \+ && UNAME_MACHINE=i686+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \+ && UNAME_MACHINE=i686+ GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL+ else+ GUESS=$UNAME_MACHINE-pc-sysv32+ fi+ ;;+ pc:*:*:*)+ # Left here for compatibility:+ # uname -m prints for DJGPP always 'pc', but it prints nothing about+ # the processor, so we play safe by assuming i586.+ # Note: whatever this is, it MUST be the same as what config.sub+ # prints for the "djgpp" host, or else GDB configure will decide that+ # this is a cross-build.+ GUESS=i586-pc-msdosdjgpp+ ;;+ Intel:Mach:3*:*)+ GUESS=i386-pc-mach3+ ;;+ paragon:*:*:*)+ GUESS=i860-intel-osf1+ ;;+ i860:*:4.*:*) # i860-SVR4+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then+ GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4+ else # Add other i860-SVR4 vendors below as they are discovered.+ GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4+ fi+ ;;+ mini*:CTIX:SYS*5:*)+ # "miniframe"+ GUESS=m68010-convergent-sysv+ ;;+ mc68k:UNIX:SYSTEM5:3.51m)+ GUESS=m68k-convergent-sysv+ ;;+ M680?0:D-NIX:5.3:*)+ GUESS=m68k-diab-dnix+ ;;+ M68*:*:R3V[5678]*:*)+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)+ OS_REL=''+ test -r /etc/.relid \+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \+ && { echo i486-ncr-sysv4; exit; } ;;+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)+ OS_REL='.3'+ test -r /etc/.relid \+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)+ GUESS=m68k-unknown-lynxos$UNAME_RELEASE+ ;;+ mc68030:UNIX_System_V:4.*:*)+ GUESS=m68k-atari-sysv4+ ;;+ TSUNAMI:LynxOS:2.*:*)+ GUESS=sparc-unknown-lynxos$UNAME_RELEASE+ ;;+ rs6000:LynxOS:2.*:*)+ GUESS=rs6000-unknown-lynxos$UNAME_RELEASE+ ;;+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)+ GUESS=powerpc-unknown-lynxos$UNAME_RELEASE+ ;;+ SM[BE]S:UNIX_SV:*:*)+ GUESS=mips-dde-sysv$UNAME_RELEASE+ ;;+ RM*:ReliantUNIX-*:*:*)+ GUESS=mips-sni-sysv4+ ;;+ RM*:SINIX-*:*:*)+ GUESS=mips-sni-sysv4+ ;;+ *:SINIX-*:*:*)+ if uname -p 2>/dev/null >/dev/null ; then+ UNAME_MACHINE=`(uname -p) 2>/dev/null`+ GUESS=$UNAME_MACHINE-sni-sysv4+ else+ GUESS=ns32k-sni-sysv+ fi+ ;;+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort+ # says <Richard.M.Bartel@ccMail.Census.GOV>+ GUESS=i586-unisys-sysv4+ ;;+ *:UNIX_System_V:4*:FTX*)+ # From Gerald Hewes <hewes@openmarket.com>.+ # How about differentiating between stratus architectures? -djm+ GUESS=hppa1.1-stratus-sysv4+ ;;+ *:*:*:FTX*)+ # From seanf@swdc.stratus.com.+ GUESS=i860-stratus-sysv4+ ;;+ i*86:VOS:*:*)+ # From Paul.Green@stratus.com.+ GUESS=$UNAME_MACHINE-stratus-vos+ ;;+ *:VOS:*:*)+ # From Paul.Green@stratus.com.+ GUESS=hppa1.1-stratus-vos+ ;;+ mc68*:A/UX:*:*)+ GUESS=m68k-apple-aux$UNAME_RELEASE+ ;;+ news*:NEWS-OS:6*:*)+ GUESS=mips-sony-newsos6+ ;;+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)+ if test -d /usr/nec; then+ GUESS=mips-nec-sysv$UNAME_RELEASE+ else+ GUESS=mips-unknown-sysv$UNAME_RELEASE+ fi+ ;;+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.+ GUESS=powerpc-be-beos+ ;;+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.+ GUESS=powerpc-apple-beos+ ;;+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.+ GUESS=i586-pc-beos+ ;;+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.+ GUESS=i586-pc-haiku+ ;;+ ppc:Haiku:*:*) # Haiku running on Apple PowerPC+ GUESS=powerpc-apple-haiku+ ;;+ *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat)+ GUESS=$UNAME_MACHINE-unknown-haiku+ ;;+ SX-4:SUPER-UX:*:*)+ GUESS=sx4-nec-superux$UNAME_RELEASE+ ;;+ SX-5:SUPER-UX:*:*)+ GUESS=sx5-nec-superux$UNAME_RELEASE+ ;;+ SX-6:SUPER-UX:*:*)+ GUESS=sx6-nec-superux$UNAME_RELEASE+ ;;+ SX-7:SUPER-UX:*:*)+ GUESS=sx7-nec-superux$UNAME_RELEASE+ ;;+ SX-8:SUPER-UX:*:*)+ GUESS=sx8-nec-superux$UNAME_RELEASE+ ;;+ SX-8R:SUPER-UX:*:*)+ GUESS=sx8r-nec-superux$UNAME_RELEASE+ ;;+ SX-ACE:SUPER-UX:*:*)+ GUESS=sxace-nec-superux$UNAME_RELEASE+ ;;+ Power*:Rhapsody:*:*)+ GUESS=powerpc-apple-rhapsody$UNAME_RELEASE+ ;;+ *:Rhapsody:*:*)+ GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE+ ;;+ arm64:Darwin:*:*)+ GUESS=aarch64-apple-darwin$UNAME_RELEASE+ ;;+ *:Darwin:*:*)+ UNAME_PROCESSOR=`uname -p`+ case $UNAME_PROCESSOR in+ unknown) UNAME_PROCESSOR=powerpc ;;+ esac+ if command -v xcode-select > /dev/null 2> /dev/null && \+ ! xcode-select --print-path > /dev/null 2> /dev/null ; then+ # Avoid executing cc if there is no toolchain installed as+ # cc will be a stub that puts up a graphical alert+ # prompting the user to install developer tools.+ CC_FOR_BUILD=no_compiler_found+ else+ set_cc_for_build+ fi+ if test "$CC_FOR_BUILD" != no_compiler_found; then+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \+ grep IS_64BIT_ARCH >/dev/null+ then+ case $UNAME_PROCESSOR in+ i386) UNAME_PROCESSOR=x86_64 ;;+ powerpc) UNAME_PROCESSOR=powerpc64 ;;+ esac+ fi+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \+ grep IS_PPC >/dev/null+ then+ UNAME_PROCESSOR=powerpc+ fi+ elif test "$UNAME_PROCESSOR" = i386 ; then+ # uname -m returns i386 or x86_64+ UNAME_PROCESSOR=$UNAME_MACHINE+ fi+ GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE+ ;;+ *:procnto*:*:* | *:QNX:[0123456789]*:*)+ UNAME_PROCESSOR=`uname -p`+ if test "$UNAME_PROCESSOR" = x86; then+ UNAME_PROCESSOR=i386+ UNAME_MACHINE=pc+ fi+ GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE+ ;;+ *:QNX:*:4*)+ GUESS=i386-pc-qnx+ ;;+ NEO-*:NONSTOP_KERNEL:*:*)+ GUESS=neo-tandem-nsk$UNAME_RELEASE+ ;;+ NSE-*:NONSTOP_KERNEL:*:*)+ GUESS=nse-tandem-nsk$UNAME_RELEASE+ ;;+ NSR-*:NONSTOP_KERNEL:*:*)+ GUESS=nsr-tandem-nsk$UNAME_RELEASE+ ;;+ NSV-*:NONSTOP_KERNEL:*:*)+ GUESS=nsv-tandem-nsk$UNAME_RELEASE+ ;;+ NSX-*:NONSTOP_KERNEL:*:*)+ GUESS=nsx-tandem-nsk$UNAME_RELEASE+ ;;+ *:NonStop-UX:*:*)+ GUESS=mips-compaq-nonstopux+ ;;+ BS2000:POSIX*:*:*)+ GUESS=bs2000-siemens-sysv+ ;;+ DS/*:UNIX_System_V:*:*)+ GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE+ ;;+ *:Plan9:*:*)+ # "uname -m" is not consistent, so use $cputype instead. 386+ # is converted to i386 for consistency with other x86+ # operating systems.+ if test "${cputype-}" = 386; then+ UNAME_MACHINE=i386+ elif test "x${cputype-}" != x; then+ UNAME_MACHINE=$cputype+ fi+ GUESS=$UNAME_MACHINE-unknown-plan9+ ;;+ *:TOPS-10:*:*)+ GUESS=pdp10-unknown-tops10+ ;;+ *:TENEX:*:*)+ GUESS=pdp10-unknown-tenex+ ;;+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)+ GUESS=pdp10-dec-tops20+ ;;+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)+ GUESS=pdp10-xkl-tops20+ ;;+ *:TOPS-20:*:*)+ GUESS=pdp10-unknown-tops20+ ;;+ *:ITS:*:*)+ GUESS=pdp10-unknown-its+ ;;+ SEI:*:*:SEIUX)+ GUESS=mips-sei-seiux$UNAME_RELEASE+ ;;+ *:DragonFly:*:*)+ DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`+ GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL+ ;;+ *:*VMS:*:*)+ UNAME_MACHINE=`(uname -p) 2>/dev/null`+ case $UNAME_MACHINE in+ A*) GUESS=alpha-dec-vms ;;+ I*) GUESS=ia64-dec-vms ;;+ V*) GUESS=vax-dec-vms ;;+ esac ;;+ *:XENIX:*:SysV)+ GUESS=i386-pc-xenix+ ;;+ i*86:skyos:*:*)+ SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`+ GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL+ ;;+ i*86:rdos:*:*)+ GUESS=$UNAME_MACHINE-pc-rdos+ ;;+ i*86:Fiwix:*:*)+ GUESS=$UNAME_MACHINE-pc-fiwix+ ;;+ *:AROS:*:*)+ GUESS=$UNAME_MACHINE-unknown-aros+ ;;+ x86_64:VMkernel:*:*)+ GUESS=$UNAME_MACHINE-unknown-esx+ ;;+ amd64:Isilon\ OneFS:*:*)+ GUESS=x86_64-unknown-onefs+ ;;+ *:Unleashed:*:*)+ GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE+ ;;+esac++# Do we have a guess based on uname results?+if test "x$GUESS" != x; then+ echo "$GUESS"+ exit+fi++# No uname command or uname output not recognized.+set_cc_for_build+cat > "$dummy.c" <<EOF+#ifdef _SEQUENT_+#include <sys/types.h>+#include <sys/utsname.h>+#endif+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)+#include <signal.h>+#if defined(_SIZE_T_) || defined(SIGLOST)+#include <sys/utsname.h>+#endif+#endif+#endif+main ()+{+#if defined (sony)+#if defined (MIPSEB)+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,+ I don't know.... */+ printf ("mips-sony-bsd\n"); exit (0);+#else+#include <sys/param.h>+ printf ("m68k-sony-newsos%s\n",+#ifdef NEWSOS4+ "4"+#else+ ""+#endif+ ); exit (0);+#endif+#endif++#if defined (NeXT)+#if !defined (__ARCHITECTURE__)+#define __ARCHITECTURE__ "m68k"+#endif+ int version;+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;+ if (version < 4)+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);+ else+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);+ exit (0);+#endif++#if defined (MULTIMAX) || defined (n16)+#if defined (UMAXV)+ printf ("ns32k-encore-sysv\n"); exit (0);+#else+#if defined (CMU)+ printf ("ns32k-encore-mach\n"); exit (0);+#else+ printf ("ns32k-encore-bsd\n"); exit (0);+#endif+#endif+#endif++#if defined (__386BSD__)+ printf ("i386-pc-bsd\n"); exit (0);+#endif++#if defined (sequent)+#if defined (i386)+ printf ("i386-sequent-dynix\n"); exit (0);+#endif+#if defined (ns32000)+ printf ("ns32k-sequent-dynix\n"); exit (0);+#endif+#endif++#if defined (_SEQUENT_)+ struct utsname un;++ uname(&un);+ if (strncmp(un.version, "V2", 2) == 0) {+ printf ("i386-sequent-ptx2\n"); exit (0);+ }+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */+ printf ("i386-sequent-ptx1\n"); exit (0);+ }+ printf ("i386-sequent-ptx\n"); exit (0);+#endif++#if defined (vax)+#if !defined (ultrix)+#include <sys/param.h>+#if defined (BSD)+#if BSD == 43+ printf ("vax-dec-bsd4.3\n"); exit (0);+#else+#if BSD == 199006+ printf ("vax-dec-bsd4.3reno\n"); exit (0);+#else+ printf ("vax-dec-bsd\n"); exit (0);+#endif+#endif+#else+ printf ("vax-dec-bsd\n"); exit (0);+#endif+#else+#if defined(_SIZE_T_) || defined(SIGLOST)+ struct utsname un;+ uname (&un);+ printf ("vax-dec-ultrix%s\n", un.release); exit (0);+#else+ printf ("vax-dec-ultrix\n"); exit (0);+#endif+#endif+#endif+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)+#if defined(_SIZE_T_) || defined(SIGLOST)+ struct utsname *un;+ uname (&un);+ printf ("mips-dec-ultrix%s\n", un.release); exit (0);+#else+ printf ("mips-dec-ultrix\n"); exit (0);+#endif+#endif+#endif++#if defined (alliant) && defined (i860)+ printf ("i860-alliant-bsd\n"); exit (0);+#endif++ exit (1);+}+EOF++$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&+ { echo "$SYSTEM_NAME"; exit; }++# Apollos put the system type in the environment.+test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }++echo "$0: unable to guess system type" >&2++case $UNAME_MACHINE:$UNAME_SYSTEM in+ mips:Linux | mips64:Linux)+ # If we got here on MIPS GNU/Linux, output extra information.+ cat >&2 <<EOF++NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize+the system type. Please install a C compiler and try again.+EOF+ ;;+esac++cat >&2 <<EOF++This script (version $timestamp), has failed to recognize the+operating system you are using. If your script is old, overwrite *all*+copies of config.guess and config.sub with the latest versions from:++ https://git.savannah.gnu.org/cgit/config.git/plain/config.guess+and+ https://git.savannah.gnu.org/cgit/config.git/plain/config.sub+EOF++our_year=`echo $timestamp | sed 's,-.*,,'`+thisyear=`date +%Y`+# shellcheck disable=SC2003+script_age=`expr "$thisyear" - "$our_year"`+if test "$script_age" -lt 3 ; then+ cat >&2 <<EOF++If $0 has already been updated, send the following data and any+information you think might be pertinent to config-patches@gnu.org to+provide the necessary information to handle your system.++config.guess timestamp = $timestamp++uname -m = `(uname -m) 2>/dev/null || echo unknown`+uname -r = `(uname -r) 2>/dev/null || echo unknown`+uname -s = `(uname -s) 2>/dev/null || echo unknown`+uname -v = `(uname -v) 2>/dev/null || echo unknown`++/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`++hostinfo = `(hostinfo) 2>/dev/null`+/bin/universe = `(/bin/universe) 2>/dev/null`+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`+/bin/arch = `(/bin/arch) 2>/dev/null`+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE"
config.sub view
@@ -1,12 +1,14 @@ #! /bin/sh # Configuration validation subroutine script.-# Copyright 1992-2021 Free Software Foundation, Inc.+# Copyright 1992-2022 Free Software Foundation, Inc. -timestamp='2021-01-08'+# shellcheck disable=SC2006,SC2268 # see below for rationale +timestamp='2022-01-03'+ # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by-# the Free Software Foundation; either version 3 of the License, or+# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but@@ -50,8 +52,15 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -me=$(echo "$0" | sed -e 's,.*/,,')+# The "shellcheck disable" line above the timestamp inhibits complaints+# about features and limitations of the classic Bourne shell that were+# superseded or lifted in POSIX. However, this script identifies a wide+# variety of pre-POSIX systems that do not have POSIX shells at all, and+# even some reasonably current systems (Solaris 10 as case-in-point) still+# have a pre-POSIX /bin/sh. +me=`echo "$0" | sed -e 's,.*/,,'`+ usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS @@ -67,7 +76,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2021 Free Software Foundation, Inc.+Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."@@ -112,9 +121,11 @@ # Split fields of configuration type # shellcheck disable=SC2162+saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <<EOF $1 EOF+IFS=$saved_IFS # Separate into logical components for further validation case $1 in@@ -163,6 +174,10 @@ basic_machine=$field1 basic_os=$field2 ;;+ zephyr*)+ basic_machine=$field1-unknown+ basic_os=$field2+ ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \@@ -769,22 +784,22 @@ vendor=hp ;; i*86v32)- cpu=$(echo "$1" | sed -e 's/86.*/86/')+ cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*)- cpu=$(echo "$1" | sed -e 's/86.*/86/')+ cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v)- cpu=$(echo "$1" | sed -e 's/86.*/86/')+ cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2)- cpu=$(echo "$1" | sed -e 's/86.*/86/')+ cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;;@@ -917,14 +932,16 @@ ;; leon-*|leon[3-9]-*) cpu=sparc- vendor=$(echo "$basic_machine" | sed 's/-.*//')+ vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162+ saved_IFS=$IFS IFS="-" read cpu vendor <<EOF $basic_machine EOF+ IFS=$saved_IFS ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and@@ -1003,6 +1020,11 @@ ;; # Here we normalize CPU types with a missing or matching vendor+ armh-unknown | armh-alt)+ cpu=armv7l+ vendor=alt+ basic_os=${basic_os:-linux-gnueabihf}+ ;; dpx20-unknown | dpx20-bull) cpu=rs6000 vendor=bull@@ -1084,7 +1106,7 @@ cpu=mipsisa64sb1el ;; sh5e[lb]-*)- cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/')+ cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` ;; spur-*) cpu=spur@@ -1102,9 +1124,9 @@ cpu=x86_64 ;; xscale-* | xscalee[bl]-*)- cpu=$(echo "$cpu" | sed 's/^xscale/arm/')+ cpu=`echo "$cpu" | sed 's/^xscale/arm/'` ;;- arm64-*)+ arm64-* | aarch64le-*) cpu=aarch64 ;; @@ -1165,10 +1187,10 @@ | alphapca5[67] | alpha64pca5[67] \ | am33_2.0 \ | amdgcn \- | arc | arceb \+ | arc | arceb | arc32 | arc64 \ | arm | arm[lb]e | arme[lb] | armv* \ | avr | avr32 \- | asmjs \+ | asmjs | javascript \ | ba \ | be32 | be64 \ | bfin | bpf | bs2000 \@@ -1204,9 +1226,13 @@ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \+ | mipsisa32r3 | mipsisa32r3el \+ | mipsisa32r5 | mipsisa32r5el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \+ | mipsisa64r3 | mipsisa64r3el \+ | mipsisa64r5 | mipsisa64r5el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \@@ -1283,35 +1309,37 @@ if test x$basic_os != x then -# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just+# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux- os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|')+ os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2- os=$(echo $basic_os | sed -e 's|os2-emx|emx|')+ os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto- os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|')+ os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) # shellcheck disable=SC2162+ saved_IFS=$IFS IFS="-" read kernel os <<EOF $basic_os EOF+ IFS=$saved_IFS ;; # Default OS when just kernel was specified nto*) kernel=nto- os=$(echo $basic_os | sed -e 's|nto|qnx|')+ os=`echo "$basic_os" | sed -e 's|nto|qnx|'` ;; linux*) kernel=linux- os=$(echo $basic_os | sed -e 's|linux|gnu|')+ os=`echo "$basic_os" | sed -e 's|linux|gnu|'` ;; *) kernel=@@ -1332,7 +1360,7 @@ os=cnk ;; solaris1 | solaris1.*)- os=$(echo $os | sed -e 's|solaris1|sunos4|')+ os=`echo "$os" | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2@@ -1361,7 +1389,7 @@ os=sco3.2v4 ;; sco3.2.[4-9]*)- os=$(echo $os | sed -e 's/sco3.2./sco3.2v/')+ os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` ;; sco*v* | scout) # Don't match below@@ -1391,7 +1419,7 @@ os=lynxos ;; mac[0-9]*)- os=$(echo "$os" | sed -e 's|mac|macos|')+ os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition@@ -1400,10 +1428,10 @@ os=os400 ;; sunos5*)- os=$(echo "$os" | sed -e 's|sunos5|solaris2|')+ os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*)- os=$(echo "$os" | sed -e 's|sunos6|solaris3|')+ os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince@@ -1437,7 +1465,7 @@ ;; # Preserve the version number of sinix5. sinix5.*)- os=$(echo $os | sed -e 's|sinix|sysv|')+ os=`echo "$os" | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4@@ -1683,8 +1711,12 @@ # Now, validate our (potentially fixed-up) OS. case $os in- # Sometimes we do "kernel-libc", so those need to count as OSes.- musl* | newlib* | uclibc*)+ # GHC specific: added for JS backend support+ js | ghcjs)+ ;;++ # Sometimes we do "kernel-abi", so those need to count as OSes.+ musl* | newlib* | relibc* | uclibc*) ;; # Likewise for "kernel-abi" eabi* | gnueabi*)@@ -1707,12 +1739,12 @@ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | mirbsd* | netbsd* | dicos* | openedition* | ose* \- | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \+ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | lites* | ieee* | go32* | aux* | hcos* \- | chorusrdb* | cegcc* | glidix* \+ | chorusrdb* | cegcc* | glidix* | serenity* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | mint* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \@@ -1725,7 +1757,8 @@ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \+ | fiwix* ) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*)@@ -1742,11 +1775,12 @@ # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in- linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )+ linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \+ | linux-musl* | linux-relibc* | linux-uclibc* ) ;; uclinux-uclibc* ) ;;- -dietlibc* | -newlib* | -musl* | -uclibc* )+ -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
configure view
@@ -1,6417 +1,8031 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles.-# Generated by GNU Autoconf 2.69 for Haskell unix package 2.0.-#-# Report bugs to <libraries@haskell.org>.-#-#-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.-#-#-# This configure script is free software; the Free Software Foundation-# gives unlimited permission to copy, distribute and modify it.-## -------------------- ##-## M4sh Initialization. ##-## -------------------- ##--# Be more Bourne compatible-DUALCASE=1; export DUALCASE # for MKS sh-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :- emulate sh- NULLCMD=:- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which- # is contrary to our usage. Disable this feature.- alias -g '${1+"$@"}'='"$@"'- setopt NO_GLOB_SUBST-else- case `(set -o) 2>/dev/null` in #(- *posix*) :- set -o posix ;; #(- *) :- ;;-esac-fi---as_nl='-'-export as_nl-# Printing a long string crashes Solaris 7 /usr/bin/printf.-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo-# Prefer a ksh shell builtin over an external printf program on Solaris,-# but without wasting forks for bash or zsh.-if test -z "$BASH_VERSION$ZSH_VERSION" \- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then- as_echo='print -r --'- as_echo_n='print -rn --'-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then- as_echo='printf %s\n'- as_echo_n='printf %s'-else- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'- as_echo_n='/usr/ucb/echo -n'- else- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'- as_echo_n_body='eval- arg=$1;- case $arg in #(- *"$as_nl"*)- expr "X$arg" : "X\\(.*\\)$as_nl";- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;- esac;- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"- '- export as_echo_n_body- as_echo_n='sh -c $as_echo_n_body as_echo'- fi- export as_echo_body- as_echo='sh -c $as_echo_body as_echo'-fi--# The user is always right.-if test "${PATH_SEPARATOR+set}" != set; then- PATH_SEPARATOR=:- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||- PATH_SEPARATOR=';'- }-fi---# IFS-# We need space, tab and new line, in precisely that order. Quoting is-# there to prevent editors from complaining about space-tab.-# (If _AS_PATH_WALK were called with IFS unset, it would disable word-# splitting by setting IFS to empty value.)-IFS=" "" $as_nl"--# Find who we are. Look in the path if we contain no directory separator.-as_myself=-case $0 in #((- *[\\/]* ) as_myself=$0 ;;- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break- done-IFS=$as_save_IFS-- ;;-esac-# We did not find ourselves, most probably we were run as `sh COMMAND'-# in which case we are not to be found in the path.-if test "x$as_myself" = x; then- as_myself=$0-fi-if test ! -f "$as_myself"; then- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2- exit 1-fi--# Unset variables that we do not need and which cause bugs (e.g. in-# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"-# suppresses any "Segmentation fault" message there. '((' could-# trigger a bug in pdksh 5.2.14.-for as_var in BASH_ENV ENV MAIL MAILPATH-do eval test x\${$as_var+set} = xset \- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :-done-PS1='$ '-PS2='> '-PS4='+ '--# NLS nuisances.-LC_ALL=C-export LC_ALL-LANGUAGE=C-export LANGUAGE--# CDPATH.-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH--# Use a proper internal environment variable to ensure we don't fall- # into an infinite loop, continuously re-executing ourselves.- if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then- _as_can_reexec=no; export _as_can_reexec;- # We cannot yet assume a decent shell, so we have to provide a-# neutralization value for shells without unset; and this also-# works around shells that cannot unset nonexistent variables.-# Preserve -v and -x to the replacement shell.-BASH_ENV=/dev/null-ENV=/dev/null-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV-case $- in # ((((- *v*x* | *x*v* ) as_opts=-vx ;;- *v* ) as_opts=-v ;;- *x* ) as_opts=-x ;;- * ) as_opts= ;;-esac-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}-# Admittedly, this is quite paranoid, since all the known shells bail-# out after a failed `exec'.-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2-as_fn_exit 255- fi- # We don't want this to propagate to other subprocesses.- { _as_can_reexec=; unset _as_can_reexec;}-if test "x$CONFIG_SHELL" = x; then- as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :- emulate sh- NULLCMD=:- # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which- # is contrary to our usage. Disable this feature.- alias -g '\${1+\"\$@\"}'='\"\$@\"'- setopt NO_GLOB_SUBST-else- case \`(set -o) 2>/dev/null\` in #(- *posix*) :- set -o posix ;; #(- *) :- ;;-esac-fi-"- as_required="as_fn_return () { (exit \$1); }-as_fn_success () { as_fn_return 0; }-as_fn_failure () { as_fn_return 1; }-as_fn_ret_success () { return 0; }-as_fn_ret_failure () { return 1; }--exitcode=0-as_fn_success || { exitcode=1; echo as_fn_success failed.; }-as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }-as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }-as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }-if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :--else- exitcode=1; echo positional parameters were not saved.-fi-test x\$exitcode = x0 || exit 1-test -x / || exit 1"- as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO- as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO- eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&- test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1-test \$(( 1 + 1 )) = 2 || exit 1"- if (eval "$as_required") 2>/dev/null; then :- as_have_required=yes-else- as_have_required=no-fi- if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :--else- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-as_found=false-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- as_found=:- case $as_dir in #(- /*)- for as_base in sh bash ksh sh5; do- # Try only shells that exist, to save several forks.- as_shell=$as_dir/$as_base- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :- CONFIG_SHELL=$as_shell as_have_required=yes- if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :- break 2-fi-fi- done;;- esac- as_found=false-done-$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :- CONFIG_SHELL=$SHELL as_have_required=yes-fi; }-IFS=$as_save_IFS--- if test "x$CONFIG_SHELL" != x; then :- export CONFIG_SHELL- # We cannot yet assume a decent shell, so we have to provide a-# neutralization value for shells without unset; and this also-# works around shells that cannot unset nonexistent variables.-# Preserve -v and -x to the replacement shell.-BASH_ENV=/dev/null-ENV=/dev/null-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV-case $- in # ((((- *v*x* | *x*v* ) as_opts=-vx ;;- *v* ) as_opts=-v ;;- *x* ) as_opts=-x ;;- * ) as_opts= ;;-esac-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}-# Admittedly, this is quite paranoid, since all the known shells bail-# out after a failed `exec'.-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2-exit 255-fi-- if test x$as_have_required = xno; then :- $as_echo "$0: This script requires a shell more modern than all"- $as_echo "$0: the shells that I found on your system."- if test x${ZSH_VERSION+set} = xset ; then- $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"- $as_echo "$0: be upgraded to zsh 4.3.4 or later."- else- $as_echo "$0: Please tell bug-autoconf@gnu.org and-$0: libraries@haskell.org about your system, including any-$0: error possibly output before this message. Then install-$0: a modern shell, or manually run the script under such a-$0: shell if you do have one."- fi- exit 1-fi-fi-fi-SHELL=${CONFIG_SHELL-/bin/sh}-export SHELL-# Unset more variables known to interfere with behavior of common tools.-CLICOLOR_FORCE= GREP_OPTIONS=-unset CLICOLOR_FORCE GREP_OPTIONS--## --------------------- ##-## M4sh Shell Functions. ##-## --------------------- ##-# as_fn_unset VAR-# ----------------# Portably unset VAR.-as_fn_unset ()-{- { eval $1=; unset $1;}-}-as_unset=as_fn_unset--# as_fn_set_status STATUS-# ------------------------# Set $? to STATUS, without forking.-as_fn_set_status ()-{- return $1-} # as_fn_set_status--# as_fn_exit STATUS-# ------------------# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.-as_fn_exit ()-{- set +e- as_fn_set_status $1- exit $1-} # as_fn_exit--# as_fn_mkdir_p-# --------------# Create "$as_dir" as a directory, including parents if necessary.-as_fn_mkdir_p ()-{-- case $as_dir in #(- -*) as_dir=./$as_dir;;- esac- test -d "$as_dir" || eval $as_mkdir_p || {- as_dirs=- while :; do- case $as_dir in #(- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(- *) as_qdir=$as_dir;;- esac- as_dirs="'$as_qdir' $as_dirs"- as_dir=`$as_dirname -- "$as_dir" ||-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \- X"$as_dir" : 'X\(//\)[^/]' \| \- X"$as_dir" : 'X\(//\)$' \| \- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||-$as_echo X"$as_dir" |- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{- s//\1/- q- }- /^X\(\/\/\)[^/].*/{- s//\1/- q- }- /^X\(\/\/\)$/{- s//\1/- q- }- /^X\(\/\).*/{- s//\1/- q- }- s/.*/./; q'`- test -d "$as_dir" && break- done- test -z "$as_dirs" || eval "mkdir $as_dirs"- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"---} # as_fn_mkdir_p--# as_fn_executable_p FILE-# ------------------------# Test if FILE is an executable regular file.-as_fn_executable_p ()-{- test -f "$1" && test -x "$1"-} # as_fn_executable_p-# as_fn_append VAR VALUE-# -----------------------# Append the text in VALUE to the end of the definition contained in VAR. Take-# advantage of any shell optimizations that allow amortized linear growth over-# repeated appends, instead of the typical quadratic growth present in naive-# implementations.-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :- eval 'as_fn_append ()- {- eval $1+=\$2- }'-else- as_fn_append ()- {- eval $1=\$$1\$2- }-fi # as_fn_append--# as_fn_arith ARG...-# -------------------# Perform arithmetic evaluation on the ARGs, and store the result in the-# global $as_val. Take advantage of shells that can avoid forks. The arguments-# must be portable across $(()) and expr.-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :- eval 'as_fn_arith ()- {- as_val=$(( $* ))- }'-else- as_fn_arith ()- {- as_val=`expr "$@" || test $? -eq 1`- }-fi # as_fn_arith---# as_fn_error STATUS ERROR [LINENO LOG_FD]-# -----------------------------------------# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the-# script with STATUS, using 1 if that was 0.-as_fn_error ()-{- as_status=$1; test $as_status -eq 0 && as_status=1- if test "$4"; then- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4- fi- $as_echo "$as_me: error: $2" >&2- as_fn_exit $as_status-} # as_fn_error--if expr a : '\(a\)' >/dev/null 2>&1 &&- test "X`expr 00001 : '.*\(...\)'`" = X001; then- as_expr=expr-else- as_expr=false-fi--if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then- as_basename=basename-else- as_basename=false-fi--if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then- as_dirname=dirname-else- as_dirname=false-fi--as_me=`$as_basename -- "$0" ||-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \- X"$0" : 'X\(//\)$' \| \- X"$0" : 'X\(/\)' \| . 2>/dev/null ||-$as_echo X/"$0" |- sed '/^.*\/\([^/][^/]*\)\/*$/{- s//\1/- q- }- /^X\/\(\/\/\)$/{- s//\1/- q- }- /^X\/\(\/\).*/{- s//\1/- q- }- s/.*/./; q'`--# Avoid depending upon Character Ranges.-as_cr_letters='abcdefghijklmnopqrstuvwxyz'-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'-as_cr_Letters=$as_cr_letters$as_cr_LETTERS-as_cr_digits='0123456789'-as_cr_alnum=$as_cr_Letters$as_cr_digits--- as_lineno_1=$LINENO as_lineno_1a=$LINENO- as_lineno_2=$LINENO as_lineno_2a=$LINENO- eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&- test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {- # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)- sed -n '- p- /[$]LINENO/=- ' <$as_myself |- sed '- s/[$]LINENO.*/&-/- t lineno- b- :lineno- N- :loop- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/- t loop- s/-\n.*//- ' >$as_me.lineno &&- chmod +x "$as_me.lineno" ||- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }-- # If we had to re-execute with $CONFIG_SHELL, we're ensured to have- # already done that, so ensure we don't try to do so again and fall- # in an infinite loop. This has already happened in practice.- _as_can_reexec=no; export _as_can_reexec- # Don't try to exec as it changes $[0], causing all sort of problems- # (the dirname of $[0] is not the place where we might find the- # original and so on. Autoconf is especially sensitive to this).- . "./$as_me.lineno"- # Exit status is that of the last command.- exit-}--ECHO_C= ECHO_N= ECHO_T=-case `echo -n x` in #(((((--n*)- case `echo 'xy\c'` in- *c*) ECHO_T=' ';; # ECHO_T is single tab character.- xy) ECHO_C='\c';;- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null- ECHO_T=' ';;- esac;;-*)- ECHO_N='-n';;-esac--rm -f conf$$ conf$$.exe conf$$.file-if test -d conf$$.dir; then- rm -f conf$$.dir/conf$$.file-else- rm -f conf$$.dir- mkdir conf$$.dir 2>/dev/null-fi-if (echo >conf$$.file) 2>/dev/null; then- if ln -s conf$$.file conf$$ 2>/dev/null; then- as_ln_s='ln -s'- # ... but there are two gotchas:- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.- # In both cases, we have to default to `cp -pR'.- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||- as_ln_s='cp -pR'- elif ln conf$$.file conf$$ 2>/dev/null; then- as_ln_s=ln- else- as_ln_s='cp -pR'- fi-else- as_ln_s='cp -pR'-fi-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file-rmdir conf$$.dir 2>/dev/null--if mkdir -p . 2>/dev/null; then- as_mkdir_p='mkdir -p "$as_dir"'-else- test -d ./-p && rmdir ./-p- as_mkdir_p=false-fi--as_test_x='test -x'-as_executable_p=as_fn_executable_p--# Sed expression to map a string onto a valid CPP name.-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"--# Sed expression to map a string onto a valid variable name.-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"---test -n "$DJDIR" || exec 7<&0 </dev/null-exec 6>&1--# Name of the host.-# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,-# so uname gets run too.-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`--#-# Initializations.-#-ac_default_prefix=/usr/local-ac_clean_files=-ac_config_libobj_dir=.-LIBOBJS=-cross_compiling=no-subdirs=-MFLAGS=-MAKEFLAGS=--# Identity of this package.-PACKAGE_NAME='Haskell unix package'-PACKAGE_TARNAME='unix'-PACKAGE_VERSION='2.0'-PACKAGE_STRING='Haskell unix package 2.0'-PACKAGE_BUGREPORT='libraries@haskell.org'-PACKAGE_URL=''--ac_unique_file="include/HsUnix.h"-# Factoring default headers for most tests.-ac_includes_default="\-#include <stdio.h>-#ifdef HAVE_SYS_TYPES_H-# include <sys/types.h>-#endif-#ifdef HAVE_SYS_STAT_H-# include <sys/stat.h>-#endif-#ifdef STDC_HEADERS-# include <stdlib.h>-# include <stddef.h>-#else-# ifdef HAVE_STDLIB_H-# include <stdlib.h>-# endif-#endif-#ifdef HAVE_STRING_H-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H-# include <memory.h>-# endif-# include <string.h>-#endif-#ifdef HAVE_STRINGS_H-# include <strings.h>-#endif-#ifdef HAVE_INTTYPES_H-# include <inttypes.h>-#endif-#ifdef HAVE_STDINT_H-# include <stdint.h>-#endif-#ifdef HAVE_UNISTD_H-# include <unistd.h>-#endif"--ac_subst_vars='LTLIBOBJS-LIBOBJS-EXTRA_LIBS-target_os-target_vendor-target_cpu-target-host_os-host_vendor-host_cpu-host-build_os-build_vendor-build_cpu-build-BUILD_PACKAGE_BOOL-EGREP-GREP-CPP-OBJEXT-EXEEXT-ac_ct_CC-CPPFLAGS-LDFLAGS-CFLAGS-CC-target_alias-host_alias-build_alias-LIBS-ECHO_T-ECHO_N-ECHO_C-DEFS-mandir-localedir-libdir-psdir-pdfdir-dvidir-htmldir-infodir-docdir-oldincludedir-includedir-runstatedir-localstatedir-sharedstatedir-sysconfdir-datadir-datarootdir-libexecdir-sbindir-bindir-program_transform_name-prefix-exec_prefix-PACKAGE_URL-PACKAGE_BUGREPORT-PACKAGE_STRING-PACKAGE_VERSION-PACKAGE_TARNAME-PACKAGE_NAME-PATH_SEPARATOR-SHELL'-ac_subst_files=''-ac_user_opts='-enable_option_checking-enable_largefile-'- ac_precious_vars='build_alias-host_alias-target_alias-CC-CFLAGS-LDFLAGS-LIBS-CPPFLAGS-CPP'---# Initialize some variables set by options.-ac_init_help=-ac_init_version=false-ac_unrecognized_opts=-ac_unrecognized_sep=-# The variables have the same names as the options, with-# dashes changed to underlines.-cache_file=/dev/null-exec_prefix=NONE-no_create=-no_recursion=-prefix=NONE-program_prefix=NONE-program_suffix=NONE-program_transform_name=s,x,x,-silent=-site=-srcdir=-verbose=-x_includes=NONE-x_libraries=NONE--# Installation directory options.-# These are left unexpanded so users can "make install exec_prefix=/foo"-# and all the variables that are supposed to be based on exec_prefix-# by default will actually change.-# Use braces instead of parens because sh, perl, etc. also accept them.-# (The list follows the same order as the GNU Coding Standards.)-bindir='${exec_prefix}/bin'-sbindir='${exec_prefix}/sbin'-libexecdir='${exec_prefix}/libexec'-datarootdir='${prefix}/share'-datadir='${datarootdir}'-sysconfdir='${prefix}/etc'-sharedstatedir='${prefix}/com'-localstatedir='${prefix}/var'-runstatedir='${localstatedir}/run'-includedir='${prefix}/include'-oldincludedir='/usr/include'-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'-infodir='${datarootdir}/info'-htmldir='${docdir}'-dvidir='${docdir}'-pdfdir='${docdir}'-psdir='${docdir}'-libdir='${exec_prefix}/lib'-localedir='${datarootdir}/locale'-mandir='${datarootdir}/man'--ac_prev=-ac_dashdash=-for ac_option-do- # If the previous option needs an argument, assign it.- if test -n "$ac_prev"; then- eval $ac_prev=\$ac_option- ac_prev=- continue- fi-- case $ac_option in- *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;- *=) ac_optarg= ;;- *) ac_optarg=yes ;;- esac-- # Accept the important Cygnus configure options, so we can diagnose typos.-- case $ac_dashdash$ac_option in- --)- ac_dashdash=yes ;;-- -bindir | --bindir | --bindi | --bind | --bin | --bi)- ac_prev=bindir ;;- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)- bindir=$ac_optarg ;;-- -build | --build | --buil | --bui | --bu)- ac_prev=build_alias ;;- -build=* | --build=* | --buil=* | --bui=* | --bu=*)- build_alias=$ac_optarg ;;-- -cache-file | --cache-file | --cache-fil | --cache-fi \- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)- ac_prev=cache_file ;;- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)- cache_file=$ac_optarg ;;-- --config-cache | -C)- cache_file=config.cache ;;-- -datadir | --datadir | --datadi | --datad)- ac_prev=datadir ;;- -datadir=* | --datadir=* | --datadi=* | --datad=*)- datadir=$ac_optarg ;;-- -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \- | --dataroo | --dataro | --datar)- ac_prev=datarootdir ;;- -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \- | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)- datarootdir=$ac_optarg ;;-- -disable-* | --disable-*)- ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`- # Reject names that are not valid shell variable names.- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&- as_fn_error $? "invalid feature name: $ac_useropt"- ac_useropt_orig=$ac_useropt- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`- case $ac_user_opts in- *"-"enable_$ac_useropt"-"*) ;;- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"- ac_unrecognized_sep=', ';;- esac- eval enable_$ac_useropt=no ;;-- -docdir | --docdir | --docdi | --doc | --do)- ac_prev=docdir ;;- -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)- docdir=$ac_optarg ;;-- -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)- ac_prev=dvidir ;;- -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)- dvidir=$ac_optarg ;;-- -enable-* | --enable-*)- ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`- # Reject names that are not valid shell variable names.- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&- as_fn_error $? "invalid feature name: $ac_useropt"- ac_useropt_orig=$ac_useropt- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`- case $ac_user_opts in- *"-"enable_$ac_useropt"-"*) ;;- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"- ac_unrecognized_sep=', ';;- esac- eval enable_$ac_useropt=\$ac_optarg ;;-- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \- | --exec | --exe | --ex)- ac_prev=exec_prefix ;;- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \- | --exec=* | --exe=* | --ex=*)- exec_prefix=$ac_optarg ;;-- -gas | --gas | --ga | --g)- # Obsolete; use --with-gas.- with_gas=yes ;;-- -help | --help | --hel | --he | -h)- ac_init_help=long ;;- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)- ac_init_help=recursive ;;- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)- ac_init_help=short ;;-- -host | --host | --hos | --ho)- ac_prev=host_alias ;;- -host=* | --host=* | --hos=* | --ho=*)- host_alias=$ac_optarg ;;-- -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)- ac_prev=htmldir ;;- -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \- | --ht=*)- htmldir=$ac_optarg ;;-- -includedir | --includedir | --includedi | --included | --include \- | --includ | --inclu | --incl | --inc)- ac_prev=includedir ;;- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \- | --includ=* | --inclu=* | --incl=* | --inc=*)- includedir=$ac_optarg ;;-- -infodir | --infodir | --infodi | --infod | --info | --inf)- ac_prev=infodir ;;- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)- infodir=$ac_optarg ;;-- -libdir | --libdir | --libdi | --libd)- ac_prev=libdir ;;- -libdir=* | --libdir=* | --libdi=* | --libd=*)- libdir=$ac_optarg ;;-- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \- | --libexe | --libex | --libe)- ac_prev=libexecdir ;;- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \- | --libexe=* | --libex=* | --libe=*)- libexecdir=$ac_optarg ;;-- -localedir | --localedir | --localedi | --localed | --locale)- ac_prev=localedir ;;- -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)- localedir=$ac_optarg ;;-- -localstatedir | --localstatedir | --localstatedi | --localstated \- | --localstate | --localstat | --localsta | --localst | --locals)- ac_prev=localstatedir ;;- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \- | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)- localstatedir=$ac_optarg ;;-- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)- ac_prev=mandir ;;- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)- mandir=$ac_optarg ;;-- -nfp | --nfp | --nf)- # Obsolete; use --without-fp.- with_fp=no ;;-- -no-create | --no-create | --no-creat | --no-crea | --no-cre \- | --no-cr | --no-c | -n)- no_create=yes ;;-- -no-recursion | --no-recursion | --no-recursio | --no-recursi \- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)- no_recursion=yes ;;-- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \- | --oldin | --oldi | --old | --ol | --o)- ac_prev=oldincludedir ;;- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)- oldincludedir=$ac_optarg ;;-- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)- ac_prev=prefix ;;- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)- prefix=$ac_optarg ;;-- -program-prefix | --program-prefix | --program-prefi | --program-pref \- | --program-pre | --program-pr | --program-p)- ac_prev=program_prefix ;;- -program-prefix=* | --program-prefix=* | --program-prefi=* \- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)- program_prefix=$ac_optarg ;;-- -program-suffix | --program-suffix | --program-suffi | --program-suff \- | --program-suf | --program-su | --program-s)- ac_prev=program_suffix ;;- -program-suffix=* | --program-suffix=* | --program-suffi=* \- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)- program_suffix=$ac_optarg ;;-- -program-transform-name | --program-transform-name \- | --program-transform-nam | --program-transform-na \- | --program-transform-n | --program-transform- \- | --program-transform | --program-transfor \- | --program-transfo | --program-transf \- | --program-trans | --program-tran \- | --progr-tra | --program-tr | --program-t)- ac_prev=program_transform_name ;;- -program-transform-name=* | --program-transform-name=* \- | --program-transform-nam=* | --program-transform-na=* \- | --program-transform-n=* | --program-transform-=* \- | --program-transform=* | --program-transfor=* \- | --program-transfo=* | --program-transf=* \- | --program-trans=* | --program-tran=* \- | --progr-tra=* | --program-tr=* | --program-t=*)- program_transform_name=$ac_optarg ;;-- -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)- ac_prev=pdfdir ;;- -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)- pdfdir=$ac_optarg ;;-- -psdir | --psdir | --psdi | --psd | --ps)- ac_prev=psdir ;;- -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)- psdir=$ac_optarg ;;-- -q | -quiet | --quiet | --quie | --qui | --qu | --q \- | -silent | --silent | --silen | --sile | --sil)- silent=yes ;;-- -runstatedir | --runstatedir | --runstatedi | --runstated \- | --runstate | --runstat | --runsta | --runst | --runs \- | --run | --ru | --r)- ac_prev=runstatedir ;;- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \- | --run=* | --ru=* | --r=*)- runstatedir=$ac_optarg ;;-- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)- ac_prev=sbindir ;;- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \- | --sbi=* | --sb=*)- sbindir=$ac_optarg ;;-- -sharedstatedir | --sharedstatedir | --sharedstatedi \- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \- | --sharedst | --shareds | --shared | --share | --shar \- | --sha | --sh)- ac_prev=sharedstatedir ;;- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \- | --sha=* | --sh=*)- sharedstatedir=$ac_optarg ;;-- -site | --site | --sit)- ac_prev=site ;;- -site=* | --site=* | --sit=*)- site=$ac_optarg ;;-- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)- ac_prev=srcdir ;;- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)- srcdir=$ac_optarg ;;-- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \- | --syscon | --sysco | --sysc | --sys | --sy)- ac_prev=sysconfdir ;;- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)- sysconfdir=$ac_optarg ;;-- -target | --target | --targe | --targ | --tar | --ta | --t)- ac_prev=target_alias ;;- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)- target_alias=$ac_optarg ;;-- -v | -verbose | --verbose | --verbos | --verbo | --verb)- verbose=yes ;;-- -version | --version | --versio | --versi | --vers | -V)- ac_init_version=: ;;-- -with-* | --with-*)- ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`- # Reject names that are not valid shell variable names.- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&- as_fn_error $? "invalid package name: $ac_useropt"- ac_useropt_orig=$ac_useropt- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`- case $ac_user_opts in- *"-"with_$ac_useropt"-"*) ;;- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"- ac_unrecognized_sep=', ';;- esac- eval with_$ac_useropt=\$ac_optarg ;;-- -without-* | --without-*)- ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`- # Reject names that are not valid shell variable names.- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&- as_fn_error $? "invalid package name: $ac_useropt"- ac_useropt_orig=$ac_useropt- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`- case $ac_user_opts in- *"-"with_$ac_useropt"-"*) ;;- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"- ac_unrecognized_sep=', ';;- esac- eval with_$ac_useropt=no ;;-- --x)- # Obsolete; use --with-x.- with_x=yes ;;-- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \- | --x-incl | --x-inc | --x-in | --x-i)- ac_prev=x_includes ;;- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)- x_includes=$ac_optarg ;;-- -x-libraries | --x-libraries | --x-librarie | --x-librari \- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)- ac_prev=x_libraries ;;- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)- x_libraries=$ac_optarg ;;-- -*) as_fn_error $? "unrecognized option: \`$ac_option'-Try \`$0 --help' for more information"- ;;-- *=*)- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`- # Reject names that are not valid shell variable names.- case $ac_envvar in #(- '' | [0-9]* | *[!_$as_cr_alnum]* )- as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;- esac- eval $ac_envvar=\$ac_optarg- export $ac_envvar ;;-- *)- # FIXME: should be removed in autoconf 3.0.- $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&- $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2- : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"- ;;-- esac-done--if test -n "$ac_prev"; then- ac_option=--`echo $ac_prev | sed 's/_/-/g'`- as_fn_error $? "missing argument to $ac_option"-fi--if test -n "$ac_unrecognized_opts"; then- case $enable_option_checking in- no) ;;- fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;- *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;- esac-fi--# Check all directory arguments for consistency.-for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \- datadir sysconfdir sharedstatedir localstatedir includedir \- oldincludedir docdir infodir htmldir dvidir pdfdir psdir \- libdir localedir mandir runstatedir-do- eval ac_val=\$$ac_var- # Remove trailing slashes.- case $ac_val in- */ )- ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`- eval $ac_var=\$ac_val;;- esac- # Be sure to have absolute directory names.- case $ac_val in- [\\/$]* | ?:[\\/]* ) continue;;- NONE | '' ) case $ac_var in *prefix ) continue;; esac;;- esac- as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"-done--# There might be people who depend on the old broken behavior: `$host'-# used to hold the argument of --host etc.-# FIXME: To remove some day.-build=$build_alias-host=$host_alias-target=$target_alias--# FIXME: To remove some day.-if test "x$host_alias" != x; then- if test "x$build_alias" = x; then- cross_compiling=maybe- elif test "x$build_alias" != "x$host_alias"; then- cross_compiling=yes- fi-fi--ac_tool_prefix=-test -n "$host_alias" && ac_tool_prefix=$host_alias---test "$silent" = yes && exec 6>/dev/null---ac_pwd=`pwd` && test -n "$ac_pwd" &&-ac_ls_di=`ls -di .` &&-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||- as_fn_error $? "working directory cannot be determined"-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||- as_fn_error $? "pwd does not report name of working directory"---# Find the source files, if location was not specified.-if test -z "$srcdir"; then- ac_srcdir_defaulted=yes- # Try the directory containing this script, then the parent directory.- ac_confdir=`$as_dirname -- "$as_myself" ||-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \- X"$as_myself" : 'X\(//\)[^/]' \| \- X"$as_myself" : 'X\(//\)$' \| \- X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||-$as_echo X"$as_myself" |- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{- s//\1/- q- }- /^X\(\/\/\)[^/].*/{- s//\1/- q- }- /^X\(\/\/\)$/{- s//\1/- q- }- /^X\(\/\).*/{- s//\1/- q- }- s/.*/./; q'`- srcdir=$ac_confdir- if test ! -r "$srcdir/$ac_unique_file"; then- srcdir=..- fi-else- ac_srcdir_defaulted=no-fi-if test ! -r "$srcdir/$ac_unique_file"; then- test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."- as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"-fi-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"-ac_abs_confdir=`(- cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"- pwd)`-# When building in place, set srcdir=.-if test "$ac_abs_confdir" = "$ac_pwd"; then- srcdir=.-fi-# Remove unnecessary trailing slashes from srcdir.-# Double slashes in file names in object file debugging info-# mess up M-x gdb in Emacs.-case $srcdir in-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;-esac-for ac_var in $ac_precious_vars; do- eval ac_env_${ac_var}_set=\${${ac_var}+set}- eval ac_env_${ac_var}_value=\$${ac_var}- eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}- eval ac_cv_env_${ac_var}_value=\$${ac_var}-done--#-# Report the --help message.-#-if test "$ac_init_help" = "long"; then- # Omit some internal or obsolete options to make the list less imposing.- # This message is too long to be a string in the A/UX 3.1 sh.- cat <<_ACEOF-\`configure' configures Haskell unix package 2.0 to adapt to many kinds of systems.--Usage: $0 [OPTION]... [VAR=VALUE]...--To assign environment variables (e.g., CC, CFLAGS...), specify them as-VAR=VALUE. See below for descriptions of some of the useful variables.--Defaults for the options are specified in brackets.--Configuration:- -h, --help display this help and exit- --help=short display options specific to this package- --help=recursive display the short help of all the included packages- -V, --version display version information and exit- -q, --quiet, --silent do not print \`checking ...' messages- --cache-file=FILE cache test results in FILE [disabled]- -C, --config-cache alias for \`--cache-file=config.cache'- -n, --no-create do not create output files- --srcdir=DIR find the sources in DIR [configure dir or \`..']--Installation directories:- --prefix=PREFIX install architecture-independent files in PREFIX- [$ac_default_prefix]- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX- [PREFIX]--By default, \`make install' will install all the files in-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify-an installation prefix other than \`$ac_default_prefix' using \`--prefix',-for instance \`--prefix=\$HOME'.--For better control, use the options below.--Fine tuning of the installation directories:- --bindir=DIR user executables [EPREFIX/bin]- --sbindir=DIR system admin executables [EPREFIX/sbin]- --libexecdir=DIR program executables [EPREFIX/libexec]- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]- --localstatedir=DIR modifiable single-machine data [PREFIX/var]- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]- --libdir=DIR object code libraries [EPREFIX/lib]- --includedir=DIR C header files [PREFIX/include]- --oldincludedir=DIR C header files for non-gcc [/usr/include]- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]- --infodir=DIR info documentation [DATAROOTDIR/info]- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]- --mandir=DIR man documentation [DATAROOTDIR/man]- --docdir=DIR documentation root [DATAROOTDIR/doc/unix]- --htmldir=DIR html documentation [DOCDIR]- --dvidir=DIR dvi documentation [DOCDIR]- --pdfdir=DIR pdf documentation [DOCDIR]- --psdir=DIR ps documentation [DOCDIR]-_ACEOF-- cat <<\_ACEOF--System types:- --build=BUILD configure for building on BUILD [guessed]- --host=HOST cross-compile to build programs to run on HOST [BUILD]- --target=TARGET configure for building compilers for TARGET [HOST]-_ACEOF-fi--if test -n "$ac_init_help"; then- case $ac_init_help in- short | recursive ) echo "Configuration of Haskell unix package 2.0:";;- esac- cat <<\_ACEOF--Optional Features:- --disable-option-checking ignore unrecognized --enable/--with options- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]- --disable-largefile omit support for large files--Some influential environment variables:- CC C compiler command- CFLAGS C compiler flags- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a- nonstandard directory <lib dir>- LIBS libraries to pass to the linker, e.g. -l<library>- CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if- you have headers in a nonstandard directory <include dir>- CPP C preprocessor--Use these variables to override the choices made by `configure' or to help-it to find libraries and programs with nonstandard names/locations.--Report bugs to <libraries@haskell.org>.-_ACEOF-ac_status=$?-fi--if test "$ac_init_help" = "recursive"; then- # If there are subdirs, report their specific --help.- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue- test -d "$ac_dir" ||- { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||- continue- ac_builddir=.--case "$ac_dir" in-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;-*)- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`- # A ".." for each directory in $ac_dir_suffix.- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`- case $ac_top_builddir_sub in- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;- esac ;;-esac-ac_abs_top_builddir=$ac_pwd-ac_abs_builddir=$ac_pwd$ac_dir_suffix-# for backward compatibility:-ac_top_builddir=$ac_top_build_prefix--case $srcdir in- .) # We are building in place.- ac_srcdir=.- ac_top_srcdir=$ac_top_builddir_sub- ac_abs_top_srcdir=$ac_pwd ;;- [\\/]* | ?:[\\/]* ) # Absolute name.- ac_srcdir=$srcdir$ac_dir_suffix;- ac_top_srcdir=$srcdir- ac_abs_top_srcdir=$srcdir ;;- *) # Relative name.- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix- ac_top_srcdir=$ac_top_build_prefix$srcdir- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;-esac-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix-- cd "$ac_dir" || { ac_status=$?; continue; }- # Check for guested configure.- if test -f "$ac_srcdir/configure.gnu"; then- echo &&- $SHELL "$ac_srcdir/configure.gnu" --help=recursive- elif test -f "$ac_srcdir/configure"; then- echo &&- $SHELL "$ac_srcdir/configure" --help=recursive- else- $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2- fi || ac_status=$?- cd "$ac_pwd" || { ac_status=$?; break; }- done-fi--test -n "$ac_init_help" && exit $ac_status-if $ac_init_version; then- cat <<\_ACEOF-Haskell unix package configure 2.0-generated by GNU Autoconf 2.69--Copyright (C) 2012 Free Software Foundation, Inc.-This configure script is free software; the Free Software Foundation-gives unlimited permission to copy, distribute and modify it.-_ACEOF- exit-fi--## ------------------------ ##-## Autoconf initialization. ##-## ------------------------ ##--# ac_fn_c_try_compile LINENO-# ---------------------------# Try to compile conftest.$ac_ext, and return whether this succeeded.-ac_fn_c_try_compile ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- rm -f conftest.$ac_objext- if { { ac_try="$ac_compile"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_compile") 2>conftest.err- ac_status=$?- if test -s conftest.err; then- grep -v '^ *+' conftest.err >conftest.er1- cat conftest.er1 >&5- mv -f conftest.er1 conftest.err- fi- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; } && {- test -z "$ac_c_werror_flag" ||- test ! -s conftest.err- } && test -s conftest.$ac_objext; then :- ac_retval=0-else- $as_echo "$as_me: failed program was:" >&5-sed 's/^/| /' conftest.$ac_ext >&5-- ac_retval=1-fi- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno- as_fn_set_status $ac_retval--} # ac_fn_c_try_compile--# ac_fn_c_try_cpp LINENO-# -----------------------# Try to preprocess conftest.$ac_ext, and return whether this succeeded.-ac_fn_c_try_cpp ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- if { { ac_try="$ac_cpp conftest.$ac_ext"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err- ac_status=$?- if test -s conftest.err; then- grep -v '^ *+' conftest.err >conftest.er1- cat conftest.er1 >&5- mv -f conftest.er1 conftest.err- fi- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; } > conftest.i && {- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||- test ! -s conftest.err- }; then :- ac_retval=0-else- $as_echo "$as_me: failed program was:" >&5-sed 's/^/| /' conftest.$ac_ext >&5-- ac_retval=1-fi- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno- as_fn_set_status $ac_retval--} # ac_fn_c_try_cpp--# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES-# --------------------------------------------------------# Tests whether HEADER exists, giving a warning if it cannot be compiled using-# the include files in INCLUDES and setting the cache variable VAR-# accordingly.-ac_fn_c_check_header_mongrel ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- if eval \${$3+:} false; then :- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5-$as_echo_n "checking for $2... " >&6; }-if eval \${$3+:} false; then :- $as_echo_n "(cached) " >&6-fi-eval ac_res=\$$3- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }-else- # Is the header compilable?-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5-$as_echo_n "checking $2 usability... " >&6; }-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-#include <$2>-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_header_compiler=yes-else- ac_header_compiler=no-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5-$as_echo "$ac_header_compiler" >&6; }--# Is the header present?-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5-$as_echo_n "checking $2 presence... " >&6; }-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <$2>-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :- ac_header_preproc=yes-else- ac_header_preproc=no-fi-rm -f conftest.err conftest.i conftest.$ac_ext-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5-$as_echo "$ac_header_preproc" >&6; }--# So? What about this header?-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((- yes:no: )- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}- ;;- no:yes:* )- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5-$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5-$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}-( $as_echo "## ------------------------------------ ##-## Report this to libraries@haskell.org ##-## ------------------------------------ ##"- ) | sed "s/^/$as_me: WARNING: /" >&2- ;;-esac- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5-$as_echo_n "checking for $2... " >&6; }-if eval \${$3+:} false; then :- $as_echo_n "(cached) " >&6-else- eval "$3=\$ac_header_compiler"-fi-eval ac_res=\$$3- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }-fi- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno--} # ac_fn_c_check_header_mongrel--# ac_fn_c_try_run LINENO-# -----------------------# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes-# that executables *can* be run.-ac_fn_c_try_run ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- if { { ac_try="$ac_link"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_link") 2>&5- ac_status=$?- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'- { { case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_try") 2>&5- ac_status=$?- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }; }; then :- ac_retval=0-else- $as_echo "$as_me: program exited with status $ac_status" >&5- $as_echo "$as_me: failed program was:" >&5-sed 's/^/| /' conftest.$ac_ext >&5-- ac_retval=$ac_status-fi- rm -rf conftest.dSYM conftest_ipa8_conftest.oo- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno- as_fn_set_status $ac_retval--} # ac_fn_c_try_run--# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES-# --------------------------------------------------------# Tests whether HEADER exists and can be compiled using the include files in-# INCLUDES, setting the cache variable VAR accordingly.-ac_fn_c_check_header_compile ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5-$as_echo_n "checking for $2... " >&6; }-if eval \${$3+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-#include <$2>-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- eval "$3=yes"-else- eval "$3=no"-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-eval ac_res=\$$3- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno--} # ac_fn_c_check_header_compile--# ac_fn_c_try_link LINENO-# ------------------------# Try to link conftest.$ac_ext, and return whether this succeeded.-ac_fn_c_try_link ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- rm -f conftest.$ac_objext conftest$ac_exeext- if { { ac_try="$ac_link"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_link") 2>conftest.err- ac_status=$?- if test -s conftest.err; then- grep -v '^ *+' conftest.err >conftest.er1- cat conftest.er1 >&5- mv -f conftest.er1 conftest.err- fi- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; } && {- test -z "$ac_c_werror_flag" ||- test ! -s conftest.err- } && test -s conftest$ac_exeext && {- test "$cross_compiling" = yes ||- test -x conftest$ac_exeext- }; then :- ac_retval=0-else- $as_echo "$as_me: failed program was:" >&5-sed 's/^/| /' conftest.$ac_ext >&5-- ac_retval=1-fi- # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information- # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would- # interfere with the next link command; also delete a directory that is- # left behind by Apple's compiler. We do this before executing the actions.- rm -rf conftest.dSYM conftest_ipa8_conftest.oo- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno- as_fn_set_status $ac_retval--} # ac_fn_c_try_link--# ac_fn_c_check_func LINENO FUNC VAR-# -----------------------------------# Tests whether FUNC exists, setting the cache variable VAR accordingly-ac_fn_c_check_func ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5-$as_echo_n "checking for $2... " >&6; }-if eval \${$3+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-/* Define $2 to an innocuous variant, in case <limits.h> declares $2.- For example, HP-UX 11i <limits.h> declares gettimeofday. */-#define $2 innocuous_$2--/* System header to define __stub macros and hopefully few prototypes,- which can conflict with char $2 (); below.- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since- <limits.h> exists even on freestanding compilers. */--#ifdef __STDC__-# include <limits.h>-#else-# include <assert.h>-#endif--#undef $2--/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char $2 ();-/* The GNU C library defines this for functions which it implements- to always fail with ENOSYS. Some functions are actually named- something starting with __ and the normal name is an alias. */-#if defined __stub_$2 || defined __stub___$2-choke me-#endif--int-main ()-{-return $2 ();- ;- return 0;-}-_ACEOF-if ac_fn_c_try_link "$LINENO"; then :- eval "$3=yes"-else- eval "$3=no"-fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext conftest.$ac_ext-fi-eval ac_res=\$$3- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno--} # ac_fn_c_check_func--# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES-# ----------------------------------------------# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR-# accordingly.-ac_fn_c_check_decl ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- as_decl_name=`echo $2|sed 's/ *(.*//'`- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }-if eval \${$3+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-int-main ()-{-#ifndef $as_decl_name-#ifdef __cplusplus- (void) $as_decl_use;-#else- (void) $as_decl_name;-#endif-#endif-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- eval "$3=yes"-else- eval "$3=no"-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-eval ac_res=\$$3- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno--} # ac_fn_c_check_decl--# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES-# -----------------------------------------------------# Tries to find if the field MEMBER exists in type AGGR, after including-# INCLUDES, setting cache variable VAR accordingly.-ac_fn_c_check_member ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5-$as_echo_n "checking for $2.$3... " >&6; }-if eval \${$4+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$5-int-main ()-{-static $2 ac_aggr;-if (ac_aggr.$3)-return 0;- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- eval "$4=yes"-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$5-int-main ()-{-static $2 ac_aggr;-if (sizeof ac_aggr.$3)-return 0;- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- eval "$4=yes"-else- eval "$4=no"-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-eval ac_res=\$$4- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno--} # ac_fn_c_check_member--# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES-# ---------------------------------------------# Tries to find the compile-time value of EXPR in a program that includes-# INCLUDES, setting VAR accordingly. Returns whether the value could be-# computed-ac_fn_c_compute_int ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- if test "$cross_compiling" = yes; then- # Depending upon the size, compute the lo and hi bounds.-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-int-main ()-{-static int test_array [1 - 2 * !(($2) >= 0)];-test_array [0] = 0;-return test_array [0];-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_lo=0 ac_mid=0- while :; do- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-int-main ()-{-static int test_array [1 - 2 * !(($2) <= $ac_mid)];-test_array [0] = 0;-return test_array [0];-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_hi=$ac_mid; break-else- as_fn_arith $ac_mid + 1 && ac_lo=$as_val- if test $ac_lo -le $ac_mid; then- ac_lo= ac_hi=- break- fi- as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext- done-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-int-main ()-{-static int test_array [1 - 2 * !(($2) < 0)];-test_array [0] = 0;-return test_array [0];-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_hi=-1 ac_mid=-1- while :; do- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-int-main ()-{-static int test_array [1 - 2 * !(($2) >= $ac_mid)];-test_array [0] = 0;-return test_array [0];-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_lo=$ac_mid; break-else- as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val- if test $ac_mid -le $ac_hi; then- ac_lo= ac_hi=- break- fi- as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext- done-else- ac_lo= ac_hi=-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-# Binary search between lo and hi bounds.-while test "x$ac_lo" != "x$ac_hi"; do- as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-int-main ()-{-static int test_array [1 - 2 * !(($2) <= $ac_mid)];-test_array [0] = 0;-return test_array [0];-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_hi=$ac_mid-else- as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-done-case $ac_lo in #((-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;-'') ac_retval=1 ;;-esac- else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-static long int longval () { return $2; }-static unsigned long int ulongval () { return $2; }-#include <stdio.h>-#include <stdlib.h>-int-main ()-{-- FILE *f = fopen ("conftest.val", "w");- if (! f)- return 1;- if (($2) < 0)- {- long int i = longval ();- if (i != ($2))- return 1;- fprintf (f, "%ld", i);- }- else- {- unsigned long int i = ulongval ();- if (i != ($2))- return 1;- fprintf (f, "%lu", i);- }- /* Do not output a trailing newline, as this causes \r\n confusion- on some platforms. */- return ferror (f) || fclose (f) != 0;-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_run "$LINENO"; then :- echo >>conftest.val; read $3 <conftest.val; ac_retval=0-else- ac_retval=1-fi-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \- conftest.$ac_objext conftest.beam conftest.$ac_ext-rm -f conftest.val-- fi- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno- as_fn_set_status $ac_retval--} # ac_fn_c_compute_int-cat >config.log <<_ACEOF-This file contains any messages produced by compilers while-running configure, to aid debugging if configure makes a mistake.--It was created by Haskell unix package $as_me 2.0, which was-generated by GNU Autoconf 2.69. Invocation command line was-- $ $0 $@--_ACEOF-exec 5>>config.log-{-cat <<_ASUNAME-## --------- ##-## Platform. ##-## --------- ##--hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`-uname -m = `(uname -m) 2>/dev/null || echo unknown`-uname -r = `(uname -r) 2>/dev/null || echo unknown`-uname -s = `(uname -s) 2>/dev/null || echo unknown`-uname -v = `(uname -v) 2>/dev/null || echo unknown`--/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`--/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`-/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`--_ASUNAME--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- $as_echo "PATH: $as_dir"- done-IFS=$as_save_IFS--} >&5--cat >&5 <<_ACEOF---## ----------- ##-## Core tests. ##-## ----------- ##--_ACEOF---# Keep a trace of the command line.-# Strip out --no-create and --no-recursion so they do not pile up.-# Strip out --silent because we don't want to record it for future runs.-# Also quote any args containing shell meta-characters.-# Make two passes to allow for proper duplicate-argument suppression.-ac_configure_args=-ac_configure_args0=-ac_configure_args1=-ac_must_keep_next=false-for ac_pass in 1 2-do- for ac_arg- do- case $ac_arg in- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;- -q | -quiet | --quiet | --quie | --qui | --qu | --q \- | -silent | --silent | --silen | --sile | --sil)- continue ;;- *\'*)- ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;- esac- case $ac_pass in- 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;- 2)- as_fn_append ac_configure_args1 " '$ac_arg'"- if test $ac_must_keep_next = true; then- ac_must_keep_next=false # Got value, back to normal.- else- case $ac_arg in- *=* | --config-cache | -C | -disable-* | --disable-* \- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \- | -with-* | --with-* | -without-* | --without-* | --x)- case "$ac_configure_args0 " in- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;- esac- ;;- -* ) ac_must_keep_next=true ;;- esac- fi- as_fn_append ac_configure_args " '$ac_arg'"- ;;- esac- done-done-{ ac_configure_args0=; unset ac_configure_args0;}-{ ac_configure_args1=; unset ac_configure_args1;}--# When interrupted or exit'd, cleanup temporary files, and complete-# config.log. We remove comments because anyway the quotes in there-# would cause problems or look ugly.-# WARNING: Use '\'' to represent an apostrophe within the trap.-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.-trap 'exit_status=$?- # Save into config.log some information that might help in debugging.- {- echo-- $as_echo "## ---------------- ##-## Cache variables. ##-## ---------------- ##"- echo- # The following way of writing the cache mishandles newlines in values,-(- for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do- eval ac_val=\$$ac_var- case $ac_val in #(- *${as_nl}*)- case $ac_var in #(- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;- esac- case $ac_var in #(- _ | IFS | as_nl) ;; #(- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(- *) { eval $ac_var=; unset $ac_var;} ;;- esac ;;- esac- done- (set) 2>&1 |- case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(- *${as_nl}ac_space=\ *)- sed -n \- "s/'\''/'\''\\\\'\'''\''/g;- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"- ;; #(- *)- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"- ;;- esac |- sort-)- echo-- $as_echo "## ----------------- ##-## Output variables. ##-## ----------------- ##"- echo- for ac_var in $ac_subst_vars- do- eval ac_val=\$$ac_var- case $ac_val in- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;- esac- $as_echo "$ac_var='\''$ac_val'\''"- done | sort- echo-- if test -n "$ac_subst_files"; then- $as_echo "## ------------------- ##-## File substitutions. ##-## ------------------- ##"- echo- for ac_var in $ac_subst_files- do- eval ac_val=\$$ac_var- case $ac_val in- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;- esac- $as_echo "$ac_var='\''$ac_val'\''"- done | sort- echo- fi-- if test -s confdefs.h; then- $as_echo "## ----------- ##-## confdefs.h. ##-## ----------- ##"- echo- cat confdefs.h- echo- fi- test "$ac_signal" != 0 &&- $as_echo "$as_me: caught signal $ac_signal"- $as_echo "$as_me: exit $exit_status"- } >&5- rm -f core *.core core.conftest.* &&- rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&- exit $exit_status-' 0-for ac_signal in 1 2 13 15; do- trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal-done-ac_signal=0--# confdefs.h avoids OS command line length limits that DEFS can exceed.-rm -f -r conftest* confdefs.h--$as_echo "/* confdefs.h */" > confdefs.h--# Predefined preprocessor variables.--cat >>confdefs.h <<_ACEOF-#define PACKAGE_NAME "$PACKAGE_NAME"-_ACEOF--cat >>confdefs.h <<_ACEOF-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"-_ACEOF--cat >>confdefs.h <<_ACEOF-#define PACKAGE_VERSION "$PACKAGE_VERSION"-_ACEOF--cat >>confdefs.h <<_ACEOF-#define PACKAGE_STRING "$PACKAGE_STRING"-_ACEOF--cat >>confdefs.h <<_ACEOF-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"-_ACEOF--cat >>confdefs.h <<_ACEOF-#define PACKAGE_URL "$PACKAGE_URL"-_ACEOF---# Let the site file select an alternate cache file if it wants to.-# Prefer an explicitly selected file to automatically selected ones.-ac_site_file1=NONE-ac_site_file2=NONE-if test -n "$CONFIG_SITE"; then- # We do not want a PATH search for config.site.- case $CONFIG_SITE in #((- -*) ac_site_file1=./$CONFIG_SITE;;- */*) ac_site_file1=$CONFIG_SITE;;- *) ac_site_file1=./$CONFIG_SITE;;- esac-elif test "x$prefix" != xNONE; then- ac_site_file1=$prefix/share/config.site- ac_site_file2=$prefix/etc/config.site-else- ac_site_file1=$ac_default_prefix/share/config.site- ac_site_file2=$ac_default_prefix/etc/config.site-fi-for ac_site_file in "$ac_site_file1" "$ac_site_file2"-do- test "x$ac_site_file" = xNONE && continue- if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5-$as_echo "$as_me: loading site script $ac_site_file" >&6;}- sed 's/^/| /' "$ac_site_file" >&5- . "$ac_site_file" \- || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}-as_fn_error $? "failed to load site script $ac_site_file-See \`config.log' for more details" "$LINENO" 5; }- fi-done--if test -r "$cache_file"; then- # Some versions of bash will fail to source /dev/null (special files- # actually), so we avoid doing that. DJGPP emulates it as a regular file.- if test /dev/null != "$cache_file" && test -f "$cache_file"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5-$as_echo "$as_me: loading cache $cache_file" >&6;}- case $cache_file in- [\\/]* | ?:[\\/]* ) . "$cache_file";;- *) . "./$cache_file";;- esac- fi-else- { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5-$as_echo "$as_me: creating cache $cache_file" >&6;}- >$cache_file-fi--# Check that the precious variables saved in the cache have kept the same-# value.-ac_cache_corrupted=false-for ac_var in $ac_precious_vars; do- eval ac_old_set=\$ac_cv_env_${ac_var}_set- eval ac_new_set=\$ac_env_${ac_var}_set- eval ac_old_val=\$ac_cv_env_${ac_var}_value- eval ac_new_val=\$ac_env_${ac_var}_value- case $ac_old_set,$ac_new_set in- set,)- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}- ac_cache_corrupted=: ;;- ,set)- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}- ac_cache_corrupted=: ;;- ,);;- *)- if test "x$ac_old_val" != "x$ac_new_val"; then- # differences in whitespace do not lead to failure.- ac_old_val_w=`echo x $ac_old_val`- ac_new_val_w=`echo x $ac_new_val`- if test "$ac_old_val_w" != "$ac_new_val_w"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}- ac_cache_corrupted=:- else- { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}- eval $ac_var=\$ac_old_val- fi- { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5-$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5-$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}- fi;;- esac- # Pass precious variables to config.status.- if test "$ac_new_set" = set; then- case $ac_new_val in- *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;- *) ac_arg=$ac_var=$ac_new_val ;;- esac- case " $ac_configure_args " in- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.- *) as_fn_append ac_configure_args " '$ac_arg'" ;;- esac- fi-done-if $ac_cache_corrupted; then- { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}- as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5-fi-## -------------------- ##-## Main body of script. ##-## -------------------- ##--ac_ext=c-ac_cpp='$CPP $CPPFLAGS'-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_c_compiler_gnu----# Safety check: Ensure that we are in the correct source directory.---ac_ext=c-ac_cpp='$CPP $CPPFLAGS'-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_c_compiler_gnu-if test -n "$ac_tool_prefix"; then- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.-set dummy ${ac_tool_prefix}gcc; ac_word=$2-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_CC+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$CC"; then- ac_cv_prog_CC="$CC" # Let the user override the test.-else-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_exec_ext in '' $ac_executable_extensions; do- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_CC="${ac_tool_prefix}gcc"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS--fi-fi-CC=$ac_cv_prog_CC-if test -n "$CC"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5-$as_echo "$CC" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi---fi-if test -z "$ac_cv_prog_CC"; then- ac_ct_CC=$CC- # Extract the first word of "gcc", so it can be a program name with args.-set dummy gcc; ac_word=$2-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_ac_ct_CC+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$ac_ct_CC"; then- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.-else-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_exec_ext in '' $ac_executable_extensions; do- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_ac_ct_CC="gcc"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS--fi-fi-ac_ct_CC=$ac_cv_prog_ac_ct_CC-if test -n "$ac_ct_CC"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5-$as_echo "$ac_ct_CC" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi-- if test "x$ac_ct_CC" = x; then- CC=""- else- case $cross_compiling:$ac_tool_warned in-yes:)-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}-ac_tool_warned=yes ;;-esac- CC=$ac_ct_CC- fi-else- CC="$ac_cv_prog_CC"-fi--if test -z "$CC"; then- if test -n "$ac_tool_prefix"; then- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.-set dummy ${ac_tool_prefix}cc; ac_word=$2-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_CC+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$CC"; then- ac_cv_prog_CC="$CC" # Let the user override the test.-else-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_exec_ext in '' $ac_executable_extensions; do- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_CC="${ac_tool_prefix}cc"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS--fi-fi-CC=$ac_cv_prog_CC-if test -n "$CC"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5-$as_echo "$CC" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi--- fi-fi-if test -z "$CC"; then- # Extract the first word of "cc", so it can be a program name with args.-set dummy cc; ac_word=$2-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_CC+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$CC"; then- ac_cv_prog_CC="$CC" # Let the user override the test.-else- ac_prog_rejected=no-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_exec_ext in '' $ac_executable_extensions; do- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then- ac_prog_rejected=yes- continue- fi- ac_cv_prog_CC="cc"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS--if test $ac_prog_rejected = yes; then- # We found a bogon in the path, so make sure we never use it.- set dummy $ac_cv_prog_CC- shift- if test $# != 0; then- # We chose a different compiler from the bogus one.- # However, it has the same basename, so the bogon will be chosen- # first if we set CC to just the basename; use the full file name.- shift- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"- fi-fi-fi-fi-CC=$ac_cv_prog_CC-if test -n "$CC"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5-$as_echo "$CC" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi---fi-if test -z "$CC"; then- if test -n "$ac_tool_prefix"; then- for ac_prog in cl.exe- do- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.-set dummy $ac_tool_prefix$ac_prog; ac_word=$2-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_CC+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$CC"; then- ac_cv_prog_CC="$CC" # Let the user override the test.-else-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_exec_ext in '' $ac_executable_extensions; do- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS--fi-fi-CC=$ac_cv_prog_CC-if test -n "$CC"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5-$as_echo "$CC" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi--- test -n "$CC" && break- done-fi-if test -z "$CC"; then- ac_ct_CC=$CC- for ac_prog in cl.exe-do- # Extract the first word of "$ac_prog", so it can be a program name with args.-set dummy $ac_prog; ac_word=$2-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_ac_ct_CC+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$ac_ct_CC"; then- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.-else-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_exec_ext in '' $ac_executable_extensions; do- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_ac_ct_CC="$ac_prog"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS--fi-fi-ac_ct_CC=$ac_cv_prog_ac_ct_CC-if test -n "$ac_ct_CC"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5-$as_echo "$ac_ct_CC" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi--- test -n "$ac_ct_CC" && break-done-- if test "x$ac_ct_CC" = x; then- CC=""- else- case $cross_compiling:$ac_tool_warned in-yes:)-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}-ac_tool_warned=yes ;;-esac- CC=$ac_ct_CC- fi-fi--fi---test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}-as_fn_error $? "no acceptable C compiler found in \$PATH-See \`config.log' for more details" "$LINENO" 5; }--# Provide some information about the compiler.-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5-set X $ac_compile-ac_compiler=$2-for ac_option in --version -v -V -qversion; do- { { ac_try="$ac_compiler $ac_option >&5"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_compiler $ac_option >&5") 2>conftest.err- ac_status=$?- if test -s conftest.err; then- sed '10a\-... rest of stderr output deleted ...- 10q' conftest.err >conftest.er1- cat conftest.er1 >&5- fi- rm -f conftest.er1 conftest.err- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }-done--cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--int-main ()-{-- ;- return 0;-}-_ACEOF-ac_clean_files_save=$ac_clean_files-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"-# Try to create an executable without -o first, disregard a.out.-# It will help us diagnose broken compilers, and finding out an intuition-# of exeext.-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5-$as_echo_n "checking whether the C compiler works... " >&6; }-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`--# The possible output files:-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"--ac_rmfiles=-for ac_file in $ac_files-do- case $ac_file in- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;- * ) ac_rmfiles="$ac_rmfiles $ac_file";;- esac-done-rm -f $ac_rmfiles--if { { ac_try="$ac_link_default"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_link_default") 2>&5- ac_status=$?- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }; then :- # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'-# in a Makefile. We should not override ac_cv_exeext if it was cached,-# so that the user can short-circuit this test for compilers unknown to-# Autoconf.-for ac_file in $ac_files ''-do- test -f "$ac_file" || continue- case $ac_file in- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )- ;;- [ab].out )- # We found the default executable, but exeext='' is most- # certainly right.- break;;- *.* )- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;- then :; else- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`- fi- # We set ac_cv_exeext here because the later test for it is not- # safe: cross compilers may not add the suffix if given an `-o'- # argument, so we may need to know it at that point already.- # Even if this section looks crufty: it has the advantage of- # actually working.- break;;- * )- break;;- esac-done-test "$ac_cv_exeext" = no && ac_cv_exeext=--else- ac_file=''-fi-if test -z "$ac_file"; then :- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-$as_echo "$as_me: failed program was:" >&5-sed 's/^/| /' conftest.$ac_ext >&5--{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}-as_fn_error 77 "C compiler cannot create executables-See \`config.log' for more details" "$LINENO" 5; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5-$as_echo_n "checking for C compiler default output file name... " >&6; }-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5-$as_echo "$ac_file" >&6; }-ac_exeext=$ac_cv_exeext--rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out-ac_clean_files=$ac_clean_files_save-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5-$as_echo_n "checking for suffix of executables... " >&6; }-if { { ac_try="$ac_link"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_link") 2>&5- ac_status=$?- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }; then :- # If both `conftest.exe' and `conftest' are `present' (well, observable)-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will-# work properly (i.e., refer to `conftest.exe'), while it won't with-# `rm'.-for ac_file in conftest.exe conftest conftest.*; do- test -f "$ac_file" || continue- case $ac_file in- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`- break;;- * ) break;;- esac-done-else- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}-as_fn_error $? "cannot compute suffix of executables: cannot compile and link-See \`config.log' for more details" "$LINENO" 5; }-fi-rm -f conftest conftest$ac_cv_exeext-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5-$as_echo "$ac_cv_exeext" >&6; }--rm -f conftest.$ac_ext-EXEEXT=$ac_cv_exeext-ac_exeext=$EXEEXT-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <stdio.h>-int-main ()-{-FILE *f = fopen ("conftest.out", "w");- return ferror (f) || fclose (f) != 0;-- ;- return 0;-}-_ACEOF-ac_clean_files="$ac_clean_files conftest.out"-# Check that the compiler produces executables we can run. If not, either-# the compiler is broken, or we cross compile.-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5-$as_echo_n "checking whether we are cross compiling... " >&6; }-if test "$cross_compiling" != yes; then- { { ac_try="$ac_link"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_link") 2>&5- ac_status=$?- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }- if { ac_try='./conftest$ac_cv_exeext'- { { case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_try") 2>&5- ac_status=$?- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }; }; then- cross_compiling=no- else- if test "$cross_compiling" = maybe; then- cross_compiling=yes- else- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}-as_fn_error $? "cannot run C compiled programs.-If you meant to cross compile, use \`--host'.-See \`config.log' for more details" "$LINENO" 5; }- fi- fi-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5-$as_echo "$cross_compiling" >&6; }--rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out-ac_clean_files=$ac_clean_files_save-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5-$as_echo_n "checking for suffix of object files... " >&6; }-if ${ac_cv_objext+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--int-main ()-{-- ;- return 0;-}-_ACEOF-rm -f conftest.o conftest.obj-if { { ac_try="$ac_compile"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_compile") 2>&5- ac_status=$?- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }; then :- for ac_file in conftest.o conftest.obj conftest.*; do- test -f "$ac_file" || continue;- case $ac_file in- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`- break;;- esac-done-else- $as_echo "$as_me: failed program was:" >&5-sed 's/^/| /' conftest.$ac_ext >&5--{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}-as_fn_error $? "cannot compute suffix of object files: cannot compile-See \`config.log' for more details" "$LINENO" 5; }-fi-rm -f conftest.$ac_cv_objext conftest.$ac_ext-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5-$as_echo "$ac_cv_objext" >&6; }-OBJEXT=$ac_cv_objext-ac_objext=$OBJEXT-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }-if ${ac_cv_c_compiler_gnu+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--int-main ()-{-#ifndef __GNUC__- choke me-#endif-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_compiler_gnu=yes-else- ac_compiler_gnu=no-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-ac_cv_c_compiler_gnu=$ac_compiler_gnu--fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5-$as_echo "$ac_cv_c_compiler_gnu" >&6; }-if test $ac_compiler_gnu = yes; then- GCC=yes-else- GCC=-fi-ac_test_CFLAGS=${CFLAGS+set}-ac_save_CFLAGS=$CFLAGS-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5-$as_echo_n "checking whether $CC accepts -g... " >&6; }-if ${ac_cv_prog_cc_g+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_save_c_werror_flag=$ac_c_werror_flag- ac_c_werror_flag=yes- ac_cv_prog_cc_g=no- CFLAGS="-g"- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_prog_cc_g=yes-else- CFLAGS=""- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :--else- ac_c_werror_flag=$ac_save_c_werror_flag- CFLAGS="-g"- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_prog_cc_g=yes-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext- ac_c_werror_flag=$ac_save_c_werror_flag-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5-$as_echo "$ac_cv_prog_cc_g" >&6; }-if test "$ac_test_CFLAGS" = set; then- CFLAGS=$ac_save_CFLAGS-elif test $ac_cv_prog_cc_g = yes; then- if test "$GCC" = yes; then- CFLAGS="-g -O2"- else- CFLAGS="-g"- fi-else- if test "$GCC" = yes; then- CFLAGS="-O2"- else- CFLAGS=- fi-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }-if ${ac_cv_prog_cc_c89+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_cv_prog_cc_c89=no-ac_save_CC=$CC-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <stdarg.h>-#include <stdio.h>-struct stat;-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */-struct buf { int x; };-FILE * (*rcsopen) (struct buf *, struct stat *, int);-static char *e (p, i)- char **p;- int i;-{- return p[i];-}-static char *f (char * (*g) (char **, int), char **p, ...)-{- char *s;- va_list v;- va_start (v,p);- s = g (p, va_arg (v,int));- va_end (v);- return s;-}--/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has- function prototypes and stuff, but not '\xHH' hex character constants.- These don't provoke an error unfortunately, instead are silently treated- as 'x'. The following induces an error, until -std is added to get- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an- array size at least. It's necessary to write '\x00'==0 to get something- that's true only with -std. */-int osf4_cc_array ['\x00' == 0 ? 1 : -1];--/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters- inside strings and character constants. */-#define FOO(x) 'x'-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];--int test (int i, double x);-struct s1 {int (*f) (int a);};-struct s2 {int (*f) (double a);};-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);-int argc;-char **argv;-int-main ()-{-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];- ;- return 0;-}-_ACEOF-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"-do- CC="$ac_save_CC $ac_arg"- if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_prog_cc_c89=$ac_arg-fi-rm -f core conftest.err conftest.$ac_objext- test "x$ac_cv_prog_cc_c89" != "xno" && break-done-rm -f conftest.$ac_ext-CC=$ac_save_CC--fi-# AC_CACHE_VAL-case "x$ac_cv_prog_cc_c89" in- x)- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5-$as_echo "none needed" >&6; } ;;- xno)- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5-$as_echo "unsupported" >&6; } ;;- *)- CC="$CC $ac_cv_prog_cc_c89"- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;-esac-if test "x$ac_cv_prog_cc_c89" != xno; then :--fi--ac_ext=c-ac_cpp='$CPP $CPPFLAGS'-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_c_compiler_gnu----ac_ext=c-ac_cpp='$CPP $CPPFLAGS'-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_c_compiler_gnu-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5-$as_echo_n "checking how to run the C preprocessor... " >&6; }-# On Suns, sometimes $CPP names a directory.-if test -n "$CPP" && test -d "$CPP"; then- CPP=-fi-if test -z "$CPP"; then- if ${ac_cv_prog_CPP+:} false; then :- $as_echo_n "(cached) " >&6-else- # Double quotes because CPP needs to be expanded- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"- do- ac_preproc_ok=false-for ac_c_preproc_warn_flag in '' yes-do- # Use a header file that comes with gcc, so configuring glibc- # with a fresh cross-compiler works.- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since- # <limits.h> exists even on freestanding compilers.- # On the NeXT, cc -E runs the code through the compiler's parser,- # not just through cpp. "Syntax error" is here to catch this case.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#ifdef __STDC__-# include <limits.h>-#else-# include <assert.h>-#endif- Syntax error-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :--else- # Broken: fails on valid input.-continue-fi-rm -f conftest.err conftest.i conftest.$ac_ext-- # OK, works on sane cases. Now check whether nonexistent headers- # can be detected and how.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <ac_nonexistent.h>-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :- # Broken: success on invalid input.-continue-else- # Passes both tests.-ac_preproc_ok=:-break-fi-rm -f conftest.err conftest.i conftest.$ac_ext--done-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.-rm -f conftest.i conftest.err conftest.$ac_ext-if $ac_preproc_ok; then :- break-fi-- done- ac_cv_prog_CPP=$CPP--fi- CPP=$ac_cv_prog_CPP-else- ac_cv_prog_CPP=$CPP-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5-$as_echo "$CPP" >&6; }-ac_preproc_ok=false-for ac_c_preproc_warn_flag in '' yes-do- # Use a header file that comes with gcc, so configuring glibc- # with a fresh cross-compiler works.- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since- # <limits.h> exists even on freestanding compilers.- # On the NeXT, cc -E runs the code through the compiler's parser,- # not just through cpp. "Syntax error" is here to catch this case.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#ifdef __STDC__-# include <limits.h>-#else-# include <assert.h>-#endif- Syntax error-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :--else- # Broken: fails on valid input.-continue-fi-rm -f conftest.err conftest.i conftest.$ac_ext-- # OK, works on sane cases. Now check whether nonexistent headers- # can be detected and how.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <ac_nonexistent.h>-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :- # Broken: success on invalid input.-continue-else- # Passes both tests.-ac_preproc_ok=:-break-fi-rm -f conftest.err conftest.i conftest.$ac_ext--done-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.-rm -f conftest.i conftest.err conftest.$ac_ext-if $ac_preproc_ok; then :--else- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check-See \`config.log' for more details" "$LINENO" 5; }-fi--ac_ext=c-ac_cpp='$CPP $CPPFLAGS'-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_c_compiler_gnu---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }-if ${ac_cv_path_GREP+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -z "$GREP"; then- ac_path_GREP_found=false- # Loop through the user's path and test for each of PROGNAME-LIST- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_prog in grep ggrep; do- for ac_exec_ext in '' $ac_executable_extensions; do- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"- as_fn_executable_p "$ac_path_GREP" || continue-# Check for GNU ac_path_GREP and select it if it is found.- # Check for GNU $ac_path_GREP-case `"$ac_path_GREP" --version 2>&1` in-*GNU*)- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;-*)- ac_count=0- $as_echo_n 0123456789 >"conftest.in"- while :- do- cat "conftest.in" "conftest.in" >"conftest.tmp"- mv "conftest.tmp" "conftest.in"- cp "conftest.in" "conftest.nl"- $as_echo 'GREP' >> "conftest.nl"- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break- as_fn_arith $ac_count + 1 && ac_count=$as_val- if test $ac_count -gt ${ac_path_GREP_max-0}; then- # Best one so far, save it but keep looking for a better one- ac_cv_path_GREP="$ac_path_GREP"- ac_path_GREP_max=$ac_count- fi- # 10*(2^10) chars as input seems more than enough- test $ac_count -gt 10 && break- done- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;-esac-- $ac_path_GREP_found && break 3- done- done- done-IFS=$as_save_IFS- if test -z "$ac_cv_path_GREP"; then- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5- fi-else- ac_cv_path_GREP=$GREP-fi--fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5-$as_echo "$ac_cv_path_GREP" >&6; }- GREP="$ac_cv_path_GREP"---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5-$as_echo_n "checking for egrep... " >&6; }-if ${ac_cv_path_EGREP+:} false; then :- $as_echo_n "(cached) " >&6-else- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1- then ac_cv_path_EGREP="$GREP -E"- else- if test -z "$EGREP"; then- ac_path_EGREP_found=false- # Loop through the user's path and test for each of PROGNAME-LIST- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- for ac_prog in egrep; do- for ac_exec_ext in '' $ac_executable_extensions; do- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"- as_fn_executable_p "$ac_path_EGREP" || continue-# Check for GNU ac_path_EGREP and select it if it is found.- # Check for GNU $ac_path_EGREP-case `"$ac_path_EGREP" --version 2>&1` in-*GNU*)- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;-*)- ac_count=0- $as_echo_n 0123456789 >"conftest.in"- while :- do- cat "conftest.in" "conftest.in" >"conftest.tmp"- mv "conftest.tmp" "conftest.in"- cp "conftest.in" "conftest.nl"- $as_echo 'EGREP' >> "conftest.nl"- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break- as_fn_arith $ac_count + 1 && ac_count=$as_val- if test $ac_count -gt ${ac_path_EGREP_max-0}; then- # Best one so far, save it but keep looking for a better one- ac_cv_path_EGREP="$ac_path_EGREP"- ac_path_EGREP_max=$ac_count- fi- # 10*(2^10) chars as input seems more than enough- test $ac_count -gt 10 && break- done- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;-esac-- $ac_path_EGREP_found && break 3- done- done- done-IFS=$as_save_IFS- if test -z "$ac_cv_path_EGREP"; then- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5- fi-else- ac_cv_path_EGREP=$EGREP-fi-- fi-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5-$as_echo "$ac_cv_path_EGREP" >&6; }- EGREP="$ac_cv_path_EGREP"---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5-$as_echo_n "checking for ANSI C header files... " >&6; }-if ${ac_cv_header_stdc+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <stdlib.h>-#include <stdarg.h>-#include <string.h>-#include <float.h>--int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_header_stdc=yes-else- ac_cv_header_stdc=no-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext--if test $ac_cv_header_stdc = yes; then- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <string.h>--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "memchr" >/dev/null 2>&1; then :--else- ac_cv_header_stdc=no-fi-rm -f conftest*--fi--if test $ac_cv_header_stdc = yes; then- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <stdlib.h>--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "free" >/dev/null 2>&1; then :--else- ac_cv_header_stdc=no-fi-rm -f conftest*--fi--if test $ac_cv_header_stdc = yes; then- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.- if test "$cross_compiling" = yes; then :- :-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <ctype.h>-#include <stdlib.h>-#if ((' ' & 0x0FF) == 0x020)-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))-#else-# define ISLOWER(c) \- (('a' <= (c) && (c) <= 'i') \- || ('j' <= (c) && (c) <= 'r') \- || ('s' <= (c) && (c) <= 'z'))-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))-#endif--#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))-int-main ()-{- int i;- for (i = 0; i < 256; i++)- if (XOR (islower (i), ISLOWER (i))- || toupper (i) != TOUPPER (i))- return 2;- return 0;-}-_ACEOF-if ac_fn_c_try_run "$LINENO"; then :--else- ac_cv_header_stdc=no-fi-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \- conftest.$ac_objext conftest.beam conftest.$ac_ext-fi--fi-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5-$as_echo "$ac_cv_header_stdc" >&6; }-if test $ac_cv_header_stdc = yes; then--$as_echo "#define STDC_HEADERS 1" >>confdefs.h--fi--# On IRIX 5.3, sys/types and inttypes.h are conflicting.-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \- inttypes.h stdint.h unistd.h-do :- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default-"-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1-_ACEOF--fi--done---- ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"-if test "x$ac_cv_header_minix_config_h" = xyes; then :- MINIX=yes-else- MINIX=-fi--- if test "$MINIX" = yes; then--$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h---$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h---$as_echo "#define _MINIX 1" >>confdefs.h-- fi--- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5-$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }-if ${ac_cv_safe_to_define___extensions__+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--# define __EXTENSIONS__ 1- $ac_includes_default-int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_safe_to_define___extensions__=yes-else- ac_cv_safe_to_define___extensions__=no-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5-$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }- test $ac_cv_safe_to_define___extensions__ = yes &&- $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h-- $as_echo "#define _ALL_SOURCE 1" >>confdefs.h-- $as_echo "#define _GNU_SOURCE 1" >>confdefs.h-- $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h-- $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h----ac_config_headers="$ac_config_headers include/HsUnixConfig.h"---# Is this a Unix system?-ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default"-if test "x$ac_cv_header_dlfcn_h" = xyes; then :- BUILD_PACKAGE_BOOL=True-else- BUILD_PACKAGE_BOOL=False-fi-----{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5-$as_echo_n "checking for an ANSI C-conforming const... " >&6; }-if ${ac_cv_c_const+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--int-main ()-{--#ifndef __cplusplus- /* Ultrix mips cc rejects this sort of thing. */- typedef int charset[2];- const charset cs = { 0, 0 };- /* SunOS 4.1.1 cc rejects this. */- char const *const *pcpcc;- char **ppc;- /* NEC SVR4.0.2 mips cc rejects this. */- struct point {int x, y;};- static struct point const zero = {0,0};- /* AIX XL C 1.02.0.0 rejects this.- It does not let you subtract one const X* pointer from another in- an arm of an if-expression whose if-part is not a constant- expression */- const char *g = "string";- pcpcc = &g + (g ? g-g : 0);- /* HPUX 7.0 cc rejects these. */- ++pcpcc;- ppc = (char**) pcpcc;- pcpcc = (char const *const *) ppc;- { /* SCO 3.2v4 cc rejects this sort of thing. */- char tx;- char *t = &tx;- char const *s = 0 ? (char *) 0 : (char const *) 0;-- *t++ = 0;- if (s) return 0;- }- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */- int x[] = {25, 17};- const int *foo = &x[0];- ++foo;- }- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */- typedef const int *iptr;- iptr p = 0;- ++p;- }- { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */- struct s { int j; const int *ap[3]; } bx;- struct s *b = &bx; b->j = 5;- }- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */- const int foo = 10;- if (!foo) return 0;- }- return !cs[0] && !zero.x;-#endif-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_c_const=yes-else- ac_cv_c_const=no-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5-$as_echo "$ac_cv_c_const" >&6; }-if test $ac_cv_c_const = no; then--$as_echo "#define const /**/" >>confdefs.h--fi---# Check whether --enable-largefile was given.-if test "${enable_largefile+set}" = set; then :- enableval=$enable_largefile;-fi--if test "$enable_largefile" != no; then-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }-if ${ac_cv_sys_largefile_CC+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_cv_sys_largefile_CC=no- if test "$GCC" != yes; then- ac_save_CC=$CC- while :; do- # IRIX 6.2 and later do not support large files by default,- # so use the C compiler's -n32 option if that helps.- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <sys/types.h>- /* Check that off_t can represent 2**63 - 1 correctly.- We can't simply define LARGE_OFF_T to be 9223372036854775807,- since some C++ compilers masquerading as C compilers- incorrectly reject 9223372036854775807. */-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721- && LARGE_OFF_T % 2147483647 == 1)- ? 1 : -1];-int-main ()-{-- ;- return 0;-}-_ACEOF- if ac_fn_c_try_compile "$LINENO"; then :- break-fi-rm -f core conftest.err conftest.$ac_objext- CC="$CC -n32"- if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_sys_largefile_CC=' -n32'; break-fi-rm -f core conftest.err conftest.$ac_objext- break- done- CC=$ac_save_CC- rm -f conftest.$ac_ext- fi-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5-$as_echo "$ac_cv_sys_largefile_CC" >&6; }- if test "$ac_cv_sys_largefile_CC" != no; then- CC=$CC$ac_cv_sys_largefile_CC- fi-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }-if ${ac_cv_sys_file_offset_bits+:} false; then :- $as_echo_n "(cached) " >&6-else- while :; do- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <sys/types.h>- /* Check that off_t can represent 2**63 - 1 correctly.- We can't simply define LARGE_OFF_T to be 9223372036854775807,- since some C++ compilers masquerading as C compilers- incorrectly reject 9223372036854775807. */-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721- && LARGE_OFF_T % 2147483647 == 1)- ? 1 : -1];-int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_sys_file_offset_bits=no; break-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#define _FILE_OFFSET_BITS 64-#include <sys/types.h>- /* Check that off_t can represent 2**63 - 1 correctly.- We can't simply define LARGE_OFF_T to be 9223372036854775807,- since some C++ compilers masquerading as C compilers- incorrectly reject 9223372036854775807. */-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721- && LARGE_OFF_T % 2147483647 == 1)- ? 1 : -1];-int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_sys_file_offset_bits=64; break-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext- ac_cv_sys_file_offset_bits=unknown- break-done-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }-case $ac_cv_sys_file_offset_bits in #(- no | unknown) ;;- *)-cat >>confdefs.h <<_ACEOF-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits-_ACEOF-;;-esac-rm -rf conftest*- if test $ac_cv_sys_file_offset_bits = unknown; then- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }-if ${ac_cv_sys_large_files+:} false; then :- $as_echo_n "(cached) " >&6-else- while :; do- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <sys/types.h>- /* Check that off_t can represent 2**63 - 1 correctly.- We can't simply define LARGE_OFF_T to be 9223372036854775807,- since some C++ compilers masquerading as C compilers- incorrectly reject 9223372036854775807. */-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721- && LARGE_OFF_T % 2147483647 == 1)- ? 1 : -1];-int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_sys_large_files=no; break-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#define _LARGE_FILES 1-#include <sys/types.h>- /* Check that off_t can represent 2**63 - 1 correctly.- We can't simply define LARGE_OFF_T to be 9223372036854775807,- since some C++ compilers masquerading as C compilers- incorrectly reject 9223372036854775807. */-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721- && LARGE_OFF_T % 2147483647 == 1)- ? 1 : -1];-int-main ()-{-- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_cv_sys_large_files=1; break-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext- ac_cv_sys_large_files=unknown- break-done-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5-$as_echo "$ac_cv_sys_large_files" >&6; }-case $ac_cv_sys_large_files in #(- no | unknown) ;;- *)-cat >>confdefs.h <<_ACEOF-#define _LARGE_FILES $ac_cv_sys_large_files-_ACEOF-;;-esac-rm -rf conftest*- fi---fi---for ac_header in dirent.h fcntl.h grp.h limits.h pwd.h signal.h string.h-do :- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1-_ACEOF--fi--done--for ac_header in sys/resource.h sys/stat.h sys/times.h sys/time.h-do :- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1-_ACEOF--fi--done--for ac_header in sys/utsname.h sys/wait.h-do :- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1-_ACEOF--fi--done--for ac_header in bsd/libutil.h libutil.h pty.h utmp.h-do :- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1-_ACEOF--fi--done--for ac_header in termios.h time.h unistd.h utime.h-do :- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1-_ACEOF--fi--done---for ac_func in getgrgid_r getgrnam_r getpwnam_r getpwuid_r getpwnam getpwuid-do :- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1-_ACEOF--fi-done--for ac_func in getpwent getgrent-do :- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1-_ACEOF--fi-done--for ac_func in lchown setenv sysconf unsetenv clearenv-do :- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1-_ACEOF--fi-done--for ac_func in nanosleep-do :- ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep"-if test "x$ac_cv_func_nanosleep" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_NANOSLEEP 1-_ACEOF--fi-done--for ac_func in ptsname-do :- ac_fn_c_check_func "$LINENO" "ptsname" "ac_cv_func_ptsname"-if test "x$ac_cv_func_ptsname" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_PTSNAME 1-_ACEOF--fi-done--for ac_func in setitimer-do :- ac_fn_c_check_func "$LINENO" "setitimer" "ac_cv_func_setitimer"-if test "x$ac_cv_func_setitimer" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_SETITIMER 1-_ACEOF--fi-done--for ac_func in readdir_r-do :- ac_fn_c_check_func "$LINENO" "readdir_r" "ac_cv_func_readdir_r"-if test "x$ac_cv_func_readdir_r" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_READDIR_R 1-_ACEOF--fi-done---ac_aux_dir=-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do- if test -f "$ac_dir/install-sh"; then- ac_aux_dir=$ac_dir- ac_install_sh="$ac_aux_dir/install-sh -c"- break- elif test -f "$ac_dir/install.sh"; then- ac_aux_dir=$ac_dir- ac_install_sh="$ac_aux_dir/install.sh -c"- break- elif test -f "$ac_dir/shtool"; then- ac_aux_dir=$ac_dir- ac_install_sh="$ac_aux_dir/shtool install -c"- break- fi-done-if test -z "$ac_aux_dir"; then- as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5-fi--# These three variables are undocumented and unsupported,-# and are intended to be withdrawn in a future Autoconf release.-# They can cause serious problems if a builder's source tree is in a directory-# whose full name contains unusual characters.-ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.-ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.-ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.---# Make sure we can run config.sub.-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||- as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5-$as_echo_n "checking build system type... " >&6; }-if ${ac_cv_build+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_build_alias=$build_alias-test "x$ac_build_alias" = x &&- ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`-test "x$ac_build_alias" = x &&- as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5--fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5-$as_echo "$ac_cv_build" >&6; }-case $ac_cv_build in-*-*-*) ;;-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;-esac-build=$ac_cv_build-ac_save_IFS=$IFS; IFS='-'-set x $ac_cv_build-shift-build_cpu=$1-build_vendor=$2-shift; shift-# Remember, the first character of IFS is used to create $*,-# except with old shells:-build_os=$*-IFS=$ac_save_IFS-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5-$as_echo_n "checking host system type... " >&6; }-if ${ac_cv_host+:} false; then :- $as_echo_n "(cached) " >&6-else- if test "x$host_alias" = x; then- ac_cv_host=$ac_cv_build-else- ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5-fi--fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5-$as_echo "$ac_cv_host" >&6; }-case $ac_cv_host in-*-*-*) ;;-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;-esac-host=$ac_cv_host-ac_save_IFS=$IFS; IFS='-'-set x $ac_cv_host-shift-host_cpu=$1-host_vendor=$2-shift; shift-# Remember, the first character of IFS is used to create $*,-# except with old shells:-host_os=$*-IFS=$ac_save_IFS-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5-$as_echo_n "checking target system type... " >&6; }-if ${ac_cv_target+:} false; then :- $as_echo_n "(cached) " >&6-else- if test "x$target_alias" = x; then- ac_cv_target=$ac_cv_host-else- ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5-fi--fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5-$as_echo "$ac_cv_target" >&6; }-case $ac_cv_target in-*-*-*) ;;-*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;-esac-target=$ac_cv_target-ac_save_IFS=$IFS; IFS='-'-set x $ac_cv_target-shift-target_cpu=$1-target_vendor=$2-shift; shift-# Remember, the first character of IFS is used to create $*,-# except with old shells:-target_os=$*-IFS=$ac_save_IFS-case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac---# The aliases save the names the user supplied, while $host etc.-# will get canonicalized.-test -n "$target_alias" &&- test "$program_prefix$program_suffix$program_transform_name" = \- NONENONEs,x,x, &&- program_prefix=${target_alias}--case $target_os in #(- *-android*) :- ;; #(- *) :- for ac_func in telldir seekdir-do :- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1-_ACEOF--fi-done- ;;-esac--for ac_func in _NSGetEnviron-do :- ac_fn_c_check_func "$LINENO" "_NSGetEnviron" "ac_cv_func__NSGetEnviron"-if test "x$ac_cv_func__NSGetEnviron" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE__NSGETENVIRON 1-_ACEOF--fi-done---ac_fn_c_check_decl "$LINENO" "execvpe" "ac_cv_have_decl_execvpe" "$ac_includes_default"-if test "x$ac_cv_have_decl_execvpe" = xyes; then :- ac_have_decl=1-else- ac_have_decl=0-fi--cat >>confdefs.h <<_ACEOF-#define HAVE_DECL_EXECVPE $ac_have_decl-_ACEOF--for ac_func in execvpe-do :- ac_fn_c_check_func "$LINENO" "execvpe" "ac_cv_func_execvpe"-if test "x$ac_cv_func_execvpe" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_EXECVPE 1-_ACEOF--fi-done---ac_fn_c_check_member "$LINENO" "struct stat" "st_atim" "ac_cv_member_struct_stat_st_atim" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_atim" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_ATIM 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim" "ac_cv_member_struct_stat_st_mtim" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_mtim" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_MTIM 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_ctim" "ac_cv_member_struct_stat_st_ctim" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_ctim" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_CTIM 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec" "ac_cv_member_struct_stat_st_atimespec" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_atimespec" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_ATIMESPEC 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimespec" "ac_cv_member_struct_stat_st_mtimespec" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_mtimespec" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_MTIMESPEC 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_ctimespec" "ac_cv_member_struct_stat_st_ctimespec" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_ctimespec" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_CTIMESPEC 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_atimensec" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimensec" "ac_cv_member_struct_stat_st_mtimensec" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_mtimensec" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_ctimensec" "ac_cv_member_struct_stat_st_ctimensec" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_ctimensec" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_CTIMENSEC 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_atime_n" "ac_cv_member_struct_stat_st_atime_n" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_atime_n" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_ATIME_N 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_mtime_n" "ac_cv_member_struct_stat_st_mtime_n" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_mtime_n" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_MTIME_N 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_ctime_n" "ac_cv_member_struct_stat_st_ctime_n" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_ctime_n" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_CTIME_N 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_uatime" "ac_cv_member_struct_stat_st_uatime" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_uatime" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_UATIME 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_umtime" "ac_cv_member_struct_stat_st_umtime" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_umtime" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_UMTIME 1-_ACEOF---fi--ac_fn_c_check_member "$LINENO" "struct stat" "st_uctime" "ac_cv_member_struct_stat_st_uctime" "$ac_includes_default"-if test "x$ac_cv_member_struct_stat_st_uctime" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_STAT_ST_UCTIME 1-_ACEOF---fi---ac_fn_c_check_member "$LINENO" "struct passwd" "pw_gecos" "ac_cv_member_struct_passwd_pw_gecos" "#include <pwd.h>-"-if test "x$ac_cv_member_struct_passwd_pw_gecos" = xyes; then :--else--$as_echo "#define HAVE_NO_PASSWD_PW_GECOS /**/" >>confdefs.h--fi---# Functions for changing file timestamps-for ac_func in utimensat futimens-do :- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1-_ACEOF--fi-done--for ac_func in lutimes futimes-do :- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1-_ACEOF--fi-done---# Additional temp functions-# We explicilty check for android, as the check AC_CHECK_FUNCS performs returns "yes" for mkstemps-# when targetting android. See similar conditionals for seekdir and telldir.-case $target_os in #(- *-android*) :- for ac_func in mkdtemp-do :- ac_fn_c_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp"-if test "x$ac_cv_func_mkdtemp" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_MKDTEMP 1-_ACEOF--fi-done- ;; #(- *) :- for ac_func in mkstemps mkdtemp-do :- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1-_ACEOF--fi-done- ;;-esac--# Functions for file synchronization and allocation control-for ac_func in fsync-do :- ac_fn_c_check_func "$LINENO" "fsync" "ac_cv_func_fsync"-if test "x$ac_cv_func_fsync" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_FSYNC 1-_ACEOF--fi-done---# On OSX linking against 'fdatasync' succeeds, but that doesn't pick-# the expected the POSIX 'fdatasync' function. So make sure that we-# also have a function declaration in scope, in addition to being able-# to link against 'fdatasync'.-ac_fn_c_check_decl "$LINENO" "fdatasync" "ac_cv_have_decl_fdatasync" "$ac_includes_default"-if test "x$ac_cv_have_decl_fdatasync" = xyes; then :- ac_have_decl=1-else- ac_have_decl=0-fi--cat >>confdefs.h <<_ACEOF-#define HAVE_DECL_FDATASYNC $ac_have_decl-_ACEOF-if test $ac_have_decl = 1; then :- for ac_func in fdatasync-do :- ac_fn_c_check_func "$LINENO" "fdatasync" "ac_cv_func_fdatasync"-if test "x$ac_cv_func_fdatasync" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_FDATASYNC 1-_ACEOF--fi-done--fi----for ac_func in posix_fadvise posix_fallocate-do :- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1-_ACEOF--fi-done---# Some termios(3) functions known to be missing sometimes (see also #55)-ac_fn_c_check_decl "$LINENO" "tcdrain" "ac_cv_have_decl_tcdrain" "$ac_includes_default-#ifdef HAVE_TERMIOS_H-#include <termios.h>-#endif--"-if test "x$ac_cv_have_decl_tcdrain" = xyes; then :- ac_have_decl=1-else- ac_have_decl=0-fi--cat >>confdefs.h <<_ACEOF-#define HAVE_DECL_TCDRAIN $ac_have_decl-_ACEOF-if test $ac_have_decl = 1; then :--$as_echo "#define HAVE_TCDRAIN 1" >>confdefs.h--fi---ac_fn_c_check_decl "$LINENO" "ctermid" "ac_cv_have_decl_ctermid" "$ac_includes_default-#ifdef HAVE_TERMIOS_H-#include <termios.h>-#endif--"-if test "x$ac_cv_have_decl_ctermid" = xyes; then :- ac_have_decl=1-else- ac_have_decl=0-fi--cat >>confdefs.h <<_ACEOF-#define HAVE_DECL_CTERMID $ac_have_decl-_ACEOF-if test $ac_have_decl = 1; then :--$as_echo "#define HAVE_CTERMID 1" >>confdefs.h--fi---# Avoid adding rt if absent or unneeded-# shm_open needs -lrt on linux-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing shm_open" >&5-$as_echo_n "checking for library containing shm_open... " >&6; }-if ${ac_cv_search_shm_open+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_func_search_save_LIBS=$LIBS-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char shm_open ();-int-main ()-{-return shm_open ();- ;- return 0;-}-_ACEOF-for ac_lib in '' rt; do- if test -z "$ac_lib"; then- ac_res="none required"- else- ac_res=-l$ac_lib- LIBS="-l$ac_lib $ac_func_search_save_LIBS"- fi- if ac_fn_c_try_link "$LINENO"; then :- ac_cv_search_shm_open=$ac_res-fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext- if ${ac_cv_search_shm_open+:} false; then :- break-fi-done-if ${ac_cv_search_shm_open+:} false; then :--else- ac_cv_search_shm_open=no-fi-rm conftest.$ac_ext-LIBS=$ac_func_search_save_LIBS-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_shm_open" >&5-$as_echo "$ac_cv_search_shm_open" >&6; }-ac_res=$ac_cv_search_shm_open-if test "$ac_res" != no; then :- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"- for ac_func in shm_open shm_unlink-do :- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1-_ACEOF--fi-done--fi--if test "x$ac_cv_search_shm_open" = x-lrt; then :- EXTRA_LIBS="$EXTRA_LIBS rt"-fi--for fp_const_name in SIGABRT SIGALRM SIGBUS SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2 SIGPOLL SIGPROF SIGSYS SIGTRAP SIGURG SIGVTALRM SIGXCPU SIGXFSZ SIG_BLOCK SIG_SETMASK SIG_UNBLOCK SIGINFO SIGWINCH-do-as_fp_Cache=`$as_echo "fp_cv_const_$fp_const_name" | $as_tr_sh`-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking value of $fp_const_name" >&5-$as_echo_n "checking value of $fp_const_name... " >&6; }-if eval \${$as_fp_Cache+:} false; then :- $as_echo_n "(cached) " >&6-else- if ac_fn_c_compute_int "$LINENO" "$fp_const_name" "fp_check_const_result" "-#if HAVE_SIGNAL_H-#include <signal.h>-#endif-"; then :--else- fp_check_const_result='-1'-fi---eval "$as_fp_Cache=\$fp_check_const_result"-fi-eval ac_res=\$$as_fp_Cache- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }-cat >>confdefs.h <<_ACEOF-#define `$as_echo "CONST_$fp_const_name" | $as_tr_cpp` `eval 'as_val=${'$as_fp_Cache'};$as_echo "$as_val"'`-_ACEOF--done---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _SC_GETGR_R_SIZE_MAX" >&5-$as_echo_n "checking for _SC_GETGR_R_SIZE_MAX... " >&6; }-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--#include <unistd.h>-#ifdef _SC_GETGR_R_SIZE_MAX-we_have_that_sysconf_thing-#endif--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "we_have_that_sysconf_thing" >/dev/null 2>&1; then :- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }--$as_echo "#define HAVE_SC_GETGR_R_SIZE_MAX 1" >>confdefs.h--else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi-rm -f conftest*---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _SC_GETPW_R_SIZE_MAX" >&5-$as_echo_n "checking for _SC_GETPW_R_SIZE_MAX... " >&6; }-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--#include <unistd.h>-#ifdef _SC_GETPW_R_SIZE_MAX-we_have_that_sysconf_thing-#endif--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "we_have_that_sysconf_thing" >/dev/null 2>&1; then :- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }--$as_echo "#define HAVE_SC_GETPW_R_SIZE_MAX 1" >>confdefs.h--else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi-rm -f conftest*----### On some systems usleep has no return value. If it does have one,-### we'd like to return it; otherwise, we'll fake it.-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of usleep" >&5-$as_echo_n "checking return type of usleep... " >&6; }-if ${fptools_cv_func_usleep_return_type+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <unistd.h>--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "void[ ]+usleep" >/dev/null 2>&1; then :- fptools_cv_func_usleep_return_type=void-else- fptools_cv_func_usleep_return_type=int-fi-rm -f conftest*--fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_func_usleep_return_type" >&5-$as_echo "$fptools_cv_func_usleep_return_type" >&6; }-case "$fptools_cv_func_usleep_return_type" in- "void" )--$as_echo "#define USLEEP_RETURNS_VOID 1" >>confdefs.h-- ;;-esac--### POSIX.1003.1 unsetenv returns 0 or -1 (EINVAL), but older implementations-### in common use return void.-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of unsetenv" >&5-$as_echo_n "checking return type of unsetenv... " >&6; }-if ${fptools_cv_func_unsetenv_return_type+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <stdlib.h>--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "void[ ]+unsetenv" >/dev/null 2>&1; then :- fptools_cv_func_unsetenv_return_type=void-else- fptools_cv_func_unsetenv_return_type=int-fi-rm -f conftest*--fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_func_unsetenv_return_type" >&5-$as_echo "$fptools_cv_func_unsetenv_return_type" >&6; }-case "$fptools_cv_func_unsetenv_return_type" in- "void" )--$as_echo "#define UNSETENV_RETURNS_VOID 1" >>confdefs.h-- ;;-esac--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RTLD_NEXT from dlfcn.h" >&5-$as_echo_n "checking for RTLD_NEXT from dlfcn.h... " >&6; }-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-- #include <dlfcn.h>- #ifdef RTLD_NEXT- yes- #endif--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "yes" >/dev/null 2>&1; then :-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }--$as_echo "#define HAVE_RTLDNEXT 1" >>confdefs.h---else-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }--fi-rm -f conftest*---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RTLD_DEFAULT from dlfcn.h" >&5-$as_echo_n "checking for RTLD_DEFAULT from dlfcn.h... " >&6; }-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-- #include <dlfcn.h>- #ifdef RTLD_DEFAULT- yes- #endif--_ACEOF-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |- $EGREP "yes" >/dev/null 2>&1; then :-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }--$as_echo "#define HAVE_RTLDDEFAULT 1" >>confdefs.h---else-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }--fi-rm -f conftest*---for ac_func in openpty-do :- ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty"-if test "x$ac_cv_func_openpty" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_OPENPTY 1-_ACEOF--else- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5-$as_echo_n "checking for openpty in -lutil... " >&6; }-if ${ac_cv_lib_util_openpty+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_check_lib_save_LIBS=$LIBS-LIBS="-lutil $LIBS"-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char openpty ();-int-main ()-{-return openpty ();- ;- return 0;-}-_ACEOF-if ac_fn_c_try_link "$LINENO"; then :- ac_cv_lib_util_openpty=yes-else- ac_cv_lib_util_openpty=no-fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext conftest.$ac_ext-LIBS=$ac_check_lib_save_LIBS-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5-$as_echo "$ac_cv_lib_util_openpty" >&6; }-if test "x$ac_cv_lib_util_openpty" = xyes; then :- $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h- EXTRA_LIBS="$EXTRA_LIBS util"-else- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lbsd" >&5-$as_echo_n "checking for openpty in -lbsd... " >&6; }-if ${ac_cv_lib_bsd_openpty+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_check_lib_save_LIBS=$LIBS-LIBS="-lbsd $LIBS"-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char openpty ();-int-main ()-{-return openpty ();- ;- return 0;-}-_ACEOF-if ac_fn_c_try_link "$LINENO"; then :- ac_cv_lib_bsd_openpty=yes-else- ac_cv_lib_bsd_openpty=no-fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext conftest.$ac_ext-LIBS=$ac_check_lib_save_LIBS-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_openpty" >&5-$as_echo "$ac_cv_lib_bsd_openpty" >&6; }-if test "x$ac_cv_lib_bsd_openpty" = xyes; then :- $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h- EXTRA_LIBS="$EXTRA_LIBS bsd"-fi---fi---fi-done---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5-$as_echo_n "checking for /dev/ptmx... " >&6; }-if test -r /dev/ptmx-then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }--$as_echo "#define HAVE_DEV_PTMX 1" >>confdefs.h--else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5-$as_echo_n "checking for /dev/ptc... " >&6; }-if test -r /dev/ptc-then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }--$as_echo "#define HAVE_DEV_PTC 1" >>confdefs.h--else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi--# Avoid adding dl if absent or unneeded-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5-$as_echo_n "checking for library containing dlopen... " >&6; }-if ${ac_cv_search_dlopen+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_func_search_save_LIBS=$LIBS-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char dlopen ();-int-main ()-{-return dlopen ();- ;- return 0;-}-_ACEOF-for ac_lib in '' dl; do- if test -z "$ac_lib"; then- ac_res="none required"- else- ac_res=-l$ac_lib- LIBS="-l$ac_lib $ac_func_search_save_LIBS"- fi- if ac_fn_c_try_link "$LINENO"; then :- ac_cv_search_dlopen=$ac_res-fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext- if ${ac_cv_search_dlopen+:} false; then :- break-fi-done-if ${ac_cv_search_dlopen+:} false; then :--else- ac_cv_search_dlopen=no-fi-rm conftest.$ac_ext-LIBS=$ac_func_search_save_LIBS-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5-$as_echo "$ac_cv_search_dlopen" >&6; }-ac_res=$ac_cv_search_dlopen-if test "$ac_res" != no; then :- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"- EXTRA_LIBS="$EXTRA_LIBS $ac_lib"-fi---# -{l,}pthread goo---{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_close" >&5-$as_echo_n "checking for library containing sem_close... " >&6; }-if ${ac_cv_search_sem_close+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_func_search_save_LIBS=$LIBS-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char sem_close ();-int-main ()-{-return sem_close ();- ;- return 0;-}-_ACEOF-for ac_lib in '' pthread; do- if test -z "$ac_lib"; then- ac_res="none required"- else- ac_res=-l$ac_lib- LIBS="-l$ac_lib $ac_func_search_save_LIBS"- fi- if ac_fn_c_try_link "$LINENO"; then :- ac_cv_search_sem_close=$ac_res-fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext- if ${ac_cv_search_sem_close+:} false; then :- break-fi-done-if ${ac_cv_search_sem_close+:} false; then :--else- ac_cv_search_sem_close=no-fi-rm conftest.$ac_ext-LIBS=$ac_func_search_save_LIBS-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sem_close" >&5-$as_echo "$ac_cv_search_sem_close" >&6; }-ac_res=$ac_cv_search_sem_close-if test "$ac_res" != no; then :- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"- EXTRA_LIBS="$EXTRA_LIBS $ac_lib"-else- { $as_echo "$as_me:${as_lineno-$LINENO}: Not found" >&5-$as_echo "$as_me: Not found" >&6;}-fi----ac_config_files="$ac_config_files unix.buildinfo"---cat >confcache <<\_ACEOF-# This file is a shell script that caches the results of configure-# tests run on this system so they can be shared between configure-# scripts and configure runs, see configure's option --config-cache.-# It is not useful on other systems. If it contains results you don't-# want to keep, you may remove or edit it.-#-# config.status only pays attention to the cache file if you give it-# the --recheck option to rerun configure.-#-# `ac_cv_env_foo' variables (set or unset) will be overridden when-# loading this file, other *unset* `ac_cv_foo' will be assigned the-# following values.--_ACEOF--# The following way of writing the cache mishandles newlines in values,-# but we know of no workaround that is simple, portable, and efficient.-# So, we kill variables containing newlines.-# Ultrix sh set writes to stderr and can't be redirected directly,-# and sets the high bit in the cache file unless we assign to the vars.-(- for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do- eval ac_val=\$$ac_var- case $ac_val in #(- *${as_nl}*)- case $ac_var in #(- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;- esac- case $ac_var in #(- _ | IFS | as_nl) ;; #(- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(- *) { eval $ac_var=; unset $ac_var;} ;;- esac ;;- esac- done-- (set) 2>&1 |- case $as_nl`(ac_space=' '; set) 2>&1` in #(- *${as_nl}ac_space=\ *)- # `set' does not quote correctly, so add quotes: double-quote- # substitution turns \\\\ into \\, and sed turns \\ into \.- sed -n \- "s/'/'\\\\''/g;- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"- ;; #(- *)- # `set' quotes correctly as required by POSIX, so do not add quotes.- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"- ;;- esac |- sort-) |- sed '- /^ac_cv_env_/b end- t clear- :clear- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/- t end- s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/- :end' >>confcache-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else- if test -w "$cache_file"; then- if test "x$cache_file" != "x/dev/null"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5-$as_echo "$as_me: updating cache $cache_file" >&6;}- if test ! -f "$cache_file" || test -h "$cache_file"; then- cat confcache >"$cache_file"- else- case $cache_file in #(- */* | ?:*)- mv -f confcache "$cache_file"$$ &&- mv -f "$cache_file"$$ "$cache_file" ;; #(- *)- mv -f confcache "$cache_file" ;;- esac- fi- fi- else- { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5-$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}- fi-fi-rm -f confcache--test "x$prefix" = xNONE && prefix=$ac_default_prefix-# Let make expand exec_prefix.-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'--DEFS=-DHAVE_CONFIG_H--ac_libobjs=-ac_ltlibobjs=-U=-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue- # 1. Remove the extension, and $U if already installed.- ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'- ac_i=`$as_echo "$ac_i" | sed "$ac_script"`- # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR- # will be set to the directory where LIBOBJS objects are built.- as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"- as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'-done-LIBOBJS=$ac_libobjs--LTLIBOBJS=$ac_ltlibobjs----: "${CONFIG_STATUS=./config.status}"-ac_write_fail=0-ac_clean_files_save=$ac_clean_files-ac_clean_files="$ac_clean_files $CONFIG_STATUS"-{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}-as_write_fail=0-cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1-#! $SHELL-# Generated by $as_me.-# Run this file to recreate the current configuration.-# Compiler output produced by configure, useful for debugging-# configure, is in config.log if it exists.--debug=false-ac_cs_recheck=false-ac_cs_silent=false--SHELL=\${CONFIG_SHELL-$SHELL}-export SHELL-_ASEOF-cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1-## -------------------- ##-## M4sh Initialization. ##-## -------------------- ##--# Be more Bourne compatible-DUALCASE=1; export DUALCASE # for MKS sh-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :- emulate sh- NULLCMD=:- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which- # is contrary to our usage. Disable this feature.- alias -g '${1+"$@"}'='"$@"'- setopt NO_GLOB_SUBST-else- case `(set -o) 2>/dev/null` in #(- *posix*) :- set -o posix ;; #(- *) :- ;;-esac-fi---as_nl='-'-export as_nl-# Printing a long string crashes Solaris 7 /usr/bin/printf.-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo-# Prefer a ksh shell builtin over an external printf program on Solaris,-# but without wasting forks for bash or zsh.-if test -z "$BASH_VERSION$ZSH_VERSION" \- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then- as_echo='print -r --'- as_echo_n='print -rn --'-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then- as_echo='printf %s\n'- as_echo_n='printf %s'-else- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'- as_echo_n='/usr/ucb/echo -n'- else- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'- as_echo_n_body='eval- arg=$1;- case $arg in #(- *"$as_nl"*)- expr "X$arg" : "X\\(.*\\)$as_nl";- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;- esac;- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"- '- export as_echo_n_body- as_echo_n='sh -c $as_echo_n_body as_echo'- fi- export as_echo_body- as_echo='sh -c $as_echo_body as_echo'-fi--# The user is always right.-if test "${PATH_SEPARATOR+set}" != set; then- PATH_SEPARATOR=:- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||- PATH_SEPARATOR=';'- }-fi---# IFS-# We need space, tab and new line, in precisely that order. Quoting is-# there to prevent editors from complaining about space-tab.-# (If _AS_PATH_WALK were called with IFS unset, it would disable word-# splitting by setting IFS to empty value.)-IFS=" "" $as_nl"--# Find who we are. Look in the path if we contain no directory separator.-as_myself=-case $0 in #((- *[\\/]* ) as_myself=$0 ;;- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR-for as_dir in $PATH-do- IFS=$as_save_IFS- test -z "$as_dir" && as_dir=.- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break- done-IFS=$as_save_IFS-- ;;-esac-# We did not find ourselves, most probably we were run as `sh COMMAND'-# in which case we are not to be found in the path.-if test "x$as_myself" = x; then- as_myself=$0-fi-if test ! -f "$as_myself"; then- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2- exit 1-fi--# Unset variables that we do not need and which cause bugs (e.g. in-# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"-# suppresses any "Segmentation fault" message there. '((' could-# trigger a bug in pdksh 5.2.14.-for as_var in BASH_ENV ENV MAIL MAILPATH-do eval test x\${$as_var+set} = xset \- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :-done-PS1='$ '-PS2='> '-PS4='+ '--# NLS nuisances.-LC_ALL=C-export LC_ALL-LANGUAGE=C-export LANGUAGE--# CDPATH.-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH---# as_fn_error STATUS ERROR [LINENO LOG_FD]-# -----------------------------------------# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the-# script with STATUS, using 1 if that was 0.-as_fn_error ()-{- as_status=$1; test $as_status -eq 0 && as_status=1- if test "$4"; then- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4- fi- $as_echo "$as_me: error: $2" >&2- as_fn_exit $as_status-} # as_fn_error---# as_fn_set_status STATUS-# ------------------------# Set $? to STATUS, without forking.-as_fn_set_status ()-{- return $1-} # as_fn_set_status--# as_fn_exit STATUS-# ------------------# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.-as_fn_exit ()-{- set +e- as_fn_set_status $1- exit $1-} # as_fn_exit--# as_fn_unset VAR-# ----------------# Portably unset VAR.-as_fn_unset ()-{- { eval $1=; unset $1;}-}-as_unset=as_fn_unset-# as_fn_append VAR VALUE-# -----------------------# Append the text in VALUE to the end of the definition contained in VAR. Take-# advantage of any shell optimizations that allow amortized linear growth over-# repeated appends, instead of the typical quadratic growth present in naive-# implementations.-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :- eval 'as_fn_append ()- {- eval $1+=\$2- }'-else- as_fn_append ()- {- eval $1=\$$1\$2- }-fi # as_fn_append--# as_fn_arith ARG...-# -------------------# Perform arithmetic evaluation on the ARGs, and store the result in the-# global $as_val. Take advantage of shells that can avoid forks. The arguments-# must be portable across $(()) and expr.-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :- eval 'as_fn_arith ()- {- as_val=$(( $* ))- }'-else- as_fn_arith ()- {- as_val=`expr "$@" || test $? -eq 1`- }-fi # as_fn_arith---if expr a : '\(a\)' >/dev/null 2>&1 &&- test "X`expr 00001 : '.*\(...\)'`" = X001; then- as_expr=expr-else- as_expr=false-fi--if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then- as_basename=basename-else- as_basename=false-fi--if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then- as_dirname=dirname-else- as_dirname=false-fi--as_me=`$as_basename -- "$0" ||-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \- X"$0" : 'X\(//\)$' \| \- X"$0" : 'X\(/\)' \| . 2>/dev/null ||-$as_echo X/"$0" |- sed '/^.*\/\([^/][^/]*\)\/*$/{- s//\1/- q- }- /^X\/\(\/\/\)$/{- s//\1/- q- }- /^X\/\(\/\).*/{- s//\1/- q- }- s/.*/./; q'`--# Avoid depending upon Character Ranges.-as_cr_letters='abcdefghijklmnopqrstuvwxyz'-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'-as_cr_Letters=$as_cr_letters$as_cr_LETTERS-as_cr_digits='0123456789'-as_cr_alnum=$as_cr_Letters$as_cr_digits--ECHO_C= ECHO_N= ECHO_T=-case `echo -n x` in #(((((--n*)- case `echo 'xy\c'` in- *c*) ECHO_T=' ';; # ECHO_T is single tab character.- xy) ECHO_C='\c';;- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null- ECHO_T=' ';;- esac;;-*)- ECHO_N='-n';;-esac--rm -f conf$$ conf$$.exe conf$$.file-if test -d conf$$.dir; then- rm -f conf$$.dir/conf$$.file-else- rm -f conf$$.dir- mkdir conf$$.dir 2>/dev/null-fi-if (echo >conf$$.file) 2>/dev/null; then- if ln -s conf$$.file conf$$ 2>/dev/null; then- as_ln_s='ln -s'- # ... but there are two gotchas:- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.- # In both cases, we have to default to `cp -pR'.- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||- as_ln_s='cp -pR'- elif ln conf$$.file conf$$ 2>/dev/null; then- as_ln_s=ln- else- as_ln_s='cp -pR'- fi-else- as_ln_s='cp -pR'-fi-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file-rmdir conf$$.dir 2>/dev/null---# as_fn_mkdir_p-# --------------# Create "$as_dir" as a directory, including parents if necessary.-as_fn_mkdir_p ()-{-- case $as_dir in #(- -*) as_dir=./$as_dir;;- esac- test -d "$as_dir" || eval $as_mkdir_p || {- as_dirs=- while :; do- case $as_dir in #(- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(- *) as_qdir=$as_dir;;- esac- as_dirs="'$as_qdir' $as_dirs"- as_dir=`$as_dirname -- "$as_dir" ||-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \- X"$as_dir" : 'X\(//\)[^/]' \| \- X"$as_dir" : 'X\(//\)$' \| \- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||-$as_echo X"$as_dir" |- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{- s//\1/- q- }- /^X\(\/\/\)[^/].*/{- s//\1/- q- }- /^X\(\/\/\)$/{- s//\1/- q- }- /^X\(\/\).*/{- s//\1/- q- }- s/.*/./; q'`- test -d "$as_dir" && break- done- test -z "$as_dirs" || eval "mkdir $as_dirs"- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"---} # as_fn_mkdir_p-if mkdir -p . 2>/dev/null; then- as_mkdir_p='mkdir -p "$as_dir"'-else- test -d ./-p && rmdir ./-p- as_mkdir_p=false-fi---# as_fn_executable_p FILE-# ------------------------# Test if FILE is an executable regular file.-as_fn_executable_p ()-{- test -f "$1" && test -x "$1"-} # as_fn_executable_p-as_test_x='test -x'-as_executable_p=as_fn_executable_p--# Sed expression to map a string onto a valid CPP name.-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"--# Sed expression to map a string onto a valid variable name.-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"---exec 6>&1-## ----------------------------------- ##-## Main body of $CONFIG_STATUS script. ##-## ----------------------------------- ##-_ASEOF-test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1-# Save the log message, to keep $0 and so on meaningful, and to-# report actual input values of CONFIG_FILES etc. instead of their-# values after options handling.-ac_log="-This file was extended by Haskell unix package $as_me 2.0, which was-generated by GNU Autoconf 2.69. Invocation command line was-- CONFIG_FILES = $CONFIG_FILES- CONFIG_HEADERS = $CONFIG_HEADERS- CONFIG_LINKS = $CONFIG_LINKS- CONFIG_COMMANDS = $CONFIG_COMMANDS- $ $0 $@--on `(hostname || uname -n) 2>/dev/null | sed 1q`-"--_ACEOF--case $ac_config_files in *"-"*) set x $ac_config_files; shift; ac_config_files=$*;;-esac--case $ac_config_headers in *"-"*) set x $ac_config_headers; shift; ac_config_headers=$*;;-esac---cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1-# Files that config.status was made for.-config_files="$ac_config_files"-config_headers="$ac_config_headers"--_ACEOF--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1-ac_cs_usage="\-\`$as_me' instantiates files and other configuration actions-from templates according to the current configuration. Unless the files-and actions are specified as TAGs, all are instantiated by default.--Usage: $0 [OPTION]... [TAG]...-- -h, --help print this help, then exit- -V, --version print version number and configuration settings, then exit- --config print configuration, then exit- -q, --quiet, --silent- do not print progress messages- -d, --debug don't remove temporary files- --recheck update $as_me by reconfiguring in the same conditions- --file=FILE[:TEMPLATE]- instantiate the configuration file FILE- --header=FILE[:TEMPLATE]- instantiate the configuration header FILE--Configuration files:-$config_files--Configuration headers:-$config_headers--Report bugs to <libraries@haskell.org>."--_ACEOF-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1-ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"-ac_cs_version="\\-Haskell unix package config.status 2.0-configured by $0, generated by GNU Autoconf 2.69,- with options \\"\$ac_cs_config\\"--Copyright (C) 2012 Free Software Foundation, Inc.-This config.status script is free software; the Free Software Foundation-gives unlimited permission to copy, distribute and modify it."--ac_pwd='$ac_pwd'-srcdir='$srcdir'-test -n "\$AWK" || AWK=awk-_ACEOF--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1-# The default lists apply if the user does not specify any file.-ac_need_defaults=:-while test $# != 0-do- case $1 in- --*=?*)- ac_option=`expr "X$1" : 'X\([^=]*\)='`- ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`- ac_shift=:- ;;- --*=)- ac_option=`expr "X$1" : 'X\([^=]*\)='`- ac_optarg=- ac_shift=:- ;;- *)- ac_option=$1- ac_optarg=$2- ac_shift=shift- ;;- esac-- case $ac_option in- # Handling of the options.- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)- ac_cs_recheck=: ;;- --version | --versio | --versi | --vers | --ver | --ve | --v | -V )- $as_echo "$ac_cs_version"; exit ;;- --config | --confi | --conf | --con | --co | --c )- $as_echo "$ac_cs_config"; exit ;;- --debug | --debu | --deb | --de | --d | -d )- debug=: ;;- --file | --fil | --fi | --f )- $ac_shift- case $ac_optarg in- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;- '') as_fn_error $? "missing file argument" ;;- esac- as_fn_append CONFIG_FILES " '$ac_optarg'"- ac_need_defaults=false;;- --header | --heade | --head | --hea )- $ac_shift- case $ac_optarg in- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;- esac- as_fn_append CONFIG_HEADERS " '$ac_optarg'"- ac_need_defaults=false;;- --he | --h)- # Conflict between --help and --header- as_fn_error $? "ambiguous option: \`$1'-Try \`$0 --help' for more information.";;- --help | --hel | -h )- $as_echo "$ac_cs_usage"; exit ;;- -q | -quiet | --quiet | --quie | --qui | --qu | --q \- | -silent | --silent | --silen | --sile | --sil | --si | --s)- ac_cs_silent=: ;;-- # This is an error.- -*) as_fn_error $? "unrecognized option: \`$1'-Try \`$0 --help' for more information." ;;-- *) as_fn_append ac_config_targets " $1"- ac_need_defaults=false ;;-- esac- shift-done--ac_configure_extra_args=--if $ac_cs_silent; then- exec 6>/dev/null- ac_configure_extra_args="$ac_configure_extra_args --silent"-fi--_ACEOF-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1-if \$ac_cs_recheck; then- set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion- shift- \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6- CONFIG_SHELL='$SHELL'- export CONFIG_SHELL- exec "\$@"-fi--_ACEOF-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1-exec 5>>config.log-{- echo- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX-## Running $as_me. ##-_ASBOX- $as_echo "$ac_log"-} >&5--_ACEOF-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1-_ACEOF--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1--# Handling of arguments.-for ac_config_target in $ac_config_targets-do- case $ac_config_target in- "include/HsUnixConfig.h") CONFIG_HEADERS="$CONFIG_HEADERS include/HsUnixConfig.h" ;;- "unix.buildinfo") CONFIG_FILES="$CONFIG_FILES unix.buildinfo" ;;-- *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;- esac-done---# If the user did not use the arguments to specify the items to instantiate,-# then the envvar interface is used. Set only those that are not.-# We use the long form for the default assignment because of an extremely-# bizarre bug on SunOS 4.1.3.-if $ac_need_defaults; then- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files- test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers-fi--# Have a temporary directory for convenience. Make it in the build tree-# simply because there is no reason against having it here, and in addition,-# creating and moving files from /tmp can sometimes cause problems.-# Hook for its removal unless debugging.-# Note that there is a small window in which the directory will not be cleaned:-# after its creation but before its name has been assigned to `$tmp'.-$debug ||-{- tmp= ac_tmp=- trap 'exit_status=$?- : "${ac_tmp:=$tmp}"- { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status-' 0- trap 'as_fn_exit 1' 1 2 13 15-}-# Create a (secure) tmp directory for tmp files.--{- tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&- test -d "$tmp"-} ||-{- tmp=./conf$$-$RANDOM- (umask 077 && mkdir "$tmp")-} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5-ac_tmp=$tmp--# Set up the scripts for CONFIG_FILES section.-# No need to generate them if there are no CONFIG_FILES.-# This happens for instance with `./config.status config.h'.-if test -n "$CONFIG_FILES"; then---ac_cr=`echo X | tr X '\015'`-# On cygwin, bash can eat \r inside `` if the user requested igncr.-# But we know of no other shell where ac_cr would be empty at this-# point, so we can use a bashism as a fallback.-if test "x$ac_cr" = x; then- eval ac_cr=\$\'\\r\'-fi-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then- ac_cs_awk_cr='\\r'-else- ac_cs_awk_cr=$ac_cr-fi--echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&-_ACEOF---{- echo "cat >conf$$subs.awk <<_ACEOF" &&- echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&- echo "_ACEOF"-} >conf$$subs.sh ||- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5-ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`-ac_delim='%!_!# '-for ac_last_try in false false false false false :; do- . ./conf$$subs.sh ||- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5-- ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`- if test $ac_delim_n = $ac_delim_num; then- break- elif $ac_last_try; then- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5- else- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "- fi-done-rm -f conf$$subs.sh--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1-cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&-_ACEOF-sed -n '-h-s/^/S["/; s/!.*/"]=/-p-g-s/^[^!]*!//-:repl-t repl-s/'"$ac_delim"'$//-t delim-:nl-h-s/\(.\{148\}\)..*/\1/-t more1-s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/-p-n-b repl-:more1-s/["\\]/\\&/g; s/^/"/; s/$/"\\/-p-g-s/.\{148\}//-t nl-:delim-h-s/\(.\{148\}\)..*/\1/-t more2-s/["\\]/\\&/g; s/^/"/; s/$/"/-p-b-:more2-s/["\\]/\\&/g; s/^/"/; s/$/"\\/-p-g-s/.\{148\}//-t delim-' <conf$$subs.awk | sed '-/^[^""]/{- N- s/\n//-}-' >>$CONFIG_STATUS || ac_write_fail=1-rm -f conf$$subs.awk-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1-_ACAWK-cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&- for (key in S) S_is_set[key] = 1- FS = ""--}-{- line = $ 0- nfields = split(line, field, "@")- substed = 0- len = length(field[1])- for (i = 2; i < nfields; i++) {- key = field[i]- keylen = length(key)- if (S_is_set[key]) {- value = S[key]- line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)- len += length(value) + length(field[++i])- substed = 1- } else- len += 1 + keylen- }-- print line-}--_ACAWK-_ACEOF-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then- sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"-else- cat-fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \- || as_fn_error $? "could not setup config files machinery" "$LINENO" 5-_ACEOF--# VPATH may cause trouble with some makes, so we remove sole $(srcdir),-# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and-# trailing colons and then remove the whole line if VPATH becomes empty-# (actually we leave an empty line to preserve line numbers).-if test "x$srcdir" = x.; then- ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{-h-s///-s/^/:/-s/[ ]*$/:/-s/:\$(srcdir):/:/g-s/:\${srcdir}:/:/g-s/:@srcdir@:/:/g-s/^:*//-s/:*$//-x-s/\(=[ ]*\).*/\1/-G-s/\n//-s/^[^=]*=[ ]*$//-}'-fi--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1-fi # test -n "$CONFIG_FILES"--# Set up the scripts for CONFIG_HEADERS section.-# No need to generate them if there are no CONFIG_HEADERS.-# This happens for instance with `./config.status Makefile'.-if test -n "$CONFIG_HEADERS"; then-cat >"$ac_tmp/defines.awk" <<\_ACAWK ||-BEGIN {-_ACEOF--# Transform confdefs.h into an awk script `defines.awk', embedded as-# here-document in config.status, that substitutes the proper values into-# config.h.in to produce config.h.--# Create a delimiter string that does not exist in confdefs.h, to ease-# handling of long lines.-ac_delim='%!_!# '-for ac_last_try in false false :; do- ac_tt=`sed -n "/$ac_delim/p" confdefs.h`- if test -z "$ac_tt"; then- break- elif $ac_last_try; then- as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5- else- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "- fi-done--# For the awk script, D is an array of macro values keyed by name,-# likewise P contains macro parameters if any. Preserve backslash-# newline sequences.--ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*-sed -n '-s/.\{148\}/&'"$ac_delim"'/g-t rset-:rset-s/^[ ]*#[ ]*define[ ][ ]*/ /-t def-d-:def-s/\\$//-t bsnl-s/["\\]/\\&/g-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\-D["\1"]=" \3"/p-s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p-d-:bsnl-s/["\\]/\\&/g-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\-D["\1"]=" \3\\\\\\n"\\/p-t cont-s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p-t cont-d-:cont-n-s/.\{148\}/&'"$ac_delim"'/g-t clear-:clear-s/\\$//-t bsnlc-s/["\\]/\\&/g; s/^/"/; s/$/"/p-d-:bsnlc-s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p-b cont-' <confdefs.h | sed '-s/'"$ac_delim"'/"\\\-"/g' >>$CONFIG_STATUS || ac_write_fail=1--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1- for (key in D) D_is_set[key] = 1- FS = ""-}-/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {- line = \$ 0- split(line, arg, " ")- if (arg[1] == "#") {- defundef = arg[2]- mac1 = arg[3]- } else {- defundef = substr(arg[1], 2)- mac1 = arg[2]- }- split(mac1, mac2, "(") #)- macro = mac2[1]- prefix = substr(line, 1, index(line, defundef) - 1)- if (D_is_set[macro]) {- # Preserve the white space surrounding the "#".- print prefix "define", macro P[macro] D[macro]- next- } else {- # Replace #undef with comments. This is necessary, for example,- # in the case of _POSIX_SOURCE, which is predefined and required- # on some systems where configure will not decide to define it.- if (defundef == "undef") {- print "/*", prefix defundef, macro, "*/"- next- }- }-}-{ print }-_ACAWK-_ACEOF-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1- as_fn_error $? "could not setup config headers machinery" "$LINENO" 5-fi # test -n "$CONFIG_HEADERS"---eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "-shift-for ac_tag-do- case $ac_tag in- :[FHLC]) ac_mode=$ac_tag; continue;;- esac- case $ac_mode$ac_tag in- :[FHL]*:*);;- :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;- :[FH]-) ac_tag=-:-;;- :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;- esac- ac_save_IFS=$IFS- IFS=:- set x $ac_tag- IFS=$ac_save_IFS- shift- ac_file=$1- shift-- case $ac_mode in- :L) ac_source=$1;;- :[FH])- ac_file_inputs=- for ac_f- do- case $ac_f in- -) ac_f="$ac_tmp/stdin";;- *) # Look for the file first in the build tree, then in the source tree- # (if the path is not absolute). The absolute path cannot be DOS-style,- # because $ac_f cannot contain `:'.- test -f "$ac_f" ||- case $ac_f in- [\\/$]*) false;;- *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;- esac ||- as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;- esac- case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac- as_fn_append ac_file_inputs " '$ac_f'"- done-- # Let's still pretend it is `configure' which instantiates (i.e., don't- # use $as_me), people would be surprised to read:- # /* config.h. Generated by config.status. */- configure_input='Generated from '`- $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'- `' by configure.'- if test x"$ac_file" != x-; then- configure_input="$ac_file. $configure_input"- { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5-$as_echo "$as_me: creating $ac_file" >&6;}- fi- # Neutralize special characters interpreted by sed in replacement strings.- case $configure_input in #(- *\&* | *\|* | *\\* )- ac_sed_conf_input=`$as_echo "$configure_input" |- sed 's/[\\\\&|]/\\\\&/g'`;; #(- *) ac_sed_conf_input=$configure_input;;- esac-- case $ac_tag in- *:-:* | *:-) cat >"$ac_tmp/stdin" \- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;- esac- ;;- esac-- ac_dir=`$as_dirname -- "$ac_file" ||-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \- X"$ac_file" : 'X\(//\)[^/]' \| \- X"$ac_file" : 'X\(//\)$' \| \- X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||-$as_echo X"$ac_file" |- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{- s//\1/- q- }- /^X\(\/\/\)[^/].*/{- s//\1/- q- }- /^X\(\/\/\)$/{- s//\1/- q- }- /^X\(\/\).*/{- s//\1/- q- }- s/.*/./; q'`- as_dir="$ac_dir"; as_fn_mkdir_p- ac_builddir=.--case "$ac_dir" in-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;-*)- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`- # A ".." for each directory in $ac_dir_suffix.- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`- case $ac_top_builddir_sub in- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;- esac ;;-esac-ac_abs_top_builddir=$ac_pwd-ac_abs_builddir=$ac_pwd$ac_dir_suffix-# for backward compatibility:-ac_top_builddir=$ac_top_build_prefix--case $srcdir in- .) # We are building in place.- ac_srcdir=.- ac_top_srcdir=$ac_top_builddir_sub- ac_abs_top_srcdir=$ac_pwd ;;- [\\/]* | ?:[\\/]* ) # Absolute name.- ac_srcdir=$srcdir$ac_dir_suffix;- ac_top_srcdir=$srcdir- ac_abs_top_srcdir=$srcdir ;;- *) # Relative name.- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix- ac_top_srcdir=$ac_top_build_prefix$srcdir- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;-esac-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix--- case $ac_mode in- :F)- #- # CONFIG_FILE- #--_ACEOF--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1-# If the template does not know about datarootdir, expand it.-# FIXME: This hack should be removed a few years after 2.60.-ac_datarootdir_hack=; ac_datarootdir_seen=-ac_sed_dataroot='-/datarootdir/ {- p- q-}-/@datadir@/p-/@docdir@/p-/@infodir@/p-/@localedir@/p-/@mandir@/p'-case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in-*datarootdir*) ac_datarootdir_seen=yes;;-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}-_ACEOF-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1- ac_datarootdir_hack='- s&@datadir@&$datadir&g- s&@docdir@&$docdir&g- s&@infodir@&$infodir&g- s&@localedir@&$localedir&g- s&@mandir@&$mandir&g- s&\\\${datarootdir}&$datarootdir&g' ;;-esac-_ACEOF--# Neutralize VPATH when `$srcdir' = `.'.-# Shell code in configure.ac might set extrasub.-# FIXME: do we really want to maintain this feature?-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1-ac_sed_extra="$ac_vpsub-$extrasub-_ACEOF-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1-:t-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b-s|@configure_input@|$ac_sed_conf_input|;t t-s&@top_builddir@&$ac_top_builddir_sub&;t t-s&@top_build_prefix@&$ac_top_build_prefix&;t t-s&@srcdir@&$ac_srcdir&;t t-s&@abs_srcdir@&$ac_abs_srcdir&;t t-s&@top_srcdir@&$ac_top_srcdir&;t t-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t-s&@builddir@&$ac_builddir&;t t-s&@abs_builddir@&$ac_abs_builddir&;t t-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t-$ac_datarootdir_hack-"-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \- >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5--test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&- { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \- "$ac_tmp/out"`; test -z "$ac_out"; } &&- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'-which seems to be undefined. Please make sure it is defined" >&5-$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'-which seems to be undefined. Please make sure it is defined" >&2;}-- rm -f "$ac_tmp/stdin"- case $ac_file in- -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;- *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;- esac \- || as_fn_error $? "could not create $ac_file" "$LINENO" 5- ;;- :H)- #- # CONFIG_HEADER- #- if test x"$ac_file" != x-; then- {- $as_echo "/* $configure_input */" \- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"- } >"$ac_tmp/config.h" \- || as_fn_error $? "could not create $ac_file" "$LINENO" 5- if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then- { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5-$as_echo "$as_me: $ac_file is unchanged" >&6;}- else- rm -f "$ac_file"- mv "$ac_tmp/config.h" "$ac_file" \- || as_fn_error $? "could not create $ac_file" "$LINENO" 5- fi- else- $as_echo "/* $configure_input */" \- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \- || as_fn_error $? "could not create -" "$LINENO" 5- fi- ;;--- esac--done # for ac_tag---as_fn_exit 0-_ACEOF-ac_clean_files=$ac_clean_files_save--test $ac_write_fail = 0 ||- as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5---# configure is writing to config.log, and then calls config.status.-# config.status does its own redirection, appending to config.log.-# Unfortunately, on DOS this fails, as config.log is still kept open-# by configure, so config.status won't be able to write to it; its-# output is simply discarded. So we exec the FD to /dev/null,-# effectively closing config.log, so it can be properly (re)opened and-# appended to by config.status. When coming back to configure, we-# need to make the FD available again.-if test "$no_create" != yes; then- ac_cs_success=:- ac_config_status_args=- test "$silent" = yes &&- ac_config_status_args="$ac_config_status_args --quiet"- exec 5>/dev/null- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false- exec 5>>config.log- # Use ||, not &&, to avoid exiting from the if with $? = 1, which- # would make configure fail if this is the last instruction.- $ac_cs_success || as_fn_exit 1-fi-if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5-$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}-fi+# Generated by GNU Autoconf 2.72 for Haskell unix package 2.0.+#+# Report bugs to <libraries@haskell.org>.+#+#+# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation,+# Inc.+#+#+# This configure script is free software; the Free Software Foundation+# gives unlimited permission to copy, distribute and modify it.+## -------------------- ##+## M4sh Initialization. ##+## -------------------- ##++# Be more Bourne compatible+DUALCASE=1; export DUALCASE # for MKS sh+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1+then :+ emulate sh+ NULLCMD=:+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which+ # is contrary to our usage. Disable this feature.+ alias -g '${1+"$@"}'='"$@"'+ setopt NO_GLOB_SUBST+else case e in #(+ e) case `(set -o) 2>/dev/null` in #(+ *posix*) :+ set -o posix ;; #(+ *) :+ ;;+esac ;;+esac+fi++++# Reset variables that may have inherited troublesome values from+# the environment.++# IFS needs to be set, to space, tab, and newline, in precisely that order.+# (If _AS_PATH_WALK were called with IFS unset, it would have the+# side effect of setting IFS to empty, thus disabling word splitting.)+# Quoting is to prevent editors from complaining about space-tab.+as_nl='+'+export as_nl+IFS=" "" $as_nl"++PS1='$ '+PS2='> '+PS4='+ '++# Ensure predictable behavior from utilities with locale-dependent output.+LC_ALL=C+export LC_ALL+LANGUAGE=C+export LANGUAGE++# We cannot yet rely on "unset" to work, but we need these variables+# to be unset--not just set to an empty or harmless value--now, to+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct+# also avoids known problems related to "unset" and subshell syntax+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH+do eval test \${$as_var+y} \+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :+done++# Ensure that fds 0, 1, and 2 are open.+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi+if (exec 3>&2) ; then :; else exec 2>/dev/null; fi++# The user is always right.+if ${PATH_SEPARATOR+false} :; then+ PATH_SEPARATOR=:+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||+ PATH_SEPARATOR=';'+ }+fi+++# Find who we are. Look in the path if we contain no directory separator.+as_myself=+case $0 in #((+ *[\\/]* ) as_myself=$0 ;;+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ test -r "$as_dir$0" && as_myself=$as_dir$0 && break+ done+IFS=$as_save_IFS++ ;;+esac+# We did not find ourselves, most probably we were run as 'sh COMMAND'+# in which case we are not to be found in the path.+if test "x$as_myself" = x; then+ as_myself=$0+fi+if test ! -f "$as_myself"; then+ printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2+ exit 1+fi+++# Use a proper internal environment variable to ensure we don't fall+ # into an infinite loop, continuously re-executing ourselves.+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then+ _as_can_reexec=no; export _as_can_reexec;+ # We cannot yet assume a decent shell, so we have to provide a+# neutralization value for shells without unset; and this also+# works around shells that cannot unset nonexistent variables.+# Preserve -v and -x to the replacement shell.+BASH_ENV=/dev/null+ENV=/dev/null+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV+case $- in # ((((+ *v*x* | *x*v* ) as_opts=-vx ;;+ *v* ) as_opts=-v ;;+ *x* ) as_opts=-x ;;+ * ) as_opts= ;;+esac+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}+# Admittedly, this is quite paranoid, since all the known shells bail+# out after a failed 'exec'.+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2+exit 255+ fi+ # We don't want this to propagate to other subprocesses.+ { _as_can_reexec=; unset _as_can_reexec;}+if test "x$CONFIG_SHELL" = x; then+ as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1+then :+ emulate sh+ NULLCMD=:+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which+ # is contrary to our usage. Disable this feature.+ alias -g '\${1+\"\$@\"}'='\"\$@\"'+ setopt NO_GLOB_SUBST+else case e in #(+ e) case \`(set -o) 2>/dev/null\` in #(+ *posix*) :+ set -o posix ;; #(+ *) :+ ;;+esac ;;+esac+fi+"+ as_required="as_fn_return () { (exit \$1); }+as_fn_success () { as_fn_return 0; }+as_fn_failure () { as_fn_return 1; }+as_fn_ret_success () { return 0; }+as_fn_ret_failure () { return 1; }++exitcode=0+as_fn_success || { exitcode=1; echo as_fn_success failed.; }+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }+if ( set x; as_fn_ret_success y && test x = \"\$1\" )+then :++else case e in #(+ e) exitcode=1; echo positional parameters were not saved. ;;+esac+fi+test x\$exitcode = x0 || exit 1+blah=\$(echo \$(echo blah))+test x\"\$blah\" = xblah || exit 1+test -x / || exit 1"+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1+test \$(( 1 + 1 )) = 2 || exit 1"+ if (eval "$as_required") 2>/dev/null+then :+ as_have_required=yes+else case e in #(+ e) as_have_required=no ;;+esac+fi+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null+then :++else case e in #(+ e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+as_found=false+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ as_found=:+ case $as_dir in #(+ /*)+ for as_base in sh bash ksh sh5; do+ # Try only shells that exist, to save several forks.+ as_shell=$as_dir$as_base+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&+ as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null+then :+ CONFIG_SHELL=$as_shell as_have_required=yes+ if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null+then :+ break 2+fi+fi+ done;;+ esac+ as_found=false+done+IFS=$as_save_IFS+if $as_found+then :++else case e in #(+ e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&+ as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null+then :+ CONFIG_SHELL=$SHELL as_have_required=yes+fi ;;+esac+fi+++ if test "x$CONFIG_SHELL" != x+then :+ export CONFIG_SHELL+ # We cannot yet assume a decent shell, so we have to provide a+# neutralization value for shells without unset; and this also+# works around shells that cannot unset nonexistent variables.+# Preserve -v and -x to the replacement shell.+BASH_ENV=/dev/null+ENV=/dev/null+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV+case $- in # ((((+ *v*x* | *x*v* ) as_opts=-vx ;;+ *v* ) as_opts=-v ;;+ *x* ) as_opts=-x ;;+ * ) as_opts= ;;+esac+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}+# Admittedly, this is quite paranoid, since all the known shells bail+# out after a failed 'exec'.+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2+exit 255+fi++ if test x$as_have_required = xno+then :+ printf "%s\n" "$0: This script requires a shell more modern than all"+ printf "%s\n" "$0: the shells that I found on your system."+ if test ${ZSH_VERSION+y} ; then+ printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should"+ printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later."+ else+ printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and+$0: libraries@haskell.org about your system, including any+$0: error possibly output before this message. Then install+$0: a modern shell, or manually run the script under such a+$0: shell if you do have one."+ fi+ exit 1+fi ;;+esac+fi+fi+SHELL=${CONFIG_SHELL-/bin/sh}+export SHELL+# Unset more variables known to interfere with behavior of common tools.+CLICOLOR_FORCE= GREP_OPTIONS=+unset CLICOLOR_FORCE GREP_OPTIONS++## --------------------- ##+## M4sh Shell Functions. ##+## --------------------- ##+# as_fn_unset VAR+# ---------------+# Portably unset VAR.+as_fn_unset ()+{+ { eval $1=; unset $1;}+}+as_unset=as_fn_unset+++# as_fn_set_status STATUS+# -----------------------+# Set $? to STATUS, without forking.+as_fn_set_status ()+{+ return $1+} # as_fn_set_status++# as_fn_exit STATUS+# -----------------+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.+as_fn_exit ()+{+ set +e+ as_fn_set_status $1+ exit $1+} # as_fn_exit++# as_fn_mkdir_p+# -------------+# Create "$as_dir" as a directory, including parents if necessary.+as_fn_mkdir_p ()+{++ case $as_dir in #(+ -*) as_dir=./$as_dir;;+ esac+ test -d "$as_dir" || eval $as_mkdir_p || {+ as_dirs=+ while :; do+ case $as_dir in #(+ *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(+ *) as_qdir=$as_dir;;+ esac+ as_dirs="'$as_qdir' $as_dirs"+ as_dir=`$as_dirname -- "$as_dir" ||+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$as_dir" : 'X\(//\)[^/]' \| \+ X"$as_dir" : 'X\(//\)$' \| \+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||+printf "%s\n" X"$as_dir" |+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{+ s//\1/+ q+ }+ /^X\(\/\/\)[^/].*/{+ s//\1/+ q+ }+ /^X\(\/\/\)$/{+ s//\1/+ q+ }+ /^X\(\/\).*/{+ s//\1/+ q+ }+ s/.*/./; q'`+ test -d "$as_dir" && break+ done+ test -z "$as_dirs" || eval "mkdir $as_dirs"+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"+++} # as_fn_mkdir_p++# as_fn_executable_p FILE+# -----------------------+# Test if FILE is an executable regular file.+as_fn_executable_p ()+{+ test -f "$1" && test -x "$1"+} # as_fn_executable_p+# as_fn_append VAR VALUE+# ----------------------+# Append the text in VALUE to the end of the definition contained in VAR. Take+# advantage of any shell optimizations that allow amortized linear growth over+# repeated appends, instead of the typical quadratic growth present in naive+# implementations.+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null+then :+ eval 'as_fn_append ()+ {+ eval $1+=\$2+ }'+else case e in #(+ e) as_fn_append ()+ {+ eval $1=\$$1\$2+ } ;;+esac+fi # as_fn_append++# as_fn_arith ARG...+# ------------------+# Perform arithmetic evaluation on the ARGs, and store the result in the+# global $as_val. Take advantage of shells that can avoid forks. The arguments+# must be portable across $(()) and expr.+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null+then :+ eval 'as_fn_arith ()+ {+ as_val=$(( $* ))+ }'+else case e in #(+ e) as_fn_arith ()+ {+ as_val=`expr "$@" || test $? -eq 1`+ } ;;+esac+fi # as_fn_arith+++# as_fn_error STATUS ERROR [LINENO LOG_FD]+# ----------------------------------------+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the+# script with STATUS, using 1 if that was 0.+as_fn_error ()+{+ as_status=$1; test $as_status -eq 0 && as_status=1+ if test "$4"; then+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4+ fi+ printf "%s\n" "$as_me: error: $2" >&2+ as_fn_exit $as_status+} # as_fn_error++if expr a : '\(a\)' >/dev/null 2>&1 &&+ test "X`expr 00001 : '.*\(...\)'`" = X001; then+ as_expr=expr+else+ as_expr=false+fi++if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then+ as_basename=basename+else+ as_basename=false+fi++if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then+ as_dirname=dirname+else+ as_dirname=false+fi++as_me=`$as_basename -- "$0" ||+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \+ X"$0" : 'X\(//\)$' \| \+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||+printf "%s\n" X/"$0" |+ sed '/^.*\/\([^/][^/]*\)\/*$/{+ s//\1/+ q+ }+ /^X\/\(\/\/\)$/{+ s//\1/+ q+ }+ /^X\/\(\/\).*/{+ s//\1/+ q+ }+ s/.*/./; q'`++# Avoid depending upon Character Ranges.+as_cr_letters='abcdefghijklmnopqrstuvwxyz'+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'+as_cr_Letters=$as_cr_letters$as_cr_LETTERS+as_cr_digits='0123456789'+as_cr_alnum=$as_cr_Letters$as_cr_digits+++ as_lineno_1=$LINENO as_lineno_1a=$LINENO+ as_lineno_2=$LINENO as_lineno_2a=$LINENO+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)+ sed -n '+ p+ /[$]LINENO/=+ ' <$as_myself |+ sed '+ t clear+ :clear+ s/[$]LINENO.*/&-/+ t lineno+ b+ :lineno+ N+ :loop+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/+ t loop+ s/-\n.*//+ ' >$as_me.lineno &&+ chmod +x "$as_me.lineno" ||+ { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }++ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have+ # already done that, so ensure we don't try to do so again and fall+ # in an infinite loop. This has already happened in practice.+ _as_can_reexec=no; export _as_can_reexec+ # Don't try to exec as it changes $[0], causing all sort of problems+ # (the dirname of $[0] is not the place where we might find the+ # original and so on. Autoconf is especially sensitive to this).+ . "./$as_me.lineno"+ # Exit status is that of the last command.+ exit+}+++# Determine whether it's possible to make 'echo' print without a newline.+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed+# for compatibility with existing Makefiles.+ECHO_C= ECHO_N= ECHO_T=+case `echo -n x` in #(((((+-n*)+ case `echo 'xy\c'` in+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.+ xy) ECHO_C='\c';;+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null+ ECHO_T=' ';;+ esac;;+*)+ ECHO_N='-n';;+esac++# For backward compatibility with old third-party macros, we provide+# the shell variables $as_echo and $as_echo_n. New code should use+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.+as_echo='printf %s\n'+as_echo_n='printf %s'++rm -f conf$$ conf$$.exe conf$$.file+if test -d conf$$.dir; then+ rm -f conf$$.dir/conf$$.file+else+ rm -f conf$$.dir+ mkdir conf$$.dir 2>/dev/null+fi+if (echo >conf$$.file) 2>/dev/null; then+ if ln -s conf$$.file conf$$ 2>/dev/null; then+ as_ln_s='ln -s'+ # ... but there are two gotchas:+ # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail.+ # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable.+ # In both cases, we have to default to 'cp -pR'.+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||+ as_ln_s='cp -pR'+ elif ln conf$$.file conf$$ 2>/dev/null; then+ as_ln_s=ln+ else+ as_ln_s='cp -pR'+ fi+else+ as_ln_s='cp -pR'+fi+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file+rmdir conf$$.dir 2>/dev/null++if mkdir -p . 2>/dev/null; then+ as_mkdir_p='mkdir -p "$as_dir"'+else+ test -d ./-p && rmdir ./-p+ as_mkdir_p=false+fi++as_test_x='test -x'+as_executable_p=as_fn_executable_p++# Sed expression to map a string onto a valid CPP name.+as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"+as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated++# Sed expression to map a string onto a valid variable name.+as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g"+as_tr_sh="eval sed '$as_sed_sh'" # deprecated+++test -n "$DJDIR" || exec 7<&0 </dev/null+exec 6>&1++# Name of the host.+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,+# so uname gets run too.+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`++#+# Initializations.+#+ac_default_prefix=/usr/local+ac_clean_files=+ac_config_libobj_dir=.+LIBOBJS=+cross_compiling=no+subdirs=+MFLAGS=+MAKEFLAGS=++# Identity of this package.+PACKAGE_NAME='Haskell unix package'+PACKAGE_TARNAME='unix'+PACKAGE_VERSION='2.0'+PACKAGE_STRING='Haskell unix package 2.0'+PACKAGE_BUGREPORT='libraries@haskell.org'+PACKAGE_URL=''++ac_unique_file="include/HsUnix.h"+# Factoring default headers for most tests.+ac_includes_default="\+#include <stddef.h>+#ifdef HAVE_STDIO_H+# include <stdio.h>+#endif+#ifdef HAVE_STDLIB_H+# include <stdlib.h>+#endif+#ifdef HAVE_STRING_H+# include <string.h>+#endif+#ifdef HAVE_INTTYPES_H+# include <inttypes.h>+#endif+#ifdef HAVE_STDINT_H+# include <stdint.h>+#endif+#ifdef HAVE_STRINGS_H+# include <strings.h>+#endif+#ifdef HAVE_SYS_TYPES_H+# include <sys/types.h>+#endif+#ifdef HAVE_SYS_STAT_H+# include <sys/stat.h>+#endif+#ifdef HAVE_UNISTD_H+# include <unistd.h>+#endif"++ac_header_c_list=+enable_year2038=no+ac_subst_vars='LTLIBOBJS+LIBOBJS+EXTRA_LIBS+target_os+target_vendor+target_cpu+target+host_os+host_vendor+host_cpu+host+build_os+build_vendor+build_cpu+build+CPP+OBJEXT+EXEEXT+ac_ct_CC+CPPFLAGS+LDFLAGS+CFLAGS+CC+target_alias+host_alias+build_alias+LIBS+ECHO_T+ECHO_N+ECHO_C+DEFS+mandir+localedir+libdir+psdir+pdfdir+dvidir+htmldir+infodir+docdir+oldincludedir+includedir+runstatedir+localstatedir+sharedstatedir+sysconfdir+datadir+datarootdir+libexecdir+sbindir+bindir+program_transform_name+prefix+exec_prefix+PACKAGE_URL+PACKAGE_BUGREPORT+PACKAGE_STRING+PACKAGE_VERSION+PACKAGE_TARNAME+PACKAGE_NAME+PATH_SEPARATOR+SHELL'+ac_subst_files=''+ac_user_opts='+enable_option_checking+enable_largefile+enable_year2038+'+ ac_precious_vars='build_alias+host_alias+target_alias+CC+CFLAGS+LDFLAGS+LIBS+CPPFLAGS+CPP'+++# Initialize some variables set by options.+ac_init_help=+ac_init_version=false+ac_unrecognized_opts=+ac_unrecognized_sep=+# The variables have the same names as the options, with+# dashes changed to underlines.+cache_file=/dev/null+exec_prefix=NONE+no_create=+no_recursion=+prefix=NONE+program_prefix=NONE+program_suffix=NONE+program_transform_name=s,x,x,+silent=+site=+srcdir=+verbose=+x_includes=NONE+x_libraries=NONE++# Installation directory options.+# These are left unexpanded so users can "make install exec_prefix=/foo"+# and all the variables that are supposed to be based on exec_prefix+# by default will actually change.+# Use braces instead of parens because sh, perl, etc. also accept them.+# (The list follows the same order as the GNU Coding Standards.)+bindir='${exec_prefix}/bin'+sbindir='${exec_prefix}/sbin'+libexecdir='${exec_prefix}/libexec'+datarootdir='${prefix}/share'+datadir='${datarootdir}'+sysconfdir='${prefix}/etc'+sharedstatedir='${prefix}/com'+localstatedir='${prefix}/var'+runstatedir='${localstatedir}/run'+includedir='${prefix}/include'+oldincludedir='/usr/include'+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'+infodir='${datarootdir}/info'+htmldir='${docdir}'+dvidir='${docdir}'+pdfdir='${docdir}'+psdir='${docdir}'+libdir='${exec_prefix}/lib'+localedir='${datarootdir}/locale'+mandir='${datarootdir}/man'++ac_prev=+ac_dashdash=+for ac_option+do+ # If the previous option needs an argument, assign it.+ if test -n "$ac_prev"; then+ eval $ac_prev=\$ac_option+ ac_prev=+ continue+ fi++ case $ac_option in+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;+ *=) ac_optarg= ;;+ *) ac_optarg=yes ;;+ esac++ case $ac_dashdash$ac_option in+ --)+ ac_dashdash=yes ;;++ -bindir | --bindir | --bindi | --bind | --bin | --bi)+ ac_prev=bindir ;;+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)+ bindir=$ac_optarg ;;++ -build | --build | --buil | --bui | --bu)+ ac_prev=build_alias ;;+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)+ build_alias=$ac_optarg ;;++ -cache-file | --cache-file | --cache-fil | --cache-fi \+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)+ ac_prev=cache_file ;;+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)+ cache_file=$ac_optarg ;;++ --config-cache | -C)+ cache_file=config.cache ;;++ -datadir | --datadir | --datadi | --datad)+ ac_prev=datadir ;;+ -datadir=* | --datadir=* | --datadi=* | --datad=*)+ datadir=$ac_optarg ;;++ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \+ | --dataroo | --dataro | --datar)+ ac_prev=datarootdir ;;+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)+ datarootdir=$ac_optarg ;;++ -disable-* | --disable-*)+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&+ as_fn_error $? "invalid feature name: '$ac_useropt'"+ ac_useropt_orig=$ac_useropt+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`+ case $ac_user_opts in+ *"+"enable_$ac_useropt"+"*) ;;+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"+ ac_unrecognized_sep=', ';;+ esac+ eval enable_$ac_useropt=no ;;++ -docdir | --docdir | --docdi | --doc | --do)+ ac_prev=docdir ;;+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)+ docdir=$ac_optarg ;;++ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)+ ac_prev=dvidir ;;+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)+ dvidir=$ac_optarg ;;++ -enable-* | --enable-*)+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&+ as_fn_error $? "invalid feature name: '$ac_useropt'"+ ac_useropt_orig=$ac_useropt+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`+ case $ac_user_opts in+ *"+"enable_$ac_useropt"+"*) ;;+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"+ ac_unrecognized_sep=', ';;+ esac+ eval enable_$ac_useropt=\$ac_optarg ;;++ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \+ | --exec | --exe | --ex)+ ac_prev=exec_prefix ;;+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \+ | --exec=* | --exe=* | --ex=*)+ exec_prefix=$ac_optarg ;;++ -gas | --gas | --ga | --g)+ # Obsolete; use --with-gas.+ with_gas=yes ;;++ -help | --help | --hel | --he | -h)+ ac_init_help=long ;;+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)+ ac_init_help=recursive ;;+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)+ ac_init_help=short ;;++ -host | --host | --hos | --ho)+ ac_prev=host_alias ;;+ -host=* | --host=* | --hos=* | --ho=*)+ host_alias=$ac_optarg ;;++ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)+ ac_prev=htmldir ;;+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \+ | --ht=*)+ htmldir=$ac_optarg ;;++ -includedir | --includedir | --includedi | --included | --include \+ | --includ | --inclu | --incl | --inc)+ ac_prev=includedir ;;+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \+ | --includ=* | --inclu=* | --incl=* | --inc=*)+ includedir=$ac_optarg ;;++ -infodir | --infodir | --infodi | --infod | --info | --inf)+ ac_prev=infodir ;;+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)+ infodir=$ac_optarg ;;++ -libdir | --libdir | --libdi | --libd)+ ac_prev=libdir ;;+ -libdir=* | --libdir=* | --libdi=* | --libd=*)+ libdir=$ac_optarg ;;++ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \+ | --libexe | --libex | --libe)+ ac_prev=libexecdir ;;+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \+ | --libexe=* | --libex=* | --libe=*)+ libexecdir=$ac_optarg ;;++ -localedir | --localedir | --localedi | --localed | --locale)+ ac_prev=localedir ;;+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)+ localedir=$ac_optarg ;;++ -localstatedir | --localstatedir | --localstatedi | --localstated \+ | --localstate | --localstat | --localsta | --localst | --locals)+ ac_prev=localstatedir ;;+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)+ localstatedir=$ac_optarg ;;++ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)+ ac_prev=mandir ;;+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)+ mandir=$ac_optarg ;;++ -nfp | --nfp | --nf)+ # Obsolete; use --without-fp.+ with_fp=no ;;++ -no-create | --no-create | --no-creat | --no-crea | --no-cre \+ | --no-cr | --no-c | -n)+ no_create=yes ;;++ -no-recursion | --no-recursion | --no-recursio | --no-recursi \+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)+ no_recursion=yes ;;++ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \+ | --oldin | --oldi | --old | --ol | --o)+ ac_prev=oldincludedir ;;+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)+ oldincludedir=$ac_optarg ;;++ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)+ ac_prev=prefix ;;+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)+ prefix=$ac_optarg ;;++ -program-prefix | --program-prefix | --program-prefi | --program-pref \+ | --program-pre | --program-pr | --program-p)+ ac_prev=program_prefix ;;+ -program-prefix=* | --program-prefix=* | --program-prefi=* \+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)+ program_prefix=$ac_optarg ;;++ -program-suffix | --program-suffix | --program-suffi | --program-suff \+ | --program-suf | --program-su | --program-s)+ ac_prev=program_suffix ;;+ -program-suffix=* | --program-suffix=* | --program-suffi=* \+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)+ program_suffix=$ac_optarg ;;++ -program-transform-name | --program-transform-name \+ | --program-transform-nam | --program-transform-na \+ | --program-transform-n | --program-transform- \+ | --program-transform | --program-transfor \+ | --program-transfo | --program-transf \+ | --program-trans | --program-tran \+ | --progr-tra | --program-tr | --program-t)+ ac_prev=program_transform_name ;;+ -program-transform-name=* | --program-transform-name=* \+ | --program-transform-nam=* | --program-transform-na=* \+ | --program-transform-n=* | --program-transform-=* \+ | --program-transform=* | --program-transfor=* \+ | --program-transfo=* | --program-transf=* \+ | --program-trans=* | --program-tran=* \+ | --progr-tra=* | --program-tr=* | --program-t=*)+ program_transform_name=$ac_optarg ;;++ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)+ ac_prev=pdfdir ;;+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)+ pdfdir=$ac_optarg ;;++ -psdir | --psdir | --psdi | --psd | --ps)+ ac_prev=psdir ;;+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)+ psdir=$ac_optarg ;;++ -q | -quiet | --quiet | --quie | --qui | --qu | --q \+ | -silent | --silent | --silen | --sile | --sil)+ silent=yes ;;++ -runstatedir | --runstatedir | --runstatedi | --runstated \+ | --runstate | --runstat | --runsta | --runst | --runs \+ | --run | --ru | --r)+ ac_prev=runstatedir ;;+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \+ | --run=* | --ru=* | --r=*)+ runstatedir=$ac_optarg ;;++ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)+ ac_prev=sbindir ;;+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \+ | --sbi=* | --sb=*)+ sbindir=$ac_optarg ;;++ -sharedstatedir | --sharedstatedir | --sharedstatedi \+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \+ | --sharedst | --shareds | --shared | --share | --shar \+ | --sha | --sh)+ ac_prev=sharedstatedir ;;+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \+ | --sha=* | --sh=*)+ sharedstatedir=$ac_optarg ;;++ -site | --site | --sit)+ ac_prev=site ;;+ -site=* | --site=* | --sit=*)+ site=$ac_optarg ;;++ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)+ ac_prev=srcdir ;;+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)+ srcdir=$ac_optarg ;;++ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \+ | --syscon | --sysco | --sysc | --sys | --sy)+ ac_prev=sysconfdir ;;+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)+ sysconfdir=$ac_optarg ;;++ -target | --target | --targe | --targ | --tar | --ta | --t)+ ac_prev=target_alias ;;+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)+ target_alias=$ac_optarg ;;++ -v | -verbose | --verbose | --verbos | --verbo | --verb)+ verbose=yes ;;++ -version | --version | --versio | --versi | --vers | -V)+ ac_init_version=: ;;++ -with-* | --with-*)+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&+ as_fn_error $? "invalid package name: '$ac_useropt'"+ ac_useropt_orig=$ac_useropt+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`+ case $ac_user_opts in+ *"+"with_$ac_useropt"+"*) ;;+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"+ ac_unrecognized_sep=', ';;+ esac+ eval with_$ac_useropt=\$ac_optarg ;;++ -without-* | --without-*)+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&+ as_fn_error $? "invalid package name: '$ac_useropt'"+ ac_useropt_orig=$ac_useropt+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`+ case $ac_user_opts in+ *"+"with_$ac_useropt"+"*) ;;+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"+ ac_unrecognized_sep=', ';;+ esac+ eval with_$ac_useropt=no ;;++ --x)+ # Obsolete; use --with-x.+ with_x=yes ;;++ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \+ | --x-incl | --x-inc | --x-in | --x-i)+ ac_prev=x_includes ;;+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)+ x_includes=$ac_optarg ;;++ -x-libraries | --x-libraries | --x-librarie | --x-librari \+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)+ ac_prev=x_libraries ;;+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)+ x_libraries=$ac_optarg ;;++ -*) as_fn_error $? "unrecognized option: '$ac_option'+Try '$0 --help' for more information"+ ;;++ *=*)+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`+ # Reject names that are not valid shell variable names.+ case $ac_envvar in #(+ '' | [0-9]* | *[!_$as_cr_alnum]* )+ as_fn_error $? "invalid variable name: '$ac_envvar'" ;;+ esac+ eval $ac_envvar=\$ac_optarg+ export $ac_envvar ;;++ *)+ # FIXME: should be removed in autoconf 3.0.+ printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&+ printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"+ ;;++ esac+done++if test -n "$ac_prev"; then+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`+ as_fn_error $? "missing argument to $ac_option"+fi++if test -n "$ac_unrecognized_opts"; then+ case $enable_option_checking in+ no) ;;+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;+ *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;+ esac+fi++# Check all directory arguments for consistency.+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \+ datadir sysconfdir sharedstatedir localstatedir includedir \+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \+ libdir localedir mandir runstatedir+do+ eval ac_val=\$$ac_var+ # Remove trailing slashes.+ case $ac_val in+ */ )+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`+ eval $ac_var=\$ac_val;;+ esac+ # Be sure to have absolute directory names.+ case $ac_val in+ [\\/$]* | ?:[\\/]* ) continue;;+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;+ esac+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"+done++# There might be people who depend on the old broken behavior: '$host'+# used to hold the argument of --host etc.+# FIXME: To remove some day.+build=$build_alias+host=$host_alias+target=$target_alias++# FIXME: To remove some day.+if test "x$host_alias" != x; then+ if test "x$build_alias" = x; then+ cross_compiling=maybe+ elif test "x$build_alias" != "x$host_alias"; then+ cross_compiling=yes+ fi+fi++ac_tool_prefix=+test -n "$host_alias" && ac_tool_prefix=$host_alias-++test "$silent" = yes && exec 6>/dev/null+++ac_pwd=`pwd` && test -n "$ac_pwd" &&+ac_ls_di=`ls -di .` &&+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||+ as_fn_error $? "working directory cannot be determined"+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||+ as_fn_error $? "pwd does not report name of working directory"+++# Find the source files, if location was not specified.+if test -z "$srcdir"; then+ ac_srcdir_defaulted=yes+ # Try the directory containing this script, then the parent directory.+ ac_confdir=`$as_dirname -- "$as_myself" ||+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$as_myself" : 'X\(//\)[^/]' \| \+ X"$as_myself" : 'X\(//\)$' \| \+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||+printf "%s\n" X"$as_myself" |+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{+ s//\1/+ q+ }+ /^X\(\/\/\)[^/].*/{+ s//\1/+ q+ }+ /^X\(\/\/\)$/{+ s//\1/+ q+ }+ /^X\(\/\).*/{+ s//\1/+ q+ }+ s/.*/./; q'`+ srcdir=$ac_confdir+ if test ! -r "$srcdir/$ac_unique_file"; then+ srcdir=..+ fi+else+ ac_srcdir_defaulted=no+fi+if test ! -r "$srcdir/$ac_unique_file"; then+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"+fi+ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work"+ac_abs_confdir=`(+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"+ pwd)`+# When building in place, set srcdir=.+if test "$ac_abs_confdir" = "$ac_pwd"; then+ srcdir=.+fi+# Remove unnecessary trailing slashes from srcdir.+# Double slashes in file names in object file debugging info+# mess up M-x gdb in Emacs.+case $srcdir in+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;+esac+for ac_var in $ac_precious_vars; do+ eval ac_env_${ac_var}_set=\${${ac_var}+set}+ eval ac_env_${ac_var}_value=\$${ac_var}+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}+ eval ac_cv_env_${ac_var}_value=\$${ac_var}+done++#+# Report the --help message.+#+if test "$ac_init_help" = "long"; then+ # Omit some internal or obsolete options to make the list less imposing.+ # This message is too long to be a string in the A/UX 3.1 sh.+ cat <<_ACEOF+'configure' configures Haskell unix package 2.0 to adapt to many kinds of systems.++Usage: $0 [OPTION]... [VAR=VALUE]...++To assign environment variables (e.g., CC, CFLAGS...), specify them as+VAR=VALUE. See below for descriptions of some of the useful variables.++Defaults for the options are specified in brackets.++Configuration:+ -h, --help display this help and exit+ --help=short display options specific to this package+ --help=recursive display the short help of all the included packages+ -V, --version display version information and exit+ -q, --quiet, --silent do not print 'checking ...' messages+ --cache-file=FILE cache test results in FILE [disabled]+ -C, --config-cache alias for '--cache-file=config.cache'+ -n, --no-create do not create output files+ --srcdir=DIR find the sources in DIR [configure dir or '..']++Installation directories:+ --prefix=PREFIX install architecture-independent files in PREFIX+ [$ac_default_prefix]+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX+ [PREFIX]++By default, 'make install' will install all the files in+'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify+an installation prefix other than '$ac_default_prefix' using '--prefix',+for instance '--prefix=\$HOME'.++For better control, use the options below.++Fine tuning of the installation directories:+ --bindir=DIR user executables [EPREFIX/bin]+ --sbindir=DIR system admin executables [EPREFIX/sbin]+ --libexecdir=DIR program executables [EPREFIX/libexec]+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]+ --libdir=DIR object code libraries [EPREFIX/lib]+ --includedir=DIR C header files [PREFIX/include]+ --oldincludedir=DIR C header files for non-gcc [/usr/include]+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]+ --infodir=DIR info documentation [DATAROOTDIR/info]+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]+ --mandir=DIR man documentation [DATAROOTDIR/man]+ --docdir=DIR documentation root [DATAROOTDIR/doc/unix]+ --htmldir=DIR html documentation [DOCDIR]+ --dvidir=DIR dvi documentation [DOCDIR]+ --pdfdir=DIR pdf documentation [DOCDIR]+ --psdir=DIR ps documentation [DOCDIR]+_ACEOF++ cat <<\_ACEOF++System types:+ --build=BUILD configure for building on BUILD [guessed]+ --host=HOST cross-compile to build programs to run on HOST [BUILD]+ --target=TARGET configure for building compilers for TARGET [HOST]+_ACEOF+fi++if test -n "$ac_init_help"; then+ case $ac_init_help in+ short | recursive ) echo "Configuration of Haskell unix package 2.0:";;+ esac+ cat <<\_ACEOF++Optional Features:+ --disable-option-checking ignore unrecognized --enable/--with options+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]+ --disable-largefile omit support for large files+ --enable-year2038 support timestamps after 2038++Some influential environment variables:+ CC C compiler command+ CFLAGS C compiler flags+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a+ nonstandard directory <lib dir>+ LIBS libraries to pass to the linker, e.g. -l<library>+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if+ you have headers in a nonstandard directory <include dir>+ CPP C preprocessor++Use these variables to override the choices made by 'configure' or to help+it to find libraries and programs with nonstandard names/locations.++Report bugs to <libraries@haskell.org>.+_ACEOF+ac_status=$?+fi++if test "$ac_init_help" = "recursive"; then+ # If there are subdirs, report their specific --help.+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue+ test -d "$ac_dir" ||+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||+ continue+ ac_builddir=.++case "$ac_dir" in+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;+*)+ ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`+ # A ".." for each directory in $ac_dir_suffix.+ ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`+ case $ac_top_builddir_sub in+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;+ esac ;;+esac+ac_abs_top_builddir=$ac_pwd+ac_abs_builddir=$ac_pwd$ac_dir_suffix+# for backward compatibility:+ac_top_builddir=$ac_top_build_prefix++case $srcdir in+ .) # We are building in place.+ ac_srcdir=.+ ac_top_srcdir=$ac_top_builddir_sub+ ac_abs_top_srcdir=$ac_pwd ;;+ [\\/]* | ?:[\\/]* ) # Absolute name.+ ac_srcdir=$srcdir$ac_dir_suffix;+ ac_top_srcdir=$srcdir+ ac_abs_top_srcdir=$srcdir ;;+ *) # Relative name.+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix+ ac_top_srcdir=$ac_top_build_prefix$srcdir+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;+esac+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix++ cd "$ac_dir" || { ac_status=$?; continue; }+ # Check for configure.gnu first; this name is used for a wrapper for+ # Metaconfig's "Configure" on case-insensitive file systems.+ if test -f "$ac_srcdir/configure.gnu"; then+ echo &&+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive+ elif test -f "$ac_srcdir/configure"; then+ echo &&+ $SHELL "$ac_srcdir/configure" --help=recursive+ else+ printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2+ fi || ac_status=$?+ cd "$ac_pwd" || { ac_status=$?; break; }+ done+fi++test -n "$ac_init_help" && exit $ac_status+if $ac_init_version; then+ cat <<\_ACEOF+Haskell unix package configure 2.0+generated by GNU Autoconf 2.72++Copyright (C) 2023 Free Software Foundation, Inc.+This configure script is free software; the Free Software Foundation+gives unlimited permission to copy, distribute and modify it.+_ACEOF+ exit+fi++## ------------------------ ##+## Autoconf initialization. ##+## ------------------------ ##++# ac_fn_c_try_compile LINENO+# --------------------------+# Try to compile conftest.$ac_ext, and return whether this succeeded.+ac_fn_c_try_compile ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ rm -f conftest.$ac_objext conftest.beam+ if { { ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_compile") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ grep -v '^ *+' conftest.err >conftest.er1+ cat conftest.er1 >&5+ mv -f conftest.er1 conftest.err+ fi+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } && {+ test -z "$ac_c_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest.$ac_objext+then :+ ac_retval=0+else case e in #(+ e) printf "%s\n" "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=1 ;;+esac+fi+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_c_try_compile++# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES+# -------------------------------------------------------+# Tests whether HEADER exists and can be compiled using the include files in+# INCLUDES, setting the cache variable VAR accordingly.+ac_fn_c_check_header_compile ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5+printf %s "checking for $2... " >&6; }+if eval test \${$3+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+#include <$2>+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ eval "$3=yes"+else case e in #(+ e) eval "$3=no" ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+eval ac_res=\$$3+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+printf "%s\n" "$ac_res" >&6; }+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_c_check_header_compile++# ac_fn_c_try_link LINENO+# -----------------------+# Try to link conftest.$ac_ext, and return whether this succeeded.+ac_fn_c_try_link ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext+ if { { ac_try="$ac_link"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_link") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ grep -v '^ *+' conftest.err >conftest.er1+ cat conftest.er1 >&5+ mv -f conftest.er1 conftest.err+ fi+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } && {+ test -z "$ac_c_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest$ac_exeext && {+ test "$cross_compiling" = yes ||+ test -x conftest$ac_exeext+ }+then :+ ac_retval=0+else case e in #(+ e) printf "%s\n" "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=1 ;;+esac+fi+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would+ # interfere with the next link command; also delete a directory that is+ # left behind by Apple's compiler. We do this before executing the actions.+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_c_try_link++# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES+# ----------------------------------------------------+# Tries to find if the field MEMBER exists in type AGGR, after including+# INCLUDES, setting cache variable VAR accordingly.+ac_fn_c_check_member ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5+printf %s "checking for $2.$3... " >&6; }+if eval test \${$4+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$5+int+main (void)+{+static $2 ac_aggr;+if (ac_aggr.$3)+return 0;+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ eval "$4=yes"+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$5+int+main (void)+{+static $2 ac_aggr;+if (sizeof ac_aggr.$3)+return 0;+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ eval "$4=yes"+else case e in #(+ e) eval "$4=no" ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+eval ac_res=\$$4+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+printf "%s\n" "$ac_res" >&6; }+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_c_check_member++# ac_fn_c_try_run LINENO+# ----------------------+# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that+# executables *can* be run.+ac_fn_c_try_run ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ if { { ac_try="$ac_link"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_link") 2>&5+ ac_status=$?+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'+ { { case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_try") 2>&5+ ac_status=$?+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }; }+then :+ ac_retval=0+else case e in #(+ e) printf "%s\n" "$as_me: program exited with status $ac_status" >&5+ printf "%s\n" "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=$ac_status ;;+esac+fi+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_c_try_run++# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES+# --------------------------------------------+# Tries to find the compile-time value of EXPR in a program that includes+# INCLUDES, setting VAR accordingly. Returns whether the value could be+# computed+ac_fn_c_compute_int ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ if test "$cross_compiling" = yes; then+ # Depending upon the size, compute the lo and hi bounds.+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+int+main (void)+{+static int test_array [1 - 2 * !(($2) >= 0)];+test_array [0] = 0;+return test_array [0];++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_lo=0 ac_mid=0+ while :; do+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+int+main (void)+{+static int test_array [1 - 2 * !(($2) <= $ac_mid)];+test_array [0] = 0;+return test_array [0];++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_hi=$ac_mid; break+else case e in #(+ e) as_fn_arith $ac_mid + 1 && ac_lo=$as_val+ if test $ac_lo -le $ac_mid; then+ ac_lo= ac_hi=+ break+ fi+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+ done+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+int+main (void)+{+static int test_array [1 - 2 * !(($2) < 0)];+test_array [0] = 0;+return test_array [0];++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_hi=-1 ac_mid=-1+ while :; do+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+int+main (void)+{+static int test_array [1 - 2 * !(($2) >= $ac_mid)];+test_array [0] = 0;+return test_array [0];++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_lo=$ac_mid; break+else case e in #(+ e) as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val+ if test $ac_mid -le $ac_hi; then+ ac_lo= ac_hi=+ break+ fi+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+ done+else case e in #(+ e) ac_lo= ac_hi= ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+# Binary search between lo and hi bounds.+while test "x$ac_lo" != "x$ac_hi"; do+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+int+main (void)+{+static int test_array [1 - 2 * !(($2) <= $ac_mid)];+test_array [0] = 0;+return test_array [0];++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_hi=$ac_mid+else case e in #(+ e) as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+done+case $ac_lo in #((+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;+'') ac_retval=1 ;;+esac+ else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+static long int longval (void) { return $2; }+static unsigned long int ulongval (void) { return $2; }+#include <stdio.h>+#include <stdlib.h>+int+main (void)+{++ FILE *f = fopen ("conftest.val", "w");+ if (! f)+ return 1;+ if (($2) < 0)+ {+ long int i = longval ();+ if (i != ($2))+ return 1;+ fprintf (f, "%ld", i);+ }+ else+ {+ unsigned long int i = ulongval ();+ if (i != ($2))+ return 1;+ fprintf (f, "%lu", i);+ }+ /* Do not output a trailing newline, as this causes \r\n confusion+ on some platforms. */+ return ferror (f) || fclose (f) != 0;++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_run "$LINENO"+then :+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0+else case e in #(+ e) ac_retval=1 ;;+esac+fi+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \+ conftest.$ac_objext conftest.beam conftest.$ac_ext+rm -f conftest.val++ fi+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_c_compute_int++# ac_fn_c_check_func LINENO FUNC VAR+# ----------------------------------+# Tests whether FUNC exists, setting the cache variable VAR accordingly+ac_fn_c_check_func ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5+printf %s "checking for $2... " >&6; }+if eval test \${$3+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.+ For example, HP-UX 11i <limits.h> declares gettimeofday. */+#define $2 innocuous_$2++/* System header to define __stub macros and hopefully few prototypes,+ which can conflict with char $2 (void); below. */++#include <limits.h>+#undef $2++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply. */+#ifdef __cplusplus+extern "C"+#endif+char $2 (void);+/* The GNU C library defines this for functions which it implements+ to always fail with ENOSYS. Some functions are actually named+ something starting with __ and the normal name is an alias. */+#if defined __stub_$2 || defined __stub___$2+choke me+#endif++int+main (void)+{+return $2 ();+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_link "$LINENO"+then :+ eval "$3=yes"+else case e in #(+ e) eval "$3=no" ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam \+ conftest$ac_exeext conftest.$ac_ext ;;+esac+fi+eval ac_res=\$$3+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+printf "%s\n" "$ac_res" >&6; }+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_c_check_func++# ac_fn_c_check_type LINENO TYPE VAR INCLUDES+# -------------------------------------------+# Tests whether TYPE exists after having included INCLUDES, setting cache+# variable VAR accordingly.+ac_fn_c_check_type ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5+printf %s "checking for $2... " >&6; }+if eval test \${$3+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) eval "$3=no"+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+int+main (void)+{+if (sizeof ($2))+ return 0;+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+int+main (void)+{+if (sizeof (($2)))+ return 0;+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :++else case e in #(+ e) eval "$3=yes" ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+eval ac_res=\$$3+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+printf "%s\n" "$ac_res" >&6; }+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_c_check_type++# ac_fn_c_try_cpp LINENO+# ----------------------+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.+ac_fn_c_try_cpp ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ if { { ac_try="$ac_cpp conftest.$ac_ext"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ grep -v '^ *+' conftest.err >conftest.er1+ cat conftest.er1 >&5+ mv -f conftest.er1 conftest.err+ fi+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } > conftest.i && {+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||+ test ! -s conftest.err+ }+then :+ ac_retval=0+else case e in #(+ e) printf "%s\n" "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=1 ;;+esac+fi+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_c_try_cpp++# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR+# ------------------------------------------------------------------+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR+# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR.+ac_fn_check_decl ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ as_decl_name=`echo $2|sed 's/ *(.*//'`+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5+printf %s "checking whether $as_decl_name is declared... " >&6; }+if eval test \${$3+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`+ eval ac_save_FLAGS=\$$6+ as_fn_append $6 " $5"+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+int+main (void)+{+#ifndef $as_decl_name+#ifdef __cplusplus+ (void) $as_decl_use;+#else+ (void) $as_decl_name;+#endif+#endif++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ eval "$3=yes"+else case e in #(+ e) eval "$3=no" ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+ eval $6=\$ac_save_FLAGS+ ;;+esac+fi+eval ac_res=\$$3+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+printf "%s\n" "$ac_res" >&6; }+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_check_decl+ac_configure_args_raw=+for ac_arg+do+ case $ac_arg in+ *\'*)+ ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;+ esac+ as_fn_append ac_configure_args_raw " '$ac_arg'"+done++case $ac_configure_args_raw in+ *$as_nl*)+ ac_safe_unquote= ;;+ *)+ ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab.+ ac_unsafe_a="$ac_unsafe_z#~"+ ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g"+ ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;;+esac++cat >config.log <<_ACEOF+This file contains any messages produced by compilers while+running configure, to aid debugging if configure makes a mistake.++It was created by Haskell unix package $as_me 2.0, which was+generated by GNU Autoconf 2.72. Invocation command line was++ $ $0$ac_configure_args_raw++_ACEOF+exec 5>>config.log+{+cat <<_ASUNAME+## --------- ##+## Platform. ##+## --------- ##++hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`+uname -m = `(uname -m) 2>/dev/null || echo unknown`+uname -r = `(uname -r) 2>/dev/null || echo unknown`+uname -s = `(uname -s) 2>/dev/null || echo unknown`+uname -v = `(uname -v) 2>/dev/null || echo unknown`++/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`++/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`++_ASUNAME++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ printf "%s\n" "PATH: $as_dir"+ done+IFS=$as_save_IFS++} >&5++cat >&5 <<_ACEOF+++## ----------- ##+## Core tests. ##+## ----------- ##++_ACEOF+++# Keep a trace of the command line.+# Strip out --no-create and --no-recursion so they do not pile up.+# Strip out --silent because we don't want to record it for future runs.+# Also quote any args containing shell meta-characters.+# Make two passes to allow for proper duplicate-argument suppression.+ac_configure_args=+ac_configure_args0=+ac_configure_args1=+ac_must_keep_next=false+for ac_pass in 1 2+do+ for ac_arg+ do+ case $ac_arg in+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \+ | -silent | --silent | --silen | --sile | --sil)+ continue ;;+ *\'*)+ ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;+ esac+ case $ac_pass in+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;+ 2)+ as_fn_append ac_configure_args1 " '$ac_arg'"+ if test $ac_must_keep_next = true; then+ ac_must_keep_next=false # Got value, back to normal.+ else+ case $ac_arg in+ *=* | --config-cache | -C | -disable-* | --disable-* \+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \+ | -with-* | --with-* | -without-* | --without-* | --x)+ case "$ac_configure_args0 " in+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;+ esac+ ;;+ -* ) ac_must_keep_next=true ;;+ esac+ fi+ as_fn_append ac_configure_args " '$ac_arg'"+ ;;+ esac+ done+done+{ ac_configure_args0=; unset ac_configure_args0;}+{ ac_configure_args1=; unset ac_configure_args1;}++# When interrupted or exit'd, cleanup temporary files, and complete+# config.log. We remove comments because anyway the quotes in there+# would cause problems or look ugly.+# WARNING: Use '\'' to represent an apostrophe within the trap.+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.+trap 'exit_status=$?+ # Sanitize IFS.+ IFS=" "" $as_nl"+ # Save into config.log some information that might help in debugging.+ {+ echo++ printf "%s\n" "## ---------------- ##+## Cache variables. ##+## ---------------- ##"+ echo+ # The following way of writing the cache mishandles newlines in values,+(+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do+ eval ac_val=\$$ac_var+ case $ac_val in #(+ *${as_nl}*)+ case $ac_var in #(+ *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;+ esac+ case $ac_var in #(+ _ | IFS | as_nl) ;; #(+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(+ *) { eval $ac_var=; unset $ac_var;} ;;+ esac ;;+ esac+ done+ (set) 2>&1 |+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(+ *${as_nl}ac_space=\ *)+ sed -n \+ "s/'\''/'\''\\\\'\'''\''/g;+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"+ ;; #(+ *)+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"+ ;;+ esac |+ sort+)+ echo++ printf "%s\n" "## ----------------- ##+## Output variables. ##+## ----------------- ##"+ echo+ for ac_var in $ac_subst_vars+ do+ eval ac_val=\$$ac_var+ case $ac_val in+ *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;+ esac+ printf "%s\n" "$ac_var='\''$ac_val'\''"+ done | sort+ echo++ if test -n "$ac_subst_files"; then+ printf "%s\n" "## ------------------- ##+## File substitutions. ##+## ------------------- ##"+ echo+ for ac_var in $ac_subst_files+ do+ eval ac_val=\$$ac_var+ case $ac_val in+ *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;+ esac+ printf "%s\n" "$ac_var='\''$ac_val'\''"+ done | sort+ echo+ fi++ if test -s confdefs.h; then+ printf "%s\n" "## ----------- ##+## confdefs.h. ##+## ----------- ##"+ echo+ cat confdefs.h+ echo+ fi+ test "$ac_signal" != 0 &&+ printf "%s\n" "$as_me: caught signal $ac_signal"+ printf "%s\n" "$as_me: exit $exit_status"+ } >&5+ rm -f core *.core core.conftest.* &&+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&+ exit $exit_status+' 0+for ac_signal in 1 2 13 15; do+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal+done+ac_signal=0++# confdefs.h avoids OS command line length limits that DEFS can exceed.+rm -f -r conftest* confdefs.h++printf "%s\n" "/* confdefs.h */" > confdefs.h++# Predefined preprocessor variables.++printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h++printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h++printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h++printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h++printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h++printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h+++# Let the site file select an alternate cache file if it wants to.+# Prefer an explicitly selected file to automatically selected ones.+if test -n "$CONFIG_SITE"; then+ ac_site_files="$CONFIG_SITE"+elif test "x$prefix" != xNONE; then+ ac_site_files="$prefix/share/config.site $prefix/etc/config.site"+else+ ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"+fi++for ac_site_file in $ac_site_files+do+ case $ac_site_file in #(+ */*) :+ ;; #(+ *) :+ ac_site_file=./$ac_site_file ;;+esac+ if test -f "$ac_site_file" && test -r "$ac_site_file"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5+printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;}+ sed 's/^/| /' "$ac_site_file" >&5+ . "$ac_site_file" \+ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+as_fn_error $? "failed to load site script $ac_site_file+See 'config.log' for more details" "$LINENO" 5; }+ fi+done++if test -r "$cache_file"; then+ # Some versions of bash will fail to source /dev/null (special files+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5+printf "%s\n" "$as_me: loading cache $cache_file" >&6;}+ case $cache_file in+ [\\/]* | ?:[\\/]* ) . "$cache_file";;+ *) . "./$cache_file";;+ esac+ fi+else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5+printf "%s\n" "$as_me: creating cache $cache_file" >&6;}+ >$cache_file+fi++# Test code for whether the C compiler supports C89 (global declarations)+ac_c_conftest_c89_globals='+/* Does the compiler advertise C89 conformance?+ Do not test the value of __STDC__, because some compilers set it to 0+ while being otherwise adequately conformant. */+#if !defined __STDC__+# error "Compiler does not advertise C89 conformance"+#endif++#include <stddef.h>+#include <stdarg.h>+struct stat;+/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */+struct buf { int x; };+struct buf * (*rcsopen) (struct buf *, struct stat *, int);+static char *e (char **p, int i)+{+ return p[i];+}+static char *f (char * (*g) (char **, int), char **p, ...)+{+ char *s;+ va_list v;+ va_start (v,p);+ s = g (p, va_arg (v,int));+ va_end (v);+ return s;+}++/* C89 style stringification. */+#define noexpand_stringify(a) #a+const char *stringified = noexpand_stringify(arbitrary+token=sequence);++/* C89 style token pasting. Exercises some of the corner cases that+ e.g. old MSVC gets wrong, but not very hard. */+#define noexpand_concat(a,b) a##b+#define expand_concat(a,b) noexpand_concat(a,b)+extern int vA;+extern int vbee;+#define aye A+#define bee B+int *pvA = &expand_concat(v,aye);+int *pvbee = &noexpand_concat(v,bee);++/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has+ function prototypes and stuff, but not \xHH hex character constants.+ These do not provoke an error unfortunately, instead are silently treated+ as an "x". The following induces an error, until -std is added to get+ proper ANSI mode. Curiously \x00 != x always comes out true, for an+ array size at least. It is necessary to write \x00 == 0 to get something+ that is true only with -std. */+int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1];++/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters+ inside strings and character constants. */+#define FOO(x) '\''x'\''+int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1];++int test (int i, double x);+struct s1 {int (*f) (int a);};+struct s2 {int (*f) (double a);};+int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),+ int, int);'++# Test code for whether the C compiler supports C89 (body of main).+ac_c_conftest_c89_main='+ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);+'++# Test code for whether the C compiler supports C99 (global declarations)+ac_c_conftest_c99_globals='+/* Does the compiler advertise C99 conformance? */+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L+# error "Compiler does not advertise C99 conformance"+#endif++// See if C++-style comments work.++#include <stdbool.h>+extern int puts (const char *);+extern int printf (const char *, ...);+extern int dprintf (int, const char *, ...);+extern void *malloc (size_t);+extern void free (void *);++// Check varargs macros. These examples are taken from C99 6.10.3.5.+// dprintf is used instead of fprintf to avoid needing to declare+// FILE and stderr.+#define debug(...) dprintf (2, __VA_ARGS__)+#define showlist(...) puts (#__VA_ARGS__)+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))+static void+test_varargs_macros (void)+{+ int x = 1234;+ int y = 5678;+ debug ("Flag");+ debug ("X = %d\n", x);+ showlist (The first, second, and third items.);+ report (x>y, "x is %d but y is %d", x, y);+}++// Check long long types.+#define BIG64 18446744073709551615ull+#define BIG32 4294967295ul+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)+#if !BIG_OK+ #error "your preprocessor is broken"+#endif+#if BIG_OK+#else+ #error "your preprocessor is broken"+#endif+static long long int bignum = -9223372036854775807LL;+static unsigned long long int ubignum = BIG64;++struct incomplete_array+{+ int datasize;+ double data[];+};++struct named_init {+ int number;+ const wchar_t *name;+ double average;+};++typedef const char *ccp;++static inline int+test_restrict (ccp restrict text)+{+ // Iterate through items via the restricted pointer.+ // Also check for declarations in for loops.+ for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i)+ continue;+ return 0;+}++// Check varargs and va_copy.+static bool+test_varargs (const char *format, ...)+{+ va_list args;+ va_start (args, format);+ va_list args_copy;+ va_copy (args_copy, args);++ const char *str = "";+ int number = 0;+ float fnumber = 0;++ while (*format)+ {+ switch (*format++)+ {+ case '\''s'\'': // string+ str = va_arg (args_copy, const char *);+ break;+ case '\''d'\'': // int+ number = va_arg (args_copy, int);+ break;+ case '\''f'\'': // float+ fnumber = va_arg (args_copy, double);+ break;+ default:+ break;+ }+ }+ va_end (args_copy);+ va_end (args);++ return *str && number && fnumber;+}+'++# Test code for whether the C compiler supports C99 (body of main).+ac_c_conftest_c99_main='+ // Check bool.+ _Bool success = false;+ success |= (argc != 0);++ // Check restrict.+ if (test_restrict ("String literal") == 0)+ success = true;+ char *restrict newvar = "Another string";++ // Check varargs.+ success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234);+ test_varargs_macros ();++ // Check flexible array members.+ struct incomplete_array *ia =+ malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));+ ia->datasize = 10;+ for (int i = 0; i < ia->datasize; ++i)+ ia->data[i] = i * 1.234;+ // Work around memory leak warnings.+ free (ia);++ // Check named initializers.+ struct named_init ni = {+ .number = 34,+ .name = L"Test wide string",+ .average = 543.34343,+ };++ ni.number = 58;++ int dynamic_array[ni.number];+ dynamic_array[0] = argv[0][0];+ dynamic_array[ni.number - 1] = 543;++ // work around unused variable warnings+ ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''+ || dynamic_array[ni.number - 1] != 543);+'++# Test code for whether the C compiler supports C11 (global declarations)+ac_c_conftest_c11_globals='+/* Does the compiler advertise C11 conformance? */+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L+# error "Compiler does not advertise C11 conformance"+#endif++// Check _Alignas.+char _Alignas (double) aligned_as_double;+char _Alignas (0) no_special_alignment;+extern char aligned_as_int;+char _Alignas (0) _Alignas (int) aligned_as_int;++// Check _Alignof.+enum+{+ int_alignment = _Alignof (int),+ int_array_alignment = _Alignof (int[100]),+ char_alignment = _Alignof (char)+};+_Static_assert (0 < -_Alignof (int), "_Alignof is signed");++// Check _Noreturn.+int _Noreturn does_not_return (void) { for (;;) continue; }++// Check _Static_assert.+struct test_static_assert+{+ int x;+ _Static_assert (sizeof (int) <= sizeof (long int),+ "_Static_assert does not work in struct");+ long int y;+};++// Check UTF-8 literals.+#define u8 syntax error!+char const utf8_literal[] = u8"happens to be ASCII" "another string";++// Check duplicate typedefs.+typedef long *long_ptr;+typedef long int *long_ptr;+typedef long_ptr long_ptr;++// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.+struct anonymous+{+ union {+ struct { int i; int j; };+ struct { int k; long int l; } w;+ };+ int m;+} v1;+'++# Test code for whether the C compiler supports C11 (body of main).+ac_c_conftest_c11_main='+ _Static_assert ((offsetof (struct anonymous, i)+ == offsetof (struct anonymous, w.k)),+ "Anonymous union alignment botch");+ v1.i = 2;+ v1.w.k = 5;+ ok |= v1.i != 5;+'++# Test code for whether the C compiler supports C11 (complete).+ac_c_conftest_c11_program="${ac_c_conftest_c89_globals}+${ac_c_conftest_c99_globals}+${ac_c_conftest_c11_globals}++int+main (int argc, char **argv)+{+ int ok = 0;+ ${ac_c_conftest_c89_main}+ ${ac_c_conftest_c99_main}+ ${ac_c_conftest_c11_main}+ return ok;+}+"++# Test code for whether the C compiler supports C99 (complete).+ac_c_conftest_c99_program="${ac_c_conftest_c89_globals}+${ac_c_conftest_c99_globals}++int+main (int argc, char **argv)+{+ int ok = 0;+ ${ac_c_conftest_c89_main}+ ${ac_c_conftest_c99_main}+ return ok;+}+"++# Test code for whether the C compiler supports C89 (complete).+ac_c_conftest_c89_program="${ac_c_conftest_c89_globals}++int+main (int argc, char **argv)+{+ int ok = 0;+ ${ac_c_conftest_c89_main}+ return ok;+}+"++as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H"+as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H"+as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H"+as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H"+as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H"+as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H"+as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H"+as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H"+as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"+as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H"+as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H"++# Auxiliary files required by this configure script.+ac_aux_files="config.guess config.sub"++# Locations in which to look for auxiliary files.+ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.."++# Search for a directory containing all of the required auxiliary files,+# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates.+# If we don't find one directory that contains all the files we need,+# we report the set of missing files from the *first* directory in+# $ac_aux_dir_candidates and give up.+ac_missing_aux_files=""+ac_first_candidate=:+printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+as_found=false+for as_dir in $ac_aux_dir_candidates+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ as_found=:++ printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5+ ac_aux_dir_found=yes+ ac_install_sh=+ for ac_aux in $ac_aux_files+ do+ # As a special case, if "install-sh" is required, that requirement+ # can be satisfied by any of "install-sh", "install.sh", or "shtool",+ # and $ac_install_sh is set appropriately for whichever one is found.+ if test x"$ac_aux" = x"install-sh"+ then+ if test -f "${as_dir}install-sh"; then+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5+ ac_install_sh="${as_dir}install-sh -c"+ elif test -f "${as_dir}install.sh"; then+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5+ ac_install_sh="${as_dir}install.sh -c"+ elif test -f "${as_dir}shtool"; then+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5+ ac_install_sh="${as_dir}shtool install -c"+ else+ ac_aux_dir_found=no+ if $ac_first_candidate; then+ ac_missing_aux_files="${ac_missing_aux_files} install-sh"+ else+ break+ fi+ fi+ else+ if test -f "${as_dir}${ac_aux}"; then+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5+ else+ ac_aux_dir_found=no+ if $ac_first_candidate; then+ ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}"+ else+ break+ fi+ fi+ fi+ done+ if test "$ac_aux_dir_found" = yes; then+ ac_aux_dir="$as_dir"+ break+ fi+ ac_first_candidate=false++ as_found=false+done+IFS=$as_save_IFS+if $as_found+then :++else case e in #(+ e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;;+esac+fi+++# These three variables are undocumented and unsupported,+# and are intended to be withdrawn in a future Autoconf release.+# They can cause serious problems if a builder's source tree is in a directory+# whose full name contains unusual characters.+if test -f "${ac_aux_dir}config.guess"; then+ ac_config_guess="$SHELL ${ac_aux_dir}config.guess"+fi+if test -f "${ac_aux_dir}config.sub"; then+ ac_config_sub="$SHELL ${ac_aux_dir}config.sub"+fi+if test -f "$ac_aux_dir/configure"; then+ ac_configure="$SHELL ${ac_aux_dir}configure"+fi++# Check that the precious variables saved in the cache have kept the same+# value.+ac_cache_corrupted=false+for ac_var in $ac_precious_vars; do+ eval ac_old_set=\$ac_cv_env_${ac_var}_set+ eval ac_new_set=\$ac_env_${ac_var}_set+ eval ac_old_val=\$ac_cv_env_${ac_var}_value+ eval ac_new_val=\$ac_env_${ac_var}_value+ case $ac_old_set,$ac_new_set in+ set,)+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5+printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;}+ ac_cache_corrupted=: ;;+ ,set)+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5+printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;}+ ac_cache_corrupted=: ;;+ ,);;+ *)+ if test "x$ac_old_val" != "x$ac_new_val"; then+ # differences in whitespace do not lead to failure.+ ac_old_val_w=`echo x $ac_old_val`+ ac_new_val_w=`echo x $ac_new_val`+ if test "$ac_old_val_w" != "$ac_new_val_w"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5+printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;}+ ac_cache_corrupted=:+ else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5+printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;}+ eval $ac_var=\$ac_old_val+ fi+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5+printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;}+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5+printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;}+ fi;;+ esac+ # Pass precious variables to config.status.+ if test "$ac_new_set" = set; then+ case $ac_new_val in+ *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;+ *) ac_arg=$ac_var=$ac_new_val ;;+ esac+ case " $ac_configure_args " in+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;+ esac+ fi+done+if $ac_cache_corrupted; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5+printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;}+ as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file'+ and start over" "$LINENO" 5+fi+## -------------------- ##+## Main body of script. ##+## -------------------- ##++ac_ext=c+ac_cpp='$CPP $CPPFLAGS'+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_c_compiler_gnu++++# Safety check: Ensure that we are in the correct source directory.++++++++++++ac_ext=c+ac_cpp='$CPP $CPPFLAGS'+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_c_compiler_gnu+if test -n "$ac_tool_prefix"; then+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.+set dummy ${ac_tool_prefix}gcc; ac_word=$2+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+printf %s "checking for $ac_word... " >&6; }+if test ${ac_cv_prog_CC+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test -n "$CC"; then+ ac_cv_prog_CC="$CC" # Let the user override the test.+else+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_exec_ext in '' $ac_executable_extensions; do+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then+ ac_cv_prog_CC="${ac_tool_prefix}gcc"+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi ;;+esac+fi+CC=$ac_cv_prog_CC+if test -n "$CC"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5+printf "%s\n" "$CC" >&6; }+else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi+++fi+if test -z "$ac_cv_prog_CC"; then+ ac_ct_CC=$CC+ # Extract the first word of "gcc", so it can be a program name with args.+set dummy gcc; ac_word=$2+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+printf %s "checking for $ac_word... " >&6; }+if test ${ac_cv_prog_ac_ct_CC+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test -n "$ac_ct_CC"; then+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.+else+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_exec_ext in '' $ac_executable_extensions; do+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then+ ac_cv_prog_ac_ct_CC="gcc"+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi ;;+esac+fi+ac_ct_CC=$ac_cv_prog_ac_ct_CC+if test -n "$ac_ct_CC"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5+printf "%s\n" "$ac_ct_CC" >&6; }+else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi++ if test "x$ac_ct_CC" = x; then+ CC=""+ else+ case $cross_compiling:$ac_tool_warned in+yes:)+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}+ac_tool_warned=yes ;;+esac+ CC=$ac_ct_CC+ fi+else+ CC="$ac_cv_prog_CC"+fi++if test -z "$CC"; then+ if test -n "$ac_tool_prefix"; then+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.+set dummy ${ac_tool_prefix}cc; ac_word=$2+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+printf %s "checking for $ac_word... " >&6; }+if test ${ac_cv_prog_CC+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test -n "$CC"; then+ ac_cv_prog_CC="$CC" # Let the user override the test.+else+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_exec_ext in '' $ac_executable_extensions; do+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then+ ac_cv_prog_CC="${ac_tool_prefix}cc"+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi ;;+esac+fi+CC=$ac_cv_prog_CC+if test -n "$CC"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5+printf "%s\n" "$CC" >&6; }+else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi+++ fi+fi+if test -z "$CC"; then+ # Extract the first word of "cc", so it can be a program name with args.+set dummy cc; ac_word=$2+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+printf %s "checking for $ac_word... " >&6; }+if test ${ac_cv_prog_CC+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test -n "$CC"; then+ ac_cv_prog_CC="$CC" # Let the user override the test.+else+ ac_prog_rejected=no+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_exec_ext in '' $ac_executable_extensions; do+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then+ if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then+ ac_prog_rejected=yes+ continue+ fi+ ac_cv_prog_CC="cc"+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++if test $ac_prog_rejected = yes; then+ # We found a bogon in the path, so make sure we never use it.+ set dummy $ac_cv_prog_CC+ shift+ if test $# != 0; then+ # We chose a different compiler from the bogus one.+ # However, it has the same basename, so the bogon will be chosen+ # first if we set CC to just the basename; use the full file name.+ shift+ ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@"+ fi+fi+fi ;;+esac+fi+CC=$ac_cv_prog_CC+if test -n "$CC"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5+printf "%s\n" "$CC" >&6; }+else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi+++fi+if test -z "$CC"; then+ if test -n "$ac_tool_prefix"; then+ for ac_prog in cl.exe+ do+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.+set dummy $ac_tool_prefix$ac_prog; ac_word=$2+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+printf %s "checking for $ac_word... " >&6; }+if test ${ac_cv_prog_CC+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test -n "$CC"; then+ ac_cv_prog_CC="$CC" # Let the user override the test.+else+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_exec_ext in '' $ac_executable_extensions; do+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi ;;+esac+fi+CC=$ac_cv_prog_CC+if test -n "$CC"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5+printf "%s\n" "$CC" >&6; }+else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi+++ test -n "$CC" && break+ done+fi+if test -z "$CC"; then+ ac_ct_CC=$CC+ for ac_prog in cl.exe+do+ # Extract the first word of "$ac_prog", so it can be a program name with args.+set dummy $ac_prog; ac_word=$2+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+printf %s "checking for $ac_word... " >&6; }+if test ${ac_cv_prog_ac_ct_CC+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test -n "$ac_ct_CC"; then+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.+else+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_exec_ext in '' $ac_executable_extensions; do+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then+ ac_cv_prog_ac_ct_CC="$ac_prog"+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi ;;+esac+fi+ac_ct_CC=$ac_cv_prog_ac_ct_CC+if test -n "$ac_ct_CC"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5+printf "%s\n" "$ac_ct_CC" >&6; }+else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi+++ test -n "$ac_ct_CC" && break+done++ if test "x$ac_ct_CC" = x; then+ CC=""+ else+ case $cross_compiling:$ac_tool_warned in+yes:)+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}+ac_tool_warned=yes ;;+esac+ CC=$ac_ct_CC+ fi+fi++fi+if test -z "$CC"; then+ if test -n "$ac_tool_prefix"; then+ # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args.+set dummy ${ac_tool_prefix}clang; ac_word=$2+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+printf %s "checking for $ac_word... " >&6; }+if test ${ac_cv_prog_CC+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test -n "$CC"; then+ ac_cv_prog_CC="$CC" # Let the user override the test.+else+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_exec_ext in '' $ac_executable_extensions; do+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then+ ac_cv_prog_CC="${ac_tool_prefix}clang"+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi ;;+esac+fi+CC=$ac_cv_prog_CC+if test -n "$CC"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5+printf "%s\n" "$CC" >&6; }+else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi+++fi+if test -z "$ac_cv_prog_CC"; then+ ac_ct_CC=$CC+ # Extract the first word of "clang", so it can be a program name with args.+set dummy clang; ac_word=$2+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+printf %s "checking for $ac_word... " >&6; }+if test ${ac_cv_prog_ac_ct_CC+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test -n "$ac_ct_CC"; then+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.+else+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_exec_ext in '' $ac_executable_extensions; do+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then+ ac_cv_prog_ac_ct_CC="clang"+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi ;;+esac+fi+ac_ct_CC=$ac_cv_prog_ac_ct_CC+if test -n "$ac_ct_CC"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5+printf "%s\n" "$ac_ct_CC" >&6; }+else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi++ if test "x$ac_ct_CC" = x; then+ CC=""+ else+ case $cross_compiling:$ac_tool_warned in+yes:)+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}+ac_tool_warned=yes ;;+esac+ CC=$ac_ct_CC+ fi+else+ CC="$ac_cv_prog_CC"+fi++fi+++test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+as_fn_error $? "no acceptable C compiler found in \$PATH+See 'config.log' for more details" "$LINENO" 5; }++# Provide some information about the compiler.+printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5+set X $ac_compile+ac_compiler=$2+for ac_option in --version -v -V -qversion -version; do+ { { ac_try="$ac_compiler $ac_option >&5"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ sed '10a\+... rest of stderr output deleted ...+ 10q' conftest.err >conftest.er1+ cat conftest.er1 >&5+ fi+ rm -f conftest.er1 conftest.err+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+done++cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main (void)+{++ ;+ return 0;+}+_ACEOF+ac_clean_files_save=$ac_clean_files+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"+# Try to create an executable without -o first, disregard a.out.+# It will help us diagnose broken compilers, and finding out an intuition+# of exeext.+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5+printf %s "checking whether the C compiler works... " >&6; }+ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'`++# The possible output files:+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"++ac_rmfiles=+for ac_file in $ac_files+do+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;+ esac+done+rm -f $ac_rmfiles++if { { ac_try="$ac_link_default"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_link_default") 2>&5+ ac_status=$?+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+then :+ # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'.+# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no'+# in a Makefile. We should not override ac_cv_exeext if it was cached,+# so that the user can short-circuit this test for compilers unknown to+# Autoconf.+for ac_file in $ac_files ''+do+ test -f "$ac_file" || continue+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )+ ;;+ [ab].out )+ # We found the default executable, but exeext='' is most+ # certainly right.+ break;;+ *.* )+ if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no;+ then :; else+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`+ fi+ # We set ac_cv_exeext here because the later test for it is not+ # safe: cross compilers may not add the suffix if given an '-o'+ # argument, so we may need to know it at that point already.+ # Even if this section looks crufty: it has the advantage of+ # actually working.+ break;;+ * )+ break;;+ esac+done+test "$ac_cv_exeext" = no && ac_cv_exeext=++else case e in #(+ e) ac_file='' ;;+esac+fi+if test -z "$ac_file"+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+printf "%s\n" "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+as_fn_error 77 "C compiler cannot create executables+See 'config.log' for more details" "$LINENO" 5; }+else case e in #(+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; } ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5+printf %s "checking for C compiler default output file name... " >&6; }+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5+printf "%s\n" "$ac_file" >&6; }+ac_exeext=$ac_cv_exeext++rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out+ac_clean_files=$ac_clean_files_save+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5+printf %s "checking for suffix of executables... " >&6; }+if { { ac_try="$ac_link"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_link") 2>&5+ ac_status=$?+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+then :+ # If both 'conftest.exe' and 'conftest' are 'present' (well, observable)+# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will+# work properly (i.e., refer to 'conftest.exe'), while it won't with+# 'rm'.+for ac_file in conftest.exe conftest conftest.*; do+ test -f "$ac_file" || continue+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`+ break;;+ * ) break;;+ esac+done+else case e in #(+ e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+as_fn_error $? "cannot compute suffix of executables: cannot compile and link+See 'config.log' for more details" "$LINENO" 5; } ;;+esac+fi+rm -f conftest conftest$ac_cv_exeext+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5+printf "%s\n" "$ac_cv_exeext" >&6; }++rm -f conftest.$ac_ext+EXEEXT=$ac_cv_exeext+ac_exeext=$EXEEXT+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <stdio.h>+int+main (void)+{+FILE *f = fopen ("conftest.out", "w");+ if (!f)+ return 1;+ return ferror (f) || fclose (f) != 0;++ ;+ return 0;+}+_ACEOF+ac_clean_files="$ac_clean_files conftest.out"+# Check that the compiler produces executables we can run. If not, either+# the compiler is broken, or we cross compile.+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5+printf %s "checking whether we are cross compiling... " >&6; }+if test "$cross_compiling" != yes; then+ { { ac_try="$ac_link"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_link") 2>&5+ ac_status=$?+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+ if { ac_try='./conftest$ac_cv_exeext'+ { { case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_try") 2>&5+ ac_status=$?+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }; }; then+ cross_compiling=no+ else+ if test "$cross_compiling" = maybe; then+ cross_compiling=yes+ else+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+as_fn_error 77 "cannot run C compiled programs.+If you meant to cross compile, use '--host'.+See 'config.log' for more details" "$LINENO" 5; }+ fi+ fi+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5+printf "%s\n" "$cross_compiling" >&6; }++rm -f conftest.$ac_ext conftest$ac_cv_exeext \+ conftest.o conftest.obj conftest.out+ac_clean_files=$ac_clean_files_save+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5+printf %s "checking for suffix of object files... " >&6; }+if test ${ac_cv_objext+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main (void)+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.o conftest.obj+if { { ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+printf "%s\n" "$ac_try_echo"; } >&5+ (eval "$ac_compile") 2>&5+ ac_status=$?+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+then :+ for ac_file in conftest.o conftest.obj conftest.*; do+ test -f "$ac_file" || continue;+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`+ break;;+ esac+done+else case e in #(+ e) printf "%s\n" "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+as_fn_error $? "cannot compute suffix of object files: cannot compile+See 'config.log' for more details" "$LINENO" 5; } ;;+esac+fi+rm -f conftest.$ac_cv_objext conftest.$ac_ext ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5+printf "%s\n" "$ac_cv_objext" >&6; }+OBJEXT=$ac_cv_objext+ac_objext=$OBJEXT+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5+printf %s "checking whether the compiler supports GNU C... " >&6; }+if test ${ac_cv_c_compiler_gnu+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main (void)+{+#ifndef __GNUC__+ choke me+#endif++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_compiler_gnu=yes+else case e in #(+ e) ac_compiler_gnu=no ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+ac_cv_c_compiler_gnu=$ac_compiler_gnu+ ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5+printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; }+ac_compiler_gnu=$ac_cv_c_compiler_gnu++if test $ac_compiler_gnu = yes; then+ GCC=yes+else+ GCC=+fi+ac_test_CFLAGS=${CFLAGS+y}+ac_save_CFLAGS=$CFLAGS+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5+printf %s "checking whether $CC accepts -g... " >&6; }+if test ${ac_cv_prog_cc_g+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_save_c_werror_flag=$ac_c_werror_flag+ ac_c_werror_flag=yes+ ac_cv_prog_cc_g=no+ CFLAGS="-g"+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main (void)+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_cv_prog_cc_g=yes+else case e in #(+ e) CFLAGS=""+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main (void)+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :++else case e in #(+ e) ac_c_werror_flag=$ac_save_c_werror_flag+ CFLAGS="-g"+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main (void)+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_cv_prog_cc_g=yes+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+ ac_c_werror_flag=$ac_save_c_werror_flag ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5+printf "%s\n" "$ac_cv_prog_cc_g" >&6; }+if test $ac_test_CFLAGS; then+ CFLAGS=$ac_save_CFLAGS+elif test $ac_cv_prog_cc_g = yes; then+ if test "$GCC" = yes; then+ CFLAGS="-g -O2"+ else+ CFLAGS="-g"+ fi+else+ if test "$GCC" = yes; then+ CFLAGS="-O2"+ else+ CFLAGS=+ fi+fi+ac_prog_cc_stdc=no+if test x$ac_prog_cc_stdc = xno+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5+printf %s "checking for $CC option to enable C11 features... " >&6; }+if test ${ac_cv_prog_cc_c11+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_cv_prog_cc_c11=no+ac_save_CC=$CC+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$ac_c_conftest_c11_program+_ACEOF+for ac_arg in '' -std=gnu11+do+ CC="$ac_save_CC $ac_arg"+ if ac_fn_c_try_compile "$LINENO"+then :+ ac_cv_prog_cc_c11=$ac_arg+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam+ test "x$ac_cv_prog_cc_c11" != "xno" && break+done+rm -f conftest.$ac_ext+CC=$ac_save_CC ;;+esac+fi++if test "x$ac_cv_prog_cc_c11" = xno+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5+printf "%s\n" "unsupported" >&6; }+else case e in #(+ e) if test "x$ac_cv_prog_cc_c11" = x+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5+printf "%s\n" "none needed" >&6; }+else case e in #(+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5+printf "%s\n" "$ac_cv_prog_cc_c11" >&6; }+ CC="$CC $ac_cv_prog_cc_c11" ;;+esac+fi+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11+ ac_prog_cc_stdc=c11 ;;+esac+fi+fi+if test x$ac_prog_cc_stdc = xno+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5+printf %s "checking for $CC option to enable C99 features... " >&6; }+if test ${ac_cv_prog_cc_c99+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_cv_prog_cc_c99=no+ac_save_CC=$CC+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$ac_c_conftest_c99_program+_ACEOF+for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99=+do+ CC="$ac_save_CC $ac_arg"+ if ac_fn_c_try_compile "$LINENO"+then :+ ac_cv_prog_cc_c99=$ac_arg+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam+ test "x$ac_cv_prog_cc_c99" != "xno" && break+done+rm -f conftest.$ac_ext+CC=$ac_save_CC ;;+esac+fi++if test "x$ac_cv_prog_cc_c99" = xno+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5+printf "%s\n" "unsupported" >&6; }+else case e in #(+ e) if test "x$ac_cv_prog_cc_c99" = x+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5+printf "%s\n" "none needed" >&6; }+else case e in #(+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5+printf "%s\n" "$ac_cv_prog_cc_c99" >&6; }+ CC="$CC $ac_cv_prog_cc_c99" ;;+esac+fi+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99+ ac_prog_cc_stdc=c99 ;;+esac+fi+fi+if test x$ac_prog_cc_stdc = xno+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5+printf %s "checking for $CC option to enable C89 features... " >&6; }+if test ${ac_cv_prog_cc_c89+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_cv_prog_cc_c89=no+ac_save_CC=$CC+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$ac_c_conftest_c89_program+_ACEOF+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"+do+ CC="$ac_save_CC $ac_arg"+ if ac_fn_c_try_compile "$LINENO"+then :+ ac_cv_prog_cc_c89=$ac_arg+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam+ test "x$ac_cv_prog_cc_c89" != "xno" && break+done+rm -f conftest.$ac_ext+CC=$ac_save_CC ;;+esac+fi++if test "x$ac_cv_prog_cc_c89" = xno+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5+printf "%s\n" "unsupported" >&6; }+else case e in #(+ e) if test "x$ac_cv_prog_cc_c89" = x+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5+printf "%s\n" "none needed" >&6; }+else case e in #(+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5+printf "%s\n" "$ac_cv_prog_cc_c89" >&6; }+ CC="$CC $ac_cv_prog_cc_c89" ;;+esac+fi+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89+ ac_prog_cc_stdc=c89 ;;+esac+fi+fi++ac_ext=c+ac_cpp='$CPP $CPPFLAGS'+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_c_compiler_gnu++++ac_header= ac_cache=+for ac_item in $ac_header_c_list+do+ if test $ac_cache; then+ ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"+ if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then+ printf "%s\n" "#define $ac_item 1" >> confdefs.h+ fi+ ac_header= ac_cache=+ elif test $ac_header; then+ ac_cache=$ac_item+ else+ ac_header=$ac_item+ fi+done+++++++++if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes+then :++printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h++fi+++++++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5+printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; }+if test ${ac_cv_safe_to_define___extensions__+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++# define __EXTENSIONS__ 1+ $ac_includes_default+int+main (void)+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_cv_safe_to_define___extensions__=yes+else case e in #(+ e) ac_cv_safe_to_define___extensions__=no ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5+printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; }++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5+printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; }+if test ${ac_cv_should_define__xopen_source+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_cv_should_define__xopen_source=no+ if test $ac_cv_header_wchar_h = yes+then :+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++ #include <wchar.h>+ mbstate_t x;+int+main (void)+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :++else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++ #define _XOPEN_SOURCE 500+ #include <wchar.h>+ mbstate_t x;+int+main (void)+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_cv_should_define__xopen_source=yes+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+fi ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5+printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; }++ printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h++ printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h++ printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h++ printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h++ printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h++ printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h++ printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h++ printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h++ printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h++ printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h++ printf "%s\n" "#define __STDC_WANT_IEC_60559_EXT__ 1" >>confdefs.h++ printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h++ printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h++ printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h++ printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h++ printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h++ if test $ac_cv_header_minix_config_h = yes+then :+ MINIX=yes+ printf "%s\n" "#define _MINIX 1" >>confdefs.h++ printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h++ printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h++else case e in #(+ e) MINIX= ;;+esac+fi+ if test $ac_cv_safe_to_define___extensions__ = yes+then :+ printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h++fi+ if test $ac_cv_should_define__xopen_source = yes+then :+ printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h++fi+++ac_config_headers="$ac_config_headers include/HsUnixConfig.h"+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5+printf %s "checking for an ANSI C-conforming const... " >&6; }+if test ${ac_cv_c_const+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main (void)+{++#ifndef __cplusplus+ /* Ultrix mips cc rejects this sort of thing. */+ typedef int charset[2];+ const charset cs = { 0, 0 };+ /* SunOS 4.1.1 cc rejects this. */+ char const *const *pcpcc;+ char **ppc;+ /* NEC SVR4.0.2 mips cc rejects this. */+ struct point {int x, y;};+ static struct point const zero = {0,0};+ /* IBM XL C 1.02.0.0 rejects this.+ It does not let you subtract one const X* pointer from another in+ an arm of an if-expression whose if-part is not a constant+ expression */+ const char *g = "string";+ pcpcc = &g + (g ? g-g : 0);+ /* HPUX 7.0 cc rejects these. */+ ++pcpcc;+ ppc = (char**) pcpcc;+ pcpcc = (char const *const *) ppc;+ { /* SCO 3.2v4 cc rejects this sort of thing. */+ char tx;+ char *t = &tx;+ char const *s = 0 ? (char *) 0 : (char const *) 0;++ *t++ = 0;+ if (s) return 0;+ }+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */+ int x[] = {25, 17};+ const int *foo = &x[0];+ ++foo;+ }+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */+ typedef const int *iptr;+ iptr p = 0;+ ++p;+ }+ { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */+ struct s { int j; const int *ap[3]; } bx;+ struct s *b = &bx; b->j = 5;+ }+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */+ const int foo = 10;+ if (!foo) return 0;+ }+ return !cs[0] && !zero.x;+#endif++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_cv_c_const=yes+else case e in #(+ e) ac_cv_c_const=no ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5+printf "%s\n" "$ac_cv_c_const" >&6; }+if test $ac_cv_c_const = no; then++printf "%s\n" "#define const /**/" >>confdefs.h++fi+++# Check whether --enable-largefile was given.+if test ${enable_largefile+y}+then :+ enableval=$enable_largefile;+fi+if test "$enable_largefile,$enable_year2038" != no,no+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CPPFLAGS option for large files" >&5+printf %s "checking for $CPPFLAGS option for large files... " >&6; }+if test ${ac_cv_sys_largefile_opts+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_save_CPPFLAGS=$CPPFLAGS+ ac_opt_found=no+ for ac_opt in "none needed" "-D_FILE_OFFSET_BITS=64" "-D_LARGE_FILES=1"; do+ if test x"$ac_opt" != x"none needed"+then :+ CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"+fi+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <sys/types.h>+#ifndef FTYPE+# define FTYPE off_t+#endif+ /* Check that FTYPE can represent 2**63 - 1 correctly.+ We can't simply define LARGE_FTYPE to be 9223372036854775807,+ since some C++ compilers masquerading as C compilers+ incorrectly reject 9223372036854775807. */+#define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31))+ int FTYPE_is_large[(LARGE_FTYPE % 2147483629 == 721+ && LARGE_FTYPE % 2147483647 == 1)+ ? 1 : -1];+int+main (void)+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ if test x"$ac_opt" = x"none needed"+then :+ # GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t.+ CPPFLAGS="$CPPFLAGS -DFTYPE=ino_t"+ if ac_fn_c_try_compile "$LINENO"+then :++else case e in #(+ e) CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"+ if ac_fn_c_try_compile "$LINENO"+then :+ ac_opt='-D_FILE_OFFSET_BITS=64'+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam+fi+ ac_cv_sys_largefile_opts=$ac_opt+ ac_opt_found=yes+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+ test $ac_opt_found = no || break+ done+ CPPFLAGS=$ac_save_CPPFLAGS++ test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected" ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_opts" >&5+printf "%s\n" "$ac_cv_sys_largefile_opts" >&6; }++ac_have_largefile=yes+case $ac_cv_sys_largefile_opts in #(+ "none needed") :+ ;; #(+ "supported through gnulib") :+ ;; #(+ "support not detected") :+ ac_have_largefile=no ;; #(+ "-D_FILE_OFFSET_BITS=64") :++printf "%s\n" "#define _FILE_OFFSET_BITS 64" >>confdefs.h+ ;; #(+ "-D_LARGE_FILES=1") :++printf "%s\n" "#define _LARGE_FILES 1" >>confdefs.h+ ;; #(+ *) :+ as_fn_error $? "internal error: bad value for \$ac_cv_sys_largefile_opts" "$LINENO" 5 ;;+esac++if test "$enable_year2038" != no+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CPPFLAGS option for timestamps after 2038" >&5+printf %s "checking for $CPPFLAGS option for timestamps after 2038... " >&6; }+if test ${ac_cv_sys_year2038_opts+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_save_CPPFLAGS="$CPPFLAGS"+ ac_opt_found=no+ for ac_opt in "none needed" "-D_TIME_BITS=64" "-D__MINGW_USE_VC2005_COMPAT" "-U_USE_32_BIT_TIME_T -D__MINGW_USE_VC2005_COMPAT"; do+ if test x"$ac_opt" != x"none needed"+then :+ CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"+fi+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++ #include <time.h>+ /* Check that time_t can represent 2**32 - 1 correctly. */+ #define LARGE_TIME_T \\+ ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30)))+ int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535+ && LARGE_TIME_T % 65537 == 0)+ ? 1 : -1];++int+main (void)+{++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ ac_cv_sys_year2038_opts="$ac_opt"+ ac_opt_found=yes+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+ test $ac_opt_found = no || break+ done+ CPPFLAGS="$ac_save_CPPFLAGS"+ test $ac_opt_found = yes || ac_cv_sys_year2038_opts="support not detected" ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_year2038_opts" >&5+printf "%s\n" "$ac_cv_sys_year2038_opts" >&6; }++ac_have_year2038=yes+case $ac_cv_sys_year2038_opts in #(+ "none needed") :+ ;; #(+ "support not detected") :+ ac_have_year2038=no ;; #(+ "-D_TIME_BITS=64") :++printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h+ ;; #(+ "-D__MINGW_USE_VC2005_COMPAT") :++printf "%s\n" "#define __MINGW_USE_VC2005_COMPAT 1" >>confdefs.h+ ;; #(+ "-U_USE_32_BIT_TIME_T"*) :+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+as_fn_error $? "the 'time_t' type is currently forced to be 32-bit. It+will stop working after mid-January 2038. Remove+_USE_32BIT_TIME_T from the compiler flags.+See 'config.log' for more details" "$LINENO" 5; } ;; #(+ *) :+ as_fn_error $? "internal error: bad value for \$ac_cv_sys_year2038_opts" "$LINENO" 5 ;;+esac++fi++fi++ac_fn_c_check_header_compile "$LINENO" "dirent.h" "ac_cv_header_dirent_h" "$ac_includes_default"+if test "x$ac_cv_header_dirent_h" = xyes+then :+ printf "%s\n" "#define HAVE_DIRENT_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default"+if test "x$ac_cv_header_fcntl_h" = xyes+then :+ printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "grp.h" "ac_cv_header_grp_h" "$ac_includes_default"+if test "x$ac_cv_header_grp_h" = xyes+then :+ printf "%s\n" "#define HAVE_GRP_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default"+if test "x$ac_cv_header_limits_h" = xyes+then :+ printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default"+if test "x$ac_cv_header_pwd_h" = xyes+then :+ printf "%s\n" "#define HAVE_PWD_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default"+if test "x$ac_cv_header_signal_h" = xyes+then :+ printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default"+if test "x$ac_cv_header_string_h" = xyes+then :+ printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h++fi++ac_fn_c_check_header_compile "$LINENO" "sys/resource.h" "ac_cv_header_sys_resource_h" "$ac_includes_default"+if test "x$ac_cv_header_sys_resource_h" = xyes+then :+ printf "%s\n" "#define HAVE_SYS_RESOURCE_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "sys/stat.h" "ac_cv_header_sys_stat_h" "$ac_includes_default"+if test "x$ac_cv_header_sys_stat_h" = xyes+then :+ printf "%s\n" "#define HAVE_SYS_STAT_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "sys/times.h" "ac_cv_header_sys_times_h" "$ac_includes_default"+if test "x$ac_cv_header_sys_times_h" = xyes+then :+ printf "%s\n" "#define HAVE_SYS_TIMES_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default"+if test "x$ac_cv_header_sys_time_h" = xyes+then :+ printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h++fi++ac_fn_c_check_header_compile "$LINENO" "sys/utsname.h" "ac_cv_header_sys_utsname_h" "$ac_includes_default"+if test "x$ac_cv_header_sys_utsname_h" = xyes+then :+ printf "%s\n" "#define HAVE_SYS_UTSNAME_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default"+if test "x$ac_cv_header_sys_wait_h" = xyes+then :+ printf "%s\n" "#define HAVE_SYS_WAIT_H 1" >>confdefs.h++fi++ac_fn_c_check_header_compile "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default"+if test "x$ac_cv_header_sys_sysmacros_h" = xyes+then :+ printf "%s\n" "#define HAVE_SYS_SYSMACROS_H 1" >>confdefs.h++fi++ac_fn_c_check_header_compile "$LINENO" "bsd/libutil.h" "ac_cv_header_bsd_libutil_h" "$ac_includes_default"+if test "x$ac_cv_header_bsd_libutil_h" = xyes+then :+ printf "%s\n" "#define HAVE_BSD_LIBUTIL_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "libutil.h" "ac_cv_header_libutil_h" "$ac_includes_default"+if test "x$ac_cv_header_libutil_h" = xyes+then :+ printf "%s\n" "#define HAVE_LIBUTIL_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "pty.h" "ac_cv_header_pty_h" "$ac_includes_default"+if test "x$ac_cv_header_pty_h" = xyes+then :+ printf "%s\n" "#define HAVE_PTY_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "utmp.h" "ac_cv_header_utmp_h" "$ac_includes_default"+if test "x$ac_cv_header_utmp_h" = xyes+then :+ printf "%s\n" "#define HAVE_UTMP_H 1" >>confdefs.h++fi++ac_fn_c_check_header_compile "$LINENO" "termios.h" "ac_cv_header_termios_h" "$ac_includes_default"+if test "x$ac_cv_header_termios_h" = xyes+then :+ printf "%s\n" "#define HAVE_TERMIOS_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "time.h" "ac_cv_header_time_h" "$ac_includes_default"+if test "x$ac_cv_header_time_h" = xyes+then :+ printf "%s\n" "#define HAVE_TIME_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"+if test "x$ac_cv_header_unistd_h" = xyes+then :+ printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h++fi+ac_fn_c_check_header_compile "$LINENO" "utime.h" "ac_cv_header_utime_h" "$ac_includes_default"+if test "x$ac_cv_header_utime_h" = xyes+then :+ printf "%s\n" "#define HAVE_UTIME_H 1" >>confdefs.h++fi+++ac_header_dirent=no+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do+ as_ac_Header=`printf "%s\n" "ac_cv_header_dirent_$ac_hdr" | sed "$as_sed_sh"`+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5+printf %s "checking for $ac_hdr that defines DIR... " >&6; }+if eval test \${$as_ac_Header+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <sys/types.h>+#include <$ac_hdr>++int+main (void)+{+if ((DIR *) 0)+return 0;+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ eval "$as_ac_Header=yes"+else case e in #(+ e) eval "$as_ac_Header=no" ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+eval ac_res=\$$as_ac_Header+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+printf "%s\n" "$ac_res" >&6; }+if eval test \"x\$"$as_ac_Header"\" = x"yes"+then :+ cat >>confdefs.h <<_ACEOF+#define `printf "%s\n" "HAVE_$ac_hdr" | sed "$as_sed_cpp"` 1+_ACEOF++ac_header_dirent=$ac_hdr; break+fi++done+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.+if test $ac_header_dirent = dirent.h; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5+printf %s "checking for library containing opendir... " >&6; }+if test ${ac_cv_search_opendir+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_func_search_save_LIBS=$LIBS+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply.+ The 'extern "C"' is for builds by C++ compilers;+ although this is not generally supported in C code supporting it here+ has little cost and some practical benefit (sr 110532). */+#ifdef __cplusplus+extern "C"+#endif+char opendir (void);+int+main (void)+{+return opendir ();+ ;+ return 0;+}+_ACEOF+for ac_lib in '' dir+do+ if test -z "$ac_lib"; then+ ac_res="none required"+ else+ ac_res=-l$ac_lib+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"+ fi+ if ac_fn_c_try_link "$LINENO"+then :+ ac_cv_search_opendir=$ac_res+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam \+ conftest$ac_exeext+ if test ${ac_cv_search_opendir+y}+then :+ break+fi+done+if test ${ac_cv_search_opendir+y}+then :++else case e in #(+ e) ac_cv_search_opendir=no ;;+esac+fi+rm conftest.$ac_ext+LIBS=$ac_func_search_save_LIBS ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5+printf "%s\n" "$ac_cv_search_opendir" >&6; }+ac_res=$ac_cv_search_opendir+if test "$ac_res" != no+then :+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"++fi++else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5+printf %s "checking for library containing opendir... " >&6; }+if test ${ac_cv_search_opendir+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_func_search_save_LIBS=$LIBS+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply.+ The 'extern "C"' is for builds by C++ compilers;+ although this is not generally supported in C code supporting it here+ has little cost and some practical benefit (sr 110532). */+#ifdef __cplusplus+extern "C"+#endif+char opendir (void);+int+main (void)+{+return opendir ();+ ;+ return 0;+}+_ACEOF+for ac_lib in '' x+do+ if test -z "$ac_lib"; then+ ac_res="none required"+ else+ ac_res=-l$ac_lib+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"+ fi+ if ac_fn_c_try_link "$LINENO"+then :+ ac_cv_search_opendir=$ac_res+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam \+ conftest$ac_exeext+ if test ${ac_cv_search_opendir+y}+then :+ break+fi+done+if test ${ac_cv_search_opendir+y}+then :++else case e in #(+ e) ac_cv_search_opendir=no ;;+esac+fi+rm conftest.$ac_ext+LIBS=$ac_func_search_save_LIBS ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5+printf "%s\n" "$ac_cv_search_opendir" >&6; }+ac_res=$ac_cv_search_opendir+if test "$ac_res" != no+then :+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"++fi++fi++++ ac_fn_c_check_member "$LINENO" "struct dirent" "d_type" "ac_cv_member_struct_dirent_d_type" "+#include <sys/types.h>+#ifdef HAVE_DIRENT_H+# include <dirent.h>+#else+# define dirent direct+# ifdef HAVE_SYS_NDIR_H+# include <sys/ndir.h>+# endif+# ifdef HAVE_SYS_DIR_H+# include <sys/dir.h>+# endif+# ifdef HAVE_NDIR_H+# include <ndir.h>+# endif+#endif++"+if test "x$ac_cv_member_struct_dirent_d_type" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_TYPE 1" >>confdefs.h+++fi+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of DT_UNKNOWN" >&5+printf %s "checking value of DT_UNKNOWN... " >&6; }+if test ${fp_cv_const_DT_UNKNOWN+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "DT_UNKNOWN" "fp_check_const_result" "+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result=-1 ;;+esac+fi++fp_cv_const_DT_UNKNOWN=$fp_check_const_result ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_DT_UNKNOWN" >&5+printf "%s\n" "$fp_cv_const_DT_UNKNOWN" >&6; }+printf "%s\n" "#define CONST_DT_UNKNOWN $fp_cv_const_DT_UNKNOWN" >>confdefs.h++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of DT_FIFO" >&5+printf %s "checking value of DT_FIFO... " >&6; }+if test ${fp_cv_const_DT_FIFO+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "DT_FIFO" "fp_check_const_result" "+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result=-2 ;;+esac+fi++fp_cv_const_DT_FIFO=$fp_check_const_result ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_DT_FIFO" >&5+printf "%s\n" "$fp_cv_const_DT_FIFO" >&6; }+printf "%s\n" "#define CONST_DT_FIFO $fp_cv_const_DT_FIFO" >>confdefs.h++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of DT_CHR" >&5+printf %s "checking value of DT_CHR... " >&6; }+if test ${fp_cv_const_DT_CHR+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "DT_CHR" "fp_check_const_result" "+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result=-3 ;;+esac+fi++fp_cv_const_DT_CHR=$fp_check_const_result ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_DT_CHR" >&5+printf "%s\n" "$fp_cv_const_DT_CHR" >&6; }+printf "%s\n" "#define CONST_DT_CHR $fp_cv_const_DT_CHR" >>confdefs.h++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of DT_DIR" >&5+printf %s "checking value of DT_DIR... " >&6; }+if test ${fp_cv_const_DT_DIR+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "DT_DIR" "fp_check_const_result" "+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result=-4 ;;+esac+fi++fp_cv_const_DT_DIR=$fp_check_const_result ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_DT_DIR" >&5+printf "%s\n" "$fp_cv_const_DT_DIR" >&6; }+printf "%s\n" "#define CONST_DT_DIR $fp_cv_const_DT_DIR" >>confdefs.h++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of DT_BLK" >&5+printf %s "checking value of DT_BLK... " >&6; }+if test ${fp_cv_const_DT_BLK+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "DT_BLK" "fp_check_const_result" "+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result=-5 ;;+esac+fi++fp_cv_const_DT_BLK=$fp_check_const_result ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_DT_BLK" >&5+printf "%s\n" "$fp_cv_const_DT_BLK" >&6; }+printf "%s\n" "#define CONST_DT_BLK $fp_cv_const_DT_BLK" >>confdefs.h++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of DT_REG" >&5+printf %s "checking value of DT_REG... " >&6; }+if test ${fp_cv_const_DT_REG+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "DT_REG" "fp_check_const_result" "+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result=-6 ;;+esac+fi++fp_cv_const_DT_REG=$fp_check_const_result ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_DT_REG" >&5+printf "%s\n" "$fp_cv_const_DT_REG" >&6; }+printf "%s\n" "#define CONST_DT_REG $fp_cv_const_DT_REG" >>confdefs.h++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of DT_LNK" >&5+printf %s "checking value of DT_LNK... " >&6; }+if test ${fp_cv_const_DT_LNK+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "DT_LNK" "fp_check_const_result" "+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result=-7 ;;+esac+fi++fp_cv_const_DT_LNK=$fp_check_const_result ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_DT_LNK" >&5+printf "%s\n" "$fp_cv_const_DT_LNK" >&6; }+printf "%s\n" "#define CONST_DT_LNK $fp_cv_const_DT_LNK" >>confdefs.h++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of DT_SOCK" >&5+printf %s "checking value of DT_SOCK... " >&6; }+if test ${fp_cv_const_DT_SOCK+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "DT_SOCK" "fp_check_const_result" "+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result=-8 ;;+esac+fi++fp_cv_const_DT_SOCK=$fp_check_const_result ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_DT_SOCK" >&5+printf "%s\n" "$fp_cv_const_DT_SOCK" >&6; }+printf "%s\n" "#define CONST_DT_SOCK $fp_cv_const_DT_SOCK" >>confdefs.h++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of DT_WHT" >&5+printf %s "checking value of DT_WHT... " >&6; }+if test ${fp_cv_const_DT_WHT+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "DT_WHT" "fp_check_const_result" "+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result=-9 ;;+esac+fi++fp_cv_const_DT_WHT=$fp_check_const_result ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fp_cv_const_DT_WHT" >&5+printf "%s\n" "$fp_cv_const_DT_WHT" >&6; }+printf "%s\n" "#define CONST_DT_WHT $fp_cv_const_DT_WHT" >>confdefs.h+++ac_fn_c_check_func "$LINENO" "getgrgid_r" "ac_cv_func_getgrgid_r"+if test "x$ac_cv_func_getgrgid_r" = xyes+then :+ printf "%s\n" "#define HAVE_GETGRGID_R 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "getgrnam_r" "ac_cv_func_getgrnam_r"+if test "x$ac_cv_func_getgrnam_r" = xyes+then :+ printf "%s\n" "#define HAVE_GETGRNAM_R 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "getpwnam_r" "ac_cv_func_getpwnam_r"+if test "x$ac_cv_func_getpwnam_r" = xyes+then :+ printf "%s\n" "#define HAVE_GETPWNAM_R 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "getpwuid_r" "ac_cv_func_getpwuid_r"+if test "x$ac_cv_func_getpwuid_r" = xyes+then :+ printf "%s\n" "#define HAVE_GETPWUID_R 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "getpwnam" "ac_cv_func_getpwnam"+if test "x$ac_cv_func_getpwnam" = xyes+then :+ printf "%s\n" "#define HAVE_GETPWNAM 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "getpwuid" "ac_cv_func_getpwuid"+if test "x$ac_cv_func_getpwuid" = xyes+then :+ printf "%s\n" "#define HAVE_GETPWUID 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "getpwent" "ac_cv_func_getpwent"+if test "x$ac_cv_func_getpwent" = xyes+then :+ printf "%s\n" "#define HAVE_GETPWENT 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "getgrent" "ac_cv_func_getgrent"+if test "x$ac_cv_func_getgrent" = xyes+then :+ printf "%s\n" "#define HAVE_GETGRENT 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "lchown" "ac_cv_func_lchown"+if test "x$ac_cv_func_lchown" = xyes+then :+ printf "%s\n" "#define HAVE_LCHOWN 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv"+if test "x$ac_cv_func_setenv" = xyes+then :+ printf "%s\n" "#define HAVE_SETENV 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf"+if test "x$ac_cv_func_sysconf" = xyes+then :+ printf "%s\n" "#define HAVE_SYSCONF 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv"+if test "x$ac_cv_func_unsetenv" = xyes+then :+ printf "%s\n" "#define HAVE_UNSETENV 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "clearenv" "ac_cv_func_clearenv"+if test "x$ac_cv_func_clearenv" = xyes+then :+ printf "%s\n" "#define HAVE_CLEARENV 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep"+if test "x$ac_cv_func_nanosleep" = xyes+then :+ printf "%s\n" "#define HAVE_NANOSLEEP 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "ptsname" "ac_cv_func_ptsname"+if test "x$ac_cv_func_ptsname" = xyes+then :+ printf "%s\n" "#define HAVE_PTSNAME 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "setitimer" "ac_cv_func_setitimer"+if test "x$ac_cv_func_setitimer" = xyes+then :+ printf "%s\n" "#define HAVE_SETITIMER 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "readdir_r" "ac_cv_func_readdir_r"+if test "x$ac_cv_func_readdir_r" = xyes+then :+ printf "%s\n" "#define HAVE_READDIR_R 1" >>confdefs.h++fi+++ac_fn_c_check_func "$LINENO" "alarm" "ac_cv_func_alarm"+if test "x$ac_cv_func_alarm" = xyes+then :+ printf "%s\n" "#define HAVE_ALARM 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "dup" "ac_cv_func_dup"+if test "x$ac_cv_func_dup" = xyes+then :+ printf "%s\n" "#define HAVE_DUP 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "execv" "ac_cv_func_execv"+if test "x$ac_cv_func_execv" = xyes+then :+ printf "%s\n" "#define HAVE_EXECV 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "getpid" "ac_cv_func_getpid"+if test "x$ac_cv_func_getpid" = xyes+then :+ printf "%s\n" "#define HAVE_GETPID 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "mknod" "ac_cv_func_mknod"+if test "x$ac_cv_func_mknod" = xyes+then :+ printf "%s\n" "#define HAVE_MKNOD 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "mkstemp" "ac_cv_func_mkstemp"+if test "x$ac_cv_func_mkstemp" = xyes+then :+ printf "%s\n" "#define HAVE_MKSTEMP 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "pipe" "ac_cv_func_pipe"+if test "x$ac_cv_func_pipe" = xyes+then :+ printf "%s\n" "#define HAVE_PIPE 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "times" "ac_cv_func_times"+if test "x$ac_cv_func_times" = xyes+then :+ printf "%s\n" "#define HAVE_TIMES 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "chown" "ac_cv_func_chown"+if test "x$ac_cv_func_chown" = xyes+then :+ printf "%s\n" "#define HAVE_CHOWN 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "fchdir" "ac_cv_func_fchdir"+if test "x$ac_cv_func_fchdir" = xyes+then :+ printf "%s\n" "#define HAVE_FCHDIR 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "fchmod" "ac_cv_func_fchmod"+if test "x$ac_cv_func_fchmod" = xyes+then :+ printf "%s\n" "#define HAVE_FCHMOD 1" >>confdefs.h++fi+++ac_fn_c_check_type "$LINENO" "struct rlimit" "ac_cv_type_struct_rlimit" "#include <sys/resource.h>+"+if test "x$ac_cv_type_struct_rlimit" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_RLIMIT 1" >>confdefs.h++fi+++# check for statx+ac_fn_c_check_func "$LINENO" "statx" "ac_cv_func_statx"+if test "x$ac_cv_func_statx" = xyes+then :++printf "%s\n" "#define HAVE_STATX_FUN 1" >>confdefs.h++fi++ac_fn_c_check_type "$LINENO" "struct statx" "ac_cv_type_struct_statx" "#include <sys/stat.h>+"+if test "x$ac_cv_type_struct_statx" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STATX 1" >>confdefs.h++fi++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for statx.stx_mnt_id" >&5+printf %s "checking for statx.stx_mnt_id... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++#include <sys/stat.h>+int+main (void)+{++struct statx statxbuf;+statx(0, "", 0, STATX_BASIC_STATS | STATX_MNT_ID, &statxbuf);+return statxbuf.stx_mnt_id;++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_link "$LINENO"+then :++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_STATX_MNT_ID 1" >>confdefs.h+++else case e in #(+ e)+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }++ ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam \+ conftest$ac_exeext conftest.$ac_ext+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for F_GETLK from fcntl.h" >&5+printf %s "checking for F_GETLK from fcntl.h... " >&6; }+ac_ext=c+ac_cpp='$CPP $CPPFLAGS'+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_c_compiler_gnu+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5+printf %s "checking how to run the C preprocessor... " >&6; }+# On Suns, sometimes $CPP names a directory.+if test -n "$CPP" && test -d "$CPP"; then+ CPP=+fi+if test -z "$CPP"; then+ if test ${ac_cv_prog_CPP+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) # Double quotes because $CC needs to be expanded+ for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp+ do+ ac_preproc_ok=false+for ac_c_preproc_warn_flag in '' yes+do+ # Use a header file that comes with gcc, so configuring glibc+ # with a fresh cross-compiler works.+ # On the NeXT, cc -E runs the code through the compiler's parser,+ # not just through cpp. "Syntax error" is here to catch this case.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <limits.h>+ Syntax error+_ACEOF+if ac_fn_c_try_cpp "$LINENO"+then :++else case e in #(+ e) # Broken: fails on valid input.+continue ;;+esac+fi+rm -f conftest.err conftest.i conftest.$ac_ext++ # OK, works on sane cases. Now check whether nonexistent headers+ # can be detected and how.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <ac_nonexistent.h>+_ACEOF+if ac_fn_c_try_cpp "$LINENO"+then :+ # Broken: success on invalid input.+continue+else case e in #(+ e) # Passes both tests.+ac_preproc_ok=:+break ;;+esac+fi+rm -f conftest.err conftest.i conftest.$ac_ext++done+# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped.+rm -f conftest.i conftest.err conftest.$ac_ext+if $ac_preproc_ok+then :+ break+fi++ done+ ac_cv_prog_CPP=$CPP+ ;;+esac+fi+ CPP=$ac_cv_prog_CPP+else+ ac_cv_prog_CPP=$CPP+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5+printf "%s\n" "$CPP" >&6; }+ac_preproc_ok=false+for ac_c_preproc_warn_flag in '' yes+do+ # Use a header file that comes with gcc, so configuring glibc+ # with a fresh cross-compiler works.+ # On the NeXT, cc -E runs the code through the compiler's parser,+ # not just through cpp. "Syntax error" is here to catch this case.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <limits.h>+ Syntax error+_ACEOF+if ac_fn_c_try_cpp "$LINENO"+then :++else case e in #(+ e) # Broken: fails on valid input.+continue ;;+esac+fi+rm -f conftest.err conftest.i conftest.$ac_ext++ # OK, works on sane cases. Now check whether nonexistent headers+ # can be detected and how.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <ac_nonexistent.h>+_ACEOF+if ac_fn_c_try_cpp "$LINENO"+then :+ # Broken: success on invalid input.+continue+else case e in #(+ e) # Passes both tests.+ac_preproc_ok=:+break ;;+esac+fi+rm -f conftest.err conftest.i conftest.$ac_ext++done+# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped.+rm -f conftest.i conftest.err conftest.$ac_ext+if $ac_preproc_ok+then :++else case e in #(+ e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check+See 'config.log' for more details" "$LINENO" 5; } ;;+esac+fi++ac_ext=c+ac_cpp='$CPP $CPPFLAGS'+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_c_compiler_gnu+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep -e" >&5+printf %s "checking for egrep -e... " >&6; }+if test ${ac_cv_path_EGREP_TRADITIONAL+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test -z "$EGREP_TRADITIONAL"; then+ ac_path_EGREP_TRADITIONAL_found=false+ # Loop through the user's path and test for each of PROGNAME-LIST+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_prog in grep ggrep+ do+ for ac_exec_ext in '' $ac_executable_extensions; do+ ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext"+ as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue+# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found.+ # Check for GNU $ac_path_EGREP_TRADITIONAL+case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #(+*GNU*)+ ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;;+#(+*)+ ac_count=0+ printf %s 0123456789 >"conftest.in"+ while :+ do+ cat "conftest.in" "conftest.in" >"conftest.tmp"+ mv "conftest.tmp" "conftest.in"+ cp "conftest.in" "conftest.nl"+ printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl"+ "$ac_path_EGREP_TRADITIONAL" -E 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break+ as_fn_arith $ac_count + 1 && ac_count=$as_val+ if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then+ # Best one so far, save it but keep looking for a better one+ ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL"+ ac_path_EGREP_TRADITIONAL_max=$ac_count+ fi+ # 10*(2^10) chars as input seems more than enough+ test $ac_count -gt 10 && break+ done+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;+esac++ $ac_path_EGREP_TRADITIONAL_found && break 3+ done+ done+ done+IFS=$as_save_IFS+ if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then+ :+ fi+else+ ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL+fi++ if test "$ac_cv_path_EGREP_TRADITIONAL"+then :+ ac_cv_path_EGREP_TRADITIONAL="$ac_cv_path_EGREP_TRADITIONAL -E"+else case e in #(+ e) if test -z "$EGREP_TRADITIONAL"; then+ ac_path_EGREP_TRADITIONAL_found=false+ # Loop through the user's path and test for each of PROGNAME-LIST+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ for ac_prog in egrep+ do+ for ac_exec_ext in '' $ac_executable_extensions; do+ ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext"+ as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue+# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found.+ # Check for GNU $ac_path_EGREP_TRADITIONAL+case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #(+*GNU*)+ ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;;+#(+*)+ ac_count=0+ printf %s 0123456789 >"conftest.in"+ while :+ do+ cat "conftest.in" "conftest.in" >"conftest.tmp"+ mv "conftest.tmp" "conftest.in"+ cp "conftest.in" "conftest.nl"+ printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl"+ "$ac_path_EGREP_TRADITIONAL" 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break+ as_fn_arith $ac_count + 1 && ac_count=$as_val+ if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then+ # Best one so far, save it but keep looking for a better one+ ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL"+ ac_path_EGREP_TRADITIONAL_max=$ac_count+ fi+ # 10*(2^10) chars as input seems more than enough+ test $ac_count -gt 10 && break+ done+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;+esac++ $ac_path_EGREP_TRADITIONAL_found && break 3+ done+ done+ done+IFS=$as_save_IFS+ if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5+ fi+else+ ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL+fi+ ;;+esac+fi ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP_TRADITIONAL" >&5+printf "%s\n" "$ac_cv_path_EGREP_TRADITIONAL" >&6; }+ EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL++cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++ #include <fcntl.h>+ #ifdef F_GETLK+ yes+ #endif++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP_TRADITIONAL "yes" >/dev/null 2>&1+then :++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_F_GETLK 1" >>confdefs.h+++else case e in #(+ e)+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+ ;;+esac+fi+rm -rf conftest*+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for O_DIRECT open flag" >&5+printf %s "checking for O_DIRECT open flag... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++ #include <fcntl.h>+ #ifdef O_DIRECT+ yes+ #endif++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP_TRADITIONAL "yes" >/dev/null 2>&1+then :++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_O_DIRECT 1" >>confdefs.h+++else case e in #(+ e)+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+ ;;+esac+fi+rm -rf conftest*+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for F_NOCACHE from fcntl.h" >&5+printf %s "checking for F_NOCACHE from fcntl.h... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++ #include <fcntl.h>+ #ifdef F_NOCACHE+ yes+ #endif++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP_TRADITIONAL "yes" >/dev/null 2>&1+then :++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_F_NOCACHE 1" >>confdefs.h+++else case e in #(+ e)+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+ ;;+esac+fi+rm -rf conftest*++++++ # Make sure we can run config.sub.+$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 ||+ as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5+printf %s "checking build system type... " >&6; }+if test ${ac_cv_build+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_build_alias=$build_alias+test "x$ac_build_alias" = x &&+ ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"`+test "x$ac_build_alias" = x &&+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5+ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` ||+ as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5+ ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5+printf "%s\n" "$ac_cv_build" >&6; }+case $ac_cv_build in+*-*-*) ;;+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;+esac+build=$ac_cv_build+ac_save_IFS=$IFS; IFS='-'+set x $ac_cv_build+shift+build_cpu=$1+build_vendor=$2+shift; shift+# Remember, the first character of IFS is used to create $*,+# except with old shells:+build_os=$*+IFS=$ac_save_IFS+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5+printf %s "checking host system type... " >&6; }+if test ${ac_cv_host+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test "x$host_alias" = x; then+ ac_cv_host=$ac_cv_build+else+ ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` ||+ as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5+fi+ ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5+printf "%s\n" "$ac_cv_host" >&6; }+case $ac_cv_host in+*-*-*) ;;+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;+esac+host=$ac_cv_host+ac_save_IFS=$IFS; IFS='-'+set x $ac_cv_host+shift+host_cpu=$1+host_vendor=$2+shift; shift+# Remember, the first character of IFS is used to create $*,+# except with old shells:+host_os=$*+IFS=$ac_save_IFS+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5+printf %s "checking target system type... " >&6; }+if test ${ac_cv_target+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if test "x$target_alias" = x; then+ ac_cv_target=$ac_cv_host+else+ ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` ||+ as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5+fi+ ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5+printf "%s\n" "$ac_cv_target" >&6; }+case $ac_cv_target in+*-*-*) ;;+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;+esac+target=$ac_cv_target+ac_save_IFS=$IFS; IFS='-'+set x $ac_cv_target+shift+target_cpu=$1+target_vendor=$2+shift; shift+# Remember, the first character of IFS is used to create $*,+# except with old shells:+target_os=$*+IFS=$ac_save_IFS+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac+++# The aliases save the names the user supplied, while $host etc.+# will get canonicalized.+test -n "$target_alias" &&+ test "$program_prefix$program_suffix$program_transform_name" = \+ NONENONEs,x,x, &&+ program_prefix=${target_alias}-+case $target_os in #(+ *-android*) :+ ;; #(+ *) :+ ac_fn_c_check_func "$LINENO" "telldir" "ac_cv_func_telldir"+if test "x$ac_cv_func_telldir" = xyes+then :+ printf "%s\n" "#define HAVE_TELLDIR 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "seekdir" "ac_cv_func_seekdir"+if test "x$ac_cv_func_seekdir" = xyes+then :+ printf "%s\n" "#define HAVE_SEEKDIR 1" >>confdefs.h++fi+ ;;+esac++ac_fn_c_check_func "$LINENO" "_NSGetEnviron" "ac_cv_func__NSGetEnviron"+if test "x$ac_cv_func__NSGetEnviron" = xyes+then :+ printf "%s\n" "#define HAVE__NSGETENVIRON 1" >>confdefs.h++fi+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5+printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }+if test ${ac_cv_c_undeclared_builtin_options+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_save_CFLAGS=$CFLAGS+ ac_cv_c_undeclared_builtin_options='cannot detect'+ for ac_arg in '' -fno-builtin; do+ CFLAGS="$ac_save_CFLAGS $ac_arg"+ # This test program should *not* compile successfully.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++int+main (void)+{+(void) strchr;+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :++else case e in #(+ e) # This test program should compile successfully.+ # No library function is consistently available on+ # freestanding implementations, so test against a dummy+ # declaration. Include always-available headers on the+ # off chance that they somehow elicit warnings.+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <float.h>+#include <limits.h>+#include <stdarg.h>+#include <stddef.h>+extern void ac_decl (int, char *);++int+main (void)+{+(void) ac_decl (0, (char *) 0);+ (void) ac_decl;++ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"+then :+ if test x"$ac_arg" = x+then :+ ac_cv_c_undeclared_builtin_options='none needed'+else case e in #(+ e) ac_cv_c_undeclared_builtin_options=$ac_arg ;;+esac+fi+ break+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext+ done+ CFLAGS=$ac_save_CFLAGS+ ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5+printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; }+ case $ac_cv_c_undeclared_builtin_options in #(+ 'cannot detect') :+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}+as_fn_error $? "cannot make $CC report undeclared builtins+See 'config.log' for more details" "$LINENO" 5; } ;; #(+ 'none needed') :+ ac_c_undeclared_builtin_options='' ;; #(+ *) :+ ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;;+esac++ac_fn_check_decl "$LINENO" "execvpe" "ac_cv_have_decl_execvpe" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"+if test "x$ac_cv_have_decl_execvpe" = xyes+then :+ ac_have_decl=1+else case e in #(+ e) ac_have_decl=0 ;;+esac+fi+printf "%s\n" "#define HAVE_DECL_EXECVPE $ac_have_decl" >>confdefs.h++ac_fn_c_check_func "$LINENO" "execvpe" "ac_cv_func_execvpe"+if test "x$ac_cv_func_execvpe" = xyes+then :+ printf "%s\n" "#define HAVE_EXECVPE 1" >>confdefs.h++fi+++ac_fn_check_decl "$LINENO" "CLOCKS_PER_SEC" "ac_cv_have_decl_CLOCKS_PER_SEC" "$ac_includes_default+#ifdef HAVE_TIME_H+#include <time.h>+#endif++" "$ac_c_undeclared_builtin_options" "CFLAGS"+if test "x$ac_cv_have_decl_CLOCKS_PER_SEC" = xyes+then :+ ac_have_decl=1+else case e in #(+ e) ac_have_decl=0 ;;+esac+fi+printf "%s\n" "#define HAVE_DECL_CLOCKS_PER_SEC $ac_have_decl" >>confdefs.h+if test $ac_have_decl = 1+then :++printf "%s\n" "#define HAVE_CLOCKS_PER_SEC 1" >>confdefs.h++fi+++ac_fn_c_check_member "$LINENO" "struct stat" "st_atim" "ac_cv_member_struct_stat_st_atim" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_atim" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIM 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim" "ac_cv_member_struct_stat_st_mtim" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_mtim" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIM 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_ctim" "ac_cv_member_struct_stat_st_ctim" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_ctim" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_CTIM 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec" "ac_cv_member_struct_stat_st_atimespec" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_atimespec" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIMESPEC 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimespec" "ac_cv_member_struct_stat_st_mtimespec" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_mtimespec" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIMESPEC 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_ctimespec" "ac_cv_member_struct_stat_st_ctimespec" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_ctimespec" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_CTIMESPEC 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_atimensec" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimensec" "ac_cv_member_struct_stat_st_mtimensec" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_mtimensec" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_ctimensec" "ac_cv_member_struct_stat_st_ctimensec" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_ctimensec" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_CTIMENSEC 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_atime_n" "ac_cv_member_struct_stat_st_atime_n" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_atime_n" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIME_N 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_mtime_n" "ac_cv_member_struct_stat_st_mtime_n" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_mtime_n" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIME_N 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_ctime_n" "ac_cv_member_struct_stat_st_ctime_n" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_ctime_n" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_CTIME_N 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_uatime" "ac_cv_member_struct_stat_st_uatime" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_uatime" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_UATIME 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_umtime" "ac_cv_member_struct_stat_st_umtime" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_umtime" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_UMTIME 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_uctime" "ac_cv_member_struct_stat_st_uctime" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_uctime" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_UCTIME 1" >>confdefs.h+++fi+++ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_blocks" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BLOCKS 1" >>confdefs.h+++fi++ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"+if test "x$ac_cv_member_struct_stat_st_blksize" = xyes+then :++printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BLKSIZE 1" >>confdefs.h+++fi+++ac_fn_c_check_member "$LINENO" "struct passwd" "pw_gecos" "ac_cv_member_struct_passwd_pw_gecos" "#include <pwd.h>+"+if test "x$ac_cv_member_struct_passwd_pw_gecos" = xyes+then :++else case e in #(+ e)+printf "%s\n" "#define HAVE_NO_PASSWD_PW_GECOS /**/" >>confdefs.h+ ;;+esac+fi+++# Functions for changing file timestamps+ac_fn_c_check_func "$LINENO" "utimensat" "ac_cv_func_utimensat"+if test "x$ac_cv_func_utimensat" = xyes+then :+ printf "%s\n" "#define HAVE_UTIMENSAT 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "futimens" "ac_cv_func_futimens"+if test "x$ac_cv_func_futimens" = xyes+then :+ printf "%s\n" "#define HAVE_FUTIMENS 1" >>confdefs.h++fi++ac_fn_c_check_func "$LINENO" "lutimes" "ac_cv_func_lutimes"+if test "x$ac_cv_func_lutimes" = xyes+then :+ printf "%s\n" "#define HAVE_LUTIMES 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "futimes" "ac_cv_func_futimes"+if test "x$ac_cv_func_futimes" = xyes+then :+ printf "%s\n" "#define HAVE_FUTIMES 1" >>confdefs.h++fi+++# Additional temp functions+# We explicitly check for android, as the check AC_CHECK_FUNCS performs returns "yes" for mkstemps+# when targetting android. See similar conditionals for seekdir and telldir.+case $target_os in #(+ *-android*) :+ ac_fn_c_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp"+if test "x$ac_cv_func_mkdtemp" = xyes+then :+ printf "%s\n" "#define HAVE_MKDTEMP 1" >>confdefs.h++fi+ ;; #(+ *) :+ ac_fn_c_check_func "$LINENO" "mkstemps" "ac_cv_func_mkstemps"+if test "x$ac_cv_func_mkstemps" = xyes+then :+ printf "%s\n" "#define HAVE_MKSTEMPS 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp"+if test "x$ac_cv_func_mkdtemp" = xyes+then :+ printf "%s\n" "#define HAVE_MKDTEMP 1" >>confdefs.h++fi+ ;;+esac++# Functions for file synchronization and allocation control+ac_fn_c_check_func "$LINENO" "fsync" "ac_cv_func_fsync"+if test "x$ac_cv_func_fsync" = xyes+then :+ printf "%s\n" "#define HAVE_FSYNC 1" >>confdefs.h++fi+++# On OSX linking against 'fdatasync' succeeds, but that doesn't pick+# the expected the POSIX 'fdatasync' function. So make sure that we+# also have a function declaration in scope, in addition to being able+# to link against 'fdatasync'.+ac_fn_check_decl "$LINENO" "fdatasync" "ac_cv_have_decl_fdatasync" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"+if test "x$ac_cv_have_decl_fdatasync" = xyes+then :+ ac_have_decl=1+else case e in #(+ e) ac_have_decl=0 ;;+esac+fi+printf "%s\n" "#define HAVE_DECL_FDATASYNC $ac_have_decl" >>confdefs.h+if test $ac_have_decl = 1+then :+ ac_fn_c_check_func "$LINENO" "fdatasync" "ac_cv_func_fdatasync"+if test "x$ac_cv_func_fdatasync" = xyes+then :+ printf "%s\n" "#define HAVE_FDATASYNC 1" >>confdefs.h++fi++fi++++ac_fn_c_check_func "$LINENO" "posix_fadvise" "ac_cv_func_posix_fadvise"+if test "x$ac_cv_func_posix_fadvise" = xyes+then :+ printf "%s\n" "#define HAVE_POSIX_FADVISE 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "posix_fallocate" "ac_cv_func_posix_fallocate"+if test "x$ac_cv_func_posix_fallocate" = xyes+then :+ printf "%s\n" "#define HAVE_POSIX_FALLOCATE 1" >>confdefs.h++fi+++# Some termios(3) functions known to be missing sometimes (see also #55)+ac_fn_check_decl "$LINENO" "tcdrain" "ac_cv_have_decl_tcdrain" "$ac_includes_default+#ifdef HAVE_TERMIOS_H+#include <termios.h>+#endif++" "$ac_c_undeclared_builtin_options" "CFLAGS"+if test "x$ac_cv_have_decl_tcdrain" = xyes+then :+ ac_have_decl=1+else case e in #(+ e) ac_have_decl=0 ;;+esac+fi+printf "%s\n" "#define HAVE_DECL_TCDRAIN $ac_have_decl" >>confdefs.h+if test $ac_have_decl = 1+then :++printf "%s\n" "#define HAVE_TCDRAIN 1" >>confdefs.h++fi+++ac_fn_check_decl "$LINENO" "ctermid" "ac_cv_have_decl_ctermid" "$ac_includes_default+#ifdef HAVE_TERMIOS_H+#include <termios.h>+#endif++" "$ac_c_undeclared_builtin_options" "CFLAGS"+if test "x$ac_cv_have_decl_ctermid" = xyes+then :+ ac_have_decl=1+else case e in #(+ e) ac_have_decl=0 ;;+esac+fi+printf "%s\n" "#define HAVE_DECL_CTERMID $ac_have_decl" >>confdefs.h+if test $ac_have_decl = 1+then :++printf "%s\n" "#define HAVE_CTERMID 1" >>confdefs.h++fi+++# Avoid adding rt if absent or unneeded+# shm_open needs -lrt on linux+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing shm_open" >&5+printf %s "checking for library containing shm_open... " >&6; }+if test ${ac_cv_search_shm_open+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_func_search_save_LIBS=$LIBS+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply.+ The 'extern "C"' is for builds by C++ compilers;+ although this is not generally supported in C code supporting it here+ has little cost and some practical benefit (sr 110532). */+#ifdef __cplusplus+extern "C"+#endif+char shm_open (void);+int+main (void)+{+return shm_open ();+ ;+ return 0;+}+_ACEOF+for ac_lib in '' rt+do+ if test -z "$ac_lib"; then+ ac_res="none required"+ else+ ac_res=-l$ac_lib+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"+ fi+ if ac_fn_c_try_link "$LINENO"+then :+ ac_cv_search_shm_open=$ac_res+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam \+ conftest$ac_exeext+ if test ${ac_cv_search_shm_open+y}+then :+ break+fi+done+if test ${ac_cv_search_shm_open+y}+then :++else case e in #(+ e) ac_cv_search_shm_open=no ;;+esac+fi+rm conftest.$ac_ext+LIBS=$ac_func_search_save_LIBS ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_shm_open" >&5+printf "%s\n" "$ac_cv_search_shm_open" >&6; }+ac_res=$ac_cv_search_shm_open+if test "$ac_res" != no+then :+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"+ ac_fn_c_check_func "$LINENO" "shm_open" "ac_cv_func_shm_open"+if test "x$ac_cv_func_shm_open" = xyes+then :+ printf "%s\n" "#define HAVE_SHM_OPEN 1" >>confdefs.h++fi+ac_fn_c_check_func "$LINENO" "shm_unlink" "ac_cv_func_shm_unlink"+if test "x$ac_cv_func_shm_unlink" = xyes+then :+ printf "%s\n" "#define HAVE_SHM_UNLINK 1" >>confdefs.h++fi++fi++if test "x$ac_cv_search_shm_open" = x-lrt+then :+ EXTRA_LIBS="$EXTRA_LIBS rt"+fi++for fp_const_name in SIGABRT SIGALRM SIGBUS SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2 SIGPOLL SIGPROF SIGSYS SIGTRAP SIGURG SIGVTALRM SIGXCPU SIGXFSZ SIG_BLOCK SIG_SETMASK SIG_UNBLOCK SIGINFO SIGWINCH+do+as_fp_Cache=`printf "%s\n" "fp_cv_const_$fp_const_name" | sed "$as_sed_sh"`+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking value of $fp_const_name" >&5+printf %s "checking value of $fp_const_name... " >&6; }+if eval test \${$as_fp_Cache+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) if ac_fn_c_compute_int "$LINENO" "$fp_const_name" "fp_check_const_result" "+#if HAVE_SIGNAL_H+#include <signal.h>+#endif+"+then :++else case e in #(+ e) fp_check_const_result='-1' ;;+esac+fi++eval "$as_fp_Cache=\$fp_check_const_result" ;;+esac+fi+eval ac_res=\$$as_fp_Cache+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+printf "%s\n" "$ac_res" >&6; }+cat >>confdefs.h <<_ACEOF+#define `printf "%s\n" "CONST_$fp_const_name" | sed "$as_sed_cpp"` `eval 'as_val=${'$as_fp_Cache'};printf "%s\n" "$as_val"'`+_ACEOF++done+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _SC_GETGR_R_SIZE_MAX" >&5+printf %s "checking for _SC_GETGR_R_SIZE_MAX... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++#include <unistd.h>+#ifdef _SC_GETGR_R_SIZE_MAX+we_have_that_sysconf_thing+#endif++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP_TRADITIONAL "we_have_that_sysconf_thing" >/dev/null 2>&1+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_SC_GETGR_R_SIZE_MAX 1" >>confdefs.h++else case e in #(+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; } ;;+esac+fi+rm -rf conftest*+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _SC_GETPW_R_SIZE_MAX" >&5+printf %s "checking for _SC_GETPW_R_SIZE_MAX... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++#include <unistd.h>+#ifdef _SC_GETPW_R_SIZE_MAX+we_have_that_sysconf_thing+#endif++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP_TRADITIONAL "we_have_that_sysconf_thing" >/dev/null 2>&1+then :+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_SC_GETPW_R_SIZE_MAX 1" >>confdefs.h++else case e in #(+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; } ;;+esac+fi+rm -rf conftest*++++### On some systems usleep has no return value. If it does have one,+### we'd like to return it; otherwise, we'll fake it.+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking return type of usleep" >&5+printf %s "checking return type of usleep... " >&6; }+if test ${fptools_cv_func_usleep_return_type+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <unistd.h>++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP_TRADITIONAL "void[ ]+usleep" >/dev/null 2>&1+then :+ fptools_cv_func_usleep_return_type=void+else case e in #(+ e) fptools_cv_func_usleep_return_type=int ;;+esac+fi+rm -rf conftest*+ ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_func_usleep_return_type" >&5+printf "%s\n" "$fptools_cv_func_usleep_return_type" >&6; }+case "$fptools_cv_func_usleep_return_type" in+ "void" )++printf "%s\n" "#define USLEEP_RETURNS_VOID 1" >>confdefs.h++ ;;+esac++### POSIX.1003.1 unsetenv returns 0 or -1 (EINVAL), but older implementations+### in common use return void.+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking return type of unsetenv" >&5+printf %s "checking return type of unsetenv... " >&6; }+if test ${fptools_cv_func_unsetenv_return_type+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <stdlib.h>++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP_TRADITIONAL "void[ ]+unsetenv" >/dev/null 2>&1+then :+ fptools_cv_func_unsetenv_return_type=void+else case e in #(+ e) fptools_cv_func_unsetenv_return_type=int ;;+esac+fi+rm -rf conftest*+ ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fptools_cv_func_unsetenv_return_type" >&5+printf "%s\n" "$fptools_cv_func_unsetenv_return_type" >&6; }+case "$fptools_cv_func_unsetenv_return_type" in+ "void" )++printf "%s\n" "#define UNSETENV_RETURNS_VOID 1" >>confdefs.h++ ;;+esac++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for RTLD_NEXT from dlfcn.h" >&5+printf %s "checking for RTLD_NEXT from dlfcn.h... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++ #include <dlfcn.h>+ #ifdef RTLD_NEXT+ yes+ #endif++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP_TRADITIONAL "yes" >/dev/null 2>&1+then :++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_RTLDNEXT 1" >>confdefs.h+++else case e in #(+ e)+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+ ;;+esac+fi+rm -rf conftest*+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for RTLD_DEFAULT from dlfcn.h" >&5+printf %s "checking for RTLD_DEFAULT from dlfcn.h... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++ #include <dlfcn.h>+ #ifdef RTLD_DEFAULT+ yes+ #endif++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP_TRADITIONAL "yes" >/dev/null 2>&1+then :++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_RTLDDEFAULT 1" >>confdefs.h+++else case e in #(+ e)+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+ ;;+esac+fi+rm -rf conftest*++++ for ac_func in openpty+do :+ ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty"+if test "x$ac_cv_func_openpty" = xyes+then :+ printf "%s\n" "#define HAVE_OPENPTY 1" >>confdefs.h++else case e in #(+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5+printf %s "checking for openpty in -lutil... " >&6; }+if test ${ac_cv_lib_util_openpty+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_check_lib_save_LIBS=$LIBS+LIBS="-lutil $LIBS"+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply.+ The 'extern "C"' is for builds by C++ compilers;+ although this is not generally supported in C code supporting it here+ has little cost and some practical benefit (sr 110532). */+#ifdef __cplusplus+extern "C"+#endif+char openpty (void);+int+main (void)+{+return openpty ();+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_link "$LINENO"+then :+ ac_cv_lib_util_openpty=yes+else case e in #(+ e) ac_cv_lib_util_openpty=no ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam \+ conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5+printf "%s\n" "$ac_cv_lib_util_openpty" >&6; }+if test "x$ac_cv_lib_util_openpty" = xyes+then :+ printf "%s\n" "#define HAVE_OPENPTY 1" >>confdefs.h+ EXTRA_LIBS="$EXTRA_LIBS util"+else case e in #(+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for openpty in -lbsd" >&5+printf %s "checking for openpty in -lbsd... " >&6; }+if test ${ac_cv_lib_bsd_openpty+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_check_lib_save_LIBS=$LIBS+LIBS="-lbsd $LIBS"+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply.+ The 'extern "C"' is for builds by C++ compilers;+ although this is not generally supported in C code supporting it here+ has little cost and some practical benefit (sr 110532). */+#ifdef __cplusplus+extern "C"+#endif+char openpty (void);+int+main (void)+{+return openpty ();+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_link "$LINENO"+then :+ ac_cv_lib_bsd_openpty=yes+else case e in #(+ e) ac_cv_lib_bsd_openpty=no ;;+esac+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam \+ conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_openpty" >&5+printf "%s\n" "$ac_cv_lib_bsd_openpty" >&6; }+if test "x$ac_cv_lib_bsd_openpty" = xyes+then :+ printf "%s\n" "#define HAVE_OPENPTY 1" >>confdefs.h+ EXTRA_LIBS="$EXTRA_LIBS bsd"+fi++ ;;+esac+fi++ ;;+esac+fi++done++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5+printf %s "checking for /dev/ptmx... " >&6; }+if test -r /dev/ptmx+then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_DEV_PTMX 1" >>confdefs.h++else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5+printf %s "checking for /dev/ptc... " >&6; }+if test -r /dev/ptc+then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5+printf "%s\n" "yes" >&6; }++printf "%s\n" "#define HAVE_DEV_PTC 1" >>confdefs.h++else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5+printf "%s\n" "no" >&6; }+fi++# Avoid adding dl if absent or unneeded+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5+printf %s "checking for library containing dlopen... " >&6; }+if test ${ac_cv_search_dlopen+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_func_search_save_LIBS=$LIBS+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply.+ The 'extern "C"' is for builds by C++ compilers;+ although this is not generally supported in C code supporting it here+ has little cost and some practical benefit (sr 110532). */+#ifdef __cplusplus+extern "C"+#endif+char dlopen (void);+int+main (void)+{+return dlopen ();+ ;+ return 0;+}+_ACEOF+for ac_lib in '' dl+do+ if test -z "$ac_lib"; then+ ac_res="none required"+ else+ ac_res=-l$ac_lib+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"+ fi+ if ac_fn_c_try_link "$LINENO"+then :+ ac_cv_search_dlopen=$ac_res+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam \+ conftest$ac_exeext+ if test ${ac_cv_search_dlopen+y}+then :+ break+fi+done+if test ${ac_cv_search_dlopen+y}+then :++else case e in #(+ e) ac_cv_search_dlopen=no ;;+esac+fi+rm conftest.$ac_ext+LIBS=$ac_func_search_save_LIBS ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5+printf "%s\n" "$ac_cv_search_dlopen" >&6; }+ac_res=$ac_cv_search_dlopen+if test "$ac_res" != no+then :+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"+ EXTRA_LIBS="$EXTRA_LIBS $ac_lib"+fi+++# -{l,}pthread goo+++{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing sem_close" >&5+printf %s "checking for library containing sem_close... " >&6; }+if test ${ac_cv_search_sem_close+y}+then :+ printf %s "(cached) " >&6+else case e in #(+ e) ac_func_search_save_LIBS=$LIBS+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply.+ The 'extern "C"' is for builds by C++ compilers;+ although this is not generally supported in C code supporting it here+ has little cost and some practical benefit (sr 110532). */+#ifdef __cplusplus+extern "C"+#endif+char sem_close (void);+int+main (void)+{+return sem_close ();+ ;+ return 0;+}+_ACEOF+for ac_lib in '' pthread+do+ if test -z "$ac_lib"; then+ ac_res="none required"+ else+ ac_res=-l$ac_lib+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"+ fi+ if ac_fn_c_try_link "$LINENO"+then :+ ac_cv_search_sem_close=$ac_res+fi+rm -f core conftest.err conftest.$ac_objext conftest.beam \+ conftest$ac_exeext+ if test ${ac_cv_search_sem_close+y}+then :+ break+fi+done+if test ${ac_cv_search_sem_close+y}+then :++else case e in #(+ e) ac_cv_search_sem_close=no ;;+esac+fi+rm conftest.$ac_ext+LIBS=$ac_func_search_save_LIBS ;;+esac+fi+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sem_close" >&5+printf "%s\n" "$ac_cv_search_sem_close" >&6; }+ac_res=$ac_cv_search_sem_close+if test "$ac_res" != no+then :+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"+ EXTRA_LIBS="$EXTRA_LIBS $ac_lib"+else case e in #(+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Not found" >&5+printf "%s\n" "$as_me: Not found" >&6;} ;;+esac+fi+++ac_fn_check_decl "$LINENO" "sem_getvalue" "ac_cv_have_decl_sem_getvalue" "$ac_includes_default+#include <semaphore.h>++" "$ac_c_undeclared_builtin_options" "CFLAGS"+if test "x$ac_cv_have_decl_sem_getvalue" = xyes+then :+ ac_have_decl=1+else case e in #(+ e) ac_have_decl=0 ;;+esac+fi+printf "%s\n" "#define HAVE_DECL_SEM_GETVALUE $ac_have_decl" >>confdefs.h+if test $ac_have_decl = 1+then :++printf "%s\n" "#define HAVE_SEM_GETVALUE 1" >>confdefs.h++fi++++ac_config_files="$ac_config_files unix.buildinfo"+++cat >confcache <<\_ACEOF+# This file is a shell script that caches the results of configure+# tests run on this system so they can be shared between configure+# scripts and configure runs, see configure's option --config-cache.+# It is not useful on other systems. If it contains results you don't+# want to keep, you may remove or edit it.+#+# config.status only pays attention to the cache file if you give it+# the --recheck option to rerun configure.+#+# 'ac_cv_env_foo' variables (set or unset) will be overridden when+# loading this file, other *unset* 'ac_cv_foo' will be assigned the+# following values.++_ACEOF++# The following way of writing the cache mishandles newlines in values,+# but we know of no workaround that is simple, portable, and efficient.+# So, we kill variables containing newlines.+# Ultrix sh set writes to stderr and can't be redirected directly,+# and sets the high bit in the cache file unless we assign to the vars.+(+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do+ eval ac_val=\$$ac_var+ case $ac_val in #(+ *${as_nl}*)+ case $ac_var in #(+ *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;+ esac+ case $ac_var in #(+ _ | IFS | as_nl) ;; #(+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(+ *) { eval $ac_var=; unset $ac_var;} ;;+ esac ;;+ esac+ done++ (set) 2>&1 |+ case $as_nl`(ac_space=' '; set) 2>&1` in #(+ *${as_nl}ac_space=\ *)+ # 'set' does not quote correctly, so add quotes: double-quote+ # substitution turns \\\\ into \\, and sed turns \\ into \.+ sed -n \+ "s/'/'\\\\''/g;+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"+ ;; #(+ *)+ # 'set' quotes correctly as required by POSIX, so do not add quotes.+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"+ ;;+ esac |+ sort+) |+ sed '+ /^ac_cv_env_/b end+ t clear+ :clear+ s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/+ t end+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/+ :end' >>confcache+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else+ if test -w "$cache_file"; then+ if test "x$cache_file" != "x/dev/null"; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5+printf "%s\n" "$as_me: updating cache $cache_file" >&6;}+ if test ! -f "$cache_file" || test -h "$cache_file"; then+ cat confcache >"$cache_file"+ else+ case $cache_file in #(+ */* | ?:*)+ mv -f confcache "$cache_file"$$ &&+ mv -f "$cache_file"$$ "$cache_file" ;; #(+ *)+ mv -f confcache "$cache_file" ;;+ esac+ fi+ fi+ else+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5+printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;}+ fi+fi+rm -f confcache++test "x$prefix" = xNONE && prefix=$ac_default_prefix+# Let make expand exec_prefix.+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'++DEFS=-DHAVE_CONFIG_H++ac_libobjs=+ac_ltlibobjs=+U=+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue+ # 1. Remove the extension, and $U if already installed.+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'+ ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"`+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR+ # will be set to the directory where LIBOBJS objects are built.+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'+done+LIBOBJS=$ac_libobjs++LTLIBOBJS=$ac_ltlibobjs+++# Check whether --enable-year2038 was given.+if test ${enable_year2038+y}+then :+ enableval=$enable_year2038;+fi+++: "${CONFIG_STATUS=./config.status}"+ac_write_fail=0+ac_clean_files_save=$ac_clean_files+ac_clean_files="$ac_clean_files $CONFIG_STATUS"+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5+printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;}+as_write_fail=0+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1+#! $SHELL+# Generated by $as_me.+# Run this file to recreate the current configuration.+# Compiler output produced by configure, useful for debugging+# configure, is in config.log if it exists.++debug=false+ac_cs_recheck=false+ac_cs_silent=false++SHELL=\${CONFIG_SHELL-$SHELL}+export SHELL+_ASEOF+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1+## -------------------- ##+## M4sh Initialization. ##+## -------------------- ##++# Be more Bourne compatible+DUALCASE=1; export DUALCASE # for MKS sh+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1+then :+ emulate sh+ NULLCMD=:+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which+ # is contrary to our usage. Disable this feature.+ alias -g '${1+"$@"}'='"$@"'+ setopt NO_GLOB_SUBST+else case e in #(+ e) case `(set -o) 2>/dev/null` in #(+ *posix*) :+ set -o posix ;; #(+ *) :+ ;;+esac ;;+esac+fi++++# Reset variables that may have inherited troublesome values from+# the environment.++# IFS needs to be set, to space, tab, and newline, in precisely that order.+# (If _AS_PATH_WALK were called with IFS unset, it would have the+# side effect of setting IFS to empty, thus disabling word splitting.)+# Quoting is to prevent editors from complaining about space-tab.+as_nl='+'+export as_nl+IFS=" "" $as_nl"++PS1='$ '+PS2='> '+PS4='+ '++# Ensure predictable behavior from utilities with locale-dependent output.+LC_ALL=C+export LC_ALL+LANGUAGE=C+export LANGUAGE++# We cannot yet rely on "unset" to work, but we need these variables+# to be unset--not just set to an empty or harmless value--now, to+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct+# also avoids known problems related to "unset" and subshell syntax+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH+do eval test \${$as_var+y} \+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :+done++# Ensure that fds 0, 1, and 2 are open.+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi+if (exec 3>&2) ; then :; else exec 2>/dev/null; fi++# The user is always right.+if ${PATH_SEPARATOR+false} :; then+ PATH_SEPARATOR=:+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||+ PATH_SEPARATOR=';'+ }+fi+++# Find who we are. Look in the path if we contain no directory separator.+as_myself=+case $0 in #((+ *[\\/]* ) as_myself=$0 ;;+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in $PATH+do+ IFS=$as_save_IFS+ case $as_dir in #(((+ '') as_dir=./ ;;+ */) ;;+ *) as_dir=$as_dir/ ;;+ esac+ test -r "$as_dir$0" && as_myself=$as_dir$0 && break+ done+IFS=$as_save_IFS++ ;;+esac+# We did not find ourselves, most probably we were run as 'sh COMMAND'+# in which case we are not to be found in the path.+if test "x$as_myself" = x; then+ as_myself=$0+fi+if test ! -f "$as_myself"; then+ printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2+ exit 1+fi++++# as_fn_error STATUS ERROR [LINENO LOG_FD]+# ----------------------------------------+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the+# script with STATUS, using 1 if that was 0.+as_fn_error ()+{+ as_status=$1; test $as_status -eq 0 && as_status=1+ if test "$4"; then+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4+ fi+ printf "%s\n" "$as_me: error: $2" >&2+ as_fn_exit $as_status+} # as_fn_error+++# as_fn_set_status STATUS+# -----------------------+# Set $? to STATUS, without forking.+as_fn_set_status ()+{+ return $1+} # as_fn_set_status++# as_fn_exit STATUS+# -----------------+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.+as_fn_exit ()+{+ set +e+ as_fn_set_status $1+ exit $1+} # as_fn_exit++# as_fn_unset VAR+# ---------------+# Portably unset VAR.+as_fn_unset ()+{+ { eval $1=; unset $1;}+}+as_unset=as_fn_unset++# as_fn_append VAR VALUE+# ----------------------+# Append the text in VALUE to the end of the definition contained in VAR. Take+# advantage of any shell optimizations that allow amortized linear growth over+# repeated appends, instead of the typical quadratic growth present in naive+# implementations.+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null+then :+ eval 'as_fn_append ()+ {+ eval $1+=\$2+ }'+else case e in #(+ e) as_fn_append ()+ {+ eval $1=\$$1\$2+ } ;;+esac+fi # as_fn_append++# as_fn_arith ARG...+# ------------------+# Perform arithmetic evaluation on the ARGs, and store the result in the+# global $as_val. Take advantage of shells that can avoid forks. The arguments+# must be portable across $(()) and expr.+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null+then :+ eval 'as_fn_arith ()+ {+ as_val=$(( $* ))+ }'+else case e in #(+ e) as_fn_arith ()+ {+ as_val=`expr "$@" || test $? -eq 1`+ } ;;+esac+fi # as_fn_arith+++if expr a : '\(a\)' >/dev/null 2>&1 &&+ test "X`expr 00001 : '.*\(...\)'`" = X001; then+ as_expr=expr+else+ as_expr=false+fi++if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then+ as_basename=basename+else+ as_basename=false+fi++if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then+ as_dirname=dirname+else+ as_dirname=false+fi++as_me=`$as_basename -- "$0" ||+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \+ X"$0" : 'X\(//\)$' \| \+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||+printf "%s\n" X/"$0" |+ sed '/^.*\/\([^/][^/]*\)\/*$/{+ s//\1/+ q+ }+ /^X\/\(\/\/\)$/{+ s//\1/+ q+ }+ /^X\/\(\/\).*/{+ s//\1/+ q+ }+ s/.*/./; q'`++# Avoid depending upon Character Ranges.+as_cr_letters='abcdefghijklmnopqrstuvwxyz'+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'+as_cr_Letters=$as_cr_letters$as_cr_LETTERS+as_cr_digits='0123456789'+as_cr_alnum=$as_cr_Letters$as_cr_digits+++# Determine whether it's possible to make 'echo' print without a newline.+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed+# for compatibility with existing Makefiles.+ECHO_C= ECHO_N= ECHO_T=+case `echo -n x` in #(((((+-n*)+ case `echo 'xy\c'` in+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.+ xy) ECHO_C='\c';;+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null+ ECHO_T=' ';;+ esac;;+*)+ ECHO_N='-n';;+esac++# For backward compatibility with old third-party macros, we provide+# the shell variables $as_echo and $as_echo_n. New code should use+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.+as_echo='printf %s\n'+as_echo_n='printf %s'++rm -f conf$$ conf$$.exe conf$$.file+if test -d conf$$.dir; then+ rm -f conf$$.dir/conf$$.file+else+ rm -f conf$$.dir+ mkdir conf$$.dir 2>/dev/null+fi+if (echo >conf$$.file) 2>/dev/null; then+ if ln -s conf$$.file conf$$ 2>/dev/null; then+ as_ln_s='ln -s'+ # ... but there are two gotchas:+ # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail.+ # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable.+ # In both cases, we have to default to 'cp -pR'.+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||+ as_ln_s='cp -pR'+ elif ln conf$$.file conf$$ 2>/dev/null; then+ as_ln_s=ln+ else+ as_ln_s='cp -pR'+ fi+else+ as_ln_s='cp -pR'+fi+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file+rmdir conf$$.dir 2>/dev/null+++# as_fn_mkdir_p+# -------------+# Create "$as_dir" as a directory, including parents if necessary.+as_fn_mkdir_p ()+{++ case $as_dir in #(+ -*) as_dir=./$as_dir;;+ esac+ test -d "$as_dir" || eval $as_mkdir_p || {+ as_dirs=+ while :; do+ case $as_dir in #(+ *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(+ *) as_qdir=$as_dir;;+ esac+ as_dirs="'$as_qdir' $as_dirs"+ as_dir=`$as_dirname -- "$as_dir" ||+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$as_dir" : 'X\(//\)[^/]' \| \+ X"$as_dir" : 'X\(//\)$' \| \+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||+printf "%s\n" X"$as_dir" |+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{+ s//\1/+ q+ }+ /^X\(\/\/\)[^/].*/{+ s//\1/+ q+ }+ /^X\(\/\/\)$/{+ s//\1/+ q+ }+ /^X\(\/\).*/{+ s//\1/+ q+ }+ s/.*/./; q'`+ test -d "$as_dir" && break+ done+ test -z "$as_dirs" || eval "mkdir $as_dirs"+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"+++} # as_fn_mkdir_p+if mkdir -p . 2>/dev/null; then+ as_mkdir_p='mkdir -p "$as_dir"'+else+ test -d ./-p && rmdir ./-p+ as_mkdir_p=false+fi+++# as_fn_executable_p FILE+# -----------------------+# Test if FILE is an executable regular file.+as_fn_executable_p ()+{+ test -f "$1" && test -x "$1"+} # as_fn_executable_p+as_test_x='test -x'+as_executable_p=as_fn_executable_p++# Sed expression to map a string onto a valid CPP name.+as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"+as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated++# Sed expression to map a string onto a valid variable name.+as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g"+as_tr_sh="eval sed '$as_sed_sh'" # deprecated+++exec 6>&1+## ----------------------------------- ##+## Main body of $CONFIG_STATUS script. ##+## ----------------------------------- ##+_ASEOF+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+# Save the log message, to keep $0 and so on meaningful, and to+# report actual input values of CONFIG_FILES etc. instead of their+# values after options handling.+ac_log="+This file was extended by Haskell unix package $as_me 2.0, which was+generated by GNU Autoconf 2.72. Invocation command line was++ CONFIG_FILES = $CONFIG_FILES+ CONFIG_HEADERS = $CONFIG_HEADERS+ CONFIG_LINKS = $CONFIG_LINKS+ CONFIG_COMMANDS = $CONFIG_COMMANDS+ $ $0 $@++on `(hostname || uname -n) 2>/dev/null | sed 1q`+"++_ACEOF++case $ac_config_files in *"+"*) set x $ac_config_files; shift; ac_config_files=$*;;+esac++case $ac_config_headers in *"+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;+esac+++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+# Files that config.status was made for.+config_files="$ac_config_files"+config_headers="$ac_config_headers"++_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+ac_cs_usage="\+'$as_me' instantiates files and other configuration actions+from templates according to the current configuration. Unless the files+and actions are specified as TAGs, all are instantiated by default.++Usage: $0 [OPTION]... [TAG]...++ -h, --help print this help, then exit+ -V, --version print version number and configuration settings, then exit+ --config print configuration, then exit+ -q, --quiet, --silent+ do not print progress messages+ -d, --debug don't remove temporary files+ --recheck update $as_me by reconfiguring in the same conditions+ --file=FILE[:TEMPLATE]+ instantiate the configuration file FILE+ --header=FILE[:TEMPLATE]+ instantiate the configuration header FILE++Configuration files:+$config_files++Configuration headers:+$config_headers++Report bugs to <libraries@haskell.org>."++_ACEOF+ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"`+ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"`+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+ac_cs_config='$ac_cs_config_escaped'+ac_cs_version="\\+Haskell unix package config.status 2.0+configured by $0, generated by GNU Autoconf 2.72,+ with options \\"\$ac_cs_config\\"++Copyright (C) 2023 Free Software Foundation, Inc.+This config.status script is free software; the Free Software Foundation+gives unlimited permission to copy, distribute and modify it."++ac_pwd='$ac_pwd'+srcdir='$srcdir'+test -n "\$AWK" || AWK=awk+_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+# The default lists apply if the user does not specify any file.+ac_need_defaults=:+while test $# != 0+do+ case $1 in+ --*=?*)+ ac_option=`expr "X$1" : 'X\([^=]*\)='`+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`+ ac_shift=:+ ;;+ --*=)+ ac_option=`expr "X$1" : 'X\([^=]*\)='`+ ac_optarg=+ ac_shift=:+ ;;+ *)+ ac_option=$1+ ac_optarg=$2+ ac_shift=shift+ ;;+ esac++ case $ac_option in+ # Handling of the options.+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)+ ac_cs_recheck=: ;;+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )+ printf "%s\n" "$ac_cs_version"; exit ;;+ --config | --confi | --conf | --con | --co | --c )+ printf "%s\n" "$ac_cs_config"; exit ;;+ --debug | --debu | --deb | --de | --d | -d )+ debug=: ;;+ --file | --fil | --fi | --f )+ $ac_shift+ case $ac_optarg in+ *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;+ '') as_fn_error $? "missing file argument" ;;+ esac+ as_fn_append CONFIG_FILES " '$ac_optarg'"+ ac_need_defaults=false;;+ --header | --heade | --head | --hea )+ $ac_shift+ case $ac_optarg in+ *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;+ esac+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"+ ac_need_defaults=false;;+ --he | --h)+ # Conflict between --help and --header+ as_fn_error $? "ambiguous option: '$1'+Try '$0 --help' for more information.";;+ --help | --hel | -h )+ printf "%s\n" "$ac_cs_usage"; exit ;;+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \+ | -silent | --silent | --silen | --sile | --sil | --si | --s)+ ac_cs_silent=: ;;++ # This is an error.+ -*) as_fn_error $? "unrecognized option: '$1'+Try '$0 --help' for more information." ;;++ *) as_fn_append ac_config_targets " $1"+ ac_need_defaults=false ;;++ esac+ shift+done++ac_configure_extra_args=++if $ac_cs_silent; then+ exec 6>/dev/null+ ac_configure_extra_args="$ac_configure_extra_args --silent"+fi++_ACEOF+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+if \$ac_cs_recheck; then+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion+ shift+ \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6+ CONFIG_SHELL='$SHELL'+ export CONFIG_SHELL+ exec "\$@"+fi++_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+exec 5>>config.log+{+ echo+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX+## Running $as_me. ##+_ASBOX+ printf "%s\n" "$ac_log"+} >&5++_ACEOF+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1++# Handling of arguments.+for ac_config_target in $ac_config_targets+do+ case $ac_config_target in+ "include/HsUnixConfig.h") CONFIG_HEADERS="$CONFIG_HEADERS include/HsUnixConfig.h" ;;+ "unix.buildinfo") CONFIG_FILES="$CONFIG_FILES unix.buildinfo" ;;++ *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;;+ esac+done+++# If the user did not use the arguments to specify the items to instantiate,+# then the envvar interface is used. Set only those that are not.+# We use the long form for the default assignment because of an extremely+# bizarre bug on SunOS 4.1.3.+if $ac_need_defaults; then+ test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files+ test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers+fi++# Have a temporary directory for convenience. Make it in the build tree+# simply because there is no reason against having it here, and in addition,+# creating and moving files from /tmp can sometimes cause problems.+# Hook for its removal unless debugging.+# Note that there is a small window in which the directory will not be cleaned:+# after its creation but before its name has been assigned to '$tmp'.+$debug ||+{+ tmp= ac_tmp=+ trap 'exit_status=$?+ : "${ac_tmp:=$tmp}"+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status+' 0+ trap 'as_fn_exit 1' 1 2 13 15+}+# Create a (secure) tmp directory for tmp files.++{+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&+ test -d "$tmp"+} ||+{+ tmp=./conf$$-$RANDOM+ (umask 077 && mkdir "$tmp")+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5+ac_tmp=$tmp++# Set up the scripts for CONFIG_FILES section.+# No need to generate them if there are no CONFIG_FILES.+# This happens for instance with './config.status config.h'.+if test -n "$CONFIG_FILES"; then+++ac_cr=`echo X | tr X '\015'`+# On cygwin, bash can eat \r inside `` if the user requested igncr.+# But we know of no other shell where ac_cr would be empty at this+# point, so we can use a bashism as a fallback.+if test "x$ac_cr" = x; then+ eval ac_cr=\$\'\\r\'+fi+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then+ ac_cs_awk_cr='\\r'+else+ ac_cs_awk_cr=$ac_cr+fi++echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&+_ACEOF+++{+ echo "cat >conf$$subs.awk <<_ACEOF" &&+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&+ echo "_ACEOF"+} >conf$$subs.sh ||+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`+ac_delim='%!_!# '+for ac_last_try in false false false false false :; do+ . ./conf$$subs.sh ||+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5++ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`+ if test $ac_delim_n = $ac_delim_num; then+ break+ elif $ac_last_try; then+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5+ else+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "+ fi+done+rm -f conf$$subs.sh++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&+_ACEOF+sed -n '+h+s/^/S["/; s/!.*/"]=/+p+g+s/^[^!]*!//+:repl+t repl+s/'"$ac_delim"'$//+t delim+:nl+h+s/\(.\{148\}\)..*/\1/+t more1+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/+p+n+b repl+:more1+s/["\\]/\\&/g; s/^/"/; s/$/"\\/+p+g+s/.\{148\}//+t nl+:delim+h+s/\(.\{148\}\)..*/\1/+t more2+s/["\\]/\\&/g; s/^/"/; s/$/"/+p+b+:more2+s/["\\]/\\&/g; s/^/"/; s/$/"\\/+p+g+s/.\{148\}//+t delim+' <conf$$subs.awk | sed '+/^[^""]/{+ N+ s/\n//+}+' >>$CONFIG_STATUS || ac_write_fail=1+rm -f conf$$subs.awk+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+_ACAWK+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&+ for (key in S) S_is_set[key] = 1+ FS = ""++}+{+ line = $ 0+ nfields = split(line, field, "@")+ substed = 0+ len = length(field[1])+ for (i = 2; i < nfields; i++) {+ key = field[i]+ keylen = length(key)+ if (S_is_set[key]) {+ value = S[key]+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)+ len += length(value) + length(field[++i])+ substed = 1+ } else+ len += 1 + keylen+ }++ print line+}++_ACAWK+_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"+else+ cat+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5+_ACEOF++# VPATH may cause trouble with some makes, so we remove sole $(srcdir),+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and+# trailing colons and then remove the whole line if VPATH becomes empty+# (actually we leave an empty line to preserve line numbers).+if test "x$srcdir" = x.; then+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{+h+s///+s/^/:/+s/[ ]*$/:/+s/:\$(srcdir):/:/g+s/:\${srcdir}:/:/g+s/:@srcdir@:/:/g+s/^:*//+s/:*$//+x+s/\(=[ ]*\).*/\1/+G+s/\n//+s/^[^=]*=[ ]*$//+}'+fi++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+fi # test -n "$CONFIG_FILES"++# Set up the scripts for CONFIG_HEADERS section.+# No need to generate them if there are no CONFIG_HEADERS.+# This happens for instance with './config.status Makefile'.+if test -n "$CONFIG_HEADERS"; then+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||+BEGIN {+_ACEOF++# Transform confdefs.h into an awk script 'defines.awk', embedded as+# here-document in config.status, that substitutes the proper values into+# config.h.in to produce config.h.++# Create a delimiter string that does not exist in confdefs.h, to ease+# handling of long lines.+ac_delim='%!_!# '+for ac_last_try in false false :; do+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`+ if test -z "$ac_tt"; then+ break+ elif $ac_last_try; then+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5+ else+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "+ fi+done++# For the awk script, D is an array of macro values keyed by name,+# likewise P contains macro parameters if any. Preserve backslash+# newline sequences.++ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*+sed -n '+s/.\{148\}/&'"$ac_delim"'/g+t rset+:rset+s/^[ ]*#[ ]*define[ ][ ]*/ /+t def+d+:def+s/\\$//+t bsnl+s/["\\]/\\&/g+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\+D["\1"]=" \3"/p+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p+d+:bsnl+s/["\\]/\\&/g+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\+D["\1"]=" \3\\\\\\n"\\/p+t cont+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p+t cont+d+:cont+n+s/.\{148\}/&'"$ac_delim"'/g+t clear+:clear+s/\\$//+t bsnlc+s/["\\]/\\&/g; s/^/"/; s/$/"/p+d+:bsnlc+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p+b cont+' <confdefs.h | sed '+s/'"$ac_delim"'/"\\\+"/g' >>$CONFIG_STATUS || ac_write_fail=1++cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+ for (key in D) D_is_set[key] = 1+ FS = ""+}+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {+ line = \$ 0+ split(line, arg, " ")+ if (arg[1] == "#") {+ defundef = arg[2]+ mac1 = arg[3]+ } else {+ defundef = substr(arg[1], 2)+ mac1 = arg[2]+ }+ split(mac1, mac2, "(") #)+ macro = mac2[1]+ prefix = substr(line, 1, index(line, defundef) - 1)+ if (D_is_set[macro]) {+ # Preserve the white space surrounding the "#".+ print prefix "define", macro P[macro] D[macro]+ next+ } else {+ # Replace #undef with comments. This is necessary, for example,+ # in the case of _POSIX_SOURCE, which is predefined and required+ # on some systems where configure will not decide to define it.+ if (defundef == "undef") {+ print "/*", prefix defundef, macro, "*/"+ next+ }+ }+}+{ print }+_ACAWK+_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5+fi # test -n "$CONFIG_HEADERS"+++eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "+shift+for ac_tag+do+ case $ac_tag in+ :[FHLC]) ac_mode=$ac_tag; continue;;+ esac+ case $ac_mode$ac_tag in+ :[FHL]*:*);;+ :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;;+ :[FH]-) ac_tag=-:-;;+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;+ esac+ ac_save_IFS=$IFS+ IFS=:+ set x $ac_tag+ IFS=$ac_save_IFS+ shift+ ac_file=$1+ shift++ case $ac_mode in+ :L) ac_source=$1;;+ :[FH])+ ac_file_inputs=+ for ac_f+ do+ case $ac_f in+ -) ac_f="$ac_tmp/stdin";;+ *) # Look for the file first in the build tree, then in the source tree+ # (if the path is not absolute). The absolute path cannot be DOS-style,+ # because $ac_f cannot contain ':'.+ test -f "$ac_f" ||+ case $ac_f in+ [\\/$]*) false;;+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;+ esac ||+ as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;;+ esac+ case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac+ as_fn_append ac_file_inputs " '$ac_f'"+ done++ # Let's still pretend it is 'configure' which instantiates (i.e., don't+ # use $as_me), people would be surprised to read:+ # /* config.h. Generated by config.status. */+ configure_input='Generated from '`+ printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'+ `' by configure.'+ if test x"$ac_file" != x-; then+ configure_input="$ac_file. $configure_input"+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5+printf "%s\n" "$as_me: creating $ac_file" >&6;}+ fi+ # Neutralize special characters interpreted by sed in replacement strings.+ case $configure_input in #(+ *\&* | *\|* | *\\* )+ ac_sed_conf_input=`printf "%s\n" "$configure_input" |+ sed 's/[\\\\&|]/\\\\&/g'`;; #(+ *) ac_sed_conf_input=$configure_input;;+ esac++ case $ac_tag in+ *:-:* | *:-) cat >"$ac_tmp/stdin" \+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;+ esac+ ;;+ esac++ ac_dir=`$as_dirname -- "$ac_file" ||+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$ac_file" : 'X\(//\)[^/]' \| \+ X"$ac_file" : 'X\(//\)$' \| \+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||+printf "%s\n" X"$ac_file" |+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{+ s//\1/+ q+ }+ /^X\(\/\/\)[^/].*/{+ s//\1/+ q+ }+ /^X\(\/\/\)$/{+ s//\1/+ q+ }+ /^X\(\/\).*/{+ s//\1/+ q+ }+ s/.*/./; q'`+ as_dir="$ac_dir"; as_fn_mkdir_p+ ac_builddir=.++case "$ac_dir" in+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;+*)+ ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`+ # A ".." for each directory in $ac_dir_suffix.+ ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`+ case $ac_top_builddir_sub in+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;+ esac ;;+esac+ac_abs_top_builddir=$ac_pwd+ac_abs_builddir=$ac_pwd$ac_dir_suffix+# for backward compatibility:+ac_top_builddir=$ac_top_build_prefix++case $srcdir in+ .) # We are building in place.+ ac_srcdir=.+ ac_top_srcdir=$ac_top_builddir_sub+ ac_abs_top_srcdir=$ac_pwd ;;+ [\\/]* | ?:[\\/]* ) # Absolute name.+ ac_srcdir=$srcdir$ac_dir_suffix;+ ac_top_srcdir=$srcdir+ ac_abs_top_srcdir=$srcdir ;;+ *) # Relative name.+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix+ ac_top_srcdir=$ac_top_build_prefix$srcdir+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;+esac+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix+++ case $ac_mode in+ :F)+ #+ # CONFIG_FILE+ #++_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+# If the template does not know about datarootdir, expand it.+# FIXME: This hack should be removed a few years after 2.60.+ac_datarootdir_hack=; ac_datarootdir_seen=+ac_sed_dataroot='+/datarootdir/ {+ p+ q+}+/@datadir@/p+/@docdir@/p+/@infodir@/p+/@localedir@/p+/@mandir@/p'+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in+*datarootdir*) ac_datarootdir_seen=yes;;+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5+printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}+_ACEOF+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+ ac_datarootdir_hack='+ s&@datadir@&$datadir&g+ s&@docdir@&$docdir&g+ s&@infodir@&$infodir&g+ s&@localedir@&$localedir&g+ s&@mandir@&$mandir&g+ s&\\\${datarootdir}&$datarootdir&g' ;;+esac+_ACEOF++# Neutralize VPATH when '$srcdir' = '.'.+# Shell code in configure.ac might set extrasub.+# FIXME: do we really want to maintain this feature?+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1+ac_sed_extra="$ac_vpsub+$extrasub+_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1+:t+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b+s|@configure_input@|$ac_sed_conf_input|;t t+s&@top_builddir@&$ac_top_builddir_sub&;t t+s&@top_build_prefix@&$ac_top_build_prefix&;t t+s&@srcdir@&$ac_srcdir&;t t+s&@abs_srcdir@&$ac_abs_srcdir&;t t+s&@top_srcdir@&$ac_top_srcdir&;t t+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t+s&@builddir@&$ac_builddir&;t t+s&@abs_builddir@&$ac_abs_builddir&;t t+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t+$ac_datarootdir_hack+"+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5++test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \+ "$ac_tmp/out"`; test -z "$ac_out"; } &&+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir'+which seems to be undefined. Please make sure it is defined" >&5+printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir'+which seems to be undefined. Please make sure it is defined" >&2;}++ rm -f "$ac_tmp/stdin"+ case $ac_file in+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;+ esac \+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5+ ;;+ :H)+ #+ # CONFIG_HEADER+ #+ if test x"$ac_file" != x-; then+ {+ printf "%s\n" "/* $configure_input */" >&1 \+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"+ } >"$ac_tmp/config.h" \+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5+printf "%s\n" "$as_me: $ac_file is unchanged" >&6;}+ else+ rm -f "$ac_file"+ mv "$ac_tmp/config.h" "$ac_file" \+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5+ fi+ else+ printf "%s\n" "/* $configure_input */" >&1 \+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \+ || as_fn_error $? "could not create -" "$LINENO" 5+ fi+ ;;+++ esac++done # for ac_tag+++as_fn_exit 0+_ACEOF+ac_clean_files=$ac_clean_files_save++test $ac_write_fail = 0 ||+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5+++# configure is writing to config.log, and then calls config.status.+# config.status does its own redirection, appending to config.log.+# Unfortunately, on DOS this fails, as config.log is still kept open+# by configure, so config.status won't be able to write to it; its+# output is simply discarded. So we exec the FD to /dev/null,+# effectively closing config.log, so it can be properly (re)opened and+# appended to by config.status. When coming back to configure, we+# need to make the FD available again.+if test "$no_create" != yes; then+ ac_cs_success=:+ ac_config_status_args=+ test "$silent" = yes &&+ ac_config_status_args="$ac_config_status_args --quiet"+ exec 5>/dev/null+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false+ exec 5>>config.log+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which+ # would make configure fail if this is the last instruction.+ $ac_cs_success || as_fn_exit 1+fi+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5+printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}+fi+
configure.ac view
@@ -1,5 +1,5 @@-AC_PREREQ([2.60])-AC_INIT([Haskell unix package], [2.0], [libraries@haskell.org], [unix])+AC_PREREQ([2.69])+AC_INIT([Haskell unix package],[2.0],[libraries@haskell.org],[unix]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsUnix.h])@@ -11,10 +11,6 @@ AC_CONFIG_HEADERS([include/HsUnixConfig.h]) -# Is this a Unix system?-AC_CHECK_HEADER([dlfcn.h], [BUILD_PACKAGE_BOOL=True], [BUILD_PACKAGE_BOOL=False])-AC_SUBST([BUILD_PACKAGE_BOOL])- AC_C_CONST dnl ** Enable large file support. NB. do this before testing the type of@@ -27,9 +23,48 @@ AC_CHECK_HEADERS([dirent.h fcntl.h grp.h limits.h pwd.h signal.h string.h]) AC_CHECK_HEADERS([sys/resource.h sys/stat.h sys/times.h sys/time.h]) AC_CHECK_HEADERS([sys/utsname.h sys/wait.h])+AC_CHECK_HEADERS([sys/sysmacros.h]) AC_CHECK_HEADERS([bsd/libutil.h libutil.h pty.h utmp.h]) AC_CHECK_HEADERS([termios.h time.h unistd.h utime.h]) +AC_STRUCT_DIRENT_D_TYPE+FP_CHECK_CONST([DT_UNKNOWN], [+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif], [-1])+FP_CHECK_CONST([DT_FIFO], [+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif], [-2])+FP_CHECK_CONST([DT_CHR], [+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif], [-3])+FP_CHECK_CONST([DT_DIR], [+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif], [-4])+FP_CHECK_CONST([DT_BLK], [+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif], [-5])+FP_CHECK_CONST([DT_REG], [+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif], [-6])+FP_CHECK_CONST([DT_LNK], [+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif], [-7])+FP_CHECK_CONST([DT_SOCK], [+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif], [-8])+FP_CHECK_CONST([DT_WHT], [+#if HAVE_STRUCT_DIRENT_D_TYPE+#include <dirent.h>+#endif], [-9])+ AC_CHECK_FUNCS([getgrgid_r getgrnam_r getpwnam_r getpwuid_r getpwnam getpwuid]) AC_CHECK_FUNCS([getpwent getgrent]) AC_CHECK_FUNCS([lchown setenv sysconf unsetenv clearenv])@@ -38,6 +73,81 @@ AC_CHECK_FUNCS([setitimer]) AC_CHECK_FUNCS([readdir_r]) +AC_CHECK_FUNCS([alarm])+AC_CHECK_FUNCS([dup])+AC_CHECK_FUNCS([execv])+AC_CHECK_FUNCS([getpid])+AC_CHECK_FUNCS([mknod])+AC_CHECK_FUNCS([mkstemp])+AC_CHECK_FUNCS([pipe])+AC_CHECK_FUNCS([times])+AC_CHECK_FUNCS([chown fchdir fchmod])++AC_CHECK_TYPE([struct rlimit],[AC_DEFINE([HAVE_STRUCT_RLIMIT],[1],[HAVE_STRUCT_RLIMIT])],[],[#include <sys/resource.h>])++# check for statx+AC_CHECK_FUNC([statx], [AC_DEFINE([HAVE_STATX_FUN],[1],[HAVE_STATX_FUN])],[],[#include <sys/stat.h>])+AC_CHECK_TYPE([struct statx],[AC_DEFINE([HAVE_STRUCT_STATX],[1],[HAVE_STRUCT_STATX])],[],[#include <sys/stat.h>])+AC_MSG_CHECKING(for statx.stx_mnt_id)+AC_LINK_IFELSE([+AC_LANG_PROGRAM([[#include <sys/stat.h>]],+[[+struct statx statxbuf;+statx(0, "", 0, STATX_BASIC_STATS | STATX_MNT_ID, &statxbuf);+return statxbuf.stx_mnt_id;+]])],+[+AC_MSG_RESULT(yes)+AC_DEFINE([HAVE_STATX_MNT_ID], [1], [Define to 1 if statx.stx_mnt_id is available.])+],+[+AC_MSG_RESULT(no)+]+)+++AC_MSG_CHECKING(for F_GETLK from fcntl.h)+AC_EGREP_CPP(yes,+[+ #include <fcntl.h>+ #ifdef F_GETLK+ yes+ #endif+], [+ AC_MSG_RESULT(yes)+ AC_DEFINE([HAVE_F_GETLK], [1], [Define to 1 if F_GETLK is available.])+], [+ AC_MSG_RESULT(no)+ ])++AC_MSG_CHECKING(for O_DIRECT open flag)+AC_EGREP_CPP(yes,+[+ #include <fcntl.h>+ #ifdef O_DIRECT+ yes+ #endif+], [+ AC_MSG_RESULT(yes)+ AC_DEFINE([HAVE_O_DIRECT], [1], [Define to 1 if O_DIRECT open flag is available.])+], [+ AC_MSG_RESULT(no)+ ])++AC_MSG_CHECKING(for F_NOCACHE from fcntl.h)+AC_EGREP_CPP(yes,+[+ #include <fcntl.h>+ #ifdef F_NOCACHE+ yes+ #endif+], [+ AC_MSG_RESULT(yes)+ AC_DEFINE([HAVE_F_NOCACHE], [1], [Define to 1 if F_NOCACHE available.])+], [+ AC_MSG_RESULT(no)+ ])+ dnl not available on android so check for it AC_CANONICAL_TARGET AS_CASE([$target_os],[*-android*],[],[AC_CHECK_FUNCS([telldir seekdir])])@@ -50,6 +160,12 @@ AC_CHECK_DECLS([execvpe]) AC_CHECK_FUNCS([execvpe]) +AC_CHECK_DECLS([CLOCKS_PER_SEC], [AC_DEFINE([HAVE_CLOCKS_PER_SEC],[1],[Define to 1 if you have the CLOCKS_PER_SEC macro.])], [], [AC_INCLUDES_DEFAULT+#ifdef HAVE_TIME_H+#include <time.h>+#endif+])+ AC_CHECK_MEMBERS([struct stat.st_atim]) AC_CHECK_MEMBERS([struct stat.st_mtim]) AC_CHECK_MEMBERS([struct stat.st_ctim])@@ -66,6 +182,9 @@ AC_CHECK_MEMBERS([struct stat.st_umtime]) AC_CHECK_MEMBERS([struct stat.st_uctime]) +AC_CHECK_MEMBERS([struct stat.st_blocks])+AC_CHECK_MEMBERS([struct stat.st_blksize])+ AC_CHECK_MEMBER([struct passwd.pw_gecos], [], [AC_DEFINE([HAVE_NO_PASSWD_PW_GECOS],[],[Ignore the pw_gecos member of passwd where it does not exist])], [[#include <pwd.h>]]) # Functions for changing file timestamps@@ -74,7 +193,7 @@ # Additional temp functions dnl androids bionic doesn't have mkstemps-# We explicilty check for android, as the check AC_CHECK_FUNCS performs returns "yes" for mkstemps+# We explicitly check for android, as the check AC_CHECK_FUNCS performs returns "yes" for mkstemps # when targetting android. See similar conditionals for seekdir and telldir. AS_CASE([$target_os],[*-android*],[AC_CHECK_FUNCS([mkdtemp])],[AC_CHECK_FUNCS([mkstemps mkdtemp])]) @@ -181,7 +300,7 @@ AC_DEFINE([HAVE_RTLDNEXT], [1], [Define to 1 if we can see RTLD_NEXT in dlfcn.h.]) ], [ AC_MSG_RESULT(no)- ]) + ]) AC_MSG_CHECKING(for RTLD_DEFAULT from dlfcn.h) AC_EGREP_CPP(yes,@@ -195,7 +314,7 @@ AC_DEFINE([HAVE_RTLDDEFAULT], [1], [Define to 1 if RTLD_DEFAULT is available.]) ], [ AC_MSG_RESULT(no)- ]) + ]) AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty,@@ -233,6 +352,10 @@ AC_SEARCH_LIBS(sem_close, pthread, [EXTRA_LIBS="$EXTRA_LIBS $ac_lib"], [AC_MSG_NOTICE([Not found])])++AC_CHECK_DECLS([sem_getvalue],[AC_DEFINE([HAVE_SEM_GETVALUE],[1],[Define to 1 if you have the `sem_getvalue' function.])],[],[AC_INCLUDES_DEFAULT+#include <semaphore.h>+]) AC_SUBST([EXTRA_LIBS]) AC_CONFIG_FILES([unix.buildinfo])
include/HsUnix.h view
@@ -83,11 +83,16 @@ #include <utmp.h> #endif +#if defined(HAVE_DLFCN_H) #include <dlfcn.h>+#endif #ifdef HAVE_SIGNAL_H #include <signal.h> #endif+#ifdef HAVE_SYS_SYSMACROS_H+#include <sys/sysmacros.h>+#endif /* defined in rts/posix/Signals.c */ extern HsInt nocldstop;@@ -116,5 +121,13 @@ // push a SVR4 STREAMS module; do nothing if STREAMS not available int __hsunix_push_module(int fd, const char *module);++#ifdef HAVE_CLOCKS_PER_SEC+clock_t __hsunix_clocks_per_second (void);+#endif++#if defined(HAVE_SYS_STAT_H) && defined(HAVE_STATX_FUN) && defined(HAVE_STRUCT_STATX)+#define HAVE_STATX 1+#endif #endif
include/HsUnixConfig.h.in view
@@ -1,5 +1,32 @@ /* include/HsUnixConfig.h.in. Generated from configure.ac by autoheader. */ +/* The value of DT_BLK. */+#undef CONST_DT_BLK++/* The value of DT_CHR. */+#undef CONST_DT_CHR++/* The value of DT_DIR. */+#undef CONST_DT_DIR++/* The value of DT_FIFO. */+#undef CONST_DT_FIFO++/* The value of DT_LNK. */+#undef CONST_DT_LNK++/* The value of DT_REG. */+#undef CONST_DT_REG++/* The value of DT_SOCK. */+#undef CONST_DT_SOCK++/* The value of DT_UNKNOWN. */+#undef CONST_DT_UNKNOWN++/* The value of DT_WHT. */+#undef CONST_DT_WHT+ /* The value of SIGABRT. */ #undef CONST_SIGABRT @@ -99,29 +126,46 @@ /* The value of SIG_UNBLOCK. */ #undef CONST_SIG_UNBLOCK +/* Define to 1 if you have the 'alarm' function. */+#undef HAVE_ALARM+ /* Define to 1 if you have the <bsd/libutil.h> header file. */ #undef HAVE_BSD_LIBUTIL_H -/* Define to 1 if you have the `clearenv' function. */+/* Define to 1 if you have the 'chown' function. */+#undef HAVE_CHOWN++/* Define to 1 if you have the 'clearenv' function. */ #undef HAVE_CLEARENV +/* Define to 1 if you have the CLOCKS_PER_SEC macro. */+#undef HAVE_CLOCKS_PER_SEC+ /* Define to 1 if you have the `ctermid' function. */ #undef HAVE_CTERMID -/* Define to 1 if you have the declaration of `ctermid', and to 0 if you+/* Define to 1 if you have the declaration of 'CLOCKS_PER_SEC', and to 0 if+ you don't. */+#undef HAVE_DECL_CLOCKS_PER_SEC++/* Define to 1 if you have the declaration of 'ctermid', and to 0 if you don't. */ #undef HAVE_DECL_CTERMID -/* Define to 1 if you have the declaration of `execvpe', and to 0 if you+/* Define to 1 if you have the declaration of 'execvpe', and to 0 if you don't. */ #undef HAVE_DECL_EXECVPE -/* Define to 1 if you have the declaration of `fdatasync', and to 0 if you+/* Define to 1 if you have the declaration of 'fdatasync', and to 0 if you don't. */ #undef HAVE_DECL_FDATASYNC -/* Define to 1 if you have the declaration of `tcdrain', and to 0 if you+/* Define to 1 if you have the declaration of 'sem_getvalue', and to 0 if you don't. */+#undef HAVE_DECL_SEM_GETVALUE++/* Define to 1 if you have the declaration of 'tcdrain', and to 0 if you+ don't. */ #undef HAVE_DECL_TCDRAIN /* Define if we have /dev/ptc. */@@ -130,49 +174,71 @@ /* Define if we have /dev/ptmx. */ #undef HAVE_DEV_PTMX -/* Define to 1 if you have the <dirent.h> header file. */+/* Define to 1 if you have the <dirent.h> header file, and it defines 'DIR'.+ */ #undef HAVE_DIRENT_H -/* Define to 1 if you have the `execvpe' function. */+/* Define to 1 if you have the 'dup' function. */+#undef HAVE_DUP++/* Define to 1 if you have the 'execv' function. */+#undef HAVE_EXECV++/* Define to 1 if you have the 'execvpe' function. */ #undef HAVE_EXECVPE +/* Define to 1 if you have the 'fchdir' function. */+#undef HAVE_FCHDIR++/* Define to 1 if you have the 'fchmod' function. */+#undef HAVE_FCHMOD+ /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H -/* Define to 1 if you have the `fdatasync' function. */+/* Define to 1 if you have the 'fdatasync' function. */ #undef HAVE_FDATASYNC -/* Define to 1 if you have the `fsync' function. */+/* Define to 1 if you have the 'fsync' function. */ #undef HAVE_FSYNC -/* Define to 1 if you have the `futimens' function. */+/* Define to 1 if you have the 'futimens' function. */ #undef HAVE_FUTIMENS -/* Define to 1 if you have the `futimes' function. */+/* Define to 1 if you have the 'futimes' function. */ #undef HAVE_FUTIMES -/* Define to 1 if you have the `getgrent' function. */+/* Define to 1 if F_GETLK is available. */+#undef HAVE_F_GETLK++/* Define to 1 if F_NOCACHE available. */+#undef HAVE_F_NOCACHE++/* Define to 1 if you have the 'getgrent' function. */ #undef HAVE_GETGRENT -/* Define to 1 if you have the `getgrgid_r' function. */+/* Define to 1 if you have the 'getgrgid_r' function. */ #undef HAVE_GETGRGID_R -/* Define to 1 if you have the `getgrnam_r' function. */+/* Define to 1 if you have the 'getgrnam_r' function. */ #undef HAVE_GETGRNAM_R -/* Define to 1 if you have the `getpwent' function. */+/* Define to 1 if you have the 'getpid' function. */+#undef HAVE_GETPID++/* Define to 1 if you have the 'getpwent' function. */ #undef HAVE_GETPWENT -/* Define to 1 if you have the `getpwnam' function. */+/* Define to 1 if you have the 'getpwnam' function. */ #undef HAVE_GETPWNAM -/* Define to 1 if you have the `getpwnam_r' function. */+/* Define to 1 if you have the 'getpwnam_r' function. */ #undef HAVE_GETPWNAM_R -/* Define to 1 if you have the `getpwuid' function. */+/* Define to 1 if you have the 'getpwuid' function. */ #undef HAVE_GETPWUID -/* Define to 1 if you have the `getpwuid_r' function. */+/* Define to 1 if you have the 'getpwuid_r' function. */ #undef HAVE_GETPWUID_R /* Define to 1 if you have the <grp.h> header file. */@@ -181,7 +247,7 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the `lchown' function. */+/* Define to 1 if you have the 'lchown' function. */ #undef HAVE_LCHOWN /* Define to 1 if you have the <libutil.h> header file. */@@ -190,34 +256,49 @@ /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H -/* Define to 1 if you have the `lutimes' function. */+/* Define to 1 if you have the 'lutimes' function. */ #undef HAVE_LUTIMES -/* Define to 1 if you have the <memory.h> header file. */-#undef HAVE_MEMORY_H+/* Define to 1 if you have the <minix/config.h> header file. */+#undef HAVE_MINIX_CONFIG_H -/* Define to 1 if you have the `mkdtemp' function. */+/* Define to 1 if you have the 'mkdtemp' function. */ #undef HAVE_MKDTEMP -/* Define to 1 if you have the `mkstemps' function. */+/* Define to 1 if you have the 'mknod' function. */+#undef HAVE_MKNOD++/* Define to 1 if you have the 'mkstemp' function. */+#undef HAVE_MKSTEMP++/* Define to 1 if you have the 'mkstemps' function. */ #undef HAVE_MKSTEMPS -/* Define to 1 if you have the `nanosleep' function. */+/* Define to 1 if you have the 'nanosleep' function. */ #undef HAVE_NANOSLEEP +/* Define to 1 if you have the <ndir.h> header file, and it defines 'DIR'. */+#undef HAVE_NDIR_H+ /* Ignore the pw_gecos member of passwd where it does not exist */ #undef HAVE_NO_PASSWD_PW_GECOS -/* Define to 1 if you have the `openpty' function. */+/* Define to 1 if you have the 'openpty' function. */ #undef HAVE_OPENPTY -/* Define to 1 if you have the `posix_fadvise' function. */+/* Define to 1 if O_DIRECT open flag is available. */+#undef HAVE_O_DIRECT++/* Define to 1 if you have the 'pipe' function. */+#undef HAVE_PIPE++/* Define to 1 if you have the 'posix_fadvise' function. */ #undef HAVE_POSIX_FADVISE -/* Define to 1 if you have the `posix_fallocate' function. */+/* Define to 1 if you have the 'posix_fallocate' function. */ #undef HAVE_POSIX_FALLOCATE -/* Define to 1 if you have the `ptsname' function. */+/* Define to 1 if you have the 'ptsname' function. */ #undef HAVE_PTSNAME /* Define to 1 if you have the <pty.h> header file. */@@ -226,7 +307,7 @@ /* Define to 1 if you have the <pwd.h> header file. */ #undef HAVE_PWD_H -/* Define to 1 if you have the `readdir_r' function. */+/* Define to 1 if you have the 'readdir_r' function. */ #undef HAVE_READDIR_R /* Define to 1 if RTLD_DEFAULT is available. */@@ -241,27 +322,39 @@ /* Define to 1 if <unistd.h> defines _SC_GETPW_R_SIZE_MAX. */ #undef HAVE_SC_GETPW_R_SIZE_MAX -/* Define to 1 if you have the `seekdir' function. */+/* Define to 1 if you have the 'seekdir' function. */ #undef HAVE_SEEKDIR -/* Define to 1 if you have the `setenv' function. */+/* Define to 1 if you have the `sem_getvalue' function. */+#undef HAVE_SEM_GETVALUE++/* Define to 1 if you have the 'setenv' function. */ #undef HAVE_SETENV -/* Define to 1 if you have the `setitimer' function. */+/* Define to 1 if you have the 'setitimer' function. */ #undef HAVE_SETITIMER -/* Define to 1 if you have the `shm_open' function. */+/* Define to 1 if you have the 'shm_open' function. */ #undef HAVE_SHM_OPEN -/* Define to 1 if you have the `shm_unlink' function. */+/* Define to 1 if you have the 'shm_unlink' function. */ #undef HAVE_SHM_UNLINK /* Define to 1 if you have the <signal.h> header file. */ #undef HAVE_SIGNAL_H +/* HAVE_STATX_FUN */+#undef HAVE_STATX_FUN++/* Define to 1 if statx.stx_mnt_id is available. */+#undef HAVE_STATX_MNT_ID+ /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the <stdio.h> header file. */+#undef HAVE_STDIO_H+ /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -271,60 +364,86 @@ /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H -/* Define to 1 if `st_atim' is a member of `struct stat'. */+/* Define to 1 if 'd_type' is a member of 'struct dirent'. */+#undef HAVE_STRUCT_DIRENT_D_TYPE++/* HAVE_STRUCT_RLIMIT */+#undef HAVE_STRUCT_RLIMIT++/* HAVE_STRUCT_STATX */+#undef HAVE_STRUCT_STATX++/* Define to 1 if 'st_atim' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIM -/* Define to 1 if `st_atimensec' is a member of `struct stat'. */+/* Define to 1 if 'st_atimensec' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIMENSEC -/* Define to 1 if `st_atimespec' is a member of `struct stat'. */+/* Define to 1 if 'st_atimespec' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIMESPEC -/* Define to 1 if `st_atime_n' is a member of `struct stat'. */+/* Define to 1 if 'st_atime_n' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIME_N -/* Define to 1 if `st_ctim' is a member of `struct stat'. */+/* Define to 1 if 'st_blksize' is a member of 'struct stat'. */+#undef HAVE_STRUCT_STAT_ST_BLKSIZE++/* Define to 1 if 'st_blocks' is a member of 'struct stat'. */+#undef HAVE_STRUCT_STAT_ST_BLOCKS++/* Define to 1 if 'st_ctim' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_CTIM -/* Define to 1 if `st_ctimensec' is a member of `struct stat'. */+/* Define to 1 if 'st_ctimensec' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_CTIMENSEC -/* Define to 1 if `st_ctimespec' is a member of `struct stat'. */+/* Define to 1 if 'st_ctimespec' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_CTIMESPEC -/* Define to 1 if `st_ctime_n' is a member of `struct stat'. */+/* Define to 1 if 'st_ctime_n' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_CTIME_N -/* Define to 1 if `st_mtim' is a member of `struct stat'. */+/* Define to 1 if 'st_mtim' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_MTIM -/* Define to 1 if `st_mtimensec' is a member of `struct stat'. */+/* Define to 1 if 'st_mtimensec' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_MTIMENSEC -/* Define to 1 if `st_mtimespec' is a member of `struct stat'. */+/* Define to 1 if 'st_mtimespec' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_MTIMESPEC -/* Define to 1 if `st_mtime_n' is a member of `struct stat'. */+/* Define to 1 if 'st_mtime_n' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_MTIME_N -/* Define to 1 if `st_uatime' is a member of `struct stat'. */+/* Define to 1 if 'st_uatime' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_UATIME -/* Define to 1 if `st_uctime' is a member of `struct stat'. */+/* Define to 1 if 'st_uctime' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_UCTIME -/* Define to 1 if `st_umtime' is a member of `struct stat'. */+/* Define to 1 if 'st_umtime' is a member of 'struct stat'. */ #undef HAVE_STRUCT_STAT_ST_UMTIME -/* Define to 1 if you have the `sysconf' function. */+/* Define to 1 if you have the 'sysconf' function. */ #undef HAVE_SYSCONF +/* Define to 1 if you have the <sys/dir.h> header file, and it defines 'DIR'.+ */+#undef HAVE_SYS_DIR_H++/* Define to 1 if you have the <sys/ndir.h> header file, and it defines 'DIR'.+ */+#undef HAVE_SYS_NDIR_H+ /* Define to 1 if you have the <sys/resource.h> header file. */ #undef HAVE_SYS_RESOURCE_H /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the <sys/sysmacros.h> header file. */+#undef HAVE_SYS_SYSMACROS_H+ /* Define to 1 if you have the <sys/times.h> header file. */ #undef HAVE_SYS_TIMES_H @@ -343,22 +462,25 @@ /* Define to 1 if you have the `tcdrain' function. */ #undef HAVE_TCDRAIN -/* Define to 1 if you have the `telldir' function. */+/* Define to 1 if you have the 'telldir' function. */ #undef HAVE_TELLDIR /* Define to 1 if you have the <termios.h> header file. */ #undef HAVE_TERMIOS_H +/* Define to 1 if you have the 'times' function. */+#undef HAVE_TIMES+ /* Define to 1 if you have the <time.h> header file. */ #undef HAVE_TIME_H /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* Define to 1 if you have the `unsetenv' function. */+/* Define to 1 if you have the 'unsetenv' function. */ #undef HAVE_UNSETENV -/* Define to 1 if you have the `utimensat' function. */+/* Define to 1 if you have the 'utimensat' function. */ #undef HAVE_UTIMENSAT /* Define to 1 if you have the <utime.h> header file. */@@ -367,7 +489,10 @@ /* Define to 1 if you have the <utmp.h> header file. */ #undef HAVE_UTMP_H -/* Define to 1 if you have the `_NSGetEnviron' function. */+/* Define to 1 if you have the <wchar.h> header file. */+#undef HAVE_WCHAR_H++/* Define to 1 if you have the '_NSGetEnviron' function. */ #undef HAVE__NSGETENVIRON /* Define to the address where bug reports for this package should be sent. */@@ -388,57 +513,120 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if you have the ANSI C header files. */+/* Define to 1 if all of the C89 standard headers exist (not just the ones+ required in a freestanding environment). This macro is provided for+ backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define if stdlib.h declares unsetenv to return void. */ #undef UNSETENV_RETURNS_VOID -/* Enable extensions on AIX 3, Interix. */+/* Enable extensions on AIX, Interix, z/OS. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif+/* Enable general extensions on macOS. */+#ifndef _DARWIN_C_SOURCE+# undef _DARWIN_C_SOURCE+#endif+/* Enable general extensions on Solaris. */+#ifndef __EXTENSIONS__+# undef __EXTENSIONS__+#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif-/* Enable threading extensions on Solaris. */+/* Enable X/Open compliant socket functions that do not require linking+ with -lxnet on HP-UX 11.11. */+#ifndef _HPUX_ALT_XOPEN_SOCKET_API+# undef _HPUX_ALT_XOPEN_SOCKET_API+#endif+/* Identify the host operating system as Minix.+ This macro does not affect the system headers' behavior.+ A future release of Autoconf may stop defining this macro. */+#ifndef _MINIX+# undef _MINIX+#endif+/* Enable general extensions on NetBSD.+ Enable NetBSD compatibility extensions on Minix. */+#ifndef _NETBSD_SOURCE+# undef _NETBSD_SOURCE+#endif+/* Enable OpenBSD compatibility extensions on NetBSD.+ Oddly enough, this does nothing on OpenBSD. */+#ifndef _OPENBSD_SOURCE+# undef _OPENBSD_SOURCE+#endif+/* Define to 1 if needed for POSIX-compatible behavior. */+#ifndef _POSIX_SOURCE+# undef _POSIX_SOURCE+#endif+/* Define to 2 if needed for POSIX-compatible behavior. */+#ifndef _POSIX_1_SOURCE+# undef _POSIX_1_SOURCE+#endif+/* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif+/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__+#endif+/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__+# undef __STDC_WANT_IEC_60559_BFP_EXT__+#endif+/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__+# undef __STDC_WANT_IEC_60559_DFP_EXT__+#endif+/* Enable extensions specified by C23 Annex F. */+#ifndef __STDC_WANT_IEC_60559_EXT__+# undef __STDC_WANT_IEC_60559_EXT__+#endif+/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__+#endif+/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__+# undef __STDC_WANT_IEC_60559_TYPES_EXT__+#endif+/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */+#ifndef __STDC_WANT_LIB_EXT2__+# undef __STDC_WANT_LIB_EXT2__+#endif+/* Enable extensions specified by ISO/IEC 24747:2009. */+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__+# undef __STDC_WANT_MATH_SPEC_FUNCS__+#endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif-/* Enable general extensions on Solaris. */-#ifndef __EXTENSIONS__-# undef __EXTENSIONS__+/* Enable X/Open extensions. Define to 500 only if necessary+ to make mbstate_t available. */+#ifndef _XOPEN_SOURCE+# undef _XOPEN_SOURCE #endif /* Define if the system headers declare usleep to return void. */ #undef USLEEP_RETURNS_VOID -/* Enable large inode numbers on Mac OS X 10.5. */-#ifndef _DARWIN_USE_64_BIT_INODE-# define _DARWIN_USE_64_BIT_INODE 1-#endif- /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* Define for large files, on AIX-style hosts. */+/* Define to 1 on platforms where this makes off_t a 64-bit type. */ #undef _LARGE_FILES -/* Define to 1 if on MINIX. */-#undef _MINIX--/* Define to 2 if the system does not provide POSIX.1 features except with- this defined. */-#undef _POSIX_1_SOURCE+/* Number of bits in time_t, on hosts where this is settable. */+#undef _TIME_BITS -/* Define to 1 if you need to in order for `stat' and other things to work. */-#undef _POSIX_SOURCE+/* Define to 1 on platforms where this makes time_t a 64-bit type. */+#undef __MINGW_USE_VC2005_COMPAT -/* Define to empty if `const' does not conform to ANSI C. */+/* Define to empty if 'const' does not conform to ANSI C. */ #undef const
include/execvpe.h view
@@ -10,16 +10,4 @@ extern int __hsunix_execvpe(const char *name, char *const argv[], char *const envp[]); -// this hack is needed for `process`; to be removed in unix-2.8-#ifndef HSUNIX_EXECVPE_H_NO_COMPAT-#include "HsUnixConfig.h"-#if HAVE_EXECVPE-# include <unistd.h>-extern int-execvpe(const char *name, char *const argv[], char *const envp[]);-#else-# define execvpe(name,argv,envp) __hsunix_execvpe(name,argv,envp)-#endif-#endif- #endif
+ jsbits/time.js view
@@ -0,0 +1,41 @@+function h$js_futimes(fd,atime,mtime) {+ if (!h$isNode()) {+ throw "h$js_futimes unsupported";+ }+ try {+ h$fs.futimesSync(fd, atime, mtime);+ } catch(e) {+ h$setErrno(e);+ return -1;+ }+ return 0;+}++function h$js_utimes(path,path_offset,atime,mtime) {+ if (!h$isNode()) {+ throw "h$js_utimes unsupported";+ }+ try {+ const d = h$decodeUtf8z(path, path_offset);+ h$fs.utimesSync(d, atime, mtime);+ } catch(e) {+ h$setErrno(e);+ return -1;+ }+ return 0;+}++function h$js_lutimes(path,path_offset,atime,mtime) {+ if (!h$isNode()) {+ throw "h$js_lutimes unsupported";+ }+ try {+ const d = h$decodeUtf8z(path, path_offset);+ h$fs.lutimesSync(d, atime, mtime);+ } catch(e) {+ h$setErrno(e);+ return -1;+ }+ return 0;+}+
+ tests/DirEnt.hsc view
@@ -0,0 +1,38 @@+{-# LANGUAGE LambdaCase #-}++#include "HsUnixConfig.h"++module Main (main) where+#if !defined(HAVE_STRUCT_DIRENT_D_TYPE)+main :: IO ()+main = do+ putStrLn "Skipping DirEnt test, since the system doesn't support d_type"+#else++import Control.Exception (bracket, finally)+import Foreign.C.String (peekCString)+import System.Exit+import System.Posix.Directory+import System.Posix.Directory.Internals++peekDirEnt :: DirEnt -> IO (String, DirType)+peekDirEnt dirEnt = do+ dName <- dirEntName dirEnt >>= peekCString+ dType <- dirEntType dirEnt+ return (dName, dType)++testDirTypeOfDot :: DirStream -> IO ()+testDirTypeOfDot dirStream = go where+ go = readDirStreamWith peekDirEnt dirStream >>= \case+ Just (".", DirectoryType) -> do+ putStrLn "Got DirectoryType for . dir"+ exitSuccess+ Just (".", dType) -> die $ "Got " ++ show dType ++ " for . dir!"+ Just _ -> go+ Nothing -> die "Read cwd in Haskell and didn't find . dir!"++main :: IO ()+main = do+ putStrLn "Running Haskell test of dirEntType"+ bracket (openDirStream ".") closeDirStream testDirTypeOfDot+#endif
+ tests/FileExtendedStatus.hs view
@@ -0,0 +1,166 @@+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}++module FileExtendedStatus (main) where++import System.Posix.Files+import System.Posix.Directory+import System.Posix.IO+import System.Posix.Types+import Control.Exception as E+import Control.Monad+import Test.Tasty.HUnit++main = do+ cleanup+ fs <- testRegular+ ds <- testDir+ testSymlink fs ds+ testLink+ cleanup++regular = "regular"+dir = "dir"+slink_regular = "link-regular-symlink"+hlink_regular = "link-regular-hardlink"+link_dir = "link-dir"++testRegular = do+ _ <- createFile regular ownerReadMode+ (fs, _) <- getStatus regular+ let expected = (False,False,False,True,False,False,False)+ actual = snd (statusExtendedElements fs)+ when (actual /= expected) $+ fail "unexpected file status bits for regular file"+ return fs++testDir = do+ createDirectory dir ownerReadMode+ (ds, _) <- getStatus dir+ let expected = (False,False,False,False,True,False,False)+ actual = snd (statusExtendedElements ds)+ when (actual /= expected) $+ fail "unexpected file status bits for directory"+ return ds++testSymlink fs ds = do+ createSymbolicLink regular slink_regular+ createSymbolicLink dir link_dir+ (fs', ls) <- getStatus slink_regular+ (ds', lds) <- getStatus link_dir++ let expected = (False,False,False,False,False,True,False)+ actualF = snd (statusExtendedElements ls)+ actualD = snd (statusExtendedElements lds)++ when (actualF /= expected) $+ fail "unexpected file status bits for symlink to regular file"++ when (actualD /= expected) $+ fail "unexpected file status bits for symlink to directory"++ when (statusExtendedElements fs /= statusExtendedElements fs') $+ fail "status for a file does not match when it's accessed via a symlink"++ when (statusExtendedElements ds /= statusExtendedElements ds') $+ fail "status for a directory does not match when it's accessed via a symlink"+++testLink = do+ createLink regular hlink_regular+ (fs, _) <- getStatus regular -- we need to retrieve it again as creating the link causes it to change!+ (fs', ls) <- getStatus hlink_regular+ snd (statusExtendedElements ls) @?= (+ False, -- isBlockDevice+ False, -- isCharacterDevice+ False, -- isNamedPipe+ True, -- isRegularFile+ False, -- isDirectory+ False, -- isSymbolicLink+ False) -- isSocket+ linkCountX fs' @?= 2+ statusExtendedElements fs @?= statusExtendedElements fs' -- status for a file should match when accessed via a link+++cleanup = do+ ignoreIOExceptions $ removeDirectory dir+ mapM_ (ignoreIOExceptions . removeLink)+ [regular, hlink_regular, slink_regular, link_dir]++ignoreIOExceptions io = io `E.catch`+ ((\_ -> return ()) :: IOException -> IO ())++getStatus f = do+ fs <- getExtendedFileStatus Nothing f defaultStatxFlags defaultStatxMask+ ls <- getExtendedFileStatus Nothing f SymlinkNoFollow defaultStatxMask+ fs' <- getFileStatus f++ statusExtendedElementsMinimal fs @?= statusElementsMinimal fs'++ return (fs, ls)++-- Yay for 20-element tuples!+statusExtendedElements fs = (,)+ (fileBlockSizeX fs+ ,linkCountX fs+ ,fileOwnerX fs+ ,fileGroupX fs+ ,fileModeX fs+ ,fileIDX fs+ ,fileSizeX fs+ ,accessTimeHiResX fs+ ,creationTimeHiResX fs+ ,statusChangeTimeHiResX fs+ ,modificationTimeHiResX fs+ )+ (isBlockDeviceX fs+ ,isCharacterDeviceX fs+ ,isNamedPipeX fs+ ,isRegularFileX fs+ ,isDirectoryX fs+ ,isSymbolicLinkX fs+ ,isSocketX fs+ )++statusExtendedElementsMinimal fs = (,)+ (fileModeX fs+ ,deviceIDX fs+ ,specialDeviceIDX fs+ ,linkCountX fs+ ,fileOwnerX fs+ ,fileGroupX fs+ ,COff (fromIntegral (fileSizeX fs))+ ,Just $ CBlkCnt (fromIntegral (fileBlocksX fs))+ ,accessTimeHiResX fs+ ,statusChangeTimeHiResX fs+ ,modificationTimeHiResX fs+ )+ (isBlockDeviceX fs+ ,isCharacterDeviceX fs+ ,isNamedPipeX fs+ ,isRegularFileX fs+ ,isDirectoryX fs+ ,isSymbolicLinkX fs+ ,isSocketX fs+ )++statusElementsMinimal fs = (,)+ (fileMode fs+ ,deviceID fs+ ,specialDeviceID fs+ ,linkCount fs+ ,fileOwner fs+ ,fileGroup fs+ ,fileSize fs+ ,fileBlocks fs+ ,accessTimeHiRes fs+ ,statusChangeTimeHiRes fs+ ,modificationTimeHiRes fs+ )+ (isBlockDevice fs+ ,isCharacterDevice fs+ ,isNamedPipe fs+ ,isRegularFile fs+ ,isDirectory fs+ ,isSymbolicLink fs+ ,isSocket fs+ )
tests/FileStatus.hs view
@@ -95,7 +95,7 @@ fs <- getFileStatus f ls <- getSymbolicLinkStatus f - fd <- openFd f ReadOnly Nothing defaultFileFlags+ fd <- openFd f ReadOnly defaultFileFlags fs' <- getFdStatus fd when (statusElements fs /= statusElements fs') $
tests/FileStatusByteString.hs view
@@ -93,7 +93,7 @@ fs <- getFileStatus f ls <- getSymbolicLinkStatus f - fd <- openFd f ReadOnly Nothing defaultFileFlags+ fd <- openFd f ReadOnly defaultFileFlags fs' <- getFdStatus fd when (statusElements fs /= statusElements fs') $
+ tests/ReadDirStream.hs view
@@ -0,0 +1,55 @@+module ReadDirStream+ ( emptyDirStream+ , nonEmptyDirStream+ ) where++import System.Posix.Files+import System.Posix.Directory+import System.Posix.IO+import Control.Exception as E+import Test.Tasty.HUnit++emptyDirStream :: IO ()+emptyDirStream = do+ cleanup+ createDirectory dir ownerReadMode+ dir_p <- openDirStream dir+ entries <- readDirStreamEntries dir_p+ closeDirStream dir_p+ cleanup+ entries @?= []+ where+ dir = "emptyDirStream"++ cleanup = do+ ignoreIOExceptions $ removeDirectory dir++nonEmptyDirStream :: IO ()+nonEmptyDirStream = do+ cleanup+ createDirectory dir ownerModes+ _ <- createFile (dir ++ "/file") ownerReadMode+ dir_p <- openDirStream dir+ entries <- readDirStreamEntries dir_p+ closeDirStream dir_p+ cleanup+ entries @?= ["file"]+ where+ dir = "nonEmptyDirStream"++ cleanup = do+ ignoreIOExceptions $ removeLink $ dir ++ "/file"+ ignoreIOExceptions $ removeDirectory dir++readDirStreamEntries :: DirStream -> IO [FilePath]+readDirStreamEntries dir_p = do+ ment <- readDirStreamMaybe dir_p+ case ment of+ Nothing -> return []+ Just "." -> readDirStreamEntries dir_p+ Just ".." -> readDirStreamEntries dir_p+ Just ent -> (ent :) <$> readDirStreamEntries dir_p++ignoreIOExceptions :: IO () -> IO ()+ignoreIOExceptions io = io `E.catch`+ ((\_ -> return ()) :: E.IOException -> IO ())
tests/Semaphore001.hs view
@@ -4,6 +4,6 @@ main :: IO () main = do- sem <- semOpen "/test" OpenSemFlags {semCreate = True, semExclusive = False} stdFileMode 1+ sem <- semOpen "/test-001" OpenSemFlags {semCreate = True, semExclusive = False} stdFileMode 1 semThreadWait sem semPost sem
+ tests/Semaphore002.hs view
@@ -0,0 +1,15 @@+module Main (main) where++import Control.Concurrent+import System.Posix++main :: IO ()+main = do+ sem <- semOpen "/test-002" OpenSemFlags {semCreate = True, semExclusive = False} stdFileMode 0+ _ <- forkIO $ do+ threadDelay (1000*1000)+ semPost sem++ -- This should succeed after 1 second.+ semThreadWait sem+ semPost sem
+ tests/SemaphoreInterrupt.hs view
@@ -0,0 +1,32 @@+module Main (main) where++import Control.Concurrent+import Control.Monad+import Data.IORef+import System.Posix++main :: IO ()+main = do++ sem <- semOpen "/test-interrupt" OpenSemFlags {semCreate = True, semExclusive = False} stdFileMode 0+ ref <- newIORef False+ _ <- forkIO $ do+ res <- semWaitInterruptible sem+ writeIORef ref res+ threadDelay 100000 -- 100 ms+ semPost sem+ threadDelay 100000 -- 100 ms+ succ1 <- readIORef ref+ unless succ1 $+ error "SemaphoreInterrupt: semWaitInterruptible failed"++ writeIORef ref False+ tid <- forkIO $ do+ res <- semWaitInterruptible sem+ writeIORef ref res+ threadDelay 100000 -- 100 ms+ killThread tid+ threadDelay 100000 -- 100 ms+ succ2 <- readIORef ref+ when succ2 $+ error "SemaphoreInterrupt: semWaitInterruptible not interrupted"
+ tests/T13660.hs view
@@ -0,0 +1,72 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}++module Main where++import Data.Maybe+#if !MIN_VERSION_base(4, 11, 0)+import Data.Monoid ((<>))+#endif+import GHC.IO.Exception+import System.IO.Error+import System.OsPath.Posix+import System.OsString.Internal.Types (PosixString(..))+import System.Posix.IO (defaultFileFlags, OpenFileFlags(..), OpenMode(..))+import System.Posix.ByteString.FilePath++import qualified Data.ByteString.Char8 as C+#if MIN_VERSION_filepath(1, 5, 0)+import qualified "os-string" System.OsString.Data.ByteString.Short as SBS+#else+import qualified "filepath" System.OsPath.Data.ByteString.Short as SBS+#endif+import qualified System.Posix.Env.PosixString as PS+import qualified System.Posix.IO.PosixString as PS+import qualified System.Posix.IO.ByteString as BS+import qualified System.Posix.Env.ByteString as BS+++main :: IO ()+main = do+ tmp <- getTemporaryDirectory+ let fp = tmp <> fromStr' "/hello\0world"+ res <- tryIOError $ PS.openFd fp WriteOnly df++ tmp' <- getTemporaryDirectory'+ let fp' = tmp' <> "/hello\0world"+ res' <- tryIOError $ BS.openFd fp' WriteOnly df++ case (res, res') of+ (Left e, Left e')+ | e == fileError (_toStr fp)+ , e' == fileError (C.unpack fp') -> pure ()+ | otherwise -> fail $ "Unexpected errors: " <> show e <> "\n\t" <> show e'+ (Right _, Left _) -> fail "System.Posix.IO.PosixString.openFd should not accept filepaths with NUL bytes"+ (Left _, Right _) -> fail "System.Posix.IO.ByteString.openFd should not accept filepaths with NUL bytes"+ (Right _, Right _) -> fail $ "System.Posix.IO.PosixString.openFd and System.Posix.IO.ByteString.openFd" <>+ " should not accept filepaths with NUL bytes"++ where+ df :: OpenFileFlags+ df = defaultFileFlags{ trunc = True, creat = Just 0o666, noctty = True, nonBlock = True }++ getTemporaryDirectory :: IO PosixPath+ getTemporaryDirectory = fromMaybe (fromStr' "/tmp") <$> PS.getEnv (fromStr' "TMPDIR")++ getTemporaryDirectory' :: IO RawFilePath+ getTemporaryDirectory' = fromMaybe "/tmp" <$> BS.getEnv "TMPDIR"++ fromStr' = pack . fmap unsafeFromChar++ _toStr (PosixString sbs) = C.unpack $ SBS.fromShort sbs++ fileError fp = IOError+ { ioe_handle = Nothing+ , ioe_type = InvalidArgument+ , ioe_location = "checkForInteriorNuls"+ , ioe_description = "POSIX filepaths must not contain internal NUL octets."+ , ioe_errno = Nothing+ , ioe_filename = Just fp+ }+
− tests/Test.hs
@@ -1,242 +0,0 @@-{-# LANGUAGE ScopedTypeVariables #-}--{-# OPTIONS_GHC -fno-warn-deprecations #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}--module Main (main) where--import Control.Applicative-import Control.Concurrent-import qualified Control.Exception as E-import Control.Monad-import Data.List (sort)-import System.Exit-import System.IO-import System.Posix-import qualified System.Posix.Env.ByteString-import Test.Tasty-import Test.Tasty.HUnit--import qualified FileStatus-import qualified FileStatusByteString-import qualified Signals001--main :: IO ()-main = defaultMain $ testGroup "All"- [ executeFile001- , fileExist01- , fileStatus- , fileStatusByteString- , getEnvironment01- , getEnvironment02- , getGroupEntry- , getUserEntry- , processGroup001- , processGroup002- , queryFdOption01- , signals001- , t1185- , t3816- , user001- , posix002- , posix005- , posix006- , posix010- ]--executeFile001 :: TestTree-executeFile001 = testCase "executeFile001" $ do- actual <- captureStdout $- executeFile "echo" True ["arg1", "ar g2"] Nothing- actual @?= "arg1 ar g2\n"--fileExist01 :: TestTree-fileExist01 = testCase "fileExist01" $ do- fileExist "."- @? "file should exist"- not <$> fileExist "does not exist"- @? "file should not exist"--fileStatus :: TestTree-fileStatus = testCase "fileStatus" FileStatus.main--fileStatusByteString :: TestTree-fileStatusByteString = testCase "fileStatusByteString" FileStatusByteString.main--getEnvironment01 :: TestTree-getEnvironment01 = testCase "getEnvironment01" $ do- env <- getEnvironment- not (null env)- @? "environment should be non-empty"--getEnvironment02 :: TestTree-getEnvironment02 = testCase "getEnvironment02" $ do- env <- System.Posix.Env.ByteString.getEnvironment- not (null env)- @? "environment should be non-empty"--getGroupEntry :: TestTree-getGroupEntry = testCase "getGroupEntry" $ do- let act = False <$ getGroupEntryForName "thisIsNotMeantToExist"- act `E.catch` (\(_ :: E.SomeException) -> return True)- @? "group should not exist"--getUserEntry :: TestTree-getUserEntry = testCase "getUserEntry" $ do- let act = False <$ getUserEntryForName "thisIsNotMeantToExist"- act `E.catch` (\(_ :: E.SomeException) -> return True)- @? "user should not exist"--processGroup001 :: TestTree-processGroup001 = testCase "processGroup001" $ do- pgid <- getProcessGroupID- pgid' <- getProcessGroupIDOf =<< getProcessID- pgid @?= pgid'--processGroup002 :: TestTree-processGroup002 = testCase "processGroup002" $ do- pid <- getProcessID- ppid <- getParentProcessID- ppgid <- getProcessGroupIDOf ppid- -- join the parent process- joinProcessGroup ppgid- pgid1 <- getProcessGroupID- ppgid @?= pgid1- -- be a leader- _ <- createProcessGroupFor pid- pgid2 <- getProcessGroupID- pid @?= fromIntegral pgid2- -- and join the parent again- setProcessGroupIDOf pid ppgid- pgid3 <- getProcessGroupID- ppgid @?= pgid3--queryFdOption01 :: TestTree-queryFdOption01 = testCase "queryFdOption01" $ do- not <$> queryFdOption stdOutput NonBlockingRead- @? "should be blocking"- setFdOption stdOutput NonBlockingRead True- queryFdOption stdOutput NonBlockingRead- @? "should be non-blocking"--signals001 :: TestTree-signals001 = testCase "signals001" Signals001.main--t1185 :: TestTree-t1185 = testCase "T1185" $ do- (stdinr, stdinw) <- createPipe- (stdoutr, stdoutw) <- createPipe- pid <- forkProcess $ do- hw <- fdToHandle stdoutw- hr <- fdToHandle stdinr- closeFd stdinw- hGetContents hr >>= hPutStr hw- hClose hr- hClose hw- exitImmediately ExitSuccess- threadDelay 100000- closeFd stdoutw- closeFd stdinw- hr2 <- fdToHandle stdoutr- hGetContents hr2 >>= putStr- actual <- getProcessStatus True False pid- actual @?= Just (Exited ExitSuccess)--t3816 :: TestTree-t3816 = testCase "T3816" $ do- not . null <$> getAllGroupEntries- @? "should be non-empty"- not . null <$> getAllGroupEntries- @? "should be non-empty"--user001 :: TestTree-user001 = testCase "user001" $ do- let force act = do- x <- act- x @?= x- force getRealUserID- force getRealUserID- force getRealGroupID- force getEffectiveUserID- force getEffectiveGroupID- force getGroups- force getEffectiveUserName- force $ getRealGroupID >>= getGroupEntryForID- force $ getRealGroupID >>= getGroupEntryForID >>= getGroupEntryForName . groupName- force getAllGroupEntries- force $ getRealUserID >>= getUserEntryForID- force getAllUserEntries--posix002 :: TestTree-posix002 = testCase "posix002" $ do- actual <- captureStdout $- executeFile "printenv" True [] (Just [("ONE","1"),("TWO","2")])- sort (lines actual) @?= ["ONE=1", "TWO=2"]--posix005 :: TestTree-posix005 = testCase "posix005" $ do- hSetBuffering stdout NoBuffering-- setEnvironment [("one","1"),("two","2")]- env0 <- getEnvironment- sort env0 @?= [("one","1"),("two","2")]-- setEnv "foo" "bar" True- env1 <- getEnvironment- sort env1 @?= [("foo","bar"),("one","1"),("two","2")]-- setEnv "foo" "baz" True- env2 <- getEnvironment- sort env2 @?= [("foo","baz"),("one","1"),("two","2")]-- setEnv "fu" "bar" True- env3 <- getEnvironment- sort env3 @?= [("foo","baz"),("fu","bar"),("one","1"),("two","2")]-- unsetEnv "foo"- env4 <- getEnvironment- sort env4 @?= [("fu","bar"),("one","1"),("two","2")]-- clearEnv- env5 <- getEnvironment- sort env5 @?= []--posix006 :: TestTree-posix006 = testCase "posix006" $ do- start <- epochTime- blockSignals reservedSignals -- see #4504- _ <- sleep 1- finish <- epochTime- let slept = finish - start- (slept >= 1 && slept <= 2)- @? "should have slept between 1 and 2"--posix010 :: TestTree-posix010 = testCase "posix010" $ do- root <- getUserEntryForName "root"- userName root @?= "root"- userID root @?= 0- userGroupID root @?= 0-- root' <- getUserEntryForID (userID root)- userName root' @?= "root"- userID root' @?= 0- userGroupID root' @?= 0-- homeDirectory root @?= homeDirectory root'------------------------------------------------------------------------------------ Utils--captureStdout :: IO () -> IO String-captureStdout = captureFd stdOutput--captureFd :: Fd -> IO () -> IO String-captureFd fd act = do- (dRead, dWrite) <- createPipe- _ <- forkProcess $ do- _ <- dupTo dWrite fd- act- closeFd dWrite- handle <- fdToHandle dRead- hGetContents handle
+ tests/Test.hsc view
@@ -0,0 +1,301 @@+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE CPP #-}++{-# OPTIONS_GHC -fno-warn-deprecations #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-}++#include "HsUnix.h"++module Main (main) where++import Control.Applicative+import Control.Concurrent+import qualified Control.Exception as E+import Control.Monad+import qualified Data.ByteString as B+import qualified Data.ByteString.Short as Sh+import Data.List (sort)+import System.Exit+import System.IO+import System.OsString.Internal.Types+import System.Posix+import qualified System.Posix.Env.ByteString as ByteString+import qualified System.Posix.ByteString.FilePath as BSFP+import qualified System.Posix.PosixPath.FilePath as PPFP+import Test.Tasty+import Test.Tasty.HUnit+import Test.Tasty.QuickCheck++import qualified FileStatus+import qualified FileExtendedStatus+import qualified FileStatusByteString+import qualified ReadDirStream+import qualified Signals001++main :: IO ()+main = defaultMain $ testGroup "All"+ [ testGroup "Common" -- common to JS and native platforms+ [ fileExist01+ ]+#if !defined(javascript_HOST_ARCH)+ , testGroup "Native"+ [ executeFile001 -- JS: missing "pipe"+ , fileStatus -- JS: missing "openat"+#ifdef HAVE_STATX+ , fileExtendedStatus -- JS: missing "openat"+#endif+ , fileStatusByteString -- JS: missing "openat"+ , getEnvironment01 -- JS: missing "environ"+ , testSystemPosixEnvByteString -- JS: missing "environ"+ , getGroupEntry -- JS: missing "sysconf"+ , getUserEntry -- JS: missing "sysconf"+ , processGroup001 -- JS: missing "getpgrp"+ , processGroup002 -- JS: missing "getppid"+ , queryFdOption01 -- JS: unimplemented "fcntl_read/write/lock"+ , signals001 -- JS: missing "sigismember"+ , t1185 -- JS: missing "pipe"+ , t3816 -- JS: missing "setgrent"+ , user001 -- JS: missing "getuid"+ , posix002 -- JS: missing "pipe"+ , posix005 -- JS: missing "environ"+ , posix006 -- JS: missing "time"+ , posix010 -- JS: missing "sysconf"+ , emptyDirStream+ , nonEmptyDirStream+ ]+#endif+ , testWithFilePath+ ]++executeFile001 :: TestTree+executeFile001 = testCase "executeFile001" $ do+ actual <- captureStdout $+ executeFile "echo" True ["arg1", "ar g2"] Nothing+ actual @?= "arg1 ar g2\n"++fileExist01 :: TestTree+fileExist01 = testCase "fileExist01" $ do+ fileExist "."+ @? "file should exist"+ not <$> fileExist "does not exist"+ @? "file should not exist"++fileStatus :: TestTree+fileStatus = testCase "fileStatus" FileStatus.main++fileExtendedStatus :: TestTree+fileExtendedStatus = testCase "fileExtendedStatus" FileExtendedStatus.main++fileStatusByteString :: TestTree+fileStatusByteString = testCase "fileStatusByteString" FileStatusByteString.main++getEnvironment01 :: TestTree+getEnvironment01 = testCase "getEnvironment01" $ do+ env <- getEnvironment+ not (null env)+ @? "environment should be non-empty"++protectEnvironment :: IO a -> IO a+protectEnvironment action = E.bracket ByteString.getEnvironment ByteString.setEnvironment $ \ _ -> action++testSystemPosixEnvByteString :: TestTree+testSystemPosixEnvByteString =+ testGroup "System.Posix.Env.ByteString" [+ testGroup "getEnvironment" [+ testCase "returns the environment" $ do+ env <- ByteString.getEnvironment+ not (null env)+ @? "environment should be non-empty"+ ]+ , testGroup "clearEnv" [+ testCase "clears the environment" $ protectEnvironment $ do+ ByteString.clearEnv+ ByteString.getEnvironment >>= (@?= [])+ ]+ ]++getGroupEntry :: TestTree+getGroupEntry = testCase "getGroupEntry" $ do+ let act = False <$ getGroupEntryForName "thisIsNotMeantToExist"+ act `E.catch` (\(_ :: E.SomeException) -> return True)+ @? "group should not exist"++getUserEntry :: TestTree+getUserEntry = testCase "getUserEntry" $ do+ let act = False <$ getUserEntryForName "thisIsNotMeantToExist"+ act `E.catch` (\(_ :: E.SomeException) -> return True)+ @? "user should not exist"++processGroup001 :: TestTree+processGroup001 = testCase "processGroup001" $ do+ pgid <- getProcessGroupID+ pgid' <- getProcessGroupIDOf =<< getProcessID+ pgid @?= pgid'++processGroup002 :: TestTree+processGroup002 = testCase "processGroup002" $ do+ pid <- getProcessID+ ppid <- getParentProcessID+ ppgid <- getProcessGroupIDOf ppid+ -- join the parent process+ joinProcessGroup ppgid+ pgid1 <- getProcessGroupID+ ppgid @?= pgid1+ -- be a leader+ _ <- createProcessGroupFor pid+ pgid2 <- getProcessGroupID+ pid @?= fromIntegral pgid2+ -- and join the parent again+ setProcessGroupIDOf pid ppgid+ pgid3 <- getProcessGroupID+ ppgid @?= pgid3++queryFdOption01 :: TestTree+queryFdOption01 = testCase "queryFdOption01" $ do+ not <$> queryFdOption stdOutput NonBlockingRead+ @? "should be blocking"+ setFdOption stdOutput NonBlockingRead True+ queryFdOption stdOutput NonBlockingRead+ @? "should be non-blocking"++signals001 :: TestTree+signals001 = testCase "signals001" Signals001.main++t1185 :: TestTree+t1185 = testCase "T1185" $ do+ (stdinr, stdinw) <- createPipe+ (stdoutr, stdoutw) <- createPipe+ pid <- forkProcess $ do+ hw <- fdToHandle stdoutw+ hr <- fdToHandle stdinr+ closeFd stdinw+ hGetContents hr >>= hPutStr hw+ hClose hr+ hClose hw+ exitImmediately ExitSuccess+ threadDelay 100000+ closeFd stdoutw+ closeFd stdinw+ hr2 <- fdToHandle stdoutr+ hGetContents hr2 >>= putStr+ actual <- getProcessStatus True False pid+ actual @?= Just (Exited ExitSuccess)++t3816 :: TestTree+t3816 = testCase "T3816" $ do+ not . null <$> getAllGroupEntries+ @? "should be non-empty"+ not . null <$> getAllGroupEntries+ @? "should be non-empty"++user001 :: TestTree+user001 = testCase "user001" $ do+ let force act = do+ x <- act+ x @?= x+ force getRealUserID+ force getRealUserID+ force getRealGroupID+ force getEffectiveUserID+ force getEffectiveGroupID+ force getGroups+ force getEffectiveUserName+ force $ getRealGroupID >>= getGroupEntryForID+ force $ getRealGroupID >>= getGroupEntryForID >>= getGroupEntryForName . groupName+ force getAllGroupEntries+ force $ getRealUserID >>= getUserEntryForID+ force getAllUserEntries++posix002 :: TestTree+posix002 = testCase "posix002" $ do+ actual <- captureStdout $+ executeFile "printenv" True [] (Just [("ONE","1"),("TWO","2")])+ sort (lines actual) @?= ["ONE=1", "TWO=2"]++posix005 :: TestTree+posix005 = testCase "posix005" $ protectEnvironment $ do+ hSetBuffering stdout NoBuffering++ setEnvironment [("one","1"),("two","2")]+ env0 <- getEnvironment+ sort env0 @?= [("one","1"),("two","2")]++ setEnv "foo" "bar" True+ env1 <- getEnvironment+ sort env1 @?= [("foo","bar"),("one","1"),("two","2")]++ setEnv "foo" "baz" True+ env2 <- getEnvironment+ sort env2 @?= [("foo","baz"),("one","1"),("two","2")]++ setEnv "fu" "bar" True+ env3 <- getEnvironment+ sort env3 @?= [("foo","baz"),("fu","bar"),("one","1"),("two","2")]++ unsetEnv "foo"+ env4 <- getEnvironment+ sort env4 @?= [("fu","bar"),("one","1"),("two","2")]++ clearEnv+ env5 <- getEnvironment+ sort env5 @?= []++posix006 :: TestTree+posix006 = testCase "posix006" $ do+ start <- epochTime+ blockSignals reservedSignals -- see #4504+ _ <- sleep 1+ finish <- epochTime+ let slept = finish - start+ (slept >= 1 && slept <= 2)+ @? "should have slept between 1 and 2"++posix010 :: TestTree+posix010 = testCase "posix010" $ do+ root <- getUserEntryForName "root"+ userName root @?= "root"+ userID root @?= 0+ userGroupID root @?= 0++ root' <- getUserEntryForID (userID root)+ userName root' @?= "root"+ userID root' @?= 0+ userGroupID root' @?= 0++ homeDirectory root @?= homeDirectory root'++testWithFilePath :: TestTree+testWithFilePath =+ adjustOption (\(QuickCheckTests n) -> QuickCheckTests (n `max` 10000)) $+ testGroup "withFilePath"+ [ testProperty "ByteString" $+ \xs -> let ys = B.pack $ filter (/= 0) xs in+ ioProperty $ BSFP.withFilePath ys+ (\ptr -> (=== ys) <$> B.packCString ptr)+ , testProperty "PosixPath" $+ \xs -> let ys = Sh.pack $ filter (/= 0) xs in+ ioProperty $ PPFP.withFilePath (PosixString ys)+ (\ptr -> (=== ys) <$> Sh.packCString ptr)+ ]++emptyDirStream :: TestTree+emptyDirStream = testCase "emptyDirStream" ReadDirStream.emptyDirStream++nonEmptyDirStream :: TestTree+nonEmptyDirStream = testCase "nonEmptyDirStream" ReadDirStream.nonEmptyDirStream++-------------------------------------------------------------------------------+-- Utils++captureStdout :: IO () -> IO String+captureStdout = captureFd stdOutput++captureFd :: Fd -> IO () -> IO String+captureFd fd act = do+ (dRead, dWrite) <- createPipe+ _ <- forkProcess $ do+ _ <- dupTo dWrite fd+ act+ closeFd dWrite+ handle <- fdToHandle dRead+ hGetContents handle
unix.buildinfo.in view
@@ -1,3 +1,2 @@-buildable: @BUILD_PACKAGE_BOOL@ extra-libraries: @EXTRA_LIBS@ install-includes: HsUnixConfig.h
unix.cabal view
@@ -1,16 +1,26 @@+cabal-version: 1.12 name: unix-version: 2.7.3+version: 2.8.8.0 -- NOTE: Don't forget to update ./changelog.md+ license: BSD3 license-file: LICENSE-maintainer: libraries@haskell.org+maintainer: Julian Ospald <hasufell@posteo.de>, Viktor Dukhovni <ietf-dane@dukhovni.org>, Andrew Lelechenko <andrew.lelechenko@gmail.com> homepage: https://github.com/haskell/unix bug-reports: https://github.com/haskell/unix/issues synopsis: POSIX functionality category: System build-type: Configure-cabal-version: >= 1.10-tested-with: GHC>=7.4.1+tested-with: GHC==9.12.1,+ GHC==9.10.1,+ GHC==9.8.4,+ GHC==9.6.6,+ GHC==9.4.7,+ GHC==9.2.8,+ GHC==9.0.2,+ GHC==8.10.7,+ GHC==8.8.4,+ GHC==8.6.5 description: This package gives you access to the set of operating system services standardised by@@ -38,6 +48,16 @@ include/HsUnixConfig.h unix.buildinfo +flag os-string+ description: Use the new os-string package+ default: False+ manual: False++flag non-portable-tests+ description: Run tests that may not be portable across all systems, but are guaranteed to succeed in our own CI+ default: False+ manual: True+ source-repository head type: git location: https://github.com/haskell/unix.git@@ -62,28 +82,40 @@ buildable: False build-depends:- base >= 4.10 && < 4.18,- bytestring >= 0.9.2 && < 0.12,- time >= 1.2 && < 1.13+ base >= 4.12.0.0 && < 4.23,+ bytestring >= 0.9.2 && < 0.13,+ time >= 1.9.1 && < 1.16 + if flag(os-string)+ build-depends: filepath >= 1.5.0.0, os-string >= 2.0.0+ else+ build-depends: filepath >= 1.4.100.0 && < 1.5.0.0+ exposed-modules: System.Posix System.Posix.ByteString+ System.Posix.PosixString System.Posix.Error System.Posix.Resource System.Posix.Time System.Posix.Unistd- System.Posix.User System.Posix.Signals System.Posix.Signals.Exts System.Posix.Semaphore System.Posix.SharedMem + System.Posix.User+ System.Posix.User.ByteString+ System.Posix.ByteString.FilePath+ System.Posix.PosixPath.FilePath System.Posix.Directory+ System.Posix.Directory.Internals+ System.Posix.Directory.Fd System.Posix.Directory.ByteString+ System.Posix.Directory.PosixPath System.Posix.DynamicLinker.Module System.Posix.DynamicLinker.Module.ByteString@@ -93,24 +125,30 @@ System.Posix.Files System.Posix.Files.ByteString+ System.Posix.Files.PosixString System.Posix.IO System.Posix.IO.ByteString+ System.Posix.IO.PosixString System.Posix.Env System.Posix.Env.ByteString+ System.Posix.Env.PosixString System.Posix.Fcntl System.Posix.Process System.Posix.Process.Internals System.Posix.Process.ByteString+ System.Posix.Process.PosixString System.Posix.Temp System.Posix.Temp.ByteString+ System.Posix.Temp.PosixString System.Posix.Terminal System.Posix.Terminal.ByteString+ System.Posix.Terminal.PosixString other-modules: System.Posix.Directory.Common@@ -119,33 +157,49 @@ System.Posix.IO.Common System.Posix.Process.Common System.Posix.Terminal.Common+ System.Posix.User.Common+ System.Posix.Env.Internal ghc-options: -Wall include-dirs: include- includes:- HsUnix.h- execvpe.h install-includes: HsUnix.h execvpe.h- c-sources:- cbits/HsUnix.c- cbits/execvpe.c + if !arch(javascript)+ c-sources:+ cbits/HsUnix.c+ cbits/execvpe.c++ if arch(javascript)+ js-sources:+ jsbits/time.js+ test-suite unix-tests hs-source-dirs: tests main-is: Test.hs other-modules: FileStatus+ FileExtendedStatus FileStatusByteString Signals001+ ReadDirStream type: exitcode-stdio-1.0 default-language: Haskell2010- build-depends: base, tasty, tasty-hunit, unix+ build-depends: base, bytestring, tasty, tasty-hunit, tasty-quickcheck, unix+ if flag(os-string)+ build-depends: filepath >= 1.5.0.0, os-string >= 2.0.0+ else+ build-depends: filepath >= 1.4.100.0 && < 1.5.0.0 ghc-options: -Wall -with-rtsopts=-V0 test-suite FdReadBuf001+ -- JS: missing "pipe"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: FdReadBuf001.hs type: exitcode-stdio-1.0@@ -154,6 +208,11 @@ ghc-options: -Wall -threaded test-suite ForkProcess01+ -- JS: missing "forkProcess"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: ForkProcess01.hs type: exitcode-stdio-1.0@@ -162,6 +221,11 @@ ghc-options: -Wall test-suite Signals002+ -- JS: missing "raise"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: Signals002.hs type: exitcode-stdio-1.0@@ -170,6 +234,11 @@ ghc-options: -Wall test-suite Signals004+ -- JS: missing "raise"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: Signals004.hs type: exitcode-stdio-1.0@@ -178,6 +247,11 @@ ghc-options: -Wall test-suite Posix004+ -- JS: missing "forkProcess"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: Posix004.hs type: exitcode-stdio-1.0@@ -186,6 +260,11 @@ ghc-options: -Wall test-suite Posix009+ -- JS: missing "rtsTimerSignal"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: Posix009.hs type: exitcode-stdio-1.0@@ -194,6 +273,11 @@ ghc-options: -Wall -with-rtsopts=-V0 test-suite Posix014+ -- JS: missing "pipe"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: Posix014.hs type: exitcode-stdio-1.0@@ -202,6 +286,11 @@ ghc-options: -Wall test-suite T8108+ -- JS: missing "sysconf"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: T8108.hs type: exitcode-stdio-1.0@@ -210,6 +299,11 @@ ghc-options: -Wall test-suite ResourceLimit+ -- JS: missing "setrlimit"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: ResourceLimit.hs type: exitcode-stdio-1.0@@ -218,6 +312,11 @@ ghc-options: -Wall test-suite Terminal+ -- JS: missing "openpty"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: Terminal.hs type: exitcode-stdio-1.0@@ -226,6 +325,11 @@ ghc-options: -Wall test-suite PutEnv001+ -- JS: missing "performGC"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: PutEnv001.hs type: exitcode-stdio-1.0@@ -234,9 +338,64 @@ ghc-options: -Wall -with-rtsopts=-V0 -O0 test-suite Semaphore001+ -- JS: missing "sem_open"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False+ hs-source-dirs: tests main-is: Semaphore001.hs type: exitcode-stdio-1.0 default-language: Haskell2010 build-depends: base, unix ghc-options: -Wall++test-suite Semaphore002+ -- JS: missing "sem_open"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False++ hs-source-dirs: tests+ main-is: Semaphore002.hs+ type: exitcode-stdio-1.0+ default-language: Haskell2010+ build-depends: base, unix+ ghc-options: -Wall -threaded++test-suite SemaphoreInterrupt+ -- JS: missing "sem_open"+ if arch(javascript)+ build-depends: unbuildable<0+ buildable: False++ hs-source-dirs: tests+ main-is: SemaphoreInterrupt.hs+ type: exitcode-stdio-1.0+ default-language: Haskell2010+ build-depends: base, unix+ ghc-options: -Wall -threaded++test-suite T13660+ hs-source-dirs: tests+ main-is: T13660.hs+ type: exitcode-stdio-1.0+ default-language: Haskell2010+ build-depends: base, unix, bytestring+ if flag(os-string)+ build-depends: filepath >= 1.5.0.0, os-string >= 2.0.0+ else+ build-depends: filepath >= 1.4.100.0 && < 1.5.0.0+ ghc-options: -Wall++test-suite DirEnt+ hs-source-dirs: tests+ main-is: DirEnt.hs+ type: exitcode-stdio-1.0+ default-language: Haskell2010+ build-depends: base, unix+ ghc-options: -Wall+ if !flag(non-portable-tests)+ build-depends: unbuildable<0+ buildable: False+