Rely on gnulib for strerror() if necessary.

* bootstrap.conf: Add "strerror" to `gnulib_modules`.

* configure.ac: Drop "sterror" from `AC_REPLACE_FUNCS`; we don't need
  Autoconf's replacement if we've got gnulib's.

* Makefile.am: Drop mention of function/macro in comment.

* src/include/lib.h: Drop C preprocessor conditional logic.

* src/roff/groff/pipeline.c: Drop fallback definition.  Let existing
  "<config.h"> inclusion do the work, and include "<string.h>"
  unconditionally.
This commit is contained in:
G. Branden Robinson 2024-11-29 23:53:01 -06:00
parent 4186c2bb27
commit 949b091c22
6 changed files with 16 additions and 10 deletions

View File

@ -1,3 +1,16 @@
2024-11-29 G. Branden Robinson <g.branden.robinson@gmail.com>
Rely on gnulib for `strerror()` if necessary.
* bootstrap.conf: Add "strerror" to `gnulib_modules`.
* configure.ac: Drop "sterror" from `AC_REPLACE_FUNCS`; we don't
need Autoconf's replacement if we've got gnulib's.
* Makefile.am: Drop mention of function/macro in comment.
* src/include/lib.h: Drop C preprocessor conditional logic.
* src/roff/groff/pipeline.c: Drop fallback definition. Let
existing "<config.h"> inclusion do the work, and include
"<string.h>" unconditionally.
2024-11-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[troff]: Align with modern groff conventions.

View File

@ -307,7 +307,6 @@ man7dir=$(manroot)/man$(man7ext)
# HAVE_SETLOCALE if you have setlocale()
# HAVE_STRCASECMP if you have strcasecmp()
# HAVE_STRNCASECMP if you have strncasecmp()
# HAVE_STRERROR if you have strerror()
# HAVE_STRSEP if you have strsep()
# HAVE_STRTOL if you have strtol()
# HAVE_SYMLINK if you have symlink()

View File

@ -49,6 +49,7 @@ gnulib_modules="
stdbool-c99
stdckdint
stdint
strerror
sys_wait
"

View File

@ -130,7 +130,7 @@ AC_FUNC_MMAP
saved_libs="$LIBS"
LIBS="$LIBS $LIBC $LIBM"
AC_REPLACE_FUNCS([fmod getcwd putenv strcasecmp \
strerror strncasecmp strtol])
strncasecmp strtol])
LIBS="$saved_libs"
AC_CHECK_FUNCS([gettimeofday isatty kill rename setlocale strdup \
strsep])

View File

@ -25,9 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HAVE_STRERROR
char *strerror(int);
#endif
const char *i_to_a(int);
const char *ui_to_a(unsigned int);

View File

@ -25,15 +25,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
#include <string.h> // strerror(), strsignal()
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STRERROR
#include <string.h>
#else
extern char *strerror();
#endif
#ifdef _POSIX_VERSION