
On Tue, 2005-08-09 at 09:36 +0100, Simon Marlow wrote:
The problem, of course, is how to get the value of $datadir to the program if it is configurable. I suggested a CPP symbol, but that is far from ideal (we don't do it this way in fptools projects any more for various reasons). Another option is to have the Setup script generate a file containing the declarations:
-- paths.h prefix="/usr/local" bindir="bin" -- or absolute libdir="lib/foo-1.0/ghc-6.4" datadir="share/foo-1.0"
which you can then #include into Haskell source. Another alternative, if you want to avoid CPP, is to have Setup generate a complete Haskell module with these declarations, but then you have to somehow choose an appropriate module name that doesn't clash.
paths.h gets my vote. Anyone have any better ideas?
What if, say, you have some C code in your package that also wants to know the values of these paths? Bernie.