Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af2f758717 | ||
|
|
2ca8174054 | ||
|
|
10e4496bb7 | ||
|
|
880d876ccf |
@@ -0,0 +1,25 @@
|
||||
Copyright (c) 2006-2008 Alexander Chemeris
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -18,8 +18,9 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
See LICENSE_gpl2.txt and LICENSE_gpl3.txt for details.
|
||||
|
||||
|
||||
All files which don't have any copyright notices, tests and examples are
|
||||
covered under the Whatever License. See LICENSE_whatever.txt for details.
|
||||
All files which don't have any copyright notices, as well as tests and
|
||||
examples are covered under the Whatever License. See LICENSE_whatever.txt for
|
||||
details.
|
||||
|
||||
|
||||
Portions of this software are copyright Google Inc. See LICENSE_pcrecpp.txt
|
||||
@@ -17,6 +17,10 @@ Portions of this software are copyright Regents of the University of
|
||||
California, see LICENSE_bsd-ucb.txt for details.
|
||||
|
||||
|
||||
Portions of this software are copyright Alexander Chemeris, see
|
||||
LICENSE_bsd-ac.txt for details.
|
||||
|
||||
|
||||
Portions of this software are licensed under Boost Software License, see
|
||||
LICENSE_boost_1_0.txt and individual source files for copyright information.
|
||||
|
||||
@@ -16,6 +16,7 @@ noinst_DATA = AUTHORS.txt LICENSE_gsmartcontrol.txt README.txt
|
||||
# Some of these files are actually needed for compilation (see src/res/Makefile.am).
|
||||
dist_doc_DATA = AUTHORS.txt ChangeLog NEWS README.txt \
|
||||
LICENSE_boost_1_0.txt \
|
||||
LICENSE_bsd-ac.txt \
|
||||
LICENSE_bsd-ucb.txt \
|
||||
LICENSE_gpl2.txt \
|
||||
LICENSE_gpl3.txt \
|
||||
@@ -68,7 +69,8 @@ src-rpm: dist
|
||||
|
||||
|
||||
# NSIS installer support.
|
||||
# Requires wine, installed NSIS, gtkmm dlls, pcre dlls, smartctl.exe, smartctl_console.exe.
|
||||
# Requires wine, installed NSIS, smartctl-nc.exe, smartctl.exe.
|
||||
# Gtkmm dlls and pcre dlls are required if linking against them.
|
||||
# dos2unix on build machine.
|
||||
# Execute only with win32 build present.
|
||||
|
||||
@@ -93,25 +95,12 @@ win-dist-prepare: all win-dist-clean
|
||||
|
||||
unix2dos nsis-dist/*.nsi nsis-dist/doc/*.txt
|
||||
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libatkmm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libcairomm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libgdkmm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libgiomm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libglibmm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libgtkmm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libpangomm-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/libsigc-*.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/pcre3.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/mingwm10.dll nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/smartctl.exe nsis-dist/
|
||||
cp "@WINDOWS_DLLS_LOCATION@"/smartctl_console.exe nsis-dist/
|
||||
cp "@WINDOWS_BINDIR@"/smartctl-nc.exe nsis-dist/
|
||||
cp "@WINDOWS_BINDIR@"/smartctl.exe nsis-dist/
|
||||
|
||||
cp src/gsmartcontrol.exe nsis-dist/
|
||||
|
||||
$(STRIP) nsis-dist/*.exe
|
||||
mv nsis-dist/mingwm10.dll nsis-dist/mingwm10.dll_
|
||||
$(STRIP) --strip-debug --strip-unneeded nsis-dist/*.dll
|
||||
mv nsis-dist/mingwm10.dll_ nsis-dist/mingwm10.dll
|
||||
|
||||
|
||||
nsis-dist: nsis-dist-nocleanup nsis-cleanup
|
||||
@@ -1,4 +1,29 @@
|
||||
|
||||
Version 0.8.5, released on 2009-09-05
|
||||
GSmartControl now uses XDG config directory for per-user configuration on
|
||||
UNIX and CSIDL_PROFILE directory on Windows. Existing configuration is
|
||||
migrated automatically.
|
||||
The names are shown correctly for unsupported devices even with the latest
|
||||
smartctl snapshots now.
|
||||
Smartctl SVN revision is shown (if available).
|
||||
The progress bars update properly when parallel tests are run.
|
||||
Windows: GSmartControl should be able to operate on any valid filesystem
|
||||
path (not just locale-representable ones).
|
||||
Windows: GSmartControl is now officially compilable on x86_64 via mingw64.
|
||||
Fixed compilation under very old gtkmm/libglademm, and with gcc 4.4.
|
||||
Fixed parsing of multiple error types in SMART error log.
|
||||
Added minor features and fixed miscellaneous bugs.
|
||||
|
||||
Version 0.8.4, released on 2009-03-23
|
||||
Linux Software RAID devices are blacklisted now. (backported from Debian).
|
||||
Attributes tab is before the capabilities tab now.
|
||||
A man page has been generously contributed by Giuseppe Iuculano
|
||||
<giuseppe@iuculano.it>.
|
||||
Smartctl version now includes the CVS snapshot date (if available).
|
||||
Windows: Look for "smartctl-nc.exe" instead of "smartctl.exe" by default.
|
||||
Windows: Use smartmontools-supplied smartctl-nc.exe by default (if found).
|
||||
Other minor changes (mainly Debian backports).
|
||||
|
||||
Version 0.8.3, released on 2008-12-27
|
||||
A random "Smartctl returned an empty output" error on Windows was fixed.
|
||||
Thanks to Zurab Khetsuriani for testing.
|
||||
@@ -10,7 +10,8 @@ Technology) data on modern hard disk drives. It allows you to inspect the
|
||||
drive's SMART data to determine its health, as well as run various tests on
|
||||
it.
|
||||
|
||||
Note: Only ATA drives (both PATA and SATA) are supported for now.
|
||||
Note: Only ATA drives (both PATA and SATA) and various USB to ATA bridges are
|
||||
supported for now.
|
||||
|
||||
http://gsmartcontrol.berlios.de
|
||||
|
||||
@@ -18,26 +19,27 @@ http://gsmartcontrol.berlios.de
|
||||
|
||||
Features
|
||||
|
||||
Automatically report and highlight any abnormal SMART information.
|
||||
* automatically reports and highlights any anomalies;
|
||||
|
||||
Ability to enable / disable SMART.
|
||||
* allows enabling/disabling SMART;
|
||||
|
||||
Ability to enable / disable Automatic Offline Data Collection - A short
|
||||
* allows enabling/disabling Automatic Offline Data Collection - a short
|
||||
self-check that the drive will perform automatically every four hours with no
|
||||
impact on performance.
|
||||
impact on performance;
|
||||
|
||||
Ability to set global and per-drive options for smartctl.
|
||||
* supports configuration of global and per-drive options for smartctl;
|
||||
|
||||
Display drive identity, capabilities, attributes, error and self-test logs.
|
||||
* performs SMART self-tests;
|
||||
|
||||
Perform SMART self-tests.
|
||||
* displays drive identity information, capabilities, attributes, and
|
||||
self-test/error logs;
|
||||
|
||||
Ability to load smartctl output as a "virtual" device, which acts just like a
|
||||
real (read-only) device.
|
||||
* can read in smartctl output from a saved file, interpreting it as a
|
||||
read-only virtual device;
|
||||
|
||||
Works on most smartctl-supported operating systems.
|
||||
* works on most smartctl-supported operating systems;
|
||||
|
||||
Extensive help information.
|
||||
* has extensive help information.
|
||||
|
||||
|
||||
|
||||
@@ -109,7 +111,7 @@ Most of these packages are probably already provided by your distribution.
|
||||
Here are the packages you need to have to build GSmartControl on some Linux
|
||||
distributions:
|
||||
|
||||
OpenSUSE, SLES, SLED:
|
||||
openSUSE, SLES, SLED:
|
||||
gcc-c++, pcre-devel, gtkmm2-devel, (possibly) libglademm-devel.
|
||||
|
||||
Fedora, CentOS, RHEL:
|
||||
@@ -146,9 +148,9 @@ SP1. The Windows port uses pd0, pd1, etc... for physical drives 0, 1, etc... .
|
||||
|
||||
* Solaris - Tested with Solaris 10 / x86 / gcc-3.4.3 / blastwave,
|
||||
Solaris 10 / x86 / sunstudio12 / sunfreeware. OpenSolaris should work but has
|
||||
not been tested yet. Note that until either smartctl gets ATA support under
|
||||
Solaris or GSmartControl gets SCSI support, these configurations are
|
||||
essentially useless.
|
||||
not been tested yet. Note: smartctl doesn't seem to support ATA under Solaris,
|
||||
while GSmartControl doesn't support SCSI yet. This only leaves various USB to
|
||||
ATA bridges. See smartctl (5), -d option for details.
|
||||
|
||||
* Mac OS X - 3rd-party testing by Fink project.
|
||||
|
||||
@@ -171,9 +173,9 @@ Long answer: read below.
|
||||
|
||||
First, check if you can find a pre-built package for your distribution or
|
||||
operating system - they usually provide the best integration and the easiest
|
||||
installation procedure. For Linux, one option is to try the OpenSUSE Build
|
||||
installation procedure. For Linux, one option is to try the openSUSE Build
|
||||
Service - it provides ready-to-install packages for various popular Linux
|
||||
distributions (OpenSUSE, Fedora, etc...). See
|
||||
distributions (openSUSE, Fedora, etc...). See
|
||||
http://download.opensuse.org/repositories/home:/alex_sh/ .
|
||||
|
||||
If you want to compile from source, check that you have all the required
|
||||
@@ -279,12 +281,12 @@ For more information, see smartctl and smartd documentation.
|
||||
|
||||
Known Issues
|
||||
|
||||
Only ATA (both PATA and SATA) disks are supported for now. The main reasons
|
||||
are:
|
||||
Only ATA drives (both PATA and SATA) and various USB to ATA bridges are
|
||||
supported for now. The main reasons are:
|
||||
|
||||
* We can't support drives which don't work with smartmontools. This affects
|
||||
drives which don't support SMART or don't export SMART data correctly (e.g.
|
||||
USB enclosures, RAIDs, etc...).
|
||||
some USB enclosures, RAIDs, etc...).
|
||||
|
||||
* Smartctl's output for SCSI drives is completely different compared to ATA.
|
||||
Also, SCSI drives are rarely found in desktop systems and the servers rarely
|
||||
@@ -296,18 +298,11 @@ Immediate Offline Tests are not supported. I haven't found a way to reliably
|
||||
monitor them yet. Besides, they run automatically anyway if Automatic Offline
|
||||
Data Collection is enabled.
|
||||
|
||||
You may run several tests on different drives in parallel, but you will only
|
||||
see the progress information of the last executing test. So, if you run tests
|
||||
on drives A, B and C (in that order), you won't be able to monitor the tests
|
||||
on A and B until C completes. And you won't be able to see any progress on A
|
||||
until both B and C complete their tests. This doesn't affect the tests
|
||||
themselves, just your ability to see their progress.
|
||||
|
||||
Testing is only supported on drives which correctly report their progress
|
||||
information in capabilities.
|
||||
|
||||
Not all drives support disabling Automatic Offline Data Collection, even if
|
||||
they report otherwise.
|
||||
they report otherwise. Unfortunately, there's no way to detect such drives.
|
||||
|
||||
Running on GTK+ / Gtkmm versions earlier than 2.12 may cause visual artifacts,
|
||||
usability issues (especially with tooltips and icons), instability, etc...
|
||||
@@ -327,18 +322,17 @@ terminal emulator (e.g., xterm, konsole or gnome-terminal):
|
||||
|
||||
smartctl -a /dev/sda
|
||||
|
||||
Note: If using official Windows packages, smartctl.exe doesn't provide any
|
||||
output. Use smartctl_console.exe instead. The devices name should be /dev/pd1
|
||||
for the second physical drive, etc... .
|
||||
Note: If using Windows, the device name should be /dev/pd1 for the second
|
||||
physical drive, etc... .
|
||||
|
||||
If you still think it's a GSmartControl issue, please collect the following
|
||||
information about your system. Without it, it may be very hard or impossible
|
||||
to fix the bug.
|
||||
|
||||
* Which operating system you use (for example, OpenSUSE Linux 11.0).
|
||||
* Which operating system you use (for example, openSUSE Linux 11.0).
|
||||
|
||||
* Which version of GTK and Gtkmm you have installed. Finding this out is very
|
||||
distribution-specific. For example, on OpenSUSE it would be
|
||||
distribution-specific. For example, on openSUSE it would be
|
||||
"rpm -q gtk2 gtkmm2". Some distributions have gtkmm24 instead. You may also
|
||||
search them in your distribution's graphical package manager, if there is one.
|
||||
|
||||
@@ -372,7 +366,7 @@ For license information, see LICENSE_gsmartcontrol.txt file.
|
||||
|
||||
You may notice that GSmartControl is not licensed under "GNU GPL version X or
|
||||
later", but under "GNU GPL version X and Y". I firmly believe that it's unwise
|
||||
to license a piece of code under non-existant licenses, whatever anyone else
|
||||
to license a piece of code under non-existent licenses, whatever anyone else
|
||||
might say. The reason for this is that one simply CANNOT know that, say, in 20
|
||||
years FSF won't be bought by some corporation who will release GPL version Z
|
||||
which will completely reverse the reasons GPL was created for.
|
||||
@@ -19,14 +19,6 @@ A treeview (also iconview, combobox) from glade comes
|
||||
with existing model, which should be unset.
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
portability:
|
||||
win32 32-bit: int: 4, long: 4, pointer: 4.
|
||||
win32 64-bit: int: 4, long: 8, pointer: 8.
|
||||
|
||||
sparc: same as win32 (what about OS?).
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------
|
||||
@@ -34,9 +26,15 @@ sparc: same as win32 (what about OS?).
|
||||
TODO:
|
||||
|
||||
|
||||
Patch pangomm for Pango::strip_markup().
|
||||
|
||||
Patch gtkmm, glibmm, pangomm for static win32 builds.
|
||||
Support Areca controller.
|
||||
|
||||
When adding device, have an option to specify "-d" type and other parameters.
|
||||
This is needed to support multi-disk devices.
|
||||
|
||||
|
||||
|
||||
Patch pangomm for Pango::strip_markup().
|
||||
|
||||
No Gtk::AboutDialog::set_logo(NULL);
|
||||
|
||||
@@ -46,9 +44,44 @@ libdebug:
|
||||
per-channel formatting.
|
||||
all flags should be per-channel.
|
||||
bug: if -q is passed, Execution log doesn't contain libdebug log. (requires per-channel status control).
|
||||
use format_time() instead of ctime() and friends, with ISO formatting.
|
||||
|
||||
|
||||
|
||||
'-l sataphy' -> SATA Phy event counters: Non-SMART feature, useful to detect SATA cabling problems.
|
||||
|
||||
'-l xerror' -> Extended Comprehensive Error log: An multi-sector and
|
||||
LBA48 capable version of '-l error'. Output is similar, except more
|
||||
entries can exists and the high bytes of the registers are also printed.
|
||||
Some newer drives (Samsung) only write to this log.
|
||||
|
||||
'-l scttemp' -> SCT Temperature history table. See below.
|
||||
|
||||
'-l xselftest' -> Extended Self Test Log: An multi-sector and LBA48
|
||||
capable version of '-l selftest'. Output will be similar, except more
|
||||
entries can exists and the LBA values can be somewhat longer.
|
||||
|
||||
"smartctl -l this_wont_exist" gives the list of supported logs - this
|
||||
is needed to detect xerror / xselftest support in smartctl.
|
||||
|
||||
|
||||
Careful with GPL (xerror...) stuff until the jmicron situation clears up.
|
||||
|
||||
Add detection for Interix (i586-pc-interix3), maybe with debian?
|
||||
|
||||
Re-check long double printing - win32 libc doesn't support it, a cast
|
||||
to double is needed.
|
||||
The underlying problem is that in msvc, long double is the same size
|
||||
as double, so printf() has mingw-incompatible presentation of long double.
|
||||
|
||||
Support USB flash disks in CVS smartctl versions:
|
||||
Try smartctl -i /dev/sdc;
|
||||
If it returns "Smartctl: please specify device type with the -d option.",
|
||||
try "-d scsi", which should at least give us the name.
|
||||
|
||||
Maybe make it easier to specify "-d" (with a dropdown?)
|
||||
Not sure, "-l aaa /tmp" doesn't list all types.
|
||||
|
||||
|
||||
|
||||
----------- Feature List ----------
|
||||
@@ -84,7 +117,6 @@ libdebug:
|
||||
+ * Selective self-test log and settings
|
||||
* SCT status and other stuff
|
||||
Display temperature somewhere (use SCT or Attr 194 for this).
|
||||
Which one is updated more frequently, SCT or attr 194?
|
||||
+ * Ability to save this information to a file.
|
||||
+ * On info window show: Ask to turn SMART on if it's disabled
|
||||
|
||||
@@ -94,7 +126,7 @@ libdebug:
|
||||
+ smartctl exited with error - look it up in error map.
|
||||
|
||||
|
||||
SCT Temperatures (do we use these?)
|
||||
SCT Temperatures
|
||||
-l scttemp prints temperature and history.
|
||||
-t scttempint,N[,p] (N - count, p - preserve across reset or not).
|
||||
This configures temperature logging interval (1 min by default) and clears the history.
|
||||
@@ -26,12 +26,23 @@
|
||||
|
||||
AC_DEFUN([AC_CXX_EXCEPTIONS],
|
||||
[AC_CACHE_CHECK(whether the compiler supports exceptions,
|
||||
ac_cv_cxx_exceptions,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[try { throw 1; } catch (int i) { return i; }]])],[ac_cv_cxx_exceptions=yes],[ac_cv_cxx_exceptions=no])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "$ac_cv_cxx_exceptions" = yes; then
|
||||
AC_DEFINE(HAVE_EXCEPTIONS,,[define if the compiler supports exceptions])
|
||||
fi
|
||||
ac_cv_cxx_exceptions,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
|
||||
[[try { throw 1; } catch (int i) { return i; }]])],
|
||||
[ac_cv_cxx_exceptions=yes], [ac_cv_cxx_exceptions=no])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
|
||||
if test "$ac_cv_cxx_exceptions" = yes; then
|
||||
AC_DEFINE(HAVE_EXCEPTIONS, 1,
|
||||
[defined to 1 if the compiler supports exceptions, 0 otherwise])
|
||||
else
|
||||
AC_DEFINE(HAVE_EXCEPTIONS, 0,
|
||||
[defined to 1 if the compiler supports exceptions, 0 otherwise])
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
|
||||
|
||||
@@ -26,12 +26,22 @@
|
||||
|
||||
AC_DEFUN([AC_CXX_NAMESPACES],
|
||||
[AC_CACHE_CHECK(whether the compiler implements namespaces,
|
||||
ac_cv_cxx_namespaces,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[namespace Outer { namespace Inner { int i = 0; }}]], [[using namespace Outer::Inner; return i;]])],[ac_cv_cxx_namespaces=yes],[ac_cv_cxx_namespaces=no])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "$ac_cv_cxx_namespaces" = yes; then
|
||||
AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
|
||||
fi
|
||||
ac_cv_cxx_namespaces,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[namespace Outer { namespace Inner { int i = 0; }}]],
|
||||
[[using namespace Outer::Inner; return i;]])],
|
||||
[ac_cv_cxx_namespaces=yes], [ac_cv_cxx_namespaces=no])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "$ac_cv_cxx_namespaces" = yes; then
|
||||
AC_DEFINE(HAVE_NAMESPACES, 1,
|
||||
[defined to 1 if the compiler implements namespaces, 0 otherwise])
|
||||
else
|
||||
AC_DEFINE(HAVE_NAMESPACES, 0,
|
||||
[defined to 1 if the compiler implements namespaces, 0 otherwise])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
@@ -26,25 +26,35 @@
|
||||
|
||||
AC_DEFUN([AC_CXX_RTTI],
|
||||
[AC_CACHE_CHECK(whether the compiler supports Run-Time Type Identification,
|
||||
ac_cv_cxx_rtti,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <typeinfo>
|
||||
class Base { public :
|
||||
Base () {}
|
||||
virtual int f () { return 0; }
|
||||
};
|
||||
class Derived : public Base { public :
|
||||
Derived () {}
|
||||
virtual int f () { return 1; }
|
||||
};
|
||||
]], [[Derived d;
|
||||
Base *ptr = &d;
|
||||
return typeid (*ptr) == typeid (Derived);
|
||||
]])],[ac_cv_cxx_rtti=yes],[ac_cv_cxx_rtti=no])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "$ac_cv_cxx_rtti" = yes; then
|
||||
AC_DEFINE(HAVE_RTTI,,
|
||||
[define if the compiler supports Run-Time Type Identification])
|
||||
fi
|
||||
ac_cv_cxx_rtti,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <typeinfo>
|
||||
class Base {
|
||||
public:
|
||||
Base () {}
|
||||
virtual int f () { return 0; }
|
||||
};
|
||||
class Derived : public Base {
|
||||
public :
|
||||
Derived () {}
|
||||
virtual int f () { return 1; }
|
||||
};
|
||||
]], [[
|
||||
Derived d;
|
||||
Base* ptr = &d;
|
||||
return typeid (*ptr) == typeid (Derived);
|
||||
]])],
|
||||
[ac_cv_cxx_rtti=yes], [ac_cv_cxx_rtti=no])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "$ac_cv_cxx_rtti" = yes; then
|
||||
AC_DEFINE(HAVE_RTTI, 1,
|
||||
[defined to 1 if the compiler supports Run-Time Type Identification, 0 otherwise])
|
||||
else
|
||||
AC_DEFINE(HAVE_RTTI, 0,
|
||||
[defined to 1 if the compiler supports Run-Time Type Identification, 0 otherwise])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
@@ -25,16 +25,25 @@
|
||||
|
||||
AC_DEFUN([AC_CXX_VERBOSE_TERMINATE_HANDLER],
|
||||
[AC_CACHE_CHECK(whether the compiler has __gnu_cxx::__verbose_terminate_handler,
|
||||
ac_cv_verbose_terminate_handler,
|
||||
[
|
||||
AC_REQUIRE([AC_CXX_EXCEPTIONS])
|
||||
AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <exception>]], [[std::set_terminate(__gnu_cxx::__verbose_terminate_handler);]])],[ac_cv_verbose_terminate_handler=yes],[ac_cv_verbose_terminate_handler=no
|
||||
])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "$ac_cv_verbose_terminate_handler" = yes; then
|
||||
AC_DEFINE(HAVE_VERBOSE_TERMINATE_HANDLER, , [define if the compiler has __gnu_cxx::__verbose_terminate_handler])
|
||||
fi
|
||||
ac_cv_verbose_terminate_handler,
|
||||
[
|
||||
AC_REQUIRE([AC_CXX_EXCEPTIONS])
|
||||
AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[#include <exception>]],
|
||||
[[std::set_terminate(__gnu_cxx::__verbose_terminate_handler);]])],
|
||||
[ac_cv_verbose_terminate_handler=yes], [ac_cv_verbose_terminate_handler=no])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "$ac_cv_verbose_terminate_handler" = yes; then
|
||||
AC_DEFINE(HAVE_VERBOSE_TERMINATE_HANDLER, 1,
|
||||
[defined to 1 if the compiler has __gnu_cxx::__verbose_terminate_handler, 0 otherwise])
|
||||
else
|
||||
AC_DEFINE(HAVE_VERBOSE_TERMINATE_HANDLER, 0,
|
||||
[defined to 1 if the compiler has __gnu_cxx::__verbose_terminate_handler, 0 otherwise])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_zlib.txt file
|
||||
############################################################################
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_zlib.txt file
|
||||
############################################################################
|
||||
|
||||
@@ -135,13 +135,17 @@ AC_DEFUN([APP_CHOOSE_GLD_READER], [
|
||||
# export to config.h
|
||||
if test "$app_cv_gld_reader" = "libglade"; then
|
||||
AC_DEFINE(ENABLE_LIBGLADE, 1, [Use libglade(mm) instead of GtkBuilder])
|
||||
else
|
||||
AC_DEFINE(ENABLE_LIBGLADE, 0, [Use libglade(mm) instead of GtkBuilder])
|
||||
fi
|
||||
if test "$app_cv_gld_reader" = "gtkbuilder"; then
|
||||
AC_DEFINE(ENABLE_GTKBUILDER, 1, [Use GtkBuilder instead of libglademm])
|
||||
else
|
||||
AC_DEFINE(ENABLE_GTKBUILDER, 1, [Use GtkBuilder instead of libglademm])
|
||||
fi
|
||||
|
||||
# If we move this to the start, some messages get in between, so we have to have it here.
|
||||
AC_MSG_CHECKING([for glade file support:])
|
||||
AC_MSG_CHECKING([for glade file support])
|
||||
|
||||
AC_MSG_RESULT([$app_cv_gld_reader])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_zlib.txt file
|
||||
############################################################################
|
||||
|
||||
@@ -50,7 +50,8 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
# gcc / gnu environment, mingw, cygwin.
|
||||
if test "x$app_cv_compiler_common_options" = "xgnu"; then
|
||||
|
||||
if test "x$app_cv_target_os_env" = "xmingw" || test "x$app_cv_target_os_env" = "xcygwin"; then
|
||||
if test "x$app_cv_target_os_env" = "xmingw32" || test "x$app_cv_target_os_env" = "xmingw64" \
|
||||
|| test "x$app_cv_target_os_env" = "xcygwin"; then
|
||||
# mingw gcc options:
|
||||
# -mno-cygwin - generate non-cygwin executables in cygwin's mingw.
|
||||
# -mms-bitfields - make structures compatible with msvc. recommended default for non-cygwin.
|
||||
@@ -60,7 +61,7 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
fi
|
||||
|
||||
# Note: Disabled -Wconversion, it was causing lots of silly warnings under x86-64.
|
||||
app_cv_compiler_tmp_var="-Wall -Wcast-align -Wcast-qual \
|
||||
app_cv_compiler_tmp_var="-Wall -Wcast-align -Wcast-qual -Wconversion \
|
||||
-Wctor-dtor-privacy -Wfloat-equal -Wnon-virtual-dtor -Woverloaded-virtual \
|
||||
-Wpointer-arith -Wshadow -Wsign-compare -Wsign-promo -Wundef -Wwrite-strings";
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags $app_cv_compiler_tmp_var";
|
||||
@@ -78,7 +79,16 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
# suncc
|
||||
elif test "x$app_cv_compiler_common_options" = "xsun"; then
|
||||
# Enable useful language extensions (e.g. __func__ in C++). Details at
|
||||
# http://docs.sun.com/app/docs/doc/819-5267/6n7c46drp?a=view
|
||||
# http://docs.sun.com/app/docs/doc/820-7599/bkapy?a=view
|
||||
# Additional options: "-staticlib=Crun -staticlib=Cstd" - link statically to
|
||||
# C++ runtime and standard libraries.
|
||||
# http://docs.sun.com/app/docs/doc/820-7599/bkaws?a=view
|
||||
|
||||
# STLport seems to be more standards-compliant, but incompatible
|
||||
# with default Cstd. Also, it's not guaranteed to keep compatibility
|
||||
# between versions. Select it with "-library=stlport4".
|
||||
# http://docs.sun.com/app/docs/doc/820-7599/bkakg?a=view
|
||||
# http://developers.sun.com/solaris/articles/cmp_stlport_libCstd.html
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags \
|
||||
+w -errtags -erroff=notemsource,notused -features=extensions";
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags \
|
||||
@@ -165,11 +175,11 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
# gcc, mingw
|
||||
if test "x$app_cv_compiler_optimize_options" = "xgnu"; then
|
||||
# -mtune=generic is since gcc 4.0 iirc
|
||||
if test "x$app_cv_target_os_env" = "xmingw" || test "x$app_cv_target_os_env" = "xcygwin"; then
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -g0 -O3 -s -march=i586";
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -g0 -O3 -s -march=i586";
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -g0 -O3 -s -march=i586";
|
||||
else
|
||||
if test "x$app_cv_target_os_env" = "xmingw32"; then
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -g0 -O3 -s -march=i686";
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -g0 -O3 -s -march=i686";
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -g0 -O3 -s -march=i686";
|
||||
else # mingw64, cygwin (they have new gcc), others.
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -g0 -O3 -s -mtune=generic";
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -g0 -O3 -s -mtune=generic";
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -g0 -O3 -s -mtune=generic";
|
||||
@@ -218,7 +228,7 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
# -mconsole - opposite of -mwindows, default.
|
||||
|
||||
AC_ARG_ENABLE(windows-console, AS_HELP_STRING([--enable-windows-console=yes|no|auto],
|
||||
[enable windows console (MinGW only). Accepted values are yes, no, auto. ]
|
||||
[enable windows console (MinGW and Cygwin only). Accepted values are yes, no, auto. ]
|
||||
[Auto means disabled for optimized builds, enabled for all others. (Default: auto)]),
|
||||
[app_cv_compiler_windows_console=${enableval}], [app_cv_compiler_windows_console=auto])
|
||||
|
||||
@@ -231,15 +241,12 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$app_cv_target_os_env" = "xmingw" || test "x$app_cv_target_os_env" = "xcygwin"; then
|
||||
if test "x$app_cv_target_os_env" = "xmingw32" || test "x$app_cv_target_os_env" = "xmingw64" \
|
||||
|| test "x$app_cv_target_os_env" = "xcygwin"; then
|
||||
if test "x$app_cv_compiler_windows_console" = "xno"; then
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mwindows";
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mwindows";
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mwindows";
|
||||
else
|
||||
# specify -mconsole even if it's the default - it should override the user-supplied setting
|
||||
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mconsole";
|
||||
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mconsole";
|
||||
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mconsole";
|
||||
fi
|
||||
AC_MSG_NOTICE([Enable windows console: $app_cv_compiler_windows_console])
|
||||
@@ -1,13 +1,14 @@
|
||||
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_zlib.txt file
|
||||
############################################################################
|
||||
|
||||
|
||||
# Check whether C++ compiler supports overloading between
|
||||
# extern "C" function pointer and C++ function pointer. GCC and
|
||||
# Check whether C++ compiler supports overloading of functions
|
||||
# with function pointer argument differing only in extern "C" specification,
|
||||
# that is, extern "C" function pointer and C++ function pointer. GCC and
|
||||
# Intel treat them equally, so no overloads are needed (or accepted)
|
||||
# there.
|
||||
|
||||
@@ -21,7 +22,8 @@
|
||||
# for template parameters (I don't remember the exact details).
|
||||
|
||||
|
||||
# If such support is found, HAVE_CXX_EXTERN_C_OVERLOAD is defined.
|
||||
# If such overloading support is found,
|
||||
# HAVE_CXX_EXTERN_C_OVERLOAD is defined.
|
||||
|
||||
|
||||
AC_DEFUN([APP_CXX_EXTERN_C_OVERLOAD], [
|
||||
@@ -37,8 +39,11 @@ AC_DEFUN([APP_CXX_EXTERN_C_OVERLOAD], [
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "x$ac_cv_cxx_extern_c_overload" = "xyes"; then
|
||||
AC_DEFINE(HAVE_CXX_EXTERN_C_OVERLOAD, ,
|
||||
[Define if the C++ complier accepts extern C function pointer overload])
|
||||
AC_DEFINE(HAVE_CXX_EXTERN_C_OVERLOAD, 1,
|
||||
[Defined to 1 if the C++ complier accepts extern C function pointer overload, 0 otherwise])
|
||||
else
|
||||
AC_DEFINE(HAVE_CXX_EXTERN_C_OVERLOAD, 0,
|
||||
[Defined to 1 if the C++ complier accepts extern C function pointer overload, 0 otherwise])
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_zlib.txt file
|
||||
############################################################################
|
||||
|
||||
|
||||
# Check whether C++ compiler supports C99 __func__.
|
||||
|
||||
AC_DEFUN([APP_CXX___FUNC__], [
|
||||
AC_DEFUN([APP_CXX___func__], [
|
||||
AC_CACHE_CHECK(whether $CXX recognizes __func__, app_cv_cxx___func__, [
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
|
||||
@@ -17,8 +17,11 @@ AC_DEFUN([APP_CXX___FUNC__], [
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "x$app_cv_cxx___func__" = "xyes"; then
|
||||
AC_DEFINE(HAVE_CXX___func__, ,
|
||||
[Define if the C++ complier supports __func__])
|
||||
AC_DEFINE(HAVE_CXX___func__, 1,
|
||||
[Defined to 1 if the C++ complier supports __func__, 0 otherwise])
|
||||
else
|
||||
AC_DEFINE(HAVE_CXX___func__, 0,
|
||||
[Defined to 1 if the C++ complier supports __func__, 0 otherwise])
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -35,8 +38,11 @@ AC_DEFUN([APP_CXX___FUNCTION__], [
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "x$app_cv_cxx___FUNCTION__" = "xyes"; then
|
||||
AC_DEFINE(HAVE_CXX___FUNCTION__, ,
|
||||
[Define if the C++ complier supports __FUNCTION__])
|
||||
AC_DEFINE(HAVE_CXX___FUNCTION__, 1,
|
||||
[Defined to 1 if the C++ complier supports __FUNCTION__, 0 otherwise])
|
||||
else
|
||||
AC_DEFINE(HAVE_CXX___FUNCTION__, 0,
|
||||
[Defined to 1 if the C++ complier supports __FUNCTION__, 0 otherwise])
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_zlib.txt file
|
||||
############################################################################
|
||||
|
||||
@@ -59,12 +59,24 @@ AC_DEFUN([APP_DETECT_OS_KERNEL], [
|
||||
app_cv_[]$1[]_os_kernel_macro="LINUX";
|
||||
;;
|
||||
|
||||
*mingw* | *cygwin*)
|
||||
i*86-*mingw* | i*86-*cygwin*)
|
||||
# mingw defines _WIN32. msvc defines _WIN32 (built-in), and WIN32 via windows.h.
|
||||
# Other mingw defines include: __WINNT, __WINNT__, __WIN32__, __i386, _X86_,
|
||||
# i386, __i386__, WIN32, __MINGW32__, WINNT (all equal to 1).
|
||||
app_cv_[]$1[]_os_kernel="windows";
|
||||
app_cv_[]$1[]_os_kernel_macro="WINDOWS";
|
||||
app_cv_[]$1[]_os_kernel="windows32";
|
||||
app_cv_[]$1[]_os_kernel_macro="WINDOWS32";
|
||||
;;
|
||||
|
||||
x86_64-*-mingw* | x86_64-*-cygwin*)
|
||||
# mingw64 defines the same stuff as 32-bit one, plus _WIN64, __MINGW64__, etc... .
|
||||
app_cv_[]$1[]_os_kernel="windows64";
|
||||
app_cv_[]$1[]_os_kernel_macro="WINDOWS64";
|
||||
;;
|
||||
|
||||
*interix*)
|
||||
# Interix is a kernel on top of windows, so we treat it separately.
|
||||
app_cv_[]$1[]_os_kernel="interix";
|
||||
app_cv_[]$1[]_os_kernel_macro="INTERIX";
|
||||
;;
|
||||
|
||||
# This includes debian gnu/kfreebsd. Dragonfly is checked separately.
|
||||
@@ -124,8 +136,14 @@ AC_DEFUN([APP_DETECT_OS_KERNEL], [
|
||||
if test "x${app_cv_[]$1[]_os_kernel}" = "xlinux"; then
|
||||
AC_DEFINE($2[]LINUX, 1, [$1 OS kernel])
|
||||
fi
|
||||
if test "x${app_cv_[]$1[]_os_kernel}" = "xwindows"; then
|
||||
AC_DEFINE($2[]WINDOWS, 1, [$1 OS kernel])
|
||||
if test "x${app_cv_[]$1[]_os_kernel}" = "xwindows32"; then
|
||||
AC_DEFINE($2[]WINDOWS32, 1, [$1 OS kernel])
|
||||
fi
|
||||
if test "x${app_cv_[]$1[]_os_kernel}" = "xwindows64"; then
|
||||
AC_DEFINE($2[]WINDOWS64, 1, [$1 OS kernel])
|
||||
fi
|
||||
if test "x${app_cv_[]$1[]_os_kernel}" = "xinterix"; then
|
||||
AC_DEFINE($2[]INTERIX, 1, [$1 OS kernel])
|
||||
fi
|
||||
if test "x${app_cv_[]$1[]_os_kernel}" = "xfreebsd"; then
|
||||
AC_DEFINE($2[]FREEBSD, 1, [$1 OS kernel])
|
||||
@@ -154,7 +172,9 @@ AC_DEFUN([APP_DETECT_OS_KERNEL], [
|
||||
|
||||
# Export to Makefile.am's.
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_LINUX, [test "x${app_cv_[]$1[]_os_kernel}" = "xlinux"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_WINDOWS, [test "x${app_cv_[]$1[]_os_kernel}" = "xwindows"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_WINDOWS32, [test "x${app_cv_[]$1[]_os_kernel}" = "xwindows32"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_WINDOWS64, [test "x${app_cv_[]$1[]_os_kernel}" = "xwindows64"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_INTERIX, [test "x${app_cv_[]$1[]_os_kernel}" = "xinterix"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_FREEBSD, [test "x${app_cv_[]$1[]_os_kernel}" = "xfreebsd"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_DRAGONFLY, [test "x${app_cv_[]$1[]_os_kernel}" = "xdragonfly"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_OPENBSD, [test "x${app_cv_[]$1[]_os_kernel}" = "xopenbsd"])
|
||||
@@ -164,6 +184,19 @@ AC_DEFUN([APP_DETECT_OS_KERNEL], [
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_QNX, [test "x${app_cv_[]$1[]_os_kernel}" = "xqnx"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_UNKNOWN, [test "x${app_cv_[]$1[]_os_kernel}" = "xunknown"])
|
||||
|
||||
|
||||
# composite ones, for easy checking
|
||||
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_KERNEL_FAMILY_WINDOWS, \
|
||||
[test "x${app_cv_[]$1[]_os_kernel}" = "xwindows32" || test "x${app_cv_[]$1[]_os_kernel}" = "xwindows64" \
|
||||
|| test "x${app_cv_[]$1[]_os_kernel}" = "xinterix"])
|
||||
|
||||
if test "x${app_cv_[]$1[]_os_kernel}" = "xwindows32" || test "x${app_cv_[]$1[]_os_kernel}" = "xwindows64" \
|
||||
|| test "x${app_cv_[]$1[]_os_kernel}" = "xinterix"; then
|
||||
AC_DEFINE($2[]FAMILY_WINDOWS, 1, [$1 OS kernel family])
|
||||
fi
|
||||
|
||||
|
||||
AC_MSG_RESULT([${app_cv_[]$1[]_os_kernel}])
|
||||
])
|
||||
|
||||
@@ -216,9 +249,17 @@ AC_DEFUN([APP_DETECT_OS_ENV], [
|
||||
app_cv_[]$1[]_os_env="cygwin";
|
||||
app_cv_[]$1[]_os_env_macro="CYGWIN";
|
||||
;;
|
||||
*mingw*)
|
||||
app_cv_[]$1[]_os_env="mingw";
|
||||
app_cv_[]$1[]_os_env_macro="MINGW";
|
||||
i*86-*mingw*)
|
||||
app_cv_[]$1[]_os_env="mingw32";
|
||||
app_cv_[]$1[]_os_env_macro="MINGW32";
|
||||
;;
|
||||
x86_64-*-mingw*)
|
||||
app_cv_[]$1[]_os_env="mingw64";
|
||||
app_cv_[]$1[]_os_env_macro="MINGW64";
|
||||
;;
|
||||
*interix*)
|
||||
app_cv_[]$1[]_os_env="interix";
|
||||
app_cv_[]$1[]_os_env_macro="INTERIX";
|
||||
;;
|
||||
# This includes gnu/linux, debian gnu/kfreebsd, debian gnu/netbsd...
|
||||
*-gnu | gnu*)
|
||||
@@ -271,8 +312,14 @@ AC_DEFUN([APP_DETECT_OS_ENV], [
|
||||
if test "x${app_cv_[]$1[]_os_env}" = "xcygwin"; then
|
||||
AC_DEFINE($2[]CYGWIN, 1, [$1 OS userspace environment])
|
||||
fi
|
||||
if test "x${app_cv_[]$1[]_os_env}" = "xmingw"; then
|
||||
AC_DEFINE($2[]MINGW, 1, [$1 OS userspace environment])
|
||||
if test "x${app_cv_[]$1[]_os_env}" = "xmingw32"; then
|
||||
AC_DEFINE($2[]MINGW32, 1, [$1 OS userspace environment])
|
||||
fi
|
||||
if test "x${app_cv_[]$1[]_os_env}" = "xmingw64"; then
|
||||
AC_DEFINE($2[]MINGW64, 1, [$1 OS userspace environment])
|
||||
fi
|
||||
if test "x${app_cv_[]$1[]_os_env}" = "xinterix"; then
|
||||
AC_DEFINE($2[]INTERIX, 1, [$1 OS userspace environment])
|
||||
fi
|
||||
if test "x${app_cv_[]$1[]_os_env}" = "xgnu"; then
|
||||
AC_DEFINE($2[]GNU, 1, [$1 OS userspace environment])
|
||||
@@ -304,7 +351,9 @@ AC_DEFUN([APP_DETECT_OS_ENV], [
|
||||
|
||||
# Export to Makefile.am's.
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_CYGWIN, [test "x${app_cv_[]$1[]_os_env}" = "xcygwin"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_MINGW, [test "x${app_cv_[]$1[]_os_env}" = "xmingw"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_MINGW32, [test "x${app_cv_[]$1[]_os_env}" = "xmingw32"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_MINGW64, [test "x${app_cv_[]$1[]_os_env}" = "xmingw64"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_INTERIX, [test "x${app_cv_[]$1[]_os_env}" = "xinterix"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_GNU, [test "x${app_cv_[]$1[]_os_env}" = "xgnu"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_FREEBSD, [test "x${app_cv_[]$1[]_os_env}" = "xfreebsd"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_DRAGONFLY, [test "x${app_cv_[]$1[]_os_env}" = "xdragonfly"])
|
||||
@@ -315,6 +364,7 @@ AC_DEFUN([APP_DETECT_OS_ENV], [
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_QNX, [test "x${app_cv_[]$1[]_os_env}" = "xqnx"])
|
||||
AM_CONDITIONAL(m4_toupper($1)[]_OS_ENV_UNKNOWN, [test "x${app_cv_[]$1[]_os_env}" = "xunknown"])
|
||||
|
||||
|
||||
AC_MSG_RESULT([${app_cv_[]$1[]_os_env}])
|
||||
])
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_zlib.txt file
|
||||
############################################################################
|
||||
|
||||
|
||||
# APP_GET_MT_FLAGS(flags_prefix[, action-if-not-found])
|
||||
# This macro detects compiler flags which are needed to compile a multi-threaded
|
||||
# (possibly pthreads-based) applications on target OS. flags_prefixCFLAGS,
|
||||
# (preferably pthreads-based) applications on target OS. flags_prefixCFLAGS,
|
||||
# flags_prefixCXXFLAGS and flags_prefixLIBS will be initialized (or appended to)
|
||||
# with the correct flags.
|
||||
|
||||
@@ -47,7 +47,7 @@ AC_DEFUN([APP_GET_MT_FLAGS], [
|
||||
fi
|
||||
|
||||
|
||||
# Compilers use at least 3 defines to indicate thread-safe support to standard libs:
|
||||
# Compilers use at least 3 defines to enable thread-safe support:
|
||||
# _THREAD_SAFE, _MT, _REENTRANT.
|
||||
# We use the ones that are required for detected platform.
|
||||
|
||||
@@ -63,17 +63,20 @@ AC_DEFUN([APP_GET_MT_FLAGS], [
|
||||
app_cv_target_thread_found="yes";
|
||||
|
||||
elif test "$ax_cv_cxx_compiler_vendor" = "sun"; then
|
||||
# suncc needs -lpthread on posix but not solaris.
|
||||
# -mt defines _REENTRANT too. Don't use -lthread.
|
||||
# suncc's -mt expands to:
|
||||
# "-D_REENTRANT -lpthread" on Linux, uses pthreads (pthread.h);
|
||||
# "-D_REENTRANT -lthread" on Solaris, uses Solaris threads (thread.h).
|
||||
# To use pthreads on Solaris, use "-mt -lpthread".
|
||||
# http://docs.sun.com/app/docs/doc/820-7598/bjapp?a=view
|
||||
app_cv_target_thread_cflags="-mt"
|
||||
app_cv_target_thread_cxxflags="-mt"
|
||||
app_cv_target_thread_libs="-mt -lpthread"
|
||||
app_cv_target_thread_libs="-mt"
|
||||
app_cv_target_thread_found="yes";
|
||||
|
||||
fi
|
||||
;;
|
||||
|
||||
windows)
|
||||
windows*)
|
||||
# NOTE: Not sure about cygwin.
|
||||
# NOTE: This only enables multithreaded code generation. For linking
|
||||
# with pthreads-win32 you need additional flags.
|
||||
@@ -87,10 +90,20 @@ AC_DEFUN([APP_GET_MT_FLAGS], [
|
||||
fi
|
||||
;;
|
||||
|
||||
freebsd | dragonfly | netbsd | openbsd)
|
||||
interix)
|
||||
# Interix kernel is implemented on top of windows kernel.
|
||||
# Interix uses -D_REENTRANT for pthreads, automatically enabling -lpthread.
|
||||
if test "$ax_cv_cxx_compiler_vendor" = "gnu"; then
|
||||
app_cv_target_thread_cflags="-D_REENTRANT"
|
||||
app_cv_target_thread_cxxflags="-D_REENTRANT"
|
||||
app_cv_target_thread_found="yes"
|
||||
fi
|
||||
;;
|
||||
|
||||
freebsd | dragonfly)
|
||||
# NOTE: Not sure about debian gnu/kfreebsd and gnu/netbsd.
|
||||
# Freebsd had -kthread, but it has been discontinued (afaik).
|
||||
# For freebsd -pthread already replaces libc with libc_r.
|
||||
# For freebsd -pthread replaces libc with libc_r.
|
||||
if test "$ax_cv_cxx_compiler_vendor" = "gnu"; then
|
||||
app_cv_target_thread_cflags="-pthread -D_MT -D_THREAD_SAFE"
|
||||
app_cv_target_thread_cxxflags="-pthread -D_MT -D_THREAD_SAFE"
|
||||
@@ -99,22 +112,48 @@ AC_DEFUN([APP_GET_MT_FLAGS], [
|
||||
fi
|
||||
;;
|
||||
|
||||
openbsd)
|
||||
if test "$ax_cv_cxx_compiler_vendor" = "gnu"; then
|
||||
app_cv_target_thread_cflags="-pthread -D_REENTRANT"
|
||||
app_cv_target_thread_cxxflags="-pthread -D_REENTRANT"
|
||||
app_cv_target_thread_libs="-pthread"
|
||||
app_cv_target_thread_found="yes";
|
||||
fi
|
||||
;;
|
||||
|
||||
netbsd)
|
||||
# See sys/featuretest.h
|
||||
if test "$ax_cv_cxx_compiler_vendor" = "gnu"; then
|
||||
app_cv_target_thread_cflags="-pthread -D_REENTRANT"
|
||||
app_cv_target_thread_cxxflags="-pthread -D_REENTRANT"
|
||||
app_cv_target_thread_libs="-pthread"
|
||||
app_cv_target_thread_found="yes";
|
||||
fi
|
||||
;;
|
||||
|
||||
solaris)
|
||||
if test "$ax_cv_cxx_compiler_vendor" = "gnu"; then
|
||||
# gnu documentation mentions -threads (and its aliases, -pthreads and -pthread)
|
||||
app_cv_target_thread_cflags="-pthreads -D_MT -D_THREAD_SAFE"
|
||||
app_cv_target_thread_cxxflags="-pthreads -D_MT -D_THREAD_SAFE"
|
||||
# gnu documentation mentions -threads (and its aliases, -pthreads and -pthread).
|
||||
# _REENTRANT is needed to enable some thread-safe equivalents of standard
|
||||
# functions.
|
||||
# http://docs.sun.com/app/docs/doc/805-8005-04/6j7hcvqs4?l=ko&a=view
|
||||
app_cv_target_thread_cflags="-pthreads -D_MT -D_THREAD_SAFE -D_REENTRANT"
|
||||
app_cv_target_thread_cxxflags="-pthreads -D_MT -D_THREAD_SAFE -D_REENTRANT"
|
||||
app_cv_target_thread_libs="-pthreads"
|
||||
app_cv_target_thread_found="yes"
|
||||
|
||||
elif test "$ax_cv_cxx_compiler_vendor" = "sun"; then
|
||||
# -mt defines _REENTRANT too. Don't use -lthread.
|
||||
# suncc's -mt expands to:
|
||||
# "-D_REENTRANT -lpthread" on Linux, uses pthreads (pthread.h);
|
||||
# "-D_REENTRANT -lthread" on Solaris, uses Solaris threads (thread.h).
|
||||
# To use pthreads on Solaris, use "-mt -lpthread".
|
||||
# http://docs.sun.com/app/docs/doc/820-7598/bjapp?a=view
|
||||
# http://docs.sun.com/app/docs/doc/816-5175/pthreads-5?a=view
|
||||
# http://docs.sun.com/app/docs/doc/816-5137/compile-74765?a=view
|
||||
# There are two threading libraries, selectable via different switches.
|
||||
app_cv_target_thread_cflags="-mt"
|
||||
app_cv_target_thread_cxxflags="-mt"
|
||||
app_cv_target_thread_libs="-mt"
|
||||
# We use POSIX threads, so append -lpthread.
|
||||
app_cv_target_thread_cflags="-mt -lpthread"
|
||||
app_cv_target_thread_cxxflags="-mt -lpthread"
|
||||
app_cv_target_thread_libs="-mt -lpthread"
|
||||
app_cv_target_thread_found="yes"
|
||||
fi
|
||||
;;
|
||||
@@ -122,8 +161,6 @@ AC_DEFUN([APP_GET_MT_FLAGS], [
|
||||
darwin)
|
||||
if test "$ax_cv_cxx_compiler_vendor" = "gnu"; then
|
||||
# Darwin produces mt code by default, and -pthread is an error.
|
||||
# gcc/darwin defines __APPLE__. __UNIX__ is not defined.
|
||||
# -D_THREAD_SAFE
|
||||
app_cv_target_thread_found="yes"
|
||||
fi
|
||||
;;
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_zlib.txt file
|
||||
############################################################################
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
# Basically, it's the same as AC_USE_SYSTEM_EXTENSIONS,
|
||||
# but uses compiler flag approach instead of config.h.
|
||||
|
||||
# The extensions used bring the system closer to the GNU,
|
||||
# X/Open (a superset of POSIX) and POSIX systems.
|
||||
|
||||
# You must call AX_COMPILER_VENDOR
|
||||
# and APP_DETECT_OS_ENV([target], ...) before using this macro.
|
||||
|
||||
@@ -66,10 +69,49 @@ AC_DEFUN([APP_USE_SYSTEM_EXTENSIONS], [
|
||||
solaris)
|
||||
# The problem with solaris is that it has too many incompatible
|
||||
# feature test macros, and there is no enable-all macro. Autoconf
|
||||
# mistakenly assumes that __EXTENSIONS__ is the one, but
|
||||
# it should be defined _in addition_ to feature test macros.
|
||||
# assumes that __EXTENSIONS__ is the one, but it should be defined
|
||||
# _in addition_ to feature test macros. Note that on its own, __EXTENSIONS__
|
||||
# still enables some useful stuff like _LARGEFILE64_SOURCE.
|
||||
# To support some posix macros, additional link objects are also required.
|
||||
# Some *_SOURCE feature test macros may be incompatible with C++.
|
||||
# http://docs.sun.com/app/docs/doc/816-5175/standards-5?a=view
|
||||
app_cv_target_extension_cflags="-D__EXTENSIONS__"
|
||||
app_cv_target_extension_cxxflags="-D__EXTENSIONS__"
|
||||
;;
|
||||
|
||||
netbsd)
|
||||
# There is no enable-all macro.
|
||||
# (_XOPEN_SOURCE >= 500 || _NETBSD_SOURCE) is recommended.
|
||||
# The default is _NETBSD_SOURCE, _XOPEN_SOURCE overrides it.
|
||||
# The manual says that rename() will behave posix-like if _POSIX_C_SOURCE
|
||||
# is defined. However, stdio.h uses (_XOPEN_SOURCE <= 2) condition,
|
||||
# which is really bogus.
|
||||
# See sys/featuretest.h
|
||||
;;
|
||||
|
||||
mingw32)
|
||||
# This enables standards-compliant stdio behaviour (regarding printf and
|
||||
# friends), as opposed to msvc-compatible one. This is usually enabled
|
||||
# by default if one of the usual macros are encountered (_XOPEN_SOURCE,
|
||||
# _GNU_SOURCE, etc...).
|
||||
# Also, we make the win2k API available (includes console functions, etc...).
|
||||
# Other things to consider: _NO_OLDNAMES (disable "deprecated"
|
||||
# non-underscored names like chdir (use _chdir), etc...).
|
||||
# See _mingw.h for details.
|
||||
app_cv_target_extension_cflags="-D__USE_MINGW_ANSI_STDIO=1 -DWINVER=0x0500"
|
||||
app_cv_target_extension_cxxflags="-D__USE_MINGW_ANSI_STDIO=1 -DWINVER=0x0500"
|
||||
;;
|
||||
|
||||
mingw64)
|
||||
# Same as ming32, but enable "from xp" mode, since there's no x86_64 2k.
|
||||
app_cv_target_extension_cflags="-D__USE_MINGW_ANSI_STDIO=1 -DWINVER=0x0501"
|
||||
app_cv_target_extension_cxxflags="-D__USE_MINGW_ANSI_STDIO=1 -DWINVER=0x0501"
|
||||
;;
|
||||
|
||||
interix)
|
||||
# As per AC_USE_SYSTEM_EXTENSIONS.
|
||||
app_cv_target_extension_cflags="-D_ALL_SOURCE"
|
||||
app_cv_target_extension_cxxflags="-D_ALL_SOURCE"
|
||||
;;
|
||||
|
||||
esac
|
||||
@@ -28,29 +28,40 @@
|
||||
|
||||
AC_DEFUN([AX_CXX_GCC_ABI_DEMANGLE],
|
||||
[AC_CACHE_CHECK(whether the compiler supports GCC C++ ABI name demangling,
|
||||
ac_cv_cxx_gcc_abi_demangle,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <typeinfo>
|
||||
#include <cxxabi.h>
|
||||
#include <string>
|
||||
ac_cv_cxx_gcc_abi_demangle,
|
||||
[AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <typeinfo>
|
||||
#include <cxxabi.h>
|
||||
#include <string>
|
||||
#include <stdlib.h> /* not cstdlib */
|
||||
|
||||
template<typename TYPE>
|
||||
class A {};
|
||||
]], [[A<int> instance;
|
||||
int status = 0;
|
||||
char* c_name = 0;
|
||||
template<typename TYPE>
|
||||
class A {};
|
||||
]], [[
|
||||
A<int> instance;
|
||||
int status = 0;
|
||||
char* c_name = 0;
|
||||
|
||||
c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status);
|
||||
c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status);
|
||||
|
||||
std::string name(c_name);
|
||||
free(c_name);
|
||||
std::string name(c_name);
|
||||
free(c_name); /* not std::free() */
|
||||
|
||||
return name == "A<int>";
|
||||
]])],[ac_cv_cxx_gcc_abi_demangle=yes],[ac_cv_cxx_gcc_abi_demangle=no])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "$ac_cv_cxx_gcc_abi_demangle" = yes; then
|
||||
AC_DEFINE(HAVE_GCC_ABI_DEMANGLE,1,
|
||||
[define if the compiler supports GCC C++ ABI name demangling])
|
||||
fi
|
||||
return name == "A<int>";
|
||||
]])],
|
||||
[ac_cv_cxx_gcc_abi_demangle=yes], [ac_cv_cxx_gcc_abi_demangle=no])
|
||||
AC_LANG_POP([])
|
||||
])
|
||||
if test "$ac_cv_cxx_gcc_abi_demangle" = yes; then
|
||||
AC_DEFINE(HAVE_GCC_ABI_DEMANGLE, 1,
|
||||
[defined to 1 if the compiler supports GCC C++ ABI name demangling, 0 otherwise])
|
||||
else
|
||||
AC_DEFINE(HAVE_GCC_ABI_DEMANGLE, 0,
|
||||
[defined to 1 if the compiler supports GCC C++ ABI name demangling, 0 otherwise])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
AC_INIT([GSmartControl], 0.8.3, [], [gsmartcontrol])
|
||||
AC_INIT([GSmartControl],[0.8.5],[],[gsmartcontrol])
|
||||
|
||||
AC_CONFIG_SRCDIR([configure.ac])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
@@ -36,6 +36,9 @@ AC_CHECK_TOOL(WINDRES, windres)
|
||||
# Win32 external dll stripping (already detected by autoconf)
|
||||
# AC_CHECK_TOOL(STRIP, strip)
|
||||
|
||||
# Defines LN_S, needed for man page installation.
|
||||
AC_PROG_LN_S
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
@@ -61,7 +64,13 @@ APP_DETECT_OS_KERNEL([build], [CONFIG_HOST_KERNEL_])
|
||||
APP_COMPILER_OPTIONS([])
|
||||
|
||||
# Thread support for known configurations.
|
||||
APP_GET_MT_FLAGS([])
|
||||
# Sun compiler (at least on linux) has some runtime issues with stringstream
|
||||
# unless we use the thread flags. Also, Linux-based gdb fails to debug
|
||||
# a gcc-compiled binary for some reason.
|
||||
# Do this for all systems except mingw.
|
||||
if test "$app_cv_target_os_env" != "mingw32" && test "$app_cv_target_os_env" != "mingw64"; then
|
||||
APP_GET_MT_FLAGS([])
|
||||
fi
|
||||
|
||||
# Enable _GNU_SOURCE, etc...
|
||||
APP_USE_SYSTEM_EXTENSIONS([])
|
||||
@@ -105,7 +114,7 @@ AX_CXX_GCC_ABI_DEMANGLE
|
||||
AC_CXX_VERBOSE_TERMINATE_HANDLER
|
||||
|
||||
# detect __func__ support (defines HAVE_CXX___func__)
|
||||
APP_CXX___FUNC__
|
||||
APP_CXX___func__
|
||||
|
||||
# detect __FUNCTION__ support (defines HAVE_CXX___FUNCTION__)
|
||||
APP_CXX___FUNCTION__
|
||||
@@ -125,7 +134,8 @@ AC_CHECK_FUNCS([strtoll _strtoi64], [break])
|
||||
# but let's ignore it. Note: They may be supported by system libc,
|
||||
# but not enabled by default (e.g. by glibc feature macros). In that case,
|
||||
# defining them still leads to undefined symbols at link time, so we don't do it.
|
||||
# Header check is the best way to determine availability:
|
||||
# Header check is the best way to determine availability.
|
||||
# This defines HAVE_DECL_<symbol> to 1 or 0.
|
||||
AC_CHECK_DECLS([strtof, strtold], [], [], [[#include <stdlib.h>]])
|
||||
# link check only:
|
||||
# AC_CHECK_FUNCS([strtof strtold])
|
||||
@@ -166,15 +176,21 @@ AC_ARG_ENABLE(abort-if-no-gtkmm, AS_HELP_STRING([--disable-abort-if-no-gtkmm],
|
||||
AC_MSG_NOTICE([Abort if no gtkmm is found: $app_cv_abort_if_no_gtkmm])
|
||||
|
||||
# iconview is available since 2.6.0. gthread is not enabled by default.
|
||||
pkg_modules="gtkmm-2.4 >= 2.6.0 gthread-2.0 >= 2.0"
|
||||
pkg_modules="gtkmm-2.4 >= 2.6.0" # gthread-2.0 >= 2.0
|
||||
|
||||
# define ENABLE_GLIB and friends if it's found.
|
||||
gtkmm_found="no"
|
||||
|
||||
PKG_CHECK_MODULES([GTKMM], [$pkg_modules], [
|
||||
AC_DEFINE([ENABLE_GLIB], [1], [Whether GLib is installed])
|
||||
AC_DEFINE([ENABLE_GLIBMM], [1], [Whether GLibmm is installed])
|
||||
gtkmm_found="yes"], [gtkmm_found="no"])
|
||||
PKG_CHECK_MODULES([GTKMM], [$pkg_modules],
|
||||
[gtkmm_found="yes"], [gtkmm_found="no"])
|
||||
|
||||
if test "x$gtkmm_found" = "xyes"; then
|
||||
AC_DEFINE([ENABLE_GLIB], [1], [Defined to 1 if GLib is installed, 0 otherwise])
|
||||
AC_DEFINE([ENABLE_GLIBMM], [1], [Defined to 1 if glibmm is installed, 0 otherwise])
|
||||
else
|
||||
AC_DEFINE([ENABLE_GLIB], [0], [Defined to 1 if GLib is installed, 0 otherwise])
|
||||
AC_DEFINE([ENABLE_GLIBMM], [0], [Defined to 1 if glibmm is installed, 0 otherwise])
|
||||
fi
|
||||
|
||||
if test "x$gtkmm_found" = "xno"; then
|
||||
if test "x$app_cv_abort_if_no_gtkmm" = "xno"; then
|
||||
@@ -265,9 +281,9 @@ AC_ARG_ENABLE([nsis-wine], [AS_HELP_STRING([--enable-nsis-wine=yes|no|auto],
|
||||
[use wine to run makensis.exe when making NSIS packages (default: auto, which is no for windows, yes for others)])],
|
||||
[with_nsis_wine=${enableval}], [with_nsis_wine=yes])
|
||||
|
||||
AC_ARG_WITH([windows-dlls], [AS_HELP_STRING([--with-windows-dlls],
|
||||
[specify location of Windows dlls when making Windows packages (default: /target/bin)])],
|
||||
[with_windows_env=${withval}], [win_windows_dlls=auto])
|
||||
AC_ARG_WITH([windows-bindir], [AS_HELP_STRING([--with-windows-bindir],
|
||||
[specify location of Windows dlls and executables when making Windows packages (default: /cross/w32/target/bin)])],
|
||||
[with_windows_bindir=${withval}], [with_windows_bindir=auto])
|
||||
|
||||
if test "x$with_nsis" = "xauto" || test "x$with_nsis" = "x"; then
|
||||
if test "x$app_cv_build_os_kernel" = "xwindows"; then
|
||||
@@ -290,13 +306,13 @@ if test "x$with_nsis_wine" != "xno"; then
|
||||
NSIS_EXEC="wine $with_nsis";
|
||||
fi
|
||||
|
||||
if test "x$with_windows_dlls" = "xauto" || test "x$with_windows_dlls" = "x"; then
|
||||
with_windows_dlls="/target/bin"
|
||||
if test "x$with_windows_bindir" = "xauto" || test "x$with_windows_bindir" = "x"; then
|
||||
with_windows_bindir="/cross/w32/target/bin"
|
||||
fi
|
||||
WINDOWS_DLLS_LOCATION="$with_windows_dlls";
|
||||
WINDOWS_BINDIR="$with_windows_bindir";
|
||||
|
||||
AC_SUBST(NSIS_EXEC)
|
||||
AC_SUBST(WINDOWS_DLLS_LOCATION)
|
||||
AC_SUBST(WINDOWS_BINDIR)
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
@@ -404,7 +420,8 @@ CXXFLAGS="$CXXFLAGS $ADDITIONAL_FLAGS"
|
||||
# Add pcrecpp too, because its files use #<file> on each other.
|
||||
ADDITIONAL_INCLUDES="-I\$(top_builddir) -I\$(top_srcdir)/src -I\$(top_srcdir)/src/pcrecpp"
|
||||
|
||||
# -include works with gcc, intel and pathscale, but doesn't work with sun and pgi.
|
||||
# -include works with gcc, intel, pathscale and sunstudio since 12u1, but doesn't work
|
||||
# with pgi and older sunstudio (the one in solaris10, for example).
|
||||
# Note: some gcc-frontend-based compilers may have to be added here
|
||||
# (e.g. gccfss (gcc frontend / sun backend), etc...).
|
||||
if test "$ax_cv_cxx_compiler_vendor" = "gnu" || test "$ax_cv_cxx_compiler_vendor" = "intel" \
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_whatever.txt file
|
||||
############################################################################
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_whatever.txt file
|
||||
############################################################################
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
@@ -1,12 +1,23 @@
|
||||
|
||||
SUBDIRS = 16 22 24 32 48 64 128 256 nsis
|
||||
|
||||
|
||||
dist_man_MANS = gsmartcontrol.1
|
||||
|
||||
install-extra-mans:
|
||||
cd $(DESTDIR)$(mandir)/man1 && $(LN_S) -f gsmartcontrol.1 gsmartcontrol-root.1
|
||||
|
||||
uninstall-extra-mans:
|
||||
cd $(DESTDIR)$(mandir)/man1 && rm -f gsmartcontrol-root.1
|
||||
|
||||
|
||||
# This command is needed if installing with make install (the cache
|
||||
# file is ignored for rpms).
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
|
||||
install-data-hook: update-icon-cache
|
||||
uninstall-hook: update-icon-cache
|
||||
install-data-hook: install-extra-mans update-icon-cache
|
||||
uninstall-hook: uninstall-extra-mans update-icon-cache
|
||||
|
||||
update-icon-cache:
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating GTK icon cache."; \
|
||||
@@ -0,0 +1,74 @@
|
||||
.TH GSmartControl "1" "" "gsmartcontrol " "User Commands"
|
||||
.SH NAME
|
||||
GSmartControl \- Hard disk drive health inspection tool
|
||||
.SH SYNOPSIS
|
||||
\fBgsmartcontrol\fP [OPTIONS]
|
||||
|
||||
\fBgsmartcontrol\-root\fP [\fI<desktop>\fP [OPTIONS]]
|
||||
.SH DESCRIPTION
|
||||
\fBGSmartControl\fP is a graphical user interface for smartctl (from
|
||||
smartmontools), which is a tool for querying and controlling SMART
|
||||
(Self-Monitoring, Analysis, and Reporting Technology) data on modern hard disk
|
||||
drives. It allows you to inspect the drive's SMART data to determine its
|
||||
health, as well as run various tests on it.
|
||||
.PP
|
||||
This manual page documents briefly the \fBgsmartcontrol\fP and
|
||||
\fBgsmartcontrol\-root\fP commands.
|
||||
.PP
|
||||
\fBgsmartcontrol\-root\fP command launches \fBgsmartcontrol\fP with
|
||||
administrative privileges. The \fIdesktop\fP argument specifies which desktop
|
||||
is currently running, for automatic selection of native su mechanism. Valid
|
||||
values for \fIdesktop\fP are \fBauto\fP, \fBkde\fP, \fBgnome\fP, \fBother\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
.SS "Help Options:"
|
||||
.TP
|
||||
\fB\-?\fP, \fB\-\-help\fP
|
||||
Show help options
|
||||
.TP
|
||||
\fB\-\-help\-all\fP
|
||||
Show all help options
|
||||
.TP
|
||||
\fB\-\-help\-gtk\fP
|
||||
Show GTK+ options
|
||||
.TP
|
||||
\fB\-\-help\-debug\fR
|
||||
Show logging options
|
||||
.SS "Application Options:"
|
||||
.TP
|
||||
\fB\-l\fP, \fB\-\-no\-locale\fP
|
||||
Disable locale
|
||||
.TP
|
||||
\fB\-V\fP, \fB\-\-version\fP
|
||||
Display version information
|
||||
.TP
|
||||
\fB\-\-no\-scan\fP
|
||||
Don't scan devices on startup
|
||||
.TP
|
||||
\fB\-\-no\-hide\-tabs\fP
|
||||
Don't hide non\-identity tabs when SMART is disabled. Useful for debugging.
|
||||
.TP
|
||||
\fB\-\-add\-virtual\fP
|
||||
Load smartctl data from file, creating a virtual drive
|
||||
.TP
|
||||
\fB\-\-add\-device\fP
|
||||
Add this device to device list. Useful with \fB\-\-no\-scan\fP to list certain drives only.
|
||||
.TP
|
||||
\fB\-\-display\fP=\fIDISPLAY\fP
|
||||
X display to use
|
||||
.TP
|
||||
\fB\-v\fP, \fB\-\-verbose\fP
|
||||
Enable verbose logging; same as \fB\-\-verbosity\-level\fP 5
|
||||
.TP
|
||||
\fB\-q\fP, \fB\-\-quiet\fP
|
||||
Disable logging; same as \fB\-\-verbosity\-level\fP 0
|
||||
.TP
|
||||
\fB\-b\fP, \fB\-\-verbosity\-level\fP
|
||||
Set verbosity level [0\-5]
|
||||
.PP
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2008 \- 2009 Alexander Shaduri <ashaduri \'at\' gmail.com>
|
||||
.PP
|
||||
.SH AUTHOR
|
||||
This manual page was originally written by Giuseppe Iuculano
|
||||
<giuseppe@iuculano.it>, for the Debian project.
|
||||
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
@@ -17,12 +17,13 @@ This distribution includes:
|
||||
|
||||
* GSmartControl binary (gsmartcontrol.exe) and associated resources. The
|
||||
binary was compiled for 32-bit Windows, and should work on both 32-bit and
|
||||
64-bit Windows.
|
||||
64-bit Windows. The binary was statically compiled against Gtkmm
|
||||
(http://www.gtkmm.org/) and related libraries, and PCRE (http://www.pcre.org/).
|
||||
|
||||
* Gtkmm (http://www.gtkmm.org/) dlls.
|
||||
* Smartctl binaries (from smartmontools 5.39-0-20090826-r2878,
|
||||
http://smartmontools.sf.net/) - smartctl-nc.exe (compiled without console
|
||||
output), smartctl.exe (compiled with console output).
|
||||
|
||||
* PCRE (http://www.pcre.org/) dll.
|
||||
|
||||
* Smartctl binaries - smartctl.exe (compiled without console output),
|
||||
smartctl_console.exe (compiled with console output), version 5.38.
|
||||
http://smartmontools.sf.net/ .
|
||||
The combined distribution is multi-licensed under GNU GPL versions 2 and 3.
|
||||
See LICENSE_gpl2.txt and LICENSE_gpl3.txt for details.
|
||||
@@ -177,7 +177,7 @@ FunctionEnd
|
||||
|
||||
|
||||
|
||||
; ----------------- INSTALLATINO TYPES
|
||||
; ----------------- INSTALLATION TYPES
|
||||
|
||||
; InstType "Recommended"
|
||||
InstType "Full"
|
||||
@@ -199,9 +199,9 @@ SectionIn 1
|
||||
File gsmartcontrol.exe
|
||||
File gsmartcontrol.ico
|
||||
File icon_*.png
|
||||
File *.dll
|
||||
; File *.dll
|
||||
File smartctl-nc.exe
|
||||
File smartctl.exe
|
||||
File smartctl_console.exe
|
||||
|
||||
File /r doc
|
||||
|
||||
@@ -271,9 +271,9 @@ Section Uninstall
|
||||
Delete "$INSTDIR\gsmartcontrol.exe"
|
||||
Delete "$INSTDIR\gsmartcontrol.ico"
|
||||
Delete "$INSTDIR\icon_*.png"
|
||||
Delete "$INSTDIR\*.dll"
|
||||
; Delete "$INSTDIR\*.dll"
|
||||
Delete "$INSTDIR\smartctl-nc.exe"
|
||||
Delete "$INSTDIR\smartctl.exe"
|
||||
Delete "$INSTDIR\smartctl_console.exe"
|
||||
|
||||
RMDir /r "$INSTDIR\doc"
|
||||
|
||||
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
@@ -15,8 +15,7 @@ Architecture: any
|
||||
Depends: ${shlibs:Depends}, smartmontools
|
||||
Description: Hard disk drive health inspection tool
|
||||
GSmartControl is a graphical user interface for smartctl (from smartmontools
|
||||
package, see http://smartmontools.sourceforge.net), which is a tool for
|
||||
querying and controlling SMART (Self-Monitoring, Analysis, and Reporting
|
||||
Technology) data on modern hard disk drives. It allows you to inspect the
|
||||
drive's SMART data to determine its health, as well as run various tests on
|
||||
it.
|
||||
package), which is a tool for querying and controlling SMART
|
||||
(Self-Monitoring, Analysis, and Reporting Technology) data on modern hard
|
||||
disk drives. It allows you to inspect the drive's SMART data to determine its
|
||||
health, as well as run various tests on it.
|
||||
@@ -5,7 +5,7 @@ It was downloaded from <http://gsmartcontrol.berlios.de/>
|
||||
|
||||
Copyright:
|
||||
|
||||
Copyright (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
Copyright (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
|
||||
License:
|
||||
|
||||
@@ -27,6 +27,6 @@ On Debian systems, the complete text of the GNU General
|
||||
Public Licenses can be found in `/usr/share/common-licenses/GPL-2' and
|
||||
`/usr/share/common-licenses/GPL-3'.
|
||||
|
||||
The Debian packaging is (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com> and
|
||||
The Debian packaging is (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com> and
|
||||
is licensed under the GPLv2 and GPLv3, see above.
|
||||
|
||||
@@ -25,8 +25,12 @@ endif
|
||||
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
|
||||
cp -f /usr/share/misc/config.guess config.guess
|
||||
endif
|
||||
./configure --enable-optimize-options=auto --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
|
||||
./configure --host=$(DEB_HOST_GNU_TYPE) \
|
||||
--build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man \
|
||||
--infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
|
||||
|
||||
# Add --enable-optimize-options=auto to configure line
|
||||
# for optimized build (may not work on older gcc versions).
|
||||
|
||||
build: build-stamp
|
||||
|
||||
@@ -42,7 +46,7 @@ build-stamp: config.status
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp
|
||||
rm -f build-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
@@ -72,7 +76,7 @@ binary-arch: build install
|
||||
# dh_installexamples
|
||||
# dh_install
|
||||
dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
@@ -81,7 +85,7 @@ binary-arch: build install
|
||||
# dh_installinit
|
||||
# dh_installcron
|
||||
# dh_installinfo
|
||||
# dh_installman
|
||||
dh_installman
|
||||
dh_link
|
||||
dh_strip
|
||||
dh_compress
|
||||
@@ -95,4 +99,4 @@ binary-arch: build install
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
############################################################################
|
||||
# Copyright:
|
||||
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
# License: See LICENSE_zlib.txt file
|
||||
############################################################################
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
<projectname>gsmartcontrol</projectname>
|
||||
<projectdirectory>.</projectdirectory>
|
||||
<absoluteprojectpath>false</absoluteprojectpath>
|
||||
<description/>
|
||||
<defaultencoding/>
|
||||
<description></description>
|
||||
<defaultencoding></defaultencoding>
|
||||
<versioncontrol/>
|
||||
</general>
|
||||
<kdevautoproject>
|
||||
<general>
|
||||
<activetarget>src/gsmartcontrol</activetarget>
|
||||
<useconfiguration>win32</useconfiguration>
|
||||
<useconfiguration>suncc</useconfiguration>
|
||||
</general>
|
||||
<run>
|
||||
<mainprogram>/10/devel/projects/gsmartcontrol/current/gsmartcontrol/debuggy</mainprogram>
|
||||
@@ -76,21 +76,21 @@
|
||||
<f77flags/>
|
||||
</optimized>
|
||||
<debuggy>
|
||||
<configargs>--disable-user-flags --enable-debug-options --enable-tests</configargs>
|
||||
<configargs>--enable-debug-options --enable-tests</configargs>
|
||||
<builddir>debuggy</builddir>
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<cflags/>
|
||||
<cxxflags/>
|
||||
<cflags></cflags>
|
||||
<cxxflags></cxxflags>
|
||||
<envvars/>
|
||||
<topsourcedir/>
|
||||
<cppflags/>
|
||||
<ldflags/>
|
||||
<ccompilerbinary/>
|
||||
<cxxcompilerbinary/>
|
||||
<f77compilerbinary/>
|
||||
<f77flags/>
|
||||
<topsourcedir></topsourcedir>
|
||||
<cppflags></cppflags>
|
||||
<ldflags></ldflags>
|
||||
<ccompilerbinary>gcc-4.4</ccompilerbinary>
|
||||
<cxxcompilerbinary>g++-4.4</cxxcompilerbinary>
|
||||
<f77compilerbinary></f77compilerbinary>
|
||||
<f77flags></f77flags>
|
||||
</debuggy>
|
||||
<icc>
|
||||
<envvars/>
|
||||
@@ -102,8 +102,8 @@
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<ccompilerbinary>icc</ccompilerbinary>
|
||||
<cxxcompilerbinary>icpc</cxxcompilerbinary>
|
||||
<ccompilerbinary>icc64</ccompilerbinary>
|
||||
<cxxcompilerbinary>icpc64</cxxcompilerbinary>
|
||||
<f77compilerbinary/>
|
||||
<cflags/>
|
||||
<cxxflags/>
|
||||
@@ -111,7 +111,7 @@
|
||||
</icc>
|
||||
<win32>
|
||||
<envvars/>
|
||||
<configargs>--disable-user-flags --enable-optimize-options --enable-tests --target=i386-mingw32 --host=i386-mingw32 --build=i686-linux PKG_CONFIG_PATH=/target/lib/pkgconfig PKG_CONFIG_LIBDIR=/target/lib PATH="/opt/cross-tools/bin:/target/bin:$PATH"</configargs>
|
||||
<configargs>--disable-user-flags --enable-optimize-options --enable-tests --build=i686-linux --host=i386-pc-mingw32 PKG_CONFIG_PATH=/cross/w32/target/lib/pkgconfig PKG_CONFIG_LIBDIR="" PATH="/cross/w32/gcc-bin:/cross/w32/target/bin:$PATH"</configargs>
|
||||
<builddir>win32</builddir>
|
||||
<topsourcedir/>
|
||||
<cppflags/>
|
||||
@@ -119,8 +119,8 @@
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<ccompilerbinary>i386-mingw32-gcc</ccompilerbinary>
|
||||
<cxxcompilerbinary>i386-mingw32-g++</cxxcompilerbinary>
|
||||
<ccompilerbinary>i386-pc-mingw32-gcc</ccompilerbinary>
|
||||
<cxxcompilerbinary>i386-pc-mingw32-g++</cxxcompilerbinary>
|
||||
<f77compilerbinary/>
|
||||
<cflags/>
|
||||
<cxxflags/>
|
||||
@@ -128,21 +128,21 @@
|
||||
</win32>
|
||||
<suncc>
|
||||
<envvars>
|
||||
<envvar value="/opt/sun/sunstudio12/bin:$PATH" name="PATH" />
|
||||
<envvar value="/opt/sun/sunstudio/bin:$PATH" name="PATH" />
|
||||
</envvars>
|
||||
<configargs>--enable-tests</configargs>
|
||||
<configargs>--enable-tests PKG_CONFIG_PATH="/opt/sun/target64/lib64/pkgconfig:/usr/lib64/pkgconfig" PKG_CONFIG_LIBDIR=""</configargs>
|
||||
<builddir>suncc</builddir>
|
||||
<topsourcedir/>
|
||||
<cppflags/>
|
||||
<ldflags>-s</ldflags>
|
||||
<ldflags>-R/opt/sun/target64/lib64 -L/opt/sun/target64/lib64</ldflags>
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<ccompilerbinary>suncc</ccompilerbinary>
|
||||
<cxxcompilerbinary>sunCC</cxxcompilerbinary>
|
||||
<f77compilerbinary/>
|
||||
<cflags>-errwarn=%all</cflags>
|
||||
<cxxflags>-DGLIBMM_HAVE_SUN_REVERSE_ITERATOR -DSIGC_HAVE_SUN_REVERSE_ITERATOR</cxxflags>
|
||||
<cflags>-errwarn=%all -I/opt/sun/target64/include</cflags>
|
||||
<cxxflags>-I/opt/sun/target64/include</cxxflags>
|
||||
<f77flags/>
|
||||
</suncc>
|
||||
<portland>
|
||||
@@ -164,7 +164,7 @@
|
||||
</portland>
|
||||
<win32-debug>
|
||||
<envvars/>
|
||||
<configargs>--disable-user-flags --enable-debug-options --enable-tests --target=i386-mingw32 --host=i386-mingw32 --build=i686-linux PKG_CONFIG_PATH=/target/lib/pkgconfig PKG_CONFIG_LIBDIR=/target/lib PATH="/opt/cross-tools/bin:/target/bin:$PATH"</configargs>
|
||||
<configargs>--disable-user-flags --enable-debug-options --enable-tests --build=i686-linux --host=i386-pc-mingw32 PKG_CONFIG_PATH=/cross/w32/target/lib/pkgconfig PKG_CONFIG_LIBDIR="" PATH="/cross/w32/gcc-bin:/cross/w32/target/bin:$PATH"</configargs>
|
||||
<builddir>win32-debug</builddir>
|
||||
<topsourcedir/>
|
||||
<cppflags/>
|
||||
@@ -172,13 +172,30 @@
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<ccompilerbinary>i386-mingw32-gcc</ccompilerbinary>
|
||||
<cxxcompilerbinary>i386-mingw32-g++</cxxcompilerbinary>
|
||||
<ccompilerbinary>i386-pc-mingw32-gcc</ccompilerbinary>
|
||||
<cxxcompilerbinary>i386-pc-mingw32-g++</cxxcompilerbinary>
|
||||
<f77compilerbinary/>
|
||||
<cflags/>
|
||||
<cxxflags/>
|
||||
<f77flags/>
|
||||
</win32-debug>
|
||||
<win64-debug>
|
||||
<envvars/>
|
||||
<configargs>--disable-user-flags --enable-optimize-options --enable-tests --build=i686-linux --host=x86_64-pc-mingw32 PKG_CONFIG_PATH=/cross/w64/target/lib/pkgconfig PKG_CONFIG_LIBDIR="" PATH="/cross/w64/gcc-bin:/cross/w64/target/bin:$PATH"</configargs>
|
||||
<builddir>win64-debug</builddir>
|
||||
<topsourcedir/>
|
||||
<cppflags/>
|
||||
<ldflags/>
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
<f77compiler>kdevg77options</f77compiler>
|
||||
<ccompilerbinary>x86_64-pc-mingw32-gcc</ccompilerbinary>
|
||||
<cxxcompilerbinary>x86_64-pc-mingw32-g++</cxxcompilerbinary>
|
||||
<f77compilerbinary/>
|
||||
<cflags/>
|
||||
<cxxflags/>
|
||||
<f77flags/>
|
||||
</win64-debug>
|
||||
</configurations>
|
||||
<make>
|
||||
<envvars>
|
||||
@@ -254,11 +271,11 @@
|
||||
</kdevdoctreeview>
|
||||
<kdevdebugger>
|
||||
<general>
|
||||
<dbgshell/>
|
||||
<gdbpath/>
|
||||
<configGdbScript/>
|
||||
<runShellScript/>
|
||||
<runGdbScript/>
|
||||
<dbgshell></dbgshell>
|
||||
<gdbpath></gdbpath>
|
||||
<configGdbScript></configGdbScript>
|
||||
<runShellScript></runShellScript>
|
||||
<runGdbScript></runGdbScript>
|
||||
<breakonloadinglibs>true</breakonloadinglibs>
|
||||
<separatetty>false</separatetty>
|
||||
<floatingtoolbar>false</floatingtoolbar>
|
||||
@@ -1,5 +1,5 @@
|
||||
Name: gsmartcontrol
|
||||
Version: @VERSION@
|
||||
Version: @VERSION@
|
||||
Release: 1as
|
||||
License: GPLv2, GPLv3
|
||||
Url: http://gsmartcontrol.berlios.de
|
||||
@@ -38,8 +38,13 @@ Group: Hardware/Other
|
||||
Requires: smartmontools, pcre, gtkmm2 >= 2.12.0
|
||||
BuildRequires: gcc-c++, libstdc++-devel, pcre-devel, gtkmm2-devel >= 2.12.0
|
||||
%else
|
||||
%if 0%{?%suse_version} == 1020
|
||||
Requires: smartmontools, pcre, gtkmm2 >= 2.6.0, libglademm >= 2.4.0
|
||||
BuildRequires: gcc-c++, libstdc++-devel, pcre-devel, gtkmm2-devel >= 2.6.0, libglademm-devel >= 2.4.0
|
||||
%else
|
||||
Requires: smartmontools, pcre, gtkmm24 >= 2.6.0, libglademm >= 2.4.0
|
||||
BuildRequires: gcc-c++, libstdc++-devel, pcre-devel, gtkmm24-devel >= 2.6.0, libglademm-devel >= 2.4.0
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%endif
|
||||
@@ -85,8 +90,11 @@ SMART data to determine its health, as well as run various tests on it.
|
||||
|
||||
|
||||
%setup -q
|
||||
%if 0%{?mandriva_version} <= 2006
|
||||
%configure
|
||||
%else
|
||||
%configure --enable-optimize-options=auto
|
||||
|
||||
%endif
|
||||
|
||||
%build
|
||||
# Set up for parallel builds
|
||||
@@ -126,6 +134,7 @@ rm -rf %buildroot
|
||||
# %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/*
|
||||
|
||||
%doc %{_datadir}/doc/gsmartcontrol
|
||||
%doc %{_mandir}/man1/*
|
||||
|
||||
%{_datadir}/gsmartcontrol
|
||||
# %{_datadir}/gsmartcontrol/*
|
||||
@@ -145,4 +154,3 @@ rm -rf %buildroot
|
||||
|
||||
* Mon Sep 15 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
- Initial .spec file.
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_zlib.txt file
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HZ_ENV_TOOLS_H
|
||||
#define HZ_ENV_TOOLS_H
|
||||
|
||||
#include "hz_config.h" // feature macros
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
// Note: This file needs glib to work on Windows.
|
||||
|
||||
// Don't check it explicitly - maybe they are provided by a third-party
|
||||
// library.
|
||||
// #if defined _WIN32 && !defined ENABLE_GLIB
|
||||
// #error "env_tools.h needs Glib on Windows!"
|
||||
// #endif
|
||||
|
||||
#if defined ENABLE_GLIB
|
||||
#include <glib.h>
|
||||
#else
|
||||
#include <cstdlib> // std::getenv
|
||||
#include <stdlib.h> // setenv, unsetenv
|
||||
// setenv(), unsetenv(): _BSD_SOURCE || _POSIX_C_SOURCE >= 200112L ||
|
||||
// _XOPEN_SOURCE >= 600
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace hz {
|
||||
|
||||
|
||||
|
||||
bool env_get_value(const std::string& name, std::string& value)
|
||||
{
|
||||
const char* v = 0;
|
||||
#ifdef ENABLE_GLIB
|
||||
v = g_getenv(name.c_str());
|
||||
#else
|
||||
v = std::getenv(name.c_str());
|
||||
#endif
|
||||
if (!v)
|
||||
return false;
|
||||
|
||||
value = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool env_set_value(const std::string& name, const std::string& value, bool overwrite = true)
|
||||
{
|
||||
#ifdef ENABLE_GLIB
|
||||
return g_setenv(name.c_str(), value.c_str(), overwrite) != 0;
|
||||
#else
|
||||
// setenv returns -1 if there's insufficient space in environment
|
||||
// or it's an invalid name (EINVAL errno is set).
|
||||
return setenv(name.c_str(), value.c_str(), overwrite) == 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool env_unset_value(const std::string& name)
|
||||
{
|
||||
#ifdef ENABLE_GLIB
|
||||
g_unsetenv(name.c_str()); // returns void. may not be thread-safe!
|
||||
return true;
|
||||
#else
|
||||
// unsetenv returns -1 on error with errno EINVAL set (invalid char in name).
|
||||
return unsetenv(name.c_str()) == 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Temporarily change a value of an environment variable.
|
||||
|
||||
class ScopedEnv {
|
||||
|
||||
public:
|
||||
|
||||
// change environment variable value.
|
||||
ScopedEnv(const std::string& name, const std::string& value, bool do_change = true, bool overwrite = true)
|
||||
: name_(name), do_change_(do_change), old_set_(false), error_(false)
|
||||
{
|
||||
if (do_change_) {
|
||||
old_set_ = env_get_value(name_, old_value_);
|
||||
if (old_set_ && !overwrite) {
|
||||
do_change_ = false;
|
||||
} else {
|
||||
error_ = !env_set_value(name_, value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// change back
|
||||
~ScopedEnv()
|
||||
{
|
||||
if (do_change_) {
|
||||
if (old_set_) {
|
||||
env_set_value(name_, old_value_, true);
|
||||
} else {
|
||||
env_unset_value(name_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool bad() const
|
||||
{
|
||||
return error_;
|
||||
}
|
||||
|
||||
|
||||
// check if the old value was set
|
||||
bool get_old_set() const
|
||||
{
|
||||
return old_set_;
|
||||
}
|
||||
|
||||
// get old value
|
||||
std::string get_old_value() const
|
||||
{
|
||||
return old_value_;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
std::string old_value_;
|
||||
bool do_change_;
|
||||
bool old_set_;
|
||||
bool error_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // ns
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,129 +0,0 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_zlib.txt file
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HZ_ERRNO_STRING_H
|
||||
#define HZ_ERRNO_STRING_H
|
||||
|
||||
#include "hz_config.h" // feature macros
|
||||
|
||||
#include <string>
|
||||
|
||||
#if defined ENABLE_GLIB
|
||||
#include <glib.h> // g_strerror(), g_strsignal()
|
||||
|
||||
#else
|
||||
#include <cstdio> // std::snprintf
|
||||
|
||||
// glibc has two versions of strerror_r:
|
||||
// GNU (may or may not use buf):
|
||||
// char *strerror_r(int errnum, char *buf, size_t buflen);
|
||||
// XSI (posix) (returns 0 on success):
|
||||
// int strerror_r(int errnum, char *buf, size_t buflen);
|
||||
|
||||
#if ((defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 200112L) \
|
||||
|| (defined _XOPEN_SOURCE && _XOPEN_SOURCE >= 600)) && !defined _GNU_SOURCE
|
||||
#define HAVE_XSI_STRERROR_R
|
||||
#include <string.h> // strerror_r
|
||||
#include <cerrno> // errno
|
||||
|
||||
#elif defined _GNU_SOURCE
|
||||
#define HAVE_GNU_STRERROR_R
|
||||
#include <string.h> // strerror_r
|
||||
|
||||
#else
|
||||
#include <cstring> // std::strerror
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Compilation options:
|
||||
// - Define ENABLE_GLIB to enable glib-related code (portable errno messages)
|
||||
|
||||
|
||||
|
||||
namespace hz {
|
||||
|
||||
|
||||
// Note: This function may return messages in native language,
|
||||
// possibly using LC_MESSAGES to select the language.
|
||||
// If Glib is enabled, it returns messages in UTF-8 format.
|
||||
|
||||
// portable strerror() version for std::string.
|
||||
inline std::string errno_string(int errno_value);
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------ Implementation
|
||||
|
||||
|
||||
|
||||
// Portable strerror() implementation
|
||||
inline std::string errno_string(int errno_value)
|
||||
{
|
||||
std::string msg;
|
||||
|
||||
#if defined ENABLE_GLIB
|
||||
|
||||
msg = g_strerror(errno_value); // no need to free. won't return 0. message is in utf8.
|
||||
|
||||
#else
|
||||
|
||||
char buf[128] = {0};
|
||||
|
||||
#if defined HAVE_XSI_STRERROR_R
|
||||
if (strerror_r(errno_value, buf, 128) == 0 && *buf) { // always writes terminating 0 in those 128.
|
||||
msg = buf;
|
||||
} else { // errno is set on error
|
||||
if (errno == EINVAL) {
|
||||
std::snprintf(buf, 128, "Unknown errno: %d.", errno_value);
|
||||
msg = buf;
|
||||
} else if (errno == ERANGE) {
|
||||
std::snprintf(buf, 128, "Insufficient buffer to store description for errno: %d.", errno_value);
|
||||
msg = buf;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined HAVE_GNU_STRERROR_R
|
||||
const char* rmsg = strerror_r(errno_value, buf, 128);
|
||||
if (rmsg) {
|
||||
msg = rmsg;
|
||||
} else {
|
||||
std::snprintf(buf, 128, "Error while getting description for errno: %d.", errno_value);
|
||||
msg = buf;
|
||||
}
|
||||
|
||||
#else // win32 and non-gnu/posix systems.
|
||||
// use strerror(). win32 has thread-safe strerror (I think).
|
||||
|
||||
const char* m = std::strerror(errno_value); // no need to free.
|
||||
if (m) {
|
||||
msg = m;
|
||||
} else {
|
||||
std::snprintf(buf, 128, "Error while getting description for errno: %d.", errno_value);
|
||||
msg = buf;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // ns
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,114 +0,0 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_zlib.txt file
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HZ_FS_TOOLS_H
|
||||
#define HZ_FS_TOOLS_H
|
||||
|
||||
#include "hz_config.h" // feature macros
|
||||
|
||||
#include <string>
|
||||
#include <cstdlib> // std::getenv(), std::size_t
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h> // getcwd, chdir
|
||||
#else
|
||||
#include <unistd.h> // getcwd, chdir
|
||||
#endif
|
||||
|
||||
#include "win32_tools.h" // registry stuff
|
||||
|
||||
|
||||
// Filesystem utilities
|
||||
|
||||
|
||||
namespace hz {
|
||||
|
||||
|
||||
|
||||
// Get the current user's home directory (in native fs encoding).
|
||||
// Return an empty string if not found.
|
||||
inline std::string get_home_dir()
|
||||
{
|
||||
// Do NOT use g_get_home_dir, it doesn't work consistently in win32
|
||||
// between glib versions.
|
||||
|
||||
#ifdef _WIN32
|
||||
std::string dir;
|
||||
win32_get_registry_value_string(dir, HKEY_CURRENT_USER,
|
||||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Personal");
|
||||
|
||||
if (dir.empty()) {
|
||||
win32_get_registry_value_string(dir, HKEY_CURRENT_USER,
|
||||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "User");
|
||||
}
|
||||
|
||||
#else // linux, etc...
|
||||
const char* e = std::getenv("HOME"); // works well enough
|
||||
std::string dir = (e ? e : "");
|
||||
|
||||
#endif
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get current working directory
|
||||
inline std::string get_current_dir()
|
||||
{
|
||||
std::size_t buf_size = 1024;
|
||||
char* buf = new char[buf_size];
|
||||
|
||||
while (getcwd(buf, buf_size) == NULL) {
|
||||
delete[] buf;
|
||||
buf = new char[buf_size *= 2];
|
||||
}
|
||||
|
||||
std::string dir = (buf ? buf : "");
|
||||
delete[] buf;
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Change current directory.
|
||||
inline bool set_current_dir(const std::string& dir)
|
||||
{
|
||||
return (chdir(dir.c_str()) == 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get temporary directory of a system (can be user-specific)
|
||||
inline std::string get_tmp_dir()
|
||||
{
|
||||
// FIXME: I'm not sure about the encoding used in win32.
|
||||
// Is it fs encoding or some kind of locale, etc...?
|
||||
const char* e = std::getenv("TMPDIR");
|
||||
if (!e)
|
||||
e = std::getenv("TMP");
|
||||
if (!e)
|
||||
e = std::getenv("TEMP");
|
||||
|
||||
#ifndef _WIN32
|
||||
if (!e)
|
||||
e = "/tmp";
|
||||
#endif
|
||||
|
||||
return std::string(e ? e : "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // ns hz
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,55 +0,0 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_zlib.txt file
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HZ_HZ_CONFIG_H
|
||||
#define HZ_HZ_CONFIG_H
|
||||
|
||||
// This file is included from all hz headers.
|
||||
|
||||
// You should include this file if you're using any of:
|
||||
// macros from autoconf-generated config.h
|
||||
// macros from global_macros.h
|
||||
// This file has effect only if "-include" compiler option doesn't work.
|
||||
|
||||
// The purpose of this file is to provide some common compatibility
|
||||
// solutions for the whole hz, while not depending on "-include"
|
||||
// compiler switches or pasting autoconf's config.h code in all files.
|
||||
|
||||
|
||||
// Define HZ_NO_COMPILER_AUTOINCLUDE from a compiler option to enable
|
||||
// auto-inclusion of global_macros.h.
|
||||
|
||||
|
||||
#ifndef APP_GLOBAL_MACROS_INCLUDED // defined in global_macros.h
|
||||
#ifdef HZ_NO_COMPILER_AUTOINCLUDE // define manually
|
||||
#include "global_macros.h"
|
||||
#else
|
||||
#define HZ_NO_GLOBAL_MACROS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// if there was no global_macros.h included, do our own mini version
|
||||
#ifdef HZ_NO_GLOBAL_MACROS
|
||||
|
||||
// Autoconf's config.h. The macro is defined by ./configure automatically.
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
// No assumptions on config.h contents - it may not do any of these
|
||||
// checks, so don't rely on them. You should use global_macros.h instead,
|
||||
// or manually define them.
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,143 +0,0 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_zlib.txt file
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HZ_STRING_SPRINTF_H
|
||||
#define HZ_STRING_SPRINTF_H
|
||||
|
||||
#include "hz_config.h" // feature macros
|
||||
|
||||
#include <string>
|
||||
#include <stdarg.h> // va_start, va_list macro and friends; vsnprintf() (C99, various other extensions)
|
||||
|
||||
|
||||
// Define ENABLE_GLIB to enable glib string functions (more portable?).
|
||||
|
||||
#if defined ENABLE_GLIB
|
||||
# include <glib.h> // g_strdup_vprintf(), g_printf_string_upper_bound()
|
||||
#elif defined _GNU_SOURCE
|
||||
# include <stdio.h> // vasprintf() (GNU extension)
|
||||
# include <stdlib.h> // free()
|
||||
#endif
|
||||
|
||||
#include "system_specific.h"
|
||||
|
||||
|
||||
// sprintf()-like formatting to std::string with automatic allocation.
|
||||
|
||||
|
||||
namespace hz {
|
||||
|
||||
|
||||
|
||||
// get the buffer size required to safely allocate a buffer and call vsnprintf().
|
||||
// return -1 if something is wrong.
|
||||
inline int string_vsprintf_get_buffer_size(const char* format, va_list ap) HZ_FUNC_PRINTF_CHECK(1, 0);
|
||||
|
||||
// same as above, but using varargs.
|
||||
// return -1 if something is wrong.
|
||||
inline int string_sprintf_get_buffer_size(const char* format, ...) HZ_FUNC_PRINTF_CHECK(1, 2);
|
||||
|
||||
|
||||
// auto-allocating std::string-returning portable vsprintf
|
||||
inline std::string string_vsprintf(const char* format, va_list ap) HZ_FUNC_PRINTF_CHECK(1, 0);
|
||||
|
||||
|
||||
// same as above, but using varargs
|
||||
inline std::string string_sprintf(const char* format, ...) HZ_FUNC_PRINTF_CHECK(1, 2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------- Implementation
|
||||
|
||||
|
||||
|
||||
inline int string_vsprintf_get_buffer_size(const char* format, va_list ap)
|
||||
{
|
||||
#ifdef ENABLE_GLIB
|
||||
// the glib version returns gsize
|
||||
return static_cast<int>(g_printf_string_upper_bound(format, ap));
|
||||
#else
|
||||
char c = 0;
|
||||
// vsnprintf() returns the number of bytes it could have written (without \0) if buffer was large enough.
|
||||
const int size = vsnprintf(&c, 1, format, ap); // C99 and others
|
||||
if (size < 0)
|
||||
return -1;
|
||||
return size + 1; // that +1 is for \0.
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline int string_sprintf_get_buffer_size(const char* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
int ret = string_vsprintf_get_buffer_size(format, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline std::string string_vsprintf(const char* format, va_list ap)
|
||||
{
|
||||
#if defined ENABLE_GLIB
|
||||
|
||||
// there's also g_vasprintf(), but only since glib 2.4.
|
||||
gchar* buf = g_strdup_vprintf(format, ap);
|
||||
std::string ret = (buf ? buf : "");
|
||||
if (buf)
|
||||
g_free(buf);
|
||||
|
||||
#elif defined _GNU_SOURCE
|
||||
|
||||
std::string ret;
|
||||
char* str = 0;
|
||||
if (vasprintf(&str, format, ap) > 0) // GNU extension
|
||||
ret = (str ? str : "");
|
||||
free(str);
|
||||
|
||||
#else
|
||||
|
||||
std::string ret;
|
||||
int size = string_vsprintf_get_buffer_size(format, ap);
|
||||
if (size > 0) {
|
||||
char* buf = new char[size];
|
||||
// write at most size (with \0). we could use vsprintf(), but it's deemed unsafe in many environments.
|
||||
if (vsnprintf(buf, size, format, ap) > 0)
|
||||
ret = buf;
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline std::string string_sprintf(const char* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
std::string ret = string_vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // ns
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,116 +0,0 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2003 - 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_zlib.txt file
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HZ_WIN32_TOOLS_H
|
||||
#define HZ_WIN32_TOOLS_H
|
||||
|
||||
#include "hz_config.h" // feature macros
|
||||
|
||||
#ifdef _WIN32 // Guards this header completely
|
||||
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include <cctype> // toupper
|
||||
|
||||
|
||||
|
||||
namespace hz {
|
||||
|
||||
|
||||
|
||||
template<class Container> inline
|
||||
bool win32_get_drive_list(Container& put_here)
|
||||
{
|
||||
DWORD buf_size = GetLogicalDriveStrings(0, 0);
|
||||
if (!buf_size) // error
|
||||
return false;
|
||||
|
||||
char* buf = new char[buf_size];
|
||||
|
||||
if (!GetLogicalDriveStrings(sizeof(buf), buf)) {
|
||||
delete[] buf;
|
||||
return false;
|
||||
}
|
||||
|
||||
char* text_ptr = buf;
|
||||
|
||||
// add the drives to list
|
||||
while (*text_ptr != '\0') {
|
||||
std::string str;
|
||||
str += static_cast<char>(std::toupper(text_ptr[0]));
|
||||
str += ":\\";
|
||||
put_here.push_back(str);
|
||||
|
||||
while (*text_ptr != '\0')
|
||||
++text_ptr;
|
||||
++text_ptr; // set to position after 0
|
||||
}
|
||||
|
||||
delete[] buf;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// base may be e.g. HKEY_CURRENT_USER
|
||||
inline bool win32_get_registry_value_string(std::string& put_here, HKEY base,
|
||||
const std::string& keydir, const std::string& key)
|
||||
{
|
||||
HKEY reg_key = NULL;
|
||||
if (RegOpenKeyEx(base, keydir.c_str(), 0, KEY_QUERY_VALUE, ®_key) != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
DWORD type = 0;
|
||||
DWORD nbytes = 0;
|
||||
bool status = (RegQueryValueEx(reg_key, key.c_str(), 0, &type, NULL, &nbytes) == ERROR_SUCCESS);
|
||||
|
||||
if (status) {
|
||||
char* result = new char[nbytes + 1];
|
||||
status = RegQueryValueEx(reg_key, key.c_str(), 0, &type, (BYTE*)result, &nbytes);
|
||||
result[nbytes] = '\0';
|
||||
put_here = result;
|
||||
delete[] result;
|
||||
}
|
||||
|
||||
if (reg_key)
|
||||
RegCloseKey(reg_key);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline bool win32_set_registry_value_string(HKEY base,
|
||||
const std::string& keydir, const std::string& key, const std::string& value)
|
||||
{
|
||||
HKEY reg_key = NULL;
|
||||
DWORD nbytes = value.length() + 1;
|
||||
|
||||
if (RegOpenKeyEx(base, keydir.c_str(), 0, KEY_QUERY_VALUE, ®_key) != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
bool status = (RegSetValueEx(reg_key, key.c_str(), 0, REG_SZ,
|
||||
(const BYTE*)(value.c_str()), nbytes) == ERROR_SUCCESS);
|
||||
|
||||
if (reg_key)
|
||||
RegCloseKey (reg_key);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // ns
|
||||
|
||||
|
||||
|
||||
#endif // win32
|
||||
|
||||
#endif // hg
|
||||
@@ -4,7 +4,7 @@ METASOURCES = AUTO
|
||||
SUBDIRS = libdebug hz rmn rconfig pcrecpp applib res
|
||||
|
||||
|
||||
if TARGET_OS_KERNEL_WINDOWS
|
||||
if TARGET_OS_KERNEL_FAMILY_WINDOWS
|
||||
WINRES_OBJ = gsc_winres_win32.o
|
||||
endif
|
||||
|
||||
@@ -19,6 +19,11 @@ mostlyclean-local:
|
||||
noinst_DATA = gsc_winres.rc.in
|
||||
|
||||
|
||||
# if TARGET_OS_KERNEL_FAMILY_WINDOWS
|
||||
# WIN_MAIN_SRC = win_main.cpp
|
||||
# endif
|
||||
|
||||
|
||||
bin_PROGRAMS = gsmartcontrol
|
||||
|
||||
gsmartcontrol_LDADD = $(top_builddir)/src/applib/libapplib.a \
|
||||
@@ -28,7 +33,7 @@ gsmartcontrol_LDADD = $(top_builddir)/src/applib/libapplib.a \
|
||||
noinst_HEADERS = global_macros.h gsc_about_dialog.h gsc_executor_error_dialog.h \
|
||||
gsc_executor_log_window.h gsc_help_window.h gsc_info_window.h gsc_init.h gsc_main_window.h \
|
||||
gsc_main_window_iconview.h gsc_preferences_window.h gsc_settings.h gsc_text_window.h
|
||||
gsmartcontrol_SOURCES = gsc_about_dialog.cpp gsc_executor_error_dialog.cpp \
|
||||
gsc_executor_log_window.cpp gsc_help_window.cpp gsc_info_window.cpp gsc_init.cpp gsc_main.cpp \
|
||||
gsc_main_window.cpp gsc_preferences_window.cpp
|
||||
gsmartcontrol_SOURCES = $(WIN_MAIN_SRC) gsc_about_dialog.cpp \
|
||||
gsc_executor_error_dialog.cpp gsc_executor_log_window.cpp gsc_help_window.cpp gsc_info_window.cpp \
|
||||
gsc_init.cpp gsc_main.cpp gsc_main_window.cpp gsc_preferences_window.cpp
|
||||
|
||||
@@ -2,8 +2,9 @@ AM_CPPFLAGS = $(all_includes)
|
||||
METASOURCES = AUTO
|
||||
noinst_LIBRARIES = libapplib.a
|
||||
libapplib_a_SOURCES = app_gtkmm_utils.cpp app_pango_utils.cpp cmdex.cpp \
|
||||
cmdex_sync.cpp cmdex_sync_gui.cpp gui_utils.cpp selftest.cpp smartctl_parser.cpp \
|
||||
storage_detector.cpp storage_device.cpp storage_property.cpp storage_property_descr.cpp
|
||||
cmdex_sync.cpp cmdex_sync_gui.cpp gui_utils.cpp selftest.cpp smartctl_executor.cpp \
|
||||
smartctl_parser.cpp storage_detector.cpp storage_device.cpp storage_property.cpp \
|
||||
storage_property_descr.cpp
|
||||
noinst_HEADERS = app_gtkmm_features.h app_gtkmm_utils.h app_pango_utils.h \
|
||||
app_pcrecpp.h app_ui_res_utils.h cmdex.h cmdex_sync.h cmdex_sync_gui.h gui_utils.h \
|
||||
selftest.h smartctl_executor.h smartctl_executor_gui.h smartctl_parser.h \
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_gsmartcontrol.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
// New tooltip API is available since 2.12
|
||||
#if !APP_GTKMM_CHECK_VERSION(2, 12, 0)
|
||||
#define APP_GTKMM_OLD_TOOLTIPS
|
||||
#define APP_GTKMM_OLD_TOOLTIPS 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_gsmartcontrol.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "app_gtkmm_features.h" // APP_GTKMM_OLD_TOOLTIPS
|
||||
|
||||
#ifdef APP_GTKMM_OLD_TOOLTIPS
|
||||
#if defined APP_GTKMM_OLD_TOOLTIPS && APP_GTKMM_OLD_TOOLTIPS
|
||||
#include <gtk/gtk.h> // gtk_tooltips_*
|
||||
#endif
|
||||
|
||||
@@ -54,7 +54,7 @@ void app_gtkmm_set_widget_tooltip(Gtk::Widget& widget,
|
||||
const Glib::ustring& tooltip_text, bool use_markup)
|
||||
{
|
||||
// set_tooltip_* is available since 2.12
|
||||
#ifndef APP_GTKMM_OLD_TOOLTIPS
|
||||
#if !(defined APP_GTKMM_OLD_TOOLTIPS && APP_GTKMM_OLD_TOOLTIPS)
|
||||
if (use_markup) {
|
||||
widget.set_tooltip_markup(tooltip_text);
|
||||
} else {
|
||||
@@ -107,7 +107,7 @@ void app_gtkmm_combobox_unset_model(Gtk::ComboBox* box)
|
||||
|
||||
|
||||
|
||||
#ifdef APP_GTKMM_OLD_TOOLTIPS
|
||||
#if defined APP_GTKMM_OLD_TOOLTIPS && APP_GTKMM_OLD_TOOLTIPS
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -160,7 +160,7 @@ void gtkmm_set_treeview_tooltip_column(Gtk::TreeView* treeview,
|
||||
if (!treeview)
|
||||
return;
|
||||
|
||||
#ifndef APP_GTKMM_OLD_TOOLTIPS
|
||||
#if !(defined APP_GTKMM_OLD_TOOLTIPS && APP_GTKMM_OLD_TOOLTIPS)
|
||||
treeview->set_tooltip_column(col_tooltip.index()); // gtkmm has only index-based api here
|
||||
|
||||
#else // manually set tooltips when hovering over cells
|
||||
@@ -177,7 +177,7 @@ void gtkmm_set_iconview_tooltip_column(Gtk::IconView* iconview,
|
||||
if (!iconview)
|
||||
return;
|
||||
|
||||
#ifndef APP_GTKMM_OLD_TOOLTIPS
|
||||
#if !(defined APP_GTKMM_OLD_TOOLTIPS && APP_GTKMM_OLD_TOOLTIPS)
|
||||
iconview->set_tooltip_column(col_tooltip.index()); // gtkmm has only index-based api here
|
||||
|
||||
#else // manually set tooltips when hovering over cells
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_gsmartcontrol.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_gsmartcontrol.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_gsmartcontrol.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_gsmartcontrol.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_gsmartcontrol.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -12,19 +12,21 @@
|
||||
|
||||
#include "hz/hz_config.h" // feature test macros (ENABLE_*)
|
||||
|
||||
#if defined ENABLE_LIBGLADE
|
||||
#if defined ENABLE_LIBGLADE && ENABLE_LIBGLADE
|
||||
#include <libglademm.h>
|
||||
#elif defined ENABLE_GTKBUILDER
|
||||
#elif defined ENABLE_GTKBUILDER && ENABLE_GTKBUILDER
|
||||
#include <gtkmm/builder.h>
|
||||
#endif
|
||||
|
||||
#if GLIBMM_EXCEPTIONS_ENABLED
|
||||
// Old glibmm versions had exceptions but didn't define this at all.
|
||||
// New ones define it to 0 if there are no glibmm exceptions.
|
||||
#if !defined GLIBMM_EXCEPTIONS_ENABLED || GLIBMM_EXCEPTIONS_ENABLED
|
||||
#include <memory> // std::auto_ptr
|
||||
#endif
|
||||
|
||||
#include "app_gtkmm_features.h" // APP_GTKMM_OLD_TOOLTIPS
|
||||
|
||||
#ifdef APP_GTKMM_OLD_TOOLTIPS
|
||||
#if defined APP_GTKMM_OLD_TOOLTIPS && APP_GTKMM_OLD_TOOLTIPS
|
||||
#include <gtk/gtk.h> // gtk_tooltips_*
|
||||
#endif
|
||||
|
||||
@@ -44,7 +46,7 @@
|
||||
// Or, if you're using compiled-in buffers, it will make them available.
|
||||
|
||||
|
||||
#if defined ENABLE_LIBGLADE
|
||||
#if defined ENABLE_LIBGLADE && ENABLE_LIBGLADE
|
||||
|
||||
#define APP_UI_RES_DATA_INIT(res_name) \
|
||||
HZ_RES_DATA_INIT_NAMED(res_name##_ui, #res_name ".glade", UIResDataBase); \
|
||||
@@ -56,7 +58,7 @@
|
||||
}
|
||||
|
||||
|
||||
#elif defined ENABLE_GTKBUILDER
|
||||
#elif defined ENABLE_GTKBUILDER && ENABLE_GTKBUILDER
|
||||
|
||||
#define APP_UI_RES_DATA_INIT(res_name) \
|
||||
HZ_RES_DATA_INIT_NAMED(res_name##_ui, #res_name ".ui", UIResDataBase); \
|
||||
@@ -84,7 +86,7 @@
|
||||
|
||||
|
||||
|
||||
#if defined ENABLE_LIBGLADE
|
||||
#if defined ENABLE_LIBGLADE && ENABLE_LIBGLADE
|
||||
|
||||
typedef Glib::RefPtr<Gnome::Glade::Xml> app_ui_res_ref_t;
|
||||
|
||||
@@ -97,7 +99,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
#if GLIBMM_EXCEPTIONS_ENABLED
|
||||
#if !defined GLIBMM_EXCEPTIONS_ENABLED || GLIBMM_EXCEPTIONS_ENABLED
|
||||
try {
|
||||
// Glib::RefPtr<Gnome::Glade::Xml> ref = Gnome::Glade::Xml::create("main_window.glade");
|
||||
ref = Gnome::Glade::Xml::create_from_buffer(reinterpret_cast<const char*>(buf),
|
||||
@@ -124,7 +126,7 @@
|
||||
}
|
||||
|
||||
|
||||
#elif defined ENABLE_GTKBUILDER
|
||||
#elif defined ENABLE_GTKBUILDER && ENABLE_GTKBUILDER
|
||||
|
||||
typedef Glib::RefPtr<Gtk::Builder> app_ui_res_ref_t;
|
||||
|
||||
@@ -137,7 +139,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
#if GLIBMM_EXCEPTIONS_ENABLED
|
||||
#if !defined GLIBMM_EXCEPTIONS_ENABLED || GLIBMM_EXCEPTIONS_ENABLED
|
||||
try {
|
||||
// ref->add_from_file("main_window.ui");
|
||||
ref->add_from_string(reinterpret_cast<const char*>(buf), static_cast<gsize>(buf_size));
|
||||
@@ -219,9 +221,9 @@ class AppUIResWidget : public WidgetType, public hz::InstanceManager<Child, Mult
|
||||
|
||||
typedef hz::InstanceManager<Child, MultiInstance> instance_class;
|
||||
|
||||
#if defined ENABLE_LIBGLADE
|
||||
#if defined ENABLE_LIBGLADE && ENABLE_LIBGLADE
|
||||
friend class Gnome::Glade::Xml; // allow construction through libglade
|
||||
#elif defined ENABLE_GTKBUILDER
|
||||
#elif defined ENABLE_GTKBUILDER && ENABLE_GTKBUILDER
|
||||
friend class Gtk::Builder; // allow construction through gtkbuilder
|
||||
#endif
|
||||
friend class hz::InstanceManager<Child, MultiInstance>; // allow construction through instance class
|
||||
@@ -234,9 +236,9 @@ class AppUIResWidget : public WidgetType, public hz::InstanceManager<Child, Mult
|
||||
return hz::InstanceManager<Child, MultiInstance>::get_single_instance();
|
||||
|
||||
std::string error;
|
||||
#if defined ENABLE_LIBGLADE
|
||||
#if defined ENABLE_LIBGLADE && ENABLE_LIBGLADE
|
||||
app_ui_res_ref_t ui;
|
||||
#elif defined ENABLE_GTKBUILDER
|
||||
#elif defined ENABLE_GTKBUILDER && ENABLE_GTKBUILDER
|
||||
app_ui_res_ref_t ui = Gtk::Builder::create();
|
||||
#else // none, just avoid compilation errors
|
||||
app_ui_res_ref_t ui = 0;
|
||||
@@ -301,9 +303,9 @@ class AppUIResWidget : public WidgetType, public hz::InstanceManager<Child, Mult
|
||||
|
||||
Glib::Object* lookup_object(const Glib::ustring& name)
|
||||
{
|
||||
#if defined ENABLE_LIBGLADE
|
||||
#if defined ENABLE_LIBGLADE && ENABLE_LIBGLADE
|
||||
return static_cast<Glib::Object*>(lookup_widget(name)); // all glade objects are widgets, it's an upcast
|
||||
#elif defined ENABLE_GTKBUILDER
|
||||
#elif defined ENABLE_GTKBUILDER && ENABLE_GTKBUILDER
|
||||
return ref_ui_->get_object(name).operator->(); // silly RefPtr doesn't have get().
|
||||
#else // none, just avoid compilation errors
|
||||
return 0;
|
||||
@@ -329,6 +331,7 @@ class AppUIResWidget : public WidgetType, public hz::InstanceManager<Child, Mult
|
||||
|
||||
// This is needed by APP_GLADE_ macros
|
||||
typedef Child self_type;
|
||||
typedef WidgetType widget_type;
|
||||
|
||||
|
||||
// protected constructor / destructor, use create() / destroy() instead of new / delete.
|
||||
@@ -339,7 +342,7 @@ class AppUIResWidget : public WidgetType, public hz::InstanceManager<Child, Mult
|
||||
: WidgetType(gtkcobj), ref_ui_(ref_ui)
|
||||
{
|
||||
// if gtkmm is older than 2.12, use the old tooltips API
|
||||
#ifdef APP_GTKMM_OLD_TOOLTIPS
|
||||
#if defined APP_GTKMM_OLD_TOOLTIPS && APP_GTKMM_OLD_TOOLTIPS
|
||||
// attach it to the window
|
||||
this->create_tooltips_data(this);
|
||||
#endif
|
||||
@@ -360,7 +363,7 @@ class AppUIResWidget : public WidgetType, public hz::InstanceManager<Child, Mult
|
||||
{ }
|
||||
|
||||
|
||||
#ifdef APP_GTKMM_OLD_TOOLTIPS
|
||||
#if defined APP_GTKMM_OLD_TOOLTIPS && APP_GTKMM_OLD_TOOLTIPS
|
||||
// differentiate Window and its children from other widgets through overloading
|
||||
|
||||
void create_tooltips_data(Gtk::Window* window)
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_whatever.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_whatever.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
// A simple empty window definition
|
||||
|
||||
#if defined ENABLE_LIBGLADE
|
||||
#if defined ENABLE_LIBGLADE && ENABLE_LIBGLADE
|
||||
|
||||
|
||||
extern const unsigned char app_ui_res_test_window_ui[] = {
|
||||
@@ -341,7 +341,7 @@ extern const unsigned int app_ui_res_test_window_ui_size = 319;
|
||||
|
||||
|
||||
|
||||
#elif defined ENABLE_GTKBUILDER
|
||||
#elif defined ENABLE_GTKBUILDER && ENABLE_GTKBUILDER
|
||||
|
||||
|
||||
extern const unsigned char app_ui_res_test_window_ui[] = {
|
||||
@@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
Copyright:
|
||||
(C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
|
||||
License: See LICENSE_gsmartcontrol.txt
|
||||
***************************************************************************/
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// #include <unistd.h> // close()
|
||||
#endif
|
||||
|
||||
#include "hz/process_signal.h" // hz::process_signal_send, win32's W*
|
||||
#include "hz/tls.h"
|
||||
#include "hz/tls_policy_glib.h"
|
||||
#include "hz/debug.h"
|
||||
@@ -37,41 +38,24 @@ extern "C" {
|
||||
// callbacks
|
||||
|
||||
|
||||
// NOTE: These functions are called in a separate threads!
|
||||
|
||||
inline void cmdex_child_watch_handler(GPid arg_pid, int waitpid_status, gpointer data)
|
||||
{
|
||||
Cmdex::on_child_watch_handler(arg_pid, waitpid_status, data);
|
||||
}
|
||||
|
||||
|
||||
inline gboolean cmdex_on_channel_io_stdout_as_available(GIOChannel* source, GIOCondition cond, gpointer data)
|
||||
inline gboolean cmdex_on_channel_io_stdout(GIOChannel* source, GIOCondition cond, gpointer data)
|
||||
{
|
||||
return Cmdex::on_channel_io_as_available(source, cond, static_cast<Cmdex*>(data), Cmdex::channel_type_stdout);
|
||||
return Cmdex::on_channel_io(source, cond, static_cast<Cmdex*>(data), Cmdex::channel_type_stdout);
|
||||
}
|
||||
|
||||
inline gboolean cmdex_on_channel_io_stderr_as_available(GIOChannel* source, GIOCondition cond, gpointer data)
|
||||
inline gboolean cmdex_on_channel_io_stderr(GIOChannel* source, GIOCondition cond, gpointer data)
|
||||
{
|
||||
return Cmdex::on_channel_io_as_available(source, cond, static_cast<Cmdex*>(data), Cmdex::channel_type_stderr);
|
||||
return Cmdex::on_channel_io(source, cond, static_cast<Cmdex*>(data), Cmdex::channel_type_stderr);
|
||||
}
|
||||
|
||||
|
||||
inline gboolean cmdex_on_channel_io_stdout_buffered(GIOChannel* source, GIOCondition cond, gpointer data)
|
||||
{
|
||||
return Cmdex::on_channel_io_buffered(source, cond, static_cast<Cmdex*>(data), Cmdex::channel_type_stdout);
|
||||
}
|
||||
|
||||
inline gboolean cmdex_on_channel_io_stderr_buffered(GIOChannel* source, GIOCondition cond, gpointer data)
|
||||
{
|
||||
return Cmdex::on_channel_io_buffered(source, cond, static_cast<Cmdex*>(data), Cmdex::channel_type_stderr);
|
||||
}
|
||||
|
||||
|
||||
inline void cmdex_on_buffered_source_destroy(gpointer data);
|
||||
|
||||
|
||||
|
||||
// this is executed in another thread!
|
||||
inline gboolean cmdex_on_term_timeout(gpointer data)
|
||||
{
|
||||
DBG_FUNCTION_ENTER_MSG;
|
||||
@@ -81,7 +65,6 @@ extern "C" {
|
||||
}
|
||||
|
||||
|
||||
// this is executed in another thread!
|
||||
inline gboolean cmdex_on_kill_timeout(gpointer data)
|
||||
{
|
||||
DBG_FUNCTION_ENTER_MSG;
|
||||
@@ -100,13 +83,11 @@ extern "C" {
|
||||
|
||||
bool Cmdex::execute()
|
||||
{
|
||||
ScopedLock locker(object_mutex_);
|
||||
|
||||
if (this->running_ || this->stopped_cleanup_needed(false))
|
||||
if (this->running_ || this->stopped_cleanup_needed())
|
||||
return false;
|
||||
|
||||
cleanup_members();
|
||||
clear_errors(false); // don't lock
|
||||
clear_errors();
|
||||
str_stdout_.clear();
|
||||
str_stderr_.clear();
|
||||
|
||||
@@ -159,7 +140,7 @@ bool Cmdex::execute()
|
||||
hz::scoped_ptr<GError> spawn_error(0, g_error_free);
|
||||
|
||||
/*
|
||||
#ifdef APP_CMDEX_USE_SYNC
|
||||
#if defined APP_CMDEX_USE_SYNC && APP_CMDEX_USE_SYNC
|
||||
|
||||
hz::scoped_ptr<gchar*> stdout_str(0, g_free);
|
||||
hz::scoped_ptr<gchar*> stderr_str(0, g_free);
|
||||
@@ -194,16 +175,6 @@ bool Cmdex::execute()
|
||||
// #endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
// Without this timeout the program randomly says that the child's output
|
||||
// is empty (happens only in windows). Sounds like a race condition, but
|
||||
// doesn't seem like it's in my code (all other platforms are ok).
|
||||
// Note: Testing is really hard when moving this around - the error might
|
||||
// occur once in 200 runs.
|
||||
// g_usleep(50*1000); // 50 msec.
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
channel_stdout_ = g_io_channel_win32_new_fd(fd_stdout_);
|
||||
channel_stderr_ = g_io_channel_win32_new_fd(fd_stderr_);
|
||||
@@ -217,7 +188,7 @@ bool Cmdex::execute()
|
||||
// If using locales, call g_locale_to_utf8() or g_convert() afterwards.
|
||||
|
||||
// blocking writes if the pipe is full helps for small-pipe systems (see man 7 pipe).
|
||||
GIOFlags channel_flags = GIOFlags(~G_IO_FLAG_NONBLOCK);
|
||||
int channel_flags = ~G_IO_FLAG_NONBLOCK;
|
||||
|
||||
// Note about GError's here:
|
||||
// What do we do? The command is already running, so let's ignore these
|
||||
@@ -228,54 +199,35 @@ bool Cmdex::execute()
|
||||
// a double-shutdown.
|
||||
// g_io_channel_set_close_on_unref(channel_stdout_, true); // close() on fd
|
||||
g_io_channel_set_encoding(channel_stdout_, NULL, 0); // binary IO
|
||||
g_io_channel_set_flags(channel_stdout_, channel_flags, 0);
|
||||
g_io_channel_set_flags(channel_stdout_, GIOFlags(g_io_channel_get_flags(channel_stdout_) & channel_flags), 0);
|
||||
g_io_channel_set_buffer_size(channel_stdout_, channel_stdout_buffer_size_);
|
||||
}
|
||||
if (channel_stderr_) {
|
||||
// g_io_channel_set_close_on_unref(channel_stderr_, true); // close() on fd
|
||||
g_io_channel_set_encoding(channel_stderr_, NULL, 0); // binary IO
|
||||
g_io_channel_set_flags(channel_stderr_, channel_flags, 0);
|
||||
g_io_channel_set_flags(channel_stderr_, GIOFlags(g_io_channel_get_flags(channel_stderr_) & channel_flags), 0);
|
||||
g_io_channel_set_buffer_size(channel_stderr_, channel_stderr_buffer_size_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Note: glib callbacks _are_ invoked in separate threads,
|
||||
// so proper locking is necessary.
|
||||
// This is different from gtk callbacks, which are directly invoked from main loop
|
||||
// in the same thread.
|
||||
|
||||
GIOCondition cond = GIOCondition(G_IO_IN | G_IO_PRI | G_IO_HUP | G_IO_ERR | G_IO_NVAL);
|
||||
gint io_thread_priority = G_PRIORITY_HIGH; // channel reader callback thread must read enough so that the loss is minimal
|
||||
// Channel reader callback must be called before other stuff so that the loss is minimal.
|
||||
gint io_priority = G_PRIORITY_HIGH;
|
||||
|
||||
if (this->stdout_make_str_as_available_) {
|
||||
this->event_source_id_stdout_ = g_io_add_watch_full(channel_stdout_, io_thread_priority, cond,
|
||||
&cmdex_on_channel_io_stdout_as_available, this, NULL);
|
||||
} else {
|
||||
this->event_source_id_stdout_ = g_io_add_watch_full(channel_stdout_, io_thread_priority, cond,
|
||||
&cmdex_on_channel_io_stdout_buffered, this, cmdex_on_buffered_source_destroy);
|
||||
}
|
||||
this->event_source_id_stdout_ = g_io_add_watch_full(channel_stdout_, io_priority, cond,
|
||||
&cmdex_on_channel_io_stdout, this, NULL);
|
||||
|
||||
if (this->stderr_make_str_as_available_) {
|
||||
this->event_source_id_stderr_ = g_io_add_watch_full(channel_stderr_, io_thread_priority, cond,
|
||||
&cmdex_on_channel_io_stderr_as_available, this, NULL);
|
||||
} else {
|
||||
this->event_source_id_stderr_ = g_io_add_watch_full(channel_stderr_, io_thread_priority, cond,
|
||||
&cmdex_on_channel_io_stderr_buffered, this, cmdex_on_buffered_source_destroy);
|
||||
}
|
||||
this->event_source_id_stderr_ = g_io_add_watch_full(channel_stderr_, io_priority, cond,
|
||||
&cmdex_on_channel_io_stderr, this, NULL);
|
||||
|
||||
|
||||
// If using SPAWN_DO_NOT_REAP_CHILD, this is needed to avoid zombies.
|
||||
// Note: Do NOT use glibmm slot, it doesn't work here.
|
||||
// The watch function is protected by mutex and won't be called before execute() exits.
|
||||
// This is AFTER the channels so that it doesn't get called before the channels are attached (is this needed?).
|
||||
// (the child stops being a zombie as soon as wait*() exits and this handler is called).
|
||||
g_child_watch_add(this->pid_, &cmdex_child_watch_handler, this);
|
||||
|
||||
|
||||
this->running_ = true; // process is running now.
|
||||
// actually, it may be already stopped, but the watcher function is blocked
|
||||
// until we exit, so the actions are serialized.
|
||||
this->running_ = true; // the process is running now.
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -286,8 +238,6 @@ bool Cmdex::execute()
|
||||
// send SIGTERM(15) (terminate)
|
||||
bool Cmdex::try_stop(hz::signal_t sig)
|
||||
{
|
||||
ScopedLock locker(object_mutex_);
|
||||
|
||||
if (!this->running_ || this->pid_ <= 0)
|
||||
return false;
|
||||
|
||||
@@ -312,12 +262,11 @@ bool Cmdex::try_stop(hz::signal_t sig)
|
||||
void Cmdex::set_stop_timeouts(int term_timeout_msec, int kill_timeout_msec)
|
||||
{
|
||||
DBG_ASSERT(term_timeout_msec == 0 || kill_timeout_msec == 0 || kill_timeout_msec > term_timeout_msec);
|
||||
ScopedLock locker(object_mutex_); // member access / serialization lock
|
||||
|
||||
if (!this->running_) // process not running
|
||||
return;
|
||||
|
||||
unset_stop_timeouts(false);
|
||||
unset_stop_timeouts();
|
||||
|
||||
if (term_timeout_msec != 0)
|
||||
event_source_id_term = g_timeout_add(term_timeout_msec, &cmdex_on_term_timeout, this);
|
||||
@@ -329,10 +278,8 @@ void Cmdex::set_stop_timeouts(int term_timeout_msec, int kill_timeout_msec)
|
||||
|
||||
|
||||
|
||||
void Cmdex::unset_stop_timeouts(bool do_lock)
|
||||
void Cmdex::unset_stop_timeouts()
|
||||
{
|
||||
ScopedLock locker(object_mutex_, do_lock); // member access / serialization lock
|
||||
|
||||
if (event_source_id_term) {
|
||||
GSource* source_term = g_main_context_find_source_by_id(NULL, event_source_id_term);
|
||||
if (source_term)
|
||||
@@ -354,14 +301,12 @@ void Cmdex::unset_stop_timeouts(bool do_lock)
|
||||
void Cmdex::stopped_cleanup()
|
||||
{
|
||||
// DBG_FUNCTION_ENTER_MSG;
|
||||
ScopedLock locker(object_mutex_); // member access / serialization lock
|
||||
|
||||
if (this->running_ || !this->stopped_cleanup_needed(false)) // huh?
|
||||
if (this->running_ || !this->stopped_cleanup_needed()) // huh?
|
||||
return;
|
||||
|
||||
// remove stop timeout callbacks
|
||||
unset_stop_timeouts(false);
|
||||
|
||||
unset_stop_timeouts();
|
||||
|
||||
// various statuses (see waitpid (2)):
|
||||
if (WIFEXITED(waitpid_status_)) { // exited normally
|
||||
@@ -399,29 +344,19 @@ void Cmdex::stopped_cleanup()
|
||||
|
||||
|
||||
|
||||
// NOTE: This function is called in a separate thread!
|
||||
// Called when child exits
|
||||
void Cmdex::on_child_watch_handler(GPid arg_pid, int waitpid_status, gpointer data)
|
||||
{
|
||||
// DBG_FUNCTION_ENTER_MSG;
|
||||
Cmdex* self = static_cast<Cmdex*>(data);
|
||||
|
||||
self->lock();
|
||||
|
||||
g_timer_stop(self->timer_); // stop the timer
|
||||
|
||||
// wait until the IO channels are closed
|
||||
// while (!(self->event_source_stdout_closed && self->event_source_stderr_closed)) {
|
||||
// self->unlock();
|
||||
// g_usleep(75*1000); // 75ms
|
||||
// self->lock();
|
||||
// }
|
||||
|
||||
self->waitpid_status_ = waitpid_status;
|
||||
self->child_watch_handler_called_ = true;
|
||||
self->running_ = false; // process is not running anymore
|
||||
|
||||
|
||||
// Remove fd IO callbacks. They may actually be removed already.
|
||||
// Remove fd IO callbacks. They may actually be removed already (note sure about this).
|
||||
// This will force calling the iochannel callback (they may not be called
|
||||
// otherwise at all if there was no output).
|
||||
if (self->event_source_id_stdout_) {
|
||||
@@ -441,13 +376,9 @@ void Cmdex::on_child_watch_handler(GPid arg_pid, int waitpid_status, gpointer da
|
||||
// close(self->fd_stdout_);
|
||||
// close(self->fd_stderr_);
|
||||
|
||||
|
||||
// Note: This callback is called in non-main thread!
|
||||
if (self->exited_callback_)
|
||||
self->exited_callback_(self->exited_callback_data_);
|
||||
|
||||
|
||||
self->unlock();
|
||||
// DBG_FUNCTION_EXIT_MSG;
|
||||
}
|
||||
|
||||
@@ -455,13 +386,10 @@ void Cmdex::on_child_watch_handler(GPid arg_pid, int waitpid_status, gpointer da
|
||||
|
||||
|
||||
|
||||
|
||||
// NOTE: This function is called in a separate thread!
|
||||
// This means that all data access must be guarded by mutexes, etc...
|
||||
gboolean Cmdex::on_channel_io_as_available(GIOChannel* source,
|
||||
gboolean Cmdex::on_channel_io(GIOChannel* source,
|
||||
GIOCondition cond, Cmdex* self, channel_t type)
|
||||
{
|
||||
// debug_out_dump("app", "Cmdex::on_channel_io_as_available("
|
||||
// debug_out_dump("app", "Cmdex::on_channel_io("
|
||||
// << (type == channel_type_stdout ? "STDOUT" : "STDERR") << ") " << int(cond) << "\n");
|
||||
|
||||
bool continue_events = true;
|
||||
@@ -477,8 +405,6 @@ gboolean Cmdex::on_channel_io_as_available(GIOChannel* source,
|
||||
const gsize count = 1;
|
||||
gchar buf[count] = {0};
|
||||
|
||||
Cmdex::ScopedLock locker(self->object_mutex_);
|
||||
|
||||
GIOChannel* channel = 0;
|
||||
std::string* output_str = 0;
|
||||
if (type == channel_type_stdout) {
|
||||
@@ -490,7 +416,6 @@ gboolean Cmdex::on_channel_io_as_available(GIOChannel* source,
|
||||
}
|
||||
|
||||
|
||||
|
||||
// while there's anything to read, read it
|
||||
do {
|
||||
hz::scoped_ptr<GError> channel_error(0, g_error_free);
|
||||
@@ -520,108 +445,6 @@ gboolean Cmdex::on_channel_io_as_available(GIOChannel* source,
|
||||
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// this must be thread-local, because many instances of Cmdex may call this
|
||||
// from various threads. stdout and stderr are in different threads, so they won't get mixed.
|
||||
// there's one-channel-per-thread situation here, so thread-local works well.
|
||||
|
||||
static hz::thread_local_ptr<std::string, hz::TlsPolicyGlib> s_final_str;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// The problem with final_str is that it may acummulate data if this function
|
||||
// is never called with (continue_events = false) condition. This may
|
||||
// actually happen with terminated spawned programs.
|
||||
// So, we clean final_str manually from source_destroy callback.
|
||||
// This callback is executed from in the same thread as on_channel_io_buffered,
|
||||
// so we get the same variable (tests show cleared s_final_str, but is this really
|
||||
// so? this function is executed during on_child_watch_handler (if spawn-terminated)).
|
||||
inline void cmdex_on_buffered_source_destroy(gpointer data)
|
||||
{
|
||||
// DBG_FUNCTION_ENTER_MSG;
|
||||
s_final_str.reset(); // .reset(), not ->clear - we don't want memory leaks in stopped threads.
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// NOTE: This function is called in a separate thread!
|
||||
// This means that all data access must be guarded by mutexes, etc...
|
||||
gboolean Cmdex::on_channel_io_buffered(GIOChannel* source,
|
||||
GIOCondition cond, Cmdex* self, channel_t type)
|
||||
{
|
||||
// debug_out_dump("app", "Cmdex::on_channel_io_buffered("
|
||||
// << (type == channel_type_stdout ? "STDOUT" : "STDERR") << ") " << int(cond) << "\n");
|
||||
|
||||
bool continue_events = true;
|
||||
if ((cond & G_IO_ERR) || (cond & G_IO_HUP) || (cond & G_IO_NVAL)) {
|
||||
continue_events = false; // there'll be no more data
|
||||
}
|
||||
|
||||
if (!s_final_str.get()) {
|
||||
s_final_str.reset(new std::string);
|
||||
s_final_str->reserve(g_io_channel_get_buffer_size(source));
|
||||
}
|
||||
|
||||
// const gsize count = 4 * 1024;
|
||||
// read the bytes one by one. without this, a buffered iochannel hangs while waiting for data.
|
||||
// we don't use unbuffered iochannels - they may lose data on program exit.
|
||||
const gsize count = 1;
|
||||
static char buf[count] = {0};
|
||||
|
||||
// while there's anything to read, read it
|
||||
do {
|
||||
hz::scoped_ptr<GError> channel_error(0, g_error_free);
|
||||
gsize bytes_read = 0;
|
||||
GIOStatus status = g_io_channel_read_chars(source, buf, count, &bytes_read, &channel_error.get_ref());
|
||||
if (bytes_read)
|
||||
s_final_str->append(buf, bytes_read);
|
||||
|
||||
if (channel_error) {
|
||||
Cmdex::ScopedLock locker(self->object_mutex_);
|
||||
self->push_error(Error<void>("giochannel", ErrorLevel::error, channel_error->message), false);
|
||||
break; // stop on next invocation (is this correct?)
|
||||
}
|
||||
|
||||
// IO_STATUS_NORMAL and IO_STATUS_AGAIN (resource unavailable) are continuable.
|
||||
if (status == G_IO_STATUS_ERROR || status == G_IO_STATUS_EOF) {
|
||||
continue_events = false;
|
||||
break;
|
||||
}
|
||||
|
||||
} while (g_io_channel_get_buffer_condition(source) & G_IO_IN);
|
||||
|
||||
|
||||
if (!continue_events) { // need locking
|
||||
Cmdex::ScopedLock locker(self->object_mutex_);
|
||||
|
||||
if (type == channel_type_stdout) {
|
||||
// set the source to be closed (the actual closing is done when we return false).
|
||||
// this is needed for the caller to wait until all the channels are stopped.
|
||||
self->str_stdout_ = *s_final_str;
|
||||
|
||||
} else if (type == channel_type_stderr) {
|
||||
self->str_stderr_ = *s_final_str;
|
||||
}
|
||||
|
||||
// glib may re-use this thread, so do a TLS cleanup.
|
||||
// also, manual cleanup is needed for policies which don't support automatic one.
|
||||
// source_destroy callback already does this, but it won't hurt.
|
||||
s_final_str.reset(); // this will delete the previous contents.
|
||||
}
|
||||
|
||||
// DBG_FUNCTION_EXIT_MSG;
|
||||
|
||||
// false if the source should be removed, true otherwise.
|
||||
return continue_events;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||