What is the best way to auto detect library dependencies in a C/C++ project?
I have a project where I have all the dependencies on the machine. It builds and runs. Now I want to put together a autotools build system. I am looking for a good way to auto detect all the dependencies needed such as header files used and libraries needed for linking.
The library bit seems to be the hardest for me to figure out. I'd like to be able to say, generate AC_CHECK_LIB commands for every function in a list or something. I could probably do this in Perl, but I've got to imagine it already exists elsewhere.
What I know is that I can view symbols with objdump and nm, I can find what library a function belongs to with these utilties, then I can manually enter an AC_CHECK_LIB command in my configure.ac to check for it. Automation would be awesome at this point.
Thanks,
Chenz
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…