views:

331

answers:

3

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 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)

A: 

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.

Douglas Leeder
+2  A: 

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.

Rhys Ulerich
Brilliant! Thanks.
mathepic
+1  A: 

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.

ptomato