Added autotools support for libmount

Check whether libmount is available at configuration time and provide
an option to explicitly enable or disable it, similar to libelf.

https://bugzilla.gnome.org/show_bug.cgi?id=522053
This commit is contained in:
Mario Sanchez Prada 2016-05-17 20:14:20 +01:00
parent 496c52ec79
commit 4f9cddaeb8
2 changed files with 29 additions and 0 deletions

View File

@ -1730,6 +1730,30 @@ if test x$have_libelf = xyes; then
AC_DEFINE(HAVE_LIBELF, 1, [Define if libelf is available])
fi
dnl ************************
dnl *** check for libmount ***
dnl ************************
AC_ARG_ENABLE(mount,
AS_HELP_STRING([--disable-libmount], [build without libmount support]))
AS_IF([ test "x$enable_libmount" != "xno"],[
PKG_CHECK_MODULES([LIBMOUNT], [mount >= 2.28], [have_libmount=yes], [have_libmount=maybe])
AS_IF([ test $have_libmount = maybe ], [
glib_save_LIBS=$LIBS
AC_CHECK_HEADER([libmount/libmount.h], [:], [have_libmount=no])
LIBS=$glib_save_LIBS
if test $have_libmount != no; then
LIBMOUNT_LIBS=-lmount
have_libmount=yes
fi
])
])
if test x$have_libmount = xyes; then
AC_DEFINE(HAVE_LIBMOUNT, 1, [Define if libmount is available])
fi
AM_CONDITIONAL(HAVE_LIBMOUNT, [test x$have_libmount = xyes])
dnl ****************************************
dnl *** platform dependent source checks ***
dnl ****************************************

View File

@ -586,6 +586,11 @@ libgio_2_0_la_CFLAGS += -xobjective-c
libgio_2_0_la_LDFLAGS += -Wl,-framework,Foundation -Wl,-framework,AppKit
endif
if HAVE_LIBMOUNT
libgio_2_0_la_CFLAGS += $(LIBMOUNT_CFLAGS)
libgio_2_0_la_LIBADD += $(LIBMOUNT_LIBS)
endif
libgio_2_0_la_DEPENDENCIES = $(gio_win32_res) $(gio_def) $(platform_deps)
gio-win32-res.o: gio.rc