HGL (empty) → 3.1
raw patch · 39 files changed
+9896/−0 lines, 39 filesdep +X11dep +basebuild-type:Customsetup-changed
Dependencies added: X11, base
Files
- Graphics/HGL.hs +98/−0
- Graphics/HGL/Core.hs +27/−0
- Graphics/HGL/Draw.hs +46/−0
- Graphics/HGL/Draw/Brush.hs +105/−0
- Graphics/HGL/Draw/Font.hs +174/−0
- Graphics/HGL/Draw/Monad.hs +24/−0
- Graphics/HGL/Draw/Pen.hs +125/−0
- Graphics/HGL/Draw/Picture.hs +197/−0
- Graphics/HGL/Draw/Region.hs +201/−0
- Graphics/HGL/Draw/Text.hs +247/−0
- Graphics/HGL/Internals/Draw.hs +93/−0
- Graphics/HGL/Internals/Event.hs +83/−0
- Graphics/HGL/Internals/Events.hs +68/−0
- Graphics/HGL/Internals/Flag.hs +60/−0
- Graphics/HGL/Internals/Types.hs +110/−0
- Graphics/HGL/Internals/Utilities.hs +49/−0
- Graphics/HGL/Key.hs +214/−0
- Graphics/HGL/Run.hs +70/−0
- Graphics/HGL/Units.hs +22/−0
- Graphics/HGL/Utils.hs +294/−0
- Graphics/HGL/Win32/Bitmap.hs +172/−0
- Graphics/HGL/Win32/Draw.hs +162/−0
- Graphics/HGL/Win32/Types.hs +62/−0
- Graphics/HGL/Win32/WND.hs +361/−0
- Graphics/HGL/Window.hs +194/−0
- Graphics/HGL/X11/DC.hs +59/−0
- Graphics/HGL/X11/Display.hs +55/−0
- Graphics/HGL/X11/Timer.hs +121/−0
- Graphics/HGL/X11/Types.hs +100/−0
- Graphics/HGL/X11/Window.hs +677/−0
- Graphics/SOE.hs +274/−0
- HGL.buildinfo.in +5/−0
- HGL.cabal +55/−0
- LICENSE +26/−0
- Setup.hs +6/−0
- config.mk.in +7/−0
- configure +5140/−0
- configure.ac +61/−0
- include/HsHGLConfig.h.in +52/−0
+ Graphics/HGL.hs view
@@ -0,0 +1,98 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- A simple graphics library.+--+-----------------------------------------------------------------------------++module Graphics.HGL+ (+ -- $intro+ module Graphics.HGL.Units+ , module Graphics.HGL.Run+ , module Graphics.HGL.Window+ , module Graphics.HGL.Draw+ , module Graphics.HGL.Key+ , module Graphics.HGL.Utils+ -- $utils+ ) where++import Graphics.HGL.Units+import Graphics.HGL.Run+import Graphics.HGL.Window+import Graphics.HGL.Draw+import Graphics.HGL.Key+import Graphics.HGL.Utils++{- $intro++The Haskell Graphics Library is designed to give the programmer access+to most interesting parts of the Win32 Graphics Device Interface and X11+library without exposing the programmer to the pain and anguish usually+associated with using these interfaces.++To give you a taste of what the library looks like, here is the +obligatory \"Hello World\" program:++> module Main where+>+> import Graphics.HGL+>+> main :: IO ()+> main = runGraphics $+> withWindow_ "Hello World Window" (300, 200) $ \ w -> do+> drawInWindow w $ text (100, 100) "Hello World"+> drawInWindow w $ ellipse (100, 80) (200, 180)+> getKey w++Here's what each function does:++* 'runGraphics' (defined in "Graphics.HGL.Run") runs a graphical action+ in an appropriate environment. All the other functions of the library+ should be used inside 'runGraphics'.++* 'withWindow_' runs an action using a new 'Window', specifying the+ window title and size (300 pixels wide and 200 high). The window is+ closed when the action finishes.++* 'drawInWindow' draws a 'Graphic' (an abstract representation of a+ picture) on a 'Window'.++* 'text' creates a 'Graphic' consisting of a string at the specified+ position.++* 'ellipse' creates a 'Graphic' consisting of an ellipse fitting inside+ a rectangle defined by the two points. These and other functions for+ defining, combining and modifying pictures are in "Graphics.HGL.Draw".++* 'getKey' waits for the user to press (and release) a key. (This is+ necessary here to prevent the window from closing before you have a+ chance to read what's on the screen.)++The library is broken up into several pieces.++-}++{- $utils++The module "Graphics.HGL.Utils" defines a number of convenience functions+in terms of more primitive functions defined by other modules. For example,++* 'withWindow_' is defined using 'openWindowEx' and 'closeWindow' (from+ "Graphics.HGL.Window").++* 'getKey' is defined using 'getWindowEvent', which waits for a range+ of user interface events.++* Instead of drawing several 'Graphic' objects sequentially as in the+ above example, you can combine them into a single 'Graphic' object using+ 'overGraphic'.++-}
+ Graphics/HGL/Core.hs view
@@ -0,0 +1,27 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Core+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Core functions of a simple graphics library.+--+-----------------------------------------------------------------------------++module Graphics.HGL.Core+ ( module Graphics.HGL.Units+ , module Graphics.HGL.Run+ , module Graphics.HGL.Window+ , module Graphics.HGL.Draw+ , module Graphics.HGL.Key+ ) where++import Graphics.HGL.Units+import Graphics.HGL.Run+import Graphics.HGL.Window+import Graphics.HGL.Draw+import Graphics.HGL.Key
+ Graphics/HGL/Draw.hs view
@@ -0,0 +1,46 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Draw+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Drawing in a simple graphics library.+--+-----------------------------------------------------------------------------++module Graphics.HGL.Draw+ (+ -- * Graphics+ -- | The type 'Graphic', which represents an abstract drawing,+ -- is actually a special case of a 'Draw' monad.+ module Graphics.HGL.Draw.Monad++ -- * Graphical objects+ -- | These are ways of constructing values of type 'Graphic'.+ , module Graphics.HGL.Draw.Picture+ , module Graphics.HGL.Draw.Text+ , module Graphics.HGL.Draw.Region++ -- * Graphical attributes+ -- | These are used to alter the above drawings.+ -- Brushes are used for filling shapes, pens for drawing lines.+ , module Graphics.HGL.Draw.Brush+ , module Graphics.HGL.Draw.Pen+ , module Graphics.HGL.Draw.Font+ ) where++import Graphics.HGL.Draw.Monad+import Graphics.HGL.Draw.Picture+import Graphics.HGL.Draw.Text+import Graphics.HGL.Draw.Region+import Graphics.HGL.Draw.Brush+import Graphics.HGL.Draw.Pen+import Graphics.HGL.Draw.Font++----------------------------------------------------------------+-- The end+----------------------------------------------------------------
+ Graphics/HGL/Draw/Brush.hs view
@@ -0,0 +1,105 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Draw.Brush+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Brushes, used for filling shapes.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++module Graphics.HGL.Draw.Brush+ ( Brush+ , createBrush+ , deleteBrush+ , selectBrush -- :: Brush -> Draw Brush+ , mkBrush+ -- , blackBrush, whiteBrush+ ) where++import Graphics.HGL.Draw.Text (RGB(..))+import Graphics.HGL.Draw.Monad (Draw)+import Graphics.HGL.Internals.Draw (mkDraw)+#if !X_DISPLAY_MISSING+import Graphics.HGL.X11.Types+import qualified Graphics.X11.Xlib as X+import Control.Concurrent (takeMVar, putMVar)+#else+import Graphics.HGL.Draw.Monad (ioToDraw, bracket)+import qualified Graphics.Win32 as Win32+#endif++----------------------------------------------------------------+-- The interface+----------------------------------------------------------------++#if X_DISPLAY_MISSING+newtype Brush = MkBrush Win32.HBRUSH+#endif++-- | Create a 'Brush'.+createBrush :: RGB -> IO Brush++-- | Destroy a 'Brush' created with 'createBrush'.+deleteBrush :: Brush -> IO ()++-- | Set the 'Brush' for subsequent drawing, returning the previous setting.+selectBrush :: Brush -> Draw Brush++-- | Create a 'Brush' locally to a drawing.+mkBrush :: RGB -> (Brush -> Draw a) -> Draw a++----------------------------------------------------------------+-- The implementation+----------------------------------------------------------------++#if !X_DISPLAY_MISSING++createBrush col = return (Brush col)++deleteBrush _ = return ()++-- ToDo: how do I set background colour for brush and pen?+selectBrush b@(Brush x) = mkDraw $ \ dc -> do+ bs <- takeMVar (ref_bits dc)+ putMVar (ref_bits dc) bs{brush=b}+ p <- lookupColor (disp dc) x+ X.setForeground (disp dc) (brushGC dc) p+ return (brush bs)++mkBrush c g = g (Brush c)++#else /* X_DISPLAY_MISSING */++createBrush (RGB r g b) = do+ b <- Win32.createSolidBrush (Win32.rgb r g b)+ return (MkBrush b)++deleteBrush (MkBrush b) = Win32.deleteBrush b++selectBrush (MkBrush b) = mkDraw $ \hdc -> do+ b' <- Win32.selectBrush hdc b+ return (MkBrush b')++mkBrush color =+ bracket (ioToDraw $ createBrush color)+ (ioToDraw . deleteBrush)++----------------------------------------------------------------+-- +-- -- special cases - these should _never_ be deleted+-- blackBrush :: IO Brush+-- whiteBrush :: IO Brush+-- +-- blackBrush = Win32.getStockBrush Win32.bLACK_BRUSH >>= return . MkBrush+-- whiteBrush = Win32.getStockBrush Win32.wHITE_BRUSH >>= return . MkBrush+-- +----------------------------------------------------------------++#endif /* X_DISPLAY_MISSING */
+ Graphics/HGL/Draw/Font.hs view
@@ -0,0 +1,174 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Draw.Font+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Text fonts.+--+-- Portability notes:+--+-- * X11 does not directly support font rotation so 'createFont' and+-- 'mkFont' always ignore the rotation angle argument in the X11+-- implementation of this library.+--+-- * Many of the font families typically available on Win32 are not+-- available on X11 (and /vice-versa/). In our experience, the font+-- families /courier/, /helvetica/ and /times/ are somewhat portable.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++module Graphics.HGL.Draw.Font+ ( Font+ , createFont+ , deleteFont+ , selectFont -- :: Font -> Draw Font+ , mkFont+ ) where++#if !X_DISPLAY_MISSING+import qualified Graphics.HGL.Internals.Utilities as Utils+import Graphics.HGL.X11.Types (Font(Font), DC(..), DC_Bits(..))+import Graphics.HGL.X11.Display (getDisplay)+import qualified Graphics.X11.Xlib as X+import Control.Concurrent.MVar (takeMVar, putMVar)+#else+import Graphics.HGL.Win32.Types+import qualified Graphics.Win32 as Win32+#endif++import Graphics.HGL.Units (Size, Angle)+import Graphics.HGL.Draw.Monad (Draw, bracket, ioToDraw)+import Graphics.HGL.Internals.Draw (mkDraw)++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++#if X_DISPLAY_MISSING+newtype Font = MkFont Win32.HFONT+#endif++-- | Create a font.+-- The rotation angle is ignored if the font is not a \"TrueType\" font+-- (e.g., a @System@ font on Win32).+createFont+ :: Size -- ^ size of character glyphs in pixels+ -> Angle -- ^ rotation angle+ -> Bool -- ^ bold font?+ -> Bool -- ^ italic font?+ -> String -- ^ font family+ -> IO Font++-- | Delete a font created with 'createFont'.+deleteFont :: Font -> IO ()++-- | Set the font for subsequent text, and return the previous font.+selectFont :: Font -> Draw Font ++-- | Generate a font for use in a drawing, and delete it afterwards.+-- The rotation angle is ignored if the font is not a \"TrueType\" font+-- (e.g., a @System@ font on Win32).+mkFont :: Size -- ^ size of character glyphs in pixels+ -> Angle -- ^ rotation angle+ -> Bool -- ^ bold font?+ -> Bool -- ^ italic font?+ -> String -- ^ font family+ -> (Font -> Draw a)+ -> Draw a++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++mkFont size angle bold italic family =+ bracket (ioToDraw $ createFont size angle bold italic family)+ (ioToDraw . deleteFont)++#if !X_DISPLAY_MISSING++createFont (width, height) escapement bold italic family = do+ display <- getDisplay+-- print fontName+ r <- Utils.safeTry (X.loadQueryFont display fontName)+ case r of+ Left e -> ioError (userError $ "Unable to load font " ++ fontName)+ Right f -> return (Font f)+ where+ fontName = concatMap ('-':) fontParts+ fontParts = [ foundry+ , family+ , weight+ , slant+ , sWdth+ , adstyl+ , pxlsz+ , ptSz+ , resx+ , resy+ , spc+ , avgWidth+ , registry+ , encoding+ ]+ foundry = "*" -- eg "adobe"+ -- family = "*" -- eg "courier"+ weight = if bold then "bold" else "medium"+ slant = if italic then "i" else "r"+ sWdth = "normal"+ adstyl = "*"+ pxlsz = show height+ ptSz = "*"+ resx = "75"+ resy = "75"+ spc = "*"+ avgWidth = show (width*10) -- not sure what unit they use+ registry = "*"+ encoding = "*"++deleteFont (Font f) = do+ display <- getDisplay+ X.freeFont display f++selectFont f@(Font x) = mkDraw $ \ dc -> do+ bs <- takeMVar (ref_bits dc)+ putMVar (ref_bits dc) bs{font=f}+ X.setFont (disp dc) (textGC dc) (X.fontFromFontStruct x)+ return (font bs)++#else /* X_DISPLAY_MISSING */++createFont (width, height) escapement bold italic family = + Win32.createFont (fromDimension height) (fromDimension width)+ (round (escapement * 1800/pi))+ 0 -- orientation+ weight+ italic False False -- italic, underline, strikeout+ Win32.aNSI_CHARSET+ Win32.oUT_DEFAULT_PRECIS+ Win32.cLIP_DEFAULT_PRECIS+ Win32.dEFAULT_QUALITY+ Win32.dEFAULT_PITCH+ family+ >>= return . MkFont+ where+ weight | bold = Win32.fW_BOLD+ | otherwise = Win32.fW_NORMAL++deleteFont (MkFont f) = Win32.deleteFont f++selectFont (MkFont f) = mkDraw (\hdc -> do+ f' <- Win32.selectFont hdc f+ return (MkFont f'))++#endif /* X_DISPLAY_MISSING */++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Draw/Monad.hs view
@@ -0,0 +1,24 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Draw.Monad+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- The 'Draw' monad, with graphical objects as a special case.+--+-----------------------------------------------------------------------------++module Graphics.HGL.Draw.Monad+ ( Graphic -- = Draw ()+ , Draw+ , ioToDraw -- :: IO a -> Draw a++ , bracket -- :: Draw a -> (a -> Draw b) -> (a -> Draw c) -> Draw c+ , bracket_ -- :: Draw a -> (a -> Draw b) -> Draw c -> Draw c+ ) where++import Graphics.HGL.Internals.Draw
+ Graphics/HGL/Draw/Pen.hs view
@@ -0,0 +1,125 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Draw.Pen+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Pens, used for drawing lines.+--+-- Portability notes:+--+-- * On Win32, the pen is also used to draw a line round all the filled+-- shapes --- so the pen color also affects how polygons, ellipses+-- and regions are drawn.+--+-- * On Win32, the 'Style' is ignored (i.e. treated as 'Solid') for pens+-- of width greater than 1. This problem does not apply to X11.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++module Graphics.HGL.Draw.Pen+ ( Pen+ , Style(Solid, Dash, Dot, DashDot, DashDotDot, Null, InsideFrame)+ , createPen -- :: Style -> Int -> RGB -> IO Pen+ , deletePen+ , selectPen -- :: Pen -> Draw Pen+ , mkPen -- :: Style -> Int -> RGB -> (Pen -> Draw a) -> Draw a+ ) where++import Graphics.HGL.Draw.Text (RGB)+import Graphics.HGL.Draw.Monad (Draw, ioToDraw)+import Graphics.HGL.Internals.Types (Style(..))+import Graphics.HGL.Internals.Draw (mkDraw) ++#if !X_DISPLAY_MISSING+import Graphics.HGL.X11.Types+import Graphics.HGL.X11.Display+import qualified Graphics.X11.Xlib as X+import Control.Concurrent (takeMVar, putMVar)+#else+import Graphics.HGL.Win32.Types+import qualified Graphics.Win32 as Win32+import Graphics.HGL.Draw.Monad (bracket)+#endif++----------------------------------------------------------------+#if X_DISPLAY_MISSING+newtype Pen = Pen Win32.HPEN+#endif++-- | Create a 'Pen'.+createPen :: Style -> Int -> RGB -> IO Pen++-- | Destroy a 'Pen' created with 'createPen'.+deletePen :: Pen -> IO ()++-- | Set the 'Pen' for subsequent drawing, returning the previous setting.+selectPen :: Pen -> Draw Pen++-- | Create a 'Pen' locally to a drawing.+mkPen :: Style -> Int -> RGB -> (Pen -> Draw a) -> Draw a+----------------------------------------------------------------++#if !X_DISPLAY_MISSING++----------------------------------------------------------------+-- Pens+--+-- Used to draw lines and boundaries of filled shapes+----------------------------------------------------------------++createPen style width col = do+ display <- getDisplay+ pixel <- lookupColor display col+ return (Pen style width pixel)++deletePen _ = return ()++-- ToDo: how do I set background colour for brush and pen?+selectPen p@(Pen _ lwidth c) = mkDraw $ \ dc -> do+ bs <- takeMVar (ref_bits dc)+ putMVar (ref_bits dc) bs{pen=p}+ X.setForeground (disp dc) (paintGC dc) c+ X.setLineAttributes (disp dc) (paintGC dc) lwidth X.lineSolid X.capButt X.joinMiter+ return (pen bs)++mkPen style width color g = do+ p <- ioToDraw $ createPen style width color+ g p++#else /* X_DISPLAY_MISSING */++style :: Style -> Win32.PenStyle+style Solid = Win32.pS_SOLID +style Dash = Win32.pS_DASH +style Dot = Win32.pS_DOT +style DashDot = Win32.pS_DASHDOT +style DashDotDot = Win32.pS_DASHDOTDOT +style Null = Win32.pS_NULL +style InsideFrame = Win32.pS_INSIDEFRAME ++createPen sty width c = + Win32.createPen (style sty) (fromIntegral width) (fromRGB c) >>= return . Pen++deletePen (Pen pen) = + Win32.deletePen pen++selectPen (Pen p) = mkDraw (\hdc -> do+ p' <- Win32.selectPen hdc p+ return (Pen p'))++mkPen sty width c =+ bracket (ioToDraw $ createPen sty width c)+ (ioToDraw . deletePen)++#endif /* X_DISPLAY_MISSING */++----------------------------------------------------------------+-- The end+----------------------------------------------------------------
+ Graphics/HGL/Draw/Picture.hs view
@@ -0,0 +1,197 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Draw.Picture+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Drawing various shapes.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++module Graphics.HGL.Draw.Picture+ ( arc, ellipse, shearEllipse+ , line, polyline, polygon+ , polyBezier -- becomes error message and polyline in X11+ ) where++#if !X_DISPLAY_MISSING+import Graphics.HGL.X11.Types+import qualified Graphics.X11.Xlib as X+import System.IO.Unsafe(unsafePerformIO)+import System.IO(stderr, hPutStrLn)+#else+import Graphics.HGL.Win32.Types+import qualified Graphics.Win32 as Win32+#endif++import Graphics.HGL.Draw.Monad(Graphic)+import Graphics.HGL.Internals.Draw(mkDraw)+import Graphics.HGL.Units++----------------------------------------------------------------+-- The Interface (SOE, p50)+----------------------------------------------------------------++-- | A filled arc from an ellipse.+arc+ :: Point -- ^ a corner of the rectangle bounding the ellipse.+ -> Point -- ^ the opposite corner of the rectangle bounding the ellipse.+ -> Angle -- ^ the start angle of the arc, measured counter-clockwise+ -- from the horizontal.+ -> Angle -- ^ the extent of the arc, measured counter-clockwise from+ -- the start angle.+ -> Graphic -- ^ a filled shape++-- | A filled ellipse that fits inside a rectangle defined by two+-- 'Point's on the window.+ellipse+ :: Point -- ^ a corner of the rectangle bounding the ellipse.+ -> Point -- ^ the opposite corner of the rectangle bounding the ellipse.+ -> Graphic -- ^ a filled shape++-- | A filled sheared ellipse that fits inside a parallelogram defined+-- by three 'Point's on the window. This function is implemented using+-- polygons on both Win32 and X11.+shearEllipse+ :: Point -- ^ a corner of the bounding parallelogram.+ -> Point -- ^ another corner of the parallelogram, adjacent to the first.+ -> Point -- ^ another corner of the parallelogram, adjacent to the first+ -- and thus opposite to the second.+ -> Graphic -- ^ a filled shape++-- | A filled polygon defined by a list of 'Point's.+polygon :: [Point] -> Graphic -- filled++-- | A line between two 'Point's.+line :: Point -> Point -> Graphic -- unfilled++-- | A series of lines through a list of 'Point's.+polyline :: [Point] -> Graphic -- unfilled++-- | A series of (unfilled) Bezier curves defined by a list of 3/n/+1+-- control 'Point's. This function is not supported on X11 (it yields+-- an error message and a 'polyline').+polyBezier :: [Point] -> Graphic -- unfilled++----------------------------------------------------------------+-- The Implementation+----------------------------------------------------------------++#if !X_DISPLAY_MISSING++arc (x0,y0) (x1,y1) s e = mkDraw (\ dc -> X.fillArc (disp dc) (drawable dc) (paintGC dc) x' y' w' h' s' e')+ where+ (x,w) = minAndDelta x0 x1+ (y,h) = minAndDelta y0 y1+ x' = fromIntegral x+ y' = fromIntegral y+ w' = fromIntegral w+ h' = fromIntegral h+ s' = round (s * 64)+ e' = round (e * 64)++ellipse (x0,y0) (x1,y1) = mkDraw (\ dc -> X.fillArc (disp dc) (drawable dc) (brushGC dc) x' y' w' h' 0 threeSixty)+ where+ (x,w) = minAndDelta x0 x1+ (y,h) = minAndDelta y0 y1+ x' = fromIntegral x+ y' = fromIntegral y+ w' = fromIntegral w+ h' = fromIntegral h++-- X measures angles in 64ths of a degree+threeSixty :: Int+threeSixty = 360*64++shearEllipse p0 p1 p2 = mkDraw (\ dc -> X.fillPolygon (disp dc) (drawable dc) (brushGC dc) pts X.convex X.coordModeOrigin)+ where+ X.Point x0 y0 = fromPoint p0+ X.Point x1 y1 = fromPoint p1+ X.Point x2 y2 = fromPoint p2++ x = avg x1 x2 -- centre of parallelogram+ y = avg y1 y2+ + dx1 = fromIntegral ((x1 - x0) `div` 2) -- distance to corners from centre+ dy1 = fromIntegral ((y1 - y0) `div` 2)+ dx2 = fromIntegral ((x2 - x0) `div` 2)+ dy2 = fromIntegral ((y2 - y0) `div` 2)++ pts = [ X.Point (x + round(c*dx1 + s*dx2)) (y + round(c*dy1 + s*dy2))+ | (c,s) <- cos'n'sins+ ]++cos'n'sins :: [(Double,Double)]+cos'n'sins = [ (cos a, sin a) | a <- angles ]++angles :: [Angle]+angles = take 40 [0, pi/20 .. ]++line p0 p1 = mkDraw (\ dc -> X.drawLine (disp dc) (drawable dc) (paintGC dc) x0 y0 x1 y1)+ where+ X.Point x0 y0 = fromPoint p0+ X.Point x1 y1 = fromPoint p1++polyline pts = mkDraw (\ dc -> X.drawLines (disp dc) (drawable dc) (paintGC dc) (map fromPoint pts) X.coordModeOrigin)+polygon pts = mkDraw (\ dc -> X.fillPolygon (disp dc) (drawable dc) (brushGC dc) (map fromPoint pts) X.complex X.coordModeOrigin)+polyBezier = unsafePerformIO $ do+ hPutStrLn stderr "warning: polyBezier is unavailable in X11 -- using polyline instead"+ return polyline++----------------------------------------------------------------+-- Utilities+----------------------------------------------------------------++-- delta is always +ve+minAndDelta :: Int -> Int -> (Int,Int)+minAndDelta a b + | a <= b = (a, b-a)+ | otherwise = (b, a-b)++-- avg :: Int32 -> Int32 -> Int32+avg :: Integral a => a -> a -> a+avg a b = (a + b) `div` 2++#else /* X_DISPLAY_MISSING */++arc p0 p1 start end = mkDraw (\ hdc -> Win32.arc hdc x0 y0 x1 y1 xs ys xe ye)+ where + (x0,y0) = fromPoint p0+ (x1,y1) = fromPoint p1+ x = (x0 + x1) `div` 2+ y = (y0 + y1) `div` 2+ start' = 2 * pi * start / 360+ end' = 2 * pi * end / 360+ xs = x + round (100 * cos start')+ ys = y + round (100 * sin start')+ xe = x + round (100 * cos end')+ ye = y + round (100 * sin end')++ellipse p0 p1 = mkDraw (\ hdc -> Win32.ellipse hdc x0 y0 x1 y1)+ where + (x0,y0) = fromPoint p0+ (x1,y1) = fromPoint p1++shearEllipse p0 p1 p2 = mkDraw (\ hdc -> + Win32.transformedEllipse hdc (fromPoint p0) (fromPoint p1) (fromPoint p2))++line p0 p1 = mkDraw (\ hdc -> Win32.moveToEx hdc x0 y0 >> Win32.lineTo hdc x1 y1)+ where + (x0,y0) = fromPoint p0+ (x1,y1) = fromPoint p1++polyline pts = mkDraw (\ hdc -> Win32.polyline hdc (map fromPoint pts))+polygon pts = mkDraw (\ hdc -> Win32.polygon hdc (map fromPoint pts))+polyBezier pts = mkDraw (\ hdc -> Win32.polyBezier hdc (map fromPoint pts))++#endif /* X_DISPLAY_MISSING */++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Draw/Region.hs view
@@ -0,0 +1,201 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Draw.Region+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- An efficient representation of sets of pixels.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++module Graphics.HGL.Draw.Region+ ( Region+#if !X_DISPLAY_MISSING+ , emptyRegion -- :: Region+#endif+ , rectangleRegion -- :: Point -> Point -> Region+ , ellipseRegion -- :: Point -> Point -> Region+ , polygonRegion -- :: [Point] -> Region+ , intersectRegion -- :: Region -> Region -> Region+ , unionRegion -- :: Region -> Region -> Region+ , subtractRegion -- :: Region -> Region -> Region+ , xorRegion -- :: Region -> Region -> Region+ , regionToGraphic -- :: Region -> Graphic+ ) where++import Graphics.HGL.Units (Point, Angle)+import Graphics.HGL.Draw.Monad (Graphic)+import Graphics.HGL.Internals.Draw (mkDraw)+#if !X_DISPLAY_MISSING+import Graphics.HGL.X11.Types (DC(..), fromPoint)+import qualified Graphics.X11.Xlib as X+#else+import Graphics.HGL.Win32.Types+import qualified Graphics.Win32 as Win32+#endif++import System.IO.Unsafe( unsafePerformIO )++----------------------------------------------------------------+-- The Interface (SOE, p136)+--+-- Note that Win32 does not include emptyRegion (SOE, p140).+-- The obvious Win32 implementation (an empty rectangle) could create problems+-- when you calculate the bounding box+-- (This could be fixed by implementing Empty Regions explicitly in Haskell+-- at the (small) cost of an extra test on every region operation.)+----------------------------------------------------------------++#if !X_DISPLAY_MISSING+newtype Region = MkRegion X.Region+#else+newtype Region = MkRegion Win32.HRGN+#endif++#if !X_DISPLAY_MISSING+-- | An empty region. This is not supported on Win32.+-- It is possible to use an empty rectangle region instead.+emptyRegion :: Region+#endif++-- | A rectangular region, with the given points as opposite corners.+rectangleRegion :: Point -> Point -> Region++-- | An elliptical region that fits in the rectangle with the given points+-- as opposite corners.+ellipseRegion :: Point -> Point -> Region++-- | A polygonal region defined by a list of 'Point's.+polygonRegion :: [Point] -> Region++-- | The intersection of two regions.+intersectRegion :: Region -> Region -> Region++-- | The union of two regions.+unionRegion :: Region -> Region -> Region++-- | The part of the first region that is not also in the second.+subtractRegion :: Region -> Region -> Region++-- | The symmetric difference of two regions.+xorRegion :: Region -> Region -> Region+ +-- | Fill a 'Region' using the current 'Graphics.HGL.Draw.Brush'.+regionToGraphic :: Region -> Graphic++----------------------------------------------------------------+-- The Implementation+----------------------------------------------------------------++#if !X_DISPLAY_MISSING++emptyXRegion = unsafePerformIO X.createRegion+emptyRegion = MkRegion emptyXRegion++rectangleRegion (x0,y0) (x1,y1) = + polygonRegion [(x0,y0),(x0,y1),(x1,y1),(x1,y0)]+ +ellipseRegion p0 p1 = MkRegion $ unsafePerformIO $ do+ X.polygonRegion pts X.evenOddRule+ where+ X.Point x0 y0 = fromPoint p0+ X.Point x1 y1 = fromPoint p1++ rx = (x1 - x0) `div` 2+ ry = (y1 - y0) `div` 2++ cx = x0 + rx + cy = y0 + ry++ rx' = fromIntegral rx+ ry' = fromIntegral ry++ pts = [ X.Point (cx + round (rx' * c)) (cy + round (ry' * s))+ | (c,s) <- cos'n'sins+ ]++cos'n'sins :: [(Double,Double)]+cos'n'sins = [ (cos a, sin a) | a <- angles ]++angles :: [Angle]+angles = take 40 [0, pi/20 .. ]+++polygonRegion pts = MkRegion $ unsafePerformIO $ do+ X.polygonRegion (map fromPoint pts) X.evenOddRule++intersectRegion = combine X.intersectRegion+unionRegion = combine X.unionRegion+subtractRegion = combine X.subtractRegion+xorRegion = combine X.xorRegion++type XRegionOp = X.Region -> X.Region -> X.Region -> IO Int++combine :: XRegionOp -> Region -> Region -> Region+combine op (MkRegion r1) (MkRegion r2) = unsafePerformIO $ do+ r <- X.createRegion+ op r1 r2 r+ return (MkRegion r)++regionToGraphic (MkRegion r) = mkDraw $ \ dc -> do+ X.setRegion (disp dc) (brushGC dc) r+ X.fillRectangle (disp dc) (drawable dc) (brushGC dc) 0 0 (-1) (-1) -- entire window (in 2s complement!)+ X.setRegion (disp dc) (brushGC dc) emptyXRegion+ return ()++#else /* X_DISPLAY_MISSING */++rectangleRegion pt0 pt1 = unsafePerformIO $ do+ r <- Win32.createRectRgn x0 y0 x1 y1+ return (MkRegion r)+ where+ (x0,y0) = fromPoint pt0+ (x1,y1) = fromPoint pt1++-- Sigh! createEllipticRgn raises an exception if either dimension+-- of the ellipse is empty. We hack around this by using rectangleRegion+-- in the problematic case (since createRectRgn behaves sensibly).+ellipseRegion pt0 pt1 + | x0 /= x1 && y0 /= y1+ = unsafePerformIO $ do+ r <- Win32.createEllipticRgn x0 y0 x1 y1+ return (MkRegion r)+ | otherwise+ = rectangleRegion pt0 pt1+ where+ (x0,y0) = fromPoint pt0+ (x1,y1) = fromPoint pt1++polygonRegion pts = unsafePerformIO $ do+ r <- Win32.createPolygonRgn (map fromPoint pts) Win32.wINDING+ return (MkRegion r)++-- combine :: Win32.ClippingMode -> Region -> Region -> Region -> IO ()+-- combine mode (MkRegion r1) (MkRegion r2) (MkRegion result) = do+-- Win32.combineRgn result r1 r2 mode+-- return ()++combine :: Win32.ClippingMode -> Region -> Region -> Region+combine mode (MkRegion r1) (MkRegion r2) = unsafePerformIO $ do+ r <- Win32.createRectRgn 0 0 0 0+ Win32.combineRgn r r1 r2 mode+ return (MkRegion r)++regionToGraphic (MkRegion r) = mkDraw (\hdc -> Win32.paintRgn hdc r)++intersectRegion = combine Win32.rGN_AND+unionRegion = combine Win32.rGN_OR+xorRegion = combine Win32.rGN_XOR+subtractRegion = combine Win32.rGN_DIFF++#endif /* X_DISPLAY_MISSING */++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Draw/Text.hs view
@@ -0,0 +1,247 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Draw.Text+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Drawing text.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++module Graphics.HGL.Draw.Text+ (+ -- * Drawing text+ text+ -- ToDo: add textInfo to Win32+#if !X_DISPLAY_MISSING+ , textInfo+#endif+ -- * Color+ , RGB(RGB)+ , setTextColor -- :: RGB -> Draw RGB+ , setBkColor -- :: RGB -> Draw RGB+ , BkMode(Opaque, Transparent)+ , setBkMode -- :: BkMode -> Draw BkMode+ -- * Alignment+ , Alignment -- = (HAlign, VAlign)+ , HAlign(Left', Center, Right')+ , VAlign(Top, Baseline, Bottom)+ , setTextAlignment -- :: Alignment -> Draw Alignment+ ) where++#if !X_DISPLAY_MISSING+import qualified Graphics.X11.Xlib as X+import Graphics.HGL.X11.Types+import Control.Concurrent.MVar (readMVar, takeMVar, putMVar)+#else+import qualified Graphics.Win32 as Win32+import Graphics.HGL.Win32.Types+import Data.Bits+#endif++import Graphics.HGL.Units (Point, Size)+import Graphics.HGL.Draw.Monad (Graphic, Draw)+import Graphics.HGL.Internals.Draw (mkDraw)+import Graphics.HGL.Internals.Types+ (RGB(..), BkMode(..), Alignment, HAlign(..), VAlign(..))++----------------------------------------------------------------+-- The Interface (SOE, p50)+----------------------------------------------------------------++-- | Render a 'String' positioned relative to the specified 'Point'.+text :: Point -> String -> Graphic -- filled++#if !X_DISPLAY_MISSING+-- | @'textInfo' s@ returns:+--+-- (1) The offset at which the string would be drawn according to the+-- current text alignment (e.g., @('Center', 'Baseline')@ will result+-- in an offset of (-width\/2,0))+--+-- (2) The size at which the text would be drawn using the current font.+--+textInfo :: String -> Draw (Point,Size)+#endif++-- | Set the foreground color for drawing text, returning the previous value.+setTextColor :: RGB -> Draw RGB++-- | Set the background color for drawing text, returning the previous value.+-- The background color is ignored when the mode is 'Transparent'.+setBkColor :: RGB -> Draw RGB++-- | Set the background mode for drawing text, returning the previous value.+setBkMode :: BkMode -> Draw BkMode++-- | Set the alignment for drawing text, returning the previous value.+setTextAlignment :: Alignment -> Draw Alignment++----------------------------------------------------------------+-- The Implementation+----------------------------------------------------------------++#if !X_DISPLAY_MISSING++text p s = mkDraw (\ dc -> do+ bs <- readMVar (ref_bits dc)+ let+ Font f = font bs+ (halign, valign) = textAlignment bs++ width = X.textWidth f s+ ascent = X.ascentFromFontStruct f+ descent = X.descentFromFontStruct f++ x' = case halign of+ Left' -> x+ Center -> x - width `div` 2+ Right' -> x - width + 1+ y' = case valign of+ Top -> y + ascent+ Baseline -> y+ Bottom -> y - descent + 1++ draw (bkMode bs) (disp dc) (drawable dc) (textGC dc) x' y' s+ )+ where+ X.Point x y = fromPoint p++ -- Win32's DeviceContext has a BkMode in it. In X, we call two different+ -- routines depending on what mode we want.+ draw Transparent = X.drawString+ draw Opaque = X.drawImageString++textInfo s = mkDraw $ \ dc -> do+ bs <- readMVar (ref_bits dc)+ let+ Font f = font bs+ (halign, valign) = textAlignment bs++ width = X.textWidth f s+ ascent = X.ascentFromFontStruct f+ descent = X.descentFromFontStruct f++ x1 = case halign of+ Left' -> 0+ Center -> - width `div` 2+ Right' -> - width + 1+ y1 = case valign of+ Top -> ascent+ Baseline -> 0+ Bottom -> - descent + 1++ x2 = x1 + width+ y2 = y1 + ascent + descent++ (x1',x2') = (min x1 x2, max x1 x2)+ (y1',y2') = (min y1 y2, max y1 y2)++ return (toPoint (X.Point x1 y1), toSize (fromIntegral (x2'-x1'), fromIntegral (y2'-y1')))++setTextColor x = mkDraw $ \ dc -> do+ bs <- takeMVar (ref_bits dc)+ putMVar (ref_bits dc) bs{textColor=x}+ p <- lookupColor (disp dc) x+ X.setForeground (disp dc) (textGC dc) p+ return (textColor bs)++setBkColor x = mkDraw $ \ dc -> do+ bs <- takeMVar (ref_bits dc)+ putMVar (ref_bits dc) bs{bkColor=x}+ p <- lookupColor (disp dc) x+ X.setBackground (disp dc) (textGC dc) p+ return (bkColor bs)++setBkMode x = mkDraw $ \ dc -> do+ bs <- takeMVar (ref_bits dc)+ putMVar (ref_bits dc) bs{bkMode=x}+ return (bkMode bs)++setTextAlignment x = mkDraw $ \ dc -> do+ bs <- takeMVar (ref_bits dc)+ putMVar (ref_bits dc) bs{textAlignment=x}+ return (textAlignment bs)++#else /* X_DISPLAY_MISSING */++type TextAlignment = Win32.TextAlignment++fromAlignment :: Alignment -> TextAlignment+fromAlignment (ha,va) = hAlign ha .|. vAlign va++hAlign :: HAlign -> TextAlignment+hAlign Left' = Win32.tA_LEFT +hAlign Center = Win32.tA_CENTER +hAlign Right' = Win32.tA_RIGHT + +vAlign :: VAlign -> TextAlignment+vAlign Top = Win32.tA_TOP +vAlign Baseline = Win32.tA_BASELINE +vAlign Bottom = Win32.tA_BOTTOM ++toAlignment :: TextAlignment -> Alignment+toAlignment x = (toHAlign (x .&. hmask), toVAlign (x .&. vmask))++toHAlign x+ | x == Win32.tA_LEFT = Left'+ | x == Win32.tA_CENTER = Center+ | x == Win32.tA_RIGHT = Right'+ | otherwise = Center -- safe(?) default++toVAlign x+ | x == Win32.tA_TOP = Top+ | x == Win32.tA_BASELINE = Baseline+ | x == Win32.tA_BOTTOM = Bottom+ | otherwise = Baseline -- safe(?) default++-- Win32 doesn't seem to provide the masks I need - these ought to work.+hmask = Win32.tA_LEFT .|. Win32.tA_CENTER .|. Win32.tA_RIGHT +vmask = Win32.tA_TOP .|. Win32.tA_BASELINE .|. Win32.tA_BOTTOM++fromBkMode :: BkMode -> Win32.BackgroundMode+fromBkMode Opaque = Win32.oPAQUE+fromBkMode Transparent = Win32.tRANSPARENT++toBkMode :: Win32.BackgroundMode -> BkMode+toBkMode x+ | x == Win32.oPAQUE = Opaque+ | x == Win32.tRANSPARENT = Transparent++-- ToDo: add an update mode for these constants+-- (not required at the moment since we always specify exactly where+-- the text is to go)+-- tA_NOUPDATECP :: TextAlignment+-- tA_UPDATECP :: TextAlignment++text (x,y) s = mkDraw $ \ hdc -> + Win32.textOut hdc (fromDimension x) (fromDimension y) s++setTextColor c = mkDraw (\hdc -> do+ c' <- Win32.setTextColor hdc (fromRGB c)+ return (toRGB c'))+ +setBkColor c = mkDraw (\hdc -> do+ c' <- Win32.setBkColor hdc (fromRGB c)+ return (toRGB c'))+ +setBkMode m = mkDraw (\hdc -> do+ m' <- Win32.setBkMode hdc (fromBkMode m)+ return (toBkMode m'))+ +setTextAlignment new_alignment = mkDraw (\hdc -> do+ old <- Win32.setTextAlign hdc (fromAlignment new_alignment)+ return (toAlignment old)+ )++#endif /* X_DISPLAY_MISSING */++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Internals/Draw.hs view
@@ -0,0 +1,93 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Internals.Draw+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : non-portable (requires concurrency)+--+-- Drawing in a simple graphics library.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++-- #hide+module Graphics.HGL.Internals.Draw+ ( Graphic -- = Draw ()+ , Draw+ , ioToDraw -- :: IO a -> Draw a++ , bracket -- :: Draw a -> (a -> Draw b) -> (a -> Draw c) -> Draw c+ , bracket_ -- :: Draw a -> (a -> Draw b) -> Draw c -> Draw c++ , unDraw -- :: Draw a -> (DC -> IO a)+ , mkDraw -- :: (DC -> IO a) -> Draw a+ ) where++#if !X_DISPLAY_MISSING+import Graphics.HGL.X11.Types(DC)+#else+import Graphics.HGL.Win32.Types(DC)+#endif+import qualified Graphics.HGL.Internals.Utilities as Utils (bracket, bracket_)+import Control.Monad (liftM)++----------------------------------------------------------------+-- Graphics+----------------------------------------------------------------++-- | An abstract representation of an image.+type Graphic = Draw ()++-- | Monad for sequential construction of images.+newtype Draw a = MkDraw (DC -> IO a)++unDraw :: Draw a -> (DC -> IO a)+unDraw (MkDraw m) = m++-- | Embed an 'IO' action in a drawing action.+ioToDraw :: IO a -> Draw a+ioToDraw m = MkDraw (\ _ -> m)++mkDraw :: (DC -> IO a) -> Draw a+mkDraw = MkDraw++-- a standard reader monad+instance Monad Draw where+ return a = MkDraw (\ hdc -> return a)+ m >>= k = MkDraw (\ hdc -> do { a <- unDraw m hdc; unDraw (k a) hdc })+ m >> k = MkDraw (\ dc -> do { unDraw m dc; unDraw k dc })++instance Functor Draw where fmap = liftM++-- | Wrap a drawing action in initialization and finalization actions.+bracket+ :: Draw a -- ^ a pre-operation, whose value is passed to the+ -- other two components.+ -> (a -> Draw b) -- ^ a post-operation, to be performed on exit from+ -- the bracket, whether normal or by an exception.+ -> (a -> Draw c) -- ^ the drawing action inside the bracket.+ -> Draw c+bracket left right m = MkDraw (\ hdc ->+ Utils.bracket (unDraw left hdc) + (\ a -> unDraw (right a) hdc)+ (\ a -> unDraw (m a) hdc))++-- | A variant of 'bracket' in which the inner drawing action does not+-- use the result of the pre-operation.+bracket_+ :: Draw a -- ^ a pre-operation, whose value is passed to the+ -- other two components.+ -> (a -> Draw b) -- ^ a post-operation, to be performed on exit from+ -- the bracket, whether normal or by an exception.+ -> Draw c -- ^ the drawing action inside the bracket.+ -> Draw c+bracket_ left right m = MkDraw (\ hdc ->+ Utils.bracket_ (unDraw left hdc) + (\ a -> unDraw (right a) hdc)+ (unDraw m hdc))++----------------------------------------------------------------
+ Graphics/HGL/Internals/Event.hs view
@@ -0,0 +1,83 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Internals.Event+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : non-portable (requires concurrency)+--+-- Events in a simple graphics library.+--+-----------------------------------------------------------------------------++-- #hide+module Graphics.HGL.Internals.Event+ ( Event(..)+ -- , Event(Char,Key,Button,MouseMove,Resize,Closed) -- deriving(Show)+ -- , char -- :: Event -> Char+ -- , keysym -- :: Event -> Key+ -- , isDown -- :: Event -> Bool+ -- , pt -- :: Event -> Point+ -- , isLeft -- :: Event -> Bool+ ) where++import Graphics.HGL.Key (Key)+import Graphics.HGL.Internals.Types (Point)++-- We probably need a lot more info about the event +-- but this will do for now.++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++-- Note: The Char event is for delivering properly translated characters+-- after a key*press*. At least under X, a single key press might yield+-- 0, 1 or more characters after translation (see X[mb]LookupString).+-- The Key event is intended for reporting key up/down events of+-- *abstract* keys, i.e. KeySyms rather than KeyCodes in X terms.+-- To make it possible to report such events for arrow keys, function+-- keys and the like, the Char field needs to be replaced by a field of+-- a type somewhat isomorphic to KeySym, but valid under Windows too.++-- | A user interface event.+--+-- Notes:+--+-- * Programmers should assume that the 'Event' datatype will be+-- extended in the not-too-distant future and that individual events+-- may change slightly. As a minimum, you should add a \"match anything\"+-- alternative to any function which pattern matches against 'Event's.+--+-- * X11 systems typically have three button mice. Button 1 is used as the+-- left button, button 3 as the right button and button 2 (the middle+-- button) is ignored.++data Event + = Char+ { char :: Char -- ^ the character represented by a key combination+ } -- ^ a properly translated character, sent after+ -- a key press.+ | Key+ { keysym :: Key -- ^ representation of the keyboard keys pressed+ , isDown :: Bool -- ^ if 'True', the key was pressed;+ -- otherwise it was released+ } -- ^ occurs when a key was pressed or released.+ | Button+ { pt :: Point -- ^ the position of the mouse cursor+ , isLeft :: Bool -- ^ if 'True', it was the left button+ , isDown :: Bool -- ^ if 'True', the button was pressed;+ -- otherwise it was released+ } -- ^ occurs when a mouse button is pressed or released.+ | MouseMove+ { pt :: Point -- ^ the position of the mouse cursor after the movement+ } -- ^ occurs when the mouse is moved inside the window.+ | Resize -- ^ occurs when the window is resized.+ | Closed -- ^ occurs when the window is closed.+ deriving Show ++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Internals/Events.hs view
@@ -0,0 +1,68 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Internals.Events+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : non-portable (requires concurrency)+--+-- A simple graphics library.+--+-----------------------------------------------------------------------------++-- #hide+module Graphics.HGL.Internals.Events(+ Events, newEvents, getEvent, sendEvent, isNoEvent,+ getTick, sendTick+ ) where++import Graphics.HGL.Internals.Event+import Graphics.HGL.Internals.Flag+import Control.Concurrent.Chan(Chan, newChan, readChan, writeChan, isEmptyChan)++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++-- Events are more or less just a channel (~list) of events+--+-- The only subtlety is that ticks are not part of the channel:+-- they're a separate "flag" so that ticks don't accumulate in the +-- queue (if you process them too fast) and so that ticks can +-- "overtake" other events.+-- (Win32 timers do the same thing. I was rather surprised to find+-- myself reimplementing this in Haskell (even in the Win32 version+-- of the Graphics library). Exposure events in X11 behave in a+-- similar way except that they do not overtake other events.)++data Events = Events { events :: Chan Event+ , tick :: Flag ()+ }++newEvents :: IO Events+getEvent :: Events -> IO Event+isNoEvent :: Events -> IO Bool+sendEvent :: Events -> Event -> IO ()+sendTick :: Events -> IO ()+getTick :: Events -> IO ()++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++newEvents = do+ events <- newChan + tick <- newFlag+ return (Events { events=events, tick=tick })++getEvent evs = readChan (events evs)+isNoEvent evs = isEmptyChan (events evs)+sendEvent evs = writeChan (events evs)+sendTick evs = setFlag (tick evs) ()+getTick evs = resetFlag (tick evs)++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Internals/Flag.hs view
@@ -0,0 +1,60 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Internals.Flag+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : non-portable (requires concurrency)+--+-- A simple graphics library.+--+-----------------------------------------------------------------------------++-- #hide+module Graphics.HGL.Internals.Flag+ ( Flag, newFlag, setFlag, resetFlag+ ) where++import Control.Concurrent.MVar+ ( MVar, newEmptyMVar, newMVar, takeMVar, putMVar+ )++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++-- We maintain a list of blocked processes.+-- Blocked processes are "stored" in MVars; the outer MVar+-- is used to implement a critical section.+newtype Flag a = Flag (MVar [MVar a])++newFlag :: IO (Flag a)+-- sets the flag, never blocks, never fails+setFlag :: Flag a -> a -> IO ()+-- block until the flag is set (and reset it)+resetFlag :: Flag a -> IO a++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++newFlag = do+ queue <- newMVar []+ return (Flag queue)++setFlag (Flag queue) a = do+ ps <- takeMVar queue+ mapM_ (\ p -> putMVar p a) ps+ putMVar queue []++resetFlag (Flag queue) = do+ ps <- takeMVar queue+ p <- newEmptyMVar + putMVar queue (p:ps)+ takeMVar p -- block++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Internals/Types.hs view
@@ -0,0 +1,110 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Internals.Types+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : portable+--+-- Basic types for a simple graphics library.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++-- #hide+module Graphics.HGL.Internals.Types where++#if !X_DISPLAY_MISSING+import qualified Graphics.X11.Xlib as X+#else+import Graphics.Win32.Misc(timeGetTime)+import Control.Monad( liftM )+#endif++import Data.Ix(Ix)+import Data.Word(Word8)++----------------------------------------------------------------+-- Units+----------------------------------------------------------------++-- | A distance on the screen, measured in pixels.+type Dimension = Int+-- | A position within a window, measured in pixels to the right and down+-- from the top left corner.+type Point = (Int,Int)+-- | A (width, height) pair, both measured in pixels.+type Size = (Int,Int)+-- | An angle in degrees (0 to 360).+type Angle = Double++-- | Time, measured in milliseconds.+type Time = Integer++-- | Time in milliseconds since some arbitrary epoch.+getTime :: IO Integer+#if !X_DISPLAY_MISSING+getTime = X.gettimeofday_in_milliseconds+#else+getTime = liftM toInteger timeGetTime+#endif++---------------------------------------------------------------+-- Drawing+----------------------------------------------------------------++-- | A color, comprising red, green and blue components.+data RGB = RGB Word8 Word8 Word8++-- | The style of line drawn by a pen.+data Style+ = Solid + | Dash -- "-------"+ | Dot -- "......."+ | DashDot -- "_._._._"+ | DashDotDot -- "_.._.._"+ | Null+ | InsideFrame++-- | Background mode for drawing text.+data BkMode+ = Opaque -- ^ Draw text on a bounding rectangle filled with the+ -- current background color.+ | Transparent -- ^ Draw text without a background rectangle.++-- | How strings drawn with 'Graphics.HGL.Draw.Text.text' are positioned+-- relative to the specified reference point.+type Alignment = (HAlign, VAlign)++-- | Horizontal alignment of text.+-- Names have a tick to distinguish them from "Prelude" names.+data HAlign+ = Left' -- ^ align the left edge of the text with the reference point+ | Center -- ^ center the text with the reference point+ | Right' -- ^ align the right edge of the text with the reference point+ deriving (Enum, Eq, Ord, Ix, Show)++-- | Vertical alignment of text.+data VAlign+ = Top -- ^ align the top edge of the text with the reference point+ | Baseline -- ^ align the baseline of the text with the reference point+ | Bottom -- ^ align the bottom edge of the text with the reference point+ deriving (Enum, Eq, Ord, Ix, Show)++---------------------------------------------------------------+-- Windows+----------------------------------------------------------------++-- | Title of a window.+type Title = String++-- | How to draw in a window.+data RedrawMode+ = DoubleBuffered -- ^ use a /double buffer/ to reduce flicker.+ -- You should probably use this for animations.+ | Unbuffered -- ^ draw directly to the window.+ -- This runs slightly faster but is more prone+ -- to flicker.
+ Graphics/HGL/Internals/Utilities.hs view
@@ -0,0 +1,49 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Internals.Utilities+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : non-portable (requires concurrency)+--+-- A simple graphics library.+--+-----------------------------------------------------------------------------++-- #hide+module Graphics.HGL.Internals.Utilities(+ bracket, bracket_,+ safeTry,+ E.Exception,+ modMVar, modMVar_+ ) where++import qualified Control.Exception as E (bracket, try, Exception)+import Control.Concurrent( MVar, takeMVar, putMVar )++bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c+bracket = E.bracket++-- Not exactly the same type as GHC's bracket_+bracket_ :: IO a -> (a -> IO b) -> IO c -> IO c+bracket_ left right m = bracket left right (const m)++safeTry :: IO a -> IO (Either E.Exception a)+safeTry = E.try++----------------------------------------------------------------+-- Utilities+----------------------------------------------------------------++modMVar :: MVar a -> (a -> a) -> IO a+modMVar mv f = do+ x <- takeMVar mv+ putMVar mv (f x)+ return x++modMVar_ :: MVar a -> (a -> a) -> IO ()+modMVar_ mv f = do+ x <- takeMVar mv+ putMVar mv (f x)
+ Graphics/HGL/Key.hs view
@@ -0,0 +1,214 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Key+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : portable+--+-- Abstract representation of keys.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++module Graphics.HGL.Key+ ( Key -- Abstract!+ , keyToChar -- :: Key -> Char+ , isCharKey -- :: Key -> Bool+ , isBackSpaceKey -- :: Key -> Bool+ , isTabKey -- :: Key -> Bool+ -- , isLineFeedKey -- :: Key -> Bool+ , isClearKey -- :: Key -> Bool+ , isReturnKey -- :: Key -> Bool+ , isEscapeKey -- :: Key -> Bool+ , isDeleteKey -- :: Key -> Bool+ -- , isMultiKeyKey -- :: Key -> Bool+ , isHomeKey -- :: Key -> Bool+ , isLeftKey -- :: Key -> Bool+ , isUpKey -- :: Key -> Bool+ , isRightKey -- :: Key -> Bool+ , isDownKey -- :: Key -> Bool+ , isPriorKey -- :: Key -> Bool+ , isPageUpKey -- :: Key -> Bool+ , isNextKey -- :: Key -> Bool+ , isPageDownKey -- :: Key -> Bool+ , isEndKey -- :: Key -> Bool+ -- , isBeginKey -- :: Key -> Bool+ , isShiftLKey -- :: Key -> Bool+ , isShiftRKey -- :: Key -> Bool+ , isControlLKey -- :: Key -> Bool+ , isControlRKey -- :: Key -> Bool+ -- , isCapsLockKey -- :: Key -> Bool+ -- , isShiftLockKey -- :: Key -> Bool+ -- , isMetaLKey -- :: Key -> Bool+ -- , isMetaRKey -- :: Key -> Bool+ -- , isAltLKey -- :: Key -> Bool+ -- , isAltRKey -- :: Key -> Bool+ ) where++import Data.Maybe (isJust)++#if !X_DISPLAY_MISSING+import Graphics.HGL.X11.Types(Key(MkKey))+import Graphics.X11.Xlib+#else+import Graphics.HGL.Win32.Types(Key(MkKey))+import Graphics.Win32+#endif++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++-- | Converts a character key to a character.+keyToChar :: Key -> Char +isCharKey :: Key -> Bool -- Is it a "real" character?+isBackSpaceKey :: Key -> Bool+isTabKey :: Key -> Bool+--isLineFeedKey :: Key -> Bool+isClearKey :: Key -> Bool+isReturnKey :: Key -> Bool+isEscapeKey :: Key -> Bool+isDeleteKey :: Key -> Bool+--isMultiKeyKey :: Key -> Bool -- Multi-key character compose.+isHomeKey :: Key -> Bool -- Cursor home.+isLeftKey :: Key -> Bool -- Cursor left, left arrow.+isUpKey :: Key -> Bool -- Cursor up, up arrow.+isRightKey :: Key -> Bool -- Cursor right, right arrow.+isDownKey :: Key -> Bool -- Cursor down, down arrow.+isPriorKey :: Key -> Bool -- Prior, previous page. Same as page up.+isPageUpKey :: Key -> Bool -- Page up, previous page. Same as prior.+isNextKey :: Key -> Bool -- Next, next page. Same as page down.+isPageDownKey :: Key -> Bool -- Page down, next page. Same as next.+isEndKey :: Key -> Bool -- End of line.+--isBeginKey :: Key -> Bool -- Beginning of line.+isShiftLKey :: Key -> Bool -- Left shift.+isShiftRKey :: Key -> Bool -- Right shift.+isControlLKey :: Key -> Bool -- Left control.+isControlRKey :: Key -> Bool -- Right control.+--isCapsLockKey :: Key -> Bool -- Caps lock.+--isShiftLockKey :: Key -> Bool -- Shift lock.+--isMetaLKey :: Key -> Bool -- Left meta.+--isMetaRKey :: Key -> Bool -- Right meta.+--isAltLKey :: Key -> Bool -- Left alt.+--isAltRKey :: Key -> Bool -- Right alt.++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++keyToChar (MkKey ks) =+ case (keySymToChar ks) of+ Just c -> c+ Nothing -> error "keyToChar: Not a character key!"++isCharKey (MkKey ks) = isJust (keySymToChar ks)++#if !X_DISPLAY_MISSING++-- Converts an X KeySym representing an ISO 8859-1 (Latin 1) character or one+-- of a few control characters to a Char.+-- Note! It is assumed that the KeySym encoding for Latin 1 characters agrees+-- with the Haskell character encoding!+keySymToChar :: KeySym -> Maybe Char+keySymToChar ks+ | xK_space <= ks && ks <= xK_ydiaeresis = Just (toEnum (fromIntegral ks))+ | ks == xK_BackSpace = Just '\BS'+ | ks == xK_Tab = Just '\HT'+ | ks == xK_Linefeed = Just '\LF'+ | ks == xK_Clear = Just '\FF'+ | ks == xK_Return = Just '\CR'+ | ks == xK_Escape = Just '\ESC'+ | ks == xK_Delete = Just '\DEL'+ | otherwise = Nothing ++isBackSpaceKey (MkKey ks) = ks == xK_BackSpace+isTabKey (MkKey ks) = ks == xK_Tab+--isLineFeedKey (MkKey ks) = ks == xK_Linefeed+isClearKey (MkKey ks) = ks == xK_Clear+isReturnKey (MkKey ks) = ks == xK_Return+isEscapeKey (MkKey ks) = ks == xK_Escape+isDeleteKey (MkKey ks) = ks == xK_Delete+--isMultiKeyKey (MkKey ks) = ks == xK_Multi_key+isHomeKey (MkKey ks) = ks == xK_Home+isLeftKey (MkKey ks) = ks == xK_Left+isUpKey (MkKey ks) = ks == xK_Up+isRightKey (MkKey ks) = ks == xK_Right+isDownKey (MkKey ks) = ks == xK_Down+isPriorKey (MkKey ks) = ks == xK_Prior+isPageUpKey (MkKey ks) = ks == xK_Page_Up+isNextKey (MkKey ks) = ks == xK_Next+isPageDownKey (MkKey ks) = ks == xK_Page_Down+isEndKey (MkKey ks) = ks == xK_End+--isBeginKey (MkKey ks) = ks == xK_Begin+isShiftLKey (MkKey ks) = ks == xK_Shift_L+isShiftRKey (MkKey ks) = ks == xK_Shift_R+isControlLKey (MkKey ks) = ks == xK_Control_L+isControlRKey (MkKey ks) = ks == xK_Control_R+--isCapsLockKey (MkKey ks) = ks == xK_Caps_Lock+--isShiftLockKey (MkKey ks) = ks == xK_Shift_Lock+--isMetaLKey (MkKey ks) = ks == xK_Meta_L+--isMetaRKey (MkKey ks) = ks == xK_Meta_R+--isAltLKey (MkKey ks) = ks == xK_Alt_L+--isAltRKey (MkKey ks) = ks == xK_Alt_R++#else /* X_DISPLAY_MISSING */++-- Converts a VKey representing an ISO 8859-1 (Latin 1) character or one+-- of a few control characters to a Char.+-- Note! It is assumed that the VKey encoding for Latin 1 characters agrees+-- with the Haskell character encoding!+keySymToChar :: VKey -> Maybe Char+keySymToChar ks+ | space <= ks && ks <= ydiaresis = Just (toEnum (fromIntegral ks))+ | ks == vK_BACK = Just '\BS'+ | ks == vK_TAB = Just '\HT'+-- | ks == vK_LINEFEED = Just '\LF'+ | ks == vK_CLEAR = Just '\FF'+ | ks == vK_RETURN = Just '\CR'+ | ks == vK_ESCAPE = Just '\ESC'+ | ks == vK_DELETE = Just '\DEL'+ | otherwise = Nothing + where+ space, ydiaresis :: VKey+ space = fromIntegral (fromEnum ' ')+ ydiaresis = fromIntegral 255 -- is this right?++isBackSpaceKey (MkKey ks) = ks == vK_BACK+isTabKey (MkKey ks) = ks == vK_TAB+--isLineFeedKey (MkKey ks) = ks == vK_LINEFEED+isClearKey (MkKey ks) = ks == vK_CLEAR+isReturnKey (MkKey ks) = ks == vK_RETURN+isEscapeKey (MkKey ks) = ks == vK_ESCAPE+isDeleteKey (MkKey ks) = ks == vK_DELETE+--isMultiKeyKey (MkKey ks) = ks == vK_MULTI_KEY+isHomeKey (MkKey ks) = ks == vK_HOME+isLeftKey (MkKey ks) = ks == vK_LEFT+isUpKey (MkKey ks) = ks == vK_UP+isRightKey (MkKey ks) = ks == vK_RIGHT+isDownKey (MkKey ks) = ks == vK_DOWN+isPriorKey (MkKey ks) = ks == vK_PRIOR+isPageUpKey (MkKey ks) = ks == vK_PRIOR -- same as isPriorKey+isNextKey (MkKey ks) = ks == vK_NEXT+isPageDownKey (MkKey ks) = ks == vK_NEXT -- same as isNextKey+isEndKey (MkKey ks) = ks == vK_END+--isBeginKey (MkKey ks) = ks == vK_Begin+isShiftLKey (MkKey ks) = ks == vK_SHIFT -- can't distinguish left and right+isShiftRKey (MkKey ks) = ks == vK_SHIFT+isControlLKey (MkKey ks) = ks == vK_CONTROL -- ambidextrous+isControlRKey (MkKey ks) = ks == vK_CONTROL+--isCapsLockKey (MkKey ks) = ks == vK_Caps_Lock+--isShiftLockKey (MkKey ks) = ks == vK_Shift_Lock+--isMetaLKey (MkKey ks) = ks == vK_Meta_L+--isMetaRKey (MkKey ks) = ks == vK_Meta_R+--isAltLKey (MkKey ks) = ks == vK_Alt_L+--isAltRKey (MkKey ks) = ks == vK_Alt_R++#endif /* X_DISPLAY_MISSING */++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Run.hs view
@@ -0,0 +1,70 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Run+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Running graphical actions.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++module Graphics.HGL.Run+ ( runGraphics -- :: IO () -> IO ()+ ) where++#if !X_DISPLAY_MISSING+import Graphics.HGL.X11.Display (getDisplayName)+import Graphics.HGL.X11.Window (runGraphicsEx)+#else+import Graphics.HGL.Win32.WND (handleEvents, beginGraphics, endGraphics)+import Graphics.HGL.Internals.Utilities (safeTry)+import Control.Concurrent (forkIO, yield)+import Data.IORef( newIORef, readIORef, writeIORef )+import System.IO.Error (try)+#endif++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++-- | Initialize the system to do graphics, run an action while collecting+-- user interface events and forwarding them to the action, and then clean+-- up everything else at the end.+-- The other functions of the library may only be used inside 'runGraphics'.+runGraphics :: IO () -> IO () -- SOE, p48++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++#if !X_DISPLAY_MISSING++runGraphics m = do+ disp <- getDisplayName+ runGraphicsEx disp m++#else /* X_DISPLAY_MISSING */++-- We took a lot of effort to make sure that we always close the+-- windows - even if "m" fails.+--+-- Note though that we use "try" instead of "safeTry" on the call to+-- "m" because it is quite normal for "m" to block (and safeTry treats+-- blocking as failure).++runGraphics m = do+ beginGraphics+ quit <- newIORef False+ safeTry $ do+ forkIO (try m >> writeIORef quit True)+ yield+ handleEvents (readIORef quit)+ endGraphics++#endif /* X_DISPLAY_MISSING */
+ Graphics/HGL/Units.hs view
@@ -0,0 +1,22 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Units+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : portable+--+-- Types for units in a simple graphics library.+--+-----------------------------------------------------------------------------++module Graphics.HGL.Units+ ( Point+ , Size+ , Angle+ , Time+ ) where++import Graphics.HGL.Internals.Types
+ Graphics/HGL/Utils.hs view
@@ -0,0 +1,294 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Utils+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Utility functions for a simple graphics library.+--+-----------------------------------------------------------------------------++module Graphics.HGL.Utils+ (+ -- * Windows+ openWindow -- :: Title -> Size -> IO Window+ , clearWindow -- :: Window -> IO ()+ , drawInWindow -- :: Window -> Graphic -> IO ()+ , withWindow -- :: Title -> Size -> (Window -> IO a) -> IO a+ , withWindow_ -- :: Title -> Size -> (Window -> IO a) -> IO ()+ , runWindow -- :: Title -> Size -> (Window -> IO a) -> IO ()+ , getWindowSize -- :: Window -> IO Size+ -- * Specific events+ -- ** Mouse events+ , getLBP -- :: Window -> IO Point+ , getRBP -- :: Window -> IO Point+ , getButton -- :: Window -> Bool -> Bool -> IO Point+ -- ** Keyboard events+ , getKey -- :: Window -> IO Key+ , getKeyEx -- :: Window -> Bool -> IO Key+ , wGetChar -- :: Window -> IO Char+ -- * Graphics+ -- ** Combining Graphics+ , emptyGraphic -- :: Graphic+ , overGraphic -- :: Graphic -> Graphic -> Graphic+ , overGraphics -- :: [Graphic] -> Graphic+ -- ** Graphic modifiers+ , withFont -- :: Font -> Graphic -> Graphic+ , withTextColor -- :: RGB -> Graphic -> Graphic+ , withTextAlignment -- :: Alignment -> Graphic -> Graphic+ , withBkColor -- :: RGB -> Graphic -> Graphic+ , withBkMode -- :: BkMode -> Graphic -> Graphic+ , withPen -- :: Pen -> Graphic -> Graphic+ , withBrush -- :: Brush -> Graphic -> Graphic+ , withRGB -- :: RGB -> Graphic -> Graphic+ -- * Named colors+ , Color(..)+ , colorList -- :: [(Color, RGB)]+ , colorTable -- :: Array Color RGB+ , withColor -- :: Color -> Graphic -> Graphic+ -- * Concurrency+ , par -- :: IO a -> IO b -> IO (a, b)+ , par_ -- :: IO a -> IO b -> IO ()+ , parMany -- :: [IO ()] -> IO ()++ ) where++import Graphics.HGL.Core+import Control.Concurrent+ ( newEmptyMVar, takeMVar, putMVar+ , forkIO+ )+import qualified Control.Exception as E+import Data.Ix(Ix)+import Data.Array(Array,array,(!))++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++-- | Create a window with the given title and size.+openWindow :: Title -> Size -> IO Window+-- | Erase all drawing in the window.+-- (That is, set the 'Graphic' held by the window to 'emptyGraphic'.)+clearWindow :: Window -> IO ()+-- | Draw the given graphic on the window, on top of anything that is+-- already there.+-- (That is, combine the given 'Graphic' and the one held by the window+-- using 'overGraphic', store the result in the window, and display it.)+drawInWindow :: Window -> Graphic -> IO ()+-- | Run an action inside a new window, ensuring that the window is destroyed+-- on exit.+withWindow :: Title -> Size -> (Window -> IO a) -> IO a+-- | A variant of 'withWindow' that ignores the result of the action.+withWindow_ :: Title -> Size -> (Window -> IO a) -> IO ()+-- | A combination of 'runGraphics' and 'withWindow_'.+runWindow :: Title -> Size -> (Window -> IO a) -> IO ()++-- | The current size of the window.+getWindowSize :: Window -> IO Size+-- | Wait for a press of the left mouse button,+-- and return the position of the mouse cursor.+getLBP :: Window -> IO Point+-- | Wait for a press of the right mouse button,+-- and return the position of the mouse cursor.+getRBP :: Window -> IO Point+-- | Wait for a mouse button to be pressed or released,+-- and return the position of the mouse cursor.+getButton :: Window+ -> Bool -- ^ if 'True', wait for the left button+ -> Bool -- ^ if 'True', wait for a press;+ -- otherwise wait for a release.+ -> IO Point+-- | Wait until a key is pressed and released.+getKey :: Window -> IO Key+-- | Wait until a key is pressed (if the second argument is 'True')+-- or released (otherwise).+getKeyEx :: Window -> Bool -> IO Key+-- | Wait for a translated character (from a key press).+-- Use in preference to 'getKey' if the aim is to read text.+wGetChar :: Window -> IO Char++-- | An empty drawing.+emptyGraphic :: Graphic+-- | A composite drawing made by overlaying the first argument on the second.+overGraphic :: Graphic -> Graphic -> Graphic+-- | Overlay a list of drawings.+overGraphics :: [Graphic] -> Graphic++-- | Set the default font for a drawing.+withFont :: Font -> Graphic -> Graphic+-- | Set the default color for drawing text.+withTextColor :: RGB -> Graphic -> Graphic+-- | Set the default alignment of text in a drawing.+withTextAlignment :: Alignment -> Graphic -> Graphic+-- | Set the default background color for drawing text with background+-- mode 'Opaque'. The background color is ignored when the mode is+-- 'Transparent'.+withBkColor :: RGB -> Graphic -> Graphic+-- | Set the default background mode for drawing text.+withBkMode :: BkMode -> Graphic -> Graphic+-- | Set the default pen for drawing lines.+withPen :: Pen -> Graphic -> Graphic+-- | Set the default brush for filling shapes.+withBrush :: Brush -> Graphic -> Graphic+-- | A convenience function that sets the brush,+-- pen and text colors to the same value.+withRGB :: RGB -> Graphic -> Graphic++-- | Named colors.+data Color + = Black+ | Blue+ | Green + | Cyan+ | Red + | Magenta+ | Yellow+ | White+ deriving (Eq, Ord, Bounded, Enum, Ix, Show, Read)++-- | A mapping of 'Color' names to 'RGB' triples.+colorList :: [(Color, RGB)]+-- | A mapping of 'Color' names to 'RGB' triples.+colorTable :: Array Color RGB+-- | Set the default drawing color for a 'Graphic'.+withColor :: Color -> Graphic -> Graphic++-- | Run two 'IO' actions in parallel and terminate when both actions terminate.+par :: IO a -> IO b -> IO (a,b)+-- | Run two 'IO' actions in parallel and terminate when both actions terminate,+-- discarding the results of the actions.+par_ :: IO a -> IO b -> IO ()+-- | Run several 'IO' actions in parallel and terminate when all actions+-- terminate, discarding the results of the actions.+parMany :: [IO ()] -> IO ()++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++-- Window operations++openWindow name size = openWindowEx name Nothing size Unbuffered Nothing++clearWindow w = setGraphic w emptyGraphic++getWindowSize w = do+ (pt,sz) <- getWindowRect w+ return sz++drawInWindow w p = do+ modGraphic w (p `overGraphic`)+ directDraw w p++withWindow name size = E.bracket (openWindow name size) closeWindow+withWindow_ name size f = withWindow name size f >> return ()+runWindow name size f = runGraphics (withWindow_ name size f)++-- Event operations++-- wait for left/right mouse button up (SOE p148)+getLBP w = getButton w True True+getRBP w = getButton w False True++-- Wait for a key to go down then a (possibly different) key to go up+getKey w = do { getKeyEx w True; getKeyEx w False }++-- wait for key to go down/up+getKeyEx w down = loop+ where+ loop = do+ e <- getWindowEvent w+ case e of + Key { keysym = k, isDown = isDown } + | isDown == down + -> return k+ _ -> loop++getButton w left down = loop+ where+ loop = do+ e <- getWindowEvent w+ case e of + Button {pt=pt,isLeft=isLeft,isDown=isDown} + | isLeft == left && isDown == down+ -> return pt+ _ -> loop++wGetChar w = loop+ where+ loop = do+ e <- getWindowEvent w+ case e of + Char {char = c} -> return c+ _ -> loop++-- Graphic++--elsewhere: type Graphic = Draw ()+emptyGraphic = return ()+g1 `overGraphic` g2 = g2 >> g1+overGraphics = foldr overGraphic emptyGraphic++-- Graphic modifiers++withFont x = bracket_ (selectFont x) selectFont+withTextAlignment x = bracket_ (setTextAlignment x) setTextAlignment+withTextColor x = bracket_ (setTextColor x) setTextColor+withBkColor x = bracket_ (setBkColor x) setBkColor+withBkMode x = bracket_ (setBkMode x) setBkMode+withPen x = bracket_ (selectPen x) selectPen+withBrush x = bracket_ (selectBrush x) selectBrush++withRGB c p = + mkBrush c $ \ brush ->+ withBrush brush $+ mkPen Solid 2 c $ \ pen ->+ withPen pen $+ withTextColor c $+ p++colorList =+ [ (Black , RGB 0 0 0)+ , (Blue , RGB 0 0 255)+ , (Green , RGB 0 255 0)+ , (Cyan , RGB 0 255 255)+ , (Red , RGB 255 0 0)+ , (Magenta , RGB 255 0 255)+ , (Yellow , RGB 255 255 0)+ , (White , RGB 255 255 255)+ ]++colorTable = array (minBound, maxBound) colorList++withColor c g = withRGB (colorTable ! c) g ++-- Concurrency primitives++par m1 m2 = do+ v1 <- newEmptyMVar + v2 <- newEmptyMVar + forkIO (m1 >>= putMVar v1)+ forkIO (m2 >>= putMVar v2)+ a <- takeMVar v1+ b <- takeMVar v2+ return (a,b)++par_ m1 m2 = do+ v1 <- newEmptyMVar + v2 <- newEmptyMVar + forkIO (m1 >> putMVar v1 ())+ forkIO (m2 >> putMVar v2 ())+ takeMVar v1+ takeMVar v2+ return ()++parMany ms = foldr par_ (return ()) ms++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Win32/Bitmap.hs view
@@ -0,0 +1,172 @@+-- #hide+module Graphics.HGL.Win32.Bitmap+ ( Bitmap+ , load, read, delete+ , draw, drawStretched, drawSheared+ , getBitmapSize+ , createBitmapFile+ ) where++import Graphics.HGL.Units (Point)+import Graphics.HGL.Internals.Draw (Draw, mkDraw)+import Graphics.HGL.Win32.Draw+import Graphics.HGL.Win32.Types+import qualified Graphics.HGL.Internals.Utilities as Utils++import qualified Graphics.Win32 as Win32+import qualified System.Win32 as Win32++import Foreign++----------------------------------------------------------------+-- The interface+----------------------------------------------------------------++load :: String -> IO (Bitmap, (Int, Int))+delete :: Bitmap -> IO ()++getBitmapSize :: Bitmap -> IO (Int, Int)++-- Bitmaps can be drawn in three ways:+-- a) with no transformation at a point+-- b) stretched to fit a rectangle+-- c) rotated and sheared to fit a parallelogram+--+-- Sadly, the latter isn't supported in Win'95++draw :: Point -> Bitmap -> Draw ()+drawStretched :: Point -> Point -> Bitmap -> Draw ()+drawSheared :: Point -> Point -> Point -> Bitmap -> Draw ()++----------------------------------------------------------------+-- The implementation+----------------------------------------------------------------++delete (MkBitmap bitmap) = Win32.deleteBitmap bitmap++load fileName = do+ --putStrLn ("<<DEBUG: loading bitmap \"" ++ fileName ++ "\">>")+ bmp <- readBitmap fileName+ sz <- getBitmapSize bmp+ return (bmp, sz)++getBitmapSize (MkBitmap bmp) = do+ (ty, w, h, wBytes, planes, bitsPixel, bits) <- Win32.getBitmapInfo bmp+ return (fromIntegral w, fromIntegral h)++draw pt bmp = mkDraw (\ hdc ->+ withCompatibleDC hdc $ \ memdc ->+ withBitmap memdc bmp $ do+ (width,height) <- getBitmapSize bmp+ Win32.bitBlt hdc x y (fromIntegral width) (fromIntegral height) + memdc 0 0 Win32.sRCCOPY)+ where+ (x,y) = fromPoint pt++drawStretched p0 p1 bmp = mkDraw (\hdc -> + withCompatibleDC hdc $ \ memdc ->+ withBitmap memdc bmp $ do+ (width,height) <- getBitmapSize bmp+ Win32.stretchBlt hdc x0 y1 (x1-x0) (y0-y1)+ memdc 0 0 (fromIntegral width) (fromIntegral height) Win32.sRCCOPY)+ where+ (x0,y0) = fromPoint p0+ (x1,y1) = fromPoint p1++drawSheared p0 p1 p2 bmp = mkDraw (\hdc ->+ withCompatibleDC hdc $ \ memdc ->+ withBitmap memdc bmp $ do+ (width,height) <- getBitmapSize bmp+ Win32.plgBlt hdc (fromPoint p0) (fromPoint p1) (fromPoint p2)+ memdc 0 0 (fromIntegral width) (fromIntegral height) Nothing 0 0)++----------------------------------------------------------------+-- Reading bitmaps from files+----------------------------------------------------------------++-- ToDo: the "bits" read are never freed but I think we can free them+-- as soon as we call createDIBitmap.++-- Summary of the Win32 documentation on BMP files:+--+-- A bitmap file consists of:+-- +-- +-------------------++-- | BITMAPFILEHEADER |+-- +-------------------++-- | BITMAPINFOHEADER |+-- +-------------------++-- | Rgbquad array |+-- +-------------------++-- | Color-index array |+-- +-------------------++-- +-- The file header tells you the size of the file and the offset of the+-- bitmap data from the header start.+-- +-- The info header specifies the width and height, the colour format,+-- compression mode, number of bytes of data, resolution and the number+-- of colours.+-- +-- The RGBQUAD array is a palette.+-- +-- The Color-index array is the actual bitmap.++readBitmap fileName = + Utils.bracket + (Win32.createFile fileName + Win32.gENERIC_READ Win32.fILE_SHARE_READ Nothing + Win32.oPEN_EXISTING Win32.fILE_ATTRIBUTE_NORMAL Nothing)+ Win32.closeHandle+ $ \ file -> do+ (offset, size) <- readFileHeader file+ (infoHeader,bmi,bits) <- readBits file offset size+ hdc <- Win32.getDC Nothing -- hdc for the screen+ bmp <- Win32.createDIBitmap hdc infoHeader Win32.cBM_INIT bits bmi Win32.dIB_RGB_COLORS+ return (MkBitmap bmp)++readFileHeader :: Win32.HANDLE -> IO (Word32, Word32)+readFileHeader file =+ -- read the file header+ allocaBytes (fromIntegral Win32.sizeofLPBITMAPFILEHEADER) $ \ fileHeader -> do+ read <- Win32.win32_ReadFile file fileHeader+ Win32.sizeofLPBITMAPFILEHEADER Nothing+ assert (read == Win32.sizeofLPBITMAPFILEHEADER) "Bitmap file lacks header"+ -- check the tag and get the size+ (tag, size, r1, r2, offset) <- Win32.getBITMAPFILEHEADER fileHeader+ assert (tag == fromIntegral (fromEnum 'B' + 256 * fromEnum 'M')) + "Bitmap file lacks tag"+ assert (r1 == 0 && r2 == 0) + "Bitmap header contains non-zero reserved words"+ return ( offset - Win32.sizeofLPBITMAPFILEHEADER+ , size - Win32.sizeofLPBITMAPFILEHEADER+ )++-- read the bits out of the rest of the file+-- assumes that you've just read the file header+readBits :: Win32.HANDLE -> Word32 -> Word32 -> + IO (Win32.LPBITMAPINFOHEADER, Win32.LPBITMAPINFO, Win32.LPVOID)+readBits file offset size = do+ header <- mallocBytes (fromIntegral size)+ read <- Win32.win32_ReadFile file header size Nothing+ assert (read == size) "Bitmap file ended unexpectedly"+ return ( castPtr header+ , header+ , castPtr header `plusPtr` fromIntegral offset+ )++-- In the development system, this might print the error message+-- if the assertion fails.+assert :: Bool -> String -> IO ()+assert _ _ = return ()+{-+assert True _ = return ()+assert False why = do+ putStrLn "Assertion failed:"+ putStrLn why+ return ()+-}++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Win32/Draw.hs view
@@ -0,0 +1,162 @@+-- #hide+module Graphics.HGL.Win32.Draw+ ( DrawFun, drawGraphic, drawBufferedGraphic, drawBufferedGraphicBC+ , saveGraphic+ , withBitmap+ , setDefaults+ , createCompatibleBitmap, withCompatibleBitmap, withCompatibleDC, withDC+ , createBitmapFile+ ) where++import Graphics.HGL.Units+import Graphics.HGL.Internals.Draw+import Graphics.HGL.Win32.Types+import qualified Graphics.HGL.Internals.Utilities as Utils+import qualified Graphics.Win32 as Win32+import Data.Int++type DrawFun = Win32.HWND -> Win32.HDC -> IO ()++drawGraphic :: Draw () -> DrawFun+drawBufferedGraphic :: Draw () -> DrawFun+drawBufferedGraphicBC :: Win32.COLORREF -> Draw () -> DrawFun+saveGraphic :: String -> Point -> Draw () -> IO ()++createBitmapFile :: Win32.HDC -> String -> Bitmap -> IO ()+createCompatibleDC :: Win32.HDC -> IO Win32.HDC+deleteDC :: Win32.HDC -> IO ()+createCompatibleBitmap :: Win32.HDC -> Int32 -> Int32 -> IO Bitmap+withCompatibleDC :: Win32.HDC -> (Win32.HDC -> IO a) -> IO a+withBitmap :: Win32.HDC -> Bitmap -> IO a -> IO a+withDC :: Maybe Win32.HWND -> (Win32.HDC -> IO a) -> IO a+withCompatibleBitmap :: Win32.HDC -> Int32 -> Int32 -> (Bitmap -> IO a) -> IO a++----------------------------------------------------------------++drawGraphic p = \ hwnd hdc -> do+ (w,h) <- windowSize hwnd+ Win32.bitBlt hdc 0 0 w h hdc 0 0 backgroundColor+ setDefaults hdc+ unDraw p hdc++drawBufferedGraphic = drawBufferedGraphicBC backgroundColor++drawBufferedGraphicBC bgColor p = \ hwnd hdc -> do+ (w,h) <- windowSize hwnd+ withBuffer (Just hwnd) w h bgColor $ \ buffer _ -> do+ setDefaults buffer+ unDraw p buffer+ Win32.bitBlt hdc 0 0 w h buffer 0 0 Win32.sRCCOPY++saveGraphic fileName size p = + withBuffer Nothing w h backgroundColor $ \ buffer bmp -> do+ setDefaults buffer+ unDraw p buffer+ createBitmapFile buffer fileName bmp+ where+ (w,h) = fromPoint size++backgroundColor = Win32.bLACKNESS++setDefaults :: Win32.HDC -> IO ()+setDefaults hdc = do+ setDefaultPen hdc+ setDefaultBrush hdc+ setDefaultText hdc+ return ()++setDefaultPen :: Win32.HDC -> IO ()+setDefaultPen = \ hdc -> do+ whitePen <- Win32.getStockPen Win32.wHITE_PEN+ Win32.selectPen hdc whitePen+ return ()++setDefaultBrush :: Win32.HDC -> IO ()+setDefaultBrush = \ hdc -> do+ whiteBrush <- Win32.getStockBrush Win32.wHITE_BRUSH+ Win32.selectBrush hdc whiteBrush+ return ()++setDefaultText :: Win32.HDC -> IO ()+setDefaultText = \ hdc -> do+ Win32.setTextColor hdc white+-- We omit this because it should be redundant (since mode is transparent)+-- And because it causes some examples to crash.+-- Maybe you're not allowed to set a color if the mode is transparent?+-- Win32.setBkColor hdc black+ Win32.setBkMode hdc Win32.tRANSPARENT+ return ()++white :: Win32.COLORREF+white = Win32.rgb 255 255 255++black :: Win32.COLORREF+black = Win32.rgb 0 0 0++----------------------------------------------------------------+-- Note that we create a bitmap which is compatible with the hdc+-- onto which we are going to zap the Graphic. It might seem that+-- it would be enough for it to be compatible with the buffer -+-- but, sadly, this isn't the case. The problem is that the buffer+-- is initially 0 pixels wide, 0 pixels high and 1 bit deep+-- (ie it looks monochrome); it only becomes n-bits deep when you+-- select in a bitmap which is n-bits deep.+--+-- If it wasn't for that, we'd have swapped these two lines:+--+-- withCompatibleBitmap w h $ \ bitmap ->+-- withCompatibleDC $ \ hdc ->+--+withBuffer :: Maybe Win32.HWND -> Int32 -> Int32 -> Win32.COLORREF -> (Win32.HDC -> Bitmap -> IO a) -> IO a++withBuffer mbhwnd w h bgColor p = + withDC mbhwnd $ \ hdc -> + withCompatibleBitmap hdc w h $ \ bitmap ->+ withCompatibleDC hdc $ \ buffer ->+ withBitmap buffer bitmap $ do+ Win32.bitBlt buffer 0 0 w h buffer 0 0 bgColor+ p buffer bitmap++----------------------------------------------------------------++-- Get the width and height of a window's client area, in pixels.+windowSize :: Win32.HWND -> IO (Win32.LONG,Win32.LONG)+windowSize hwnd =+ Win32.getClientRect hwnd >>= \ (l',t',r',b') ->+ return (r' - l', b' - t')++-- Note that this DC is only "1 bit" in size - you have to call+-- "createCompatibleBitmap" before it is big enough to hold the bitmap+-- you want.+createCompatibleDC hdc = Win32.createCompatibleDC (Just hdc)++deleteDC = Win32.deleteDC++createCompatibleBitmap hdc w h = do+ bmp <- Win32.createCompatibleBitmap hdc w h+ return (MkBitmap bmp)++withBitmap hdc bmp = Utils.bracket_ (selectBitmap hdc bmp) (selectBitmap hdc)++withDC mhwnd = Utils.bracket (Win32.getDC mhwnd) (Win32.releaseDC mhwnd)++-- Note that this DC is only "1 bit" in size - you have to call+-- "createCompatibleBitmap" before it is big enough to hold the bitmap+-- you want.+withCompatibleDC hdc = Utils.bracket (createCompatibleDC hdc) deleteDC++withCompatibleBitmap hdc w h =+ Utils.bracket (createCompatibleBitmap hdc w h) deleteBitmap++deleteBitmap (MkBitmap bmp) = Win32.deleteBitmap bmp++selectBitmap hdc (MkBitmap bmp) = do+ bmp' <- Win32.selectBitmap hdc bmp+ return (MkBitmap bmp)++createBitmapFile hdc fileName (MkBitmap bmp) = + Win32.createBMPFile fileName bmp hdc++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/Win32/Types.hs view
@@ -0,0 +1,62 @@+-- #hide+module Graphics.HGL.Win32.Types+ ( toDimension, fromDimension+ , toPoint, fromPoint+ , toRGB, fromRGB+ , Bitmap(..)+ , DC+ , Key(MkKey)+ ) where++import qualified Graphics.Win32 as Win32+import Graphics.HGL.Internals.Types++-- Hugs does not allow operators to have different fixities in +-- different modules (this is a known deviation from Standard Haskell).+-- In consequence, we don't declare any fixities in any non-standard+-- library because it would prevent the programmer from using the same+-- operator name at a different fixity.+--+-- infixr 9 `over`++----------------------------------------------------------------+-- Units+----------------------------------------------------------------++-- These functions are used when implementing Graphic values+toPoint :: Win32.POINT -> Point+fromPoint :: Point -> Win32.POINT++toDimension :: Win32.INT -> Dimension+fromDimension :: Dimension -> Win32.INT++toPoint (x,y) = (toDimension x, toDimension y)+fromPoint (x,y) = (fromDimension x, fromDimension y)+toDimension = fromIntegral+fromDimension = fromIntegral++---------------------------------------------------------------+-- Colors+----------------------------------------------------------------++fromRGB :: RGB -> Win32.COLORREF+fromRGB (RGB r g b) = Win32.rgb r g b++toRGB :: Win32.COLORREF -> RGB+toRGB c = RGB (Win32.getRValue c) (Win32.getGValue c) (Win32.getBValue c)++----------------------------------------------------------------+-- Bitmaps+----------------------------------------------------------------++newtype Bitmap = MkBitmap Win32.HBITMAP++----------------------------------------------------------------+-- Drawing Context+----------------------------------------------------------------++type DC = Win32.HDC++newtype Key = MkKey Win32.VKey deriving Show++----------------------------------------------------------------
+ Graphics/HGL/Win32/WND.hs view
@@ -0,0 +1,361 @@+-- #hide+module Graphics.HGL.Win32.WND+ ( WND, mkWND, openWND, closeWND, redrawWND+ , handleEvents, closeAllHWNDs+ , beginGraphics, endGraphics+ , wndRect+ , getHWND+ , drawWND+ ) where++import Graphics.HGL.Units (Point)+import Graphics.HGL.Internals.Event( Event(..) )+import Graphics.HGL.Internals.Draw (Draw, unDraw)+import Graphics.HGL.Internals.Events( Events, sendEvent, sendTick )+import Graphics.HGL.Internals.Utilities(safeTry, Exception)+import Graphics.HGL.Win32.Draw( DrawFun, setDefaults, withDC )+import Graphics.HGL.Win32.Types( Key(MkKey), toPoint )++import Control.Concurrent( yield )+import Control.Monad(liftM2,when)+import Data.Bits+import Data.IORef+import Data.Maybe(isJust)+import System.IO.Unsafe(unsafePerformIO)++import Graphics.Win32+import System.Win32 (getModuleHandle)++----------------------------------------------------------------+-- Once a window has been closed, we want to detect any further+-- operations on the window - so all access is via a mutable Maybe+----------------------------------------------------------------++newtype WND = MkWND (IORef (Maybe HWND))++closeWND :: WND -> IO ()+closeWND wnd@(MkWND hwndref) = do+ mb_hwnd <- readIORef hwndref+ writeIORef hwndref Nothing -- mark it as closed+ case mb_hwnd of+ Just hwnd -> do+ removeHWND hwnd -- added by Ulf Norell <ulfn@cs.chalmers.se>+ yield -- added by Ulf+ destroyWindow hwnd+ Nothing -> return ()++getHWND :: WND -> IO HWND+getHWND (MkWND hwndref) = do+ mb_hwnd <- readIORef hwndref+ case mb_hwnd of + Just hwnd -> return hwnd+ Nothing -> ioError (userError "Attempted to act on closed window")++redrawWND :: WND -> IO ()+redrawWND wnd = do+ hwnd <- getHWND wnd+ invalidateRect (Just hwnd) Nothing False++drawWND :: WND -> Draw () -> IO ()+drawWND wnd p = do+ hwnd <- getHWND wnd+ withDC (Just hwnd) (\ hdc -> setDefaults hdc >> unDraw p hdc)++wndRect :: WND -> IO (Point, Point)+wndRect wnd = do+ hwnd <- getHWND wnd+ (l,t,r,b) <- getClientRect hwnd+ return (toPoint (l,t), toPoint (r,b))++mkWND :: HWND -> IO WND+mkWND hwnd = fmap MkWND (newIORef (Just hwnd))++openWND :: String -> Maybe POINT -> Maybe POINT + -> Events -- where to send the events+ -> DrawFun -- how to redraw the picture+ -> Maybe MilliSeconds -- time between timer ticks+ -> IO WND+openWND name pos size events draw tickRate = do+ checkInitialised+ clAss <- newClass+ hwnd <- createWND name wndProc pos size wS_OVERLAPPEDWINDOW Nothing+ show hwnd False+ updateWindow hwnd+ maybe (return ())+ (\ rate -> setWinTimer hwnd 1 rate >> return ())+ tickRate + fmap MkWND (newIORef (Just hwnd))+ where+ wndProc hwnd msg wParam lParam = do+ -- print msg+ rs <- safeTry $ do+ r <- windowProc + (sendEvent events) + draw+ (\ wParam -> sendTick events)+ hwnd msg wParam lParam+ r `seq` return r -- force it inside the try!+ case rs of+ Right a -> return a+ Left e -> uncaughtError e >> return 0 -- Let's hope this works ok++ show hwnd iconified = + if iconified + then do + showWindow hwnd sW_SHOWNORMAL -- open "iconified"+ return ()+ else do + showWindow hwnd sW_RESTORE -- open "restored" (ie normal size)+ bringWindowToTop hwnd++-- Note that this code uses a single (static) MSG throughout the whole+-- system - let's hope this isn't a problem+handleEvents :: IO Bool -> IO ()+handleEvents userQuit = do+ -- first wait for a window to be created or for the user prog to quit+ -- this avoids the race condition that we might quit (for lack of+ -- any windows) before the user's thread has even had a chance to run.+ safeTry $+ while (fmap not (liftM2 (||) userQuit (fmap not noMoreWindows)))+ yield -- Ulf uses this instead of handleEvent+ -- then wait for all windows to be shut down or user to quit+ safeTry $+ while (fmap not (liftM2 (||) userQuit systemQuit)) + handleEvent+ return ()+ where+ while p s = do { c <- p; if c then s >> while p s else return () }++handleEvent :: IO ()+handleEvent = do+ yield -- always yield before any blocking operation+ nowin <- noMoreWindows+ when (not nowin) $ allocaMessage $ \ lpmsg -> do+ getMessage lpmsg Nothing+ translateMessage lpmsg+ dispatchMessage lpmsg+ return ()+++----------------------------------------------------------------+-- The grotty details - opening WNDs, creating classes, etc+----------------------------------------------------------------++className = mkClassName "Graphics.HGL.Win32.WND"++newClass :: IO ATOM+newClass = do+ icon <- loadIcon Nothing iDI_APPLICATION+ cursor <- loadCursor Nothing iDC_ARROW+ whiteBrush <- getStockBrush wHITE_BRUSH+ mainInstance <- getModuleHandle Nothing+ atom <- registerClass (+ (cS_HREDRAW .|. cS_VREDRAW), -- redraw if window size Changes+ mainInstance,+ (Just icon),+ (Just cursor),+ (Just whiteBrush),+ Nothing,+ className)+ --return atom+ return (maybe undefined id atom)++createWND :: String -> WindowClosure -> Maybe POINT -> Maybe POINT + -> WindowStyle -> Maybe HMENU -> IO HWND+createWND name wndProc posn size style menu = do+ mainInstance <- getModuleHandle Nothing+ mbSize <- calcSize size+ hwnd <- createWindowEx + 0 -- Win32.wS_EX_TOPMOST + className+ name+ style+ (fmap (fromIntegral.fst) posn) -- x+ (fmap (fromIntegral.snd) posn) -- y+ (fmap (fromIntegral.fst) mbSize) -- w+ (fmap (fromIntegral.snd) mbSize) -- h+ Nothing -- parent+ menu+ mainInstance+ wndProc+ addHWND hwnd+ return hwnd+ where+ calcSize :: Maybe POINT -> IO (Maybe POINT)+ calcSize = + maybe (return Nothing)+ (\ (width, height) -> do+ (l,t,r,b) <- adjustWindowRect (0,0,width,height) style (isJust menu)+ return $ Just (r-l, b-t))++windowProc :: (Event -> IO ()) -> -- Event Handler+ DrawFun -> -- Picture redraw+ (WPARAM -> IO ()) -> -- tick+ (HWND -> WindowMessage -> WPARAM -> LPARAM -> IO LRESULT)+windowProc send redraw tick hwnd msg wParam lParam+ | msg == wM_PAINT+ = paint+ | msg == wM_MOUSEMOVE+ = mouseMove lParam+ | msg == wM_LBUTTONDOWN || msg == wM_LBUTTONDBLCLK+ = button lParam True True+ | msg == wM_LBUTTONUP+ = button lParam True False+ | msg == wM_RBUTTONDOWN || msg == wM_RBUTTONDBLCLK+ = button lParam False True+ | msg == wM_RBUTTONUP+ = button lParam False False+ | msg == wM_KEYDOWN+ = key wParam True+ | msg == wM_KEYUP+ = key wParam False+ | msg == wM_CHAR+ = char wParam+ | msg == wM_TIMER+ = timer wParam+ | msg == wM_SIZE+ = resize+{-+ | msg == wM_MOUSEACTIVATE+ = do+ hwnd' <- setFocus hwnd+ if hwnd `eqHWND` hwnd' + then+ return mA_NOACTIVATE -- already had input focus+ else+ return mA_ACTIVATEANDEAT+-}+ | msg == wM_DESTROY+ = destroy+ | otherwise+ = defWindowProc (Just hwnd) msg wParam lParam++ where+ paint :: IO LRESULT+ paint = paintWith hwnd (\hdc lpps -> do+ redraw hwnd hdc+ return 0+ )++ button :: LPARAM -> Bool -> Bool -> IO LRESULT+ button lParam isLeft isDown = do+ let (y,x) = lParam `divMod` 65536+ send (Button {pt = toPoint (x,y), isLeft=isLeft, isDown=isDown})+ return 0++ key :: WPARAM -> Bool -> IO LRESULT+ key wParam isDown = do+ send (Key { keysym = MkKey wParam, isDown = isDown })+ -- by returning 1 we let it get translated into a char too+ return 1++ char :: WPARAM -> IO LRESULT+ char wParam = do+ send (Char { char = toEnum (fromIntegral wParam) })+ return 0++ mouseMove :: LPARAM -> IO LRESULT+ mouseMove lParam = do+ let (y,x) = lParam `divMod` 65536+ send (MouseMove { pt = toPoint (x,y) })+ return 0++ timer :: WPARAM -> IO LRESULT+ timer wParam = do+ tick wParam+ return 0++ resize :: IO LRESULT+ resize = do+ -- don't send new size, it may be out of date by the time we+ -- get round to reading the event+ send Resize+ return 0++ destroy :: IO LRESULT+ destroy = do+ removeHWND hwnd+ send Closed+ return 0++paintWith :: HWND -> (HDC -> LPPAINTSTRUCT -> IO a) -> IO a+paintWith hwnd p =+ allocaPAINTSTRUCT $ \ lpps -> do+ hdc <- beginPaint hwnd lpps+ a <- p hdc lpps+ endPaint hwnd lpps+ return a++----------------------------------------------------------------+-- The open window list+----------------------------------------------------------------++-- It's very important that we close any windows - even if the +-- Haskell application fails to do so (or aborts for some reason).+-- Therefore we keep a list of open windows and close them all at the+-- end.++-- persistent list of open windows+windows :: IORef [HWND]+windows = unsafePerformIO (newIORef [])++initialised :: IORef Bool+initialised = unsafePerformIO (newIORef False)++noMoreWindows :: IO Bool+noMoreWindows = fmap null (readIORef windows)++-- It's also important that we abort cleanly if an uncaught IOError+-- occurs - this flag keeps track of such things++hadUncaughtError :: IORef Bool+hadUncaughtError = unsafePerformIO (newIORef False)++-- We call this if an uncaught error has occured+uncaughtError :: Exception -> IO ()+uncaughtError e = do+ putStr "Uncaught Error: "+ print e + writeIORef hadUncaughtError True++systemQuit :: IO Bool+systemQuit = liftM2 (||) (readIORef hadUncaughtError) noMoreWindows++beginGraphics :: IO ()+beginGraphics = do+ closeAllHWNDs -- just in case any are already open!+ writeIORef initialised True++checkInitialised :: IO ()+checkInitialised = do+ init <- readIORef initialised+ if init + then return ()+ else ioError (userError msg)+ where+ msg = "Graphics library uninitialised: perhaps you forgot to use runGraphics?"++endGraphics :: IO ()+endGraphics = do+ closeAllHWNDs+ writeIORef initialised False++closeAllHWNDs :: IO ()+closeAllHWNDs = do+ hwnds <- readIORef windows+ mapM_ destroyWindow hwnds+ writeIORef windows []+ writeIORef hadUncaughtError False -- clear the system+++addHWND :: HWND -> IO ()+addHWND hwnd = do+ hwnds <- readIORef windows+ writeIORef windows (hwnd:hwnds)++-- remove a HWND from windows list+removeHWND :: HWND -> IO ()+removeHWND hwnd = do+ hwnds <- readIORef windows+ writeIORef windows (filter (/= hwnd) hwnds)+
+ Graphics/HGL/Window.hs view
@@ -0,0 +1,194 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.Window+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : provisional+-- Portability : non-portable (requires concurrency)+--+-- Windows in a simple graphics library.+--+-----------------------------------------------------------------------------++#include "HsHGLConfig.h"++module Graphics.HGL.Window+ (+ -- * Windows+ Window+ , Title -- = String+ , RedrawMode(Unbuffered, DoubleBuffered)+ , openWindowEx -- :: Title -> Maybe Point -> Maybe Size ->+ -- RedrawMode -> Maybe Time -> IO Window+ , getWindowRect -- :: Window -> IO (Point,Point)+ , closeWindow -- :: Window -> IO ()++ -- * Drawing in a window+ , setGraphic -- :: Window -> Graphic -> IO ()+ , getGraphic -- :: Window -> IO Graphic+ , modGraphic -- :: Window -> (Graphic -> Graphic) -> IO ()+ , directDraw -- :: Window -> Graphic -> IO ()+ -- not in X11: , redrawWindow -- :: Window -> IO ()++ -- * Events in a window+ , Event(..)+ -- , Event(Char,Key,Button,MouseMove,Resize,Closed) -- deriving(Show)+ -- , char -- :: Event -> Char+ -- , keysym -- :: Event -> Key+ -- , isDown -- :: Event -> Bool+ -- , pt -- :: Event -> Point+ -- , isLeft -- :: Event -> Bool+ , getWindowEvent -- :: Window -> IO Event+ , maybeGetWindowEvent -- :: Window -> IO (Maybe Event)++ -- * Timer ticks+ -- | Timers that tick at regular intervals are set up by 'openWindowEx'.+ , getWindowTick -- :: Window -> IO ()+ , getTime -- :: IO Time+ ) where++#ifdef __HADDOCK__+import Graphics.HGL.Key+#endif+import Graphics.HGL.Units+import Graphics.HGL.Draw( Graphic )+import Graphics.HGL.Internals.Event( Event(..) )+import Graphics.HGL.Internals.Types( Title, RedrawMode(..), getTime )+import qualified Graphics.HGL.Internals.Events as E+import Graphics.HGL.Internals.Utilities( modMVar, modMVar_ )+#if !X_DISPLAY_MISSING+import Graphics.HGL.X11.Window (Window(..))+import qualified Graphics.HGL.X11.Window as X (openWindowEx, closeWindow,+ redrawWindow, directDraw, getWindowRect )+#else+import Graphics.HGL.Win32.WND+ (WND, openWND, getHWND, closeWND, wndRect, redrawWND, drawWND)+import Graphics.HGL.Win32.Types+import Graphics.HGL.Win32.Draw( + drawGraphic, drawBufferedGraphic + )+import Graphics.HGL.Draw (Draw)+-- import Graphics.HGL.Internals.Types++import qualified Graphics.Win32 as Win32+#endif++import Control.Concurrent.MVar++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++-- | Wait for the next event on the given window.+getWindowEvent :: Window -> IO Event++-- | Check for a pending event on the given window.+maybeGetWindowEvent :: Window -> IO (Maybe Event)++-- | Wait for the next tick event from the timer on the given window.+getWindowTick :: Window -> IO ()++-- | Get the current drawing in a window.+getGraphic :: Window -> IO Graphic++-- | Set the current drawing in a window.+setGraphic :: Window -> Graphic -> IO ()++-- | Update the drawing for a window.+-- Note that this does not force a redraw.+modGraphic :: Window -> (Graphic -> Graphic) -> IO ()++-- | General window creation.+openWindowEx+ :: Title -- ^ title of the window+ -> Maybe Point -- ^ the optional initial position of a window+ -> Size -- ^ initial size of the window+ -> RedrawMode -- ^ how to display a graphic on the window+ -> Maybe Time -- ^ the time between ticks (in milliseconds) of an+ -- optional timer associated with the window+ -> IO Window++-- | Close the window.+closeWindow :: Window -> IO ()++redrawWindow :: Window -> IO ()++directDraw :: Window -> Graphic -> IO ()++-- | The position of the top left corner of the window on the screen,+-- and the size of the window.+getWindowRect :: Window -> IO (Point, Size)++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++getWindowEvent w = E.getEvent (events w)++maybeGetWindowEvent w+ = do noEvent <- E.isNoEvent (events w)+ if noEvent + then return Nothing+ else do ev <- getWindowEvent w+ return (Just ev)++getWindowTick w = E.getTick (events w)++getGraphic w = readMVar (graphic w)++setGraphic w p = do+ modMVar (graphic w) (const p)+ redrawWindow w++modGraphic w = modMVar_ (graphic w)++#if !X_DISPLAY_MISSING++openWindowEx = X.openWindowEx+closeWindow = X.closeWindow+getWindowRect = X.getWindowRect+redrawWindow = X.redrawWindow+directDraw = X.directDraw++#else /* X_DISPLAY_MISSING */++data Window = MkWindow { + events :: E.Events, -- the event stream+ graphic :: MVar (Draw ()), -- the current graphic+ wnd :: WND -- the real window+ }++openWindowEx name pos size redrawMode tickRate = do+ graphic <- newMVar (return ())+ events <- E.newEvents+ let draw = \ hwnd hdc -> do+ p <- readMVar graphic + repaint p hwnd hdc+ wnd <- openWND name (fmap fromPoint pos) (Just $ fromPoint size) + events draw (fmap fromInteger tickRate)+ mkWindow wnd events graphic+ where+ repaint = case redrawMode of+ Unbuffered -> drawGraphic+ DoubleBuffered -> drawBufferedGraphic++mkWindow :: WND -> E.Events -> MVar (Draw ()) -> IO Window+mkWindow wnd events graphic = do+ return (MkWindow { wnd=wnd, events=events, graphic=graphic })++closeWindow w = closeWND (wnd w)+getWindowRect w = wndRect (wnd w)+redrawWindow w = redrawWND (wnd w)+directDraw w p = drawWND (wnd w) p++-- in case you need low level access+windowHWND :: Window -> IO Win32.HWND+windowHWND w = getHWND (wnd w)++#endif /* X_DISPLAY_MISSING */++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/X11/DC.hs view
@@ -0,0 +1,59 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.X11.DC+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : non-portable (requires concurrency)+--+-- A simple graphics library.+--+-----------------------------------------------------------------------------++-- #hide+module Graphics.HGL.X11.DC+ ( drawUnbuffered, drawBuffered, erase+ ) where++import Graphics.HGL.X11.Types++import qualified Graphics.X11.Xlib as X++import Data.IORef( IORef, readIORef, writeIORef )+import Control.Concurrent( readMVar )+import Graphics.HGL.Internals.Draw++----------------------------------------------------------------+-- Draw+----------------------------------------------------------------++drawUnbuffered :: DC -> Draw () -> IO ()+drawUnbuffered dc p = do+ unDraw erase dc+ unDraw p dc++drawBuffered :: DC -> Draw () -> X.GC -> Int -> IORef (Maybe X.Pixmap) -> IO ()+drawBuffered dc p gc depth ref_mbuffer = do+ (_,(width,height)) <- readMVar (ref_rect dc)+ -- Note: The buffer is deallocated whenever the window size changes!+ mbuffer <- readIORef ref_mbuffer+ buffer <- case mbuffer of+ Nothing -> X.createPixmap (disp dc)+ (drawable dc)+ width+ height+ depth+ Just buffer -> return buffer+ X.fillRectangle (disp dc) buffer gc 0 0 width height+ unDraw p dc{drawable=buffer}+ X.copyArea (disp dc) buffer (drawable dc) (paintGC dc) 0 0 width height 0 0+ writeIORef ref_mbuffer (Just buffer)++erase :: Draw ()+erase = mkDraw (\ dc -> X.clearWindow (disp dc) (drawable dc))++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/X11/Display.hs view
@@ -0,0 +1,55 @@+-- #hide+module Graphics.HGL.X11.Display+ ( getDisplayName+ , openDisplay+ , closeDisplay+ , getDisplay+ ) where++import Graphics.HGL.Internals.Utilities (modMVar)++import qualified Graphics.X11.Xlib as X++import Control.Concurrent.MVar (MVar, newMVar, readMVar, takeMVar, putMVar)+import Control.Monad (when)+import Data.Maybe (isJust)+import System.Environment (getEnv)+import System.IO.Error (try)+import System.IO.Unsafe (unsafePerformIO)++getDisplayName :: IO String+getDisplayName = do+ disp <- try (getEnv "DISPLAY")+ return (either (const ":0.0") id disp)++displayRef :: MVar (Maybe X.Display)+displayRef = unsafePerformIO (newMVar Nothing)++openDisplay :: String -> IO () -> IO X.Display+openDisplay host cleanup = do+ mb_display <- readMVar displayRef+ when (isJust mb_display) cleanup+ openDisplay'+ where+ openDisplay' = do + display <- X.openDisplay host `catch` \ err -> + ioError (userError ("Unable to open X display " ++ host))+ modMVar displayRef (const $ Just display)+ return display++closeDisplay :: IO ()+closeDisplay = do+ mb_display <- takeMVar displayRef+ case mb_display of+ Nothing -> do+ putMVar displayRef Nothing+ Just display -> do+ X.closeDisplay display+ putMVar displayRef Nothing++getDisplay :: IO X.Display+getDisplay = do+ mb_display <- readMVar displayRef+ case mb_display of+ Nothing -> ioError $ userError "Display not opened yet"+ Just display -> return display
+ Graphics/HGL/X11/Timer.hs view
@@ -0,0 +1,121 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.X11.Timer+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : non-portable (requires concurrency)+--+-- A simple graphics library.+--+-----------------------------------------------------------------------------++-- #hide+module Graphics.HGL.X11.Timer+ ( Timer, new, stop+ , Timers, newTimers, clearTimers, nextTick, fireTimers+ ) where++import Control.Concurrent+ ( MVar, newMVar, takeMVar, putMVar, readMVar )+import Graphics.HGL.Internals.Utilities( modMVar_ )+import Graphics.HGL.Internals.Types++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++data Timer = Timer+ { period :: Time -- how often does it fire+ , action :: IO () -- what to do when it does+ , tag :: MVar () -- something that supports an equality test+ }++-- A standard timer implementation using a list of (delta-time,timer) pairs.+type Timers = MVar [(Time, Timer)]++newTimers :: IO Timers+clearTimers :: Timers -> IO ()+nextTick :: Timers -> IO (Maybe Time)+fireTimers :: Timers -> Time -> IO ()++new :: Timers -> Time -> IO () -> IO Timer+stop :: Timers -> Timer -> IO ()++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++newTimers = do+ newMVar []++-- This will only work if the mvar is non-empty.+-- Fortunately, all operations on timers do atomic updates (modMVar)+-- so this should be true.+clearTimers ts = do+ modMVar_ ts (const [])++fireTimers timers t = do+ xs <- takeMVar timers+ let (ts,xs') = firedTimers t xs+ xs'' = foldr insert xs' ts+ putMVar timers xs''+ mapM_ action ts+ where+ insert :: Timer -> [(Time,Timer)] -> [(Time,Timer)]+ insert timer = insertTimer (period timer) timer++nextTick timers = do+ ts <- readMVar timers+ case ts of+ ((t,_):_) -> return (Just t)+ _ -> return Nothing++new timers t a = do+ tag <- newMVar ()+ let timer = Timer{period=t, action=a, tag=tag}+ modMVar_ timers (insertTimer t timer) + return timer++stop timers timer = do+ modMVar_ timers (deleteTimer timer) ++instance Eq Timer where+ t1 == t2 = tag t1 == tag t2++insertTimer :: Time -> Timer -> [(Time,Timer)] -> [(Time,Timer)]+insertTimer t timer [] = [(t,timer)]+insertTimer t timer (x@(t',timer'):xs)+ | t <= t'+ = (t,timer) : (t'-t, timer') : xs+ | otherwise+ = x : insertTimer (t-t') timer xs++deleteTimer :: Timer -> [(Time,Timer)] -> [(Time,Timer)]+deleteTimer timer [] = []+deleteTimer timer (x@(t',timer'):xs)+ | timer == timer'+ = case xs of+ [] -> []+ (t'', timer''):xs' -> (t'+t'', timer''):xs'+ | otherwise + = x : deleteTimer timer xs++-- we could try to avoid timer drift by returning how "late" we are+-- in firing the timer+-- Maybe a better approach is to make use of the real-time clock provided+-- by the OS and stay in sync with that?+firedTimers :: Time -> [(Time,Timer)] -> ([Timer],[(Time,Timer)])+firedTimers t [] = ([],[])+firedTimers t ((t',timer):xs)+ | t < t'+ = ([], (t'-t,timer):xs)+ | otherwise+ = let (timers, xs') = firedTimers (t-t') xs+ in (timer : timers, xs')++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/HGL/X11/Types.hs view
@@ -0,0 +1,100 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.X11.Types+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : non-portable (requires concurrency)+--+-- Basic types for a simple graphics library.+--+-----------------------------------------------------------------------------++-- #hide+module Graphics.HGL.X11.Types+ ( DC(..)+ , DC_Bits(..)+ , Font(Font), Brush(Brush), Pen(Pen), defaultPen+ , Key(MkKey)+ , fromPoint, toPoint+ , fromSize, toSize+ , lookupColor+ ) where++import Graphics.HGL.Internals.Types++import qualified Graphics.X11.Xlib as X++import Control.Concurrent.MVar (MVar)+import Data.Bits+import Data.Word (Word8)++----------------------------------------------------------------+-- Units+----------------------------------------------------------------++fromPoint :: Point -> X.Point+toPoint :: X.Point -> Point+fromSize :: Size -> (X.Dimension, X.Dimension)+toSize :: (X.Dimension, X.Dimension) -> Size++fromPoint (x,y) = X.Point (fromIntegral x) (fromIntegral y)+toPoint (X.Point x y) = (fromIntegral x, fromIntegral y)+fromSize (x,y) = (fromIntegral x, fromIntegral y)+toSize (x,y) = (fromIntegral x, fromIntegral y)++----------------------------------------------------------------+-- Device Context (simulates Win32 Device Contexts)+----------------------------------------------------------------++data DC = MkDC+ { disp :: X.Display+ , drawable :: X.Drawable+ , textGC :: X.GC+ , paintGC :: X.GC+ , brushGC :: X.GC+ , ref_rect :: MVar (X.Point,(X.Dimension, X.Dimension))+ , ref_bits :: MVar DC_Bits+ }++data DC_Bits = DC_Bits+ { textColor :: RGB+ , bkColor :: RGB+ , bkMode :: BkMode+ , textAlignment :: Alignment+ , brush :: Brush+ , pen :: Pen+ , font :: Font+ }++newtype Key = MkKey X.KeySym deriving Show++newtype Font = Font X.FontStruct+newtype Brush = Brush RGB++data Pen = Pen Style Int X.Pixel++defaultPen :: X.Pixel -> Pen+defaultPen col = Pen Solid 0 col++lookupColor :: X.Display -> RGB -> IO X.Pixel+lookupColor display col = (do+ (X.Color p _ _ _ _) <-+ X.allocColor display color_map (X.Color 0 r g b xcolor_flags)+ return p)+ `catch` \ err -> + print err >> return 0+-- ioError (userError ("Error: " ++ show err+-- ++ "\nUnable to allocate colo[u]r " ++ show (r,g,b) +-- ++ " - I'll bet you're running Netscape."))+ where+ screen = X.defaultScreenOfDisplay display+ color_map = X.defaultColormapOfScreen screen++ RGB r' g' b' = col+ (r,g,b) = ((fromIntegral r') * 256, (fromIntegral g') * 256, (fromIntegral b')*256)++xcolor_flags :: Word8+xcolor_flags = X.doRed .|. X.doGreen .|. X.doBlue
+ Graphics/HGL/X11/Window.hs view
@@ -0,0 +1,677 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.HGL.X11.Window+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+-- +-- Maintainer : libraries@haskell.org+-- Stability : internal+-- Portability : non-portable (requires concurrency)+--+-- A simple graphics library.+--+-----------------------------------------------------------------------------++-- #hide+module Graphics.HGL.X11.Window+ ( runGraphicsEx -- :: String -> IO () -> IO ()++ , Window(events, graphic)+ , openWindowEx -- :: Title -> Maybe Point -> Size ->+ -- RedrawMode -> Maybe Time -> IO Window+ , closeWindow -- :: Window -> IO ()+ , getWindowRect -- :: Window -> IO (Point,Point)+ , redrawWindow -- :: Window -> IO ()+ , directDraw -- :: Window -> Graphic -> IO ()++ , sendTicks, findWindow, showEvent+ ) where++import Graphics.HGL.Internals.Types+import Graphics.HGL.Internals.Draw (Graphic, Draw, unDraw)+import Graphics.HGL.Internals.Event+import qualified Graphics.HGL.Internals.Utilities as Utils+import qualified Graphics.HGL.Internals.Events as E+import Graphics.HGL.X11.Types+import Graphics.HGL.X11.Display+import Graphics.HGL.X11.DC+import qualified Graphics.HGL.X11.Timer as T++import qualified Graphics.X11.Xlib as X++import Control.Concurrent (forkIO, yield)+import Control.Concurrent.MVar (MVar, newMVar, takeMVar, putMVar, readMVar)+import Control.Exception (finally)+import Control.Monad (when)+import Data.Bits+import Data.IORef (IORef, newIORef, readIORef, writeIORef)+import Data.Maybe (isJust, fromJust, fromMaybe)+import System.IO.Unsafe (unsafePerformIO)++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++data Window = MkWindow + { wnd :: X.Window -- the real window+ , ref_dc :: MVar (Maybe DC) -- "device context"+ , exposed :: IORef Bool -- have we had an expose event yet?+ , events :: E.Events -- the event stream+ , graphic :: MVar Graphic -- the current graphic+ , redraw :: RedrawStuff+ , timer :: Maybe T.Timer+ }++openWindowEx :: Title -> Maybe Point -> Size -> + RedrawMode -> Maybe Time -> IO Window++closeWindow :: Window -> IO ()+getWindowRect :: Window -> IO (Point,Point)++redrawWindow :: Window -> IO ()+directDraw :: Window -> Graphic -> IO ()++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++----------------------------------------------------------------+-- Windows+----------------------------------------------------------------++closeWindow' :: Bool -> Window -> IO ()+closeWindow' destroyXWindow w = do+ mb_dc <- takeMVar (ref_dc w)+ case mb_dc of+ Just dc -> do+ putMVar (ref_dc w) Nothing -- mark it for dead+ X.freeGC (disp dc) (textGC dc)+ X.freeGC (disp dc) (paintGC dc)+ X.freeGC (disp dc) (brushGC dc)+ case (redraw w) of+ UnbufferedStuff -> return ()+ BufferedStuff gc _ ref_mbuffer -> do+ X.freeGC (disp dc) gc+ removeBuffer dc ref_mbuffer + when destroyXWindow $ do+ X.destroyWindow (disp dc) (drawable dc) -- ths dc had better hold a window!+ minor_eloop (disp dc)+ Nothing -> do+ putMVar (ref_dc w) Nothing++removeBuffer :: DC -> IORef (Maybe X.Pixmap) -> IO ()+removeBuffer dc ref_mbuffer = do+ mbuffer <- readIORef ref_mbuffer+ case mbuffer of+ Nothing -> return ()+ Just buffer -> X.freePixmap (disp dc) buffer+ writeIORef ref_mbuffer Nothing++removeDeadWindows :: IO ()+removeDeadWindows = do+ ws <- takeMVar wnds+ ws' <- remove ws []+ putMVar wnds ws'+ where+ remove [] r = return r+ remove (w:ws) r = do+ mb_dc <- readMVar (ref_dc w)+ if (isJust mb_dc) + then remove ws (w:r)+ else remove ws r++closeAllWindows :: IO ()+closeAllWindows = do+ ws <- readMVar wnds+ mapM_ (closeWindow' True) ws+ removeDeadWindows -- bring out your dead++sendTicks :: IO ()+sendTicks = do+ ws <- readMVar wnds+ sequence_ [ E.sendTick (events w) | w <- ws ]++-- persistent list of open windows+wnds :: MVar [Window]+wnds = unsafePerformIO (newMVar [])++-- persistent list of timers+timers :: T.Timers+timers = unsafePerformIO T.newTimers++runGraphicsEx :: String -> IO () -> IO ()+runGraphicsEx host m = do+ X.setDefaultErrorHandler+ display <- openDisplay host closeAllWindows+ T.clearTimers timers+-- color_map <- X.getStandardColormap display root X.a_RGB_BEST_MAP+ -- HN 2001-01-30+ -- There is a race condition here since the event loop terminates if it+ -- encounters an empty window list (in the global, imperative, variable+ -- wnds). Thus, if m has not yet opened a window (assuming it will!)+ -- when the event_loop is entered, it will exit immediately.+ -- Solution: wait until either the window list is non-empty, or until+ -- m exits (in case it does not open a window for some reason).+ mDone <- newIORef False+ forkIO (catchErrors m `finally` writeIORef mDone True)+ let loop = do+ yield+ ws <- readMVar wnds + d <- readIORef mDone+ if not (null ws) then+ main_eloop display+ else if not d then+ loop+ else+ return ()+ catchErrors loop+-- X.sync display True+ closeAllWindows+-- X.sync display True+ -- A final yield to make sure there's no threads thinking of+ -- accessing the display+ yield+ closeDisplay++catchErrors :: IO () -> IO ()+catchErrors m = do+ r <- Utils.safeTry m+ case r of+ Left e -> do+-- putStr "Uncaught Error: "+ print e + Right _ -> return ()+ return ()++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++openWindowEx name pos size redrawMode tickRate = do+ display <- getDisplay+ let+ corner@(X.Point x y) = fromPoint (fromMaybe (0,0) pos)+ (w,h) = fromSize size+ let screen = X.defaultScreenOfDisplay display+ fg_color = X.whitePixelOfScreen screen+ bg_color = X.blackPixelOfScreen screen+ depth = X.defaultDepthOfScreen screen+ root = X.rootWindowOfScreen screen+ visual = X.defaultVisualOfScreen screen++ -- ToDo: resurrect the old code for constructing attribute sets+ window <- X.allocaSetWindowAttributes $ \ attributes -> do+ X.set_background_pixel attributes bg_color + let event_mask = + ( X.buttonPressMask+ .|. X.buttonReleaseMask+ .|. X.keyPressMask+ .|. X.keyReleaseMask+ .|. X.pointerMotionMask+ .|. X.exposureMask+ .|. X.structureNotifyMask+ )+ X.set_event_mask attributes event_mask+ -- We use backing store to reduce the number of expose events due to+ -- raising/lowering windows.+ X.set_backing_store attributes X.whenMapped+ -- We use bit-gravity to avoid generating exposure events when a window is+ -- made smaller (they can't be avoided when the window is enlarged).+ -- The choice of NW is somewhat arbitrary but hopefully works often+ -- enough to be worth it.+ X.set_bit_gravity attributes X.northWestGravity+ let attrmask + = X.cWBackPixel + .|. X.cWEventMask + .|. X.cWBackingStore+ .|. X.cWBitGravity+ X.createWindow display root + x y -- x, y+ w h -- width, height+ 1 -- border_width+ depth -- use CopyFromParent??+ X.inputOutput+ visual -- use CopyFromParent??+ attrmask+ attributes++ -- AC, 1/9/2000: Tell the window manager that we want to use the+ -- DELETE_WINDOW protocol+ delWinAtom <- X.internAtom display "WM_DELETE_WINDOW" False+ X.setWMProtocols display window [delWinAtom]+ + X.setTextProperty display window name X.wM_ICON_NAME + X.setTextProperty display window name X.wM_NAME + X.mapWindow display window + X.raiseWindow display window++ text_gc <- X.createGC display window + X.setBackground display text_gc bg_color+ X.setForeground display text_gc fg_color++ pen_gc <- X.createGC display window + X.setBackground display pen_gc bg_color+ X.setForeground display pen_gc fg_color++ brush_gc <- X.createGC display window + X.setBackground display brush_gc bg_color+ X.setForeground display brush_gc fg_color++ redraw <- case redrawMode of+ Unbuffered -> return UnbufferedStuff+ DoubleBuffered -> do+ gc <- X.createGC display window+ X.setForeground display gc bg_color -- gc for clearing the screen+ ref_mbuffer <- newIORef Nothing+ return (BufferedStuff gc depth ref_mbuffer)++ win <- newWindow display window fg_color text_gc pen_gc brush_gc (corner,(w,h)) redraw tickRate++ -- It might be some time till we get back to the event loop+ -- so we try to process as many events as possible now.+ -- This is a bit of a hack and partly aimed at avoiding the bug that+ -- directDraw might try to draw something before the first expose event+ -- is processed.+ -- To make the hack even more effective, we wait a short time (allegedly+ -- 1uS) and synchronise before looking for the event.+ -- + -- NB:+ -- This whole thing is based on the implicit notion that the server thread+ -- is "lower priority" than the user threads. That is, the server thread+ -- will only run when no user threads are runnable. + --+ -- Or, more concretely, only the server thread calls yield so it's safe + -- to call the minor_eloop (which doesn't yield or block) but not the+ -- major_eloop because, amongst other things, it may yield or block.+ X.waitForEvent display 1+ X.sync display False+ minor_eloop display++ return win++closeWindow w = do+ closeWindow' True w+ removeDeadWindows -- bring out your dead++getWindowRect w = do+ mb_dc <- readMVar (ref_dc w)+ case mb_dc of + Just dc -> do + (pt,sz) <- readMVar (ref_rect dc)+ return (toPoint pt, toSize sz)+ Nothing -> + return ((0,0),(0,0)) -- ToDo?++-- main_eloop :: X.Display -> IO ()+-- main_eloop d =+-- X.allocaXEvent $ \ xevent -> do+-- let loop = do+-- -- X.sync d False -- wild attempt to fix the broken X connection problem+-- count <- X.pending d+-- if (count > 0) then do+-- -- X.sync d False -- wild attempt to fix the broken X connection problem+-- X.nextEvent d xevent+-- window <- X.get_Window xevent+-- wnd <- findWindow window+-- etype <- X.get_EventType xevent+-- -- print (window,etype)+-- dispatchEvent wnd etype xevent+-- ws <- readMVar wnds+-- unless (null ws) loop+-- else +-- loop+-- loop++-- This is the main event loop in the program+main_eloop :: X.Display -> IO ()+main_eloop d =+ X.allocaXEvent $ \ xevent -> do+ let handleEvent = do+ count <- X.pending d+ next <- T.nextTick timers+ if (count > 0 || not (isJust next))+ then do+ -- Event in queue or no tick pending.+ X.nextEvent d xevent+ window <- X.get_Window xevent+ etype <- X.get_EventType xevent+ -- showEvent etype+ withWindow window $ \ wnd -> do+ dispatchEvent d wnd etype xevent+ else do+ -- No event and tick pending.+ let delay = fromJust next+ t0 <- getTime+ timedOut <- X.waitForEvent d (fromIntegral (delay * 1000))+ t1 <- getTime+ T.fireTimers timers (t1 - t0)+ let + loop = do+ -- We yield at this point because we're (potentially) + -- about to block so we should give other threads a chance+ -- to run.+ yield+ ws <- readMVar wnds+ if (null ws) + then return ()+ else do+ handleEvent + loop+ loop++-- This event loop is the same as above except that it is +-- non-blocking: it only handles those events that have already arrived.+-- And this is important because it means we don't have to yield which+-- means it can safely be called by user code (see comment in openWindowEx).+minor_eloop :: X.Display -> IO ()+minor_eloop d =+ X.allocaXEvent $ \ xevent -> do+ let + handleEvent = do+ X.nextEvent d xevent+ window <- X.get_Window xevent+ etype <- X.get_EventType xevent+ -- print etype+ withWindow window $ \ wnd -> do+ dispatchEvent d wnd etype xevent+ return ()++ loop = do+ ws <- readMVar wnds+ if null ws+ then + return ()+ else do+ -- Note: _do not_ call pending if null ws+ count <- X.pending d+ if count == 0+ then return ()+ else do+ handleEvent + loop+ loop++-- The DC is wrapped inside (MVar (Maybe ...)) so that we can mark+-- windows as being dead the moment they die and so that we don't+-- try to keep writing to them afterwards.+-- The events remain valid after the window dies.+-- It might be wiser to clear all events(???) and start returning+-- Closed whenever events are read - or (more GC friendly?), when+-- first read occurs but block thereafter?++data RedrawStuff + = UnbufferedStuff+ | BufferedStuff+ X.GC -- GC with foreground = background_color+ Int -- depth+ (IORef (Maybe X.Pixmap)) -- The buffer, allocated on demand+ -- drawBuffered. ++drawOnDC :: DC -> Draw () -> RedrawStuff -> IO ()+drawOnDC dc p redraw = + case redraw of+ UnbufferedStuff -> drawUnbuffered dc p+ BufferedStuff gc depth ref_mbuffer -> drawBuffered dc p gc depth ref_mbuffer++newWindow :: X.Display -> X.Window -> X.Pixel -> X.GC -> X.GC -> X.GC -> (X.Point,(X.Dimension,X.Dimension)) -> RedrawStuff -> Maybe Time -> IO Window+newWindow display window fg_color tgc pgc bgc rect redraw tickRate = do+ es <- E.newEvents+ pic <- newMVar (return ())+-- failed attempts to find the default font+-- f' <- X.fontFromGC display tgc+-- f <- X.queryFont display f'+-- Since we can't ask the server what default font it chooses to bless+-- us with, we have to set an explicit font. + f <- X.loadQueryFont display "9x15" -- a random choice+ X.setFont display tgc (X.fontFromFontStruct f)+ bits <- newMVar DC_Bits+ { textColor = RGB 255 255 255+ , bkColor = RGB 0 0 0+ , bkMode = Transparent+ , textAlignment = (Left',Top)+ , brush = Brush (RGB 255 255 255)+ , pen = defaultPen fg_color+ , font = Font f+ }+ ref_rect <- newMVar rect+ dc <- newMVar (Just MkDC{disp=display,drawable=window,textGC=tgc,paintGC=pgc,brushGC=bgc,ref_rect=ref_rect,ref_bits=bits})+ timer <- case tickRate of+ Just t -> T.new timers t (E.sendTick es) >>= return.Just+ Nothing -> return Nothing+ ref_exposed <- newIORef False+ let wnd = MkWindow{wnd=window,ref_dc=dc,exposed=ref_exposed,events=es,graphic=pic,redraw=redraw,timer=timer}+ Utils.modMVar wnds (wnd:)+ return wnd++redrawWindow w = do+ canDraw <- readIORef (exposed w)+ when canDraw $ do+ mb_dc <- readMVar (ref_dc w)+ case mb_dc of+ Just dc -> do+ p <- readMVar (graphic w)+ drawOnDC dc p (redraw w)+ Nothing -> return ()++directDraw w p = do+ mb_dc <- readMVar (ref_dc w)+ canDraw <- readIORef (exposed w)+ when canDraw $ do+ case mb_dc of+ Just dc -> unDraw p dc+ Nothing -> return ()++findWindow :: X.Window -> IO Window+findWindow xw = do+ ws <- readMVar wnds+ return (head [ w | w <- ws, xw == wnd w ]) -- ToDo: don't use head++withWindow :: X.Window -> (Window -> IO ()) -> IO ()+withWindow xw k = do+ ws <- readMVar wnds+ case [ w | w <- ws, xw == wnd w ] of+ (w:_) -> k w+ _ -> return ()++send :: Window -> Event -> IO ()+send w e = E.sendEvent (events w) e++dispatchEvent :: X.Display -> Window -> X.EventType -> X.XEventPtr -> IO ()+dispatchEvent display w etype xevent + | etype == X.graphicsExpose || etype == X.expose+ = paint+ | etype == X.motionNotify+ = mouseMove+ | etype == X.buttonPress+ = button True+ | etype == X.buttonRelease+ = button False+ | etype == X.keyPress+ = key True+ | etype == X.keyRelease+ = key False+ | etype == X.configureNotify+ = reconfig+ | etype == X.destroyNotify+ = destroy+ -- AC, 1/9/2000: treat a ClientMesage as a destroy event+ -- TODO: really need to examine the event in more detail,+ -- and ensure that xevent.xclient.message_type==ATOM_WM_PROTOCOLS &&+ -- xevent.xclient.data.l[0]==ATOM_WM_DELETE_WINDOW+ -- where ATOM_XXX is obtained from XInternAtom(dpy,"XXX",False)+ | etype == X.clientMessage+ = destroy++ -- ToDo: consider printing a warning message+ | otherwise+ = return ()++ where++ -- Redrawing is awkward because the request comes as a number of+ -- separate events. We need to do one of the following (we currently+ -- do a combination of (1) and (3)):+ -- 1) Do a single redraw of the entire window but first delete all other+ -- expose events for this window from the queue.+ -- 2) Use all expose events for this window to build a Region object+ -- and use that to optimise redraws.+ -- 3) When double-buffering, use the buffer and information about+ -- whether it is up to date to serve redraws from the buffer.+ -- When single-buffering, use the server's backing store to reduce+ -- the number of expose events. (Combine with bit-gravity info to+ -- handle resize requests.)+ paint :: IO ()+ paint = do+ let + stompOnExposeEvents = do+-- X.get_ExposeEvent xevent >>= print+ gotOne <- X.checkTypedWindowEvent display (wnd w) X.expose xevent+ when gotOne stompOnExposeEvents+ writeIORef (exposed w) True -- now safe to draw directly+ stompOnExposeEvents+ p <- readMVar (graphic w)+ mb_dc <- readMVar (ref_dc w)+ case mb_dc of + Just dc -> drawOnDC dc p (redraw w)+ Nothing -> return ()++ button :: Bool -> IO ()+ button isDown = do+ (_,_,_,x,y,_,_,_,b,_) <- X.get_ButtonEvent xevent+ let isLeft = b == 1 -- assume that button 1 = left button+ send w Button{pt = (x,y), isLeft=isLeft, isDown=isDown}++-- An X KeySym is *not* a character; not even a Unicode character! And+-- since characters in Hugs only are 8-bit, we get a runtime error+-- below. There is an underlying assumption that key events only+-- involve characters. But of course there are function keys, arrow+-- keys, etc. too. While this will be a problem if one wants to get at+-- e.g. arrow keys (e.g. for some drawing application) or at+-- dead/multi-keys for doing proper input, we'll ignore them+-- completely for now. Furthermore, one really needs to call+-- XlookupString (not XkeysymToString!) to do the processing! We'll+-- ignore that too, and do a static mapping of just a few keysyms.++ key :: Bool -> IO ()+ key isDown =+ do+ -- Should really use XmbLookupString here to make compose work.+ -- It's OK to call X.lookupString both on key up and down events.+ -- Not true for X.mbLookupString. In that case, use e.g. X.lookup+ -- on key up events.+ (mks, s) <- X.lookupString (X.asKeyEvent xevent)+ case mks of+ Just ks -> send w (Key {keysym = MkKey ks, isDown = isDown})+ Nothing -> return ()+ if isDown then (mapM_ (\c -> send w (Char {char = c})) s) else return ()++ mouseMove ::IO ()+ mouseMove = do+ (_,_,_,x,y,_,_,_,_,_) <- X.get_MotionEvent xevent+ send w MouseMove{ pt = (x,y) }++ reconfig :: IO ()+ reconfig = do+ (x,y,width,height) <- X.get_ConfigureEvent xevent+ mb_dc <- readMVar (ref_dc w)+ case mb_dc of + Just dc -> do+ Utils.modMVar (ref_rect dc) (const ((X.Point x y),(width,height)))+ case (redraw w) of+ UnbufferedStuff -> return ()+ BufferedStuff _ _ ref_mbuffer -> removeBuffer dc ref_mbuffer+ Nothing -> return ()++ -- don't send new size, it may be out of date by the time we+ -- get round to reading the event+ send w Resize++ destroy :: IO ()+ destroy = do+ -- putStrLn "Window Destroyed" -- todo+ closeWindow' True w+ removeDeadWindows -- bring out your dead+ send w Closed++----------------------------------------------------------------+-- Utilities+----------------------------------------------------------------++-- Only for debugging++showEvent :: X.EventType -> IO ()+showEvent etype+ | etype == X.keyPress+ = putStrLn "keyPress"+ | etype == X.keyRelease+ = putStrLn "keyRelease"+ | etype == X.buttonPress+ = putStrLn "buttonPress"+ | etype == X.buttonRelease+ = putStrLn "buttonRelease"+ | etype == X.motionNotify+ = putStrLn "motionNotify"+ | etype == X.enterNotify+ = putStrLn "enterNotify"+ | etype == X.leaveNotify+ = putStrLn "leaveNotify"+ | etype == X.focusIn+ = putStrLn "focusIn"+ | etype == X.focusOut+ = putStrLn "focusOut"+ | etype == X.keymapNotify+ = putStrLn "keymapNotify"+ | etype == X.expose+ = putStrLn "expose"+ | etype == X.graphicsExpose+ = putStrLn "graphicsExpose"+ | etype == X.noExpose+ = putStrLn "noExpose"+ | etype == X.visibilityNotify+ = putStrLn "visibilityNotify"+ | etype == X.createNotify+ = putStrLn "createNotify"+ | etype == X.destroyNotify+ = putStrLn "destroyNotify"+ | etype == X.unmapNotify+ = putStrLn "unmapNotify"+ | etype == X.mapNotify+ = putStrLn "mapNotify"+ | etype == X.mapRequest+ = putStrLn "mapRequest"+ | etype == X.reparentNotify+ = putStrLn "reparentNotify"+ | etype == X.configureNotify+ = putStrLn "configureNotify"+ | etype == X.configureRequest+ = putStrLn "configureRequest"+ | etype == X.gravityNotify+ = putStrLn "gravityNotify"+ | etype == X.resizeRequest+ = putStrLn "resizeRequest"+ | etype == X.circulateNotify+ = putStrLn "circulateNotify"+ | etype == X.circulateRequest+ = putStrLn "circulateRequest"+ | etype == X.propertyNotify+ = putStrLn "propertyNotify"+ | etype == X.selectionClear+ = putStrLn "selectionClear"+ | etype == X.selectionRequest+ = putStrLn "selectionRequest"+ | etype == X.selectionNotify+ = putStrLn "selectionNotify"+ | etype == X.colormapNotify+ = putStrLn "colormapNotify"+ | etype == X.clientMessage+ = putStrLn "clientMessage"+ | etype == X.mappingNotify+ = putStrLn "mappingNotify"+ | etype == X.lASTEvent+ = putStrLn "lASTEvent"+ | otherwise+ = putStrLn ("Unknown X event type: " ++ show etype)++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ Graphics/SOE.hs view
@@ -0,0 +1,274 @@+-----------------------------------------------------------------------------+-- |+-- Module : Graphics.SOE+-- Copyright : (c) Alastair Reid, 1999-2003+-- License : BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer : libraries@haskell.org+-- Stability : stable+-- Portability : non-portable (requires concurrency)+--+-- The graphics library used in /The Haskell School of Expression/,+-- by Paul Hudak, cf <http://www.haskell.org/soe/>.+--+-- /Notes:/+--+-- * This module is called @SOEGraphics@ in the book. It is a cut+-- down version of "Graphics.HGL", with the interface frozen to match+-- the book.+--+-- * In chapters 13, 17 and 19 of the book, there are imports of modules+-- @Win32Misc@ and @Word@. These should be omitted, as 'timeGetTime'+-- and 'word32ToInt' are provided by this module.+-----------------------------------------------------------------------------++module Graphics.SOE+ (+ -- * Getting started+ runGraphics -- p41++ -- * Windows+ , Title -- p40+ , Size+ , Window+ , openWindow+ , getWindowSize -- not in SOE, but Resize is+ , clearWindow -- used on p127+ , drawInWindow -- p41+ , drawInWindowNow -- backward compatibility (p281)+ , setGraphic -- p168+ , closeWindow -- p41++ -- ** General windows+ , openWindowEx -- p168++ , RedrawMode -- SOE has (Graphic -> DrawFun)+ , drawGraphic -- p168+ , drawBufferedGraphic++ -- * Drawing+ , Graphic -- p41+ , emptyGraphic -- p171+ , overGraphic+ , overGraphics -- not in SOE, but an obvious extension++ -- ** Color+ , Color(..) -- p43+ , withColor++ -- ** Drawing text+ , text -- p41++ -- ** Drawing shapes+ , Point+ , ellipse -- p43+ , shearEllipse+ , line+ , polygon+ , polyline+ , polyBezier -- warning: becomes error message and polyline in X11++ , Angle -- not in SOE+ , arc -- not in SOE, but handy for pie charts++ -- ** Regions+ , Region -- p117+ , createRectangle+ , createEllipse+ , createPolygon+ , andRegion+ , orRegion+ , xorRegion+ , diffRegion+ , drawRegion++ -- * User interaction++ -- ** Keyboard events+ , getKey -- p41++ -- ** Mouse events+ , getLBP -- used on p127+ , getRBP -- not in SOE, but obvious++ -- ** General events+ , Event(..) -- p214+ , maybeGetWindowEvent -- p248+ , getWindowEvent -- not in SOE, but obvious++ -- * Time+ -- Timers that tick at regular intervals are set up by 'openWindowEx'.+ , Word32 -- p168+ , getWindowTick++ , timeGetTime -- from Win32+ , word32ToInt -- obsolete function from Data.Word++ ) where++import Graphics.HGL+ hiding (getKey, getKeyEx, openWindowEx,+ Event(..), getWindowEvent, maybeGetWindowEvent)+import qualified Graphics.HGL as HGL+import Control.Monad(liftM)+import Data.Word(Word32)++----------------------------------------------------------------+-- Interface+----------------------------------------------------------------++-- | A rectangular region, with the given points as opposite corners.+createRectangle :: Point -> Point -> Region++-- | A polygonal region defined by a list of 'Point's.+createPolygon :: [Point] -> Region++-- | An elliptical region that fits in the rectangle with the given points+-- as opposite corners.+createEllipse :: Point -> Point -> Region++-- | The union of two regions.+orRegion :: Region -> Region -> Region++-- | The intersection of two regions.+andRegion :: Region -> Region -> Region++-- | The part of the first region that is not also in the second.+diffRegion :: Region -> Region -> Region++-- | Draw a 'Region' in the current color.+drawRegion :: Region -> Graphic++-- | Another name for 'drawInWindow', retained for backwards compatibility.+drawInWindowNow :: Window -> Graphic -> IO ()++----------------------------------------------------------------+-- Implementation+----------------------------------------------------------------++-- | an extended version of 'openWindow'.+openWindowEx :: Title -- ^ the title of the window+ -> Maybe Point -- ^ the initial position of the window+ -> Maybe Size -- ^ the initial size of the window+ -> RedrawMode -- ^ how to display a graphic on the window+ -> Maybe Word32 -- ^ optionally attach a timer to the window,+ -- with the specified time (in milliseconds)+ -- between ticks.+ -> IO Window+openWindowEx a b (Just c) d e =+ HGL.openWindowEx a b c d (fmap fromIntegral e)+openWindowEx a b Nothing d e =+ HGL.openWindowEx a b (300,300) d (fmap fromIntegral e)++createRectangle = rectangleRegion+createEllipse = ellipseRegion+createPolygon = polygonRegion+orRegion = unionRegion+andRegion = intersectRegion+diffRegion = subtractRegion+drawRegion = regionToGraphic++-- backwards compatibility:++-- | Draw directly to the window+-- (slightly faster than 'drawBufferedGraphic', but more prone to flicker).+drawGraphic :: RedrawMode+drawGraphic = Unbuffered++-- | Use a /double buffer/ to reduce flicker and thus improve the look+-- of animations.+drawBufferedGraphic :: RedrawMode+drawBufferedGraphic = DoubleBuffered++-- should have a different way to specify background color+-- drawBufferedGraphicBC :: RGB -> RedrawMode++drawInWindowNow = drawInWindow++-- | The current time of day (in milliseconds).+timeGetTime :: IO Word32+timeGetTime = liftM integerToWord32 getTime++integerToWord32 :: Integer -> Word32+#ifdef __GLASGOW_HASKELL__+integerToWord32 = fromInteger -- conversion to Word32 doesn't overflow+#else+integerToWord32 n = fromInteger (n `mod` (toInteger (maxBound::Word32) + 1))+#endif++-- | An obsolete special case of 'fromIntegral'.+word32ToInt :: Word32 -> Int+word32ToInt = fromIntegral++----------------------------------------------------------------+-- Event, getKey, and maybeGetWindowEvent compatibility+----------------------------------------------------------------++{-+ The SOE sources are set in stone, so this module provides the interface+ SOE expects, even if the Graphics library moves on (cf. Event.Key).+-}++-- Deprecated SOE compatibility.++-- | Wait until a key is pressed and released,+-- and return the corresponding character.+getKey :: Window -> IO Char+getKey w = do { getKeyEx w True; getKeyEx w False }++-- | Wait until a key is pressed (if the second argument is 'True')+-- or released (otherwise), and return the corresponding character.+-- (not in SOE)+getKeyEx :: Window -> Bool -> IO Char+getKeyEx w down = loop+ where+ loop = do+ e <- HGL.getWindowEvent w+ case e of+ HGL.Key { HGL.keysym = k, HGL.isDown = isDown }+ | isDown == down && isCharKey k+ -> return (keyToChar k)+ _ -> loop++-- | Wait for the next event in the window.+getWindowEvent :: Window -> IO Event+getWindowEvent w = liftM toSOEEvent (HGL.getWindowEvent w)++-- | Return a pending eventin the window, if any.+maybeGetWindowEvent :: Window -> IO (Maybe Event)+maybeGetWindowEvent w = liftM (fmap toSOEEvent) (HGL.maybeGetWindowEvent w)++-- tiresome, but necessary.+toSOEEvent :: HGL.Event -> Event+toSOEEvent (HGL.Char x) = Key x True+toSOEEvent (HGL.Key k isDown) = Key (keyToChar k) isDown+toSOEEvent (HGL.Button pt left down) = Button pt left down+toSOEEvent (HGL.MouseMove p) = MouseMove p+toSOEEvent (HGL.Resize) = Resize+toSOEEvent (HGL.Closed) = Closed++-- | User interface events+data Event+ = Key+ { char :: Char -- ^ character corresponding to the key+ , isDown :: Bool -- ^ if 'True', the key was pressed;+ -- otherwise it was released+ } -- ^ occurs when a key was pressed or released.+ | Button+ { pt :: Point -- ^ the position of the mouse cursor+ , isLeft :: Bool -- ^ if 'True', it was the left button+ , isDown :: Bool -- ^ if 'True', the button was pressed;+ -- otherwise it was released+ } -- ^ occurs when a mouse button is pressed or released.+ | MouseMove+ { pt :: Point -- ^ the position of the mouse cursor+ } -- ^ occurs when the mouse is moved inside the window.+ | Resize -- ^ occurs when the window is resized.+ -- The new window size can be discovered using+ -- 'getWindowSize'.+ | Closed -- ^ occurs when the window is closed.+ deriving Show++----------------------------------------------------------------+-- End+----------------------------------------------------------------
+ HGL.buildinfo.in view
@@ -0,0 +1,5 @@+-- @configure_input@+-- System-dependent values used by Distribution.Simple.defaultUserHooks+--+buildable: @BUILD_PACKAGE_BOOL@+other-modules: @EXTRA_MODULES@
+ HGL.cabal view
@@ -0,0 +1,55 @@+name: HGL+version: 3.1+license: BSD3+license-file: LICENSE+author: Alastair Reid+maintainer: <libraries@haskell.org>+category: Graphics+build-depends: base, X11+synopsis: A simple graphics library based on X11 or Win32+description:+ A simple graphics library, designed to give the programmer access+ to most interesting parts of the Win32 Graphics Device Interface+ and X11 library without exposing the programmer to the pain and+ anguish usually associated with using these interfaces.+ .+ The library also includes a module Graphics.SOE providing the+ interface used in "The Haskell School of Expression", by Paul+ Hudak, cf <http://www.haskell.org/soe/>.+extra-source-files:+ configure.ac configure+ config.mk.in HGL.buildinfo.in include/HsHGLConfig.h.in+ Graphics/HGL/Win32/Bitmap.hs Graphics/HGL/Win32/Draw.hs+ Graphics/HGL/Win32/Types.hs Graphics/HGL/Win32/WND.hs+ Graphics/HGL/X11/Display.hs Graphics/HGL/X11/DC.hs+ Graphics/HGL/X11/Timer.hs Graphics/HGL/X11/Types.hs+ Graphics/HGL/X11/Window.hs+extra-tmp-files:+ config.log config.status autom4te.cache+ config.mk HGL.buildinfo include/HsHGLConfig.h+exposed-modules:+ Graphics.HGL.Core,+ Graphics.HGL.Draw,+ Graphics.HGL.Units,+ Graphics.HGL.Key,+ Graphics.HGL.Run,+ Graphics.HGL.Draw.Brush,+ Graphics.HGL.Draw.Font,+ Graphics.HGL.Draw.Monad,+ Graphics.HGL.Draw.Pen,+ Graphics.HGL.Draw.Picture,+ Graphics.HGL.Draw.Region,+ Graphics.HGL.Draw.Text,+ Graphics.HGL.Utils,+ Graphics.HGL.Window,+ Graphics.HGL,+ Graphics.SOE+other-modules:+ Graphics.HGL.Internals.Event,+ Graphics.HGL.Internals.Events,+ Graphics.HGL.Internals.Draw,+ Graphics.HGL.Internals.Types,+ Graphics.HGL.Internals.Flag,+ Graphics.HGL.Internals.Utilities+extensions: CPP+include-dirs: include
+ LICENSE view
@@ -0,0 +1,26 @@+The Haskell Graphics Library is Copyright (c) Alastair Reid,+1996-2003, All rights reserved, and is distributed as free software+under the following license.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:++- Redistributions of source code must retain the above copyright notice,+this list of conditions and the following disclaimer.++- Neither name of the copyright holders nor the names of its+contributors may be used to endorse or promote products derived from+this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+HOLDERS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,6 @@+module Main (main) where++import Distribution.Simple (defaultMainWithHooks, defaultUserHooks)++main :: IO ()+main = defaultMainWithHooks defaultUserHooks
+ config.mk.in view
@@ -0,0 +1,7 @@+HGL_BUILD_PACKAGE=@HGL_BUILD_PACKAGE@+ifneq "$(HGL_BUILD_PACKAGE)" "no"+PLATFORM=@PLATFORM@+PACKAGE=@PACKAGE_TARNAME@+VERSION=@PACKAGE_VERSION@+MAINTAINER=@PACKAGE_BUGREPORT@+endif
+ configure view
@@ -0,0 +1,5140 @@+#! /bin/sh+# Guess values for system-dependent variables and create Makefiles.+# Generated by GNU Autoconf 2.57 for Haskell Graphics Library 3.1.+#+# Report bugs to <libraries@haskell.org>.+#+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002+# 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 Bourne compatible+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then+ emulate sh+ NULLCMD=:+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which+ # is contrary to our usage. Disable this feature.+ alias -g '${1+"$@"}'='"$@"'+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then+ set -o posix+fi++# Support unset when possible.+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then+ as_unset=unset+else+ as_unset=false+fi+++# Work around bugs in pre-3.0 UWIN ksh.+$as_unset ENV MAIL MAILPATH+PS1='$ '+PS2='> '+PS4='+ '++# NLS nuisances.+for as_var in \+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \+ LC_TELEPHONE LC_TIME+do+ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then+ eval $as_var=C; export $as_var+ else+ $as_unset $as_var+ fi+done++# Required to use basename.+if expr a : '\(a\)' >/dev/null 2>&1; 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+++# Name of the executable.+as_me=`$as_basename "$0" ||+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \+ X"$0" : 'X\(//\)$' \| \+ X"$0" : 'X\(/\)$' \| \+ . : '\(.\)' 2>/dev/null ||+echo X/"$0" |+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }+ /^X\/\(\/\/\)$/{ s//\1/; q; }+ /^X\/\(\/\).*/{ s//\1/; q; }+ s/.*/./; q'`+++# PATH needs CR, and LINENO needs CR and PATH.+# 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++# The user is always right.+if test "${PATH_SEPARATOR+set}" != set; then+ echo "#! /bin/sh" >conf$$.sh+ echo "exit 0" >>conf$$.sh+ chmod +x conf$$.sh+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then+ PATH_SEPARATOR=';'+ else+ PATH_SEPARATOR=:+ fi+ rm -f conf$$.sh+fi+++ as_lineno_1=$LINENO+ as_lineno_2=$LINENO+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`+ test "x$as_lineno_1" != "x$as_lineno_2" &&+ test "x$as_lineno_3" = "x$as_lineno_2" || {+ # Find who we are. Look in the path if we contain no path at all+ # relative or not.+ 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++ ;;+ 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+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2+ { (exit 1); exit 1; }; }+ fi+ case $CONFIG_SHELL in+ '')+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH+do+ IFS=$as_save_IFS+ test -z "$as_dir" && as_dir=.+ for as_base in sh bash ksh sh5; do+ case $as_dir in+ /*)+ if ("$as_dir/$as_base" -c '+ as_lineno_1=$LINENO+ as_lineno_2=$LINENO+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`+ test "x$as_lineno_1" != "x$as_lineno_2" &&+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }+ CONFIG_SHELL=$as_dir/$as_base+ export CONFIG_SHELL+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}+ fi;;+ esac+ done+done+;;+ esac++ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO+ # uniformly replaced by the line number. The first 'sed' inserts a+ # line-number line before each line; the second 'sed' does the real+ # work. The second script uses 'N' to pair each line-number line+ # with the numbered line, and appends trailing '-' during+ # substitution so that $LINENO is not a special case at line end.+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)+ sed '=' <$as_myself |+ sed '+ N+ s,$,-,+ : loop+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,+ t loop+ s,-$,,+ s,^['$as_cr_digits']*\n,,+ ' >$as_me.lineno &&+ chmod +x $as_me.lineno ||+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2+ { (exit 1); exit 1; }; }++ # 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 sensible to this).+ . ./$as_me.lineno+ # Exit status is that of the last command.+ exit+}+++case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in+ *c*,-n*) ECHO_N= ECHO_C='+' ECHO_T=' ' ;;+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;+esac++if expr a : '\(a\)' >/dev/null 2>&1; then+ as_expr=expr+else+ as_expr=false+fi++rm -f conf$$ conf$$.exe conf$$.file+echo >conf$$.file+if ln -s conf$$.file conf$$ 2>/dev/null; then+ # We could just check for DJGPP; but this test a) works b) is more generic+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).+ if test -f conf$$.exe; then+ # Don't use ln at all; we don't have any links+ as_ln_s='cp -p'+ else+ as_ln_s='ln -s'+ fi+elif ln conf$$.file conf$$ 2>/dev/null; then+ as_ln_s=ln+else+ as_ln_s='cp -p'+fi+rm -f conf$$ conf$$.exe conf$$.file++if mkdir -p . 2>/dev/null; then+ as_mkdir_p=:+else+ as_mkdir_p=false+fi++as_executable_p="test -f"++# Sed expression to map a string onto a valid CPP name.+as_tr_cpp="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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"+++# IFS+# We need space, tab and new line, in precisely that order.+as_nl='+'+IFS=" $as_nl"++# CDPATH.+$as_unset CDPATH+++# Name of the host.+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,+# so uname gets run too.+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`++exec 6>&1++#+# Initializations.+#+ac_default_prefix=/usr/local+ac_config_libobj_dir=.+cross_compiling=no+subdirs=+MFLAGS=+MAKEFLAGS=+SHELL=${CONFIG_SHELL-/bin/sh}++# Maximum number of lines to put in a shell here document.+# This variable seems obsolete. It should probably be removed, and+# only ac_max_sed_lines should be used.+: ${ac_max_here_lines=38}++# Identity of this package.+PACKAGE_NAME='Haskell Graphics Library'+PACKAGE_TARNAME='HGL'+PACKAGE_VERSION='3.1'+PACKAGE_STRING='Haskell Graphics Library 3.1'+PACKAGE_BUGREPORT='libraries@haskell.org'++ac_unique_file="Graphics/HGL.hs"+# Factoring default headers for most tests.+ac_includes_default="\+#include <stdio.h>+#if HAVE_SYS_TYPES_H+# include <sys/types.h>+#endif+#if HAVE_SYS_STAT_H+# include <sys/stat.h>+#endif+#if STDC_HEADERS+# include <stdlib.h>+# include <stddef.h>+#else+# if HAVE_STDLIB_H+# include <stdlib.h>+# endif+#endif+#if HAVE_STRING_H+# if !STDC_HEADERS && HAVE_MEMORY_H+# include <memory.h>+# endif+# include <string.h>+#endif+#if HAVE_STRINGS_H+# include <strings.h>+#endif+#if HAVE_INTTYPES_H+# include <inttypes.h>+#else+# if HAVE_STDINT_H+# include <stdint.h>+# endif+#endif+#if HAVE_UNISTD_H+# include <unistd.h>+#endif"++ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS EGREP HGL_BUILD_PACKAGE PLATFORM EXTRA_MODULES BUILD_PACKAGE_BOOL LIBOBJS LTLIBOBJS'+ac_subst_files=''++# Initialize some variables set by options.+ac_init_help=+ac_init_version=false+# 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.+bindir='${exec_prefix}/bin'+sbindir='${exec_prefix}/sbin'+libexecdir='${exec_prefix}/libexec'+datadir='${prefix}/share'+sysconfdir='${prefix}/etc'+sharedstatedir='${prefix}/com'+localstatedir='${prefix}/var'+libdir='${exec_prefix}/lib'+includedir='${prefix}/include'+oldincludedir='/usr/include'+infodir='${prefix}/info'+mandir='${prefix}/man'++ac_prev=+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++ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`++ # Accept the important Cygnus configure options, so we can diagnose typos.++ case $ac_option in++ -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 | --data | --dat | --da)+ ac_prev=datadir ;;+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \+ | --da=*)+ datadir=$ac_optarg ;;++ -disable-* | --disable-*)+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2+ { (exit 1); exit 1; }; }+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`+ eval "enable_$ac_feature=no" ;;++ -enable-* | --enable-*)+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2+ { (exit 1); exit 1; }; }+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`+ case $ac_option in+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;+ *) ac_optarg=yes ;;+ esac+ eval "enable_$ac_feature='$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 ;;++ -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 ;;++ -localstatedir | --localstatedir | --localstatedi | --localstated \+ | --localstate | --localstat | --localsta | --localst \+ | --locals | --local | --loca | --loc | --lo)+ ac_prev=localstatedir ;;+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)+ 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 ;;++ -q | -quiet | --quiet | --quie | --qui | --qu | --q \+ | -silent | --silent | --silen | --sile | --sil)+ silent=yes ;;++ -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&+ { echo "$as_me: error: invalid package name: $ac_package" >&2+ { (exit 1); exit 1; }; }+ ac_package=`echo $ac_package| sed 's/-/_/g'`+ case $ac_option in+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;+ *) ac_optarg=yes ;;+ esac+ eval "with_$ac_package='$ac_optarg'" ;;++ -without-* | --without-*)+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`+ # Reject names that are not valid shell variable names.+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&+ { echo "$as_me: error: invalid package name: $ac_package" >&2+ { (exit 1); exit 1; }; }+ ac_package=`echo $ac_package | sed 's/-/_/g'`+ eval "with_$ac_package=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 ;;++ -*) { echo "$as_me: error: unrecognized option: $ac_option+Try \`$0 --help' for more information." >&2+ { (exit 1); exit 1; }; }+ ;;++ *=*)+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`+ # Reject names that are not valid shell variable names.+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2+ { (exit 1); exit 1; }; }+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`+ eval "$ac_envvar='$ac_optarg'"+ export $ac_envvar ;;++ *)+ # FIXME: should be removed in autoconf 3.0.+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&+ 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'`+ { echo "$as_me: error: missing argument to $ac_option" >&2+ { (exit 1); exit 1; }; }+fi++# Be sure to have absolute paths.+for ac_var in exec_prefix prefix+do+ eval ac_val=$`echo $ac_var`+ case $ac_val in+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2+ { (exit 1); exit 1; }; };;+ esac+done++# Be sure to have absolute paths.+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \+ localstatedir libdir includedir oldincludedir infodir mandir+do+ eval ac_val=$`echo $ac_var`+ case $ac_val in+ [\\/$]* | ?:[\\/]* ) ;;+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2+ { (exit 1); exit 1; }; };;+ esac+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+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.+ If a cross compiler is detected then cross compile mode will be used." >&2+ 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+++# 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 its parent.+ ac_confdir=`(dirname "$0") 2>/dev/null ||+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$0" : 'X\(//\)[^/]' \| \+ X"$0" : 'X\(//\)$' \| \+ X"$0" : 'X\(/\)' \| \+ . : '\(.\)' 2>/dev/null ||+echo X"$0" |+ 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+ if test "$ac_srcdir_defaulted" = yes; then+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2+ { (exit 1); exit 1; }; }+ else+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2+ { (exit 1); exit 1; }; }+ fi+fi+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2+ { (exit 1); exit 1; }; }+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`+ac_env_build_alias_set=${build_alias+set}+ac_env_build_alias_value=$build_alias+ac_cv_env_build_alias_set=${build_alias+set}+ac_cv_env_build_alias_value=$build_alias+ac_env_host_alias_set=${host_alias+set}+ac_env_host_alias_value=$host_alias+ac_cv_env_host_alias_set=${host_alias+set}+ac_cv_env_host_alias_value=$host_alias+ac_env_target_alias_set=${target_alias+set}+ac_env_target_alias_value=$target_alias+ac_cv_env_target_alias_set=${target_alias+set}+ac_cv_env_target_alias_value=$target_alias+ac_env_CC_set=${CC+set}+ac_env_CC_value=$CC+ac_cv_env_CC_set=${CC+set}+ac_cv_env_CC_value=$CC+ac_env_CFLAGS_set=${CFLAGS+set}+ac_env_CFLAGS_value=$CFLAGS+ac_cv_env_CFLAGS_set=${CFLAGS+set}+ac_cv_env_CFLAGS_value=$CFLAGS+ac_env_LDFLAGS_set=${LDFLAGS+set}+ac_env_LDFLAGS_value=$LDFLAGS+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}+ac_cv_env_LDFLAGS_value=$LDFLAGS+ac_env_CPPFLAGS_set=${CPPFLAGS+set}+ac_env_CPPFLAGS_value=$CPPFLAGS+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}+ac_cv_env_CPPFLAGS_value=$CPPFLAGS+ac_env_CPP_set=${CPP+set}+ac_env_CPP_value=$CPP+ac_cv_env_CPP_set=${CPP+set}+ac_cv_env_CPP_value=$CPP++#+# 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 Graphics Library 3.1 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 \`..']++_ACEOF++ cat <<_ACEOF+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]+ --datadir=DIR read-only architecture-independent data [PREFIX/share]+ --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]+ --libdir=DIR object code libraries [EPREFIX/lib]+ --includedir=DIR C header files [PREFIX/include]+ --oldincludedir=DIR C header files for non-gcc [/usr/include]+ --infodir=DIR info documentation [PREFIX/info]+ --mandir=DIR man documentation [PREFIX/man]+_ACEOF++ cat <<\_ACEOF++X features:+ --x-includes=DIR X include files are in DIR+ --x-libraries=DIR X library files are in DIR+_ACEOF+fi++if test -n "$ac_init_help"; then+ case $ac_init_help in+ short | recursive ) echo "Configuration of Haskell Graphics Library 3.1:";;+ esac+ cat <<\_ACEOF++Optional Features:+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]+ --enable-hgl build HGL. (default=autodetect)++Optional Packages:+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)+ --with-x use the X Window System++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>+ CPPFLAGS 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+fi++if test "$ac_init_help" = "recursive"; then+ # If there are subdirs, report their specific --help.+ ac_popdir=`pwd`+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue+ test -d $ac_dir || continue+ ac_builddir=.++if test "$ac_dir" != .; then+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`+ # A "../" for each directory in $ac_dir_suffix.+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`+else+ ac_dir_suffix= ac_top_builddir=+fi++case $srcdir in+ .) # No --srcdir option. We are building in place.+ ac_srcdir=.+ if test -z "$ac_top_builddir"; then+ ac_top_srcdir=.+ else+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`+ fi ;;+ [\\/]* | ?:[\\/]* ) # Absolute path.+ ac_srcdir=$srcdir$ac_dir_suffix;+ ac_top_srcdir=$srcdir ;;+ *) # Relative path.+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix+ ac_top_srcdir=$ac_top_builddir$srcdir ;;+esac+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be+# absolute.+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`++ cd $ac_dir+ # Check for guested configure; otherwise get Cygnus style 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+ elif test -f $ac_srcdir/configure.ac ||+ test -f $ac_srcdir/configure.in; then+ echo+ $ac_configure --help+ else+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2+ fi+ cd $ac_popdir+ done+fi++test -n "$ac_init_help" && exit 0+if $ac_init_version; then+ cat <<\_ACEOF+Haskell Graphics Library configure 3.1+generated by GNU Autoconf 2.57++Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002+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 0+fi+exec 5>config.log+cat >&5 <<_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 Graphics Library $as_me 3.1, which was+generated by GNU Autoconf 2.57. Invocation command line was++ $ $0 $@++_ACEOF+{+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`+hostinfo = `(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=.+ echo "PATH: $as_dir"+done++} >&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_sep=+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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;+ esac+ case $ac_pass in+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;+ 2)+ ac_configure_args1="$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+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"+ # Get rid of the leading space.+ ac_sep=" "+ ;;+ esac+ done+done+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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: Be sure not to use single quotes in there, as some shells,+# such as our DU 5.0 friend, will then `close' the trap.+trap 'exit_status=$?+ # Save into config.log some information that might help in debugging.+ {+ echo++ cat <<\_ASBOX+## ---------------- ##+## Cache variables. ##+## ---------------- ##+_ASBOX+ echo+ # The following way of writing the cache mishandles newlines in values,+{+ (set) 2>&1 |+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in+ *ac_space=\ *)+ sed -n \+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"+ ;;+ *)+ sed -n \+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"+ ;;+ esac;+}+ echo++ cat <<\_ASBOX+## ----------------- ##+## Output variables. ##+## ----------------- ##+_ASBOX+ echo+ for ac_var in $ac_subst_vars+ do+ eval ac_val=$`echo $ac_var`+ echo "$ac_var='"'"'$ac_val'"'"'"+ done | sort+ echo++ if test -n "$ac_subst_files"; then+ cat <<\_ASBOX+## ------------- ##+## Output files. ##+## ------------- ##+_ASBOX+ echo+ for ac_var in $ac_subst_files+ do+ eval ac_val=$`echo $ac_var`+ echo "$ac_var='"'"'$ac_val'"'"'"+ done | sort+ echo+ fi++ if test -s confdefs.h; then+ cat <<\_ASBOX+## ----------- ##+## confdefs.h. ##+## ----------- ##+_ASBOX+ echo+ sed "/^$/d" confdefs.h | sort+ echo+ fi+ test "$ac_signal" != 0 &&+ echo "$as_me: caught signal $ac_signal"+ echo "$as_me: exit $exit_status"+ } >&5+ rm -f core core.* *.core &&+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&+ exit $exit_status+ ' 0+for ac_signal in 1 2 13 15; do+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal+done+ac_signal=0++# confdefs.h avoids OS command line length limits that DEFS can exceed.+rm -rf conftest* confdefs.h+# AIX cpp loses on an empty file, so make sure it contains at least a newline.+echo >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+++# Let the site file select an alternate cache file if it wants to.+# Prefer explicitly selected file to automatically selected ones.+if test -z "$CONFIG_SITE"; then+ if test "x$prefix" != xNONE; then+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"+ else+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"+ fi+fi+for ac_site_file in $CONFIG_SITE; do+ if test -r "$ac_site_file"; then+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5+echo "$as_me: loading site script $ac_site_file" >&6;}+ sed 's/^/| /' "$ac_site_file" >&5+ . "$ac_site_file"+ 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.+ if test -f "$cache_file"; then+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5+echo "$as_me: loading cache $cache_file" >&6;}+ case $cache_file in+ [\\/]* | ?:[\\/]* ) . $cache_file;;+ *) . ./$cache_file;;+ esac+ fi+else+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5+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 `(set) 2>&1 |+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,)+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}+ ac_cache_corrupted=: ;;+ ,set)+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5+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+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5+echo "$as_me: former value: $ac_old_val" >&2;}+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5+echo "$as_me: current value: $ac_new_val" >&2;}+ ac_cache_corrupted=:+ fi;;+ esac+ # Pass precious variables to config.status.+ if test "$ac_new_set" = set; then+ case $ac_new_val in+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)+ ac_arg=$ac_var=`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.+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;+ esac+ fi+done+if $ac_cache_corrupted; then+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5+echo "$as_me: error: changes in the environment can compromise the build" >&2;}+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}+ { (exit 1); exit 1; }; }+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+++++++++++++++++++++++++++++# Check whether --enable-hgl or --disable-hgl was given.+if test "${enable_hgl+set}" = set; then+ enableval="$enable_hgl"+ enable_hgl=$enableval+else+ enable_hgl=yes+fi;+++if test "$enable_hgl" = no; then+ HGL_BUILD_PACKAGE=no+else+# Safety check: Ensure that we are in the correct source directory.+++ ac_config_headers="$ac_config_headers include/HsHGLConfig.h"+++# Check for X11 include paths and libraries+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+echo "$as_me:$LINENO: checking for $ac_word" >&5+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6+if test "${ac_cv_prog_CC+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_CC="${ac_tool_prefix}gcc"+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+done++fi+fi+CC=$ac_cv_prog_CC+if test -n "$CC"; then+ echo "$as_me:$LINENO: result: $CC" >&5+echo "${ECHO_T}$CC" >&6+else+ echo "$as_me:$LINENO: result: no" >&5+echo "${ECHO_T}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+echo "$as_me:$LINENO: checking for $ac_word" >&5+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_ac_ct_CC="gcc"+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+done++fi+fi+ac_ct_CC=$ac_cv_prog_ac_ct_CC+if test -n "$ac_ct_CC"; then+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5+echo "${ECHO_T}$ac_ct_CC" >&6+else+ echo "$as_me:$LINENO: result: no" >&5+echo "${ECHO_T}no" >&6+fi++ CC=$ac_ct_CC+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+echo "$as_me:$LINENO: checking for $ac_word" >&5+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6+if test "${ac_cv_prog_CC+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_CC="${ac_tool_prefix}cc"+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+done++fi+fi+CC=$ac_cv_prog_CC+if test -n "$CC"; then+ echo "$as_me:$LINENO: result: $CC" >&5+echo "${ECHO_T}$CC" >&6+else+ echo "$as_me:$LINENO: result: no" >&5+echo "${ECHO_T}no" >&6+fi++fi+if test -z "$ac_cv_prog_CC"; then+ ac_ct_CC=$CC+ # Extract the first word of "cc", so it can be a program name with args.+set dummy cc; ac_word=$2+echo "$as_me:$LINENO: checking for $ac_word" >&5+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_ac_ct_CC="cc"+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+done++fi+fi+ac_ct_CC=$ac_cv_prog_ac_ct_CC+if test -n "$ac_ct_CC"; then+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5+echo "${ECHO_T}$ac_ct_CC" >&6+else+ echo "$as_me:$LINENO: result: no" >&5+echo "${ECHO_T}no" >&6+fi++ CC=$ac_ct_CC+else+ CC="$ac_cv_prog_CC"+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+echo "$as_me:$LINENO: checking for $ac_word" >&5+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6+if test "${ac_cv_prog_CC+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&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_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"+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+done++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+ echo "$as_me:$LINENO: result: $CC" >&5+echo "${ECHO_T}$CC" >&6+else+ echo "$as_me:$LINENO: result: no" >&5+echo "${ECHO_T}no" >&6+fi++fi+if test -z "$CC"; then+ if test -n "$ac_tool_prefix"; then+ for ac_prog in cl+ 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+echo "$as_me:$LINENO: checking for $ac_word" >&5+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6+if test "${ac_cv_prog_CC+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+done++fi+fi+CC=$ac_cv_prog_CC+if test -n "$CC"; then+ echo "$as_me:$LINENO: result: $CC" >&5+echo "${ECHO_T}$CC" >&6+else+ echo "$as_me:$LINENO: result: no" >&5+echo "${ECHO_T}no" >&6+fi++ test -n "$CC" && break+ done+fi+if test -z "$CC"; then+ ac_ct_CC=$CC+ for ac_prog in cl+do+ # Extract the first word of "$ac_prog", so it can be a program name with args.+set dummy $ac_prog; ac_word=$2+echo "$as_me:$LINENO: checking for $ac_word" >&5+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_ac_ct_CC="$ac_prog"+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+done++fi+fi+ac_ct_CC=$ac_cv_prog_ac_ct_CC+if test -n "$ac_ct_CC"; then+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5+echo "${ECHO_T}$ac_ct_CC" >&6+else+ echo "$as_me:$LINENO: result: no" >&5+echo "${ECHO_T}no" >&6+fi++ test -n "$ac_ct_CC" && break+done++ CC=$ac_ct_CC+fi++fi+++test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH+See \`config.log' for more details." >&5+echo "$as_me: error: no acceptable C compiler found in \$PATH+See \`config.log' for more details." >&2;}+ { (exit 1); exit 1; }; }++# Provide some information about the compiler.+echo "$as_me:$LINENO:" \+ "checking for C compiler version" >&5+ac_compiler=`set X $ac_compile; echo $2`+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5+ (eval $ac_compiler --version </dev/null >&5) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5+ (eval $ac_compiler -v </dev/null >&5) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5+ (eval $ac_compiler -V </dev/null >&5) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }++cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+ac_clean_files_save=$ac_clean_files+ac_clean_files="$ac_clean_files a.out 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.+echo "$as_me:$LINENO: checking for C compiler default output" >&5+echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5+ (eval $ac_link_default) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; then+ # Find the output, starting from the most likely. This scheme is+# not robust to junk in `.', hence go to wildcards (a.*) only as a last+# resort.++# Be careful to initialize this variable, since it used to be cached.+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.+ac_cv_exeext=+# b.out is created by i960 compilers.+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out+do+ test -f "$ac_file" || continue+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )+ ;;+ conftest.$ac_ext )+ # This is the source file.+ ;;+ [ab].out )+ # We found the default executable, but exeext='' is most+ # certainly right.+ break;;+ *.* )+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`+ # FIXME: I believe we export ac_cv_exeext for Libtool,+ # but it would be cool to find out if it's true. Does anybody+ # maintain Libtool? --akim.+ export ac_cv_exeext+ break;;+ * )+ break;;+ esac+done+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++{ { echo "$as_me:$LINENO: error: C compiler cannot create executables+See \`config.log' for more details." >&5+echo "$as_me: error: C compiler cannot create executables+See \`config.log' for more details." >&2;}+ { (exit 77); exit 77; }; }+fi++ac_exeext=$ac_cv_exeext+echo "$as_me:$LINENO: result: $ac_file" >&5+echo "${ECHO_T}$ac_file" >&6++# Check the compiler produces executables we can run. If not, either+# the compiler is broken, or we cross compile.+echo "$as_me:$LINENO: checking whether the C compiler works" >&5+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0+# If not cross compiling, check that we can run a simple program.+if test "$cross_compiling" != yes; then+ if { ac_try='./$ac_file'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ cross_compiling=no+ else+ if test "$cross_compiling" = maybe; then+ cross_compiling=yes+ else+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.+If you meant to cross compile, use \`--host'.+See \`config.log' for more details." >&5+echo "$as_me: error: cannot run C compiled programs.+If you meant to cross compile, use \`--host'.+See \`config.log' for more details." >&2;}+ { (exit 1); exit 1; }; }+ fi+ fi+fi+echo "$as_me:$LINENO: result: yes" >&5+echo "${ECHO_T}yes" >&6++rm -f a.out a.exe conftest$ac_cv_exeext b.out+ac_clean_files=$ac_clean_files_save+# Check the compiler produces executables we can run. If not, either+# the compiler is broken, or we cross compile.+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6+echo "$as_me:$LINENO: result: $cross_compiling" >&5+echo "${ECHO_T}$cross_compiling" >&6++echo "$as_me:$LINENO: checking for suffix of executables" >&5+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; 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 | *.o | *.obj ) ;;+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`+ export ac_cv_exeext+ break;;+ * ) break;;+ esac+done+else+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link+See \`config.log' for more details." >&5+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link+See \`config.log' for more details." >&2;}+ { (exit 1); exit 1; }; }+fi++rm -f conftest$ac_cv_exeext+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5+echo "${ECHO_T}$ac_cv_exeext" >&6++rm -f conftest.$ac_ext+EXEEXT=$ac_cv_exeext+ac_exeext=$EXEEXT+echo "$as_me:$LINENO: checking for suffix of object files" >&5+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6+if test "${ac_cv_objext+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.o conftest.obj+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; then+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do+ case $ac_file in+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`+ break;;+ esac+done+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile+See \`config.log' for more details." >&5+echo "$as_me: error: cannot compute suffix of object files: cannot compile+See \`config.log' for more details." >&2;}+ { (exit 1); exit 1; }; }+fi++rm -f conftest.$ac_cv_objext conftest.$ac_ext+fi+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5+echo "${ECHO_T}$ac_cv_objext" >&6+OBJEXT=$ac_cv_objext+ac_objext=$OBJEXT+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6+if test "${ac_cv_c_compiler_gnu+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++int+main ()+{+#ifndef __GNUC__+ choke me+#endif++ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest.$ac_objext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_compiler_gnu=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_compiler_gnu=no+fi+rm -f conftest.$ac_objext conftest.$ac_ext+ac_cv_c_compiler_gnu=$ac_compiler_gnu++fi+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6+GCC=`test $ac_compiler_gnu = yes && echo yes`+ac_test_CFLAGS=${CFLAGS+set}+ac_save_CFLAGS=$CFLAGS+CFLAGS="-g"+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6+if test "${ac_cv_prog_cc_g+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest.$ac_objext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_prog_cc_g=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_prog_cc_g=no+fi+rm -f conftest.$ac_objext conftest.$ac_ext+fi+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5+echo "${ECHO_T}$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+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6+if test "${ac_cv_prog_cc_stdc+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_cv_prog_cc_stdc=no+ac_save_CC=$CC+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <stdarg.h>+#include <stdio.h>+#include <sys/types.h>+#include <sys/stat.h>+/* 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;+}+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+# Don't try gcc -ansi; that turns off useful extensions and+# breaks some systems' header files.+# AIX -qlanglvl=ansi+# Ultrix and OSF/1 -std1+# HP-UX 10.20 and later -Ae+# HP-UX older versions -Aa -D_HPUX_SOURCE+# SVR4 -Xc -D__EXTENSIONS__+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"+do+ CC="$ac_save_CC $ac_arg"+ rm -f conftest.$ac_objext+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest.$ac_objext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_prog_cc_stdc=$ac_arg+break+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++fi+rm -f conftest.$ac_objext+done+rm -f conftest.$ac_ext conftest.$ac_objext+CC=$ac_save_CC++fi++case "x$ac_cv_prog_cc_stdc" in+ x|xno)+ echo "$as_me:$LINENO: result: none needed" >&5+echo "${ECHO_T}none needed" >&6 ;;+ *)+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6+ CC="$CC $ac_cv_prog_cc_stdc" ;;+esac++# Some people use a C++ compiler to compile C. Since we use `exit',+# in C++ we need to declare it. In case someone uses the same compiler+# for both compiling C and C++ we need to have the C++ compiler decide+# the declaration of exit, since it's the most demanding environment.+cat >conftest.$ac_ext <<_ACEOF+#ifndef __cplusplus+ choke me+#endif+_ACEOF+rm -f conftest.$ac_objext+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest.$ac_objext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ for ac_declaration in \+ ''\+ '#include <stdlib.h>' \+ 'extern "C" void std::exit (int) throw (); using std::exit;' \+ 'extern "C" void std::exit (int); using std::exit;' \+ 'extern "C" void exit (int) throw ();' \+ 'extern "C" void exit (int);' \+ 'void exit (int);'+do+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <stdlib.h>+$ac_declaration+int+main ()+{+exit (42);+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest.$ac_objext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ :+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++continue+fi+rm -f conftest.$ac_objext conftest.$ac_ext+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+$ac_declaration+int+main ()+{+exit (42);+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest.$ac_objext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ break+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++fi+rm -f conftest.$ac_objext conftest.$ac_ext+done+rm -f conftest*+if test -n "$ac_declaration"; then+ echo '#ifdef __cplusplus' >>confdefs.h+ echo $ac_declaration >>confdefs.h+ echo '#endif' >>confdefs.h+fi++else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++fi+rm -f conftest.$ac_objext conftest.$ac_ext+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+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#ifdef __STDC__+# include <limits.h>+#else+# include <assert.h>+#endif+ Syntax error+_ACEOF+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } >/dev/null; then+ if test -s conftest.err; then+ ac_cpp_err=$ac_c_preproc_warn_flag+ else+ ac_cpp_err=+ fi+else+ ac_cpp_err=yes+fi+if test -z "$ac_cpp_err"; then+ :+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ # Broken: fails on valid input.+continue+fi+rm -f conftest.err conftest.$ac_ext++ # OK, works on sane cases. Now check whether non-existent headers+ # can be detected and how.+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <ac_nonexistent.h>+_ACEOF+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } >/dev/null; then+ if test -s conftest.err; then+ ac_cpp_err=$ac_c_preproc_warn_flag+ else+ ac_cpp_err=+ fi+else+ ac_cpp_err=yes+fi+if test -z "$ac_cpp_err"; then+ # Broken: success on invalid input.+continue+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ # Passes both tests.+ac_preproc_ok=:+break+fi+rm -f conftest.err conftest.$ac_ext++done+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.+rm -f 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+echo "$as_me:$LINENO: result: $CPP" >&5+echo "${ECHO_T}$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 >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#ifdef __STDC__+# include <limits.h>+#else+# include <assert.h>+#endif+ Syntax error+_ACEOF+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } >/dev/null; then+ if test -s conftest.err; then+ ac_cpp_err=$ac_c_preproc_warn_flag+ else+ ac_cpp_err=+ fi+else+ ac_cpp_err=yes+fi+if test -z "$ac_cpp_err"; then+ :+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ # Broken: fails on valid input.+continue+fi+rm -f conftest.err conftest.$ac_ext++ # OK, works on sane cases. Now check whether non-existent headers+ # can be detected and how.+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <ac_nonexistent.h>+_ACEOF+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } >/dev/null; then+ if test -s conftest.err; then+ ac_cpp_err=$ac_c_preproc_warn_flag+ else+ ac_cpp_err=+ fi+else+ ac_cpp_err=yes+fi+if test -z "$ac_cpp_err"; then+ # Broken: success on invalid input.+continue+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ # Passes both tests.+ac_preproc_ok=:+break+fi+rm -f conftest.err conftest.$ac_ext++done+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.+rm -f conftest.err conftest.$ac_ext+if $ac_preproc_ok; then+ :+else+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check+See \`config.log' for more details." >&5+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check+See \`config.log' for more details." >&2;}+ { (exit 1); exit 1; }; }+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+++echo "$as_me:$LINENO: checking for X" >&5+echo $ECHO_N "checking for X... $ECHO_C" >&6+++# Check whether --with-x or --without-x was given.+if test "${with_x+set}" = set; then+ withval="$with_x"++fi;+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.+if test "x$with_x" = xno; then+ # The user explicitly disabled X.+ have_x=disabled+else+ if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then+ # Both variables are already set.+ have_x=yes+ else+ if test "${ac_cv_have_x+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ # One or both of the vars are not set, and there is no cached value.+ac_x_includes=no ac_x_libraries=no+rm -fr conftest.dir+if mkdir conftest.dir; then+ cd conftest.dir+ # Make sure to not put "make" in the Imakefile rules, since we grep it out.+ cat >Imakefile <<'_ACEOF'+acfindx:+ @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'+_ACEOF+ if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then+ # GNU make sometimes prints "make[1]: Entering...", which would confuse us.+ eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`+ # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.+ for ac_extension in a so sl; do+ if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&+ test -f $ac_im_libdir/libX11.$ac_extension; then+ ac_im_usrlibdir=$ac_im_libdir; break+ fi+ done+ # Screen out bogus values from the imake configuration. They are+ # bogus both because they are the default anyway, and because+ # using them would break gcc on systems where it needs fixed includes.+ case $ac_im_incroot in+ /usr/include) ;;+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;+ esac+ case $ac_im_usrlibdir in+ /usr/lib | /lib) ;;+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;+ esac+ fi+ cd ..+ rm -fr conftest.dir+fi++# Standard set of common directories for X headers.+# Check X11 before X11Rn because it is often a symlink to the current release.+ac_x_header_dirs='+/usr/X11/include+/usr/X11R6/include+/usr/X11R5/include+/usr/X11R4/include++/usr/include/X11+/usr/include/X11R6+/usr/include/X11R5+/usr/include/X11R4++/usr/local/X11/include+/usr/local/X11R6/include+/usr/local/X11R5/include+/usr/local/X11R4/include++/usr/local/include/X11+/usr/local/include/X11R6+/usr/local/include/X11R5+/usr/local/include/X11R4++/usr/X386/include+/usr/x386/include+/usr/XFree86/include/X11++/usr/include+/usr/local/include+/usr/unsupported/include+/usr/athena/include+/usr/local/x11r5/include+/usr/lpp/Xamples/include++/usr/openwin/include+/usr/openwin/share/include'++if test "$ac_x_includes" = no; then+ # Guess where to find include files, by looking for Intrinsic.h.+ # First, try using that file with no special directory specified.+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <X11/Intrinsic.h>+_ACEOF+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } >/dev/null; then+ if test -s conftest.err; then+ ac_cpp_err=$ac_c_preproc_warn_flag+ else+ ac_cpp_err=+ fi+else+ ac_cpp_err=yes+fi+if test -z "$ac_cpp_err"; then+ # We can compile using X headers with no special include directory.+ac_x_includes=+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ for ac_dir in $ac_x_header_dirs; do+ if test -r "$ac_dir/X11/Intrinsic.h"; then+ ac_x_includes=$ac_dir+ break+ fi+done+fi+rm -f conftest.err conftest.$ac_ext+fi # $ac_x_includes = no++if test "$ac_x_libraries" = no; then+ # Check for the libraries.+ # See if we find them without any special options.+ # Don't add to $LIBS permanently.+ ac_save_LIBS=$LIBS+ LIBS="-lXt $LIBS"+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <X11/Intrinsic.h>+int+main ()+{+XtMalloc (0)+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ LIBS=$ac_save_LIBS+# We can link X programs with no special library path.+ac_x_libraries=+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++LIBS=$ac_save_LIBS+for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`+do+ # Don't even attempt the hair of trying to link an X program!+ for ac_extension in a so sl; do+ if test -r $ac_dir/libXt.$ac_extension; then+ ac_x_libraries=$ac_dir+ break 2+ fi+ done+done+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+fi # $ac_x_libraries = no++if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then+ # Didn't find X anywhere. Cache the known absence of X.+ ac_cv_have_x="have_x=no"+else+ # Record where we found X for the cache.+ ac_cv_have_x="have_x=yes \+ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"+fi+fi++ fi+ eval "$ac_cv_have_x"+fi # $with_x != no++if test "$have_x" != yes; then+ echo "$as_me:$LINENO: result: $have_x" >&5+echo "${ECHO_T}$have_x" >&6+ no_x=yes+else+ # If each of the values was on the command line, it overrides each guess.+ test "x$x_includes" = xNONE && x_includes=$ac_x_includes+ test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries+ # Update the cache value to reflect the command line values.+ ac_cv_have_x="have_x=yes \+ ac_x_includes=$x_includes ac_x_libraries=$x_libraries"+ echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5+echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6+fi++if test "$no_x" = yes; then+ # Not all programs may use this symbol, but it does not hurt to define it.++cat >>confdefs.h <<\_ACEOF+#define X_DISPLAY_MISSING 1+_ACEOF++ X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=+else+ if test -n "$x_includes"; then+ X_CFLAGS="$X_CFLAGS -I$x_includes"+ fi++ # It would also be nice to do this for all -L options, not just this one.+ if test -n "$x_libraries"; then+ X_LIBS="$X_LIBS -L$x_libraries"+ # For Solaris; some versions of Sun CC require a space after -R and+ # others require no space. Words are not sufficient . . . .+ case `(uname -sr) 2>/dev/null` in+ "SunOS 5"*)+ echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5+echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6+ ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_R_nospace=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_R_nospace=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+ if test $ac_R_nospace = yes; then+ echo "$as_me:$LINENO: result: no" >&5+echo "${ECHO_T}no" >&6+ X_LIBS="$X_LIBS -R$x_libraries"+ else+ LIBS="$ac_xsave_LIBS -R $x_libraries"+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_R_space=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_R_space=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+ if test $ac_R_space = yes; then+ echo "$as_me:$LINENO: result: yes" >&5+echo "${ECHO_T}yes" >&6+ X_LIBS="$X_LIBS -R $x_libraries"+ else+ echo "$as_me:$LINENO: result: neither works" >&5+echo "${ECHO_T}neither works" >&6+ fi+ fi+ LIBS=$ac_xsave_LIBS+ esac+ fi++ # Check for system-dependent libraries X programs must link with.+ # Do this before checking for the system-independent R6 libraries+ # (-lICE), since we may need -lsocket or whatever for X linking.++ if test "$ISC" = yes; then+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"+ else+ # Martyn Johnson says this is needed for Ultrix, if the X+ # libraries were built with DECnet support. And Karl Berry says+ # the Alpha needs dnet_stub (dnet does not exist).+ ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char XOpenDisplay ();+int+main ()+{+XOpenDisplay ();+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ :+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5+echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6+if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-ldnet $LIBS"+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char dnet_ntoa ();+int+main ()+{+dnet_ntoa ();+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_lib_dnet_dnet_ntoa=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_lib_dnet_dnet_ntoa=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5+echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6+if test $ac_cv_lib_dnet_dnet_ntoa = yes; then+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"+fi++ if test $ac_cv_lib_dnet_dnet_ntoa = no; then+ echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5+echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6+if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-ldnet_stub $LIBS"+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char dnet_ntoa ();+int+main ()+{+dnet_ntoa ();+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_lib_dnet_stub_dnet_ntoa=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_lib_dnet_stub_dnet_ntoa=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5+echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6+if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"+fi++ fi+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+ LIBS="$ac_xsave_LIBS"++ # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,+ # to get the SysV transport functions.+ # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)+ # needs -lnsl.+ # The nsl library prevents programs from opening the X display+ # on Irix 5.2, according to T.E. Dickey.+ # The functions gethostbyname, getservbyname, and inet_addr are+ # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.+ echo "$as_me:$LINENO: checking for gethostbyname" >&5+echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6+if test "${ac_cv_func_gethostbyname+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+/* System header to define __stub macros and hopefully few prototypes,+ which can conflict with char gethostbyname (); 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+/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+{+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char gethostbyname ();+/* 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_gethostbyname) || defined (__stub___gethostbyname)+choke me+#else+char (*f) () = gethostbyname;+#endif+#ifdef __cplusplus+}+#endif++int+main ()+{+return f != gethostbyname;+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_func_gethostbyname=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_func_gethostbyname=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+fi+echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5+echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6++ if test $ac_cv_func_gethostbyname = no; then+ echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5+echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6+if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lnsl $LIBS"+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char gethostbyname ();+int+main ()+{+gethostbyname ();+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_lib_nsl_gethostbyname=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_lib_nsl_gethostbyname=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5+echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6+if test $ac_cv_lib_nsl_gethostbyname = yes; then+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"+fi++ if test $ac_cv_lib_nsl_gethostbyname = no; then+ echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5+echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6+if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lbsd $LIBS"+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char gethostbyname ();+int+main ()+{+gethostbyname ();+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_lib_bsd_gethostbyname=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_lib_bsd_gethostbyname=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5+echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6+if test $ac_cv_lib_bsd_gethostbyname = yes; then+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"+fi++ fi+ fi++ # lieder@skyler.mavd.honeywell.com says without -lsocket,+ # socket/setsockopt and other routines are undefined under SCO ODT+ # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary+ # on later versions), says Simon Leinen: it contains gethostby*+ # variants that don't use the name server (or something). -lsocket+ # must be given before -lnsl if both are needed. We assume that+ # if connect needs -lnsl, so does gethostbyname.+ echo "$as_me:$LINENO: checking for connect" >&5+echo $ECHO_N "checking for connect... $ECHO_C" >&6+if test "${ac_cv_func_connect+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+/* System header to define __stub macros and hopefully few prototypes,+ which can conflict with char connect (); 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+/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+{+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char connect ();+/* 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_connect) || defined (__stub___connect)+choke me+#else+char (*f) () = connect;+#endif+#ifdef __cplusplus+}+#endif++int+main ()+{+return f != connect;+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_func_connect=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_func_connect=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+fi+echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5+echo "${ECHO_T}$ac_cv_func_connect" >&6++ if test $ac_cv_func_connect = no; then+ echo "$as_me:$LINENO: checking for connect in -lsocket" >&5+echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6+if test "${ac_cv_lib_socket_connect+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lsocket $X_EXTRA_LIBS $LIBS"+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char connect ();+int+main ()+{+connect ();+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_lib_socket_connect=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_lib_socket_connect=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5+echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6+if test $ac_cv_lib_socket_connect = yes; then+ X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"+fi++ fi++ # Guillermo Gomez says -lposix is necessary on A/UX.+ echo "$as_me:$LINENO: checking for remove" >&5+echo $ECHO_N "checking for remove... $ECHO_C" >&6+if test "${ac_cv_func_remove+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+/* System header to define __stub macros and hopefully few prototypes,+ which can conflict with char remove (); 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+/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+{+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char remove ();+/* 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_remove) || defined (__stub___remove)+choke me+#else+char (*f) () = remove;+#endif+#ifdef __cplusplus+}+#endif++int+main ()+{+return f != remove;+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_func_remove=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_func_remove=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+fi+echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5+echo "${ECHO_T}$ac_cv_func_remove" >&6++ if test $ac_cv_func_remove = no; then+ echo "$as_me:$LINENO: checking for remove in -lposix" >&5+echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6+if test "${ac_cv_lib_posix_remove+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lposix $LIBS"+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char remove ();+int+main ()+{+remove ();+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_lib_posix_remove=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_lib_posix_remove=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5+echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6+if test $ac_cv_lib_posix_remove = yes; then+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"+fi++ fi++ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.+ echo "$as_me:$LINENO: checking for shmat" >&5+echo $ECHO_N "checking for shmat... $ECHO_C" >&6+if test "${ac_cv_func_shmat+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+/* System header to define __stub macros and hopefully few prototypes,+ which can conflict with char shmat (); 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+/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+{+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char shmat ();+/* 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_shmat) || defined (__stub___shmat)+choke me+#else+char (*f) () = shmat;+#endif+#ifdef __cplusplus+}+#endif++int+main ()+{+return f != shmat;+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_func_shmat=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_func_shmat=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+fi+echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5+echo "${ECHO_T}$ac_cv_func_shmat" >&6++ if test $ac_cv_func_shmat = no; then+ echo "$as_me:$LINENO: checking for shmat in -lipc" >&5+echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6+if test "${ac_cv_lib_ipc_shmat+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lipc $LIBS"+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char shmat ();+int+main ()+{+shmat ();+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_lib_ipc_shmat=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_lib_ipc_shmat=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5+echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6+if test $ac_cv_lib_ipc_shmat = yes; then+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"+fi++ fi+ fi++ # Check for libraries that X11R6 Xt/Xaw programs need.+ ac_save_LDFLAGS=$LDFLAGS+ test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"+ # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to+ # check for ICE first), but we must link in the order -lSM -lICE or+ # we get undefined symbols. So assume we have SM if we have ICE.+ # These have to be linked with before -lX11, unlike the other+ # libraries we check for below, so use a different variable.+ # John Interrante, Karl Berry+ echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5+echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6+if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lICE $X_EXTRA_LIBS $LIBS"+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */++/* Override any gcc2 internal prototype to avoid an error. */+#ifdef __cplusplus+extern "C"+#endif+/* We use char because int might match the return type of a gcc2+ builtin and then its argument prototype would still apply. */+char IceConnectionNumber ();+int+main ()+{+IceConnectionNumber ();+ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_lib_ICE_IceConnectionNumber=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_lib_ICE_IceConnectionNumber=no+fi+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5+echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6+if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then+ X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"+fi++ LDFLAGS=$ac_save_LDFLAGS++fi+++# AC_PATH_XTRA doesn't actually check that the C compiler can+# really include the X headers, so double-check here. In particular,+# this will catch the case of using a mingw32 gcc on a Cygwin system:+# Cygwin has the X headers & libs installed, but the mingw32 gcc can't+# use them, and we want to disable the package in this case.+CPPFLAGS="$CPPFLAGS $X_CFLAGS"+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <X11/Xlib.h>+_ACEOF+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } >/dev/null; then+ if test -s conftest.err; then+ ac_cpp_err=$ac_c_preproc_warn_flag+ else+ ac_cpp_err=+ fi+else+ ac_cpp_err=yes+fi+if test -z "$ac_cpp_err"; then+ :+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ no_x=yes+fi+rm -f conftest.err conftest.$ac_ext++# Build the package if we found X11 stuff+if test "$no_x" = yes; then+ # or we're on Windows+ echo "$as_me:$LINENO: checking for egrep" >&5+echo $ECHO_N "checking for egrep... $ECHO_C" >&6+if test "${ac_cv_prog_egrep+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1+ then ac_cv_prog_egrep='grep -E'+ else ac_cv_prog_egrep='egrep'+ fi+fi+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5+echo "${ECHO_T}$ac_cv_prog_egrep" >&6+ EGREP=$ac_cv_prog_egrep+++echo "$as_me:$LINENO: checking for ANSI C header files" >&5+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6+if test "${ac_cv_header_stdc+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <stdlib.h>+#include <stdarg.h>+#include <string.h>+#include <float.h>++int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest.$ac_objext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_cv_header_stdc=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_cv_header_stdc=no+fi+rm -f 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 >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* 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 >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* 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 >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <ctype.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))+ exit(2);+ exit (0);+}+_ACEOF+rm -f conftest$ac_exeext+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5+ (eval $ac_link) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ :+else+ echo "$as_me: program exited with status $ac_status" >&5+echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++( exit $ac_status )+ac_cv_header_stdc=no+fi+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext+fi+fi+fi+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5+echo "${ECHO_T}$ac_cv_header_stdc" >&6+if test $ac_cv_header_stdc = yes; then++cat >>confdefs.h <<\_ACEOF+#define STDC_HEADERS 1+_ACEOF++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=`echo "ac_cv_header_$ac_header" | $as_tr_sh`+echo "$as_me:$LINENO: checking for $ac_header" >&5+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6+if eval "test \"\${$as_ac_Header+set}\" = set"; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+$ac_includes_default++#include <$ac_header>+_ACEOF+rm -f conftest.$ac_objext+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest.$ac_objext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ eval "$as_ac_Header=yes"+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++eval "$as_ac_Header=no"+fi+rm -f conftest.$ac_objext conftest.$ac_ext+fi+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6+if test `eval echo '${'$as_ac_Header'}'` = yes; then+ cat >>confdefs.h <<_ACEOF+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1+_ACEOF++fi++done+++if test "${ac_cv_header_windows_h+set}" = set; then+ echo "$as_me:$LINENO: checking for windows.h" >&5+echo $ECHO_N "checking for windows.h... $ECHO_C" >&6+if test "${ac_cv_header_windows_h+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+fi+echo "$as_me:$LINENO: result: $ac_cv_header_windows_h" >&5+echo "${ECHO_T}$ac_cv_header_windows_h" >&6+else+ # Is the header compilable?+echo "$as_me:$LINENO: checking windows.h usability" >&5+echo $ECHO_N "checking windows.h usability... $ECHO_C" >&6+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+$ac_includes_default+#include <windows.h>+_ACEOF+rm -f conftest.$ac_objext+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5+ (eval $ac_compile) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } &&+ { ac_try='test -s conftest.$ac_objext'+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5+ (eval $ac_try) 2>&5+ ac_status=$?+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); }; }; then+ ac_header_compiler=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ac_header_compiler=no+fi+rm -f conftest.$ac_objext conftest.$ac_ext+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5+echo "${ECHO_T}$ac_header_compiler" >&6++# Is the header present?+echo "$as_me:$LINENO: checking windows.h presence" >&5+echo $ECHO_N "checking windows.h presence... $ECHO_C" >&6+cat >conftest.$ac_ext <<_ACEOF+#line $LINENO "configure"+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <windows.h>+_ACEOF+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } >/dev/null; then+ if test -s conftest.err; then+ ac_cpp_err=$ac_c_preproc_warn_flag+ else+ ac_cpp_err=+ fi+else+ ac_cpp_err=yes+fi+if test -z "$ac_cpp_err"; then+ ac_header_preproc=yes+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_header_preproc=no+fi+rm -f conftest.err conftest.$ac_ext+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5+echo "${ECHO_T}$ac_header_preproc" >&6++# So? What about this header?+case $ac_header_compiler:$ac_header_preproc in+ yes:no )+ { echo "$as_me:$LINENO: WARNING: windows.h: accepted by the compiler, rejected by the preprocessor!" >&5+echo "$as_me: WARNING: windows.h: accepted by the compiler, rejected by the preprocessor!" >&2;}+ { echo "$as_me:$LINENO: WARNING: windows.h: proceeding with the preprocessor's result" >&5+echo "$as_me: WARNING: windows.h: proceeding with the preprocessor's result" >&2;}+ (+ cat <<\_ASBOX+## ------------------------------------ ##+## Report this to bug-autoconf@gnu.org. ##+## ------------------------------------ ##+_ASBOX+ ) |+ sed "s/^/$as_me: WARNING: /" >&2+ ;;+ no:yes )+ { echo "$as_me:$LINENO: WARNING: windows.h: present but cannot be compiled" >&5+echo "$as_me: WARNING: windows.h: present but cannot be compiled" >&2;}+ { echo "$as_me:$LINENO: WARNING: windows.h: check for missing prerequisite headers?" >&5+echo "$as_me: WARNING: windows.h: check for missing prerequisite headers?" >&2;}+ { echo "$as_me:$LINENO: WARNING: windows.h: proceeding with the preprocessor's result" >&5+echo "$as_me: WARNING: windows.h: proceeding with the preprocessor's result" >&2;}+ (+ cat <<\_ASBOX+## ------------------------------------ ##+## Report this to bug-autoconf@gnu.org. ##+## ------------------------------------ ##+_ASBOX+ ) |+ sed "s/^/$as_me: WARNING: /" >&2+ ;;+esac+echo "$as_me:$LINENO: checking for windows.h" >&5+echo $ECHO_N "checking for windows.h... $ECHO_C" >&6+if test "${ac_cv_header_windows_h+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_cv_header_windows_h=$ac_header_preproc+fi+echo "$as_me:$LINENO: result: $ac_cv_header_windows_h" >&5+echo "${ECHO_T}$ac_cv_header_windows_h" >&6++fi+if test $ac_cv_header_windows_h = yes; then+ HGL_BUILD_PACKAGE=yes+ PLATFORM=Win32+ cat >>confdefs.h <<\_ACEOF+#define X_DISPLAY_MISSING 1+_ACEOF++else+ HGL_BUILD_PACKAGE=no+fi+++else+ HGL_BUILD_PACKAGE=yes+ PLATFORM=X11+fi+fi++++case "$PLATFORM" in+Win32) EXTRA_MODULES='Graphics.HGL.Win32.Bitmap, Graphics.HGL.Win32.Draw, Graphics.HGL.Win32.Types, Graphics.HGL.Win32.WND' ;;+X11) EXTRA_MODULES='Graphics.HGL.X11.Display, Graphics.HGL.X11.DC, Graphics.HGL.X11.Timer, Graphics.HGL.X11.Types, Graphics.HGL.X11.Window' ;;+*) EXTRA_MODULES= ;;+esac+++# Define CPP variables used in package.conf.in+if test "$HGL_BUILD_PACKAGE" = yes; then++cat >>confdefs.h <<_ACEOF+#define PLATFORM $PLATFORM+_ACEOF++fi++if test "$HGL_BUILD_PACKAGE" = yes; then+ BUILD_PACKAGE_BOOL=True+else+ BUILD_PACKAGE_BOOL=False+fi+++ ac_config_files="$ac_config_files config.mk HGL.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, don't put newlines in cache variables' values.+# 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.+{+ (set) 2>&1 |+ case `(ac_space=' '; set | grep ac_space) 2>&1` in+ *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 \+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"+ ;;+ esac;+} |+ sed '+ t clear+ : clear+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/+ t end+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/+ : end' >>confcache+if diff $cache_file confcache >/dev/null 2>&1; then :; else+ if test -w $cache_file; then+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"+ cat confcache >$cache_file+ else+ echo "not updating unwritable cache $cache_file"+ 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}'++# VPATH may cause trouble with some makes, so we remove $(srcdir),+# ${srcdir} and @srcdir@ 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[ ]*=/{+s/:*\$(srcdir):*/:/;+s/:*\${srcdir}:*/:/;+s/:*@srcdir@:*/:/;+s/^\([^=]*=[ ]*\):*/\1/;+s/:*$//;+s/^[^=]*=[ ]*$//;+}'+fi++DEFS=-DHAVE_CONFIG_H++ac_libobjs=+ac_ltlibobjs=+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue+ # 1. Remove the extension, and $U if already installed.+ ac_i=`echo "$ac_i" |+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`+ # 2. Add them.+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'+done+LIBOBJS=$ac_libobjs++LTLIBOBJS=$ac_ltlibobjs++++: ${CONFIG_STATUS=./config.status}+ac_clean_files_save=$ac_clean_files+ac_clean_files="$ac_clean_files $CONFIG_STATUS"+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5+echo "$as_me: creating $CONFIG_STATUS" >&6;}+cat >$CONFIG_STATUS <<_ACEOF+#! $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}+_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF+## --------------------- ##+## M4sh Initialization. ##+## --------------------- ##++# Be Bourne compatible+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then+ emulate sh+ NULLCMD=:+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which+ # is contrary to our usage. Disable this feature.+ alias -g '${1+"$@"}'='"$@"'+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then+ set -o posix+fi++# Support unset when possible.+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then+ as_unset=unset+else+ as_unset=false+fi+++# Work around bugs in pre-3.0 UWIN ksh.+$as_unset ENV MAIL MAILPATH+PS1='$ '+PS2='> '+PS4='+ '++# NLS nuisances.+for as_var in \+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \+ LC_TELEPHONE LC_TIME+do+ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then+ eval $as_var=C; export $as_var+ else+ $as_unset $as_var+ fi+done++# Required to use basename.+if expr a : '\(a\)' >/dev/null 2>&1; 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+++# Name of the executable.+as_me=`$as_basename "$0" ||+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \+ X"$0" : 'X\(//\)$' \| \+ X"$0" : 'X\(/\)$' \| \+ . : '\(.\)' 2>/dev/null ||+echo X/"$0" |+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }+ /^X\/\(\/\/\)$/{ s//\1/; q; }+ /^X\/\(\/\).*/{ s//\1/; q; }+ s/.*/./; q'`+++# PATH needs CR, and LINENO needs CR and PATH.+# 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++# The user is always right.+if test "${PATH_SEPARATOR+set}" != set; then+ echo "#! /bin/sh" >conf$$.sh+ echo "exit 0" >>conf$$.sh+ chmod +x conf$$.sh+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then+ PATH_SEPARATOR=';'+ else+ PATH_SEPARATOR=:+ fi+ rm -f conf$$.sh+fi+++ as_lineno_1=$LINENO+ as_lineno_2=$LINENO+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`+ test "x$as_lineno_1" != "x$as_lineno_2" &&+ test "x$as_lineno_3" = "x$as_lineno_2" || {+ # Find who we are. Look in the path if we contain no path at all+ # relative or not.+ 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++ ;;+ 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+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}+ { (exit 1); exit 1; }; }+ fi+ case $CONFIG_SHELL in+ '')+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH+do+ IFS=$as_save_IFS+ test -z "$as_dir" && as_dir=.+ for as_base in sh bash ksh sh5; do+ case $as_dir in+ /*)+ if ("$as_dir/$as_base" -c '+ as_lineno_1=$LINENO+ as_lineno_2=$LINENO+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`+ test "x$as_lineno_1" != "x$as_lineno_2" &&+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }+ CONFIG_SHELL=$as_dir/$as_base+ export CONFIG_SHELL+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}+ fi;;+ esac+ done+done+;;+ esac++ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO+ # uniformly replaced by the line number. The first 'sed' inserts a+ # line-number line before each line; the second 'sed' does the real+ # work. The second script uses 'N' to pair each line-number line+ # with the numbered line, and appends trailing '-' during+ # substitution so that $LINENO is not a special case at line end.+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)+ sed '=' <$as_myself |+ sed '+ N+ s,$,-,+ : loop+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,+ t loop+ s,-$,,+ s,^['$as_cr_digits']*\n,,+ ' >$as_me.lineno &&+ chmod +x $as_me.lineno ||+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}+ { (exit 1); exit 1; }; }++ # 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 sensible to this).+ . ./$as_me.lineno+ # Exit status is that of the last command.+ exit+}+++case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in+ *c*,-n*) ECHO_N= ECHO_C='+' ECHO_T=' ' ;;+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;+esac++if expr a : '\(a\)' >/dev/null 2>&1; then+ as_expr=expr+else+ as_expr=false+fi++rm -f conf$$ conf$$.exe conf$$.file+echo >conf$$.file+if ln -s conf$$.file conf$$ 2>/dev/null; then+ # We could just check for DJGPP; but this test a) works b) is more generic+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).+ if test -f conf$$.exe; then+ # Don't use ln at all; we don't have any links+ as_ln_s='cp -p'+ else+ as_ln_s='ln -s'+ fi+elif ln conf$$.file conf$$ 2>/dev/null; then+ as_ln_s=ln+else+ as_ln_s='cp -p'+fi+rm -f conf$$ conf$$.exe conf$$.file++if mkdir -p . 2>/dev/null; then+ as_mkdir_p=:+else+ as_mkdir_p=false+fi++as_executable_p="test -f"++# Sed expression to map a string onto a valid CPP name.+as_tr_cpp="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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"+++# IFS+# We need space, tab and new line, in precisely that order.+as_nl='+'+IFS=" $as_nl"++# CDPATH.+$as_unset CDPATH++exec 6>&1++# Open the log real soon, to keep \$[0] and so on meaningful, and to+# report actual input values of CONFIG_FILES etc. instead of their+# values after options handling. Logging --version etc. is OK.+exec 5>>config.log+{+ echo+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX+## Running $as_me. ##+_ASBOX+} >&5+cat >&5 <<_CSEOF++This file was extended by Haskell Graphics Library $as_me 3.1, which was+generated by GNU Autoconf 2.57. Invocation command line was++ CONFIG_FILES = $CONFIG_FILES+ CONFIG_HEADERS = $CONFIG_HEADERS+ CONFIG_LINKS = $CONFIG_LINKS+ CONFIG_COMMANDS = $CONFIG_COMMANDS+ $ $0 $@++_CSEOF+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5+echo >&5+_ACEOF++# Files that config.status was made for.+if test -n "$ac_config_files"; then+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS+fi++if test -n "$ac_config_headers"; then+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS+fi++if test -n "$ac_config_links"; then+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS+fi++if test -n "$ac_config_commands"; then+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS+fi++cat >>$CONFIG_STATUS <<\_ACEOF++ac_cs_usage="\+\`$as_me' instantiates files from templates according to the+current configuration.++Usage: $0 [OPTIONS] [FILE]...++ -h, --help print this help, then exit+ -V, --version print version number, then exit+ -q, --quiet 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 <bug-autoconf@gnu.org>."+_ACEOF++cat >>$CONFIG_STATUS <<_ACEOF+ac_cs_version="\\+Haskell Graphics Library config.status 3.1+configured by $0, generated by GNU Autoconf 2.57,+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"++Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001+Free Software Foundation, Inc.+This config.status script is free software; the Free Software Foundation+gives unlimited permission to copy, distribute and modify it."+srcdir=$srcdir+_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF+# If no file are specified by the user, then we need to provide default+# value. By we need to know if files were specified by the user.+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=$1+ ac_optarg=$2+ ac_shift=shift+ ;;+ *) # This is not an option, so the user has probably given explicit+ # arguments.+ ac_option=$1+ ac_need_defaults=false;;+ esac++ case $ac_option in+ # Handling of the options.+_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)+ ac_cs_recheck=: ;;+ --version | --vers* | -V )+ echo "$ac_cs_version"; exit 0 ;;+ --he | --h)+ # Conflict between --help and --header+ { { echo "$as_me:$LINENO: error: ambiguous option: $1+Try \`$0 --help' for more information." >&5+echo "$as_me: error: ambiguous option: $1+Try \`$0 --help' for more information." >&2;}+ { (exit 1); exit 1; }; };;+ --help | --hel | -h )+ echo "$ac_cs_usage"; exit 0 ;;+ --debug | --d* | -d )+ debug=: ;;+ --file | --fil | --fi | --f )+ $ac_shift+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"+ ac_need_defaults=false;;+ --header | --heade | --head | --hea )+ $ac_shift+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"+ ac_need_defaults=false;;+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \+ | -silent | --silent | --silen | --sile | --sil | --si | --s)+ ac_cs_silent=: ;;++ # This is an error.+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1+Try \`$0 --help' for more information." >&5+echo "$as_me: error: unrecognized option: $1+Try \`$0 --help' for more information." >&2;}+ { (exit 1); exit 1; }; } ;;++ *) ac_config_targets="$ac_config_targets $1" ;;++ 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+if \$ac_cs_recheck; then+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion+fi++_ACEOF++++++cat >>$CONFIG_STATUS <<\_ACEOF+for ac_config_target in $ac_config_targets+do+ case "$ac_config_target" in+ # Handling of arguments.+ "config.mk" ) CONFIG_FILES="$CONFIG_FILES config.mk" ;;+ "HGL.buildinfo" ) CONFIG_FILES="$CONFIG_FILES HGL.buildinfo" ;;+ "include/HsHGLConfig.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/HsHGLConfig.h" ;;+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}+ { (exit 1); exit 1; }; };;+ 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 to put it here, and in addition,+# creating and moving files from /tmp can sometimes cause problems.+# Create a temporary directory, and hook for its removal unless debugging.+$debug ||+{+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0+ trap '{ (exit 1); exit 1; }' 1 2 13 15+}++# Create a (secure) tmp directory for tmp files.++{+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&+ test -n "$tmp" && test -d "$tmp"+} ||+{+ tmp=./confstat$$-$RANDOM+ (umask 077 && mkdir $tmp)+} ||+{+ echo "$me: cannot create a temporary directory in ." >&2+ { (exit 1); exit 1; }+}++_ACEOF++cat >>$CONFIG_STATUS <<_ACEOF++#+# CONFIG_FILES section.+#++# No need to generate the scripts if there are no CONFIG_FILES.+# This happens for instance when ./config.status config.h+if test -n "\$CONFIG_FILES"; then+ # Protect against being on the right side of a sed subst in config.status.+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF+s,@SHELL@,$SHELL,;t t+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t+s,@exec_prefix@,$exec_prefix,;t t+s,@prefix@,$prefix,;t t+s,@program_transform_name@,$program_transform_name,;t t+s,@bindir@,$bindir,;t t+s,@sbindir@,$sbindir,;t t+s,@libexecdir@,$libexecdir,;t t+s,@datadir@,$datadir,;t t+s,@sysconfdir@,$sysconfdir,;t t+s,@sharedstatedir@,$sharedstatedir,;t t+s,@localstatedir@,$localstatedir,;t t+s,@libdir@,$libdir,;t t+s,@includedir@,$includedir,;t t+s,@oldincludedir@,$oldincludedir,;t t+s,@infodir@,$infodir,;t t+s,@mandir@,$mandir,;t t+s,@build_alias@,$build_alias,;t t+s,@host_alias@,$host_alias,;t t+s,@target_alias@,$target_alias,;t t+s,@DEFS@,$DEFS,;t t+s,@ECHO_C@,$ECHO_C,;t t+s,@ECHO_N@,$ECHO_N,;t t+s,@ECHO_T@,$ECHO_T,;t t+s,@LIBS@,$LIBS,;t t+s,@CC@,$CC,;t t+s,@CFLAGS@,$CFLAGS,;t t+s,@LDFLAGS@,$LDFLAGS,;t t+s,@CPPFLAGS@,$CPPFLAGS,;t t+s,@ac_ct_CC@,$ac_ct_CC,;t t+s,@EXEEXT@,$EXEEXT,;t t+s,@OBJEXT@,$OBJEXT,;t t+s,@CPP@,$CPP,;t t+s,@X_CFLAGS@,$X_CFLAGS,;t t+s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t+s,@X_LIBS@,$X_LIBS,;t t+s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t+s,@EGREP@,$EGREP,;t t+s,@HGL_BUILD_PACKAGE@,$HGL_BUILD_PACKAGE,;t t+s,@PLATFORM@,$PLATFORM,;t t+s,@EXTRA_MODULES@,$EXTRA_MODULES,;t t+s,@BUILD_PACKAGE_BOOL@,$BUILD_PACKAGE_BOOL,;t t+s,@LIBOBJS@,$LIBOBJS,;t t+s,@LTLIBOBJS@,$LTLIBOBJS,;t t+CEOF++_ACEOF++ cat >>$CONFIG_STATUS <<\_ACEOF+ # Split the substitutions into bite-sized pieces for seds with+ # small command number limits, like on Digital OSF/1 and HP-UX.+ ac_max_sed_lines=48+ ac_sed_frag=1 # Number of current file.+ ac_beg=1 # First line for current file.+ ac_end=$ac_max_sed_lines # Line after last line for current file.+ ac_more_lines=:+ ac_sed_cmds=+ while $ac_more_lines; do+ if test $ac_beg -gt 1; then+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag+ else+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag+ fi+ if test ! -s $tmp/subs.frag; then+ ac_more_lines=false+ else+ # The purpose of the label and of the branching condition is to+ # speed up the sed processing (if there are no `@' at all, there+ # is no need to browse any of the substitutions).+ # These are the two extra sed commands mentioned above.+ (echo ':t+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed+ if test -z "$ac_sed_cmds"; then+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"+ else+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"+ fi+ ac_sed_frag=`expr $ac_sed_frag + 1`+ ac_beg=$ac_end+ ac_end=`expr $ac_end + $ac_max_sed_lines`+ fi+ done+ if test -z "$ac_sed_cmds"; then+ ac_sed_cmds=cat+ fi+fi # test -n "$CONFIG_FILES"++_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".+ case $ac_file in+ - | *:- | *:-:* ) # input from stdin+ cat >$tmp/stdin+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;+ * ) ac_file_in=$ac_file.in ;;+ esac++ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$ac_file" : 'X\(//\)[^/]' \| \+ X"$ac_file" : 'X\(//\)$' \| \+ X"$ac_file" : 'X\(/\)' \| \+ . : '\(.\)' 2>/dev/null ||+echo X"$ac_file" |+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }+ /^X\(\/\/\)$/{ s//\1/; q; }+ /^X\(\/\).*/{ s//\1/; q; }+ s/.*/./; q'`+ { if $as_mkdir_p; then+ mkdir -p "$ac_dir"+ else+ as_dir="$ac_dir"+ as_dirs=+ while test ! -d "$as_dir"; do+ as_dirs="$as_dir $as_dirs"+ as_dir=`(dirname "$as_dir") 2>/dev/null ||+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$as_dir" : 'X\(//\)[^/]' \| \+ X"$as_dir" : 'X\(//\)$' \| \+ X"$as_dir" : 'X\(/\)' \| \+ . : '\(.\)' 2>/dev/null ||+echo X"$as_dir" |+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }+ /^X\(\/\/\)$/{ s//\1/; q; }+ /^X\(\/\).*/{ s//\1/; q; }+ s/.*/./; q'`+ done+ test ! -n "$as_dirs" || mkdir $as_dirs+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}+ { (exit 1); exit 1; }; }; }++ ac_builddir=.++if test "$ac_dir" != .; then+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`+ # A "../" for each directory in $ac_dir_suffix.+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`+else+ ac_dir_suffix= ac_top_builddir=+fi++case $srcdir in+ .) # No --srcdir option. We are building in place.+ ac_srcdir=.+ if test -z "$ac_top_builddir"; then+ ac_top_srcdir=.+ else+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`+ fi ;;+ [\\/]* | ?:[\\/]* ) # Absolute path.+ ac_srcdir=$srcdir$ac_dir_suffix;+ ac_top_srcdir=$srcdir ;;+ *) # Relative path.+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix+ ac_top_srcdir=$ac_top_builddir$srcdir ;;+esac+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be+# absolute.+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`++++ if test x"$ac_file" != x-; then+ { echo "$as_me:$LINENO: creating $ac_file" >&5+echo "$as_me: creating $ac_file" >&6;}+ rm -f "$ac_file"+ fi+ # 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. */+ if test x"$ac_file" = x-; then+ configure_input=+ else+ configure_input="$ac_file. "+ fi+ configure_input=$configure_input"Generated from `echo $ac_file_in |+ sed 's,.*/,,'` by configure."++ # First look for the input files in the build tree, otherwise in the+ # src tree.+ ac_file_inputs=`IFS=:+ for f in $ac_file_in; do+ case $f in+ -) echo $tmp/stdin ;;+ [\\/$]*)+ # Absolute (can't be DOS-style, as IFS=:)+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5+echo "$as_me: error: cannot find input file: $f" >&2;}+ { (exit 1); exit 1; }; }+ echo $f;;+ *) # Relative+ if test -f "$f"; then+ # Build tree+ echo $f+ elif test -f "$srcdir/$f"; then+ # Source tree+ echo $srcdir/$f+ else+ # /dev/null tree+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5+echo "$as_me: error: cannot find input file: $f" >&2;}+ { (exit 1); exit 1; }; }+ fi;;+ esac+ done` || { (exit 1); exit 1; }+_ACEOF+cat >>$CONFIG_STATUS <<_ACEOF+ sed "$ac_vpsub+$extrasub+_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF+:t+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b+s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out+ rm -f $tmp/stdin+ if test x"$ac_file" != x-; then+ mv $tmp/out $ac_file+ else+ cat $tmp/out+ rm -f $tmp/out+ fi++done+_ACEOF+cat >>$CONFIG_STATUS <<\_ACEOF++#+# CONFIG_HEADER section.+#++# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where+# NAME is the cpp macro being defined and VALUE is the value it is being given.+#+# ac_d sets the value in "#define NAME VALUE" lines.+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'+ac_dB='[ ].*$,\1#\2'+ac_dC=' '+ac_dD=',;t'+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'+ac_uB='$,\1#\2define\3'+ac_uC=' '+ac_uD=',;t'++for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".+ case $ac_file in+ - | *:- | *:-:* ) # input from stdin+ cat >$tmp/stdin+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;+ * ) ac_file_in=$ac_file.in ;;+ esac++ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5+echo "$as_me: creating $ac_file" >&6;}++ # First look for the input files in the build tree, otherwise in the+ # src tree.+ ac_file_inputs=`IFS=:+ for f in $ac_file_in; do+ case $f in+ -) echo $tmp/stdin ;;+ [\\/$]*)+ # Absolute (can't be DOS-style, as IFS=:)+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5+echo "$as_me: error: cannot find input file: $f" >&2;}+ { (exit 1); exit 1; }; }+ echo $f;;+ *) # Relative+ if test -f "$f"; then+ # Build tree+ echo $f+ elif test -f "$srcdir/$f"; then+ # Source tree+ echo $srcdir/$f+ else+ # /dev/null tree+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5+echo "$as_me: error: cannot find input file: $f" >&2;}+ { (exit 1); exit 1; }; }+ fi;;+ esac+ done` || { (exit 1); exit 1; }+ # Remove the trailing spaces.+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in++_ACEOF++# Transform confdefs.h into two sed scripts, `conftest.defines' and+# `conftest.undefs', that substitutes the proper values into+# config.h.in to produce config.h. The first handles `#define'+# templates, and the second `#undef' templates.+# And first: Protect against being on the right side of a sed subst in+# config.status. Protect against being in an unquoted here document+# in config.status.+rm -f conftest.defines conftest.undefs+# Using a here document instead of a string reduces the quoting nightmare.+# Putting comments in sed scripts is not portable.+#+# `end' is used to avoid that the second main sed command (meant for+# 0-ary CPP macros) applies to n-ary macro definitions.+# See the Autoconf documentation for `clear'.+cat >confdef2sed.sed <<\_ACEOF+s/[\\&,]/\\&/g+s,[\\$`],\\&,g+t clear+: clear+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp+t end+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp+: end+_ACEOF+# If some macros were called several times there might be several times+# the same #defines, which is useless. Nevertheless, we may not want to+# sort them, since we want the *last* AC-DEFINE to be honored.+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs+rm -f confdef2sed.sed++# This sed command replaces #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.+cat >>conftest.undefs <<\_ACEOF+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,+_ACEOF++# Break up conftest.defines because some shells have a limit on the size+# of here documents, and old seds have small limits too (100 cmds).+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS+echo ' :' >>$CONFIG_STATUS+rm -f conftest.tail+while grep . conftest.defines >/dev/null+do+ # Write a limited-size here document to $tmp/defines.sed.+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS+ # Speed up: don't consider the non `#define' lines.+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS+ # Work around the forget-to-reset-the-flag bug.+ echo 't clr' >>$CONFIG_STATUS+ echo ': clr' >>$CONFIG_STATUS+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS+ echo 'CEOF+ sed -f $tmp/defines.sed $tmp/in >$tmp/out+ rm -f $tmp/in+ mv $tmp/out $tmp/in+' >>$CONFIG_STATUS+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail+ rm -f conftest.defines+ mv conftest.tail conftest.defines+done+rm -f conftest.defines+echo ' fi # grep' >>$CONFIG_STATUS+echo >>$CONFIG_STATUS++# Break up conftest.undefs because some shells have a limit on the size+# of here documents, and old seds have small limits too (100 cmds).+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS+rm -f conftest.tail+while grep . conftest.undefs >/dev/null+do+ # Write a limited-size here document to $tmp/undefs.sed.+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS+ # Speed up: don't consider the non `#undef'+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS+ # Work around the forget-to-reset-the-flag bug.+ echo 't clr' >>$CONFIG_STATUS+ echo ': clr' >>$CONFIG_STATUS+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS+ echo 'CEOF+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out+ rm -f $tmp/in+ mv $tmp/out $tmp/in+' >>$CONFIG_STATUS+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail+ rm -f conftest.undefs+ mv conftest.tail conftest.undefs+done+rm -f conftest.undefs++cat >>$CONFIG_STATUS <<\_ACEOF+ # 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. */+ if test x"$ac_file" = x-; then+ echo "/* Generated by configure. */" >$tmp/config.h+ else+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h+ fi+ cat $tmp/in >>$tmp/config.h+ rm -f $tmp/in+ if test x"$ac_file" != x-; then+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5+echo "$as_me: $ac_file is unchanged" >&6;}+ else+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$ac_file" : 'X\(//\)[^/]' \| \+ X"$ac_file" : 'X\(//\)$' \| \+ X"$ac_file" : 'X\(/\)' \| \+ . : '\(.\)' 2>/dev/null ||+echo X"$ac_file" |+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }+ /^X\(\/\/\)$/{ s//\1/; q; }+ /^X\(\/\).*/{ s//\1/; q; }+ s/.*/./; q'`+ { if $as_mkdir_p; then+ mkdir -p "$ac_dir"+ else+ as_dir="$ac_dir"+ as_dirs=+ while test ! -d "$as_dir"; do+ as_dirs="$as_dir $as_dirs"+ as_dir=`(dirname "$as_dir") 2>/dev/null ||+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \+ X"$as_dir" : 'X\(//\)[^/]' \| \+ X"$as_dir" : 'X\(//\)$' \| \+ X"$as_dir" : 'X\(/\)' \| \+ . : '\(.\)' 2>/dev/null ||+echo X"$as_dir" |+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }+ /^X\(\/\/\)$/{ s//\1/; q; }+ /^X\(\/\).*/{ s//\1/; q; }+ s/.*/./; q'`+ done+ test ! -n "$as_dirs" || mkdir $as_dirs+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}+ { (exit 1); exit 1; }; }; }++ rm -f $ac_file+ mv $tmp/config.h $ac_file+ fi+ else+ cat $tmp/config.h+ rm -f $tmp/config.h+ fi+done+_ACEOF++cat >>$CONFIG_STATUS <<\_ACEOF++{ (exit 0); exit 0; }+_ACEOF+chmod +x $CONFIG_STATUS+ac_clean_files=$ac_clean_files_save+++# 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 || { (exit 1); exit 1; }+fi+
+ configure.ac view
@@ -0,0 +1,61 @@+AC_INIT([Haskell Graphics Library], [3.1], [libraries@haskell.org], [HGL])++FP_ARG_HGL++if test "$enable_hgl" = no; then+ HGL_BUILD_PACKAGE=no+else+# Safety check: Ensure that we are in the correct source directory.+AC_CONFIG_SRCDIR([Graphics/HGL.hs])++AC_CONFIG_HEADERS([include/HsHGLConfig.h])++# Check for X11 include paths and libraries+AC_PATH_XTRA++# AC_PATH_XTRA doesn't actually check that the C compiler can+# really include the X headers, so double-check here. In particular,+# this will catch the case of using a mingw32 gcc on a Cygwin system:+# Cygwin has the X headers & libs installed, but the mingw32 gcc can't+# use them, and we want to disable the package in this case.+CPPFLAGS="$CPPFLAGS $X_CFLAGS"+AC_TRY_CPP([#include <X11/Xlib.h>],,[no_x=yes])++# Build the package if we found X11 stuff+if test "$no_x" = yes; then+ # or we're on Windows+ AC_CHECK_HEADER([windows.h],+ [HGL_BUILD_PACKAGE=yes+ PLATFORM=Win32+ AC_DEFINE(X_DISPLAY_MISSING)],+ [HGL_BUILD_PACKAGE=no])+else+ HGL_BUILD_PACKAGE=yes+ PLATFORM=X11+fi+fi+AC_SUBST([HGL_BUILD_PACKAGE])+AC_SUBST([PLATFORM])++case "$PLATFORM" in+Win32) EXTRA_MODULES='Graphics.HGL.Win32.Bitmap, Graphics.HGL.Win32.Draw, Graphics.HGL.Win32.Types, Graphics.HGL.Win32.WND' ;;+X11) EXTRA_MODULES='Graphics.HGL.X11.Display, Graphics.HGL.X11.DC, Graphics.HGL.X11.Timer, Graphics.HGL.X11.Types, Graphics.HGL.X11.Window' ;;+*) EXTRA_MODULES= ;;+esac+AC_SUBST([EXTRA_MODULES])++# Define CPP variables used in package.conf.in+if test "$HGL_BUILD_PACKAGE" = yes; then+ AC_DEFINE_UNQUOTED([PLATFORM], [$PLATFORM],+ [Package providing the underlying graphics library.])+fi++if test "$HGL_BUILD_PACKAGE" = yes; then+ BUILD_PACKAGE_BOOL=True+else+ BUILD_PACKAGE_BOOL=False+fi+AC_SUBST([BUILD_PACKAGE_BOOL])++AC_CONFIG_FILES([config.mk HGL.buildinfo])+AC_OUTPUT
+ include/HsHGLConfig.h.in view
@@ -0,0 +1,52 @@+/* include/HsHGLConfig.h.in. Generated from configure.ac by autoheader. */++/* Define to 1 if you have the <inttypes.h> header file. */+#undef HAVE_INTTYPES_H++/* Define to 1 if you have the <memory.h> header file. */+#undef HAVE_MEMORY_H++/* Define to 1 if you have the <stdint.h> header file. */+#undef HAVE_STDINT_H++/* Define to 1 if you have the <stdlib.h> header file. */+#undef HAVE_STDLIB_H++/* Define to 1 if you have the <strings.h> header file. */+#undef HAVE_STRINGS_H++/* Define to 1 if you have the <string.h> header file. */+#undef HAVE_STRING_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/types.h> header file. */+#undef HAVE_SYS_TYPES_H++/* Define to 1 if you have the <unistd.h> header file. */+#undef HAVE_UNISTD_H++/* Define to the address where bug reports for this package should be sent. */+#undef PACKAGE_BUGREPORT++/* Define to the full name of this package. */+#undef PACKAGE_NAME++/* Define to the full name and version of this package. */+#undef PACKAGE_STRING++/* Define to the one symbol short name of this package. */+#undef PACKAGE_TARNAME++/* Define to the version of this package. */+#undef PACKAGE_VERSION++/* Package providing the underlying graphics library. */+#undef PLATFORM++/* Define to 1 if you have the ANSI C header files. */+#undef STDC_HEADERS++/* Define to 1 if the X Window System is missing or not being used. */+#undef X_DISPLAY_MISSING