[gnome-applets] require cpufreq.h header to build cpufreq applet
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets] require cpufreq.h header to build cpufreq applet
- Date: Tue, 6 Dec 2016 20:28:07 +0000 (UTC)
commit c78f9be997416c45174bf872d22749ed91c23305
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Dec 6 19:46:49 2016 +0200
require cpufreq.h header to build cpufreq applet
configure.ac | 7 +-
cpufreq/src/Makefile.am | 18 +-
cpufreq/src/cpufreq-monitor-cpuinfo.c | 135 ------
cpufreq/src/cpufreq-monitor-cpuinfo.h | 49 ---
cpufreq/src/cpufreq-monitor-factory.c | 28 --
cpufreq/src/cpufreq-monitor-procfs.c | 218 ----------
cpufreq/src/cpufreq-monitor-procfs.h | 53 ---
cpufreq/src/cpufreq-monitor-sysfs.c | 342 ----------------
cpufreq/src/cpufreq-monitor-sysfs.h | 53 ---
cpufreq/src/cpufreq-selector/Makefile.am | 9 +-
.../cpufreq-selector/cpufreq-selector-factory.c | 14 +-
.../src/cpufreq-selector/cpufreq-selector-procfs.c | 239 -----------
.../src/cpufreq-selector/cpufreq-selector-procfs.h | 53 ---
.../src/cpufreq-selector/cpufreq-selector-sysfs.c | 427 --------------------
.../src/cpufreq-selector/cpufreq-selector-sysfs.h | 57 ---
15 files changed, 9 insertions(+), 1693 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f1183ba..8642ef1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -476,10 +476,8 @@ AC_ARG_WITH([cpufreq-lib],
AC_CHECK_HEADER(cpufreq.h, have_libcpufreq=yes, have_libcpufreq=no)
LIBCPUFREQ_LIBS=
if test "x$have_libcpufreq" = "xyes"; then
- AC_DEFINE([HAVE_LIBCPUFREQ], [1], [Have libcpufreq.])
LIBCPUFREQ_LIBS="-l$with_cpufreq_lib"
fi
-AM_CONDITIONAL(HAVE_LIBCPUFREQ, test x$have_libcpufreq = xyes)
AC_SUBST(LIBCPUFREQ_LIBS)
build_cpufreq_applet=no
@@ -496,6 +494,11 @@ if test x$disable_cpufreq = xno; then
esac
fi
+if test "x$have_libcpufreq" = "xno"; then
+ AC_MSG_WARN([*** cpufreq applet will not be built ***])
+ build_cpufreq_applet=no
+fi
+
AM_CONDITIONAL(BUILD_CPUFREQ_APPLET, test x$build_cpufreq_applet = xyes)
AM_CONDITIONAL(BUILD_CPUFREQ_SELECTOR, test x$enable_selector = xyes)
AM_CONDITIONAL(CPUFREQ_SELECTOR_SUID, test x$suid = xyes)
diff --git a/cpufreq/src/Makefile.am b/cpufreq/src/Makefile.am
index 62eb30f..32e9a03 100644
--- a/cpufreq/src/Makefile.am
+++ b/cpufreq/src/Makefile.am
@@ -41,13 +41,8 @@ libcpu_frequency_applet_la_SOURCES = \
cpufreq-monitor.h \
cpufreq-monitor-factory.c \
cpufreq-monitor-factory.h \
- cpufreq-monitor-procfs.c \
- cpufreq-monitor-procfs.h \
- cpufreq-monitor-sysfs.c \
- cpufreq-monitor-sysfs.h \
- cpufreq-monitor-cpuinfo.c \
- cpufreq-monitor-cpuinfo.h \
- $(cpufreq_files) \
+ cpufreq-monitor-libcpufreq.c \
+ cpufreq-monitor-libcpufreq.h \
$(NULL)
libcpu_frequency_applet_la_LDFLAGS = \
@@ -63,13 +58,4 @@ libcpu_frequency_applet_la_LIBADD = \
$(DBUS_LIBS) \
$(NULL)
-if HAVE_LIBCPUFREQ
-
-cpufreq_files = \
- cpufreq-monitor-libcpufreq.c \
- cpufreq-monitor-libcpufreq.h \
- $(NULL)
-
-endif
-
-include $(top_srcdir)/git.mk
diff --git a/cpufreq/src/cpufreq-monitor-factory.c b/cpufreq/src/cpufreq-monitor-factory.c
index fc79d1b..dcadc00 100644
--- a/cpufreq/src/cpufreq-monitor-factory.c
+++ b/cpufreq/src/cpufreq-monitor-factory.c
@@ -27,12 +27,7 @@
#include "cpufreq-applet.h"
#include "cpufreq-utils.h"
-#include "cpufreq-monitor-sysfs.h"
-#include "cpufreq-monitor-procfs.h"
-#include "cpufreq-monitor-cpuinfo.h"
-#ifdef HAVE_LIBCPUFREQ
#include "cpufreq-monitor-libcpufreq.h"
-#endif
#include "cpufreq-monitor-factory.h"
CPUFreqMonitor *
@@ -40,29 +35,6 @@ cpufreq_monitor_factory_create_monitor (guint cpu)
{
CPUFreqMonitor *monitor = NULL;
-#ifdef HAVE_LIBCPUFREQ
monitor = cpufreq_monitor_libcpufreq_new (cpu);
return monitor;
-#endif
-
- if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.6 kernel */
- monitor = cpufreq_monitor_sysfs_new (cpu);
- } else if (g_file_test ("/proc/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.4 kernel (Deprecated)*/
- monitor = cpufreq_monitor_procfs_new (cpu);
- } else if (g_file_test ("/proc/cpuinfo", G_FILE_TEST_EXISTS)) {
- /* If there is no cpufreq support it shows only the cpu frequency,
- * I think is better than do nothing. I have to notify it to the user, because
- * he could think that cpufreq is supported but it doesn't work succesfully
- */
-
- cpufreq_utils_display_error (_("CPU frequency scaling unsupported"),
- _("You will not be able to modify the frequency of your
machine. "
- "Your machine may be misconfigured or not have hardware
support "
- "for CPU frequency scaling."));
-
- monitor = cpufreq_monitor_cpuinfo_new (cpu);
- }
-
- return monitor;
}
-
diff --git a/cpufreq/src/cpufreq-selector/Makefile.am b/cpufreq/src/cpufreq-selector/Makefile.am
index 74b648c..b702416 100644
--- a/cpufreq/src/cpufreq-selector/Makefile.am
+++ b/cpufreq/src/cpufreq-selector/Makefile.am
@@ -21,20 +21,13 @@ if CPUFREQ_SELECTOR_SUID
chmod 4755 $(DESTDIR)$(bindir)/cpufreq-selector
endif
-
-if HAVE_LIBCPUFREQ
-cpufreq_files=cpufreq-selector-libcpufreq.c cpufreq-selector-libcpufreq.h
-endif
-
if HAVE_POLKIT
service_files=cpufreq-selector-service.c cpufreq-selector-service.h
endif
cpufreq_selector_SOURCES = \
cpufreq-selector.c cpufreq-selector.h \
- cpufreq-selector-sysfs.c cpufreq-selector-sysfs.h \
- cpufreq-selector-procfs.c cpufreq-selector-procfs.h \
- $(cpufreq_files) \
+ cpufreq-selector-libcpufreq.c cpufreq-selector-libcpufreq.h \
$(service_files) \
cpufreq-selector-factory.c cpufreq-selector-factory.h \
$(BUILT_SOURCES) \
diff --git a/cpufreq/src/cpufreq-selector/cpufreq-selector-factory.c
b/cpufreq/src/cpufreq-selector/cpufreq-selector-factory.c
index aaefe76..31a96e3 100644
--- a/cpufreq/src/cpufreq-selector/cpufreq-selector-factory.c
+++ b/cpufreq/src/cpufreq-selector/cpufreq-selector-factory.c
@@ -21,26 +21,14 @@
#endif
#include "cpufreq-selector-factory.h"
-#include "cpufreq-selector-sysfs.h"
-#include "cpufreq-selector-procfs.h"
-#ifdef HAVE_LIBCPUFREQ
#include "cpufreq-selector-libcpufreq.h"
-#endif
CPUFreqSelector *
cpufreq_selector_factory_create_selector (guint cpu)
{
CPUFreqSelector *selector = NULL;
-
-#ifdef HAVE_LIBCPUFREQ
+
selector = cpufreq_selector_libcpufreq_new (cpu);
-#else
- if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.6 kernel */
- selector = cpufreq_selector_sysfs_new (cpu);
- } else if (g_file_test ("/proc/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.4 kernel */
- selector = cpufreq_selector_procfs_new (cpu);
- }
-#endif /* HAVE_LIBCPUFREQ */
return selector;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]