Should the config.h file be published? Conflict with Python

I am working on a C library that has SWIG bindings to Python. In my autotools configuration, I am checking the gettimeofday function. I found that I cannot compile the Python part of my project because it conflicts with the pyconfig.h file, which also defines HAVE_GETTIMEOFDAY.

This seems like a very common problem, I was surprised to see that Python config.h contrary to my own. In my project, I keep config.h private --- ie Not installed with make install . I got the impression that this is correct. I found at least one blog post where this opinion is shared.

Is this a bug that Python is conflicting with my config.h ?

Edit: I solved this by adding

 AC_DEFINE(Py_PYCONFIG_H,[],[Defined here to avoid conflicts with pyconfig.h]) 

to my configure.ac . The question still remains, should config.h be open in your project or remain closed, accessible only to implementation files at build time?

+4
source share
1 answer

You should not post to avoid problems like the ones you have. See the Gentoo autotools best-practices document , in particular the paragraph starting with the header file config.h should read the internal header file .

In your case, I would do the same as you: add #define, which prevents the processing of this file.

+3
source

All Articles