From 9c4648db2857c300cfd3bd96b8916401587377aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Fri, 30 Jun 2023 02:19:09 +0200 Subject: [PATCH] Add detection and, if necessary, prototype for strlcat and strlcpy. This resolves FTBFS - see issue TDE/tde-packaging-gentoo#299. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit c69b585fbe2bd59567358767e95789ccad43469e) --- ConfigureChecks.cmake | 9 +++++++++ config.h.cmake | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 244a6e48a..455fcab01 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -387,6 +387,15 @@ if( BUILD_TDEIOSLAVES OR BUILD_KSYSGUARD ) endif( ) +# strlcat, strlcpy +if( BUILD_KSYSGUARD OR BUILD_KCHECKPASS ) + check_function_exists( strlcat HAVE_STRLCAT ) + check_symbol_exists( strlcat "string.h" HAVE_STRLCAT_PROTO ) + check_function_exists( strlcpy HAVE_STRLCPY ) + check_symbol_exists( strlcpy "string.h" HAVE_STRLCPY_PROTO ) +endif( ) + + # getifaddrs (kcontrol, tdm) if( BUILD_KCONTROL OR BUILD_TDM ) check_function_exists( getifaddrs HAVE_GETIFADDRS ) diff --git a/config.h.cmake b/config.h.cmake index fec3909f4..3324456f3 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -132,6 +132,33 @@ // kcontrol/input #cmakedefine HAVE_LIBUSB 1 +// ksysguard, kcheckpass +#cmakedefine HAVE_STRLCAT 1 +#cmakedefine HAVE_STRLCAT_PROTO 1 +#cmakedefine HAVE_STRLCPY 1 +#cmakedefine HAVE_STRLCPY_PROTO 1 + +#if !defined(HAVE_STRLCAT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcat(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + +#if !defined(HAVE_STRLCPY_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcpy(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + + // tdeprint #cmakedefine HAVE_SIGACTION 1 #cmakedefine HAVE_SIGSET 1