Refactor configure options
--enable-src is renamed as --enable-app. Fix build failure if libxml2 is not available.
This commit is contained in:
parent
d1c109f59e
commit
9dcd6b003d
85
configure.ac
85
configure.ac
|
@ -53,25 +53,30 @@ AC_ARG_ENABLE([maintainer-mode],
|
||||||
[Turn on compile time warnings])],
|
[Turn on compile time warnings])],
|
||||||
[maintainer_mode=$enableval], [maintainer_mode=no])
|
[maintainer_mode=$enableval], [maintainer_mode=no])
|
||||||
|
|
||||||
AC_ARG_ENABLE([src],
|
AC_ARG_ENABLE([app],
|
||||||
[AS_HELP_STRING([--enable-src],
|
[AS_HELP_STRING([--enable-app],
|
||||||
[Build installable SPDY client/server programs in src])],
|
[Build applications (nghttp, nghttpd and nghttpx) [default=check]])],
|
||||||
[request_src=$enableval], [request_src=yes])
|
[request_app=$enableval], [request_app=check])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([hpack-tools],
|
||||||
|
[AS_HELP_STRING([--enable-hpack-tools],
|
||||||
|
[Build HPACK tools [default=check]])],
|
||||||
|
[request_hpack_tools=$enableval], [request_hpack_tools=check])
|
||||||
|
|
||||||
AC_ARG_ENABLE([examples],
|
AC_ARG_ENABLE([examples],
|
||||||
[AS_HELP_STRING([--enable-examples],
|
[AS_HELP_STRING([--enable-examples],
|
||||||
[Build example programs])],
|
[Build examples [default=check]])],
|
||||||
[request_examples=$enableval], [request_examples=yes])
|
[request_examples=$enableval], [request_examples=check])
|
||||||
|
|
||||||
AC_ARG_ENABLE([failmalloc],
|
AC_ARG_ENABLE([failmalloc],
|
||||||
[AS_HELP_STRING([--enable-failmalloc],
|
[AS_HELP_STRING([--enable-failmalloc],
|
||||||
[Build failmalloc test program])],
|
[Build failmalloc test program [default=no]])],
|
||||||
[request_failmalloc=$enableval], [request_failmalloc=no])
|
[request_failmalloc=$enableval], [request_failmalloc=no])
|
||||||
|
|
||||||
AC_ARG_WITH([libxml2],
|
AC_ARG_WITH([libxml2],
|
||||||
[AS_HELP_STRING([--without-libxml2],
|
[AS_HELP_STRING([--with-libxml2],
|
||||||
[disable support for libxml2])],
|
[Use libxml2 [default=check]])],
|
||||||
[], [with_libxml2=yes])
|
[request_libxml2=$withval], [request_libxml2=check])
|
||||||
|
|
||||||
dnl Define variables
|
dnl Define variables
|
||||||
AC_ARG_VAR([CYTHON], [the Cython executable])
|
AC_ARG_VAR([CYTHON], [the Cython executable])
|
||||||
|
@ -205,12 +210,18 @@ fi
|
||||||
|
|
||||||
# libxml2 (for src/nghttp)
|
# libxml2 (for src/nghttp)
|
||||||
have_libxml2=no
|
have_libxml2=no
|
||||||
if test "x$with_libxml2" != "xno"; then
|
if test "x${request_libxml2}" != "xno"; then
|
||||||
AM_PATH_XML2(2.7.7, [have_libxml2=yes], [have_libxml2=no])
|
AM_PATH_XML2(2.7.7, [have_libxml2=yes], [have_libxml2=no])
|
||||||
if test "x${have_libxml2}" = "xyes"; then
|
if test "x${have_libxml2}" = "xyes"; then
|
||||||
AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have `libxml2` library.])
|
AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have `libxml2` library.])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "x${request_libxml2}" = "xyes" &&
|
||||||
|
test "x${have_libxml2}" != "xyes"; then
|
||||||
|
AC_MSG_ERROR([libxml2 was requested (--with-libxml2) but not found])
|
||||||
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL([HAVE_LIBXML2], [ test "x${have_libxml2}" = "xyes" ])
|
AM_CONDITIONAL([HAVE_LIBXML2], [ test "x${have_libxml2}" = "xyes" ])
|
||||||
|
|
||||||
# spdylay (for src/nghttpx)
|
# spdylay (for src/nghttpx)
|
||||||
|
@ -224,32 +235,50 @@ else
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([HAVE_SPDYLAY], [ test "x${have_spdylay}" = "xyes" ])
|
AM_CONDITIONAL([HAVE_SPDYLAY], [ test "x${have_spdylay}" = "xyes" ])
|
||||||
|
|
||||||
# The programs under src depend on OpenSSL and libevent_openssl
|
# The nghttp, nghttpd and nghttpx under src depend on OpenSSL and
|
||||||
enable_src=no
|
# libevent_openssl
|
||||||
if test "x${request_src}" = "xyes" &&
|
enable_app=no
|
||||||
|
if test "x${request_app}" != "xno" &&
|
||||||
test "x${have_openssl}" = "xyes" &&
|
test "x${have_openssl}" = "xyes" &&
|
||||||
test "x${have_libevent_openssl}" = "xyes"; then
|
test "x${have_libevent_openssl}" = "xyes"; then
|
||||||
enable_src=yes
|
enable_app=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL([ENABLE_SRC], [ test "x${enable_src}" = "xyes" ])
|
if test "x${request_app}" = "xyes" &&
|
||||||
|
test "x${enable_app}" != "xyes"; then
|
||||||
|
AC_MSG_ERROR([applications were requested (--enable-app) but dependencies are not met.])
|
||||||
|
fi
|
||||||
|
|
||||||
# The example programs depend on OpenSSL
|
AM_CONDITIONAL([ENABLE_APP], [ test "x${enable_app}" = "xyes" ])
|
||||||
|
|
||||||
|
enable_hpack_tools=no
|
||||||
|
# HPACK tools requires jansson
|
||||||
|
if test "x${request_hpack_tools}" != "xno" &&
|
||||||
|
test "x${have_jansson}" = "xyes"; then
|
||||||
|
enable_hpack_tools=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x${request_hpack_tools}" = "xyes" &&
|
||||||
|
test "x${enable_hpack_tools}" != "xyes"; then
|
||||||
|
AC_MSG_ERROR([HPACK tools were requested (--enable-hpack-tools) but dependencies are not met.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AM_CONDITIONAL([ENABLE_HPACK_TOOLS], [ test "x${enable_hpack_tools}" = "xyes" ])
|
||||||
|
|
||||||
|
# The example programs depend on OpenSSL and libevent_openssl
|
||||||
enable_examples=no
|
enable_examples=no
|
||||||
if test "x${request_examples}" = "xyes" &&
|
if test "x${request_examples}" != "xno" &&
|
||||||
test "x${have_openssl}" = "xyes" &&
|
test "x${have_openssl}" = "xyes" &&
|
||||||
test "x${have_libevent_openssl}" = "xyes"; then
|
test "x${have_libevent_openssl}" = "xyes"; then
|
||||||
enable_examples=yes
|
enable_examples=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL([ENABLE_EXAMPLES], [ test "x${enable_examples}" = "xyes" ])
|
if test "x${request_examples}" = "xyes" &&
|
||||||
|
test "x${enable_examples}" != "xyes"; then
|
||||||
# HPACK tools requires jansson
|
AC_MSG_ERROR([examples were requested (--enable-examples) but dependencies are not met.])
|
||||||
if test "x${have_jansson}" = "xyes"; then
|
|
||||||
enable_hpack_tools=yes
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL([ENABLE_HPACK_TOOLS], [ test "x${enable_hpack_tools}" = "xyes" ])
|
AM_CONDITIONAL([ENABLE_EXAMPLES], [ test "x${enable_examples}" = "xyes" ])
|
||||||
|
|
||||||
# failmalloc tests
|
# failmalloc tests
|
||||||
AM_CONDITIONAL([ENABLE_FAILMALLOC], [ test "x${enable_failmalloc}" = "xyes" ])
|
AM_CONDITIONAL([ENABLE_FAILMALLOC], [ test "x${enable_failmalloc}" = "xyes" ])
|
||||||
|
@ -349,16 +378,16 @@ AC_MSG_NOTICE([summary of build options:
|
||||||
CXXFLAGS: ${CXXFLAGS}
|
CXXFLAGS: ${CXXFLAGS}
|
||||||
CXXCPP: ${CXXCPP}
|
CXXCPP: ${CXXCPP}
|
||||||
Library types: Shared=${enable_shared}, Static=${enable_static}
|
Library types: Shared=${enable_shared}, Static=${enable_static}
|
||||||
|
Python: ${PYTHON} ${PYTHON_VERSION}
|
||||||
|
Cython: ${CYTHON}
|
||||||
CUnit: ${have_cunit}
|
CUnit: ${have_cunit}
|
||||||
OpenSSL: ${have_openssl}
|
OpenSSL: ${have_openssl}
|
||||||
Libxml2: ${have_libxml2}
|
Libxml2: ${have_libxml2}
|
||||||
Libevent(SSL): ${have_libevent_openssl}
|
Libevent(SSL): ${have_libevent_openssl}
|
||||||
Spdylay: ${have_spdylay}
|
Spdylay: ${have_spdylay}
|
||||||
Jansson: ${have_jansson}
|
Jansson: ${have_jansson}
|
||||||
Src: ${enable_src}
|
Applications: ${enable_app}
|
||||||
Examples: ${enable_examples}
|
|
||||||
HPACK tools: ${enable_hpack_tools}
|
HPACK tools: ${enable_hpack_tools}
|
||||||
|
Examples: ${enable_examples}
|
||||||
Failmalloc: ${request_failmalloc}
|
Failmalloc: ${request_failmalloc}
|
||||||
Python: ${PYTHON} ${PYTHON_VERSION}
|
|
||||||
Cython: ${CYTHON}
|
|
||||||
])
|
])
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
#include <libxml/HTMLparser.h>
|
#include <libxml/HTMLparser.h>
|
||||||
|
|
||||||
|
#endif // HAVE_LIBXML2
|
||||||
|
|
||||||
namespace nghttp2 {
|
namespace nghttp2 {
|
||||||
|
|
||||||
enum RequestPriority {
|
enum RequestPriority {
|
||||||
|
@ -49,6 +51,8 @@ struct ParserData {
|
||||||
ParserData(const std::string& base_uri);
|
ParserData(const std::string& base_uri);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBXML2
|
||||||
|
|
||||||
class HtmlParser {
|
class HtmlParser {
|
||||||
public:
|
public:
|
||||||
HtmlParser(const std::string& base_uri);
|
HtmlParser(const std::string& base_uri);
|
||||||
|
@ -65,24 +69,21 @@ private:
|
||||||
ParserData parser_data_;
|
ParserData parser_data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nghttp2
|
|
||||||
|
|
||||||
#else // !HAVE_LIBXML2
|
#else // !HAVE_LIBXML2
|
||||||
|
|
||||||
namespace nghttp2 {
|
|
||||||
|
|
||||||
class HtmlParser {
|
class HtmlParser {
|
||||||
public:
|
public:
|
||||||
HtmlParser(const std::string& base_uri) {}
|
HtmlParser(const std::string& base_uri) {}
|
||||||
int parse_chunk(const char *chunk, size_t size, int fin) { return 0; }
|
int parse_chunk(const char *chunk, size_t size, int fin) { return 0; }
|
||||||
const std::vector<std::string>& get_links() const { return links_; }
|
const std::vector<std::pair<std::string, RequestPriority>>&
|
||||||
|
get_links() const { return links_; }
|
||||||
void clear_links() {}
|
void clear_links() {}
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> links_;
|
std::vector<std::pair<std::string, RequestPriority>> links_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nghttp2
|
|
||||||
|
|
||||||
#endif // !HAVE_LIBXML2
|
#endif // !HAVE_LIBXML2
|
||||||
|
|
||||||
|
} // namespace nghttp2
|
||||||
|
|
||||||
#endif // HTML_PARSER_H
|
#endif // HTML_PARSER_H
|
||||||
|
|
|
@ -25,8 +25,6 @@ bin_PROGRAMS =
|
||||||
check_PROGRAMS =
|
check_PROGRAMS =
|
||||||
TESTS =
|
TESTS =
|
||||||
|
|
||||||
if ENABLE_SRC
|
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-Wall \
|
-Wall \
|
||||||
-I$(top_srcdir)/lib/includes \
|
-I$(top_srcdir)/lib/includes \
|
||||||
|
@ -48,6 +46,8 @@ AM_LDFLAGS = \
|
||||||
|
|
||||||
LDADD = $(top_builddir)/lib/libnghttp2.la
|
LDADD = $(top_builddir)/lib/libnghttp2.la
|
||||||
|
|
||||||
|
if ENABLE_APP
|
||||||
|
|
||||||
bin_PROGRAMS += nghttp nghttpd nghttpx
|
bin_PROGRAMS += nghttp nghttpd nghttpx
|
||||||
|
|
||||||
HELPER_OBJECTS = util.cc http2.cc timegm.c app_helper.cc
|
HELPER_OBJECTS = util.cc http2.cc timegm.c app_helper.cc
|
||||||
|
@ -119,6 +119,8 @@ nghttpx_unittest_LDADD = libnghttpx.a ${LDADD} ${AM_LDFLAGS} \
|
||||||
TESTS += nghttpx-unittest
|
TESTS += nghttpx-unittest
|
||||||
endif # HAVE_CUNIT
|
endif # HAVE_CUNIT
|
||||||
|
|
||||||
|
endif # ENABLE_APP
|
||||||
|
|
||||||
if ENABLE_HPACK_TOOLS
|
if ENABLE_HPACK_TOOLS
|
||||||
|
|
||||||
bin_PROGRAMS += inflatehd deflatehd
|
bin_PROGRAMS += inflatehd deflatehd
|
||||||
|
@ -130,5 +132,3 @@ inflatehd_SOURCES = inflatehd.c $(HPACK_TOOLS_COMMON_SRCS)
|
||||||
deflatehd_SOURCES = deflatehd.c $(HPACK_TOOLS_COMMON_SRCS)
|
deflatehd_SOURCES = deflatehd.c $(HPACK_TOOLS_COMMON_SRCS)
|
||||||
|
|
||||||
endif # ENABLE_HPACK_TOOLS
|
endif # ENABLE_HPACK_TOOLS
|
||||||
|
|
||||||
endif # ENABLE_SRC
|
|
||||||
|
|
|
@ -69,11 +69,11 @@ if ENABLE_FAILMALLOC
|
||||||
TESTS += failmalloc
|
TESTS += failmalloc
|
||||||
endif # ENABLE_FAILMALLOC
|
endif # ENABLE_FAILMALLOC
|
||||||
|
|
||||||
if ENABLE_SRC
|
if ENABLE_APP
|
||||||
|
|
||||||
# EXTRA_DIST = end_to_end.py
|
# EXTRA_DIST = end_to_end.py
|
||||||
# TESTS += end_to_end.py
|
# TESTS += end_to_end.py
|
||||||
|
|
||||||
endif # ENABLE_SRC
|
endif # ENABLE_APP
|
||||||
|
|
||||||
endif # HAVE_CUNIT
|
endif # HAVE_CUNIT
|
||||||
|
|
Loading…
Reference in New Issue