|
1
|
+Description: Fix FTBFS when building --with-cpufreq=cpupower
|
|
2
|
+Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
|
|
3
|
+
|
|
4
|
+--- a/cpufreq/src/cpufreq-monitor-libcpufreq.c
|
|
5
|
++++ b/cpufreq/src/cpufreq-monitor-libcpufreq.c
|
|
6
|
+@@ -19,11 +19,14 @@
|
|
7
|
+ * Authors : Carlos Garca Campos <carlosgc@gnome.org>
|
|
8
|
+ */
|
|
9
|
+
|
|
10
|
++#ifdef HAVE_CONFIG_H
|
|
11
|
++#include "config.h"
|
|
12
|
++#endif
|
|
13
|
++
|
|
14
|
+ #include <glib.h>
|
|
15
|
+ #include <glib/gi18n.h>
|
|
16
|
+
|
|
17
|
+ #include <stdlib.h>
|
|
18
|
+-#include <linux/version.h>
|
|
19
|
+ #include <cpufreq.h>
|
|
20
|
+ #include "cpufreq-monitor-libcpufreq.h"
|
|
21
|
+ #include "cpufreq-utils.h"
|
|
22
|
+@@ -36,8 +39,14 @@
|
|
23
|
+
|
|
24
|
+ G_DEFINE_TYPE (CPUFreqMonitorLibcpufreq, cpufreq_monitor_libcpufreq, CPUFREQ_TYPE_MONITOR)
|
|
25
|
+
|
|
26
|
+-typedef struct cpufreq_policy CPUFreqPolicy;
|
|
27
|
++#ifdef HAVE_GET_FREQUENCIES
|
|
28
|
++typedef struct cpufreq_frequencies CPUFreqFrequencyList;
|
|
29
|
++#define cpufreq_get_available_frequencies(cpu) cpufreq_get_frequencies ("available", cpu)
|
|
30
|
++#define cpufreq_put_available_frequencies(first) cpufreq_put_frequencies (first)
|
|
31
|
++#else
|
|
32
|
+ typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
|
|
33
|
++#endif
|
|
34
|
++typedef struct cpufreq_policy CPUFreqPolicy;
|
|
35
|
+ typedef struct cpufreq_available_governors CPUFreqGovernorList;
|
|
36
|
+
|
|
37
|
+ static void
|
|
38
|
+@@ -98,7 +107,7 @@
|
|
39
|
+ return CPUFREQ_MONITOR (monitor);
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+-#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 7, 0)
|
|
43
|
++#ifdef HAVE_IS_CPU_ONLINE
|
|
44
|
+ extern int cpupower_is_cpu_online (unsigned int cpu);
|
|
45
|
+ #endif
|
|
46
|
+
|
|
47
|
+@@ -115,7 +124,7 @@
|
|
48
|
+ /* Check whether it failed because
|
|
49
|
+ * cpu is not online.
|
|
50
|
+ */
|
|
51
|
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
|
|
52
|
++#ifndef HAVE_IS_CPU_ONLINE
|
|
53
|
+ if (!cpufreq_cpu_exists (cpu)) {
|
|
54
|
+ #else
|
|
55
|
+ if (cpupower_is_cpu_online (cpu)) {
|
|
56
|
+--- a/configure.ac
|
|
57
|
++++ b/configure.ac
|
|
58
|
+@@ -357,33 +357,51 @@
|
|
59
|
+ enable_suid=no
|
|
60
|
+ fi
|
|
61
|
+
|
|
62
|
+-AC_ARG_WITH([cpufreq-lib],
|
|
63
|
+- AS_HELP_STRING([--with-cpufreq-lib=lib], [library to use for cpufreq applet @<:@default=cpufreq@:>@]),
|
|
64
|
+- [with_cpufreq_lib=$withval], [with_cpufreq_lib="cpupower"])
|
|
65
|
++build_cpufreq_applet=yes
|
|
66
|
++AS_IF([test "x$disable_cpufreq" = "xno"], [
|
|
67
|
++ case "${host}" in
|
|
68
|
++ *linux*)
|
|
69
|
++ AC_CHECK_HEADER([cpufreq.h], [
|
|
70
|
++ AC_CHECK_LIB([cpupower], [cpupower_is_cpu_online], [
|
|
71
|
++ AC_DEFINE([HAVE_IS_CPU_ONLINE], 1,
|
|
72
|
++ [Define to 1 if cpupower_is_cpu_online() is available])
|
|
73
|
++ cpufreq_lib="cpupower"
|
|
74
|
+
|
|
75
|
+-AC_CHECK_HEADER(cpufreq.h, have_libcpufreq=yes, have_libcpufreq=no)
|
|
76
|
+-LIBCPUFREQ_LIBS=
|
|
77
|
+-if test "x$have_libcpufreq" = "xyes"; then
|
|
78
|
+- AC_DEFINE([HAVE_LIBCPUFREQ], [1], [Have libcpufreq.])
|
|
79
|
+- LIBCPUFREQ_LIBS="-l$with_cpufreq_lib"
|
|
80
|
+-fi
|
|
81
|
+-AM_CONDITIONAL(HAVE_LIBCPUFREQ, test x$have_libcpufreq = xyes)
|
|
82
|
+-AC_SUBST(LIBCPUFREQ_LIBS)
|
|
83
|
+-
|
|
84
|
+-build_cpufreq_applet=no
|
|
85
|
++ AC_CHECK_LIB([cpupower], [cpufreq_get_frequencies], [
|
|
86
|
++ AC_DEFINE([HAVE_GET_FREQUENCIES], 1,
|
|
87
|
++ [Define to 1 if cpufreq_get_frequencies() is available])
|
|
88
|
++ ])
|
|
89
|
++ ], [
|
|
90
|
++ AC_CHECK_LIB([cpupower], [cpufreq_cpu_exists], [
|
|
91
|
++ cpufreq_lib="cpupower"
|
|
92
|
++ ], [
|
|
93
|
++ AC_CHECK_LIB([cpufreq], [cpufreq_cpu_exists], [
|
|
94
|
++ cpufreq_lib="cpufreq"
|
|
95
|
++ ], [cpufreq_lib=])
|
|
96
|
++ ])
|
|
97
|
++ ])
|
|
98
|
+
|
|
99
|
+-if test x$disable_cpufreq = xno; then
|
|
100
|
+- case "${host}" in
|
|
101
|
+- *linux*)
|
|
102
|
+- build_cpufreq_applet=yes
|
|
103
|
+- ;;
|
|
104
|
+- *)
|
|
105
|
+- AC_MSG_WARN([${host} is not supported by cpufreq applet, not building])
|
|
106
|
+- build_cpufreq_applet=no
|
|
107
|
+- ;;
|
|
108
|
+- esac
|
|
109
|
+-fi
|
|
110
|
++ AS_IF([test "x$cpufreq_lib" != "x"], [
|
|
111
|
++ LIBCPUFREQ_LIBS="-l$cpufreq_lib"
|
|
112
|
++ AC_DEFINE([HAVE_LIBCPUFREQ], [1], [Have libcpufreq.])
|
|
113
|
++ AC_SUBST([LIBCPUFREQ_LIBS])
|
|
114
|
++ ], [
|
|
115
|
++ AC_MSG_WARN([*** cpufreq applet will not be built ***])
|
|
116
|
++ build_cpufreq_applet=no
|
|
117
|
++ ])
|
|
118
|
++ ], [
|
|
119
|
++ AC_MSG_WARN([*** can't find cpufreq.h, cpufreq applet will not be built ***])
|
|
120
|
++ build_cpufreq_applet=no
|
|
121
|
++ ])
|
|
122
|
++ ;;
|
|
123
|
++ *)
|
|
124
|
++ AC_MSG_WARN([${host} is not supported by cpufreq applet, not building])
|
|
125
|
++ build_cpufreq_applet=no
|
|
126
|
++ ;;
|
|
127
|
++ esac
|
|
128
|
++], [build_cpufreq_applet=no])
|
|
129
|
+
|
|
130
|
++AM_CONDITIONAL(HAVE_LIBCPUFREQ, test x$cpufreq_lib != x)
|
|
131
|
+ AM_CONDITIONAL(BUILD_CPUFREQ_APPLET, test x$build_cpufreq_applet = xyes)
|
|
132
|
+ AM_CONDITIONAL(BUILD_CPUFREQ_SELECTOR, test x$enable_selector = xyes)
|
|
133
|
+ AM_CONDITIONAL(CPUFREQ_SELECTOR_SUID, test x$enable_suid = xyes)
|
|
134
|
+--- a/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c
|
|
135
|
++++ b/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c
|
|
136
|
+@@ -19,6 +19,10 @@
|
|
137
|
+ * Authors : Carlos Garca Campos <carlosgc@gnome.org>
|
|
138
|
+ */
|
|
139
|
+
|
|
140
|
++#ifdef HAVE_CONFIG_H
|
|
141
|
++#include "config.h"
|
|
142
|
++#endif
|
|
143
|
++
|
|
144
|
+ #include <glib.h>
|
|
145
|
+ #include <glib/gstdio.h>
|
|
146
|
+ #include <cpufreq.h>
|
|
147
|
+@@ -38,8 +42,15 @@
|
|
148
|
+
|
|
149
|
+ G_DEFINE_TYPE (CPUFreqSelectorLibcpufreq, cpufreq_selector_libcpufreq, CPUFREQ_TYPE_SELECTOR)
|
|
150
|
+
|
|
151
|
+-typedef struct cpufreq_policy CPUFreqPolicy;
|
|
152
|
++#ifdef HAVE_GET_FREQUENCIES
|
|
153
|
++typedef struct cpufreq_frequencies CPUFreqFrequencyList;
|
|
154
|
++#define cpufreq_get_available_frequencies(cpu) cpufreq_get_frequencies ("available", cpu)
|
|
155
|
++#define cpufreq_put_available_frequencies(first) cpufreq_put_frequencies (first)
|
|
156
|
++#else
|
|
157
|
+ typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
|
|
158
|
++#endif
|
|
159
|
++
|
|
160
|
++typedef struct cpufreq_policy CPUFreqPolicy;
|
|
161
|
+ typedef struct cpufreq_available_governors CPUFreqGovernorList;
|
|
162
|
+
|
|
163
|
+ static void
|