]> git.ipfire.org Git - collecty.git/commitdiff
configure: Fix detection for libsensors
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 23 Oct 2025 13:38:44 +0000 (13:38 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 23 Oct 2025 13:38:44 +0000 (13:38 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
configure.ac

index 2a0ae0a55e67d1ee55b347d80398655414e7df08..6a02140ee063e05b9a90f19dc00aaa88912582c1 100644 (file)
@@ -163,9 +163,15 @@ save_LIBS="$LIBS"
 # 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"