[glib/wip/msanchez/libmount: 1/8] Added autotools support for libmount



commit fe4a82d7299a3c6be349c4356a84f5a39fdda79f
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Tue May 17 20:14:20 2016 +0100

    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.

 configure.ac    |   24 ++++++++++++++++++++++++
 gio/Makefile.am |    5 +++++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1dc8045..1710573 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1728,6 +1728,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 ****************************************
diff --git a/gio/Makefile.am b/gio/Makefile.am
index e911d91..718c923 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -534,6 +534,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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]