Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 703264
Collapse All | Expand All

(-)a/configure.ac (-24 / +42 lines)
Lines 357-389 if test "x$HAVE_POLKIT" = "xyes"; then Link Here
357
   enable_suid=no
357
   enable_suid=no
358
fi
358
fi
359
359
360
AC_ARG_WITH([cpufreq-lib],
360
build_cpufreq_applet=yes
361
	AS_HELP_STRING([--with-cpufreq-lib=lib], [library to use for cpufreq applet @<:@default=cpufreq@:>@]),
361
AS_IF([test "x$disable_cpufreq" = "xno"], [
362
	[with_cpufreq_lib=$withval], [with_cpufreq_lib="cpupower"])
362
  case "${host}" in
363
    *linux*)
364
      AC_CHECK_HEADER([cpufreq.h], [
365
        AC_CHECK_LIB([cpupower], [cpupower_is_cpu_online], [
366
          AC_DEFINE([HAVE_IS_CPU_ONLINE], 1,
367
                    [Define to 1 if cpupower_is_cpu_online() is available])
368
          cpufreq_lib="cpupower"
363
369
364
AC_CHECK_HEADER(cpufreq.h, have_libcpufreq=yes, have_libcpufreq=no)
370
          AC_CHECK_LIB([cpupower], [cpufreq_get_frequencies], [
365
LIBCPUFREQ_LIBS=
371
            AC_DEFINE([HAVE_GET_FREQUENCIES], 1,
366
if test "x$have_libcpufreq" = "xyes"; then
372
                      [Define to 1 if cpufreq_get_frequencies() is available])
367
   AC_DEFINE([HAVE_LIBCPUFREQ], [1], [Have libcpufreq.])
373
          ])
368
   LIBCPUFREQ_LIBS="-l$with_cpufreq_lib"
374
        ], [
369
fi
375
          AC_CHECK_LIB([cpupower], [cpufreq_cpu_exists], [
370
AM_CONDITIONAL(HAVE_LIBCPUFREQ, test x$have_libcpufreq = xyes)
376
            cpufreq_lib="cpupower"
371
AC_SUBST(LIBCPUFREQ_LIBS)
377
          ], [
372
378
            AC_CHECK_LIB([cpufreq], [cpufreq_cpu_exists], [
373
build_cpufreq_applet=no
379
              cpufreq_lib="cpufreq"
380
            ], [cpufreq_lib=])
381
          ])
382
        ])
374
383
375
if test x$disable_cpufreq = xno; then
384
        AS_IF([test "x$cpufreq_lib" != "x"], [
376
   case "${host}" in
385
          LIBCPUFREQ_LIBS="-l$cpufreq_lib"
377
      *linux*)
386
          AC_DEFINE([HAVE_LIBCPUFREQ], [1], [Have libcpufreq.])
378
         build_cpufreq_applet=yes
387
          AC_SUBST([LIBCPUFREQ_LIBS])
379
	 ;;
388
        ], [
380
      *)
389
          AC_MSG_WARN([*** cpufreq applet will not be built ***])
381
         AC_MSG_WARN([${host} is not supported by cpufreq applet, not building])
390
          build_cpufreq_applet=no
382
	 build_cpufreq_applet=no
391
        ])
383
	 ;;
392
      ], [
384
   esac
393
        AC_MSG_WARN([*** can't find cpufreq.h, cpufreq applet will not be built ***])
385
fi
394
        build_cpufreq_applet=no
395
      ])
396
      ;;
397
    *)
398
      AC_MSG_WARN([${host} is not supported by cpufreq applet, not building])
399
      build_cpufreq_applet=no
400
      ;;
401
  esac
402
], [build_cpufreq_applet=no])
386
403
404
AM_CONDITIONAL(HAVE_LIBCPUFREQ, test x$cpufreq_lib != x)
387
AM_CONDITIONAL(BUILD_CPUFREQ_APPLET, test x$build_cpufreq_applet = xyes)
405
AM_CONDITIONAL(BUILD_CPUFREQ_APPLET, test x$build_cpufreq_applet = xyes)
388
AM_CONDITIONAL(BUILD_CPUFREQ_SELECTOR, test x$enable_selector = xyes)
406
AM_CONDITIONAL(BUILD_CPUFREQ_SELECTOR, test x$enable_selector = xyes)
389
AM_CONDITIONAL(CPUFREQ_SELECTOR_SUID, test x$enable_suid = xyes)
407
AM_CONDITIONAL(CPUFREQ_SELECTOR_SUID, test x$enable_suid = xyes)
(-)a/cpufreq/src/cpufreq-monitor-libcpufreq.c (-4 / +14 lines)
Lines 19-29 Link Here
19
 * Authors : Carlos García Campos <carlosgc@gnome.org>
19
 * Authors : Carlos García Campos <carlosgc@gnome.org>
20
 */
20
 */
21
21
22
#ifdef HAVE_CONFIG_H
23
#include "config.h"
24
#endif
25
22
#include <glib.h>
26
#include <glib.h>
23
#include <glib/gi18n.h>
27
#include <glib/gi18n.h>
24
28
25
#include <stdlib.h>
29
#include <stdlib.h>
26
#include <linux/version.h>
27
#include <cpufreq.h>
30
#include <cpufreq.h>
28
#include "cpufreq-monitor-libcpufreq.h"
31
#include "cpufreq-monitor-libcpufreq.h"
29
#include "cpufreq-utils.h"
32
#include "cpufreq-utils.h"
Lines 36-43 static GList *cpufreq_monitor_libcpufr Link Here
36
39
37
G_DEFINE_TYPE (CPUFreqMonitorLibcpufreq, cpufreq_monitor_libcpufreq, CPUFREQ_TYPE_MONITOR)
40
G_DEFINE_TYPE (CPUFreqMonitorLibcpufreq, cpufreq_monitor_libcpufreq, CPUFREQ_TYPE_MONITOR)
38
41
39
typedef struct cpufreq_policy                CPUFreqPolicy;
42
#ifdef HAVE_GET_FREQUENCIES
43
typedef struct cpufreq_frequencies CPUFreqFrequencyList;
44
#define cpufreq_get_available_frequencies(cpu) cpufreq_get_frequencies ("available", cpu)
45
#define cpufreq_put_available_frequencies(first) cpufreq_put_frequencies (first)
46
#else
40
typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
47
typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
48
#endif
49
50
typedef struct cpufreq_policy                CPUFreqPolicy;
41
typedef struct cpufreq_available_governors   CPUFreqGovernorList;
51
typedef struct cpufreq_available_governors   CPUFreqGovernorList;
42
52
43
static void
53
static void
Lines 98-104 cpufreq_monitor_libcpufreq_new (guint cp Link Here
98
        return CPUFREQ_MONITOR (monitor);
108
        return CPUFREQ_MONITOR (monitor);
99
}
109
}
100
110
101
#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 7, 0)
111
#ifdef HAVE_IS_CPU_ONLINE
102
extern int cpupower_is_cpu_online (unsigned int cpu);
112
extern int cpupower_is_cpu_online (unsigned int cpu);
103
#endif
113
#endif
104
114
Lines 115-121 cpufreq_monitor_libcpufreq_run (CPUFreqM Link Here
115
		/* Check whether it failed because
125
		/* Check whether it failed because
116
		 * cpu is not online.
126
		 * cpu is not online.
117
		 */
127
		 */
118
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
128
#ifndef HAVE_IS_CPU_ONLINE
119
		if (!cpufreq_cpu_exists (cpu)) {
129
		if (!cpufreq_cpu_exists (cpu)) {
120
#else
130
#else
121
		if (cpupower_is_cpu_online (cpu)) {
131
		if (cpupower_is_cpu_online (cpu)) {
(-)a/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c (-1 / +13 lines)
Lines 19-28 Link Here
19
 * Authors : Carlos García Campos <carlosgc@gnome.org>
19
 * Authors : Carlos García Campos <carlosgc@gnome.org>
20
 */
20
 */
21
21
22
#ifdef HAVE_CONFIG_H
23
#include "config.h"
24
#endif
25
22
#include <glib.h>
26
#include <glib.h>
23
#include <glib/gstdio.h>
27
#include <glib/gstdio.h>
24
#include <cpufreq.h>
28
#include <cpufreq.h>
25
#include <stdlib.h>
29
#include <stdlib.h>
30
#include <linux/version.h>
26
31
27
#include "cpufreq-selector-libcpufreq.h"
32
#include "cpufreq-selector-libcpufreq.h"
28
33
Lines 38-45 static gboolean cpufreq_selector_libcpuf Link Here
38
43
39
G_DEFINE_TYPE (CPUFreqSelectorLibcpufreq, cpufreq_selector_libcpufreq, CPUFREQ_TYPE_SELECTOR)
44
G_DEFINE_TYPE (CPUFreqSelectorLibcpufreq, cpufreq_selector_libcpufreq, CPUFREQ_TYPE_SELECTOR)
40
45
41
typedef struct cpufreq_policy                CPUFreqPolicy;
46
#ifdef HAVE_GET_FREQUENCIES
47
typedef struct cpufreq_frequencies CPUFreqFrequencyList;
48
#define cpufreq_get_available_frequencies(cpu) cpufreq_get_frequencies ("available", cpu)
49
#define cpufreq_put_available_frequencies(first) cpufreq_put_frequencies (first)
50
#else
42
typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
51
typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
52
#endif
53
54
typedef struct cpufreq_policy                CPUFreqPolicy;
43
typedef struct cpufreq_available_governors   CPUFreqGovernorList;
55
typedef struct cpufreq_available_governors   CPUFreqGovernorList;
44
56
45
static void
57
static void

Return to bug 703264