cmake: improve Spdylay detection
Auto-detect spdylay availability using CMake, making pkg-config completely optional.
This commit is contained in:
parent
9bc6dc7113
commit
1b67b2d33e
|
@ -71,13 +71,11 @@ find_package(LibXml2 QUIET)
|
||||||
set(WITH_LIBXML2_DEFAULT ${LIBXML2_FOUND})
|
set(WITH_LIBXML2_DEFAULT ${LIBXML2_FOUND})
|
||||||
find_package(Jemalloc QUIET)
|
find_package(Jemalloc QUIET)
|
||||||
set(WITH_JEMALLOC_DEFAULT ${JEMALLOC_FOUND})
|
set(WITH_JEMALLOC_DEFAULT ${JEMALLOC_FOUND})
|
||||||
find_package(SPDYLAY QUIET)
|
find_package(Spdylay 1.3.2 QUIET)
|
||||||
set(WITH_SPDYLAY_DEFAULT ${SPDYLAY_FOUND})
|
set(WITH_SPDYLAY_DEFAULT ${SPDYLAY_FOUND})
|
||||||
|
|
||||||
include(CMakeOptions.txt)
|
include(CMakeOptions.txt)
|
||||||
|
|
||||||
find_package(PkgConfig 0.20)
|
|
||||||
|
|
||||||
if(ENABLE_LIB_ONLY)
|
if(ENABLE_LIB_ONLY)
|
||||||
set(ENABLE_APP OFF)
|
set(ENABLE_APP OFF)
|
||||||
set(ENABLE_HPACK_TOOLS OFF)
|
set(ENABLE_HPACK_TOOLS OFF)
|
||||||
|
@ -166,32 +164,6 @@ if(CUNIT_FOUND)
|
||||||
else()
|
else()
|
||||||
set(HAVE_CUNIT 0)
|
set(HAVE_CUNIT 0)
|
||||||
endif()
|
endif()
|
||||||
# # If pkg-config does not find cunit, check it using AC_CHECK_LIB. We
|
|
||||||
# # do this because Debian (Ubuntu) lacks pkg-config file for cunit.
|
|
||||||
# if test "x${have_cunit}" = "xno"; then
|
|
||||||
# AC_MSG_WARN([${CUNIT_PKG_ERRORS}])
|
|
||||||
# AC_CHECK_LIB([cunit], [CU_initialize_registry],
|
|
||||||
# [have_cunit=yes], [have_cunit=no])
|
|
||||||
# if test "x${have_cunit}" = "xyes"; then
|
|
||||||
# CUNIT_LIBS="-lcunit"
|
|
||||||
# CUNIT_CFLAGS=""
|
|
||||||
# AC_SUBST([CUNIT_LIBS])
|
|
||||||
# AC_SUBST([CUNIT_CFLAGS])
|
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
# if test "x${have_cunit}" = "xyes"; then
|
|
||||||
# # cunit in Mac OS X requires ncurses. Note that in Mac OS X, test
|
|
||||||
# # program can be built without -lncurses, but it emits runtime
|
|
||||||
# # error.
|
|
||||||
# case "${build}" in
|
|
||||||
# *-apple-darwin*)
|
|
||||||
# CUNIT_LIBS="$CUNIT_LIBS -lncurses"
|
|
||||||
# AC_SUBST([CUNIT_LIBS])
|
|
||||||
# ;;
|
|
||||||
# esac
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ])
|
|
||||||
|
|
||||||
if(ENABLE_APP)
|
if(ENABLE_APP)
|
||||||
find_package(OpenSSL 1.0.1 REQUIRED)
|
find_package(OpenSSL 1.0.1 REQUIRED)
|
||||||
|
@ -258,14 +230,8 @@ endif()
|
||||||
|
|
||||||
# spdylay (for src/nghttpx and src/h2load)
|
# spdylay (for src/nghttpx and src/h2load)
|
||||||
if(WITH_SPDYLAY)
|
if(WITH_SPDYLAY)
|
||||||
pkg_check_modules(LIBSPDYLAY libspdylay>=1.3.2)
|
find_package(Spdylay 1.3.2 REQUIRED)
|
||||||
if(LIBSPDYLAY_FOUND)
|
|
||||||
set(HAVE_SPDYLAY 1)
|
set(HAVE_SPDYLAY 1)
|
||||||
else()
|
|
||||||
set(HAVE_SPDYLAY 0)
|
|
||||||
message(STATUS "The SPDY support in nghttpx and h2load will be disabled.")
|
|
||||||
endif()
|
|
||||||
# XXX fail if WITH_SPDYLAY=ON
|
|
||||||
else()
|
else()
|
||||||
set(HAVE_SPDYLAY 0)
|
set(HAVE_SPDYLAY 0)
|
||||||
endif()
|
endif()
|
||||||
|
@ -549,7 +515,7 @@ message(STATUS "summary of build options:
|
||||||
Libxml2: ${HAVE_LIBXML2} (LIBS='${LIBXML2_LIBRARIES}')
|
Libxml2: ${HAVE_LIBXML2} (LIBS='${LIBXML2_LIBRARIES}')
|
||||||
Libev: ${HAVE_LIBEV} (LIBS='${LIBEV_LIBRARIES}')
|
Libev: ${HAVE_LIBEV} (LIBS='${LIBEV_LIBRARIES}')
|
||||||
Libevent(SSL): ${HAVE_LIBEVENT_OPENSSL} (LIBS='${LIBEVENT_OPENSSL_LIBRARIES}')
|
Libevent(SSL): ${HAVE_LIBEVENT_OPENSSL} (LIBS='${LIBEVENT_OPENSSL_LIBRARIES}')
|
||||||
Spdylay: ${HAVE_SPDYLAY} (LIBS='${LIBSPDYLAY_LIBRARIES}')
|
Spdylay: ${HAVE_SPDYLAY} (LIBS='${SPDYLAY_LIBRARIES}')
|
||||||
Jansson: ${HAVE_JANSSON} (LIBS='${JANSSON_LIBRARIES}')
|
Jansson: ${HAVE_JANSSON} (LIBS='${JANSSON_LIBRARIES}')
|
||||||
Jemalloc: ${HAVE_JEMALLOC} (LIBS='${JEMALLOC_LIBRARIES}')
|
Jemalloc: ${HAVE_JEMALLOC} (LIBS='${JEMALLOC_LIBRARIES}')
|
||||||
Zlib: ${HAVE_ZLIB} (LIBS='${ZLIB_LIBRARIES}')
|
Zlib: ${HAVE_ZLIB} (LIBS='${ZLIB_LIBRARIES}')
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
# - Try to find spdylay
|
||||||
|
# Once done this will define
|
||||||
|
# SPDYLAY_FOUND - System has spdylay
|
||||||
|
# SPDYLAY_INCLUDE_DIRS - The spdylay include directories
|
||||||
|
# SPDYLAY_LIBRARIES - The libraries needed to use spdylay
|
||||||
|
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
pkg_check_modules(PC_SPDYLAY QUIET libspdylay)
|
||||||
|
|
||||||
|
find_path(SPDYLAY_INCLUDE_DIR
|
||||||
|
NAMES spdylay/spdylay.h
|
||||||
|
HINTS ${PC_SPDYLAY_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
find_library(SPDYLAY_LIBRARY
|
||||||
|
NAMES spdylay
|
||||||
|
HINTS ${PC_SPDYLAY_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(SPDYLAY_INCLUDE_DIR)
|
||||||
|
set(_version_regex "^#define[ \t]+SPDYLAY_VERSION[ \t]+\"([^\"]+)\".*")
|
||||||
|
file(STRINGS "${SPDYLAY_INCLUDE_DIR}/spdylay/spdylayver.h"
|
||||||
|
SPDYLAY_VERSION REGEX "${_version_regex}")
|
||||||
|
string(REGEX REPLACE "${_version_regex}" "\\1"
|
||||||
|
SPDYLAY_VERSION "${SPDYLAY_VERSION}")
|
||||||
|
unset(_version_regex)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set SPDYLAY_FOUND to TRUE
|
||||||
|
# if all listed variables are TRUE and the requested version matches.
|
||||||
|
find_package_handle_standard_args(Spdylay REQUIRED_VARS
|
||||||
|
SPDYLAY_LIBRARY SPDYLAY_INCLUDE_DIR
|
||||||
|
VERSION_VAR SPDYLAY_VERSION)
|
||||||
|
|
||||||
|
if(SPDYLAY_FOUND)
|
||||||
|
set(SPDYLAY_LIBRARIES ${SPDYLAY_LIBRARY})
|
||||||
|
set(SPDYLAY_INCLUDE_DIRS ${SPDYLAY_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(SPDYLAY_INCLUDE_DIR SPDYLAY_LIBRARY)
|
|
@ -16,7 +16,7 @@ include_directories(
|
||||||
"${CMAKE_SOURCE_DIR}/third-party"
|
"${CMAKE_SOURCE_DIR}/third-party"
|
||||||
|
|
||||||
${JEMALLOC_INCLUDE_DIRS}
|
${JEMALLOC_INCLUDE_DIRS}
|
||||||
${LIBSPDYLAY_INCLUDE_DIRS}
|
${SPDYLAY_INCLUDE_DIRS}
|
||||||
${LIBXML2_INCLUDE_DIR}
|
${LIBXML2_INCLUDE_DIR}
|
||||||
${LIBEV_INCLUDE_DIRS}
|
${LIBEV_INCLUDE_DIRS}
|
||||||
${OPENSSL_INCLUDE_DIRS}
|
${OPENSSL_INCLUDE_DIRS}
|
||||||
|
@ -28,7 +28,7 @@ include_directories(
|
||||||
link_libraries(
|
link_libraries(
|
||||||
nghttp2
|
nghttp2
|
||||||
${JEMALLOC_LIBRARIES}
|
${JEMALLOC_LIBRARIES}
|
||||||
${LIBSPDYLAY_LIBRARIES}
|
${SPDYLAY_LIBRARIES}
|
||||||
${LIBXML2_LIBRARIES}
|
${LIBXML2_LIBRARIES}
|
||||||
${LIBEV_LIBRARIES}
|
${LIBEV_LIBRARIES}
|
||||||
${OPENSSL_LIBRARIES}
|
${OPENSSL_LIBRARIES}
|
||||||
|
|
Loading…
Reference in New Issue