APACHE_MODPATH_INIT(http2)
http2_objs="mod_http2.lo h2_alt_svc.lo h2_bucket_beam.lo h2_bucket_eoc.lo h2_bucket_eos.lo h2_config.lo h2_conn.lo h2_conn_io.lo h2_ctx.lo h2_filter.lo h2_from_h1.lo h2_h2.lo h2_mplx.lo h2_ngn_shed.lo h2_push.lo h2_request.lo h2_response.lo h2_session.lo h2_stream.lo h2_switch.lo h2_task.lo h2_util.lo h2_worker.lo h2_workers.lo "
AC_DEFUN([APACHE_CHECK_NGHTTP2],[
AC_CACHE_CHECK([for nghttp2], [ac_cv_nghttp2], [
ac_cv_nghttp2=no
ap_nghttp2_found=""
ap_nghttp2_base=""
ap_nghttp2_libs=""
AC_MSG_CHECKING([for user-provided nghttp2 base directory])
AC_ARG_WITH(nghttp2, APACHE_HELP_STRING(--with-nghttp2=PATH, nghttp2 installation directory), [
if test "x$withval" != "xyes" -a "x$withval" != "x"; then
ap_nghttp2_base="`cd $withval ; pwd`"
fi
])
if test "x$ap_nghttp2_base" = "x"; then
AC_MSG_RESULT(none)
else
AC_MSG_RESULT($ap_nghttp2_base)
fi
saved_CPPFLAGS="$CPPFLAGS"
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
if test -n "$PKGCONFIG"; then
saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
AC_MSG_CHECKING([for pkg-config along $PKG_CONFIG_PATH])
if test "x$ap_nghttp2_base" != "x" -a \
-f "${ap_nghttp2_base}/lib/pkgconfig/libnghttp2.pc"; then
PKG_CONFIG_PATH="${ap_nghttp2_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH
fi
AC_ARG_ENABLE(nghttp2-staticlib-deps,APACHE_HELP_STRING(--enable-nghttp2-staticlib-deps,[link mod_http2 with dependencies of libnghttp2's static libraries (as indicated by "pkg-config --static"). Must be specified in addition to --enable-http2.]), [
if test "$enableval" = "yes"; then
PKGCONFIG_LIBOPTS="--static"
fi
])
ap_nghttp2_libs="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-l --silence-errors libnghttp2`"
if test $? -eq 0; then
ap_nghttp2_found="yes"
pkglookup="`$PKGCONFIG --cflags-only-I libnghttp2`"
APR_ADDTO(CPPFLAGS, [$pkglookup])
APR_ADDTO(MOD_CFLAGS, [$pkglookup])
pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-L libnghttp2`"
APR_ADDTO(LDFLAGS, [$pkglookup])
APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-other libnghttp2`"
APR_ADDTO(LDFLAGS, [$pkglookup])
APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
fi
PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
fi
if test "x$ap_nghttp2_base" != "x" -a "x$ap_nghttp2_found" = "x"; then
APR_ADDTO(CPPFLAGS, [-I$ap_nghttp2_base/include])
APR_ADDTO(MOD_CFLAGS, [-I$ap_nghttp2_base/include])
APR_ADDTO(LDFLAGS, [-L$ap_nghttp2_base/lib])
APR_ADDTO(MOD_LDFLAGS, [-L$ap_nghttp2_base/lib])
if test "x$ap_platform_runtime_link_flag" != "x"; then
APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_nghttp2_base/lib])
APR_ADDTO(MOD_LDFLAGS, [$ap_platform_runtime_link_flag$ap_nghttp2_base/lib])
fi
fi
AC_MSG_CHECKING([for nghttp2 version >= 1.2.1])
AC_TRY_COMPILE([ [AC_MSG_RESULT(OK)
ac_cv_nghttp2=yes],
[AC_MSG_RESULT(FAILED)])
if test "x$ac_cv_nghttp2" = "xyes"; then
ap_nghttp2_libs="${ap_nghttp2_libs:--lnghttp2} `$apr_config --libs`"
APR_ADDTO(MOD_LDFLAGS, [$ap_nghttp2_libs])
APR_ADDTO(LIBS, [$ap_nghttp2_libs])
liberrors=""
AC_CHECK_HEADERS([nghttp2/nghttp2.h])
AC_CHECK_FUNCS([nghttp2_session_server_new2], [], [liberrors="yes"])
if test "x$liberrors" != "x"; then
AC_MSG_WARN([nghttp2 library is unusable])
fi
AC_CHECK_FUNCS([nghttp2_stream_get_weight], [], [liberrors="yes"])
if test "x$liberrors" != "x"; then
AC_MSG_WARN([nghttp2 version >= 1.3.0 is required])
fi
AC_CHECK_FUNCS([nghttp2_session_change_stream_priority],
[APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_CHANGE_PRIO"])], [])
else
AC_MSG_WARN([nghttp2 version is too old])
fi
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
])
if test "x$ac_cv_nghttp2" = "xyes"; then
AC_DEFINE(HAVE_NGHTTP2, 1, [Define if nghttp2 is available])
fi
])
APACHE_MODULE(http2, [HTTP/2 protocol handling in addition to HTTP protocol
handling. Implemented by mod_http2. This module requires a libnghttp2 installation.
See --with-nghttp2 on how to manage non-standard locations. This module
is usually linked shared and requires loading. ], $http2_objs, , most, [
APACHE_CHECK_OPENSSL
if test "$ac_cv_openssl" = "yes" ; then
APR_ADDTO(MOD_CPPFLAGS, ["-DH2_OPENSSL"])
fi
APACHE_CHECK_NGHTTP2
if test "$ac_cv_nghttp2" = "yes" ; then
if test "x$enable_http2" = "xshared"; then
APR_ADDTO(MOD_HTTP2_LDADD, [-export-symbols-regex http2_module])
fi
else
enable_http2=no
fi
])
proxy_http2_objs="mod_proxy_http2.lo h2_proxy_session.lo h2_proxy_util.lo "
APACHE_MODULE(proxy_http2, [HTTP/2 proxy module. This module requires a libnghttp2 installation.
See --with-nghttp2 on how to manage non-standard locations. Also requires --enable-proxy.], $proxy_http2_objs, , no, [
APACHE_CHECK_NGHTTP2
if test "$ac_cv_nghttp2" = "yes" ; then
if test "x$enable_http2" = "xshared"; then
APR_ADDTO(MOD_PROXY_HTTP2_LDADD, [-export-symbols-regex proxy_http2_module])
fi
else
enable_proxy_http2=no
fi
], proxy)
APACHE_MODPATH_FINISH