3 dnl Copyright (C) 2008-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 AC_DEFUN([gl_FUNC_STRSIGNAL],
10 dnl Persuade glibc <string.h> to declare strsignal().
11 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
13 AC_REQUIRE([gl_STRING_H_DEFAULTS])
14 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
16 AC_CHECK_DECLS_ONCE([strsignal])
17 if test $ac_cv_have_decl_strsignal = no; then
21 AC_CHECK_FUNCS([strsignal])
22 if test $ac_cv_func_strsignal = yes; then
24 dnl Check if strsignal behaves reasonably for out-of-range signal numbers.
25 dnl On Solaris it returns NULL; on AIX 5.1 it returns (char *) -1.
26 AC_CACHE_CHECK([whether strsignal always returns a string],
27 [gl_cv_func_working_strsignal],
31 #include <unistd.h> /* NetBSD 5.0 declares it in wrong header. */
34 char *s = strsignal (-1);
41 [gl_cv_func_working_strsignal=yes],
42 [gl_cv_func_working_strsignal=no],
44 solaris* | aix*) gl_cv_func_working_strsignal=no;;
45 *) gl_cv_func_working_strsignal="guessing yes";;
47 if test "$gl_cv_func_working_strsignal" = no; then
55 # Prerequisites of lib/strsignal.c.
56 AC_DEFUN([gl_PREREQ_STRSIGNAL], [
57 AC_CHECK_HEADERS_ONCE([unistd.h])
58 AC_CHECK_DECLS([sys_siglist], [], [], [[#include <signal.h>]])
59 AC_CHECK_DECLS([_sys_siglist], [], [], [[#include <signal.h>]])