开发者

Autoconf - Where does config.h go?

I'm writing my own unit testing library (using autoconf, automake, and libtool) to better fit my needs (I don't need a super large amount of features, just a test runner and assertions). I have开发者_Python百科 gotten to the point where it seems to be usable.

Of course, it uses a config.h to figure out what headers to include. The problem is that I am not sure where config.h should go since it will tend to clash easily with other project's config.h, as well as the fact that it is architecture dependent.

What should my method be for installing this header? (It is needed by all the other headers)


The ax_prefix_config_h macro sounds like what you want. It provides a way to create another config.h-like file that contains the config.h information prefixed. So, e.g., instead of #define HAVE_SOMETHING in config.h you'll get #define MYLIB_HAVE_SOMETHING in mylib_config.h. Quite handy.


You shouldn't be exporting config.h in your library's interface anyway.

This link shows a method of getting around that if your installed headers really, truly need to be platform dependent. It is a fragile method using an outdated autoconf macro though.


You can choice to output a different config file by changing the AC_OUTPUT macro, although I'm not sure how you project is going to integrate with other projects. If it's a sub-project, then it'll be in a sub-directory anyway.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜