* Implemented reply parsers for A, NS, PTR, CNAME, MX, SOA, SRV, TXT messages
[m6w6/ext-ares] / config.m4
index 46d96a37256a4240fed96d5bbe74f785ee49c1fb..f90065fadf8f4f8a1ff730025f814e3aa9bf0d0b 100644 (file)
--- a/config.m4
+++ b/config.m4
@@ -18,6 +18,11 @@ if test "$PHP_ARES" != "no"; then
                AC_MSG_ERROR(could not find ares.h)
        fi
        
+       dnl ##########
+       dnl newer versions of libcares need -lrt
+       dnl ##########
+       PHP_ADD_LIBRARY(rt, 1, ARES_SHARED_LIBADD)
+       
        PHP_ARES_LIB=
        PHP_CHECK_LIBRARY(cares, ares_init, [
                        PHP_ARES_LIB=cares
@@ -27,11 +32,11 @@ if test "$PHP_ARES" != "no"; then
                                ], [
                                        PHP_ARES_LIB=unknown
                                ], [
-                                       -L$PHP_ARES_DIR/$PHP_LIBDIR
+                                       -lrt -L$PHP_ARES_DIR/$PHP_LIBDIR
                                ]
                        )
                ], [
-                       -L$PHP_ARES_DIR/$PHP_LIBDIR
+                       -lrt -L$PHP_ARES_DIR/$PHP_LIBDIR
                ]
        )
        AC_MSG_CHECKING(for libares/libcares)
@@ -50,30 +55,55 @@ 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]
+               [-lrt -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_CHECK_LIBRARY($PHP_ARES_LIB, ares_expand_string, 
-               [AC_DEFINE([HAVE_ARES_EXPAND_STRING], [1], [ ])], [ ], 
-               [-L$PHP_ARES_DIR/$PHP_LIBDIR]
-       )
-       PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_parse_aaaa_reply, 
-               [AC_DEFINE([HAVE_ARES_PARSE_AAAA_REPLY], [1], [ ])], [ ], 
-               [-L$PHP_ARES_DIR/$PHP_LIBDIR]
+               [-lrt -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]
+               [-lrt -L$PHP_ARES_DIR/$PHP_LIBDIR]
+       )
+       PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_version,
+               [AC_DEFINE([HAVE_ARES_VERSION], [1], [ ])], [ ],
+               [-lrt -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_library_init,
+               [AC_DEFINE([HAVE_ARES_LIBRARY_INIT], [1], [ ])], [ ],
+               [-lrt -L$PHP_ARES_DIR/$PHP_LIBDIR]
        )
+       PHP_CHECK_LIBRARY($PHP_ARES_LIB, ares_library_cleanup,
+               [AC_DEFINE([HAVE_ARES_LIBRARY_CLEANUP], [1], [ ])], [ ],
+               [-lrt -L$PHP_ARES_DIR/$PHP_LIBDIR]
+       )
+       
+       dnl ##########
+       dnl check new c-ares callback API
+       dnl ##########
+       save_LIBS=$LIBS
+       save_CFLAGS=$CFLAGS
+       LDFLIBS="-L$PHP_ARES_DIR/$PHP_LIBDIR -l$PHP_ARES_LIB -lrt"
+       CFLAGS="-I$PHP_ARES_DIR/include -Werror"
+       
+       AC_MSG_CHECKING(for new c-ares callback API)
+       AC_TRY_COMPILE(
+               [#include <ares.h>
+               ], [
+                       ares_search(0, 0, 0, 0, (void (*)(void *, int, int, unsigned char *, int)) 0, 0);
+               ], [
+                       AC_MSG_RESULT(yes)
+                       AC_DEFINE([PHP_ARES_NEW_CALLBACK_API], [1], [ ])
+               ], [
+                       AC_MSG_RESULT(no)
+                       AC_DEFINE([PHP_ARES_NEW_CALLBACK_API], [0], [ ])
+               ]
+       )
+       
+       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)