Right now, we have rolled our own tool that outputs compiler options to be used when building magic tools (src/tp-magic-config.sh.in being the source, $(BIN_PREFIX)/tp-magic-config being the installed script).
We should probably look into using pkg-config, part of the freedesktop.org (FDO) standard. (SDL, GTK, etc. use it these days.) See: http://www.freedesktop.org/wiki/Software/pkg-config