]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
configure.ac: if neither UPSCONN{,_t} type was found, refuse to build NUT plugin
authorJim Klimov <jimklimov+nut@gmail.com>
Wed, 31 Aug 2022 13:32:46 +0000 (15:32 +0200)
committerFlorian Forster <octo@collectd.org>
Wed, 29 Nov 2023 20:56:20 +0000 (21:56 +0100)
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

index 2f9e00c37c8f16085017bd9e00def5cc6b8f4f47..9a28a3a4a8ade5a9e40abf2960ca2b0975a4de0d 100644 (file)
@@ -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 <stdlib.h>
@@ -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