https://github.com/Cisco-Talos/clamav/issues/340

Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -642,10 +642,12 @@ else()
     if(APPLE)
         set(BIND_8_COMPAT 1)
     endif()
-    check_include_file("resolv.h"       HAVE_RESOLV_H)
-    if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND EXISTS /usr/include/resolv.h)
-        # This hack because check_include_file() can't find "resolv.h" on FreeBSD.
+    if(CMAKE_SYSTEM_NAME MATCHES ".*BSD" AND EXISTS /usr/include/resolv.h)
+        # This hack because check_include_file() can't include supplementary
+        # headers, and resolv.h on BSD systems typically needs netinet/in.h
         set(HAVE_RESOLV_H 1)
+    else()
+        check_include_file("resolv.h"       HAVE_RESOLV_H)
     endif()
     check_include_file("dirent.h"       HAVE_DIRENT_H)
     check_include_file("dlfcn.h"        HAVE_DLFCN_H)
