From 5f57935678613334bfa18ee547cb1f22a3a0a7dd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 18 Aug 2006 18:36:04 +0000 Subject: Add support for NetBSD 3.0. * src/stat.c (USE_STATVFS): Set to 1 if 'struct statvfs' has a field f_fstypename. (STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME): Define also if 'struct statvfs' has a field f_fstypename. This undoes the 2006-08-15 to src/stat.c. * lib/mountlist.c [MOUNTED_GETMNTINFO2]: Include sys/statvfs.h. (ME_DUMMY): Treat "kernfs" as a dummy. (read_file_system_list) [MOUNTED_GETMNTINFO2]: Implement. * m4/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Also check for sys/statvfs.h. When getmntinfo was found, check its declaration and set either MOUNTED_GETMNTINFO or MOUNTED_GETMNTINFO2 depending on it. * m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Test also for f_fstypename in struct statvfs. --- m4/ChangeLog | 8 ++++++++ m4/ls-mntd-fs.m4 | 38 ++++++++++++++++++++++++++++++++------ m4/stat-prog.m4 | 5 +++-- 3 files changed, 43 insertions(+), 8 deletions(-) (limited to 'm4') diff --git a/m4/ChangeLog b/m4/ChangeLog index 6bf97c912..a531c6665 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,11 @@ +2006-08-18 Bruno Haible + + * ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Also check for + sys/statvfs.h. When getmntinfo was found, check its declaration and + set either MOUNTED_GETMNTINFO or MOUNTED_GETMNTINFO2 depending on it. + * stat-prog.m4 (cu_PREREQ_STAT_PROG): Test also for f_fstypename + in struct statvfs. + 2006-08-18 Jim Meyering * gethrxtime.m4 (gl_PREREQ_GETHRXTIME): Also check for CLOCK_REALTIME, diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4 index a4c808907..c29933162 100644 --- a/m4/ls-mntd-fs.m4 +++ b/m4/ls-mntd-fs.m4 @@ -1,4 +1,4 @@ -#serial 21 +#serial 22 # How to list mounted file systems. # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software @@ -28,7 +28,7 @@ AC_CHECK_FUNCS(getmntent) AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS], [ AC_CHECK_FUNCS(listmntent getmntinfo) -AC_CHECK_HEADERS_ONCE(sys/param.h) +AC_CHECK_HEADERS_ONCE(sys/param.h sys/statvfs.h) # We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses # NGROUPS (as the array dimension for a struct member) without a definition. @@ -232,10 +232,36 @@ if test -z "$ac_list_mounted_fs"; then ]) AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo) if test $fu_cv_sys_mounted_getmntinfo = yes; then - ac_list_mounted_fs=found - AC_DEFINE(MOUNTED_GETMNTINFO, 1, - [Define if there is a function named getmntinfo for reading the - list of mounted file systems. (4.4BSD, Darwin)]) + AC_MSG_CHECKING([whether getmntinfo returns statvfs structures]) + AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo2, + [ + AC_TRY_COMPILE([ +#include +#if HAVE_SYS_MOUNT_H +# include +#endif +#if HAVE_SYS_STATVFS_H +# include +#endif +extern int getmntinfo (struct statfs **, int); + ], [], + [fu_cv_sys_mounted_getmntinfo2=no], + [fu_cv_sys_mounted_getmntinfo2=yes]) + ]) + AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo2]) + if test $fu_cv_sys_mounted_getmntinfo2 = no; then + ac_list_mounted_fs=found + AC_DEFINE(MOUNTED_GETMNTINFO, 1, + [Define if there is a function named getmntinfo for reading the + list of mounted file systems and it returns an array of + 'struct statfs'. (4.4BSD, Darwin)]) + else + ac_list_mounted_fs=found + AC_DEFINE(MOUNTED_GETMNTINFO2, 1, + [Define if there is a function named getmntinfo for reading the + list of mounted file systems and it returns an array of + 'struct statvfs'. (NetBSD 3.0)]) + fi fi fi diff --git a/m4/stat-prog.m4 b/m4/stat-prog.m4 index 489ed7558..4505f54a3 100644 --- a/m4/stat-prog.m4 +++ b/m4/stat-prog.m4 @@ -1,7 +1,7 @@ -# stat-prog.m4 serial 2 +# stat-prog.m4 serial 3 # Record the prerequisites of src/stat.c from the coreutils package. -# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -60,6 +60,7 @@ $ac_includes_default AC_CHECK_MEMBERS([struct statfs.f_basetype],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statvfs.f_basetype],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$statxfs_includes]) + AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statfs.f_type],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statvfs.f_type],,,[$statxfs_includes]) AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,,[$statxfs_includes]) -- cgit v1.2.3-54-g00ecf