diff -ur curl-7.19.7/CMakeLists.txt curl-7.19.7-haiku/CMakeLists.txt
--- curl-7.19.7/CMakeLists.txt	2009-07-22 14:09:53.000000000 -0600
+++ curl-7.19.7-haiku/CMakeLists.txt	2009-11-24 11:55:56.000000000 -0700
@@ -227,6 +227,9 @@
   check_library_exists_concat("bnetapi" closesocket HAVE_LIBBNETAPI)
 endif(BEOS)
 
+# Haiku needs libnetwork for recv and friends
+check_library_exists_concat("network" recv HAVE_LIBNETWORK)
+
 if(NOT NOT_NEED_LIBNSL)
   check_library_exists_concat("nsl"    gethostbyname  HAVE_LIBNSL)
 endif(NOT NOT_NEED_LIBNSL)
@@ -783,7 +786,11 @@
 
 if(HAVE_SOCKLEN_T)
   set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t")
+  if(HAVE_SYS_SOCKET_H)
+    set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
+  endif(HAVE_SYS_SOCKET_H)
   check_type_size("socklen_t" CURL_SIZEOF_CURL_SOCKLEN_T)
+  set(CMAKE_EXTRA_INCLUDE_FILES)
 else()
   set(CURL_TYPEOF_CURL_SOCKLEN_T int)
   set(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT})
diff -ur curl-7.19.7/include/curl/curlbuild.h.cmake curl-7.19.7-haiku/include/curl/curlbuild.h.cmake
--- curl-7.19.7/include/curl/curlbuild.h.cmake	2009-07-22 14:09:53.000000000 -0600
+++ curl-7.19.7-haiku/include/curl/curlbuild.h.cmake	2009-11-24 12:02:30.000000000 -0700
@@ -144,6 +144,11 @@
 #  include <ws2tcpip.h>
 #endif
 
+/* on Haiku socklen_t is in here */
+#ifdef __HAIKU__
+#  include <sys/socket.h>
+#endif
+
 /* Data type definition of curl_socklen_t. */
 typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
 
