.
[gnulib.git] / m4 / ls-mntd-fs.m4
index a1d271d..1920622 100644 (file)
@@ -1,21 +1,17 @@
-#serial 4
+#serial 8
 
 dnl From Jim Meyering.
 dnl
 dnl This is not pretty.  I've just taken the autoconf code and wrapped
 dnl it in an AC_DEFUN.
 dnl
-dnl CAUTION: This is very fragile.  It relies on several checks that
-dnl are still in fileutils' configure.in:
-dnl FIXME: add AC_REQUIRE uses to pull in all definitions required
-dnl for all uses of $ac_cv_func_* and $ac_cv_header_* variables below.
-dnl
-
-AC_PREREQ(2.14a)
 
 # jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
 AC_DEFUN(jm_LIST_MOUNTED_FILESYSTEMS,
   [
+AC_CHECK_FUNCS(listmntent getmntent getmntinfo)
+AC_CHECK_HEADERS(mntent.h)
+
 # Determine how to get the list of mounted filesystems.
 ac_list_mounted_fs=
 
@@ -180,8 +176,6 @@ if test -z "$ac_list_mounted_fs"; then
   fi
 fi
 
-# FIXME: add a test for netbsd-1.1 here
-
 if test -z "$ac_list_mounted_fs"; then
   # Ultrix
   AC_MSG_CHECKING([for getmnt function])
@@ -202,15 +196,20 @@ fi
 
 if test -z "$ac_list_mounted_fs"; then
   # BeOS
-  AC_MSG_CHECKING([for next_dev function])
-  AC_CACHE_VAL(fu_cv_sys_mounted_next_dev,
-    [AC_TRY_CPP([#include <fs_info.h>],
-       fu_cv_sys_mounted_next_dev=yes,
-       fu_cv_sys_mounted_next_dev=no)])
-  AC_MSG_RESULT($fu_cv_sys_mounted_next_dev)
-  if test $fu_cv_sys_mounted_next_dev = yes; then
+  AC_CHECK_FUNCS(next_dev fs_stat_dev)
+  AC_CHECK_HEADERS(fs_info.h)
+  AC_MSG_CHECKING([for BEOS mounted file system support functions])
+  if test $ac_cv_header_fs_info_h = yes \
+      && test $ac_cv_func_next_dev = yes \
+       && test $ac_cv_func_fs_stat_dev = yes; then
+    fu_result=yes
+  else
+    fu_result=no
+  fi
+  AC_MSG_RESULT($fu_result)
+  if test $fu_result = yes; then
     ac_list_mounted_fs=found
-    AC_DEFINE(MOUNTED_NEXT_DEV, 1,
+    AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
       [Define if there are functions named next_dev and fs_stat_dev for
    reading the list of mounted filesystems.  (BeOS)])
   fi
@@ -238,6 +237,11 @@ if test -z "$ac_list_mounted_fs"; then
   # Can't build mountlist.c or anything that needs its functions
 fi
 
-AC_SHELL_IFELSE([test $ac_list_mounted_fs = found], [$1], [$2])dnl
+dnl FIXME: this should use AS_IF.
+if test $ac_list_mounted_fs = found; then
+$1
+else
+$2
+fi
 
   ])