Skip to content

Commit

Permalink
CMake fixes for Linux.
Browse files Browse the repository at this point in the history
Make sure <sys/socket.h> is included if around when testing/using
socklen_t.  Also, disable LDAP if LDAP_H is not found on the system.
  • Loading branch information
billhoffman committed Mar 24, 2010
1 parent d42f932 commit 5709a0d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CMake/CheckTypeSize.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */

#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif

#ifdef _WIN32
# include <winsock2.h>
Expand Down
3 changes: 2 additions & 1 deletion CMake/CheckTypeSize.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE)
set(CHECK_TYPE_SIZE_TYPE "${TYPE}")
set(MACRO_CHECK_TYPE_SIZE_FLAGS
"${CMAKE_REQUIRED_FLAGS}")
foreach(def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H)
foreach(def HAVE_SYS_TYPES_H
HAVE_STDINT_H HAVE_STDDEF_H HAVE_SYS_SOCKET_H)
if("${def}")
set(MACRO_CHECK_TYPE_SIZE_FLAGS
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
Expand Down
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DI
mark_as_advanced(HTTP_ONLY)
option(CURL_DISABLE_FTP "disables FTP" OFF)
mark_as_advanced(CURL_DISABLE_FTP)
option(CURL_DISABLE_LDAP "disables LDAP" OFF)
option(CURL_DISABLE_LDAP "disables LDAP" ON)
mark_as_advanced(CURL_DISABLE_LDAP)
option(CURL_DISABLE_TELNET "disables Telnet" OFF)
mark_as_advanced(CURL_DISABLE_TELNET)
Expand Down Expand Up @@ -392,6 +392,11 @@ if(CMAKE_USE_OPENSSL)
check_include_file_concat("openssl/rand.h" HAVE_OPENSSL_RAND_H)
endif(CMAKE_USE_OPENSSL)

if(NOT HAVE_LDAP_H)
message(STATUS "LDAP_H not found CURL_DISABLE_LDAP set ON")
set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
endif()


check_type_size(size_t SIZEOF_SIZE_T)
check_type_size(ssize_t SIZEOF_SSIZE_T)
Expand Down Expand Up @@ -782,6 +787,10 @@ endif(CMAKE_COMPILER_IS_GNUCC AND APPLE)
if(HAVE_SOCKLEN_T)
set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t")
check_type_size("socklen_t" CURL_SIZEOF_CURL_SOCKLEN_T)
if(NOT HAVE_CURL_SIZEOF_CURL_SOCKLEN_T)
message(FATAL_ERROR
"Check for sizeof socklen_t failed, see CMakeFiles/CMakerror.log")
endif()
else()
set(CURL_TYPEOF_CURL_SOCKLEN_T int)
set(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT})
Expand Down
4 changes: 4 additions & 0 deletions include/curl/curlbuild.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
# include <ws2tcpip.h>
#endif

#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif

/* Data type definition of curl_socklen_t. */
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;

Expand Down

0 comments on commit 5709a0d

Please sign in to comment.