[glib] build: Drop fallback checks for libmount versions without pkg-config



commit b716660fab3c4a9ce7b76ef6015294c16dd0fcad
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Feb 12 12:13:01 2018 +0000

    build: Drop fallback checks for libmount versions without pkg-config
    
    Building against libmount installed into a non-default prefix wasn’t
    working, as we were using #include <libmount/libmount.h> rather than
    the correct #include <libmount.h> — all the mount.pc pkg-config files
    set `Cflags: -I${includedir}/libmount`.
    
    Fixing this while retaining the fallback support for versions of
    libmount without a pkg-config file would have been tricky (we would need
    to work out a suitable -I flag to set in LIBMOUNT_CFLAGS) to still be
    able to use the correct #include path). Thankfully, libmount gained
    pkg-config support a long time ago, so I think we can safely drop the
    fallback code. In particular, Debian Jessie, Ubuntu Trusty, and CentOS 5
    all ship a mount.pc file.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=793288

 configure.ac      | 17 +----------------
 gio/gunixmounts.c |  2 +-
 meson.build       |  8 +-------
 3 files changed, 3 insertions(+), 24 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a4ceedbb1..694dee3bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1798,22 +1798,7 @@ AC_ARG_ENABLE(libmount,
                               [build with libmount support [default for Linux]])],,
               [enable_libmount=$enable_libmount_default])
 AS_IF([ test "x$enable_libmount" = "xyes"],[
-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])
-
-  # We used to check for mnt_unref_table(), but now for compat with
-  # e.g. RHEL7 just use mnt_free_table().  Let's keep this check
-  # anyways.
-  AC_CHECK_LIB([mount], [mnt_free_table], [:], [have_libmount=no])
-  LIBS=$glib_save_LIBS
-
-  if test $have_libmount != no; then
-    LIBMOUNT_LIBS=-lmount
-    have_libmount=yes
-  fi
-])
+PKG_CHECK_MODULES([LIBMOUNT], [mount >= 2.28], [have_libmount=yes], [have_libmount=no])
 if test $have_libmount = no ; then
    AC_MSG_ERROR([*** Could not find libmount])
 fi
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index add8e3f31..0035d57e7 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -159,7 +159,7 @@ static guint64 mount_poller_time = 0;
 #ifdef HAVE_MNTENT_H
 #include <mntent.h>
 #ifdef HAVE_LIBMOUNT
-#include <libmount/libmount.h>
+#include <libmount.h>
 #endif
 #elif defined (HAVE_SYS_MNTTAB_H)
 #include <sys/mnttab.h>
diff --git a/meson.build b/meson.build
index f42ecbbb6..3c0b63d02 100644
--- a/meson.build
+++ b/meson.build
@@ -1521,13 +1521,7 @@ xgettext = find_program('xgettext', required : false)
 # pkg-config file below
 libmount_dep = []
 if host_system == 'linux' and get_option('libmount')
-  libmount_dep = [dependency('mount', version : '>=2.28', required : false)]
-  if not libmount_dep[0].found()
-    libmount_dep = [cc.find_library('mount', required : true)]
-    if not cc.has_header('libmount/libmount.h')
-      error('libmount support needs libmount/libmount.h header')
-    endif
-  endif
+  libmount_dep = [dependency('mount', version : '>=2.28', required : true)]
 endif
 
 if host_system == 'windows'


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