linamh/net-analyzer/net-snmp/files/net-snmp-5.4.1-sensors3-version_detect.patch

57 lines
1.4 KiB
Diff
Raw Normal View History

From: Gordon Malm <gengor@gentoo.org>
Detect lm_sensors version and build accordingly.
--- a/agent/mibgroup/hardware/sensors.h
+++ b/agent/mibgroup/hardware/sensors.h
@@ -1,13 +1,21 @@
config_require(hardware/sensors/hw_sensors)
#if defined(solaris)
+
# if defined(HAVE_PICL_H)
config_require(hardware/sensors/picld_sensors)
# else
config_require(hardware/sensors/kstat_sensors)
# endif
+
#else
+
+# if defined(HAVE_LMSENSORS_V2)
+config_require(hardware/sensors/lmsensors_v2)
+# else
config_require(hardware/sensors/lmsensors_v3)
+# endif
+
#endif
//config_require(hardware/sensors/dummy_sensors)
--- a/configure.in
+++ b/configure.in
@@ -1909,6 +1909,25 @@ done
AC_MSG_RESULT([$new_module_list.])
+echo " $new_module_list " | $GREP "ucd-snmp/lmsensorsMib" > /dev/null
+if test $? -eq 0 ; then
+ case $target_os in
+ linux*)
+ AC_CHECK_HEADER(sensors/sensors.h,,[AC_MSG_ERROR([asked to use lm_sensors but I couldn't find sensors/sensors.h])])
+
+ AC_MSG_CHECKING([lm_sensors version])
+ AC_EGREP_CPP(lmsensors_v2,[
+#include <sensors/sensors.h>
+#if SENSORS_API_VERSION < 0x400
+lmsensors_v2
+#endif
+ ], [AC_DEFINE([HAVE_LMSENSORS_V2], [1], [Define if lm_sensors version 2.x])]
+ have_lmsensors_ver="2.x", have_lmsensors_ver="3.x or higher")
+ AC_MSG_RESULT([$have_lmsensors_ver])
+ ;;
+ esac
+fi
+
#---------------------
# loop over module list
#