From: Jim Klimov Date: Wed, 31 Aug 2022 13:32:46 +0000 (+0200) Subject: configure.ac: if neither UPSCONN{,_t} type was found, refuse to build NUT plugin X-Git-Tag: 6.0.0-rc0~42^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=630939177be14beb801a3533b50c3dc7248f9525;p=thirdparty%2Fcollectd.git 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). --- 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