1 # strsignal.m4 serial 8
2 dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_FUNC_STRSIGNAL],
9 dnl Persuade glibc <string.h> to declare strsignal().
10 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
12 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
13 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
15 AC_CHECK_DECLS_ONCE([strsignal])
16 if test $ac_cv_have_decl_strsignal = no; then
20 AC_CHECK_FUNCS([strsignal])
21 if test $ac_cv_func_strsignal = yes; then
23 dnl Check if strsignal behaves reasonably for out-of-range signal numbers.
24 dnl On Solaris it returns NULL; on AIX 5.1 it returns (char *) -1.
25 AC_CACHE_CHECK([whether strsignal always returns a string],
26 [gl_cv_func_working_strsignal],
30 #include <unistd.h> /* NetBSD 5.0 declares it in wrong header. */
33 char *s = strsignal (-1);
40 [gl_cv_func_working_strsignal=yes],
41 [gl_cv_func_working_strsignal=no],
43 solaris* | aix*) gl_cv_func_working_strsignal=no;;
44 *) gl_cv_func_working_strsignal="guessing yes";;
46 if test "$gl_cv_func_working_strsignal" = no; then
54 # Prerequisites of lib/strsignal.c.
55 AC_DEFUN([gl_PREREQ_STRSIGNAL], [
56 AC_CHECK_HEADERS_ONCE([unistd.h])
57 AC_REQUIRE([AC_DECL_SYS_SIGLIST])
58 AC_CHECK_DECLS([_sys_siglist], [], [], [[#include <signal.h>]])