From 630939177be14beb801a3533b50c3dc7248f9525 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 31 Aug 2022 15:32:46 +0200 Subject: [PATCH] configure.ac: if neither UPSCONN{,_t} type was found, refuse to build NUT plugin NOTE: src/nut.c also has pragmas to error out in this situation, but that handling is compiler-dependent and happens too late in the checkout/configure/build loop. Presumably this inability to find the type in the earlier-found header file is also triggered by build environment "inconsistencies" like lack of basic types in the libc implementation (maybe highlighting the need for additional headers or macros for the platform). --- configure.ac | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2f9e00c37..9a28a3a4a 100644 --- a/configure.ac +++ b/configure.ac @@ -5873,9 +5873,10 @@ fi if test "x$with_libupsclient" = "xyes"; then SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags" + someUPSCONN_FOUND=false AC_CHECK_TYPES([UPSCONN_t, UPSCONN], - [], + [someUPSCONN_FOUND=true], [], [[ #include @@ -5884,6 +5885,12 @@ if test "x$with_libupsclient" = "xyes"; then ]] ) + AS_IF([test x"$someUPSCONN_FOUND" = xfalse], + [AC_MSG_WARN([Can not find either UPSCONN or UPSCONN_t type definition for upsclient library]) + with_libupsclient="no (required data types for NUT API were not detected)"] + ) + + unset someUPSCONN_FOUND CPPFLAGS="$SAVE_CPPFLAGS" fi -- 2.47.2