Changeset 3096

Show
Ignore:
Timestamp:
09/18/05 22:39:53 (9 years ago)
Author:
mmh
Message:

(mmh)
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.

Location:
lm-sensors/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/Makefile

    r3087 r3096  
    8787MODPREF := /lib/modules/$(shell $(CC) -I$(LINUX_HEADERS) -E etc/config.c | grep uts_release |cut -f 2 -d'"') 
    8888 
     89# When building userspace for use with 2.4.x series kernels, we turn off 
     90# sysfs support by default.  You can override this (e.g. if you want 
     91# to build binaries that work for both 2.4.x, and 2.6.x and above) 
     92# by uncommenting the line after the next endif.  Keep in mind, if and only 
     93# if you do this: you will need to install the libsysfs libraries on your 
     94# kernel 2.4.x systems also. 
     95ifeq (,$(findstring /2.4., $(MODPREF))) 
     96        SYSFS_SUPPORT := 1 
     97else 
     98        SYSFS_SUPPORT := 
     99endif 
     100#SYSFS_SUPPORT := 1 
     101 
    89102# Prevent 2.6+ users from using improper targets, as this won't work. 
    90103ifeq (,$(findstring /2.4., $(MODPREF))) 
     
    258271PROGCFLAGS := $(ALL_CFLAGS) 
    259272ARCPPFLAGS := $(ALL_CPPFLAGS) 
     273ifdef SYSFS_SUPPORT 
     274ARCPPFLAGS := $(ARCPPFLAGS) -DSYSFS_SUPPORT 
     275endif 
    260276ARCFLAGS := $(ALL_CFLAGS) 
    261277LIBCPPFLAGS := $(ALL_CPPFLAGS) 
     278ifdef SYSFS_SUPPORT 
     279LIBCPPFLAGS := $(LIBCPPFLAGS) -DSYSFS_SUPPORT 
     280endif 
    262281LIBCFLAGS := -fpic $(ALL_CFLAGS) 
    263282 
  • lm-sensors/trunk/lib/Module.mk

    r3093 r3096  
    5050               $(MODULE_DIR)/error.c $(MODULE_DIR)/chips.c \ 
    5151               $(MODULE_DIR)/proc.c $(MODULE_DIR)/access.c \ 
    52                $(MODULE_DIR)/init.c $(MODULE_DIR)/sysfs.c 
     52               $(MODULE_DIR)/init.c 
     53ifdef SYSFS_SUPPORT 
     54        LIBCSOURCES := $(LIBCSOURCES) $(MODULE_DIR)/sysfs.c 
     55endif 
     56 
    5357LIBOTHEROBJECTS := $(MODULE_DIR)/conf-parse.o $(MODULE_DIR)/conf-lex.o 
    5458LIBSHOBJECTS := $(LIBCSOURCES:.c=.lo) $(LIBOTHEROBJECTS:.o=.lo) 
     
    6165 
    6266# How to create the shared library 
     67ifdef SYSFS_SUPPORT 
    6368$(MODULE_DIR)/$(LIBSHLIBNAME): $(LIBSHOBJECTS) 
    6469        $(CC) -shared -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm -lsysfs 
     70else 
     71$(MODULE_DIR)/$(LIBSHLIBNAME): $(LIBSHOBJECTS) 
     72        $(CC) -shared -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm 
     73endif 
    6574 
    6675$(MODULE_DIR)/$(LIBSHSONAME): $(MODULE_DIR)/$(LIBSHLIBNAME) 
  • lm-sensors/trunk/lib/sysfs.h

    r3095 r3096  
    2121#define SENSORS_LIB_SYSFS_H 
    2222 
     23#ifdef SYSFS_SUPPORT 
    2324extern int sensors_found_sysfs; 
    2425 
     
    3132extern int sensors_read_sysfs_bus(void); 
    3233 
     34#else 
     35 
     36#define sensors_found_sysfs 0 
     37#define sensors_init_sysfs() 
     38#define sensors_read_sysfs_chips() (-1) 
     39#define sensors_read_sysfs_bus() (-1) 
     40 
     41#endif 
     42 
    3343#endif /* !SENSORS_LIB_SYSFS_H */