summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 07:34:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 07:34:15 +0000
commitafea5f9539cbf1eeaa85ec77d79eb2f59724f470 (patch)
tree2a4eba394a6bc60d2eaa8304d91168a07225d51e /cmake
parentInitial commit. (diff)
downloadnghttp2-upstream/1.52.0.tar.xz
nghttp2-upstream/1.52.0.zip
Adding upstream version 1.52.0.upstream/1.52.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--cmake/ExtractValidFlags.cmake31
-rw-r--r--cmake/FindCUnit.cmake40
-rw-r--r--cmake/FindJansson.cmake40
-rw-r--r--cmake/FindJemalloc.cmake40
-rw-r--r--cmake/FindLibbpf.cmake32
-rw-r--r--cmake/FindLibcares.cmake40
-rw-r--r--cmake/FindLibev.cmake38
-rw-r--r--cmake/FindLibevent.cmake97
-rw-r--r--cmake/FindLibnghttp3.cmake41
-rw-r--r--cmake/FindLibngtcp2.cmake41
-rw-r--r--cmake/FindLibngtcp2_crypto_openssl.cmake43
-rw-r--r--cmake/FindSystemd.cmake19
-rw-r--r--cmake/Version.cmake11
-rw-r--r--cmakeconfig.h.in92
14 files changed, 605 insertions, 0 deletions
diff --git a/cmake/ExtractValidFlags.cmake b/cmake/ExtractValidFlags.cmake
new file mode 100644
index 0000000..ccd57dc
--- /dev/null
+++ b/cmake/ExtractValidFlags.cmake
@@ -0,0 +1,31 @@
+# Convenience function that checks the availability of certain
+# C or C++ compiler flags and returns valid ones as a string.
+
+include(CheckCCompilerFlag)
+include(CheckCXXCompilerFlag)
+
+function(extract_valid_c_flags varname)
+ set(valid_flags)
+ foreach(flag IN LISTS ARGN)
+ string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag})
+ set(flag_var "C_FLAG_${flag_var}")
+ check_c_compiler_flag("${flag}" "${flag_var}")
+ if(${flag_var})
+ set(valid_flags "${valid_flags} ${flag}")
+ endif()
+ endforeach()
+ set(${varname} "${valid_flags}" PARENT_SCOPE)
+endfunction()
+
+function(extract_valid_cxx_flags varname)
+ set(valid_flags)
+ foreach(flag IN LISTS ARGN)
+ string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag})
+ set(flag_var "CXX_FLAG_${flag_var}")
+ check_cxx_compiler_flag("${flag}" "${flag_var}")
+ if(${flag_var})
+ set(valid_flags "${valid_flags} ${flag}")
+ endif()
+ endforeach()
+ set(${varname} "${valid_flags}" PARENT_SCOPE)
+endfunction()
diff --git a/cmake/FindCUnit.cmake b/cmake/FindCUnit.cmake
new file mode 100644
index 0000000..ada87c1
--- /dev/null
+++ b/cmake/FindCUnit.cmake
@@ -0,0 +1,40 @@
+# - Try to find cunit
+# Once done this will define
+# CUNIT_FOUND - System has cunit
+# CUNIT_INCLUDE_DIRS - The cunit include directories
+# CUNIT_LIBRARIES - The libraries needed to use cunit
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_CUNIT QUIET cunit)
+
+find_path(CUNIT_INCLUDE_DIR
+ NAMES CUnit/CUnit.h
+ HINTS ${PC_CUNIT_INCLUDE_DIRS}
+)
+find_library(CUNIT_LIBRARY
+ NAMES cunit
+ HINTS ${PC_CUNIT_LIBRARY_DIRS}
+)
+
+if(CUNIT_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+CU_VERSION[ \t]+\"([^\"]+)\".*")
+ file(STRINGS "${CUNIT_INCLUDE_DIR}/CUnit/CUnit.h"
+ CUNIT_VERSION REGEX "${_version_regex}")
+ string(REGEX REPLACE "${_version_regex}" "\\1"
+ CUNIT_VERSION "${CUNIT_VERSION}")
+ unset(_version_regex)
+endif()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set CUNIT_FOUND to TRUE
+# if all listed variables are TRUE and the requested version matches.
+find_package_handle_standard_args(CUnit REQUIRED_VARS
+ CUNIT_LIBRARY CUNIT_INCLUDE_DIR
+ VERSION_VAR CUNIT_VERSION)
+
+if(CUNIT_FOUND)
+ set(CUNIT_LIBRARIES ${CUNIT_LIBRARY})
+ set(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(CUNIT_INCLUDE_DIR CUNIT_LIBRARY)
diff --git a/cmake/FindJansson.cmake b/cmake/FindJansson.cmake
new file mode 100644
index 0000000..4c4bcb7
--- /dev/null
+++ b/cmake/FindJansson.cmake
@@ -0,0 +1,40 @@
+# - Try to find jansson
+# Once done this will define
+# JANSSON_FOUND - System has jansson
+# JANSSON_INCLUDE_DIRS - The jansson include directories
+# JANSSON_LIBRARIES - The libraries needed to use jansson
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_JANSSON QUIET jansson)
+
+find_path(JANSSON_INCLUDE_DIR
+ NAMES jansson.h
+ HINTS ${PC_JANSSON_INCLUDE_DIRS}
+)
+find_library(JANSSON_LIBRARY
+ NAMES jansson
+ HINTS ${PC_JANSSON_LIBRARY_DIRS}
+)
+
+if(JANSSON_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+JANSSON_VERSION[ \t]+\"([^\"]+)\".*")
+ file(STRINGS "${JANSSON_INCLUDE_DIR}/jansson.h"
+ JANSSON_VERSION REGEX "${_version_regex}")
+ string(REGEX REPLACE "${_version_regex}" "\\1"
+ JANSSON_VERSION "${JANSSON_VERSION}")
+ unset(_version_regex)
+endif()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set JANSSON_FOUND to TRUE
+# if all listed variables are TRUE and the requested version matches.
+find_package_handle_standard_args(Jansson REQUIRED_VARS
+ JANSSON_LIBRARY JANSSON_INCLUDE_DIR
+ VERSION_VAR JANSSON_VERSION)
+
+if(JANSSON_FOUND)
+ set(JANSSON_LIBRARIES ${JANSSON_LIBRARY})
+ set(JANSSON_INCLUDE_DIRS ${JANSSON_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(JANSSON_INCLUDE_DIR JANSSON_LIBRARY)
diff --git a/cmake/FindJemalloc.cmake b/cmake/FindJemalloc.cmake
new file mode 100644
index 0000000..b7815fa
--- /dev/null
+++ b/cmake/FindJemalloc.cmake
@@ -0,0 +1,40 @@
+# - Try to find jemalloc
+# Once done this will define
+# JEMALLOC_FOUND - System has jemalloc
+# JEMALLOC_INCLUDE_DIRS - The jemalloc include directories
+# JEMALLOC_LIBRARIES - The libraries needed to use jemalloc
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_JEMALLOC QUIET jemalloc)
+
+find_path(JEMALLOC_INCLUDE_DIR
+ NAMES jemalloc/jemalloc.h
+ HINTS ${PC_JEMALLOC_INCLUDE_DIRS}
+)
+find_library(JEMALLOC_LIBRARY
+ NAMES jemalloc
+ HINTS ${PC_JEMALLOC_LIBRARY_DIRS}
+)
+
+if(JEMALLOC_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+JEMALLOC_VERSION[ \t]+\"([^\"]+)\".*")
+ file(STRINGS "${JEMALLOC_INCLUDE_DIR}/jemalloc/jemalloc.h"
+ JEMALLOC_VERSION REGEX "${_version_regex}")
+ string(REGEX REPLACE "${_version_regex}" "\\1"
+ JEMALLOC_VERSION "${JEMALLOC_VERSION}")
+ unset(_version_regex)
+endif()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE
+# if all listed variables are TRUE and the requested version matches.
+find_package_handle_standard_args(Jemalloc REQUIRED_VARS
+ JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR
+ VERSION_VAR JEMALLOC_VERSION)
+
+if(JEMALLOC_FOUND)
+ set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
+ set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(JEMALLOC_INCLUDE_DIR JEMALLOC_LIBRARY)
diff --git a/cmake/FindLibbpf.cmake b/cmake/FindLibbpf.cmake
new file mode 100644
index 0000000..7f76255
--- /dev/null
+++ b/cmake/FindLibbpf.cmake
@@ -0,0 +1,32 @@
+# - Try to find libbpf
+# Once done this will define
+# LIBBPF_FOUND - System has libbpf
+# LIBBPF_INCLUDE_DIRS - The libbpf include directories
+# LIBBPF_LIBRARIES - The libraries needed to use libbpf
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_LIBBPF QUIET libbpf)
+
+find_path(LIBBPF_INCLUDE_DIR
+ NAMES bpf/bpf.h
+ HINTS ${PC_LIBBPF_INCLUDE_DIRS}
+)
+find_library(LIBBPF_LIBRARY
+ NAMES bpf
+ HINTS ${PC_LIBBPF_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LIBBPF_FOUND
+# to TRUE if all listed variables are TRUE and the requested version
+# matches.
+find_package_handle_standard_args(Libbpf REQUIRED_VARS
+ LIBBPF_LIBRARY LIBBPF_INCLUDE_DIR
+ VERSION_VAR LIBBPF_VERSION)
+
+if(LIBBPF_FOUND)
+ set(LIBBPF_LIBRARIES ${LIBBPF_LIBRARY})
+ set(LIBBPF_INCLUDE_DIRS ${LIBBPF_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LIBBPF_INCLUDE_DIR LIBBPF_LIBRARY)
diff --git a/cmake/FindLibcares.cmake b/cmake/FindLibcares.cmake
new file mode 100644
index 0000000..1fe56ce
--- /dev/null
+++ b/cmake/FindLibcares.cmake
@@ -0,0 +1,40 @@
+# - Try to find libcares
+# Once done this will define
+# LIBCARES_FOUND - System has libcares
+# LIBCARES_INCLUDE_DIRS - The libcares include directories
+# LIBCARES_LIBRARIES - The libraries needed to use libcares
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_LIBCARES QUIET libcares)
+
+find_path(LIBCARES_INCLUDE_DIR
+ NAMES ares.h
+ HINTS ${PC_LIBCARES_INCLUDE_DIRS}
+)
+find_library(LIBCARES_LIBRARY
+ NAMES cares
+ HINTS ${PC_LIBCARES_LIBRARY_DIRS}
+)
+
+if(LIBCARES_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+ARES_VERSION_STR[ \t]+\"([^\"]+)\".*")
+ file(STRINGS "${LIBCARES_INCLUDE_DIR}/ares_version.h"
+ LIBCARES_VERSION REGEX "${_version_regex}")
+ string(REGEX REPLACE "${_version_regex}" "\\1"
+ LIBCARES_VERSION "${LIBCARES_VERSION}")
+ unset(_version_regex)
+endif()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LIBCARES_FOUND to TRUE
+# if all listed variables are TRUE and the requested version matches.
+find_package_handle_standard_args(Libcares REQUIRED_VARS
+ LIBCARES_LIBRARY LIBCARES_INCLUDE_DIR
+ VERSION_VAR LIBCARES_VERSION)
+
+if(LIBCARES_FOUND)
+ set(LIBCARES_LIBRARIES ${LIBCARES_LIBRARY})
+ set(LIBCARES_INCLUDE_DIRS ${LIBCARES_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LIBCARES_INCLUDE_DIR LIBCARES_LIBRARY)
diff --git a/cmake/FindLibev.cmake b/cmake/FindLibev.cmake
new file mode 100644
index 0000000..71e4508
--- /dev/null
+++ b/cmake/FindLibev.cmake
@@ -0,0 +1,38 @@
+# - Try to find libev
+# Once done this will define
+# LIBEV_FOUND - System has libev
+# LIBEV_INCLUDE_DIRS - The libev include directories
+# LIBEV_LIBRARIES - The libraries needed to use libev
+
+find_path(LIBEV_INCLUDE_DIR
+ NAMES ev.h
+)
+find_library(LIBEV_LIBRARY
+ NAMES ev
+)
+
+if(LIBEV_INCLUDE_DIR)
+ file(STRINGS "${LIBEV_INCLUDE_DIR}/ev.h"
+ LIBEV_VERSION_MAJOR REGEX "^#define[ \t]+EV_VERSION_MAJOR[ \t]+[0-9]+")
+ file(STRINGS "${LIBEV_INCLUDE_DIR}/ev.h"
+ LIBEV_VERSION_MINOR REGEX "^#define[ \t]+EV_VERSION_MINOR[ \t]+[0-9]+")
+ string(REGEX REPLACE "[^0-9]+" "" LIBEV_VERSION_MAJOR "${LIBEV_VERSION_MAJOR}")
+ string(REGEX REPLACE "[^0-9]+" "" LIBEV_VERSION_MINOR "${LIBEV_VERSION_MINOR}")
+ set(LIBEV_VERSION "${LIBEV_VERSION_MAJOR}.${LIBEV_VERSION_MINOR}")
+ unset(LIBEV_VERSION_MINOR)
+ unset(LIBEV_VERSION_MAJOR)
+endif()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LIBEV_FOUND to TRUE
+# if all listed variables are TRUE and the requested version matches.
+find_package_handle_standard_args(Libev REQUIRED_VARS
+ LIBEV_LIBRARY LIBEV_INCLUDE_DIR
+ VERSION_VAR LIBEV_VERSION)
+
+if(LIBEV_FOUND)
+ set(LIBEV_LIBRARIES ${LIBEV_LIBRARY})
+ set(LIBEV_INCLUDE_DIRS ${LIBEV_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LIBEV_INCLUDE_DIR LIBEV_LIBRARY)
diff --git a/cmake/FindLibevent.cmake b/cmake/FindLibevent.cmake
new file mode 100644
index 0000000..e8a3cef
--- /dev/null
+++ b/cmake/FindLibevent.cmake
@@ -0,0 +1,97 @@
+# - Try to find libevent
+#.rst
+# FindLibevent
+# ------------
+#
+# Find Libevent include directories and libraries. Invoke as::
+#
+# find_package(Libevent
+# [version] [EXACT] # Minimum or exact version
+# [REQUIRED] # Fail if Libevent is not found
+# [COMPONENT <C>...]) # Libraries to look for
+#
+# Valid components are one or more of:: libevent core extra pthreads openssl.
+# Note that 'libevent' contains both core and extra. You must specify one of
+# them for the other components.
+#
+# This module will define the following variables::
+#
+# LIBEVENT_FOUND - True if headers and requested libraries were found
+# LIBEVENT_INCLUDE_DIRS - Libevent include directories
+# LIBEVENT_LIBRARIES - Libevent libraries to be linked
+# LIBEVENT_<C>_FOUND - Component <C> was found (<C> is uppercase)
+# LIBEVENT_<C>_LIBRARY - Library to be linked for Libevent component <C>.
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_LIBEVENT QUIET libevent)
+
+# Look for the Libevent 2.0 or 1.4 headers
+find_path(LIBEVENT_INCLUDE_DIR
+ NAMES
+ event2/event-config.h
+ event-config.h
+ HINTS
+ ${PC_LIBEVENT_INCLUDE_DIRS}
+)
+
+if(LIBEVENT_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+_EVENT_VERSION[ \t]+\"([^\"]+)\".*")
+ if(EXISTS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h")
+ # Libevent 2.0
+ file(STRINGS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h"
+ LIBEVENT_VERSION REGEX "${_version_regex}")
+ if("${LIBEVENT_VERSION}" STREQUAL "")
+ set(LIBEVENT_VERSION ${PC_LIBEVENT_VERSION})
+ endif()
+ else()
+ # Libevent 1.4
+ file(STRINGS "${LIBEVENT_INCLUDE_DIR}/event-config.h"
+ LIBEVENT_VERSION REGEX "${_version_regex}")
+ endif()
+ string(REGEX REPLACE "${_version_regex}" "\\1"
+ LIBEVENT_VERSION "${LIBEVENT_VERSION}")
+ unset(_version_regex)
+endif()
+
+set(_LIBEVENT_REQUIRED_VARS)
+foreach(COMPONENT ${Libevent_FIND_COMPONENTS})
+ set(_LIBEVENT_LIBNAME libevent)
+ # Note: compare two variables to avoid a CMP0054 policy warning
+ if(COMPONENT STREQUAL _LIBEVENT_LIBNAME)
+ set(_LIBEVENT_LIBNAME event)
+ else()
+ set(_LIBEVENT_LIBNAME "event_${COMPONENT}")
+ endif()
+ string(TOUPPER "${COMPONENT}" COMPONENT_UPPER)
+ find_library(LIBEVENT_${COMPONENT_UPPER}_LIBRARY
+ NAMES ${_LIBEVENT_LIBNAME}
+ HINTS ${PC_LIBEVENT_LIBRARY_DIRS}
+ )
+ if(LIBEVENT_${COMPONENT_UPPER}_LIBRARY)
+ set(Libevent_${COMPONENT}_FOUND 1)
+ endif()
+ list(APPEND _LIBEVENT_REQUIRED_VARS LIBEVENT_${COMPONENT_UPPER}_LIBRARY)
+endforeach()
+unset(_LIBEVENT_LIBNAME)
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LIBEVENT_FOUND to TRUE
+# if all listed variables are TRUE and the requested version matches.
+find_package_handle_standard_args(Libevent REQUIRED_VARS
+ ${_LIBEVENT_REQUIRED_VARS}
+ LIBEVENT_INCLUDE_DIR
+ VERSION_VAR LIBEVENT_VERSION
+ HANDLE_COMPONENTS)
+
+if(LIBEVENT_FOUND)
+ set(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR})
+ set(LIBEVENT_LIBRARIES)
+ foreach(COMPONENT ${Libevent_FIND_COMPONENTS})
+ string(TOUPPER "${COMPONENT}" COMPONENT_UPPER)
+ list(APPEND LIBEVENT_LIBRARIES ${LIBEVENT_${COMPONENT_UPPER}_LIBRARY})
+ set(LIBEVENT_${COMPONENT_UPPER}_FOUND ${Libevent_${COMPONENT}_FOUND})
+ endforeach()
+endif()
+
+mark_as_advanced(LIBEVENT_INCLUDE_DIR ${_LIBEVENT_REQUIRED_VARS})
+unset(_LIBEVENT_REQUIRED_VARS)
diff --git a/cmake/FindLibnghttp3.cmake b/cmake/FindLibnghttp3.cmake
new file mode 100644
index 0000000..ecd01f6
--- /dev/null
+++ b/cmake/FindLibnghttp3.cmake
@@ -0,0 +1,41 @@
+# - Try to find libnghttp3
+# Once done this will define
+# LIBNGHTTP3_FOUND - System has libnghttp3
+# LIBNGHTTP3_INCLUDE_DIRS - The libnghttp3 include directories
+# LIBNGHTTP3_LIBRARIES - The libraries needed to use libnghttp3
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_LIBNGHTTP3 QUIET libnghttp3)
+
+find_path(LIBNGHTTP3_INCLUDE_DIR
+ NAMES nghttp3/nghttp3.h
+ HINTS ${PC_LIBNGHTTP3_INCLUDE_DIRS}
+)
+find_library(LIBNGHTTP3_LIBRARY
+ NAMES nghttp3
+ HINTS ${PC_LIBNGHTTP3_LIBRARY_DIRS}
+)
+
+if(LIBNGHTTP3_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+NGHTTP3_VERSION[ \t]+\"([^\"]+)\".*")
+ file(STRINGS "${LIBNGHTTP3_INCLUDE_DIR}/nghttp3/version.h"
+ LIBNGHTTP3_VERSION REGEX "${_version_regex}")
+ string(REGEX REPLACE "${_version_regex}" "\\1"
+ LIBNGHTTP3_VERSION "${LIBNGHTTP3_VERSION}")
+ unset(_version_regex)
+endif()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LIBNGHTTP3_FOUND
+# to TRUE if all listed variables are TRUE and the requested version
+# matches.
+find_package_handle_standard_args(Libnghttp3 REQUIRED_VARS
+ LIBNGHTTP3_LIBRARY LIBNGHTTP3_INCLUDE_DIR
+ VERSION_VAR LIBNGHTTP3_VERSION)
+
+if(LIBNGHTTP3_FOUND)
+ set(LIBNGHTTP3_LIBRARIES ${LIBNGHTTP3_LIBRARY})
+ set(LIBNGHTTP3_INCLUDE_DIRS ${LIBNGHTTP3_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LIBNGHTTP3_INCLUDE_DIR LIBNGHTTP3_LIBRARY)
diff --git a/cmake/FindLibngtcp2.cmake b/cmake/FindLibngtcp2.cmake
new file mode 100644
index 0000000..c670114
--- /dev/null
+++ b/cmake/FindLibngtcp2.cmake
@@ -0,0 +1,41 @@
+# - Try to find libngtcp2
+# Once done this will define
+# LIBNGTCP2_FOUND - System has libngtcp2
+# LIBNGTCP2_INCLUDE_DIRS - The libngtcp2 include directories
+# LIBNGTCP2_LIBRARIES - The libraries needed to use libngtcp2
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_LIBNGTCP2 QUIET libngtcp2)
+
+find_path(LIBNGTCP2_INCLUDE_DIR
+ NAMES ngtcp2/ngtcp2.h
+ HINTS ${PC_LIBNGTCP2_INCLUDE_DIRS}
+)
+find_library(LIBNGTCP2_LIBRARY
+ NAMES ngtcp2
+ HINTS ${PC_LIBNGTCP2_LIBRARY_DIRS}
+)
+
+if(LIBNGTCP2_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+NGTCP2_VERSION[ \t]+\"([^\"]+)\".*")
+ file(STRINGS "${LIBNGTCP2_INCLUDE_DIR}/ngtcp2/version.h"
+ LIBNGTCP2_VERSION REGEX "${_version_regex}")
+ string(REGEX REPLACE "${_version_regex}" "\\1"
+ LIBNGTCP2_VERSION "${LIBNGTCP2_VERSION}")
+ unset(_version_regex)
+endif()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LIBNGTCP2_FOUND
+# to TRUE if all listed variables are TRUE and the requested version
+# matches.
+find_package_handle_standard_args(Libngtcp2 REQUIRED_VARS
+ LIBNGTCP2_LIBRARY LIBNGTCP2_INCLUDE_DIR
+ VERSION_VAR LIBNGTCP2_VERSION)
+
+if(LIBNGTCP2_FOUND)
+ set(LIBNGTCP2_LIBRARIES ${LIBNGTCP2_LIBRARY})
+ set(LIBNGTCP2_INCLUDE_DIRS ${LIBNGTCP2_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LIBNGTCP2_INCLUDE_DIR LIBNGTCP2_LIBRARY)
diff --git a/cmake/FindLibngtcp2_crypto_openssl.cmake b/cmake/FindLibngtcp2_crypto_openssl.cmake
new file mode 100644
index 0000000..8df7859
--- /dev/null
+++ b/cmake/FindLibngtcp2_crypto_openssl.cmake
@@ -0,0 +1,43 @@
+# - Try to find libngtcp2_crypto_openssl
+# Once done this will define
+# LIBNGTCP2_CRYPTO_OPENSSL_FOUND - System has libngtcp2_crypto_openssl
+# LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIRS - The libngtcp2_crypto_openssl include directories
+# LIBNGTCP2_CRYPTO_OPENSSL_LIBRARIES - The libraries needed to use libngtcp2_crypto_openssl
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_LIBNGTCP2_CRYPTO_OPENSSL QUIET libngtcp2_crypto_openssl)
+
+find_path(LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR
+ NAMES ngtcp2/ngtcp2_crypto_openssl.h
+ HINTS ${PC_LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIRS}
+)
+find_library(LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY
+ NAMES ngtcp2_crypto_openssl
+ HINTS ${PC_LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY_DIRS}
+)
+
+if(LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR)
+ set(_version_regex "^#define[ \t]+NGTCP2_VERSION[ \t]+\"([^\"]+)\".*")
+ file(STRINGS "${LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR}/ngtcp2/version.h"
+ LIBNGTCP2_CRYPTO_OPENSSL_VERSION REGEX "${_version_regex}")
+ string(REGEX REPLACE "${_version_regex}" "\\1"
+ LIBNGTCP2_CRYPTO_OPENSSL_VERSION "${LIBNGTCP2_CRYPTO_OPENSSL_VERSION}")
+ unset(_version_regex)
+endif()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set
+# LIBNGTCP2_CRYPTO_OPENSSL_FOUND to TRUE if all listed variables are
+# TRUE and the requested version matches.
+find_package_handle_standard_args(Libngtcp2_crypto_openssl REQUIRED_VARS
+ LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY
+ LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR
+ VERSION_VAR LIBNGTCP2_CRYPTO_OPENSSL_VERSION)
+
+if(LIBNGTCP2_CRYPTO_OPENSSL_FOUND)
+ set(LIBNGTCP2_CRYPTO_OPENSSL_LIBRARIES ${LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY})
+ set(LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIRS ${LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR
+ LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY)
diff --git a/cmake/FindSystemd.cmake b/cmake/FindSystemd.cmake
new file mode 100644
index 0000000..e7534e5
--- /dev/null
+++ b/cmake/FindSystemd.cmake
@@ -0,0 +1,19 @@
+# - Try to find systemd
+# Once done this will define
+# SYSTEMD_FOUND - System has systemd
+# SYSTEMD_INCLUDE_DIRS - The systemd include directories
+# SYSTEMD_LIBRARIES - The libraries needed to use systemd
+
+include(FeatureSummary)
+set_package_properties(Systemd PROPERTIES
+ URL "http://freedesktop.org/wiki/Software/systemd/"
+ DESCRIPTION "System and Service Manager")
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_SYSTEMD QUIET libsystemd)
+find_library(SYSTEMD_LIBRARIES NAMES systemd ${PC_SYSTEMD_LIBRARY_DIRS})
+find_path(SYSTEMD_INCLUDE_DIRS systemd/sd-login.h HINTS ${PC_SYSTEMD_INCLUDE_DIRS})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Systemd DEFAULT_MSG SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES)
+mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES)
diff --git a/cmake/Version.cmake b/cmake/Version.cmake
new file mode 100644
index 0000000..8ac4849
--- /dev/null
+++ b/cmake/Version.cmake
@@ -0,0 +1,11 @@
+# Converts a version such as 1.2.255 to 0x0102ff
+function(HexVersion version_hex_var major minor patch)
+ math(EXPR version_dec "${major} * 256 * 256 + ${minor} * 256 + ${patch}")
+ set(version_hex "0x")
+ foreach(i RANGE 5 0 -1)
+ math(EXPR num "(${version_dec} >> (4 * ${i})) & 15")
+ string(SUBSTRING "0123456789abcdef" ${num} 1 num_hex)
+ set(version_hex "${version_hex}${num_hex}")
+ endforeach()
+ set(${version_hex_var} "${version_hex}" PARENT_SCOPE)
+endfunction()
diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in
new file mode 100644
index 0000000..2e357d5
--- /dev/null
+++ b/cmakeconfig.h.in
@@ -0,0 +1,92 @@
+/* Hint to the compiler that a function never returns */
+#define NGHTTP2_NORETURN @HINT_NORETURN@
+
+/* Define to `int' if <sys/types.h> does not define. */
+#cmakedefine ssize_t @ssize_t@
+
+/* Define to 1 if you have the `std::map::emplace`. */
+#cmakedefine HAVE_STD_MAP_EMPLACE 1
+
+/* Define to 1 if you have `libjansson` library. */
+#cmakedefine HAVE_JANSSON 1
+
+/* Define to 1 if you have `libxml2` library. */
+#cmakedefine HAVE_LIBXML2 1
+
+/* Define to 1 if you have `mruby` library. */
+#cmakedefine HAVE_MRUBY 1
+
+/* Define to 1 if you have `neverbleed` library. */
+#cmakedefine HAVE_NEVERBLEED 1
+
+/* sizeof(int *) */
+#cmakedefine SIZEOF_INT_P @SIZEOF_INT_P@
+
+/* sizeof(time_t) */
+#cmakedefine SIZEOF_TIME_T @SIZEOF_TIME_T@
+
+/* Define to 1 if you have the `_Exit` function. */
+#cmakedefine HAVE__EXIT 1
+
+/* Define to 1 if you have the `accept4` function. */
+#cmakedefine HAVE_ACCEPT4 1
+
+/* Define to 1 if you have the `mkostemp` function. */
+#cmakedefine HAVE_MKOSTEMP 1
+
+/* Define to 1 if you have the `initgroups` function. */
+#cmakedefine01 HAVE_DECL_INITGROUPS
+
+/* Define to 1 to enable debug output. */
+#cmakedefine DEBUGBUILD 1
+
+/* Define to 1 if you want to disable threads. */
+#cmakedefine NOTHREADS 1
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#cmakedefine HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#cmakedefine HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#cmakedefine HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#cmakedefine HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#cmakedefine HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#cmakedefine HAVE_PWD_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#cmakedefine HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#cmakedefine HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#cmakedefine HAVE_SYSLOG_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#cmakedefine HAVE_TIME_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
+
+/* Define to 1 if HTTP/3 is enabled. */
+#cmakedefine ENABLE_HTTP3 1
+
+/* Define to 1 if you have `libbpf` library. */
+#cmakedefine HAVE_LIBBPF 1
+
+/* Define to 1 if you have enum bpf_stats_type in linux/bpf.h. */
+#cmakedefine HAVE_BPF_STATS_TYPE 1
+
+/* Define to 1 if you have `libngtcp2_crypto_openssl` library. */
+#cmakedefine HAVE_LIBNGTCP2_CRYPTO_OPENSSL