X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-ares;a=blobdiff_plain;f=config.m4;h=cab790830542d71799dc7135ca187aa78e81e0e1;hp=1b96e73f4b561bedae8cfb5b19c92e7fbc9ccdfb;hb=11d026bf66fedc63347b184a6d5aa451d1fc2a21;hpb=d7101dab193ff93425126756a861f3b1c7c6d5e8 diff --git a/config.m4 b/config.m4 index 1b96e73..cab7908 100644 --- a/config.m4 +++ b/config.m4 @@ -1,7 +1,7 @@ dnl $Id$ dnl config.m4 for extension ares -PHP_ARG_WITH(ares, for asynchronous resolver support, +PHP_ARG_WITH(ares, [enable asynchronous resolver support], [ --with-ares Include asynchronous resolver support]) if test "$PHP_ARES" != "no"; then @@ -18,15 +18,29 @@ if test "$PHP_ARES" != "no"; then AC_MSG_ERROR(could not find ares.h) fi - PHP_ADD_LIBRARY(rt, ARES_SHARED_LIBADD) PHP_ARES_LIB= + PHP_ARES_LIBADD= PHP_CHECK_LIBRARY(cares, ares_init, [ PHP_ARES_LIB=cares ], [ PHP_CHECK_LIBRARY(ares, ares_init, [ PHP_ARES_LIB=ares ], [ - PHP_ARES_LIB=unknown + PHP_CHECK_LIBRARY(cares, ares_init, [ + PHP_ARES_LIB=cares + PHP_ARES_LIBADD=rt + ], [ + PHP_CHECK_LIBRARY(ares, ares_init, [ + PHP_ARES_LIB=ares + PHP_ARES_LIBADD=rt + ], [ + PHP_AREES_LIB=unknown + ], [ + -lrt -L$PHP_ARES_DIR/$PHP_LIBDIR + ]) + ], [ + -lrt -L$PHP_ARES_DIR/$PHP_LIBDIR + ]) ], [ -L$PHP_ARES_DIR/$PHP_LIBDIR ] @@ -38,9 +52,16 @@ if test "$PHP_ARES" != "no"; then AC_MSG_CHECKING(for libares/libcares) AC_MSG_RESULT($PHP_ARES_LIB) + if test "x$PHP_ARES_LIBADD" != "x"; then + PHP_ADD_LIBRARY(PHP_ARES_LIBADD, 1, ARES_SHARED_LIBADD) + dnl for later use + PHP_ARES_LIBADD="-l$PHP_ARES_LIBADD" + fi + if test $PHP_ARES_LIB = "unknown"; then AC_MSG_ERROR(could neither find libares nor libcares) elif test $PHP_ARES_LIB = "cares"; then + AC_DEFINE([PHP_ARES_CARES], [1], [ ]) AC_DEFINE_UNQUOTED([PHP_ARES_LIBNAME], "c-ares (CURL)", [ ]) AC_DEFINE([PHP_ARES_EXPAND_LEN_TYPE], [long], [ ]) else @@ -51,28 +72,56 @@ if test "$PHP_ARES" != "no"; then PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_cancel, [AC_DEFINE([HAVE_ARES_CANCEL], [1], [ ])], [ ], - [-L$PHP_ARES_DIR/$PHP_LIBDIR] + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] ) PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_getnameinfo, [AC_DEFINE([HAVE_ARES_GETNAMEINFO], [1], [ ])], [ ], - [-L$PHP_ARES_DIR/$PHP_LIBDIR] + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] ) PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_getsock, [AC_DEFINE([HAVE_ARES_GETSOCK], [1], [ ])], [ ], - [-L$PHP_ARES_DIR/$PHP_LIBDIR] + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] ) - PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_version, - [AC_DEFINE([HAVE_ARES_VERSION], [1], [ ])], [ ], - [-L$PHP_ARES_DIR/$PHP_LIBDIR] + PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_version, + [AC_DEFINE([HAVE_ARES_VERSION], [1], [ ])], [ ], + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] + ) + PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_library_init, + [AC_DEFINE([HAVE_ARES_LIBRARY_INIT], [1], [ ])], [ ], + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] + ) + PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_library_cleanup, + [AC_DEFINE([HAVE_ARES_LIBRARY_CLEANUP], [1], [ ])], [ ], + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] + ) + PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_set_local_dev, + [AC_DEFINE([HAVE_ARES_SET_LOCAL_DEV], [1], [ ])], [ ], + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] + ) + PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_set_local_ip4, + [AC_DEFINE([HAVE_ARES_SET_LOCAL_IP4], [1], [ ])], [ ], + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] + ) + PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_set_local_ip6, + [AC_DEFINE([HAVE_ARES_SET_LOCAL_IP6], [1], [ ])], [ ], + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] + ) + PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_inet_ntop, + [AC_DEFINE([HAVE_ARES_INET_NTOP], [1], [ ])], [ ], + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] + ) + PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_inet_pton, + [AC_DEFINE([HAVE_ARES_INET_NTOP], [1], [ ])], [ ], + [$PHP_ARES_LIBADD -L$PHP_ARES_DIR/$PHP_LIBDIR] ) - - dnl check new c-ares API - + dnl ########## + dnl check new c-ares callback API + dnl ########## save_LIBS=$LIBS save_CFLAGS=$CFLAGS - LIBS="-L $PHP_ARES_DIR/$PHP_LIBDIR -l $PHP_ARES_LIB" - CFLAGS="-I$PHP_ARES_DIR/include -pedantic-errors" + LIBS="-L$PHP_ARES_DIR/$PHP_LIBDIR -l$PHP_ARES_LIB $PHP_ARES_LIBADD" + CFLAGS="-I$PHP_ARES_DIR/include -Werror" AC_MSG_CHECKING(for new c-ares callback API) AC_TRY_COMPILE( @@ -91,11 +140,11 @@ if test "$PHP_ARES" != "no"; then LIBS=$save_LIBS CFLAGS=$save_CFLAGS - AC_CHECK_HEADERS([netdb.h unistd.h arpa/inet.h arpa/nameser.h]) + AC_CHECK_HEADERS([netdb.h unistd.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h]) PHP_ADD_INCLUDE($PHP_ARES_DIR/include) PHP_ADD_LIBRARY_WITH_PATH($PHP_ARES_LIB, $PHP_ARES_DIR/$PHP_LIBDIR, ARES_SHARED_LIBADD) PHP_SUBST(ARES_SHARED_LIBADD) - PHP_NEW_EXTENSION(ares, ares.c, $ext_shared) + PHP_NEW_EXTENSION(ares, php_ares.c, $ext_shared) fi