libreplace: use the new getifaddrs test also for autoconf.
authorMichael Adam <obnox@samba.org>
Thu, 28 Feb 2008 20:44:31 +0000 (21:44 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 29 Feb 2008 08:31:02 +0000 (09:31 +0100)
Michael
(cherry picked from commit a2a506ff0eae2a64ebe2ddbb81a6c2a5fa7fe3da)
(This used to be commit c5932414fdf0b568cbfe6cdefaec41c8afc8ca6b)

source3/lib/replace/getifaddrs.c
source3/lib/replace/getifaddrs.m4

index 053657475d8fa0214bedecabc773a19d116f7e7a..551ff863df20a061fb5e16a883cde79b72aee2f1 100644 (file)
@@ -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
index 767797e8d2a37b809509d6cd785b9cb3492958e0..1fa168b59e6162c4c7566a101b7ff2a1839b7dba 100644 (file)
@@ -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])