lobase

Linux port of OpenBSDs userland.
Log | Files | Refs | README

commit 31f0970ad6c2a7f1b3ba6e0493ff2df44888f5fb
parent ac6721edcc59d588731a5e43156e46b01377ca47
Author: Duncaen <mail@duncano.de>
Date:   Thu, 25 May 2017 21:10:14 +0200

configure: add checks for sys_siglist and sys_signame

Diffstat:
config.h.in | 8++++++++
config.mk.in | 2++
configure | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 6++++++
include/signal.h | 15++++++++++++++-
5 files changed, 114 insertions(+), 1 deletion(-)

diff --git a/config.h.in b/config.h.in @@ -3,6 +3,14 @@ /* Define to 1 if your system has a working `chown' function. */ #undef HAVE_CHOWN +/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you + don't. */ +#undef HAVE_DECL_SYS_SIGLIST + +/* Define to 1 if you have the declaration of `sys_signame', and to 0 if you + don't. */ +#undef HAVE_DECL_SYS_SIGNAME + /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H diff --git a/config.mk.in b/config.mk.in @@ -31,4 +31,6 @@ HAVE_FGETLN=@HAVE_FGETLN@ HAVE_GETENTROPY=@HAVE_GETENTROPY@ HAVE_EXPLICIT_BZERO=@HAVE_EXPLICIT_BZERO@ HAVE_REALLOCARRAY=@HAVE_REALLOCARRAY@ +HAVE_SYS_SIGLIST=@HAVE_SYS_SIGLIST@ +HAVE_SYS_SIGNAME=@HAVE_SYS_SIGNAME@ endif diff --git a/configure b/configure @@ -624,6 +624,8 @@ ac_includes_default="\ ac_header_list= ac_subst_vars='LTLIBOBJS +HAVE_SYS_SIGNAME +HAVE_SYS_SIGLIST HAVE_REALLOCARRAY HAVE_EXPLICIT_BZERO HAVE_GETENTROPY @@ -1888,6 +1890,52 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -4903,6 +4951,34 @@ fi done +ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" " +#include <signal.h> + +" +if test "x$ac_cv_have_decl_sys_siglist" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SYS_SIGLIST $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "sys_signame" "ac_cv_have_decl_sys_signame" " +#include <signal.h> + +" +if test "x$ac_cv_have_decl_sys_signame" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SYS_SIGNAME $ac_have_decl +_ACEOF + + # AC_SUBST(HAVE_STRLCAT, "$have_strlcat") # AC_SUBST(HAVE_STRLCPY, "$have_strlcpy") # AC_SUBST(HAVE_GETENTROPY, "$have_getentropy") @@ -4932,6 +5008,14 @@ if test "x$ac_cv_func_reallocarray" = "xyes"; then : HAVE_REALLOCARRAY=1 fi +if test "x$ac_cv_have_decl_sys_siglist" = "xyes"; then : + HAVE_SYS_SIGLIST=1 + +fi +if test "x$ac_cv_have_decl_sys_signame" = "xyes"; then : + HAVE_SYS_SIGNAME=1 + +fi cat >>confdefs.h <<_ACEOF diff --git a/configure.ac b/configure.ac @@ -41,6 +41,10 @@ AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_FUNC_MMAP AC_CHECK_FUNCS([strlcpy strlcat dl_iterate_phdr getentropy strptime issetugid fgetln reallocarray explicit_bzero getdtablecount]) +AC_CHECK_DECLS([sys_siglist, sys_signame], [], [], [ +#include <signal.h> +]) + # AC_SUBST(HAVE_STRLCAT, "$have_strlcat") # AC_SUBST(HAVE_STRLCPY, "$have_strlcpy") # AC_SUBST(HAVE_GETENTROPY, "$have_getentropy") @@ -52,6 +56,8 @@ AS_IF([test "x$ac_cv_func_strlcpy" = "xyes"],[AC_SUBST(HAVE_STRLCPY, 1)],[]) AS_IF([test "x$ac_cv_func_getentropy" = "xyes"],[AC_SUBST(HAVE_GETENTROPY, 1)],[]) AS_IF([test "x$ac_cv_func_explicit_bzero" = "xyes"],[AC_SUBST(HAVE_EXPLICIT_BZERO, 1)],[]) AS_IF([test "x$ac_cv_func_reallocarray" = "xyes"],[AC_SUBST(HAVE_REALLOCARRAY, 1)],[]) +AS_IF([test "x$ac_cv_have_decl_sys_siglist" = "xyes"],[AC_SUBST(HAVE_SYS_SIGLIST, 1)],[]) +AS_IF([test "x$ac_cv_have_decl_sys_signame" = "xyes"],[AC_SUBST(HAVE_SYS_SIGNAME, 1)],[]) AC_DEFINE_UNQUOTED([_PATH_TTY], ["/dev/tty"], [Path to tty.]) AC_DEFINE_UNQUOTED([_PATH_UUCPLOCK], ["/var/spool/lock"], [Serial device lock file path.]) diff --git a/include/signal.h b/include/signal.h @@ -5,7 +5,20 @@ #define SIGINFO SIGUSR1 -extern const char *const sys_signame[_NSIG]; +#ifndef _NSIG +# ifdef NSIG +# define _NSIG NSIG +# else +# define _NSIG 128 +# endif +#endif + +#if !HAVE_DECL_SYS_SIGLIST extern const char *const sys_siglist[_NSIG]; +#endif /* !HAVE_DECL_SYS_SIGLIST */ + +#if !HAVE_DECL_SYS_SIGNAME +extern const char *const sys_signame[_NSIG]; +#endif /* !HAVE_DECL_SYS_SIGNAME */ #endif /* _COMPAT_SIGNAL_H_ */