From: Sebastien GODARD Date: Sat, 19 Dec 2020 08:08:59 +0000 (+0100) Subject: simtest: Check for 32 bit version of lm_sensors library X-Git-Tag: v12.5.2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4f52299cb9094d1413ebaae51d5311ee075a67d0;p=sysstat simtest: Check for 32 bit version of lm_sensors library This version of lm_sensors library will be used to compile the 32 bit version of sadc if available. 32 bit version of sadc is useful to make sure that datafiles created by a 64 or 32 bit version of sadc can be read on every architecture. Signed-off-by: Sebastien GODARD --- diff --git a/Makefile.in b/Makefile.in index ce6cb78..be4049c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -23,13 +23,24 @@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_BIN = @INSTALL_BIN@ +ifndef HAVE_SENSORS HAVE_SENSORS = @HAVE_SENSORS@ +endif LFSENSORS = DFSENSORS = ifeq ($(HAVE_SENSORS),y) LFSENSORS = @LFSENSORS@ DFSENSORS = @DFSENSORS@ endif +ifndef HAVE_SENSORS32 +HAVE_SENSORS32 = @HAVE_SENSORS32@ +endif +LFSENSORS32 = +DFSENSORS32 = +ifeq ($(HAVE_SENSORS32),y) +LFSENSORS32 = @LFSENSORS32@ +DFSENSORS32 = @DFSENSORS32@ +endif HAVE_PCP = @HAVE_PCP@ LFPCP = @@ -74,16 +85,33 @@ DOC_DIR = @docdir@ endif NLS_DIR = $(PREFIX)/share/locale + +ifndef SYSCONFIG_DIR SYSCONFIG_DIR = @SYSCONFIG_DIR@ +endif +ifndef SYSCONFIG_FILE SYSCONFIG_FILE = @SYSCONFIG_FILE@ +endif # Compiler flags -CFLAGS = @CFLAGS@ -Wall -Wstrict-prototypes -pipe -O2 +ifndef CFLAGS +CFLAGS = @CFLAGS@ +endif +CFLAGS += -Wall -Wstrict-prototypes -pipe -O2 + +ifndef DFLAGS DFLAGS = @DFLAGS@ -LFLAGS = @STRIP@ +endif DFLAGS += -DSA_DIR=\"$(SA_DIR)\" -DSADC_PATH=\"$(SADC_PATH)\" -DFLAGS += $(DFSENSORS) +DFLAGS += $(DFSENSORS) $(DFSENSORS32) DFLAGS += $(DFPCP) +ifdef TFLAGS +DFLAGS += $(TFLAGS) +endif + +ifndef LFLAGS +LFLAGS = @STRIP@ +endif # Commands ifndef MSGFMT @@ -116,8 +144,14 @@ SYSPARAM = @SYSPARAM@ ifeq ($(SYSPARAM),y) DFLAGS += -DHAVE_SYS_PARAM_H endif + +ifndef TGLIB32 TGLIB32 = @TGLIB32@ +endif + +ifndef NLS NLS = @NLS@ +endif LFLAGS += @LFINTL@ ifeq ($(NLS),y) REQUIRE_NLS = -DUSE_NLS -DPACKAGE=\"$(PACKAGE)\" -DLOCALEDIR=\"$(NLS_DIR)\" @@ -125,8 +159,13 @@ endif ifdef REQUIRE_NLS DFLAGS += $(REQUIRE_NLS) endif + +ifndef INSTALL_CRON INSTALL_CRON = @INSTALL_CRON@ +endif +ifndef CRON_OWNER CRON_OWNER = @CRON_OWNER@ +endif MAN_GROUP = @MAN_GROUP@ ifndef IGNORE_FILE_ATTRIBUTES @@ -318,6 +357,8 @@ cifsiostat.o: cifsiostat.c cifsiostat.h count.h rd_stats.h version.h common.h cifsiostat: cifsiostat.o librdstats_light.a libsyscom.a +# inisar: Old sar version + tests/ini/sa_common.o: tests/ini/sa_common.c tests/ini/iniversion.h tests/ini/sa.h tests/ini/common.h tests/ini/rd_stats.h tests/ini/rd_sensors.h tests/ini/ioconf.h tests/ini/inisysconfig.h tests/ini/act_sar.o: tests/ini/activity.c tests/ini/sa.h tests/ini/common.h tests/ini/rd_stats.h tests/ini/rd_sensors.h tests/ini/pr_stats.h @@ -344,40 +385,33 @@ tests/ini/inisar.o: tests/ini/inisar.c tests/ini/sa.h tests/ini/iniversion.h tes tests/ini/inisar: tests/ini/inisar.o tests/ini/act_sar.o tests/ini/format_sar.o tests/ini/sa_common.o tests/ini/pr_stats.o tests/ini/librdstats_light.a tests/ini/libsyscom.a +# sar32/sadc32: 32-bit versions of sar/sadc tests/32bits/sadc32.o: sadc.c sa.h version.h common.h rd_stats.h rd_sensors.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< - -tests/32bits/sadc32: LFLAGS += $(LFSENSORS) - -tests/32bits/sadc32: tests/32bits/sadc32.o tests/32bits/act_sadc32.o tests/32bits/sa_wrap32.o tests/32bits/sa_common_light32.o tests/32bits/common_light32.o tests/32bits/systest32.o tests/32bits/librdstats32.a tests/32bits/librdsensors32.a - $(CC) -m32 -o $@ $(CFLAGS) $^ $(LFLAGS) + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/sar32.o: sar.c sa.h version.h common.h rd_stats.h rd_sensors.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< - -tests/32bits/sar32: tests/32bits/sar32.o tests/32bits/act_sar32.o tests/32bits/format_sar32.o tests/32bits/sa_common32.o tests/32bits/pr_stats32.o tests/32bits/librdstats_light32.a tests/32bits/libsyscom32.a - $(CC) -m32 -o $@ $(CFLAGS) $^ $(LFLAGS) + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/act_sadc32.o: activity.c sa.h common.h rd_stats.h rd_sensors.h - $(CC) -m32 -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/act_sar32.o: activity.c sa.h common.h rd_stats.h rd_sensors.h pr_stats.h - $(CC) -m32 -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< tests/32bits/sa_wrap32.o: sa_wrap.c sa.h common.h rd_stats.h count.h rd_sensors.h - $(CC) -m32 -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/sa_common_light32.o: sa_common.c version.h sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h - $(CC) -m32 -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/sa_common32.o: sa_common.c version.h sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/common_light32.o: common.c version.h common.h - $(CC) -m32 -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/systest32.o: systest.c systest.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/libsyscom32.a: tests/32bits/common32.o tests/32bits/ioconf32.o tests/32bits/systest32.o $(AR) rvs $@ $? @@ -392,31 +426,37 @@ tests/32bits/librdsensors32.a: tests/32bits/rd_sensors32.o $(AR) rvs $@ $? tests/32bits/rd_stats32.o: rd_stats.c common.h rd_stats.h - $(CC) -m32 -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/rd_stats_light32.o: rd_stats.c common.h rd_stats.h ioconf.h sysconfig.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/count32.o: count.c common.h rd_stats.h - $(CC) -m32 -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADC $(DFLAGS) $< tests/32bits/count_light32.o: count.c common.h rd_stats.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/format_sar32.o: format.c sa.h common.h rd_stats.h rd_sensors.h - $(CC) -m32 -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SAR $(DFLAGS) $< tests/32bits/pr_stats32.o: pr_stats.c sa.h common.h rd_stats.h rd_sensors.h ioconf.h sysconfig.h pr_stats.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/common32.o: common.c version.h common.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/ioconf32.o: ioconf.c ioconf.h common.h sysconfig.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< tests/32bits/rd_sensors32.o: rd_sensors.c common.h rd_sensors.h rd_stats.h - $(CC) -m32 -o $@ -c $(CFLAGS) $(DFLAGS) $< + $(CC) -o $@ -c $(CFLAGS) $(DFLAGS) $< + +tests/32bits/sadc32: LFLAGS += $(LFSENSORS32) + +tests/32bits/sadc32: tests/32bits/sadc32.o tests/32bits/act_sadc32.o tests/32bits/sa_wrap32.o tests/32bits/sa_common_light32.o tests/32bits/common_light32.o tests/32bits/systest32.o tests/32bits/librdstats32.a tests/32bits/librdsensors32.a + +tests/32bits/sar32: tests/32bits/sar32.o tests/32bits/act_sar32.o tests/32bits/format_sar32.o tests/32bits/sa_common32.o tests/32bits/pr_stats32.o tests/32bits/librdstats_light32.a tests/32bits/libsyscom32.a ifdef REQUIRE_NLS locales: $(NLSGMO) @@ -738,6 +778,10 @@ TESTLIST:=$(shell ls $(TESTDIR) | egrep '^[0-9]+$$' | sort -n) testcomp: tests/ini/inisar sa32bit ifeq ($(TGLIB32),yes) +sa32bit: DFLAGS += -DARCH32 + +sa32bit: CFLAGS += -m32 + sa32bit: tests/32bits/sadc32 tests/32bits/sar32 else sa32bit: diff --git a/configure b/configure index 747b797..cae28b4 100755 --- a/configure +++ b/configure @@ -671,13 +671,16 @@ INIT_DIR RC_DIR rcdir TGLIB32 +DFSENSORS32 +LFSENSORS32 +HAVE_SENSORS32 +DFSENSORS +LFSENSORS +HAVE_SENSORS PCP_IMPL DFPCP LFPCP HAVE_PCP -DFSENSORS -LFSENSORS -HAVE_SENSORS SYSTEMD_SLEEP_DIR SYSTEMD_UNIT_DIR SYSTEMCTL @@ -750,8 +753,8 @@ ac_user_opts=' enable_option_checking with_systemdsystemunitdir with_systemdsleepdir -enable_sensors enable_pcp +enable_sensors enable_largefile enable_nls enable_file_attr @@ -1396,8 +1399,8 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-sensors disable sensors support --disable-pcp disable PCP support + --disable-sensors disable sensors support --disable-largefile omit support for large files --disable-nls disable National Language Support --disable-file-attr do not set attributes on files being installed @@ -4572,6 +4575,110 @@ fi done +# Should we check for PCP support? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCP support" >&5 +$as_echo_n "checking for PCP support... " >&6; } +# Check whether --enable-pcp was given. +if test "${enable_pcp+set}" = set; then : + enableval=$enable_pcp; PCP=$enableval +else + PCP=yes +fi + +if test $PCP != "yes"; then + HAVE_PCP="n" +else + HAVE_PCP="y" +fi + +if test ! $HAVE_PCP_PMAPI_H; then + HAVE_PCP="n" + PCP=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCP" >&5 +$as_echo "$PCP" >&6; } + +# Check for PCP libraries +LFPCP="" +DFPCP="" +if test $HAVE_PCP = "y"; then + PCP=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pmGetVersion in -lpcp" >&5 +$as_echo_n "checking for pmGetVersion in -lpcp... " >&6; } +if ${ac_cv_lib_pcp_pmGetVersion+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcp $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pmGetVersion (); +int +main () +{ +return pmGetVersion (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pcp_pmGetVersion=yes +else + ac_cv_lib_pcp_pmGetVersion=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcp_pmGetVersion" >&5 +$as_echo "$ac_cv_lib_pcp_pmGetVersion" >&6; } +if test "x$ac_cv_lib_pcp_pmGetVersion" = xyes; then : + LFPCP="-lpcp -lpcp_import" +else + HAVE_PCP="n" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCP libraries" >&5 +$as_echo_n "checking for PCP libraries... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include +int +main () +{ +pmiEnd(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + PCP=yes; DFPCP="-DHAVE_PCP" +else + HAVE_PCP="n"; PCP=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCP" >&5 +$as_echo "$PCP" >&6; } +fi + + + + +if test $HAVE_PCP_IMPL_H; then + PCP_IMPL="y" +else + PCP_IMPL="n" +fi + + # Should we check for lm_sensors? { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sensors support" >&5 $as_echo_n "checking for sensors support... " >&6; } @@ -4583,17 +4690,18 @@ else fi if test $SENSORS != "yes"; then - HAVE_SENSORS="n" + SENSORS_SUPPORT="n" else - HAVE_SENSORS="y" + SENSORS_SUPPORT="y" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SENSORS" >&5 $as_echo "$SENSORS" >&6; } -# Check for lm_sensors +# Check for lm_sensors library LFSENSORS="" DFSENSORS="" -if test $HAVE_SENSORS = "y"; then +HAVE_SENSORS="n" +if test $SENSORS_SUPPORT = "y"; then SENSORS=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sensors_get_detected_chips in -lsensors" >&5 $as_echo_n "checking for sensors_get_detected_chips in -lsensors... " >&6; } @@ -4637,8 +4745,8 @@ else HAVE_SENSORS="n" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sensors lib" >&5 -$as_echo_n "checking for sensors lib... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sensors library" >&5 +$as_echo_n "checking for sensors library... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -4652,7 +4760,7 @@ sensors_cleanup(); } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - SENSORS=yes; DFSENSORS="-DHAVE_SENSORS" + SENSORS=yes; HAVE_SENSORS="y"; DFSENSORS="-DHAVE_SENSORS" else HAVE_SENSORS="n"; SENSORS=no fi @@ -4664,40 +4772,23 @@ fi -# Should we check for PCP support? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCP support" >&5 -$as_echo_n "checking for PCP support... " >&6; } -# Check whether --enable-pcp was given. -if test "${enable_pcp+set}" = set; then : - enableval=$enable_pcp; PCP=$enableval -else - PCP=yes -fi - -if test $PCP != "yes"; then - HAVE_PCP="n" -else - HAVE_PCP="y" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCP" >&5 -$as_echo "$PCP" >&6; } - -if test ! $HAVE_PCP_PMAPI_H; then - HAVE_PCP="n" -fi - -# Check for PCP libraries -LFPCP="" -DFPCP="" -if test $HAVE_PCP = "y"; then - PCP=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pmGetVersion in -lpcp" >&5 -$as_echo_n "checking for pmGetVersion in -lpcp... " >&6; } -if ${ac_cv_lib_pcp_pmGetVersion+:} false; then : +# Check for 32-bit version of lm_sensors library +LFSENSORS32="" +DFSENSORS32="" +HAVE_SENSORS32="n" +if test $SENSORS_SUPPORT = "y"; then + CFLAGS_SAVE=$CFLAGS + CFLAGS+=" -m32" + LDFLAGS=" -lsensors" + SENSORS=no +# Check for another function to avoid using cached result + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sensors_cleanup in -lsensors" >&5 +$as_echo_n "checking for sensors_cleanup in -lsensors... " >&6; } +if ${ac_cv_lib_sensors_sensors_cleanup+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpcp $LIBS" +LIBS="-lsensors $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4707,66 +4798,61 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char pmGetVersion (); +char sensors_cleanup (); int main () { -return pmGetVersion (); +return sensors_cleanup (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pcp_pmGetVersion=yes + ac_cv_lib_sensors_sensors_cleanup=yes else - ac_cv_lib_pcp_pmGetVersion=no + ac_cv_lib_sensors_sensors_cleanup=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcp_pmGetVersion" >&5 -$as_echo "$ac_cv_lib_pcp_pmGetVersion" >&6; } -if test "x$ac_cv_lib_pcp_pmGetVersion" = xyes; then : - LFPCP="-lpcp -lpcp_import" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sensors_sensors_cleanup" >&5 +$as_echo "$ac_cv_lib_sensors_sensors_cleanup" >&6; } +if test "x$ac_cv_lib_sensors_sensors_cleanup" = xyes; then : + LFSENSORS32="-lsensors" else - HAVE_PCP="n" + HAVE_SENSORS32="n" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCP libraries" >&5 -$as_echo_n "checking for PCP libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sensors 32-bit library" >&5 +$as_echo_n "checking for sensors 32-bit library... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include +#include + #include int main () { -pmiEnd(); +sensors_cleanup(); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - PCP=yes; DFPCP="-DHAVE_PCP" +if ac_fn_c_try_link "$LINENO"; then : + SENSORS=yes; HAVE_SENSORS32="y"; DFSENSORS32="-DHAVE_SENSORS32" else - HAVE_PCP="n"; PCP=no + HAVE_SENSORS32="n"; SENSORS=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCP" >&5 -$as_echo "$PCP" >&6; } +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SENSORS" >&5 +$as_echo "$SENSORS" >&6; } + CFLAGS=$CFLAGS_SAVE fi -if test $HAVE_PCP_IMPL_H; then - PCP_IMPL="y" -else - PCP_IMPL="n" -fi - - # Check for 32-bit system libraries TGLIB32=no CFLAGS_SAVE=$CFLAGS diff --git a/configure.in b/configure.in index b712943..d797c6f 100644 --- a/configure.in +++ b/configure.in @@ -113,35 +113,6 @@ AC_CHECK_FUNCS(strcspn) AC_CHECK_FUNCS(strspn) AC_CHECK_FUNCS(strstr) -# Should we check for lm_sensors? -AC_MSG_CHECKING(for sensors support) -AC_ARG_ENABLE(sensors, - AC_HELP_STRING([--disable-sensors], - [disable sensors support]), - SENSORS=$enableval,SENSORS=yes) -if test $SENSORS != "yes"; then - HAVE_SENSORS="n" -else - HAVE_SENSORS="y" -fi -AC_MSG_RESULT($SENSORS) - -# Check for lm_sensors -LFSENSORS="" -DFSENSORS="" -if test $HAVE_SENSORS = "y"; then - SENSORS=no - AC_CHECK_LIB(sensors, sensors_get_detected_chips, LFSENSORS="-lsensors", HAVE_SENSORS="n") - AC_MSG_CHECKING(for sensors lib) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - #include ]], - [[sensors_cleanup();]])],SENSORS=yes; DFSENSORS="-DHAVE_SENSORS", HAVE_SENSORS="n"; SENSORS=no) - AC_MSG_RESULT($SENSORS) -fi -AC_SUBST(HAVE_SENSORS) -AC_SUBST(LFSENSORS) -AC_SUBST(DFSENSORS) - # Should we check for PCP support? AC_MSG_CHECKING(for PCP support) AC_ARG_ENABLE(pcp, @@ -153,11 +124,12 @@ if test $PCP != "yes"; then else HAVE_PCP="y" fi -AC_MSG_RESULT($PCP) if test ! $HAVE_PCP_PMAPI_H; then HAVE_PCP="n" + PCP=no fi +AC_MSG_RESULT($PCP) # Check for PCP libraries LFPCP="" @@ -182,6 +154,58 @@ else fi AC_SUBST(PCP_IMPL) +# Should we check for lm_sensors? +AC_MSG_CHECKING(for sensors support) +AC_ARG_ENABLE(sensors, + AC_HELP_STRING([--disable-sensors], + [disable sensors support]), + SENSORS=$enableval,SENSORS=yes) +if test $SENSORS != "yes"; then + SENSORS_SUPPORT="n" +else + SENSORS_SUPPORT="y" +fi +AC_MSG_RESULT($SENSORS) + +# Check for lm_sensors library +LFSENSORS="" +DFSENSORS="" +HAVE_SENSORS="n" +if test $SENSORS_SUPPORT = "y"; then + SENSORS=no + AC_CHECK_LIB(sensors, sensors_get_detected_chips, LFSENSORS="-lsensors", HAVE_SENSORS="n") + AC_MSG_CHECKING(for sensors library) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include + #include ]], + [[sensors_cleanup();]])], SENSORS=yes; HAVE_SENSORS="y"; DFSENSORS="-DHAVE_SENSORS", HAVE_SENSORS="n"; SENSORS=no) + AC_MSG_RESULT($SENSORS) +fi +AC_SUBST(HAVE_SENSORS) +AC_SUBST(LFSENSORS) +AC_SUBST(DFSENSORS) + +# Check for 32-bit version of lm_sensors library +LFSENSORS32="" +DFSENSORS32="" +HAVE_SENSORS32="n" +if test $SENSORS_SUPPORT = "y"; then + CFLAGS_SAVE=$CFLAGS + CFLAGS+=" -m32" + LDFLAGS=" -lsensors" + SENSORS=no +# Check for another function to avoid using cached result + AC_CHECK_LIB(sensors, sensors_cleanup, LFSENSORS32="-lsensors", HAVE_SENSORS32="n") + AC_MSG_CHECKING(for sensors 32-bit library) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include + #include ]], + [[sensors_cleanup();]])], SENSORS=yes; HAVE_SENSORS32="y"; DFSENSORS32="-DHAVE_SENSORS32", HAVE_SENSORS32="n"; SENSORS=no) + AC_MSG_RESULT($SENSORS) + CFLAGS=$CFLAGS_SAVE +fi +AC_SUBST(HAVE_SENSORS32) +AC_SUBST(LFSENSORS32) +AC_SUBST(DFSENSORS32) + # Check for 32-bit system libraries TGLIB32=no CFLAGS_SAVE=$CFLAGS diff --git a/rd_sensors.c b/rd_sensors.c index ee91070..1d3f560 100644 --- a/rd_sensors.c +++ b/rd_sensors.c @@ -34,7 +34,7 @@ #define _(string) (string) #endif -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) #include "sensors/sensors.h" #endif @@ -56,7 +56,7 @@ */ __nr_t read_fan(struct stats_pwr_fan *st_pwr_fan, __nr_t nr_alloc) { -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) __nr_t fan_read = 0; const sensors_chip_name *chip; const sensors_feature *feature; @@ -118,7 +118,7 @@ __nr_t read_fan(struct stats_pwr_fan *st_pwr_fan, __nr_t nr_alloc) */ __nr_t read_temp(struct stats_pwr_temp *st_pwr_temp, __nr_t nr_alloc) { -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) __nr_t temp_read = 0; const sensors_chip_name *chip; const sensors_feature *feature; @@ -185,7 +185,7 @@ __nr_t read_temp(struct stats_pwr_temp *st_pwr_temp, __nr_t nr_alloc) */ __nr_t read_in(struct stats_pwr_in *st_pwr_in, __nr_t nr_alloc) { -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) __nr_t in_read = 0; const sensors_chip_name *chip; const sensors_feature *feature; @@ -234,7 +234,7 @@ __nr_t read_in(struct stats_pwr_in *st_pwr_in, __nr_t nr_alloc) #endif /* HAVE_SENSORS */ } -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) /* *************************************************************************** * Count the number of sensors of given type on the machine. @@ -276,7 +276,7 @@ __nr_t get_sensors_nr(sensors_feature_type type) { */ __nr_t get_fan_nr(void) { -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) return get_sensors_nr(SENSORS_FEATURE_FAN); #else return 0; @@ -293,12 +293,11 @@ __nr_t get_fan_nr(void) */ __nr_t get_temp_nr(void) { -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) return get_sensors_nr(SENSORS_FEATURE_TEMP); #else return 0; #endif /* HAVE_SENSORS */ - } /* @@ -311,10 +310,9 @@ __nr_t get_temp_nr(void) */ __nr_t get_in_nr(void) { -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) return get_sensors_nr(SENSORS_FEATURE_IN); #else return 0; #endif /* HAVE_SENSORS */ - } diff --git a/sadc.c b/sadc.c index b4cc6ad..5a11ab2 100644 --- a/sadc.c +++ b/sadc.c @@ -45,7 +45,7 @@ #define _(string) (string) #endif -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) #include "sensors/sensors.h" #include "sensors/error.h" #endif @@ -1209,7 +1209,7 @@ int main(int argc, char **argv) ofile[0] = sa_dir[0] = comment[0] = '\0'; -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) /* Initialize sensors, let it use the default cfg file */ int err = sensors_init(NULL); if (err) { @@ -1427,7 +1427,7 @@ int main(int argc, char **argv) /* Main loop */ rw_sa_stat_loop(count, stdfd, ofd, ofile, sa_dir); -#ifdef HAVE_SENSORS +#if (defined(HAVE_SENSORS) && !defined(ARCH32)) || (defined(ARCH32) && defined(HAVE_SENSORS32)) /* Cleanup sensors */ sensors_cleanup(); #endif /* HAVE_SENSORS */