Fix build with C++11 support enabled

In particular, usage of __DATE__ in main.cpp is now recognized as a
user-defined literal, so an additional whitespace is required separating
the string and __DATE__.

Also, typeof (which was a GNU extension) is now replaced by decltype,
so perf/perf_bundle.cpp has been modified.
The preprocessor is used to tell whether we are compiling in C++11 mode
or not and select the keyword accordingly.
Fixed errors that appear while reading ALPM accounting files.

When no disks are attached to a host, reading ahci_alpm_* files fail
with "Invalid argument" (but ahci_alpm_accounting can be written, so an
instance of ahci is created).

This case is now checked by reading ahci_alpm_accounting before writing to it:
if reading fails, the whole SCSI host is skipped.
show HH:MM for time left instead of just minutes
Revert "Fixed errors that appear while reading ALPM accounting files."

This reverts commit ff4ea11b4da748f27fcb80a12e143d8d5107f0a7.
Fix build with C++11 support enabled

In particular, usage of __DATE__ in main.cpp is now recognized as a
user-defined literal, so an additional whitespace is required separating
the string and __DATE__.

Also, typeof (which was a GNU extension) is now replaced by decltype,
so perf/perf_bundle.cpp has been modified.
The preprocessor is used to tell whether we are compiling in C++11 mode
or not and select the keyword accordingly.
Fixed errors that appear while reading ALPM accounting files.

When no disks are attached to a host, reading ahci_alpm_* files fail
with "Invalid argument" (but ahci_alpm_accounting can be written, so an
instance of ahci is created).

This case is now checked by reading ahci_alpm_accounting before writing to it:
if reading fails, the whole SCSI host is skipped.
show HH:MM for time left instead of just minutes
Merge branch 'master' into patch
set Medfield processor correctly for core and cpu.
Merge branch 'master' into patch
build: wrap Makefile.am to a more reasonable line length
Fix discharging detection

It seems there is an typo in the code that detects discharging.
There is another check in sysfs.cpp, so despite of this typo the
detection works correctly with sysfs backend. But the alternate
power_supply backend doesn't have this check, so if used, it
doesn't work correctly. I think the typo should be fixed or
the check should be removed from measurement.cpp (maybe
together with the power_supply implementation). The latter
solution is probably more clear.
Fixed HTML output to make W3C validator happy

Various fixes to pass W3C HTML validation. Also unified
whitespaces - preferred tabs over multiple spaces to save
some space.
Move AC_LANG after AC_INIT to make it take effect.

Looking at config.log one sees that the tests are run using the C compiler
in spite of the AC_LANG line if AC_LANG is before AC_INIT.

Signed-off-by: Magnus Fromreide <magfr@lysator.liu.se>
factor out powertop_init() function

Factor out powertop_init() function to perform basic initialization on
powertop start up.

Commit 057d6126eb6329c86b29a2e0219c0d0e49a84191 moved init after
commandline options parsing. However, in some cases we need it before
parsing, e.g. -- calibration.

Reported-by: Lekensteyn <lekensteyn@gmail.com>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
catch fstream exceptions in lib routines

Catch possible fstream and traits_type exceptions in lib.

Reported-by: Lekensteyn <lekensteyn@gmail.com>
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Merge branch 'patch'
fixed typeo found after merge by hand for Sergey Senozhatsky
iw: handle HAVE_LIBNL20 properly

On (05/18/12 15:40), Németh Márton wrote:
> Doesn't compile either:
>
> gcc -DHAVE_CONFIG_H -I. -I..  -D_FORTIFY_SOURCE=2        -g -O2 -MT tuning/powertop-iw.o -MD -MP -MF tuning/.deps/powertop-iw.Tpo -c -o tuning/powertop-iw.o
> `test -f 'tuning/iw.c' || echo './'`tuning/iw.c
> tuning/iw.c: In function ‘set_power_save’:
> tuning/iw.c:130: error: storage size of ‘ps_state’ isn’t known
> tuning/iw.c:132: error: ‘NL80211_PS_DISABLED’ undeclared (first use in this function)
> tuning/iw.c:132: error: (Each undeclared identifier is reported only once
> tuning/iw.c:132: error: for each function it appears in.)
> tuning/iw.c:134: error: ‘NL80211_PS_ENABLED’ undeclared (first use in this function)
> tuning/iw.c:136: error: ‘NL80211_ATTR_PS_STATE’ undeclared (first use in this function)
> tuning/iw.c: In function ‘print_power_save_handler’:
> tuning/iw.c:152: error: ‘NL80211_ATTR_PS_STATE’ undeclared (first use in this function)
> tuning/iw.c:156: error: ‘NL80211_PS_ENABLED’ undeclared (first use in this function)
> tuning/iw.c:159: error: ‘NL80211_PS_DISABLED’ undeclared (first use in this function)
> tuning/iw.c: In function ‘__handle_cmd’:
> tuning/iw.c:227: error: ‘NL80211_CMD_GET_POWER_SAVE’ undeclared (first use in this function)
> tuning/iw.c:230: error: ‘NL80211_CMD_SET_POWER_SAVE’ undeclared (first use in this function)
> make[3]: *** [tuning/powertop-iw.o] Error 1
> make[3]: Leaving directory `/mnt/store/nmarci/src/powertop/powertop2/powertop/src'
> make[2]: *** [all] Error 2
> make[2]: Leaving directory `/mnt/store/nmarci/src/powertop/powertop2/powertop/src'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/mnt/store/nmarci/src/powertop/powertop2/powertop'
> make: *** [all] Error 2
>
> Looks like I have a linux/nl80211.h installed on my system which doesn't contain
> NL80211_PS_ENABLED, NL80211_PS_DISABLED, NL80211_ATTR_PS_STATE, NL80211_CMD_GET_POWER_SAVE
> and NL80211_CMD_SET_POWER_SAVE. These were added by commit
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=ffb9eb3d8b450c22bbbc688c6b630141ac476fd9
>
> The header file src/tuning/nl80211.h in powertop repository seems to be a newer one.
>

Hm.. In that case solution is simple.
Merge branch 'patch'