diff --git a/config.h.in b/config.h.in index 02885f980..8ed7fb241 100644 --- a/config.h.in +++ b/config.h.in @@ -155,6 +155,10 @@ don't. */ #undef HAVE_DECL_LLONG_MIN +/* Define to 1 if you have the declaration of 'NSIG', and to 0 if you don't. + */ +#undef HAVE_DECL_NSIG + /* Define to 1 if you have the declaration of 'PATH_MAX', and to 0 if you don't. */ #undef HAVE_DECL_PATH_MAX @@ -231,6 +235,10 @@ don't. */ #undef HAVE_DECL__INNETGR +/* Define to 1 if you have the declaration of '_NSIG', and to 0 if you don't. + */ +#undef HAVE_DECL__NSIG + /* Define to 1 if you have the declaration of '_POSIX_PATH_MAX', and to 0 if you don't. */ #undef HAVE_DECL__POSIX_PATH_MAX @@ -243,6 +251,10 @@ don't. */ #undef HAVE_DECL__SYS_SIGNAME +/* Define to 1 if you have the declaration of '__NSIG', and to 0 if you don't. + */ +#undef HAVE_DECL___NSIG + /* Define to 1 if you have the 'devname' function. */ #undef HAVE_DEVNAME diff --git a/configure b/configure index 2f4cd9c83..1902feb44 100755 --- a/configure +++ b/configure @@ -27654,6 +27654,65 @@ case "$enable_zlib" in ;; esac +ac_fn_check_decl "$LINENO" "NSIG" "ac_cv_have_decl_NSIG" " +$ac_includes_default +#include + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_NSIG" = xyes +then : + ac_have_decl=1 +else case e in #( + e) ac_have_decl=0 ;; +esac +fi +printf "%s\n" "#define HAVE_DECL_NSIG $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + +else case e in #( + e) + ac_fn_check_decl "$LINENO" "_NSIG" "ac_cv_have_decl__NSIG" " +$ac_includes_default +#include + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl__NSIG" = xyes +then : + ac_have_decl=1 +else case e in #( + e) ac_have_decl=0 ;; +esac +fi +printf "%s\n" "#define HAVE_DECL__NSIG $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + +else case e in #( + e) + ac_fn_check_decl "$LINENO" "__NSIG" "ac_cv_have_decl___NSIG" " +$ac_includes_default +#include + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl___NSIG" = xyes +then : + ac_have_decl=1 +else case e in #( + e) ac_have_decl=0 ;; +esac +fi +printf "%s\n" "#define HAVE_DECL___NSIG $ac_have_decl" >>confdefs.h + + ;; +esac +fi + + ;; +esac +fi + + ac_fn_check_decl "$LINENO" "errno" "ac_cv_have_decl_errno" " $ac_includes_default #include diff --git a/configure.ac b/configure.ac index a556f5afd..5d1fbe0ef 100644 --- a/configure.ac +++ b/configure.ac @@ -3282,6 +3282,24 @@ case "$enable_zlib" in ;; esac +dnl +dnl Check for NSIG, _NSIG or __NSIG declarations in signal.h +dnl +AC_CHECK_DECLS([NSIG], [], [ + AC_CHECK_DECLS([_NSIG], [], [ + AC_CHECK_DECLS([__NSIG], [], [], [ +AC_INCLUDES_DEFAULT +#include + ]) + ], [ +AC_INCLUDES_DEFAULT +#include + ]) +], [ +AC_INCLUDES_DEFAULT +#include +]) + dnl dnl Check for errno declaration in errno.h dnl diff --git a/include/sudo_compat.h b/include/sudo_compat.h index edf609ea8..f5639dfc8 100644 --- a/include/sudo_compat.h +++ b/include/sudo_compat.h @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: ISC * - * Copyright (c) 1996, 1998-2005, 2008, 2009-2022 + * Copyright (c) 1996, 1998-2005, 2008, 2009-2023 * Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any @@ -205,10 +205,10 @@ extern int errno; #endif /* !HAVE_DECL_ERRNO */ /* Not all systems define NSIG in signal.h */ -#if !defined(NSIG) -# if defined(_NSIG) +#if !defined(HAVE_DECL_NSIG) || !HAVE_DECL_NSIG +# if defined(HAVE_DECL__NSIG) && HAVE_DECL__NSIG # define NSIG _NSIG -# elif defined(__NSIG) +# elif defined(HAVE_DECL___NSIG) && HAVE_DECL___NSIG # define NSIG __NSIG # else # define NSIG 64