|
Packit |
90a5c9 |
dnl Licensed to the Apache Software Foundation (ASF) under one or more
|
|
Packit |
90a5c9 |
dnl contributor license agreements. See the NOTICE file distributed with
|
|
Packit |
90a5c9 |
dnl this work for additional information regarding copyright ownership.
|
|
Packit |
90a5c9 |
dnl The ASF licenses this file to You under the Apache License, Version 2.0
|
|
Packit |
90a5c9 |
dnl (the "License"); you may not use this file except in compliance with
|
|
Packit |
90a5c9 |
dnl the License. You may obtain a copy of the License at
|
|
Packit |
90a5c9 |
dnl
|
|
Packit |
90a5c9 |
dnl http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
90a5c9 |
dnl
|
|
Packit |
90a5c9 |
dnl Unless required by applicable law or agreed to in writing, software
|
|
Packit |
90a5c9 |
dnl distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
90a5c9 |
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
90a5c9 |
dnl See the License for the specific language governing permissions and
|
|
Packit |
90a5c9 |
dnl limitations under the License.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl # start of module specific part
|
|
Packit |
90a5c9 |
APACHE_MODPATH_INIT(http2)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl # list of module object files
|
|
Packit |
90a5c9 |
http2_objs="dnl
|
|
Packit |
90a5c9 |
mod_http2.lo dnl
|
|
Packit |
90a5c9 |
h2_alt_svc.lo dnl
|
|
Packit |
90a5c9 |
h2_bucket_beam.lo dnl
|
|
Packit |
90a5c9 |
h2_bucket_eos.lo dnl
|
|
Packit |
90a5c9 |
h2_config.lo dnl
|
|
Packit |
90a5c9 |
h2_conn.lo dnl
|
|
Packit |
90a5c9 |
h2_conn_io.lo dnl
|
|
Packit |
90a5c9 |
h2_ctx.lo dnl
|
|
Packit |
90a5c9 |
h2_filter.lo dnl
|
|
Packit |
90a5c9 |
h2_from_h1.lo dnl
|
|
Packit |
90a5c9 |
h2_h2.lo dnl
|
|
Packit |
90a5c9 |
h2_headers.lo dnl
|
|
Packit |
90a5c9 |
h2_mplx.lo dnl
|
|
Packit |
90a5c9 |
h2_ngn_shed.lo dnl
|
|
Packit |
90a5c9 |
h2_push.lo dnl
|
|
Packit |
90a5c9 |
h2_request.lo dnl
|
|
Packit |
90a5c9 |
h2_session.lo dnl
|
|
Packit |
90a5c9 |
h2_stream.lo dnl
|
|
Packit |
90a5c9 |
h2_switch.lo dnl
|
|
Packit |
90a5c9 |
h2_task.lo dnl
|
|
Packit |
90a5c9 |
h2_util.lo dnl
|
|
Packit |
90a5c9 |
h2_workers.lo dnl
|
|
Packit |
90a5c9 |
"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl
|
|
Packit |
90a5c9 |
dnl APACHE_CHECK_NGHTTP2
|
|
Packit |
90a5c9 |
dnl
|
|
Packit |
90a5c9 |
dnl Configure for nghttp2, giving preference to
|
|
Packit |
90a5c9 |
dnl "--with-nghttp2=<path>" if it was specified.
|
|
Packit |
90a5c9 |
dnl
|
|
Packit |
90a5c9 |
AC_DEFUN([APACHE_CHECK_NGHTTP2],[
|
|
Packit |
90a5c9 |
AC_CACHE_CHECK([for nghttp2], [ac_cv_nghttp2], [
|
|
Packit |
90a5c9 |
dnl initialise the variables we use
|
|
Packit |
90a5c9 |
ac_cv_nghttp2=no
|
|
Packit |
90a5c9 |
ap_nghttp2_found=""
|
|
Packit |
90a5c9 |
ap_nghttp2_base=""
|
|
Packit |
90a5c9 |
ap_nghttp2_libs=""
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl Determine the nghttp2 base directory, if any
|
|
Packit |
90a5c9 |
AC_MSG_CHECKING([for user-provided nghttp2 base directory])
|
|
Packit |
90a5c9 |
AC_ARG_WITH(nghttp2, APACHE_HELP_STRING(--with-nghttp2=PATH, nghttp2 installation directory), [
|
|
Packit |
90a5c9 |
dnl If --with-nghttp2 specifies a directory, we use that directory
|
|
Packit |
90a5c9 |
if test "x$withval" != "xyes" -a "x$withval" != "x"; then
|
|
Packit |
90a5c9 |
dnl This ensures $withval is actually a directory and that it is absolute
|
|
Packit |
90a5c9 |
ap_nghttp2_base="`cd $withval ; pwd`"
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
])
|
|
Packit |
90a5c9 |
if test "x$ap_nghttp2_base" = "x"; then
|
|
Packit |
90a5c9 |
AC_MSG_RESULT(none)
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
AC_MSG_RESULT($ap_nghttp2_base)
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl Run header and version checks
|
|
Packit |
90a5c9 |
saved_CPPFLAGS="$CPPFLAGS"
|
|
Packit |
90a5c9 |
saved_LIBS="$LIBS"
|
|
Packit |
90a5c9 |
saved_LDFLAGS="$LDFLAGS"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl Before doing anything else, load in pkg-config variables
|
|
Packit |
90a5c9 |
if test -n "$PKGCONFIG"; then
|
|
Packit |
90a5c9 |
saved_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
|
|
Packit |
90a5c9 |
AC_MSG_CHECKING([for pkg-config along $PKG_CONFIG_PATH])
|
|
Packit |
90a5c9 |
if test "x$ap_nghttp2_base" != "x" ; then
|
|
Packit |
90a5c9 |
if test -f "${ap_nghttp2_base}/lib/pkgconfig/libnghttp2.pc"; then
|
|
Packit |
90a5c9 |
dnl Ensure that the given path is used by pkg-config too, otherwise
|
|
Packit |
90a5c9 |
dnl the system libnghttp2.pc might be picked up instead.
|
|
Packit |
90a5c9 |
PKG_CONFIG_PATH="${ap_nghttp2_base}/lib/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
|
|
Packit |
90a5c9 |
export PKG_CONFIG_PATH
|
|
Packit |
90a5c9 |
elif test -f "${ap_nghttp2_base}/lib64/pkgconfig/libnghttp2.pc"; then
|
|
Packit |
90a5c9 |
dnl Ensure that the given path is used by pkg-config too, otherwise
|
|
Packit |
90a5c9 |
dnl the system libnghttp2.pc might be picked up instead.
|
|
Packit |
90a5c9 |
PKG_CONFIG_PATH="${ap_nghttp2_base}/lib64/pkgconfig${PKG_CONFIG_PATH+:}${PKG_CONFIG_PATH}"
|
|
Packit |
90a5c9 |
export PKG_CONFIG_PATH
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
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.]), [
|
|
Packit |
90a5c9 |
if test "$enableval" = "yes"; then
|
|
Packit |
90a5c9 |
PKGCONFIG_LIBOPTS="--static"
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
])
|
|
Packit |
90a5c9 |
ap_nghttp2_libs="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-l --silence-errors libnghttp2`"
|
|
Packit |
90a5c9 |
if test $? -eq 0; then
|
|
Packit |
90a5c9 |
ap_nghttp2_found="yes"
|
|
Packit |
90a5c9 |
pkglookup="`$PKGCONFIG --cflags-only-I libnghttp2`"
|
|
Packit |
90a5c9 |
APR_ADDTO(CPPFLAGS, [$pkglookup])
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_CFLAGS, [$pkglookup])
|
|
Packit |
90a5c9 |
pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-L libnghttp2`"
|
|
Packit |
90a5c9 |
APR_ADDTO(LDFLAGS, [$pkglookup])
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
|
|
Packit |
90a5c9 |
pkglookup="`$PKGCONFIG $PKGCONFIG_LIBOPTS --libs-only-other libnghttp2`"
|
|
Packit |
90a5c9 |
APR_ADDTO(LDFLAGS, [$pkglookup])
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_LDFLAGS, [$pkglookup])
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
PKG_CONFIG_PATH="$saved_PKG_CONFIG_PATH"
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl fall back to the user-supplied directory if not found via pkg-config
|
|
Packit |
90a5c9 |
if test "x$ap_nghttp2_base" != "x" -a "x$ap_nghttp2_found" = "x"; then
|
|
Packit |
90a5c9 |
APR_ADDTO(CPPFLAGS, [-I$ap_nghttp2_base/include])
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_CFLAGS, [-I$ap_nghttp2_base/include])
|
|
Packit |
90a5c9 |
APR_ADDTO(LDFLAGS, [-L$ap_nghttp2_base/lib])
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_LDFLAGS, [-L$ap_nghttp2_base/lib])
|
|
Packit |
90a5c9 |
if test "x$ap_platform_runtime_link_flag" != "x"; then
|
|
Packit |
90a5c9 |
APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_nghttp2_base/lib])
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_LDFLAGS, [$ap_platform_runtime_link_flag$ap_nghttp2_base/lib])
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AC_MSG_CHECKING([for nghttp2 version >= 1.2.1])
|
|
Packit |
90a5c9 |
AC_TRY_COMPILE([#include <nghttp2/nghttp2ver.h>],[
|
|
Packit |
90a5c9 |
#if !defined(NGHTTP2_VERSION_NUM)
|
|
Packit |
90a5c9 |
#error "Missing nghttp2 version"
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
#if NGHTTP2_VERSION_NUM < 0x010201
|
|
Packit |
90a5c9 |
#error "Unsupported nghttp2 version " NGHTTP2_VERSION_TEXT
|
|
Packit |
90a5c9 |
#endif],
|
|
Packit |
90a5c9 |
[AC_MSG_RESULT(OK)
|
|
Packit |
90a5c9 |
ac_cv_nghttp2=yes],
|
|
Packit |
90a5c9 |
[AC_MSG_RESULT(FAILED)])
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if test "x$ac_cv_nghttp2" = "xyes"; then
|
|
Packit |
90a5c9 |
ap_nghttp2_libs="${ap_nghttp2_libs:--lnghttp2} `$apr_config --libs`"
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_LDFLAGS, [$ap_nghttp2_libs])
|
|
Packit |
90a5c9 |
APR_ADDTO(LIBS, [$ap_nghttp2_libs])
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl Run library and function checks
|
|
Packit |
90a5c9 |
liberrors=""
|
|
Packit |
90a5c9 |
AC_CHECK_HEADERS([nghttp2/nghttp2.h])
|
|
Packit |
90a5c9 |
AC_CHECK_FUNCS([nghttp2_session_server_new2], [], [liberrors="yes"])
|
|
Packit |
90a5c9 |
if test "x$liberrors" != "x"; then
|
|
Packit |
90a5c9 |
AC_MSG_WARN([nghttp2 library is unusable])
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
dnl # nghttp2 >= 1.3.0: access to stream weights
|
|
Packit |
90a5c9 |
AC_CHECK_FUNCS([nghttp2_stream_get_weight], [], [liberrors="yes"])
|
|
Packit |
90a5c9 |
if test "x$liberrors" != "x"; then
|
|
Packit |
90a5c9 |
AC_MSG_WARN([nghttp2 version >= 1.3.0 is required])
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
dnl # nghttp2 >= 1.5.0: changing stream priorities
|
|
Packit |
90a5c9 |
AC_CHECK_FUNCS([nghttp2_session_change_stream_priority],
|
|
Packit |
90a5c9 |
[APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_CHANGE_PRIO"])], [])
|
|
Packit |
90a5c9 |
dnl # nghttp2 >= 1.14.0: invalid header callback
|
|
Packit |
90a5c9 |
AC_CHECK_FUNCS([nghttp2_session_callbacks_set_on_invalid_header_callback],
|
|
Packit |
90a5c9 |
[APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_INVALID_HEADER_CB"])], [])
|
|
Packit |
90a5c9 |
dnl # nghttp2 >= 1.15.0: get/set stream window sizes
|
|
Packit |
90a5c9 |
AC_CHECK_FUNCS([nghttp2_session_get_stream_local_window_size],
|
|
Packit |
90a5c9 |
[APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_LOCAL_WIN_SIZE"])], [])
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
AC_MSG_WARN([nghttp2 version is too old])
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl restore
|
|
Packit |
90a5c9 |
CPPFLAGS="$saved_CPPFLAGS"
|
|
Packit |
90a5c9 |
LIBS="$saved_LIBS"
|
|
Packit |
90a5c9 |
LDFLAGS="$saved_LDFLAGS"
|
|
Packit |
90a5c9 |
])
|
|
Packit |
90a5c9 |
if test "x$ac_cv_nghttp2" = "xyes"; then
|
|
Packit |
90a5c9 |
AC_DEFINE(HAVE_NGHTTP2, 1, [Define if nghttp2 is available])
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
])
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl # hook module into the Autoconf mechanism (--enable-http2)
|
|
Packit |
90a5c9 |
APACHE_MODULE(http2, [HTTP/2 protocol handling in addition to HTTP protocol
|
|
Packit |
90a5c9 |
handling. Implemented by mod_http2. This module requires a libnghttp2 installation.
|
|
Packit |
90a5c9 |
See --with-nghttp2 on how to manage non-standard locations. This module
|
|
Packit |
90a5c9 |
is usually linked shared and requires loading. ], $http2_objs, , most, [
|
|
Packit |
90a5c9 |
APACHE_CHECK_OPENSSL
|
|
Packit |
90a5c9 |
if test "$ac_cv_openssl" = "yes" ; then
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_CPPFLAGS, ["-DH2_OPENSSL"])
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
APACHE_CHECK_NGHTTP2
|
|
Packit |
90a5c9 |
if test "$ac_cv_nghttp2" = "yes" ; then
|
|
Packit |
90a5c9 |
if test "x$enable_http2" = "xshared"; then
|
|
Packit |
90a5c9 |
# The only symbol which needs to be exported is the module
|
|
Packit |
90a5c9 |
# structure, so ask libtool to hide everything else:
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_HTTP2_LDADD, [-export-symbols-regex http2_module])
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
enable_http2=no
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
])
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
# Ensure that other modules can pick up mod_http2.h
|
|
Packit |
90a5c9 |
# icing: hold back for now until it is more stable
|
|
Packit |
90a5c9 |
#APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current])
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl # list of module object files
|
|
Packit |
90a5c9 |
proxy_http2_objs="dnl
|
|
Packit |
90a5c9 |
mod_proxy_http2.lo dnl
|
|
Packit |
90a5c9 |
h2_proxy_session.lo dnl
|
|
Packit |
90a5c9 |
h2_proxy_util.lo dnl
|
|
Packit |
90a5c9 |
"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl # hook module into the Autoconf mechanism (--enable-proxy_http2)
|
|
Packit |
90a5c9 |
APACHE_MODULE(proxy_http2, [HTTP/2 proxy module. This module requires a libnghttp2 installation.
|
|
Packit |
90a5c9 |
See --with-nghttp2 on how to manage non-standard locations. Also requires --enable-proxy.], $proxy_http2_objs, , no, [
|
|
Packit |
90a5c9 |
APACHE_CHECK_NGHTTP2
|
|
Packit |
90a5c9 |
if test "$ac_cv_nghttp2" = "yes" ; then
|
|
Packit |
90a5c9 |
if test "x$enable_http2" = "xshared"; then
|
|
Packit |
90a5c9 |
# The only symbol which needs to be exported is the module
|
|
Packit |
90a5c9 |
# structure, so ask libtool to hide everything else:
|
|
Packit |
90a5c9 |
APR_ADDTO(MOD_PROXY_HTTP2_LDADD, [-export-symbols-regex proxy_http2_module])
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
enable_proxy_http2=no
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
], proxy)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
dnl # end of module specific part
|
|
Packit |
90a5c9 |
APACHE_MODPATH_FINISH
|
|
Packit |
90a5c9 |
|