From ca237a3ad31a8bba18297042df670e3a710ca10e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 28 Feb 2008 21:44:31 +0100 Subject: libreplace: use the new getifaddrs test also for autoconf. Michael (cherry picked from commit a2a506ff0eae2a64ebe2ddbb81a6c2a5fa7fe3da) (This used to be commit c5932414fdf0b568cbfe6cdefaec41c8afc8ca6b) --- source3/lib/replace/getifaddrs.c | 29 ----------------------------- source3/lib/replace/getifaddrs.m4 | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 33 deletions(-) (limited to 'source3/lib/replace') diff --git a/source3/lib/replace/getifaddrs.c b/source3/lib/replace/getifaddrs.c index 053657475d..551ff863df 100644 --- a/source3/lib/replace/getifaddrs.c +++ b/source3/lib/replace/getifaddrs.c @@ -363,32 +363,3 @@ int rep_getifaddrs(struct ifaddrs **ifap) return -1; } #endif - -#ifdef AUTOCONF_TEST -/* this is the autoconf driver to test getifaddrs() */ - - int main() -{ - struct ifaddrs *ifs = NULL; - int ret; - - ret = getifaddrs(&ifs); - if (ret != 0) { - perror("getifaddrs() failed"); - return 1; - } - - while (ifs) { - printf("%-10s ", ifs->ifa_name); - if (ifs->ifa_addr != NULL && - ifs->ifa_addr->sa_family == AF_INET) { - printf("IP=%s ", inet_ntoa(((struct sockaddr_in *)ifs->ifa_addr)->sin_addr)); - if (ifs->ifa_netmask != NULL) - printf("NETMASK=%s", inet_ntoa(((struct sockaddr_in *)ifs->ifa_netmask)->sin_addr)); - } - printf("\n"); - ifs = ifs->ifa_next; - } - return 0; -} -#endif diff --git a/source3/lib/replace/getifaddrs.m4 b/source3/lib/replace/getifaddrs.m4 index 767797e8d2..1fa168b59e 100644 --- a/source3/lib/replace/getifaddrs.m4 +++ b/source3/lib/replace/getifaddrs.m4 @@ -49,7 +49,10 @@ AC_TRY_RUN([ #define AUTOCONF_TEST 1 #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" -#include "$libreplacedir/getifaddrs.c"], +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/getifaddrs.c"], libreplace_cv_HAVE_IFACE_GETIFADDRS=yes,libreplace_cv_HAVE_IFACE_GETIFADDRS=no,libreplace_cv_HAVE_IFACE_GETIFADDRS=cross)]) if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available]) @@ -67,7 +70,10 @@ AC_TRY_RUN([ #undef _XOPEN_SOURCE_EXTENDED #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" -#include "$libreplacedir/getifaddrs.c"], +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/getifaddrs.c"], libreplace_cv_HAVE_IFACE_AIX=yes,libreplace_cv_HAVE_IFACE_AIX=no,libreplace_cv_HAVE_IFACE_AIX=cross)]) if test x"$libreplace_cv_HAVE_IFACE_AIX" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available]) @@ -84,7 +90,10 @@ AC_TRY_RUN([ #define AUTOCONF_TEST 1 #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" -#include "$libreplacedir/getifaddrs.c"], +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/getifaddrs.c"], libreplace_cv_HAVE_IFACE_IFCONF=yes,libreplace_cv_HAVE_IFACE_IFCONF=no,libreplace_cv_HAVE_IFACE_IFCONF=cross)]) if test x"$libreplace_cv_HAVE_IFACE_IFCONF" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available]) @@ -100,7 +109,10 @@ AC_TRY_RUN([ #define AUTOCONF_TEST 1 #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" -#include "$libreplacedir/getifaddrs.c"], +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/getifaddrs.c"], libreplace_cv_HAVE_IFACE_IFREQ=yes,libreplace_cv_HAVE_IFACE_IFREQ=no,libreplace_cv_HAVE_IFACE_IFREQ=cross)]) if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available]) -- cgit