Skip to content

Commit

Permalink
Define socklen_t in according to a feature test (#949)
Browse files Browse the repository at this point in the history
Co-authored-by: KO Myung-Hun <komh@chollian.net>
  • Loading branch information
derselbst and komh committed Jul 28, 2021
1 parent ec6d563 commit 8e56188
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,18 @@ if ( enable-ipv6 )
endif ( HAVE_INETNTOP )
endif ( enable-ipv6 )

unset ( HAVE_SOCKLEN_T CACHE )
set ( CMAKE_EXTRA_INCLUDE_FILES_SAVE ${CMAKE_EXTRA_INCLUDE_FILES} )
if ( WIN32 )
set ( CMAKE_EXTRA_INCLUDE_FILES "winsock2.h;ws2tcpip.h" )
else ( WIN32 )
set ( CMAKE_EXTRA_INCLUDE_FILES sys/socket.h )
endif ( WIN32 )
check_type_size ( socklen_t SOCKLEN_T )
set ( CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES_SAVE} )
if ( HAVE_SOCKLEN_T )
set ( HAVE_SOCKLEN_T 1 )
endif ( HAVE_SOCKLEN_T )

# General configuration file
configure_file ( ${CMAKE_SOURCE_DIR}/src/config.cmake
Expand Down
3 changes: 3 additions & 0 deletions src/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,7 @@
/* Define to 1 if you have the logf() function. */
#cmakedefine HAVE_LOGF @HAVE_LOGF@

/* Define to 1 if you have the socklen_t type. */
#cmakedefine HAVE_SOCKLEN_T @HAVE_SOCKLEN_T@

#endif /* CONFIG_H */
3 changes: 3 additions & 0 deletions src/utils/fluid_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,11 @@ char *fluid_strtok(char **str, char *delim);
#define INCL_DOS
#include <os2.h>

/* Define socklen_t if not provided */
#if !HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
#endif

/**
Time functions
Expand Down

0 comments on commit 8e56188

Please sign in to comment.