configure script and config.h file

Asked by straim

I've been using libmodbus-2.0.3 in our embedded project, but when I tried to build a TCP slave (a modbus TCP server)
I found the issues that has been discussed in this forum (about the modbus_init_listen and slave id) , I did modified the
2.0.3 version of the lib adding a function like modbus_slave_tcp_accept() before check this site, but when I started to seek in this Q/A about the slave id I found that there's a libmodbus-2.2.0 that have all I need!. The problem is that the new configure script doesn't check the malloc() function because of cross-compiling to my host,target platform (arm-linux) and set the ac_cv_func_malloc_0_nonnull=no
by default wich is why the config.h file ends with:
#define HAVE_MALLOC 0
and
#define malloc rpl_malloc
despite of having a standard ANSI C library (wich is also checked with result 1):
#define HAVE_STDLIB_H 1
#define STDC_HEADERS 1
anyway, I can figure out 2 workarounds, that are obvious (edit the configure and set the variable=yes or comment the malloc redefine and set #HAVE_MALLOC 1) but I think that maybe this could be a bug or a mischeck, so maybe you can check this :)
(both of them work and the lib works flawless)

I'm asking this because I'm just a user of the "./configure" script so I don't want to make mistakes correcting that kind of checks.

Regards!

PD: in the test directory I had to add the #include <sys/socket.h> to avoid the error: (obviously due to my toolchain :) )
bandwidth-slave-many-up.c:36: error: 'SHUT_RDWR' undeclared (first use in this function)

Toolchain: http://arm.cirrus.com/files/tools/arm-linux-gcc-4.1.1-920t.tar.bz2

Question information

Language:
English Edit question
Status:
Solved
For:
libmodbus Edit question
Assignee:
No assignee Edit question
Solved by:
Stéphane Raimbault
Solved:
Last query:
Last reply:
Revision history for this message
Best Stéphane Raimbault (sra) said :
#1

Autotools are too often painful to use although they must help us so if the check doesn't pass on your toolchain, it doesn't bother me to completly remove the check (I presume malloc is present).

To avoid the include of sys/socket.h, I've created a new function in modbus.h.

The previous changes are now committed on trunk, thank you for your comments.

Revision history for this message
straim (straim) said :
#2

Thanks Stéphane Raimbault, that solved my question.

Revision history for this message
straim (straim) said :
#3

lol, sry Stéphane, I obviously forgot to thank you and to press the "That answers solve my problem" button :)