(jm_LIST_MOUNTED_FILESYSTEMS): Add a compile-test
authorJim Meyering <jim@meyering.net>
Sun, 23 Sep 2001 09:19:42 +0000 (09:19 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 23 Sep 2001 09:19:42 +0000 (09:19 +0000)
instead of the mere test for existence of mntent.h.  The latter
would get a false-positive on AIX 3.4 systems.

m4/ls-mntd-fs.m4

index 541ea66..58a9db5 100644 (file)
@@ -60,9 +60,23 @@ if test $ac_cv_func_getmntent = yes; then
     # 4.3BSD, SunOS, HP-UX, Dynix, Irix
     AC_MSG_CHECKING([for one-argument getmntent function])
     AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
-                [test $ac_cv_header_mntent_h = yes \
-                  && fu_cv_sys_mounted_getmntent1=yes \
-                  || fu_cv_sys_mounted_getmntent1=no])
+                [AC_TRY_COMPILE([
+#include <mntent.h>
+#if !defined MOUNTED
+# if defined _PATH_MOUNTED     /* GNU libc  */
+#  define MOUNTED _PATH_MOUNTED
+# endif
+# if defined MNT_MNTTAB        /* HP-UX.  */
+#  define MOUNTED MNT_MNTTAB
+# endif
+# if defined MNTTABNAME        /* Dynix.  */
+#  define MOUNTED MNTTABNAME
+# endif
+#endif
+],
+                    [ struct mntent *mnt = 0; char *table = MOUNTED; ],
+                   fu_cv_sys_mounted_getmntent1=yes,
+                   fu_cv_sys_mounted_getmntent1=no)])
     AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
     if test $fu_cv_sys_mounted_getmntent1 = yes; then
       ac_list_mounted_fs=found