Skip to content

Commit

Permalink
m4/nut_check_libmodbus.m4: tests on Windows may require -lws2_32 and/…
Browse files Browse the repository at this point in the history
…or -liphlpapi

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jan 22, 2025
1 parent 9045f4e commit ee2d330
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion m4/nut_check_libmodbus.m4
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,21 @@ if test -z "${nut_have_libmodbus_seen}"; then
CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}"
LIBS="${LIBS_ORIG} ${depLIBS}"
AC_CHECK_HEADERS(modbus.h, [nut_have_libmodbus=yes], [nut_have_libmodbus=no], [AC_INCLUDES_DEFAULT])
AS_IF([test x"${nut_have_libmodbus}" = xyes ], [
AC_CHECK_FUNCS(modbus_new_tcp, [], [
AC_REQUIRE([NUT_CHECK_SOCKETLIB])
AS_IF([test x"${NETLIBS-}${NETLIBS_GETADDRS-}" = x], [
nut_have_libmodbus=no
],[
AC_MSG_NOTICE([Retry detection of libmodbus TCP support with NETLIBS])
unset ac_cv_func_modbus_new_tcp
LIBS="${LIBS} ${NETLIBS} ${NETLIBS_GETADDRS-}"
AC_CHECK_FUNCS(modbus_new_tcp, [], [nut_have_libmodbus=no])
])
])
])
AS_IF([test x"${nut_have_libmodbus}" = xyes ], [
AC_CHECK_FUNCS(modbus_new_rtu, [], [nut_have_libmodbus=no])
AC_CHECK_FUNCS(modbus_new_tcp, [], [nut_have_libmodbus=no])
AC_CHECK_FUNCS(modbus_set_byte_timeout, [], [nut_have_libmodbus=no])
AC_CHECK_FUNCS(modbus_set_response_timeout, [], [nut_have_libmodbus=no])
])
Expand Down

0 comments on commit ee2d330

Please sign in to comment.