From: Bruno Haible Date: Fri, 21 Mar 2025 10:46:43 +0000 (+0100) Subject: mountlist: Replace a configure-time error with a compile-time error. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=ea4258f5d942c5fdd4f805ba7875ad6dee2654b0;p=gnulib.git mountlist: Replace a configure-time error with a compile-time error. Reported by Yury V. Zaytsev in . * m4/mountlist.m4 (gl_MOUNTLIST): Instead of aborting the configuration, define MOUNTED_NOT_PORTED. * lib/mountlist.c (read_file_system_list): Err out if MOUNTED_NOT_PORTED is defined. * modules/mountlist (configure.ac, Makefile.am): Compile mountlist.c on all platforms. --- diff --git a/ChangeLog b/ChangeLog index 1d681ea6e2..6cd99afd0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2025-03-21 Bruno Haible + + mountlist: Replace a configure-time error with a compile-time error. + Reported by Yury V. Zaytsev in + . + * m4/mountlist.m4 (gl_MOUNTLIST): Instead of aborting the configuration, + define MOUNTED_NOT_PORTED. + * lib/mountlist.c (read_file_system_list): Err out if MOUNTED_NOT_PORTED + is defined. + * modules/mountlist (configure.ac, Makefile.am): Compile mountlist.c on + all platforms. + 2025-03-21 Bruno Haible setlocale-null: Fix autoconf warning. diff --git a/lib/mountlist.c b/lib/mountlist.c index 2ed4b138ba..d52d4ffca7 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -1096,7 +1096,7 @@ read_file_system_list (bool need_fs_type) } #endif /* MOUNTED_INTERIX_STATVFS */ -#if defined _WIN32 && !defined __CYGWIN__ +#if defined _WIN32 && !defined __CYGWIN__ /* native Windows */ /* Don't assume that UNICODE is not defined. */ # undef GetDriveType # define GetDriveType GetDriveTypeA @@ -1287,6 +1287,10 @@ read_file_system_list (bool need_fs_type) } #endif +#if MOUNTED_NOT_PORTED +# error "Please port gnulib mountlist.c to your platform!" +#endif + *mtail = NULL; return mount_list; diff --git a/m4/mountlist.m4 b/m4/mountlist.m4 index 0b8e3f1da2..e7eac2e9ed 100644 --- a/m4/mountlist.m4 +++ b/m4/mountlist.m4 @@ -1,5 +1,5 @@ # mountlist.m4 -# serial 17 +# serial 18 dnl Copyright (C) 2002-2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -325,12 +325,11 @@ int getmntinfo (struct statfs **, int); fi if test -z "$ac_list_mounted_fs"; then - AC_MSG_ERROR([could not determine how to read list of mounted file systems]) - # FIXME -- no need to abort building the whole package - # Can't build mountlist.c or anything that needs its functions + AC_DEFINE([MOUNTED_NOT_PORTED], [1], + [Define if we don't know how to determine the list of mounted file systems.]) fi - if test $ac_list_mounted_fs = found; then + if test "$ac_list_mounted_fs" = found; then gl_cv_list_mounted_fs=yes else gl_cv_list_mounted_fs=no diff --git a/modules/mountlist b/modules/mountlist index 016ff2dd6f..b4acef36e6 100644 --- a/modules/mountlist +++ b/modules/mountlist @@ -20,15 +20,10 @@ xalloc configure.ac: gl_MOUNTLIST -gl_CONDITIONAL([GL_COND_OBJ_MOUNTLIST], [test $gl_cv_list_mounted_fs = yes]) -AM_COND_IF([GL_COND_OBJ_MOUNTLIST], [ - gl_PREREQ_MOUNTLIST_EXTRA -]) +gl_PREREQ_MOUNTLIST_EXTRA Makefile.am: -if GL_COND_OBJ_MOUNTLIST lib_SOURCES += mountlist.c -endif Include: "mountlist.h"