mirror of https://github.com/aria2/aria2
Use pkg-config for libcares. Dropped c-ares pre-1.5 support.
parent
bf74f8f009
commit
b21cce0002
|
@ -134,7 +134,7 @@ if test "x$with_libcares" = "xyes"; then
|
||||||
AM_PATH_LIBCARES
|
AM_PATH_LIBCARES
|
||||||
if test "x$have_libcares" = "xyes"; then
|
if test "x$have_libcares" = "xyes"; then
|
||||||
LIBS="$LIBCARES_LIBS $LIBS"
|
LIBS="$LIBCARES_LIBS $LIBS"
|
||||||
CPPFLAGS="$LIBCARES_CPPFLAGS $CPPFLAGS"
|
CPPFLAGS="$LIBCARES_CFLAGS $CPPFLAGS"
|
||||||
elif test "x$with_libcares_requested" = "xyes"; then
|
elif test "x$with_libcares_requested" = "xyes"; then
|
||||||
ARIA2_DEP_NOT_MET([libcares])
|
ARIA2_DEP_NOT_MET([libcares])
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -14,52 +14,46 @@ libcares_prefix_include=$libcares_prefix/include
|
||||||
|
|
||||||
LIBS_save=$LIBS
|
LIBS_save=$LIBS
|
||||||
CPPFLAGS_save=$CPPFLAGS
|
CPPFLAGS_save=$CPPFLAGS
|
||||||
|
PKG_CONFIG_PATH_save=$PKG_CONFIG_PATH
|
||||||
|
|
||||||
LIBS="-L$libcares_prefix_lib $LIBS"
|
PKG_CONFIG_PATH="$libcares_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||||
CPPFLAGS="-I$libcares_prefix_include -Wall $CPPFLAGS"
|
PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.0], [have_libcares=yes],
|
||||||
|
[have_libcares=no])
|
||||||
AC_CHECK_LIB([cares], [ares_init], [have_libcares=yes])
|
|
||||||
|
|
||||||
if test "x$have_libcares" != "xyes"; then
|
|
||||||
AC_CHECK_LIB([cares], [ares_init], [have_libcares=yes need_librt=yes], [],
|
|
||||||
[-lrt])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$have_libcares" = "xyes"; then
|
if test "x$have_libcares" = "xyes"; then
|
||||||
if test "x$need_librt" = "xyes"; then
|
LIBS="$LIBCARES_LIBS $LIBS"
|
||||||
LIBS="-lrt $LIBS"
|
CPPFLAGS="$LIBCARES_CFLAGS $CPPFLAGS"
|
||||||
fi
|
fi
|
||||||
LIBS="-lcares $LIBS"
|
|
||||||
AC_MSG_CHECKING([whether ares_host_callback accepts timeouts(c-ares >= 1.5)])
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
#include <ares.h>
|
|
||||||
|
|
||||||
void callback(void* arg, int status, int timeouts, struct hostent* host);
|
if test "x$have_libcares" != "xyes"; then
|
||||||
]],
|
LIBS="-L$libcares_prefix_lib $LIBS"
|
||||||
[[
|
CPPFLAGS="-I$libcares_prefix_include -Wall $CPPFLAGS"
|
||||||
ares_gethostbyname((ares_channel)0, "foo", 0, callback, 0);
|
|
||||||
]])],
|
|
||||||
[have_libcares1_5=yes],
|
|
||||||
[have_libcares1_5=no])
|
|
||||||
AC_MSG_RESULT([$have_libcares1_5])
|
|
||||||
|
|
||||||
if test "x$have_libcares1_5" = "xyes"; then
|
AC_CHECK_LIB([cares], [ares_init], [have_libcares=yes])
|
||||||
AC_DEFINE([HAVE_LIBCARES1_5], [1], [Define 1 if ares_host_callback accepts timeouts(c-ares >= 1.5)])
|
|
||||||
fi
|
|
||||||
AC_CHECK_TYPES([ares_addr_node], [], [], [[#include <ares.h>]])
|
|
||||||
AC_CHECK_FUNCS([ares_set_servers])
|
|
||||||
|
|
||||||
AC_DEFINE([HAVE_LIBCARES], [1], [Define to 1 if you have libcares.])
|
if test "x$have_libcares" != "xyes"; then
|
||||||
|
AC_CHECK_LIB([cares], [ares_init], [have_libcares=yes need_librt=yes], [],
|
||||||
|
[-lrt])
|
||||||
|
fi
|
||||||
|
if test "x$have_libcares" = "xyes"; then
|
||||||
LIBCARES_LIBS="-L$libcares_prefix_lib -lcares"
|
LIBCARES_LIBS="-L$libcares_prefix_lib -lcares"
|
||||||
if test "x$need_librt" = "xyes"; then
|
if test "x$need_librt" = "xyes"; then
|
||||||
LIBCARES_LIBS="$LIBCARES_LIBS -lrt"
|
LIBCARES_LIBS="$LIBCARES_LIBS -lrt"
|
||||||
fi
|
fi
|
||||||
LIBCARES_CPPFLAGS="-I$libcares_prefix_include"
|
LIBCARES_CFLAGS="-I$libcares_prefix_include"
|
||||||
AC_SUBST(LIBCARES_LIBS)
|
|
||||||
AC_SUBST(LIBCARES_CPPFLAGS)
|
LIBS="$LIBCARES_LIBS $LIBS_save"
|
||||||
|
CPPFLAGS="$LIBCARES_CFLAGS $CPPFLAGS_save"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$have_libcares" = "xyes"; then
|
||||||
|
AC_DEFINE([HAVE_LIBCARES], [1], [Define to 1 if you have libcares.])
|
||||||
|
AC_CHECK_TYPES([ares_addr_node], [], [], [[#include <ares.h>]])
|
||||||
|
AC_CHECK_FUNCS([ares_set_servers])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIBS=$LIBS_save
|
LIBS=$LIBS_save
|
||||||
CPPFLAGS=$CPPFLAGS_save
|
CPPFLAGS=$CPPFLAGS_save
|
||||||
|
PKG_CONFIG_PATH=$PKG_CONFIG_PATH_save
|
||||||
])
|
])
|
||||||
|
|
|
@ -41,11 +41,7 @@
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
#ifdef HAVE_LIBCARES1_5
|
|
||||||
void callback(void* arg, int status, int timeouts, struct hostent* host)
|
void callback(void* arg, int status, int timeouts, struct hostent* host)
|
||||||
#else
|
|
||||||
void callback(void* arg, int status, struct hostent* host)
|
|
||||||
#endif // HAVE_LIBCARES1_5
|
|
||||||
{
|
{
|
||||||
AsyncNameResolver* resolverPtr = reinterpret_cast<AsyncNameResolver*>(arg);
|
AsyncNameResolver* resolverPtr = reinterpret_cast<AsyncNameResolver*>(arg);
|
||||||
if(status != ARES_SUCCESS) {
|
if(status != ARES_SUCCESS) {
|
||||||
|
|
|
@ -48,12 +48,8 @@
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
class AsyncNameResolver {
|
class AsyncNameResolver {
|
||||||
#ifdef HAVE_LIBCARES1_5
|
friend void callback
|
||||||
friend void callback(void* arg, int status, int timeouts, struct hostent* host);
|
(void* arg, int status, int timeouts, struct hostent* host);
|
||||||
#else
|
|
||||||
friend void callback(void* arg, int status, struct hostent* host);
|
|
||||||
#endif // HAVE_LIBCARES1_5
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum STATUS {
|
enum STATUS {
|
||||||
STATUS_READY,
|
STATUS_READY,
|
||||||
|
|
Loading…
Reference in New Issue