From: Michael Olbrich Subject: make sgutils2 dependency optional This patch adds a configure option for sgutils2. When disabled, the helper program using it will not be built. Signed-off-by: Michael Olbrich --- configure.ac | 23 ++++++++++++++--------- src/helpers/Makefile.am | 5 ++++- 2 files changed, 18 insertions(+), 10 deletions(-) Index: b/configure.ac =================================================================== --- a/configure.ac +++ b/configure.ac @@ -120,15 +120,20 @@ if test "x$GCC" = "xyes"; then changequote([,])dnl fi -have_sgutils="false" -AC_CHECK_LIB([sgutils2], [sg_ll_inquiry], have_sgutils="true") -if test x$have_sgutils != "xtrue"; then - AC_MSG_ERROR([libsgutils2 is needed]) -fi -SGUTILS_CFLAGS="" -SGUTILS_LIBS="-lsgutils2" -AC_SUBST(SGUTILS_CFLAGS) -AC_SUBST(SGUTILS_LIBS) +AC_ARG_ENABLE(sgutils2, [ --disable-sgutils2],enable_sgutils2=$enableval,enable_sgutils2=yes) + +if test "x$enable_sgutils2" = xyes; then + have_sgutils="false" + AC_CHECK_LIB([sgutils2], [sg_ll_inquiry], have_sgutils="true") + if test x$have_sgutils != "xtrue"; then + AC_MSG_ERROR([libsgutils2 is needed]) + fi + SGUTILS_CFLAGS="" + SGUTILS_LIBS="-lsgutils2" + AC_SUBST(SGUTILS_CFLAGS) + AC_SUBST(SGUTILS_LIBS) +fi +AM_CONDITIONAL(SGUTILS2_ENABLED, test "x$enable_sgutils2" = xyes) PKG_CHECK_MODULES(GUDEV, [gudev-1.0 >= 147]) Index: b/src/helpers/Makefile.am =================================================================== --- a/src/helpers/Makefile.am +++ b/src/helpers/Makefile.am @@ -28,12 +28,15 @@ libexec_PROGRAMS = \ udisks-helper-fstab-mounter \ udisks-helper-ata-smart-collect \ udisks-helper-ata-smart-selftest \ - udisks-helper-drive-detach \ udisks-helper-drive-poll \ udisks-helper-linux-md-check \ udisks-helper-drive-benchmark \ $(NULL) +if SGUTILS2_ENABLED +libexec_PROGRAMS += udisks-helper-drive-detach +endif + noinst_LTLIBRARIES = libpartutil.la libpartutil_la_SOURCES = partutil.h partutil.c libpartutil_la_CPPFLAGS = $(LIBPARTED_CFLAGS)