
On Sat, Apr 14, 2007 at 07:09:57AM -0700, David Roundy wrote:
On Fri, Apr 13, 2007 at 06:04:46PM -0600, Jason Creighton wrote:
I poked around the cabal docs for a bit, and I didn't see any obvious way to get cabal to check for the presence of certain headers. Also, if the headers weren't there, we couldn't really do anything anyway, other than fail with a friendlier error.
Argh! That seems crazy. How can cabal not have support for looking for libraries? It's not so hard to write, but this seems like it'd be critical--certainly it'll be critical if we're going to use cabal for darcs (as Eric is in the process of doing).
I Am Not A Cabal Expert. Please take what I say with a grain of salt. :) But it does appear to me that, for right now anyway, the answer is "use autoconf or similar": http://www.haskell.org/ghc/docs/latest/html/Cabal/authors.html#system-depend...
I wonder if the Xinerama module should be a separate package anyway. What do you guys think about that?
It could be, but then we'd still depend on the module, unless cabal supports optional package dependencies. I'd rather have a compile-time check whether xinerama is present, and preferably if it's not present then we should emit a warning (WARNING: compiling without xinerama support!!!) and compile an X11-extras with the same API, but which assumes just one screen. It doesn't seem like it should be that hard, and reducing the number of libraries required would definitely be a Good Thing. Most people don't actually have two monitors.
Yes, that could work. I'm working on doing this with a simple "configure" (just a plain shell script, no autoconf (yet?)) script. I'll let y'all know how it turns out. This brings up another minor issue: Right now, Graphics.X11.Xinerama exports: XineramaScreenInfo data structure xineramaIsActive :: Display -> IO Bool xineramaQueryExtension :: Display -> IO (Maybe (CInt, CInt)) xineramaQueryVersion :: Display -> IO (Maybe (CInt, CInt)) xineramaQueryScreens :: Display -> IO (Maybe [XineramaScreenInfo]) getScreenInfo :: Display -> IO [Rectangle] The xinerama* functions are as direct as possible wrappers around their C equivalents. getScreenInfo is a helpful wrapper around xineramaQueryScreens that fakes out a single display when Xinerama is not active. (That's right: Even if the X11 servers supports Xienrama, if it's not currently being used, all the Xinerama-functions fail. Yay.) So the upshot of this is, if we do autoconfig magic (which I think we probably should do), we can only export getScreenInfo and forget about providing a low-level interface to Xinerama. I do not think this is a major concern. The other functions are fairly useless: xineramaIsActive does what you'd expect, xineramaQueryExtension returns X11 extension numbers, which I think would only be useful for low-level X11 programming, and xineramaQueryVersion returns the major and minor version numbers of the Xinerama protocol being used. Again, I do not see these as major issues. Xmonad only uses getScreenInfo, and I don't know of anybody else that even uses the Xinerama wrapper. If, in the future, somebody comes up with a valid use case for them, we can cross that bridge when we come to it. So if nobody objects, I'm going to continue to work on autoconfig magic to make a "getScreenInfo" that works even in the face of non-existent Xinerama. Jason Creighton