Commit c3306fb1 authored by Bill Hoffman's avatar Bill Hoffman
Browse files

BUG: add cmake test for socklen_t

parent fb48867d
#include <stdio.h>
#include <stdlib.h>
#if !defined(_WIN32) || defined(__CYGWIN__)
#include <sys/types.h>
#include <sys/socket.h>
#endif
int
main ()
{
if ((socklen_t *) 0)
return 0;
if (sizeof (socklen_t))
return 0;
;
return 0;
}
......@@ -14,7 +14,25 @@ IF (WIN32)
ENDIF (NOT BORLAND)
ENDIF (WIN32)
IF("VTK_HAVE_SOCKLEN_T" MATCHES "^VTK_HAVE_SOCKLEN_T$")
MESSAGE(STATUS "Checking support for socklen_t type")
TRY_COMPILE(VTK_HAVE_SOCKLEN_T
${VTK_BINARY_DIR}/CMakeTmp/SocklenT
${VTK_SOURCE_DIR}/CMake/vtkTestSocklenT.c
OUTPUT_VARIABLE OUTPUT)
IF(VTK_HAVE_SOCKLEN_T)
MESSAGE(STATUS "Checking support for socklen_t type -- yes")
SET(VTK_HAVE_SOCKLEN_T 1 CACHE INTERNAL "Support for socklen_t type")
ELSE(VTK_HAVE_SOCKLEN_T)
MESSAGE(STATUS "Checking support for socklen_t type -- no")
SET(VTK_HAVE_SOCKLEN_T 0 CACHE INTERNAL "Support for socklen_t type")
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining if the compiler supports socklen_t type "
"failed with the following output:\n"
"${OUTPUT}\n" APPEND)
ENDIF(VTK_HAVE_SOCKLEN_T)
ENDIF("VTK_HAVE_SOCKLEN_T" MATCHES "^VTK_HAVE_SOCKLEN_T$")
SET ( Kit_SRCS
vtkDuplicatePolyData.cxx
vtkBranchExtentTranslator.cxx
......
......@@ -36,7 +36,7 @@
#define vtkCloseSocketMacro(sock) (close(sock))
#endif
vtkCxxRevisionMacro(vtkSocketCommunicator, "1.49");
vtkCxxRevisionMacro(vtkSocketCommunicator, "1.50");
vtkStandardNewMacro(vtkSocketCommunicator);
//----------------------------------------------------------------------------
......@@ -274,10 +274,10 @@ int vtkSocketCommunicator::GetPort(int sock)
{
struct sockaddr_in sockinfo;
memset(&sockinfo, 0, sizeof(sockinfo));
#if defined(_WIN32) && !defined(__CYGWIN__)
int sizebuf = sizeof(sockinfo);
#else
#if defined(VTK_HAVE_SOCKLEN_T)
socklen_t sizebuf = sizeof(sockinfo);
#else
int sizebuf = sizeof(sockinfo);
#endif
if(getsockname(sock, (sockaddr*)&sockinfo, &sizebuf) != 0)
{
......@@ -548,7 +548,7 @@ int vtkSocketCommunicator::ReceiveTagged(void* data, int wordSize,
if(!this->ReceiveInternal(this->Socket, &recvTag,
static_cast<int>(sizeof(int))))
{
vtkErrorMacro("Could not receive tag.");
vtkErrorMacro("Could not receive tag. " << tag);
return 0;
}
if(this->SwapBytesInReceivedData)
......
......@@ -53,7 +53,7 @@
#cmakedefine VTK_ISTREAM_SUPPORTS_LONG_LONG
#cmakedefine VTK_OSTREAM_SUPPORTS_LONG_LONG
#define VTK_STREAM_EOF_SEVERITY @VTK_STREAM_EOF_SEVERITY@
#cmakedefine VTK_HAVE_SOCKLEN_T
/*--------------------------------------------------------------------------*/
/* VTK Platform Configuration */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment