Search code examples
cheader-filesconfigureautotools

Get list of all includes for project compiled with GNU autotools


For a C project managed and successfully compiled using GNU autotools, eg. emacs, is there a simple way to get a list of all the included headers that were required to compile the project (the site-specific include paths that were found by the configure script during compilation)?

My current approach has just been to

  1. run cpp -C ...
  2. look at the error for a missing header
  3. manually add the path to the required header to my command
  4. repeat until there are no more errors.

Obviously, this is a pain. I would think a project compiled using configure would have this information somewhere. Does it?


Solution

  • For a C project managed and compiled using GNU autotools, eg. emacs, is there a simple way to get a list of all the included headers that were required to compile the project?

    If by "were required" you mean that you want to make the determination after the project is successfully built, then yes. Unless suppressed, Automake-based makefiles have rules for generating include-dependency lists, which they use on subsequent builds to recognize the need to rebuild unchanged sources on account of changes to dependencies. You can find these files in the .deps subdirectory.

    For what it's worth, when compiling with gcc, the gcc -MM command is used for the purpose.