From: paul k. <pau...@xs...> - 2005-03-31 15:13:17
|
Hi Michael The problem is indeed in configure.in. The nested AC_CHECK_HEADERS doesn't work properly. (not sure why) AC_CHECK_HEADERS(linux/compiler.h, [AC_CHECK_HEADERS(linux/i2c.h,[ AC_CHECK_HEADERS(linux/i2c-dev.h,[has_i2c=true],[has_i2c=false]$ ],[has_i2c=false])] [has_i2c=false] ) There are actually two problems. One of them generates the warnings on linux/i2c-dev.h If I understand correctly, the behaviour of autoconf is changed. Instead of only preprocessing the header files, they now try to compile the files. If the file doesn't compile the warning is generated, so the developers (i.e. us) can change it. In the current autoconf versions, the file is still accepted if preprocessing goes well. But for future versions of autoconf, the check is based on if the file actually compiles. So it is recommended that we eliminate the warning by listing the required include files to make linux/i2c-dev.h compile. This is done by: AC_CHECK_HEADERS(linux/i2c-dev.h,[has_i2c=true],[has_i2c=false],[#include <linux/compiler.h>;#include <linux/i2c.h>;]) Using this line as the third line in the nested sequence above, still doesn't work. All 3 includes are correctly validated, but for some reason has_i2c is never set to true. I solved by changing the entire nested sequence to: AC_CHECK_HEADERS(linux/compiler.h linux/i2c.h linux/i2c-dev.h,[has_i2c=true],[has_i2c=false],[#include <linux/compiler.h>;#include <linux/i2c.h>;]) That works for me to enable i2c support, and also disables i2c support when linux/compiler.h is missing. I still have to do some additional tests, but you can give it a try with the above line. Cheers, Paul Michael Reinelt wrote: >Hi Luis, > > > >>Although you do have ifdef's around my I2C functions, and after I >>manually enable I2C by editing config.h, it seems to ignore the >>drv_generic_i2c.h file, as it spews out errors at tthe end, and >>drv_generic_i2c.c is not being compiled at all... >> >>What does the configure look for in order to detect I2C as present? >> >> > >Well, editing config.h isn't enough. The drv_generic_i2c.o will not be >compiled and linked if configure cannot find the i2c includes (or thinks >they're unusable, as it happens here). > >The detection is done within configure.in, line 57, which sets the >variable "has_i2c" to true or false. This variable is checked in >drivers.m4, at the very end, and ex-/includes drv_generic_i2c.o, and >defines the WITH_I2C preprocessor symbol. > >configure checks for compiler.h, i2c.h and i2c-dev.h. Take a look at >your config.log, it should contain some messages about i2c. > > >bye, Michael > > > |