Add more --with-* configure flags

This commit is contained in:
Tatsuhiro Tsujikawa 2021-02-21 21:38:59 +09:00
parent 2f2b211766
commit 579fa6ea93
1 changed files with 178 additions and 77 deletions

View File

@ -112,6 +112,41 @@ AC_ARG_WITH([libxml2],
[Use libxml2 [default=check]])], [Use libxml2 [default=check]])],
[request_libxml2=$withval], [request_libxml2=check]) [request_libxml2=$withval], [request_libxml2=check])
AC_ARG_WITH([jansson],
[AS_HELP_STRING([--with-jansson],
[Use jansson [default=check]])],
[request_jansson=$withval], [request_jansson=check])
AC_ARG_WITH([zlib],
[AS_HELP_STRING([--with-zlib],
[Use zlib [default=check]])],
[request_zlib=$withval], [request_zlib=check])
AC_ARG_WITH([libevent-openssl],
[AS_HELP_STRING([--with-libevent-openssl],
[Use libevent_openssl [default=check]])],
[request_libevent_openssl=$withval], [request_libevent_openssl=check])
AC_ARG_WITH([libcares],
[AS_HELP_STRING([--with-libcares],
[Use libc-ares [default=check]])],
[request_libcares=$withval], [request_libcares=check])
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl],
[Use openssl [default=check]])],
[request_openssl=$withval], [request_openssl=check])
AC_ARG_WITH([libev],
[AS_HELP_STRING([--with-libev],
[Use libev [default=check]])],
[request_libev=$withval], [request_libev=check])
AC_ARG_WITH([cunit],
[AS_HELP_STRING([--with-cunit],
[Use cunit [default=check]])],
[request_cunit=$withval], [request_cunit=check])
AC_ARG_WITH([jemalloc], AC_ARG_WITH([jemalloc],
[AS_HELP_STRING([--with-jemalloc], [AS_HELP_STRING([--with-jemalloc],
[Use jemalloc [default=check]])], [Use jemalloc [default=check]])],
@ -293,11 +328,19 @@ case "$host_os" in
esac esac
# zlib # zlib
have_zlib=no
if test "x${request_zlib}" != "xno"; then
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no]) PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no])
if test "x${have_zlib}" = "xno"; then if test "x${have_zlib}" = "xno"; then
AC_MSG_NOTICE($ZLIB_PKG_ERRORS) AC_MSG_NOTICE($ZLIB_PKG_ERRORS)
fi fi
fi
if test "x${request_zlib}" = "xyes" &&
test "x${have_zlib}" != "xyes"; then
AC_MSG_ERROR([zlib was requested (--with-zlib) but not found])
fi
# dl: openssl requires libdl when it is statically linked. # dl: openssl requires libdl when it is statically linked.
case "${host_os}" in case "${host_os}" in
@ -312,6 +355,8 @@ case "${host_os}" in
esac esac
# cunit # cunit
have_cunit=no
if test "x${request_cunit}" != "xno"; then
PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes], [have_cunit=no]) PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes], [have_cunit=no])
# If pkg-config does not find cunit, check it using AC_CHECK_LIB. We # 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. # do this because Debian (Ubuntu) lacks pkg-config file for cunit.
@ -337,10 +382,19 @@ if test "x${have_cunit}" = "xyes"; then
;; ;;
esac esac
fi fi
fi
if test "x${request_cunit}" = "xyes" &&
test "x${have_cunit}" != "xyes"; then
AC_MSG_ERROR([cunit was requested (--with-cunit) but not found])
fi
AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ]) AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ])
# libev (for src) # libev (for src)
have_libev=no
if test "x${request_libev}" != "xno"; then
if test "x${LIBEV_LIBS}" = "x" && test "x${LIBEV_CFLAGS}" = "x"; then
# libev does not have pkg-config file. Check it in an old way. # libev does not have pkg-config file. Check it in an old way.
save_LIBS=$LIBS save_LIBS=$LIBS
# android requires -lm for floor # android requires -lm for floor
@ -355,30 +409,65 @@ if test "x${have_libev}" = "xyes"; then
fi fi
fi fi
LIBS=$save_LIBS LIBS=$save_LIBS
else
have_libev=yes
fi
fi
if test "x${request_libev}" = "xyes" &&
test "x${have_libev}" != "xyes"; then
AC_MSG_ERROR([libev was requested (--with-libev) but not found])
fi
# openssl (for src) # openssl (for src)
have_openssl=no
if test "x${request_openssl}" != "xno"; then
PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1], PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1],
[have_openssl=yes], [have_openssl=no]) [have_openssl=yes], [have_openssl=no])
if test "x${have_openssl}" = "xno"; then if test "x${have_openssl}" = "xno"; then
AC_MSG_NOTICE($OPENSSL_PKG_ERRORS) AC_MSG_NOTICE($OPENSSL_PKG_ERRORS)
fi fi
fi
if test "x${request_openssl}" = "xyes" &&
test "x${have_openssl}" != "xyes"; then
AC_MSG_ERROR([openssl was requested (--with-openssl) but not found])
fi
# c-ares (for src) # c-ares (for src)
have_libcares=no
if test "x${request_libcares}" != "xno"; then
PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.5], [have_libcares=yes], PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.5], [have_libcares=yes],
[have_libcares=no]) [have_libcares=no])
if test "x${have_libcares}" = "xno"; then if test "x${have_libcares}" = "xno"; then
AC_MSG_NOTICE($LIBCARES_PKG_ERRORS) AC_MSG_NOTICE($LIBCARES_PKG_ERRORS)
fi fi
fi
if test "x${request_libcares}" = "xyes" &&
test "x${have_libcares}" != "xyes"; then
AC_MSG_ERROR([libcares was requested (--with-libcares) but not found])
fi
# libevent_openssl (for examples) # libevent_openssl (for examples)
# 2.0.8 is required because we use evconnlistener_set_error_cb() # 2.0.8 is required because we use evconnlistener_set_error_cb()
have_libevent_openssl=no
if test "x${request_libevent_openssl}" != "xno"; then
PKG_CHECK_MODULES([LIBEVENT_OPENSSL], [libevent_openssl >= 2.0.8], PKG_CHECK_MODULES([LIBEVENT_OPENSSL], [libevent_openssl >= 2.0.8],
[have_libevent_openssl=yes], [have_libevent_openssl=no]) [have_libevent_openssl=yes], [have_libevent_openssl=no])
if test "x${have_libevent_openssl}" = "xno"; then if test "x${have_libevent_openssl}" = "xno"; then
AC_MSG_NOTICE($LIBEVENT_OPENSSL_PKG_ERRORS) AC_MSG_NOTICE($LIBEVENT_OPENSSL_PKG_ERRORS)
fi fi
fi
if test "x${request_libevent_openssl}" = "xyes" &&
test "x${have_libevent_openssl}" != "xyes"; then
AC_MSG_ERROR([libevent_openssl was requested (--with-libevent) but not found])
fi
# jansson (for src/nghttp, src/deflatehd and src/inflatehd) # jansson (for src/nghttp, src/deflatehd and src/inflatehd)
have_jansson=no
if test "x${request_jansson}" != "xno"; then
PKG_CHECK_MODULES([JANSSON], [jansson >= 2.5], PKG_CHECK_MODULES([JANSSON], [jansson >= 2.5],
[have_jansson=yes], [have_jansson=no]) [have_jansson=yes], [have_jansson=no])
if test "x${have_jansson}" = "xyes"; then if test "x${have_jansson}" = "xyes"; then
@ -387,7 +476,12 @@ if test "x${have_jansson}" = "xyes"; then
else else
AC_MSG_NOTICE($JANSSON_PKG_ERRORS) AC_MSG_NOTICE($JANSSON_PKG_ERRORS)
fi fi
fi
if test "x${request_jansson}" = "xyes" &&
test "x${have_jansson}" != "xyes"; then
AC_MSG_ERROR([jansson was requested (--with-jansson) but not found])
fi
# libsystemd (for src/nghttpx) # libsystemd (for src/nghttpx)
have_libsystemd=no have_libsystemd=no
@ -408,6 +502,8 @@ if test "x${request_systemd}" = "xyes" &&
fi fi
# libxml2 (for src/nghttp) # libxml2 (for src/nghttp)
have_libxml2=no
if test "x${request_libxml2}" != "xno"; then
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.26], PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.26],
[have_libxml2=yes], [have_libxml2=no]) [have_libxml2=yes], [have_libxml2=no])
if test "x${have_libxml2}" = "xyes"; then if test "x${have_libxml2}" = "xyes"; then
@ -415,6 +511,7 @@ if test "x${have_libxml2}" = "xyes"; then
else else
AC_MSG_NOTICE($LIBXML2_PKG_ERRORS) AC_MSG_NOTICE($LIBXML2_PKG_ERRORS)
fi fi
fi
if test "x${request_libxml2}" = "xyes" && if test "x${request_libxml2}" = "xyes" &&
test "x${have_libxml2}" != "xyes"; then test "x${have_libxml2}" != "xyes"; then
@ -426,6 +523,7 @@ AM_CONDITIONAL([HAVE_LIBXML2], [ test "x${have_libxml2}" = "xyes" ])
# jemalloc # jemalloc
have_jemalloc=no have_jemalloc=no
if test "x${request_jemalloc}" != "xno"; then if test "x${request_jemalloc}" != "xno"; then
if test "x${JEMALLOC_LIBS}" = "x" && test "x${JEMALLOC_CFLAGS}" = "x"; then
save_LIBS=$LIBS save_LIBS=$LIBS
AC_SEARCH_LIBS([malloc_stats_print], [jemalloc], [have_jemalloc=yes], [], AC_SEARCH_LIBS([malloc_stats_print], [jemalloc], [have_jemalloc=yes], [],
[$PTHREAD_LDFLAGS]) [$PTHREAD_LDFLAGS])
@ -449,6 +547,9 @@ if test "x${request_jemalloc}" != "xno"; then
JEMALLOC_LIBS=${jemalloc_libs} JEMALLOC_LIBS=${jemalloc_libs}
AC_SUBST([JEMALLOC_LIBS]) AC_SUBST([JEMALLOC_LIBS])
fi fi
else
have_jemalloc=yes
fi
fi fi
if test "x${request_jemalloc}" = "xyes" && if test "x${request_jemalloc}" = "xyes" &&