Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | From 1b70b7a798eeeec554ab5aa9fcfff96a22e91774 Mon Sep 17 00:00:00 2001 |
| 2 | From: Gustavo Sverzut Barbieri <barbieri@profusion.mobi> |
| 3 | Date: Thu, 26 May 2011 17:30:04 -0300 |
| 4 | Subject: [PATCH] Allow disabling atasmart, lvm2 and devicemapper support. |
| 5 | |
| 6 | https://bugs.freedesktop.org/show_bug.cgi?id=37647 |
| 7 | |
| 8 | diff --git a/configure.ac b/configure.ac |
| 9 | index 62cc35d..b664135 100644 |
| 10 | --- a/configure.ac |
| 11 | +++ b/configure.ac |
| 12 | @@ -155,13 +155,33 @@ PKG_CHECK_MODULES(POLKIT_GOBJECT_1, [polkit-gobject-1 >= 0.97]) |
| 13 | AC_SUBST(POLKIT_GOBJECT_1_CFLAGS) |
| 14 | AC_SUBST(POLKIT_GOBJECT_1_LIBS) |
| 15 | |
| 16 | -PKG_CHECK_MODULES(LIBPARTED, [libparted >= 1.8.8]) |
| 17 | -AC_SUBST(LIBPARTED_CFLAGS) |
| 18 | -AC_SUBST(LIBPARTED_LIBS) |
| 19 | - |
| 20 | -PKG_CHECK_MODULES(DEVMAPPER, [devmapper >= 1.02]) |
| 21 | -AC_SUBST(DEVMAPPER_CFLAGS) |
| 22 | -AC_SUBST(DEVMAPPER_LIBS) |
| 23 | +have_parted=no |
| 24 | +AC_ARG_ENABLE(parted, AS_HELP_STRING([--disable-parted], [disable disk partitioning])) |
| 25 | +if test "x$enable_parted" != "xno"; then |
| 26 | + PKG_CHECK_MODULES(LIBPARTED, [libparted >= 1.8.8], |
| 27 | + [AC_DEFINE(USE_PARTED, 1, [Define if parted should be used]) have_parted=yes], |
| 28 | + have_parted=no) |
| 29 | + AC_SUBST(LIBPARTED_CFLAGS) |
| 30 | + AC_SUBST(LIBPARTED_LIBS) |
| 31 | + if test "x$have_parted" = xno -a "x$enable_parted" = xyes; then |
| 32 | + AC_MSG_ERROR([parted support requested but libraries not found]) |
| 33 | + fi |
| 34 | +fi |
| 35 | +AM_CONDITIONAL(HAVE_PARTED, [test "$have_parted" = "yes"]) |
| 36 | + |
| 37 | +have_devmapper=no |
| 38 | +AC_ARG_ENABLE(devmapper, AS_HELP_STRING([--disable-devmapper], [disable device mapper support])) |
| 39 | +if test "x$enable_devmapper" != "xno"; then |
| 40 | + PKG_CHECK_MODULES(DEVMAPPER, [devmapper >= 1.02], |
| 41 | + [AC_DEFINE(HAVE_DEVMAPPER, 1, [Define if device mapper is available]) have_devmapper=yes], |
| 42 | + have_devmapper=no) |
| 43 | + AC_SUBST(DEVMAPPER_CFLAGS) |
| 44 | + AC_SUBST(DEVMAPPER_LIBS) |
| 45 | + if test "x$have_devmapper" = xno -a "x$enable_devmapper" = xyes; then |
| 46 | + AC_MSG_ERROR([devmapper support requested but libraries not found]) |
| 47 | + fi |
| 48 | +fi |
| 49 | +AM_CONDITIONAL(HAVE_DEVMAPPER, [test "$have_devmapper" = "yes"]) |
| 50 | |
| 51 | have_lvm2=no |
| 52 | AC_ARG_ENABLE(lvm2, AS_HELP_STRING([--disable-lvm2], [disable LVM2 support])) |
| 53 | @@ -185,9 +205,19 @@ if test "x$enable_dmmp" != "xno"; then |
| 54 | fi |
| 55 | AM_CONDITIONAL(HAVE_DMMP, [test "$have_dmmp" = "yes"]) |
| 56 | |
| 57 | -PKG_CHECK_MODULES(LIBATASMART, [libatasmart >= 0.14]) |
| 58 | -AC_SUBST(LIBATASMART_CFLAGS) |
| 59 | -AC_SUBST(LIBATASMART_LIBS) |
| 60 | +have_libatasmart=no |
| 61 | +AC_ARG_ENABLE(libatasmart, AS_HELP_STRING([--disable-libatasmart], [disable libatasmart support])) |
| 62 | +if test "x$enable_libatasmart" != "xno"; then |
| 63 | + PKG_CHECK_MODULES(LIBATASMART, [libatasmart >= 0.14], |
| 64 | + [AC_DEFINE(HAVE_LIBATASMART, 1, [Define if libatasmart is available]) have_libatasmart=yes], |
| 65 | + have_libatasmart=no) |
| 66 | + AC_SUBST(LIBATASMART_CFLAGS) |
| 67 | + AC_SUBST(LIBATASMART_LIBS) |
| 68 | + if test "x$have_libatasmart" = xno -a "x$enable_libatasmart" = xyes; then |
| 69 | + AC_MSG_ERROR([libatasmart support requested but libraries not found]) |
| 70 | + fi |
| 71 | +fi |
| 72 | +AM_CONDITIONAL(HAVE_LIBATASMART, [test "$have_libatasmart" = "yes"]) |
| 73 | |
| 74 | PKG_CHECK_MODULES(LIBUDEV, [libudev >= 143]) |
| 75 | AC_SUBST(LIBUDEV_CFLAGS) |
| 76 | @@ -267,9 +297,12 @@ echo " |
| 77 | cppflags: ${CPPFLAGS} |
| 78 | xsltproc: ${XSLTPROC} |
| 79 | |
| 80 | + Parted support: ${have_parted} |
| 81 | + Device Mapper support: ${have_devmapper} |
| 82 | LVM2 support: ${have_lvm2} |
| 83 | dm-multipath: ${have_dmmp} |
| 84 | Remote Access: ${remote_access} |
| 85 | + libatasmart support: ${have_libatasmart} |
| 86 | |
| 87 | Maintainer mode: ${USE_MAINTAINER_MODE} |
| 88 | Profiling: ${enable_profiling} |
| 89 | diff --git a/src/adapter-private.h b/src/adapter-private.h |
| 90 | index 3409e21..ef584e3 100644 |
| 91 | --- a/src/adapter-private.h |
| 92 | +++ b/src/adapter-private.h |
| 93 | @@ -23,7 +23,6 @@ |
| 94 | |
| 95 | #include <dbus/dbus-glib.h> |
| 96 | #include <gudev/gudev.h> |
| 97 | -#include <atasmart.h> |
| 98 | |
| 99 | #include "types.h" |
| 100 | |
| 101 | diff --git a/src/adapter.c b/src/adapter.c |
| 102 | index b85a0ef..802420b 100644 |
| 103 | --- a/src/adapter.c |
| 104 | +++ b/src/adapter.c |
| 105 | @@ -30,7 +30,6 @@ |
| 106 | #include <dbus/dbus-glib.h> |
| 107 | #include <dbus/dbus-glib-lowlevel.h> |
| 108 | #include <gudev/gudev.h> |
| 109 | -#include <atasmart.h> |
| 110 | |
| 111 | #include "daemon.h" |
| 112 | #include "adapter.h" |
| 113 | diff --git a/src/daemon.c b/src/daemon.c |
| 114 | index 6072502..d043cb0 100644 |
| 115 | --- a/src/daemon.c |
| 116 | +++ b/src/daemon.c |
| 117 | @@ -1745,6 +1745,7 @@ mdstat_changed_event (GIOChannel *channel, |
| 118 | return TRUE; |
| 119 | } |
| 120 | |
| 121 | +#ifdef HAVE_LIBATASMART |
| 122 | static gboolean |
| 123 | refresh_ata_smart_data (Daemon *daemon) |
| 124 | { |
| 125 | @@ -1773,6 +1774,7 @@ refresh_ata_smart_data (Daemon *daemon) |
| 126 | |
| 127 | return FALSE; |
| 128 | } |
| 129 | +#endif |
| 130 | |
| 131 | static gboolean |
| 132 | register_disks_daemon (Daemon *daemon) |
| 133 | @@ -1984,12 +1986,14 @@ daemon_new (void) |
| 134 | mount_file_clean_stale (l); |
| 135 | g_list_free (l); |
| 136 | |
| 137 | +#ifdef HAVE_LIBATASMART |
| 138 | /* set up timer for refreshing ATA SMART data - we don't want to refresh immediately because |
| 139 | * when adding a device we also do this... |
| 140 | */ |
| 141 | daemon->priv->ata_smart_refresh_timer_id = g_timeout_add_seconds (ATA_SMART_REFRESH_INTERVAL_SECONDS, |
| 142 | (GSourceFunc) refresh_ata_smart_data, |
| 143 | daemon); |
| 144 | +#endif |
| 145 | |
| 146 | PROFILE ("daemon_new(): end"); |
| 147 | return daemon; |
| 148 | diff --git a/src/device-private.c b/src/device-private.c |
| 149 | index 22a0d35..fb96525 100644 |
| 150 | --- a/src/device-private.c |
| 151 | +++ b/src/device-private.c |
| 152 | @@ -1378,7 +1378,7 @@ device_set_drive_ata_smart_time_collected (Device *device, |
| 153 | |
| 154 | void |
| 155 | device_set_drive_ata_smart_status (Device *device, |
| 156 | - SkSmartOverall value) |
| 157 | + guint value) |
| 158 | { |
| 159 | if (G_UNLIKELY (device->priv->drive_ata_smart_status != value)) |
| 160 | { |
| 161 | diff --git a/src/device-private.h b/src/device-private.h |
| 162 | index a6db7f2..71473a6 100644 |
| 163 | --- a/src/device-private.h |
| 164 | +++ b/src/device-private.h |
| 165 | @@ -23,7 +23,6 @@ |
| 166 | |
| 167 | #include <dbus/dbus-glib.h> |
| 168 | #include <gudev/gudev.h> |
| 169 | -#include <atasmart.h> |
| 170 | |
| 171 | #include "types.h" |
| 172 | |
| 173 | @@ -224,7 +223,7 @@ struct DevicePrivate |
| 174 | |
| 175 | gboolean drive_ata_smart_is_available; |
| 176 | guint64 drive_ata_smart_time_collected; |
| 177 | - SkSmartOverall drive_ata_smart_status; |
| 178 | + guint drive_ata_smart_status; |
| 179 | void *drive_ata_smart_blob; |
| 180 | gsize drive_ata_smart_blob_size; |
| 181 | |
| 182 | @@ -391,7 +390,7 @@ void device_set_holders_objpath (Device *device, GStrv value); |
| 183 | |
| 184 | void device_set_drive_ata_smart_is_available (Device *device, gboolean value); |
| 185 | void device_set_drive_ata_smart_time_collected (Device *device, guint64 value); |
| 186 | -void device_set_drive_ata_smart_status (Device *device, SkSmartOverall value); |
| 187 | +void device_set_drive_ata_smart_status (Device *device, guint value); |
| 188 | void device_set_drive_ata_smart_blob_steal (Device *device, gchar *blob, gsize blob_size); |
| 189 | |
| 190 | G_END_DECLS |
| 191 | diff --git a/src/device.c b/src/device.c |
| 192 | index 6a34940..7a5a4a9 100644 |
| 193 | --- a/src/device.c |
| 194 | +++ b/src/device.c |
| 195 | @@ -50,7 +50,9 @@ |
| 196 | #include <dbus/dbus-glib.h> |
| 197 | #include <dbus/dbus-glib-lowlevel.h> |
| 198 | #include <gudev/gudev.h> |
| 199 | +#ifdef HAVE_LIBATASMART |
| 200 | #include <atasmart.h> |
| 201 | +#endif |
| 202 | |
| 203 | #include "daemon.h" |
| 204 | #include "device.h" |
| 205 | @@ -659,10 +661,14 @@ get_property (GObject *object, |
| 206 | case PROP_DRIVE_ATA_SMART_STATUS: |
| 207 | { |
| 208 | const gchar *status; |
| 209 | - if (device->priv->drive_ata_smart_status == (SkSmartOverall) - 1) |
| 210 | +#ifdef HAVE_LIBATASMART |
| 211 | + if (device->priv->drive_ata_smart_status == (guint) - 1) |
| 212 | status = ""; |
| 213 | else |
| 214 | status = sk_smart_overall_to_string (device->priv->drive_ata_smart_status); |
| 215 | +#else |
| 216 | + status = ""; |
| 217 | +#endif |
| 218 | g_value_set_string (value, status); |
| 219 | } |
| 220 | break; |
| 221 | @@ -5114,6 +5120,7 @@ device_new (Daemon *daemon, |
| 222 | goto out; |
| 223 | } |
| 224 | |
| 225 | +#ifdef HAVE_LIBATASMART |
| 226 | /* if just added, update the smart data if applicable */ |
| 227 | if (device->priv->drive_ata_smart_is_available) |
| 228 | { |
| 229 | @@ -5121,6 +5128,7 @@ device_new (Daemon *daemon, |
| 230 | gchar *ata_smart_refresh_data_options[] = { NULL }; |
| 231 | device_drive_ata_smart_refresh_data (device, ata_smart_refresh_data_options, NULL); |
| 232 | } |
| 233 | +#endif |
| 234 | |
| 235 | PROFILE ("device_new(native_path=%s): end", native_path); |
| 236 | out: |
| 237 | @@ -9794,16 +9802,18 @@ drive_ata_smart_refresh_data_completed_cb (DBusGMethodInvocation *context, |
| 238 | const char *stdout, |
| 239 | gpointer user_data) |
| 240 | { |
| 241 | +#ifdef HAVE_LIBATASMART |
| 242 | gint rc; |
| 243 | - SkDisk *d; |
| 244 | + SkDisk *d = NULL; |
| 245 | + SkSmartOverall overall; |
| 246 | gchar *blob; |
| 247 | gsize blob_size; |
| 248 | time_t time_collected; |
| 249 | - SkSmartOverall overall; |
| 250 | +#endif |
| 251 | |
| 252 | PROFILE ("drive_ata_smart_refresh_data_completed_cb(device=%s) start", device->priv->native_path); |
| 253 | |
| 254 | - d = NULL; |
| 255 | +#ifdef HAVE_LIBATASMART |
| 256 | blob = NULL; |
| 257 | |
| 258 | if (job_was_cancelled || stdout == NULL) |
| 259 | @@ -9907,6 +9917,11 @@ drive_ata_smart_refresh_data_completed_cb (DBusGMethodInvocation *context, |
| 260 | g_free (blob); |
| 261 | if (d != NULL) |
| 262 | sk_disk_free (d); |
| 263 | + |
| 264 | +#else |
| 265 | + throw_error (context, ERROR_FAILED, "libatasmart support disabled"); |
| 266 | +#endif |
| 267 | + |
| 268 | PROFILE ("drive_ata_smart_refresh_data_completed_cb(device=%s) end", device->priv->native_path); |
| 269 | } |
| 270 | |
| 271 | diff --git a/src/expander-private.h b/src/expander-private.h |
| 272 | index ef4f440..98a8300 100644 |
| 273 | --- a/src/expander-private.h |
| 274 | +++ b/src/expander-private.h |
| 275 | @@ -23,7 +23,6 @@ |
| 276 | |
| 277 | #include <dbus/dbus-glib.h> |
| 278 | #include <gudev/gudev.h> |
| 279 | -#include <atasmart.h> |
| 280 | |
| 281 | #include "types.h" |
| 282 | |
| 283 | diff --git a/src/expander.c b/src/expander.c |
| 284 | index 734ec0a..e799f13 100644 |
| 285 | --- a/src/expander.c |
| 286 | +++ b/src/expander.c |
| 287 | @@ -34,7 +34,6 @@ |
| 288 | #include <dbus/dbus-glib.h> |
| 289 | #include <dbus/dbus-glib-lowlevel.h> |
| 290 | #include <gudev/gudev.h> |
| 291 | -#include <atasmart.h> |
| 292 | #include <stdlib.h> |
| 293 | |
| 294 | #include "daemon.h" |
| 295 | diff --git a/src/helpers/Makefile.am b/src/helpers/Makefile.am |
| 296 | index 4b863c0..d3ec4e9 100644 |
| 297 | --- a/src/helpers/Makefile.am |
| 298 | +++ b/src/helpers/Makefile.am |
| 299 | @@ -19,15 +19,9 @@ INCLUDES = \ |
| 300 | |
| 301 | libexec_PROGRAMS = \ |
| 302 | udisks-helper-mkfs \ |
| 303 | - udisks-helper-delete-partition \ |
| 304 | - udisks-helper-create-partition \ |
| 305 | - udisks-helper-modify-partition \ |
| 306 | - udisks-helper-create-partition-table \ |
| 307 | udisks-helper-change-filesystem-label \ |
| 308 | udisks-helper-linux-md-remove-component \ |
| 309 | udisks-helper-fstab-mounter \ |
| 310 | - udisks-helper-ata-smart-collect \ |
| 311 | - udisks-helper-ata-smart-selftest \ |
| 312 | udisks-helper-drive-detach \ |
| 313 | udisks-helper-drive-poll \ |
| 314 | udisks-helper-linux-md-check \ |
| 315 | @@ -48,6 +42,13 @@ udisks_helper_mkfs_SOURCES = job-shared.h job-mkfs.c |
| 316 | udisks_helper_mkfs_CPPFLAGS = $(AM_CPPFLAGS) |
| 317 | udisks_helper_mkfs_LDADD = $(GLIB_LIBS) |
| 318 | |
| 319 | +if HAVE_PARTED |
| 320 | +libexec_PROGRAMS += \ |
| 321 | + udisks-helper-delete-partition \ |
| 322 | + udisks-helper-create-partition \ |
| 323 | + udisks-helper-modify-partition \ |
| 324 | + udisks-helper-create-partition-table |
| 325 | + |
| 326 | udisks_helper_delete_partition_SOURCES = job-shared.h job-delete-partition.c |
| 327 | udisks_helper_delete_partition_CPPFLAGS = $(AM_CPPFLAGS) |
| 328 | udisks_helper_delete_partition_LDADD = $(GLIB_LIBS) libpartutil.la |
| 329 | @@ -63,11 +64,17 @@ udisks_helper_modify_partition_LDADD = $(GLIB_LIBS) libpartutil.la |
| 330 | udisks_helper_create_partition_table_SOURCES = job-shared.h job-create-partition-table.c |
| 331 | udisks_helper_create_partition_table_CPPFLAGS = $(AM_CPPFLAGS) |
| 332 | udisks_helper_create_partition_table_LDADD = $(GLIB_LIBS) libpartutil.la |
| 333 | +endif |
| 334 | |
| 335 | udisks_helper_change_filesystem_label_SOURCES = job-shared.h job-change-filesystem-label.c |
| 336 | udisks_helper_change_filesystem_label_CPPFLAGS = $(AM_CPPFLAGS) |
| 337 | udisks_helper_change_filesystem_label_LDADD = $(GLIB_LIBS) |
| 338 | |
| 339 | +if HAVE_LIBATASMART |
| 340 | +libexec_PROGRAMS += \ |
| 341 | + udisks-helper-ata-smart-collect \ |
| 342 | + udisks-helper-ata-smart-selftest |
| 343 | + |
| 344 | udisks_helper_ata_smart_selftest_SOURCES = job-shared.h job-ata-smart-selftest.c |
| 345 | udisks_helper_ata_smart_selftest_CPPFLAGS = $(AM_CPPFLAGS) $(LIBATASMART_CFLAGS) $(GLIB_CFLAGS) |
| 346 | udisks_helper_ata_smart_selftest_LDADD = $(LIBATASMART_LIBS) $(GLIB_LIBS) |
| 347 | @@ -75,6 +82,7 @@ udisks_helper_ata_smart_selftest_LDADD = $(LIBATASMART_LIBS) $(GLIB_LIBS) |
| 348 | udisks_helper_ata_smart_collect_SOURCES = job-ata-smart-collect.c |
| 349 | udisks_helper_ata_smart_collect_CPPFLAGS = $(AM_CPPFLAGS) $(LIBATASMART_CFLAGS) $(GLIB_CFLAGS) |
| 350 | udisks_helper_ata_smart_collect_LDADD = $(LIBATASMART_LIBS) $(GLIB_LIBS) |
| 351 | +endif |
| 352 | |
| 353 | udisks_helper_linux_md_remove_component_SOURCES = job-shared.h job-linux-md-remove-component.c |
| 354 | udisks_helper_linux_md_remove_component_CPPFLAGS = $(AM_CPPFLAGS) |
| 355 | diff --git a/src/helpers/partutil.c b/src/helpers/partutil.c |
| 356 | index 72a8fe3..8893a39 100644 |
| 357 | --- a/src/helpers/partutil.c |
| 358 | +++ b/src/helpers/partutil.c |
| 359 | @@ -62,7 +62,6 @@ DEBUG (const gchar *format, |
| 360 | # include <config.h> |
| 361 | #endif |
| 362 | |
| 363 | -#define USE_PARTED |
| 364 | #ifdef USE_PARTED |
| 365 | #include <parted/parted.h> |
| 366 | #endif |
| 367 | @@ -928,6 +927,7 @@ part_table_parse_apple (int fd, |
| 368 | return p; |
| 369 | } |
| 370 | |
| 371 | +#ifdef USE_PARTED |
| 372 | static PartitionTable * |
| 373 | part_table_load_from_disk_from_file (char *device_file) |
| 374 | { |
| 375 | @@ -948,6 +948,7 @@ part_table_load_from_disk_from_file (char *device_file) |
| 376 | out: |
| 377 | return ret; |
| 378 | } |
| 379 | +#endif |
| 380 | |
| 381 | PartitionTable * |
| 382 | part_table_load_from_disk (int fd) |
| 383 | diff --git a/src/port-private.h b/src/port-private.h |
| 384 | index cc48376..a91532f 100644 |
| 385 | --- a/src/port-private.h |
| 386 | +++ b/src/port-private.h |
| 387 | @@ -23,7 +23,6 @@ |
| 388 | |
| 389 | #include <dbus/dbus-glib.h> |
| 390 | #include <gudev/gudev.h> |
| 391 | -#include <atasmart.h> |
| 392 | |
| 393 | #include "types.h" |
| 394 | |
| 395 | diff --git a/src/probers/Makefile.am b/src/probers/Makefile.am |
| 396 | index 06bb566..01c693b 100644 |
| 397 | --- a/src/probers/Makefile.am |
| 398 | +++ b/src/probers/Makefile.am |
| 399 | @@ -22,8 +22,6 @@ INCLUDES = \ |
| 400 | |
| 401 | udevhelperdir = $(slashlibdir)/udev |
| 402 | udevhelper_PROGRAMS = udisks-part-id \ |
| 403 | - udisks-dm-export \ |
| 404 | - udisks-probe-ata-smart \ |
| 405 | udisks-probe-sas-expander \ |
| 406 | $(NULL) |
| 407 | |
| 408 | @@ -35,17 +33,23 @@ udisks_part_id_SOURCES = part-id.c |
| 409 | udisks_part_id_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUDEV_CFLAGS) |
| 410 | udisks_part_id_LDADD = $(GLIB_LIBS) $(LIBUDEV_LIBS) $(top_builddir)/src/helpers/libpartutil.la |
| 411 | |
| 412 | +if HAVE_DEVMAPPER |
| 413 | +udevhelper_PROGRAMS += udisks-dm-export |
| 414 | udisks_dm_export_SOURCES = udisks-dm-export.c |
| 415 | udisks_dm_export_CPPFLAGS = $(AM_CPPFLAGS) $(DEVMAPPER_CFLAGS) $(GLIB_CFLAGS) |
| 416 | udisks_dm_export_LDADD = $(DEVMAPPER_LIBS) $(GLIB_LIBS) |
| 417 | +endif |
| 418 | |
| 419 | udisks_lvm_pv_export_SOURCES = udisks-lvm-pv-export.c |
| 420 | udisks_lvm_pv_export_CPPFLAGS = $(AM_CPPFLAGS) $(DEVMAPPER_CFLAGS) $(LVM2_CFLAGS) $(GLIB_CFLAGS) |
| 421 | udisks_lvm_pv_export_LDADD = $(DEVMAPPER_LIBS) $(LVM2_LIBS) $(GLIB_LIBS) |
| 422 | |
| 423 | +if HAVE_LIBATASMART |
| 424 | +udevhelper_PROGRAMS += udisks-probe-ata-smart |
| 425 | udisks_probe_ata_smart_SOURCES = udisks-probe-ata-smart.c |
| 426 | udisks_probe_ata_smart_CPPFLAGS = $(AM_CPPFLAGS) $(LIBATASMART_CFLAGS) |
| 427 | udisks_probe_ata_smart_LDADD = $(LIBATASMART_LIBS) |
| 428 | +endif |
| 429 | |
| 430 | udisks_probe_sas_expander_SOURCES = udisks-probe-sas-expander.c |
| 431 | udisks_probe_sas_expander_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) |
| 432 | diff --git a/tools/udisks.c b/tools/udisks.c |
| 433 | index 6fbd6a6..e0c4fbb 100644 |
| 434 | --- a/tools/udisks.c |
| 435 | +++ b/tools/udisks.c |
| 436 | @@ -43,7 +43,9 @@ |
| 437 | #include <dbus/dbus-glib.h> |
| 438 | #include <dbus/dbus-glib-lowlevel.h> |
| 439 | |
| 440 | +#ifdef HAVE_LIBATASMART |
| 441 | #include <atasmart.h> |
| 442 | +#endif |
| 443 | |
| 444 | #include "udisks-daemon-glue.h" |
| 445 | #include "udisks-device-glue.h" |
| 446 | @@ -979,6 +981,7 @@ end_highlight (void) |
| 447 | g_print ("\x1B[0m"); |
| 448 | } |
| 449 | |
| 450 | +#ifdef HAVE_LIBATASMART |
| 451 | static const gchar * |
| 452 | ata_smart_status_to_desc (const gchar *status, |
| 453 | gboolean *out_highlight) |
| 454 | @@ -1159,6 +1162,7 @@ print_ata_smart_attr (SkDisk *d, |
| 455 | g_free (threshold_str); |
| 456 | g_free (pretty); |
| 457 | } |
| 458 | +#endif |
| 459 | |
| 460 | static void |
| 461 | do_show_info (const char *object_path) |
| 462 | @@ -1440,7 +1444,7 @@ do_show_info (const char *object_path) |
| 463 | g_print (" if speed: %" G_GINT64_FORMAT " bits/s\n", props->drive_connection_speed); |
| 464 | |
| 465 | /* ------------------------------------------------------------------------------------------------- */ |
| 466 | - |
| 467 | +#ifdef HAVE_LIBATASMART |
| 468 | if (!props->drive_ata_smart_is_available) |
| 469 | { |
| 470 | g_print (" ATA SMART: not available\n"); |
| 471 | @@ -1493,7 +1497,9 @@ do_show_info (const char *object_path) |
| 472 | } |
| 473 | |
| 474 | } |
| 475 | - |
| 476 | +#else |
| 477 | + g_print (" ATA SMART: not supported\n"); |
| 478 | +#endif |
| 479 | /* ------------------------------------------------------------------------------------------------- */ |
| 480 | |
| 481 | } |
| 482 | -- |
| 483 | 1.7.5.rc3 |
| 484 | |