src: Don't build h2load if std::future is not working

This commit is contained in:
Tatsuhiro Tsujikawa 2014-06-18 14:24:45 +09:00
parent 8acd67b3fa
commit a344a8f566
2 changed files with 28 additions and 2 deletions

View File

@ -137,12 +137,13 @@ fi
AX_CXX_COMPILE_STDCXX_11([noext], [optional]) AX_CXX_COMPILE_STDCXX_11([noext], [optional])
AC_LANG_PUSH(C++)
# Check that std::chrono::steady_clock is available. In particular, # Check that std::chrono::steady_clock is available. In particular,
# gcc 4.6 does not have one, but has monotonic_clock which is the old # gcc 4.6 does not have one, but has monotonic_clock which is the old
# name existed in the pre-standard draft. If steady_clock is not # name existed in the pre-standard draft. If steady_clock is not
# available, don't define HAVE_STEADY_CLOCK and replace steady_clock # available, don't define HAVE_STEADY_CLOCK and replace steady_clock
# with monotonic_clock. # with monotonic_clock.
AC_LANG_PUSH(C++)
AC_MSG_CHECKING([whether std::chrono::steady_clock is available]) AC_MSG_CHECKING([whether std::chrono::steady_clock is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[ [[
@ -155,6 +156,24 @@ auto tp = std::chrono::steady_clock::now();
[Define to 1 if you have the `std::chrono::steady_clock`.]) [Define to 1 if you have the `std::chrono::steady_clock`.])
AC_MSG_RESULT([yes])], AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]) [AC_MSG_RESULT([no])])
# Check that std::future is available.
AC_MSG_CHECKING([whether std::future is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[
#include <vector>
#include <future>
]],
[[
std::vector<std::future<int>> v;
]])],
[AC_DEFINE([HAVE_STD_FUTURE], [1],
[Define to 1 if you have the `std::future`.])
have_std_future=yes
AC_MSG_RESULT([yes])],
[have_std_future=no
AC_MSG_RESULT([no])])
AC_LANG_POP() AC_LANG_POP()
# Checks for libraries. # Checks for libraries.
@ -324,6 +343,7 @@ if test "x${request_app}" = "xyes" &&
fi fi
AM_CONDITIONAL([ENABLE_APP], [ test "x${enable_app}" = "xyes" ]) AM_CONDITIONAL([ENABLE_APP], [ test "x${enable_app}" = "xyes" ])
AM_CONDITIONAL([ENABLE_H2LOAD], [ test "x${have_std_future}" = "xyes" ])
enable_hpack_tools=no enable_hpack_tools=no
# HPACK tools requires jansson # HPACK tools requires jansson

View File

@ -54,7 +54,7 @@ LDADD = \
if ENABLE_APP if ENABLE_APP
bin_PROGRAMS += nghttp nghttpd nghttpx h2load bin_PROGRAMS += nghttp nghttpd nghttpx
HELPER_OBJECTS = util.cc http2.cc timegm.c app_helper.cc nghttp2_gzip.c HELPER_OBJECTS = util.cc http2.cc timegm.c app_helper.cc nghttp2_gzip.c
HELPER_HFILES = util.h http2.h timegm.h app_helper.h nghttp2_config.h \ HELPER_HFILES = util.h http2.h timegm.h app_helper.h nghttp2_config.h \
@ -74,6 +74,10 @@ nghttpd_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttpd.cc \
ssl.cc ssl.h \ ssl.cc ssl.h \
HttpServer.cc HttpServer.h HttpServer.cc HttpServer.h
if ENABLE_H2LOAD
bin_PROGRAMS += h2load
h2load_SOURCES = util.cc util.h http2.cc http2.h h2load.cc h2load.h \ h2load_SOURCES = util.cc util.h http2.cc http2.h h2load.cc h2load.h \
timegm.c timegm.h \ timegm.c timegm.h \
ssl.cc ssl.h \ ssl.cc ssl.h \
@ -84,6 +88,8 @@ if HAVE_SPDYLAY
h2load_SOURCES += h2load_spdy_session.cc h2load_spdy_session.h h2load_SOURCES += h2load_spdy_session.cc h2load_spdy_session.h
endif # HAVE_SPDYLAY endif # HAVE_SPDYLAY
endif # ENABLE_H2LOAD
NGHTTPX_SRCS = \ NGHTTPX_SRCS = \
util.cc util.h http2.cc http2.h timegm.c timegm.h base64.h \ util.cc util.h http2.cc http2.h timegm.c timegm.h base64.h \
app_helper.cc app_helper.h \ app_helper.cc app_helper.h \