changeset 17898:e116e136cebd

mountlist: only use libmount when specified libmount can propagate device IDs provided by Linux in /proc/self/mountinfo. However there are currently many shared libs dependencies introduced by libmount with associated runtime and virt mem overhead. Therefore don't enable by default. * m4/ls-mntd-fs.m4: Use --with-libmount to enable at build time. Note the ac_cv_lib_libmount_mnt_table_parse_stream cache variable had a typo and so was ineffective, thus there is no backwards compatibility issue.
author Pádraig Brady <P@draigBrady.com>
date Tue, 20 Jan 2015 01:40:54 +0000
parents e36b50feede9
children 28409c0a2a56
files ChangeLog m4/ls-mntd-fs.m4
diffstat 2 files changed, 24 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-02-11  Pádraig Brady  <P@draigBrady.com>
+
+	mountlist: only use libmount when specified
+	There are currently many shared libs dependencies introduced by
+	libmount with associated runtime and virt mem overhead.
+	Therefore don't enable by default.
+	* m4/ls-mntd-fs.m4: Use --with-libmount to enable at build time.
+
 2015-02-08  Daiki Ueno  <ueno@gnu.org>
 
 	uniname/unimame-tests: don't link with -lunistring
--- a/m4/ls-mntd-fs.m4
+++ b/m4/ls-mntd-fs.m4
@@ -153,17 +153,23 @@
          (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
       AC_CHECK_FUNCS([hasmntopt])
 
+      AC_ARG_WITH([libmount],
+        [AS_HELP_STRING([--with-libmount],
+          [use libmount if available to parse the system mount list.])],
+        [],
+        dnl libmount has the advantage of propagating accurate device IDs for
+        dnl each entry, but the disadvantage of many dependent shared libs
+        dnl with associated runtime startup overhead and virt mem usage.
+        [with_libmount=no])
+
       # Check for libmount to support /proc/self/mountinfo on Linux
-      AC_CACHE_VAL([ac_cv_lib_libmount_mnt_table_parse_stream],
-        [AC_CHECK_LIB([mount], [mnt_new_table_from_file],
-          ac_cv_lib_mount_mnt_table_parse_stream=yes,
-          ac_cv_lib_mount_mnt_table_parse_stream=no)])
-      if test $ac_cv_lib_mount_mnt_table_parse_stream = yes; then
-         AC_DEFINE([MOUNTED_PROC_MOUNTINFO], [1],
-           [Define if want to use /proc/self/mountinfo on Linux.])
-         LIBS="-lmount $LIBS"
-      elif test -f /proc/self/mountinfo; then
-         AC_MSG_WARN([/proc/self/mountinfo present but libmount is missing.])
+      if test "x$with_libmount" != xno; then
+        AC_CHECK_LIB([mount], [mnt_new_table_from_file],
+           [AC_DEFINE([MOUNTED_PROC_MOUNTINFO], [1],
+             [Define if want to use /proc/self/mountinfo on Linux.])
+            LIBS="-lmount $LIBS"],
+           [test -f /proc/self/mountinfo &&
+             AC_MSG_WARN([/proc/self/mountinfo present but libmount missing.])])
       fi
     fi
   fi