diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f2e223f01c89023d9717091dc130240b599882a..41d94485dcc3640a499a4ba45ffcc83f57733780 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,6 @@ include(CheckCSourceCompiles)
 include(CheckCXXSourceCompiles)
 include(TestBigEndian)
 include(CheckFunctionExists)
-include(CheckPrototypeDefinition)
 include(FindOptionalPackage)
 
 find_program(ECHO echo)
@@ -80,8 +79,11 @@ check_function_exists(memmem HAVE_MEMMEM)
 check_function_exists(memrchr HAVE_MEMRCHR)
 check_function_exists(sendfile HAVE_SENDFILE)
 if (HAVE_SENDFILE)
-    check_prototype_definition(sendfile "ssize_t sendfile(int out_fd, int in_fd, off_t * offset, size_t count)" "0" "sys/sendfile.h" HAVE_SENDFILE_LINUX)
-    check_prototype_definition(sendfile "int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags)" "0" "" HAVE_SENDFILE_BSD)
+    if (TARGET_OS_LINUX)
+        set(HAVE_SENDFILE_LINUX 1)
+    else(HAVE_SENDFILE)
+        set(HAVE_SENDFILE_BSD 1)
+    endif()
 endif()
 check_function_exists(open_memstream HAVE_OPEN_MEMSTREAM)