English 中文(简体)
Should config.h be made public? Conflict with Python
原标题:
  • 时间:2009-12-24 00:47:48
  •  标签:
  • autotools

I am working on a C library that has SWIG bindings to Python. In my autotools configuration, I check for the gettimeofday function. I have discovered that I can t compile the Python portion of my project because it conflicts with a file pyconfig.h, which also defines HAVE_GETTIMEOFDAY.

This seems like a very general problem, I was surprised to see Python s config.h conflicting with my own. In my project I keep config.h private---i.e., not installed with make install. My impression is that this is correct. I found at least one blog post where this opinion is shared.

Is it a bug that Python conflicts with my config.h?

Edit: I solved it by adding

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

to my configure.ac. Question still stands, should config.h be public in your project, or kept private, only available to implementation files during build?

最佳回答

It should not be made public to avoid problems like the one you re having. See the Gentoo autotools best-practices document, specifically, the paragraph that starts with The config.h header file should be considered to be an internal header file.

In your case, I would do exactly the same thing that you did: add a #define that prevents processing that file.

问题回答

暂无回答




相关问题
How to install and use libtool shared library (.lo files)?

So after I ran libtool and got out a libfoo.lo and foo.o file from my library source, how do I convert the libfoo.lo file into a normal Linux shared library, like libfoo.so.1.0.0 so I can install and ...

What s the point of aclocal?

What s the point of the aclocal script and aclocal.m4 file, in context of using autotools to configure source files? From what I read, aclocal scans macro files for macros that are later used by ...

Should config.h be made public? Conflict with Python

I am working on a C library that has SWIG bindings to Python. In my autotools configuration, I check for the gettimeofday function. I have discovered that I can t compile the Python portion of my ...

What is the proper way of including linux kernel config?

I m porting an old version of a software that is partly a linux kernel module to EL5, after doing the relevant hacks, the horrible GNU autotools mess that is used to compile the thing (no, it does ...

热门标签