Skip to content

Commit

Permalink
Fixed compilation under macOS.
Browse files Browse the repository at this point in the history
Fixed compilation under Fedora Rawhide.
Don't use -mtune=generic for all targets.
Don't use common compiler options by default.
  • Loading branch information
ashaduri committed Jun 19, 2017
1 parent 6e7d67a commit bf9889c
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 37 deletions.
4 changes: 4 additions & 0 deletions gsmartcontrol/NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 1.0.1, released on 2017-06-19
Fixed compilation under macOS.
Fixed compilation under Fedora Rawhide.
Don't use -mtune=generic for all targets.

Version 1.0.0, released on 2017-06-16
Ported to GTK+ 3.
Expand Down
23 changes: 18 additions & 5 deletions gsmartcontrol/autoconf.m4/app_compiler_options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
AC_ARG_ENABLE(common-options, AS_HELP_STRING([--enable-common-options=<compiler>|auto|none],
[enable useful compilation options (warnings, mostly). Accepted values are auto, none, gnu, clang, intel, sun. (Default: auto)]),
[app_cv_compiler_common_options=${enableval}], [app_cv_compiler_common_options=auto])
[app_cv_compiler_common_options=${enableval}], [app_cv_compiler_common_options=none])
# the default value is "yes" (if no value given after =), treat it as auto.
if test "x$app_cv_compiler_common_options" = "xyes" || test "x$app_cv_compiler_common_options" = "xauto"; then
Expand All @@ -54,7 +54,7 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
|| 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.
# -mms-bitfields - make structures compatible with msvc. recommended default for non-cygwin. Default for mingw.
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mms-bitfields"
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mms-bitfields"
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mms-bitfields"
Expand Down Expand Up @@ -183,10 +183,23 @@ AC_DEFUN([APP_COMPILER_OPTIONS], [
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";
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -g0 -O3 -s";
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -g0 -O3 -s";
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -g0 -O3 -s";
fi
# -mtune=generic is only for x86*
case "$target" in
i686-*)
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mtune=generic";
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mtune=generic";
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mtune=generic";
;;
x86_64-*)
app_cv_compiler_options_cflags="$app_cv_compiler_options_cflags -mtune=generic";
app_cv_compiler_options_cxxflags="$app_cv_compiler_options_cxxflags -mtune=generic";
app_cv_compiler_options_ldflags="$app_cv_compiler_options_ldflags -mtune=generic";
;;
esac
# intel / gnu
elif test "x$app_cv_compiler_optimize_options" = "xintel" && test "x$app_cv_target_os_env" = "xgnu"; then
Expand Down
18 changes: 12 additions & 6 deletions gsmartcontrol/configure-dev
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ configure_script="$2";
if [ "$type" == "" ]; then
echo "Usage: $0 <type> [<configure_script>]"
echo "where <type> is one of:"
echo "debug optimized icc clang win32 win32-debug win64-debug sun portland open64";
echo "none debug optimized gcc-debug clang-debug icc-debug sun win32-cross win32-cross-debug \
win64-cross win64-cross-debug win32-msys win32-msys-debug win64-msys win64-msys-debug";
echo "<configure_script> is ../configure by default"
exit 1;
fi
Expand All @@ -21,16 +22,21 @@ fi
flags="";

case $type in
gcc)
none)
flags="--enable-tests" ;;
debug)
flags="--enable-debug-options --enable-tests" ;;
optimized)
flags="--enable-optimize-options --enable-tests" ;;

gcc-debug)
flags="--enable-debug-options --enable-tests" ;;
flags="CC=gcc CXX=g++ --enable-common-options=gnu --enable-debug-options --enable-tests" ;;
clang-debug)
flags="CC=clang CXX=clang++ --enable-debug-options --enable-tests" ;;
flags="CC=clang CXX=clang++ --enable-common-options=clang --enable-debug-options --enable-tests" ;;
icc-debug)
flags="CC=icc64 CXX=icpc64 --enable-debug-options --enable-tests" ;;
flags="CC=icc64 CXX=icpc64 --enable-common-options=intel --enable-debug-options --enable-tests" ;;
sun)
flags="CC=suncc CXX=sunCC CFLAGS=\"-errwarn=%all -I/opt/sun/target64/include\" \
flags="CC=suncc CXX=sunCC --enable-common-options=sun CFLAGS=\"-errwarn=%all -I/opt/sun/target64/include\" \
CXXFLAGS=\"-I/opt/sun/target64/include\" PATH=\"/opt/sun/sunstudio/bin:$PATH\" \
LDFLAGS=\"-R/opt/sun/target64/lib64 -L/opt/sun/target64/lib64\" \
PKG_CONFIG_PATH=\"/opt/sun/target64/lib64/pkgconfig:/usr/lib64/pkgconfig\" \
Expand Down
2 changes: 1 addition & 1 deletion gsmartcontrol/configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

AC_INIT([GSmartControl],[1.0.0],[],[gsmartcontrol])
AC_INIT([GSmartControl],[1.0.1],[],[gsmartcontrol])

AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([config.h])
Expand Down
32 changes: 16 additions & 16 deletions gsmartcontrol/src/applib/storage_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ std::string StorageDevice::get_status_name(StorageDevice::status_t status, bool



StorageDevice::StorageDevice(const string& dev_or_vfile, bool is_virtual)
StorageDevice::StorageDevice(const std::string& dev_or_vfile, bool is_virtual)
{
detected_type_ = detected_type_unknown;
// force_type_ = false;
Expand All @@ -76,7 +76,7 @@ StorageDevice::StorageDevice(const string& dev_or_vfile, bool is_virtual)



StorageDevice::StorageDevice(const string& dev, const string& type_arg)
StorageDevice::StorageDevice(const std::string& dev, const std::string& type_arg)
{
detected_type_ = detected_type_unknown;
// force_type_ = false;
Expand Down Expand Up @@ -575,14 +575,14 @@ StorageProperty StorageDevice::get_health_property() const



string StorageDevice::get_device() const
std::string StorageDevice::get_device() const
{
return device_;
}



string StorageDevice::get_device_base() const
std::string StorageDevice::get_device_base() const
{
if (is_virtual_)
return "";
Expand All @@ -595,7 +595,7 @@ string StorageDevice::get_device_base() const



string StorageDevice::get_device_with_type() const
std::string StorageDevice::get_device_with_type() const
{
if (this->get_is_virtual()) {
std::string ret = "Virtual";
Expand Down Expand Up @@ -626,7 +626,7 @@ StorageDevice::detected_type_t StorageDevice::get_detected_type() const



void StorageDevice::set_type_argument(const string& arg)
void StorageDevice::set_type_argument(const std::string& arg)
{
type_arg_ = arg;
}
Expand All @@ -640,7 +640,7 @@ std::string StorageDevice::get_type_argument() const



void StorageDevice::set_extra_arguments(const string& args)
void StorageDevice::set_extra_arguments(const std::string& args)
{
extra_args_ = args;
}
Expand All @@ -661,7 +661,7 @@ bool StorageDevice::get_is_virtual() const



string StorageDevice::get_virtual_file() const
std::string StorageDevice::get_virtual_file() const
{
return (is_virtual_ ? virtual_file_ : std::string());
}
Expand All @@ -682,7 +682,7 @@ const SmartctlParser::prop_list_t& StorageDevice::get_properties() const



StorageProperty StorageDevice::lookup_property(const string& generic_name, StorageProperty::section_t section, StorageProperty::subsection_t subsection) const
StorageProperty StorageDevice::lookup_property(const std::string& generic_name, StorageProperty::section_t section, StorageProperty::subsection_t subsection) const
{
for (SmartctlParser::prop_list_t::const_iterator iter = properties_.begin(); iter != properties_.end(); ++iter) {
if (section != StorageProperty::section_unknown && iter->section != section)
Expand All @@ -698,21 +698,21 @@ StorageProperty StorageDevice::lookup_property(const string& generic_name, Stora



string StorageDevice::get_model_name() const
std::string StorageDevice::get_model_name() const
{
return (model_name_.defined() ? model_name_.value() : "");
}



string StorageDevice::get_family_name() const
std::string StorageDevice::get_family_name() const
{
return (family_name_.defined() ? family_name_.value() : "");
}



string StorageDevice::get_serial_number() const
std::string StorageDevice::get_serial_number() const
{
return (serial_number_.defined() ? serial_number_.value() : "");
}
Expand All @@ -726,28 +726,28 @@ bool StorageDevice::get_is_hdd() const



void StorageDevice::set_info_output(const string& s)
void StorageDevice::set_info_output(const std::string& s)
{
info_output_ = s;
}



string StorageDevice::get_info_output() const
std::string StorageDevice::get_info_output() const
{
return info_output_;
}



void StorageDevice::set_full_output(const string& s)
void StorageDevice::set_full_output(const std::string& s)
{
full_output_ = s;
}



string StorageDevice::get_full_output() const
std::string StorageDevice::get_full_output() const
{
return full_output_;
}
Expand Down
15 changes: 6 additions & 9 deletions gsmartcontrol/src/hz/tls_policy_glib.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@ extern "C" {
class TlsPolicyGlib {
public:

TlsPolicyGlib(tls_policy_glib_cleanup_func_t native_cleanup) : native_cleanup_(native_cleanup)
{
key_ = G_PRIVATE_INIT(native_cleanup_);
}
TlsPolicyGlib(tls_policy_glib_cleanup_func_t native_cleanup)
: key_((GPrivate)G_PRIVATE_INIT(native_cleanup))
{ }

#if defined HAVE_CXX_EXTERN_C_OVERLOAD && HAVE_CXX_EXTERN_C_OVERLOAD
TlsPolicyGlib(tls_policy_glib_cleanup_func_cpp_t native_cleanup) : native_cleanup_(native_cleanup)
{
key_ = G_PRIVATE_INIT(native_cleanup_);
}
TlsPolicyGlib(tls_policy_glib_cleanup_func_cpp_t native_cleanup)
: key_((GPrivate)G_PRIVATE_INIT(native_cleanup))
{ }
#endif

~TlsPolicyGlib()
Expand All @@ -78,7 +76,6 @@ class TlsPolicyGlib {
private:

mutable GPrivate key_;
tls_policy_glib_cleanup_func_t native_cleanup_; ///< may be NULL

TlsPolicyGlib(const TlsPolicyGlib&);
TlsPolicyGlib& operator= (const TlsPolicyGlib& from);
Expand Down

0 comments on commit bf9889c

Please sign in to comment.