From 1960e5c2782075fd6114439a33a859327dd07962 Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Thu, 11 Apr 2024 19:58:01 +1200 Subject: [PATCH 1/2] add stdio.h/stblib.h to includes function exit() is defined in stdlib.h[1]. The build fails with -Werror=implicit-function-declaration. [1] https://en.cppreference.com/w/c/program/exit --- opensshlib/configure.ac | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/opensshlib/configure.ac b/opensshlib/configure.ac index 3961df48..e8807ebe 100644 --- a/opensshlib/configure.ac +++ b/opensshlib/configure.ac @@ -1111,7 +1111,10 @@ mips-sony-bsd|mips-sony-newsos4) esac AC_MSG_CHECKING([compiler and flags for sanity]) -AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ exit(0); ]])], +AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +#include +]], [[ exit(0); ]])], [ AC_MSG_RESULT([yes]) ], [ AC_MSG_RESULT([no]) @@ -1349,6 +1352,7 @@ AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include +#include #include ]], [[ struct dirent d; @@ -1944,7 +1948,10 @@ AC_CHECK_FUNC([getpagesize], if test "x$ac_cv_func_snprintf" = "xyes" ; then AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) AC_RUN_IFELSE( - [AC_LANG_PROGRAM([[ #include ]], + [AC_LANG_PROGRAM([[ +#include +#include +]], [[ char b[5]; snprintf(b,5,"123456789"); @@ -2346,6 +2353,7 @@ if test "x$openssl" = "xyes" ; then AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include + #include #include #include #define DATA "conftest.sslincver" @@ -2380,6 +2388,7 @@ if test "x$openssl" = "xyes" ; then AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include + #include #include #define OPENSSL_API_COMPAT 0x10000000L #include @@ -3186,6 +3195,7 @@ if test -z "$have_llong_max"; then AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include +#include /* Why is this so damn hard? */ #ifdef __GNUC__ # undef __GNUC__ @@ -3644,6 +3654,7 @@ dnl test snprintf (broken on SCO w/gcc) AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include +#include #include #ifdef HAVE_SNPRINTF main() @@ -3701,6 +3712,7 @@ AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [sta [Define if we don't have struct __res_state in resolv.h])], [[ #include +#include #if HAVE_SYS_TYPES_H # include #endif @@ -3744,6 +3756,7 @@ AC_CACHE_CHECK([for msg_accrights field in struct msghdr], #include #include #include +#include ]], [[ #ifdef msg_accrights #error "msg_accrights is a macro" @@ -3804,6 +3817,7 @@ AC_CACHE_CHECK([for msg_control field in struct msghdr], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include +#include #include ]], [[ #ifdef msg_control @@ -3825,7 +3839,7 @@ if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then fi AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ extern char *__progname; printf("%s", __progname); ]])], [ ac_cv_libc_defines___progname="yes" ], [ ac_cv_libc_defines___progname="no" @@ -3897,7 +3911,7 @@ if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then fi AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])], [ ac_cv_libc_defines_sys_errlist="yes" ], [ ac_cv_libc_defines_sys_errlist="no" @@ -3910,7 +3924,7 @@ fi AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ extern int sys_nerr; printf("%i", sys_nerr);]])], [ ac_cv_libc_defines_sys_nerr="yes" ], [ ac_cv_libc_defines_sys_nerr="no" @@ -4220,6 +4234,7 @@ AC_ARG_WITH([maildir], AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include +#include #include #ifdef HAVE_PATHS_H #include @@ -4366,6 +4381,7 @@ if test -z "$disable_shadow" ; then AC_MSG_CHECKING([if the systems has expire shadow information]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include +#include #include struct spwd sp; ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])], @@ -4464,6 +4480,7 @@ otherwise scp will not work.]) [AC_LANG_PROGRAM([[ /* find out what STDPATH is */ #include +#include #ifdef HAVE_PATHS_H # include #endif From 8f627a8beaa4d2d61f691c18f76e6d25a51c81dc Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Mon, 15 Apr 2024 08:39:56 +1200 Subject: [PATCH 2/2] add unitstd to includes --- opensshlib/configure.ac | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/opensshlib/configure.ac b/opensshlib/configure.ac index e8807ebe..6b3be121 100644 --- a/opensshlib/configure.ac +++ b/opensshlib/configure.ac @@ -1853,6 +1853,9 @@ AC_CHECK_FUNCS([setresuid], [ AC_MSG_CHECKING([if setresuid seems to work]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ +#ifdef HAVE_UNISTD_H +#include +#endif #include #include ]], [[ @@ -1878,6 +1881,9 @@ AC_CHECK_FUNCS([setresgid], [ [AC_LANG_PROGRAM([[ #include #include +#ifdef HAVE_UNISTD_H +#include +#endif ]], [[ errno=0; setresgid(0,0,0); @@ -2042,6 +2048,9 @@ if test "x$ac_cv_func_mkdtemp" = "xyes" ; then AC_MSG_CHECKING([for (overly) strict mkstemp]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ +#ifdef HAVE_UNISTD_H +#include +#endif #include ]], [[ char template[]="conftest.mkstemp-test"; @@ -2070,6 +2079,13 @@ if test ! -z "$check_for_openpty_ctty_bug"; then AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_PTY_H +#include +#endif #include #include #include