<commit_before>include(CheckIncludeFile)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckTypeSize)

# Need expat.

check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
check_include_file(endian.h HAVE_ENDIAN_H)
check_include_file(dlfcn.h HAVE_DLFCN_H)
check_include_file(event.h HAVE_EVENT_H)
check_include_file(getopt.h HAVE_GETOPT_H)
check_include_file(glob.h HAVE_GLOB_H)
check_include_file(grp.h HAVE_GRP_H)
check_include_file(inttypes.h HAVE_INTTYPES_H)
check_include_file(iphlpapi.h HAVE_IPHLPAPI_H)
check_include_file(login_cap.h HAVE_LOGIN_CAP_H)
check_include_file(memory.h HAVE_MEMORY_H)
check_include_file(netdb.h HAVE_NETDB_H)
check_include_file(netinet/in.h HAVE_NETINET_IN_H)
check_include_file(pwd.h HAVE_PWD_H)
check_include_file(stdarg.h HAVE_STDARG_H)
check_include_file(stdbool.h HAVE_STDBOOL_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stdlib.h HAVE_STDLIB_H)
check_include_file(strings.h HAVE_STRINGS_H)
check_include_file(string.h HAVE_STRING_H)
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_file(sys/sha2.h HAVE_SYS_SHA2_H)
check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
check_include_file(sys/sysctl.h HAVE_SYS_SYSCTL_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(sys/uio.h HAVE_SYS_UIO_H)
check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
check_include_file(syslog.h HAVE_SYSLOG_H)
check_include_file(time.h HAVE_TIME_H)
check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(vfork.h HAVE_VFORK_H)
check_include_file(windows.h HAVE_WINDOWS_H)
check_include_file(winsock2.h HAVE_WINSOCK2_H)
check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)

if (WIN32)
  set(CMAKE_REQUIRED_LIBRARIES
    iphlpapi
    ws2_32)
endif ()

check_function_exists(arc4random HAVE_ARC4RANDOM)
check_function_exists(arc4random_uniform HAVE_ARC4RANDOM_UNIFORM)
check_function_exists(chown HAVE_CHOWN)
check_function_exists(chroot HAVE_CHROOT)
check_function_exists(ctime_r HAVE_CTIME_R)
check_function_exists(daemon HAVE_DAEMON)
check_function_exists(endprotoent HAVE_ENDPROTOENT)
check_function_exists(endservent HAVE_ENDSERVENT)
check_function_exists(fnctl HAVE_FNCTL)
check_function_exists(fork HAVE_FORK)
check_function_exists(fseeko HAVE_FSEEKO)
check_function_exists(getaddrinfo HAVE_GETADDRINFO)
check_function_exists(getentropy HAVE_GETENTROPY)
check_function_exists(getpwnam HAVE_GETPWNAM)
check_function_exists(getrlimit HAVE_GETRLIMIT)
check_function_exists(glob HAVE_GLOB)
check_function_exists(gmtime_r HAVE_GMTIME_R)
check_function_exists(inet_aton HAVE_INET_ATON)
check_function_exists(inet_ntop HAVE_INET_NTOP)
check_function_exists(inet_pton HAVE_INET_PTON)
check_function_exists(initgroups HAVE_INITGROUPS)
check_function_exists(ioctlsocket HAVE_IOCTLSOCKET)
check_function_exists(kill HAVE_KILL)
check_function_exists(localtime_r HAVE_LOCALTIME_R)
check_function_exists(malloc HAVE_MALLOC)
check_function_exists(memmove HAVE_MEMMOVE)
check_function_exists(random HAVE_RANDOM)
check_function_exists(recvmsg HAVE_RECVMSG)
check_function_exists(sbrk HAVE_SBRK)
check_function_exists(sendmsg HAVE_SENDMSG)
check_function_exists(setregid HAVE_SETREGID)
check_function_exists(setresgid HAVE_SETRESGID)
check_function_exists(setresuid HAVE_SETRESUID)
check_function_exists(setreuid HAVE_SETREUID)
check_function_exists(setrlimit HAVE_SETRLIMIT)
check_function_exists(setsid HAVE_SETSID)
check_function_exists(setusercontent HAVE_SETUSERCONTENT)
check_function_exists(sigprocmask HAVE_SIGPROCMASK)
check_function_exists(sleep HAVE_SLEEP)
check_function_exists(snprintf HAVE_SNPRINTF)
check_function_exists(socketpair HAVE_SOCKETPAIR)
check_function_exists(srandom HAVE_SRANDOM)
check_function_exists(strftime HAVE_STRFTIME)
check_function_exists(strlcat HAVE_STRLCAT)
check_function_exists(strlcpy HAVE_STRLCPY)
check_function_exists(strptime HAVE_STRPTIME)
check_function_exists(strlcpy HAVE_STRLCPY)
check_function_exists(tzset HAVE_TZSET)
check_function_exists(usleep HAVE_USLEEP)
check_function_exists(writev HAVE_WRITEV)
check_function_exists(_beginthreadex HAVE__BEGINTHREADEX)

function (check_type_exists type variable header default)
  set(CMAKE_EXTRA_INCLUDE_FILES "${header}")
  check_type_size("${type}" "${variable}")

  if (NOT HAVE_${type})
    set("${variable}" "${default}" PARENT_SCOPE)
  else ()
    set("${variable}" "FALSE" PARENT_SCOPE)
  endif ()
endfunction ()

set(CMAKE_EXTRA_INCLUDE_FILES "time.h")
check_type_size(time_t SIZEOF_TIME_T)
set(CMAKE_EXTRA_INCLUDE_FILES)

check_type_exists(gid_t gid_t "sys/types.h" int)
check_type_exists(in_addr_t in_addr_t "netinet/in.h" uint32_t)
check_type_exists(in_port_t in_port_t "netinet/in.h" uint16_t)<commit_msg>unbound: fix getaddrinfo detection for 32-bit windows<commit_after>include(CheckIncludeFile)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckTypeSize)

# Need expat.

check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
check_include_file(endian.h HAVE_ENDIAN_H)
check_include_file(dlfcn.h HAVE_DLFCN_H)
check_include_file(event.h HAVE_EVENT_H)
check_include_file(getopt.h HAVE_GETOPT_H)
check_include_file(glob.h HAVE_GLOB_H)
check_include_file(grp.h HAVE_GRP_H)
check_include_file(inttypes.h HAVE_INTTYPES_H)
check_include_file(iphlpapi.h HAVE_IPHLPAPI_H)
check_include_file(login_cap.h HAVE_LOGIN_CAP_H)
check_include_file(memory.h HAVE_MEMORY_H)
check_include_file(netdb.h HAVE_NETDB_H)
check_include_file(netinet/in.h HAVE_NETINET_IN_H)
check_include_file(pwd.h HAVE_PWD_H)
check_include_file(stdarg.h HAVE_STDARG_H)
check_include_file(stdbool.h HAVE_STDBOOL_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stdlib.h HAVE_STDLIB_H)
check_include_file(strings.h HAVE_STRINGS_H)
check_include_file(string.h HAVE_STRING_H)
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_file(sys/sha2.h HAVE_SYS_SHA2_H)
check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
check_include_file(sys/sysctl.h HAVE_SYS_SYSCTL_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(sys/uio.h HAVE_SYS_UIO_H)
check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
check_include_file(syslog.h HAVE_SYSLOG_H)
check_include_file(time.h HAVE_TIME_H)
check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(vfork.h HAVE_VFORK_H)
check_include_file(windows.h HAVE_WINDOWS_H)
check_include_file(winsock2.h HAVE_WINSOCK2_H)
check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)

if (WIN32)
  set(CMAKE_REQUIRED_LIBRARIES
    iphlpapi
    ws2_32)
endif ()

check_function_exists(arc4random HAVE_ARC4RANDOM)
check_function_exists(arc4random_uniform HAVE_ARC4RANDOM_UNIFORM)
check_function_exists(chown HAVE_CHOWN)
check_function_exists(chroot HAVE_CHROOT)
check_function_exists(ctime_r HAVE_CTIME_R)
check_function_exists(daemon HAVE_DAEMON)
check_function_exists(endprotoent HAVE_ENDPROTOENT)
check_function_exists(endservent HAVE_ENDSERVENT)
check_function_exists(fnctl HAVE_FNCTL)
check_function_exists(fork HAVE_FORK)
check_function_exists(fseeko HAVE_FSEEKO)
check_function_exists(getentropy HAVE_GETENTROPY)
check_function_exists(getpwnam HAVE_GETPWNAM)
check_function_exists(getrlimit HAVE_GETRLIMIT)
check_function_exists(glob HAVE_GLOB)
check_function_exists(gmtime_r HAVE_GMTIME_R)
check_function_exists(inet_aton HAVE_INET_ATON)
check_function_exists(inet_ntop HAVE_INET_NTOP)
check_function_exists(inet_pton HAVE_INET_PTON)
check_function_exists(initgroups HAVE_INITGROUPS)
check_function_exists(ioctlsocket HAVE_IOCTLSOCKET)
check_function_exists(kill HAVE_KILL)
check_function_exists(localtime_r HAVE_LOCALTIME_R)
check_function_exists(malloc HAVE_MALLOC)
check_function_exists(memmove HAVE_MEMMOVE)
check_function_exists(random HAVE_RANDOM)
check_function_exists(recvmsg HAVE_RECVMSG)
check_function_exists(sbrk HAVE_SBRK)
check_function_exists(sendmsg HAVE_SENDMSG)
check_function_exists(setregid HAVE_SETREGID)
check_function_exists(setresgid HAVE_SETRESGID)
check_function_exists(setresuid HAVE_SETRESUID)
check_function_exists(setreuid HAVE_SETREUID)
check_function_exists(setrlimit HAVE_SETRLIMIT)
check_function_exists(setsid HAVE_SETSID)
check_function_exists(setusercontent HAVE_SETUSERCONTENT)
check_function_exists(sigprocmask HAVE_SIGPROCMASK)
check_function_exists(sleep HAVE_SLEEP)
check_function_exists(snprintf HAVE_SNPRINTF)
check_function_exists(socketpair HAVE_SOCKETPAIR)
check_function_exists(srandom HAVE_SRANDOM)
check_function_exists(strftime HAVE_STRFTIME)
check_function_exists(strlcat HAVE_STRLCAT)
check_function_exists(strlcpy HAVE_STRLCPY)
check_function_exists(strptime HAVE_STRPTIME)
check_function_exists(strlcpy HAVE_STRLCPY)
check_function_exists(tzset HAVE_TZSET)
check_function_exists(usleep HAVE_USLEEP)
check_function_exists(writev HAVE_WRITEV)
check_function_exists(_beginthreadex HAVE__BEGINTHREADEX)

set(getaddrinfo_headers)
if (HAVE_NETDB_H)
  list(APPEND getaddrinfo_headers "netdb.h")
endif ()
if (HAVE_WS2TCPIP_H)
  list(APPEND getaddrinfo_headers "ws2tcpip.h")
endif ()
check_symbol_exists(getaddrinfo "${getaddrinfo_headers}" HAVE_GETADDRINFO)

check_function_exists(getaddrinfo HAVE_GETADDRINFO)

function (check_type_exists type variable header default)
  set(CMAKE_EXTRA_INCLUDE_FILES "${header}")
  check_type_size("${type}" "${variable}")

  if (NOT HAVE_${type})
    set("${variable}" "${default}" PARENT_SCOPE)
  else ()
    set("${variable}" "FALSE" PARENT_SCOPE)
  endif ()
endfunction ()

set(CMAKE_EXTRA_INCLUDE_FILES "time.h")
check_type_size(time_t SIZEOF_TIME_T)
set(CMAKE_EXTRA_INCLUDE_FILES)

check_type_exists(gid_t gid_t "sys/types.h" int)
check_type_exists(in_addr_t in_addr_t "netinet/in.h" uint32_t)
check_type_exists(in_port_t in_port_t "netinet/in.h" uint16_t)
{'fraction_non_alphanumeric': 0.06793257514216085, 'fraction_numerical': 0.004264825345247766, 'mean_word_length': 13.612759643916913, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '961659', 'n_tokens_mistral': 3841, 'n_tokens_neox': 3773, 'n_words': 471}