diff --git a/ChangeLog b/ChangeLog index 457fe3129..a83650057 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2016-06-21 Riccardo Mottola + + * Source/NSWorkspace.m + * configure.ac + * configure + Explicitely check for statfs/statvfs flags member. + 2016-06-16 Ivan Vucica * ANNOUNCE: diff --git a/Headers/Additions/GNUstepGUI/config.h.in b/Headers/Additions/GNUstepGUI/config.h.in index 221cfc0c6..8f1fa7fee 100644 --- a/Headers/Additions/GNUstepGUI/config.h.in +++ b/Headers/Additions/GNUstepGUI/config.h.in @@ -27,7 +27,7 @@ /* Define to 1 if you have the `GifQuantizeBuffer' function. */ #undef HAVE_GIFQUANTIZEBUFFER -/* Have ImageMagick */ +/* Don't have ImageMagick */ #undef HAVE_IMAGEMAGICK /* Define to 1 if you have the header file. */ @@ -84,6 +84,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SNDFILE_H +/* Define to 1 if you have the `statvfs' function. */ +#undef HAVE_STATVFS + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -96,6 +99,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if `f_flags' is a member of `struct statfs'. */ +#undef HAVE_STRUCT_STATFS_F_FLAGS + +/* Define to 1 if `f_flag' is a member of `struct statvfs'. */ +#undef HAVE_STRUCT_STATVFS_F_FLAG + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MNTENT_H diff --git a/Source/NSWorkspace.m b/Source/NSWorkspace.m index 4a2ba55be..cc617e3d4 100644 --- a/Source/NSWorkspace.m +++ b/Source/NSWorkspace.m @@ -1210,7 +1210,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath non-standard f_basetype field, which provides the name of the underlying file system type. */ -#if (defined (__NetBSD__) && __NetBSD_Version__ >= 300000000) || (defined(__sun__) && defined(__svr4__)) +#if (defined (__NetBSD__) && defined (HAVE_STATVFS)) || (defined(__sun__) && defined(__svr4__)) #define statfs statvfs #define f_flags f_flag #endif @@ -1228,8 +1228,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath *removableFlag = YES; *writableFlag = 1; - // FIXME TODO maybe we need an explicit configure check for f_flags -#if !defined(__GNU__) +#if defined(HAVE_STRUCT_STATFS_F_FLAGS) || defined(HAVE_STRUCT_STATVFS_F_FLAG) *writableFlag = (m.f_flags & ST_RDONLY) == 0; #endif *unmountableFlag = NO; diff --git a/configure b/configure index 3e87b5094..4711ecb71 100755 --- a/configure +++ b/configure @@ -4036,6 +4036,17 @@ _ACEOF fi done +for ac_func in statvfs +do : + ac_fn_c_check_func "$LINENO" "statvfs" "ac_cv_func_statvfs" +if test "x$ac_cv_func_statvfs" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STATVFS 1 +_ACEOF + +fi +done + for ac_header in sys/statvfs.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/statvfs.h" "ac_cv_header_sys_statvfs_h" "$ac_includes_default" @@ -4061,6 +4072,44 @@ fi done +ac_fn_c_check_member "$LINENO" "struct statfs" "f_flags" "ac_cv_member_struct_statfs_f_flags" " +#if defined(HAVE_GETMNTINFO) +#include +#include +#endif +#if defined (HAVE_SYS_STATVFS_H) +#include +#endif +#if defined (HAVE_SYS_VFS_H) +#include +#endif + +" +if test "x$ac_cv_member_struct_statfs_f_flags" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STATFS_F_FLAGS 1 +_ACEOF + + +fi + +ac_fn_c_check_member "$LINENO" "struct statvfs" "f_flag" "ac_cv_member_struct_statvfs_f_flag" " +#if defined (HAVE_SYS_STATVFS_H) +#include +#endif + +" +if test "x$ac_cv_member_struct_statvfs_f_flag" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STATVFS_F_FLAG 1 +_ACEOF + + +fi + + #-------------------------------------------------------------------- # Simple way to add a bunch of paths to the flags #-------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index ba7facf65..3f1342d2f 100644 --- a/configure.ac +++ b/configure.ac @@ -155,9 +155,28 @@ AC_CHECK_MEMBER(struct mntent.mnt_dir,[AC_DEFINE(MNT_MEMB,mnt_dir,mntent structu AC_CHECK_MEMBER(struct mntent.mnt_mountp,[AC_DEFINE(MNT_MEMB,mnt_mountp,mntent structure member name)],,[#include ]) AC_FUNC_GETMNTENT AC_CHECK_FUNCS(getmntinfo) +AC_CHECK_FUNCS(statvfs) AC_CHECK_HEADERS(sys/statvfs.h) AC_CHECK_HEADERS(sys/vfs.h) +AC_CHECK_MEMBERS([struct statfs.f_flags],[],[],[ +#if defined(HAVE_GETMNTINFO) +#include +#include +#endif +#if defined (HAVE_SYS_STATVFS_H) +#include +#endif +#if defined (HAVE_SYS_VFS_H) +#include +#endif +]) +AC_CHECK_MEMBERS([struct statvfs.f_flag],[],[],[ +#if defined (HAVE_SYS_STATVFS_H) +#include +#endif +]) + #-------------------------------------------------------------------- # Simple way to add a bunch of paths to the flags #--------------------------------------------------------------------