Skip to content

Commit

Permalink
CMake: translate the changes for Hurd support from autotools.
Browse files Browse the repository at this point in the history
Untested, but it should handle Hurd the same way it's handled by the
configure script.
  • Loading branch information
guyharris committed Feb 4, 2024
1 parent 88e3ff2 commit f817637
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1889,6 +1889,7 @@ else()
check_include_file(linux/socket.h HAVE_LINUX_SOCKET_H)
check_include_file(sys/dlpi.h HAVE_SYS_DLPI_H)
check_include_file(config/HaikuConfig.h HAVE_CONFIG_HAIKUCONFIG_H)
check_include_file(hurd.h HAVE_HURD_H)

if(BPF_H_DEFINES_BIOCSETIF)
#
Expand All @@ -1912,6 +1913,11 @@ else()
# Haiku.
#
set(PCAP_TYPE haiku)
elseif(HAVE_HURD_H)
#
# Hurd.
#
set(PCAP_TYPE hurd)
else()
#
# We don't have any capture type we know about.
Expand Down Expand Up @@ -2098,6 +2104,15 @@ else(WIN32)
#
check_include_files("net/if.h;net/if_dl.h;net/if_types.h" HAVE_NET_IF_TYPES_H)
set(PCAP_SRC pcap-${PCAP_TYPE}.c)
elseif(PCAP_TYPE STREQUAL "hurd")
#
# Check for some headers just in case.
#
set(PCAP_LINK_LIBRARIES ${PCAP_LINK_LIBRARIES} rt)
set(LIBS "${LIBS} -lrt")
set(LIBS_STATIC "${LIBS_STATIC} -lrt")
set(LIBS_PRIVATE "${LIBS_PRIVATE} -lrt")
set(PCAP_SRC pcap-${PCAP_TYPE}.c)
elseif(PCAP_TYPE STREQUAL "null")
else()
message(FATAL_ERROR "${PCAP_TYPE} is not a valid pcap type")
Expand Down
3 changes: 3 additions & 0 deletions cmakeconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
/* on HP-UX 10.20 or later */
#cmakedefine HAVE_HPUX10_20_OR_LATER 1

/* Define to 1 if you have the <hurd.h> header file. */
#cmakedefine HAVE_HURD_H 1

/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1

Expand Down

0 comments on commit f817637

Please sign in to comment.