1 Description: configure: barometer: fix i2c lib usage for 4.0
2 Forwarded: https://github.com/collectd/collectd/issues/2646
3 Author: Andreas Hasenack <andreas.hasenack@canonical.com>
4 Bug-Ubuntu: https://bugs.launchpad.net/bugs/1742691
5 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=886920
6 Last-Update: 2018-02-21
8 diff --git a/Makefile.am b/Makefile.am
9 index ae027a368..ef71be836 100644
10 --- a/Makefile.am
11 +++ b/Makefile.am
12 @@ -591,7 +591,7 @@ if BUILD_PLUGIN_BAROMETER
13 pkglib_LTLIBRARIES += barometer.la
14 barometer_la_SOURCES = src/barometer.c
15 barometer_la_LDFLAGS = $(PLUGIN_LDFLAGS)
16 -barometer_la_LIBADD = -lm
17 +barometer_la_LIBADD = -lm -li2c
18 endif
20 if BUILD_PLUGIN_BATTERY
21 diff --git a/configure.ac b/configure.ac
22 index e869a6a09..d9854d024 100644
23 --- a/configure.ac
24 +++ b/configure.ac
25 @@ -1883,7 +1883,7 @@ if test "x$ac_system" = "xLinux"; then
26 [with_libi2c="no (symbol i2c_smbus_read_i2c_block_data not found - have you installed libi2c-dev ?)"],
27 [[
28 #include <stdlib.h>
29 - #include <linux/i2c-dev.h>
30 + #include <i2c/smbus.h>
31 ]]
32 )
33 else
34 diff --git a/src/barometer.c b/src/barometer.c
35 index f698005ca..e3d418d2a 100644
36 --- a/src/barometer.c
37 +++ b/src/barometer.c
38 @@ -27,6 +27,7 @@
40 #include <fcntl.h>
41 #include <linux/i2c-dev.h>
42 +#include <i2c/smbus.h>
43 #include <math.h>
44 #include <stdint.h>
45 #include <sys/ioctl.h>