[pacman-dev] [PATCH 3/3] diskspace: add the actually used statfs type in ifdefs

Dan McGee dpmcgee at gmail.com
Sat Apr 2 14:27:28 EDT 2011


On Fri, Apr 1, 2011 at 5:36 PM, Rémy Oudompheng
<remyoudompheng at gmail.com> wrote:
> Some systems, like FreeBSD might define both statfs
> and statvfs: however if statvfs exists whereas getmntinfo()
> uses a statfs struct, the current ifdefs would select the wrong
> line of code.
>
> Signed-off-by: Rémy Oudompheng <remy at archlinux.org>
> ---
>  acinclude.m4            |    8 ++++++--
>  lib/libalpm/diskspace.c |    4 ++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index 7309d73..1e51e92 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -115,8 +115,12 @@ AC_DEFUN([FS_STATS_TYPE],
>  extern int getmntinfo (struct statfs **, int);
>  ]],
>           [])],
> -        [fs_stats_cv_type="struct statfs"],
> -        [fs_stats_cv_type="struct statvfs"])],
> +        [fs_stats_cv_type="struct statfs"
> +         AC_DEFINE([HAVE_GETMNTINFO_STATFS], 1, [Define if getmntinfo() uses statfs.])
> +        ],
> +        [fs_stats_cv_type="struct statvfs"
> +         AC_DEFINE([HAVE_GETMNTINFO_STATVFS], 1, [Define if getmntinfo() uses statvfs.])
> +        ])],
>       [AC_CHECK_FUNC(getmntent,
>         [fs_stats_cv_type="struct statvfs"])]
>     )]
> diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
> index 281173a..066107d 100644
> --- a/lib/libalpm/diskspace.c
> +++ b/lib/libalpm/diskspace.c
> @@ -112,9 +112,9 @@ static alpm_list_t *mount_point_list(void)
>                mp->mount_dir = strdup(fsp->f_mntonname);
>                mp->mount_dir_len = strlen(mp->mount_dir);
>                memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
> -#if defined HAVE_STRUCT_STATVFS_F_FLAG
> +#if defined(HAVE_GETMNTINFO_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_FLAG)
>                mp->read_only = fsp->f_flag & ST_RDONLY;
> -#elif defined HAVE_STRUCT_STATFS_F_FLAGS
> +#elif defined(HAVE_GETMNTINFO_STATFS) && defined(HAVE_STRUCT_STATFS_F_FLAGS)
>                mp->read_only = fsp->f_flags & MNT_RDONLY;
>  #endif

configure.ac:196: warning: AC_CACHE_VAL(fs_stats_cv_type, ...):
suspicious presence of an AC_DEFINE in the second argument, where no
actions should be taken
../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from...
acinclude.m4:105: FS_STATS_TYPE is expanded from...
configure.ac:196: the top level
 cd . && /bin/sh /home/dmcgee/projects/pacman-maint/missing --run
automake-1.11 --foreign
configure.ac:196: warning: AC_CACHE_VAL(fs_stats_cv_type, ...):
suspicious presence of an AC_DEFINE in the second argument, where no
actions should be taken
../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from...
acinclude.m4:105: FS_STATS_TYPE is expanded from...
configure.ac:196: the top level
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh
/home/dmcgee/projects/pacman-maint/missing --run autoconf
configure.ac:196: warning: AC_CACHE_VAL(fs_stats_cv_type, ...):
suspicious presence of an AC_DEFINE in the second argument, where no
actions should be taken
../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from...
acinclude.m4:105: FS_STATS_TYPE is expanded from...
configure.ac:196: the top level


More information about the pacman-dev mailing list