Description
I ran into an issue today where I needed to write some code like this:
#if /* <C library> version is greater than 2.1 */
wibble
#else
wobble
#endif
This is in a project where <C library>
is detected with pkgconfig-depends
. I would have hoped that the autogenerated cabal_macros.h
would provide some way of detecting <C library>
's version (as specified in <C library>.pc
, but sadly that doesn't seem to be the case, so I have to work around it manually by using Cabal
flags and cpp-options: -DC_LIBRARY_VERSION=xyz
.
Would it be unreasonable to have cabal_macros.h
spit out PKGCONFIG_VERSION
and MIN_PKGCONFIG_VERSION
macros for every pkg-config
dependency? There's the issue that pkg-config
names can contain characters that aren't permissible in Cabal
package names. For example, glib-2.0
contains a period. But maybe we could just turn periods into underscores like we currently do hyphens.