]> 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)
committerMatthias Runge <mrunge@matthias-runge.de>
Thu, 8 Sep 2022 06:58:29 +0000 (08:58 +0200)
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 f88ed26505c18431bfb32b4dff31d072ab8ccd0f..bbe65a7e992316d00080b1c55ff8fb45a0d563be 100644 (file)
@@ -5867,9 +5867,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>
@@ -5878,6 +5879,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