#include "config.h" in .h files

I was writing a new C test to run from test_c_utils.py and I found that #include “config.h” is a problem for such tests, as we don’t know for sure where the config file is when the test is run. I see several solutions:

  1. Provide some environment variable to the test scripts which tells where to find config.h so the appropriate -I flag can be provided to the compiler.
  2. Export and install config.h in include/graphviz/config.h and include it as <graphviz/config.h> (Though this might also need an env var to find, though perhaps we can assume we can find it from $PATH: look for dot executable and navigate from there.)
  3. Remove #include “config.h” from all .h files and use NO_CONFIG preprocessor definiition as already done in list.c to support test_list.c.
    • Note that list.c is lucky in that it has a small include list, and misses the list below
    • Currently, a small number of .h files have #include “config.h”, and need to be fixed:
      • cmd/gvedit/csettings.h
        cmd/tools/convert.h
        lib/cgraph/cghdr.h
        lib/cgraph/ingraphs.h
        lib/common/colorprocs.h
        lib/common/render.h
        lib/fdpgen/grid.h
        lib/neatogen/neato.h
        lib/neatogen/sparsegraph.h
        lib/sfdpgen/sfdp.h
        lib/sfio/sfhdr.h
        lib/sfio/sfio.h
        plugin.demo/xgtk/src/support.h
    • Also, the generated parser files currently only see config.h because it’s included by some .h files they include. This must also be fixed, as without seeing the config.h they are buggy.:
      • cmd/tools/gmlparse.y
        lib/cgraph/grammar.y
        lib/cgraph/scan.l
        lib/common/htmlparse.y
        lib/expr/exparse.y

I Vote for #3 and can send out an MR if supported, though perhaps there are reasons to go with a different solution. Please let me know.

-Brian