Commit 1d6ab32ea572054f8340b202ae511675cba64d8d
1 parent
e8dc8cb0
Fix #333455 - Workaround IPTOS_LOWDELAY not supported
- check IPTOS_LOWDELAY define in configure - generate a config.h - include the generated config.h in modbus.c
Showing
4 changed files
with
10 additions
and
0 deletions
NEWS
| @@ -7,6 +7,8 @@ libmodbus 2.2.0 (2009-05-01) | @@ -7,6 +7,8 @@ libmodbus 2.2.0 (2009-05-01) | ||
| 7 | - modbus_param_t is smaller (2 int removed) | 7 | - modbus_param_t is smaller (2 int removed) |
| 8 | - Better error management | 8 | - Better error management |
| 9 | - Faster | 9 | - Faster |
| 10 | +- Fix #333455 reported by Jeff Laughlin | ||
| 11 | + Cygwin IPTOS_LOWDELAY not supported on cygwin | ||
| 10 | 12 | ||
| 11 | libmodbus 2.0.3 (2009-03-22) | 13 | libmodbus 2.0.3 (2009-03-22) |
| 12 | ============================ | 14 | ============================ |
configure.ac
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | AC_PREREQ(2.59) | 4 | AC_PREREQ(2.59) |
| 5 | AC_INIT(libmodbus, 2.0.3, stephane.raimbault@gmail.com) | 5 | AC_INIT(libmodbus, 2.0.3, stephane.raimbault@gmail.com) |
| 6 | AC_CONFIG_SRCDIR([src/modbus.c]) | 6 | AC_CONFIG_SRCDIR([src/modbus.c]) |
| 7 | +AC_CONFIG_HEADERS([config.h]) | ||
| 7 | AM_INIT_AUTOMAKE | 8 | AM_INIT_AUTOMAKE |
| 8 | AM_DISABLE_STATIC | 9 | AM_DISABLE_STATIC |
| 9 | 10 | ||
| @@ -25,6 +26,9 @@ AC_HEADER_TIME | @@ -25,6 +26,9 @@ AC_HEADER_TIME | ||
| 25 | AC_TYPE_UINT16_T | 26 | AC_TYPE_UINT16_T |
| 26 | AC_TYPE_UINT32_T | 27 | AC_TYPE_UINT32_T |
| 27 | AC_TYPE_UINT8_T | 28 | AC_TYPE_UINT8_T |
| 29 | +AC_CHECK_DECLS([IPTOS_LOWDELAY], | ||
| 30 | + [have_iptos_lowdelay=yes], [have_iptos_lowdelay=no], | ||
| 31 | + [#include <netinet/ip.h>]) | ||
| 28 | 32 | ||
| 29 | # Checks for library functions. | 33 | # Checks for library functions. |
| 30 | AC_FUNC_FORK | 34 | AC_FUNC_FORK |
src/Makefile.am
| 1 | lib_LTLIBRARIES = libmodbus.la | 1 | lib_LTLIBRARIES = libmodbus.la |
| 2 | libmodbus_la_SOURCES = modbus.c modbus.h | 2 | libmodbus_la_SOURCES = modbus.c modbus.h |
| 3 | libmodbus_la_LDFLAGS = -version-info 2:0:0 | 3 | libmodbus_la_LDFLAGS = -version-info 2:0:0 |
| 4 | +service_CFLAGS = -I$(top_srcdir)/ | ||
| 4 | 5 | ||
| 5 | # Include files to install | 6 | # Include files to install |
| 6 | libmodbusincludedir = $(includedir)/modbus | 7 | libmodbusincludedir = $(includedir)/modbus |
src/modbus.c
| @@ -28,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
| 28 | http://copyleft.free.fr/wordpress/index.php/libmodbus/ | 28 | http://copyleft.free.fr/wordpress/index.php/libmodbus/ |
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | +#include <config.h> | ||
| 31 | #include <stdio.h> | 32 | #include <stdio.h> |
| 32 | #include <string.h> | 33 | #include <string.h> |
| 33 | #include <stdlib.h> | 34 | #include <stdlib.h> |
| @@ -1685,6 +1686,7 @@ static int modbus_connect_tcp(modbus_param_t *mb_param) | @@ -1685,6 +1686,7 @@ static int modbus_connect_tcp(modbus_param_t *mb_param) | ||
| 1685 | return ret; | 1686 | return ret; |
| 1686 | } | 1687 | } |
| 1687 | 1688 | ||
| 1689 | +#ifdef HAVE_DECL_IPTOS_LOWDELAY | ||
| 1688 | /* Set the IP low delay option */ | 1690 | /* Set the IP low delay option */ |
| 1689 | option = IPTOS_LOWDELAY; | 1691 | option = IPTOS_LOWDELAY; |
| 1690 | ret = setsockopt(mb_param->fd, IPPROTO_TCP, IP_TOS, | 1692 | ret = setsockopt(mb_param->fd, IPPROTO_TCP, IP_TOS, |
| @@ -1694,6 +1696,7 @@ static int modbus_connect_tcp(modbus_param_t *mb_param) | @@ -1694,6 +1696,7 @@ static int modbus_connect_tcp(modbus_param_t *mb_param) | ||
| 1694 | close(mb_param->fd); | 1696 | close(mb_param->fd); |
| 1695 | return ret; | 1697 | return ret; |
| 1696 | } | 1698 | } |
| 1699 | +#endif | ||
| 1697 | 1700 | ||
| 1698 | if (mb_param->debug) { | 1701 | if (mb_param->debug) { |
| 1699 | printf("Connecting to %s\n", mb_param->ip); | 1702 | printf("Connecting to %s\n", mb_param->ip); |