This patch makes optional the sysfs support in libsensors.  The default is to
*disable* sysfs support if a 2.4.x kernel is detected, for all other versions,
support will be enabled.  This can be overridden in the top-level Makefile.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3096 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark M. Hoffman committed 2005-09-18 20:39:53 +00:00
1 parent 85a0c8ccb2
commit a116313d54
3 files changed
+39 -1

No files matched your search

+19
View File
@@ -86,6 +86,19 @@ CC := gcc
# /lib/modules/2.4.29
MODPREF := /lib/modules/$(shell $(CC) -I$(LINUX_HEADERS) -E etc/config.c | grep uts_release |cut -f 2 -d'"')
# When building userspace for use with 2.4.x series kernels, we turn off
# sysfs support by default. You can override this (e.g. if you want
# to build binaries that work for both 2.4.x, and 2.6.x and above)
# by uncommenting the line after the next endif. Keep in mind, if and only
# if you do this: you will need to install the libsysfs libraries on your
# kernel 2.4.x systems also.
ifeq (,$(findstring /2.4., $(MODPREF)))
SYSFS_SUPPORT := 1
else
SYSFS_SUPPORT :=
endif
#SYSFS_SUPPORT := 1
# Prevent 2.6+ users from using improper targets, as this won't work.
ifeq (,$(findstring /2.4., $(MODPREF)))
ifeq (, $(MAKECMDGOALS))
@@ -257,8 +270,14 @@ MODCFLAGS += $(ALL_CFLAGS)
PROGCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS) -Wundef
PROGCFLAGS := $(ALL_CFLAGS)
ARCPPFLAGS := $(ALL_CPPFLAGS)
ifdef SYSFS_SUPPORT
ARCPPFLAGS := $(ARCPPFLAGS) -DSYSFS_SUPPORT
endif
ARCFLAGS := $(ALL_CFLAGS)
LIBCPPFLAGS := $(ALL_CPPFLAGS)
ifdef SYSFS_SUPPORT
LIBCPPFLAGS := $(LIBCPPFLAGS) -DSYSFS_SUPPORT
endif
LIBCFLAGS := -fpic $(ALL_CFLAGS)
.PHONY: all clean install version package dep
+10 -1
View File
@@ -49,7 +49,11 @@ LIBTARGETS := $(MODULE_DIR)/$(LIBSTLIBNAME) $(MODULE_DIR)/$(LIBSHLIBNAME) \
LIBCSOURCES := $(MODULE_DIR)/data.c $(MODULE_DIR)/general.c \
$(MODULE_DIR)/error.c $(MODULE_DIR)/chips.c \
$(MODULE_DIR)/proc.c $(MODULE_DIR)/access.c \
$(MODULE_DIR)/init.c $(MODULE_DIR)/sysfs.c
$(MODULE_DIR)/init.c
ifdef SYSFS_SUPPORT
LIBCSOURCES := $(LIBCSOURCES) $(MODULE_DIR)/sysfs.c
endif
LIBOTHEROBJECTS := $(MODULE_DIR)/conf-parse.o $(MODULE_DIR)/conf-lex.o
LIBSHOBJECTS := $(LIBCSOURCES:.c=.lo) $(LIBOTHEROBJECTS:.o=.lo)
LIBSTOBJECTS := $(LIBCSOURCES:.c=.ao) $(LIBOTHEROBJECTS:.o=.ao)
@@ -60,8 +64,13 @@ LIBHEADERFILES := $(MODULE_DIR)/error.h $(MODULE_DIR)/sensors.h \
$(MODULE_DIR)/chips.h
# How to create the shared library
ifdef SYSFS_SUPPORT
$(MODULE_DIR)/$(LIBSHLIBNAME): $(LIBSHOBJECTS)
$(CC) -shared -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm -lsysfs
else
$(MODULE_DIR)/$(LIBSHLIBNAME): $(LIBSHOBJECTS)
$(CC) -shared -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm
endif
$(MODULE_DIR)/$(LIBSHSONAME): $(MODULE_DIR)/$(LIBSHLIBNAME)
$(RM) $@
+10
View File
@@ -20,6 +20,7 @@
#ifndef SENSORS_LIB_SYSFS_H
#define SENSORS_LIB_SYSFS_H
#ifdef SYSFS_SUPPORT
extern int sensors_found_sysfs;
extern char sensors_sysfs_mount[];
@@ -30,4 +31,13 @@ extern int sensors_read_sysfs_chips(void);
extern int sensors_read_sysfs_bus(void);
#else
#define sensors_found_sysfs 0
#define sensors_init_sysfs()
#define sensors_read_sysfs_chips() (-1)
#define sensors_read_sysfs_bus() (-1)
#endif
#endif /* !SENSORS_LIB_SYSFS_H */