Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# lm-sensors
AC_CHECK_HEADERS([sensors/sensors.h sensors/errors.h])
-LIBS=
-AC_CHECK_LIB(sensors, sensors_init, [have_sensors=yes], [have_sensors=no])
-SENSORS_LIBS="$LIBS"
+LIBS="-lm"
+AC_CHECK_LIB([sensors], [sensors_init],
+ [have_sensors=yes; SENSORS_LIBS="-lsensors ${LIBS}"],
+ [have_sensors=no; SENSORS_LIBS=""])
+
+if test "x$have_sensors" = "xyes"; then
+ AC_DEFINE([HAVE_SENSORS], [1], [Define if you have libsensors])
+fi
+
AC_SUBST(SENSORS_LIBS)
LIBS="$save_LIBS"