Autoconf - Where does config.h go?
Asked Answered
F

3

6

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)

Fieldfare answered 27/11, 2009 at 18:53 Comment(1)
The method for installing config.h should be the same as your method for destroying your filesystem. You can pour acid on the hard drive, or drop the machine off a 90 story building, or drop it into a lake. But a better choice is to not do it. Config.h should only be used in the build directory when you compile your project. It should not be installed.Hap
I
5

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.

Imbecile answered 28/11, 2009 at 1:57 Comment(0)
E
2

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.

Eponym answered 29/11, 2009 at 18:0 Comment(0)
F
1

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.

Foil answered 27/11, 2009 at 19:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.