1 AC_CHECK_HEADERS([ifaddrs.h])
3 dnl Used when getifaddrs is not available
4 AC_CHECK_MEMBERS([struct sockaddr.sa_len],
5 [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Whether struct sockaddr has a sa_len member])],
7 [#include <sys/socket.h>])
9 dnl test for getifaddrs and freeifaddrs
10 AC_CACHE_CHECK([for getifaddrs and freeifaddrs],libreplace_cv_HAVE_GETIFADDRS,[
12 #include <sys/types.h>
17 #include <sys/socket.h>
18 #include <netinet/in.h>
19 #include <arpa/inet.h>
23 struct ifaddrs *ifp = NULL;
24 int ret = getifaddrs (&ifp);
27 libreplace_cv_HAVE_GETIFADDRS=yes,libreplace_cv_HAVE_GETIFADDRS=no)])
28 if test x"$libreplace_cv_HAVE_GETIFADDRS" = x"yes"; then
29 AC_DEFINE(HAVE_GETIFADDRS,1,[Whether the system has getifaddrs])
30 AC_DEFINE(HAVE_FREEIFADDRS,1,[Whether the system has freeifaddrs])
31 AC_DEFINE(HAVE_STRUCT_IFADDRS,1,[Whether struct ifaddrs is available])
35 # look for a method of finding the list of network interfaces
37 # This tests need LIBS="${LIBREPLACE_NETWORK_LIBS}"
40 LIBS="${LIBREPLACE_NETWORK_LIBS}"
41 SAVE_CPPFLAGS="$CPPFLAGS"
42 CPPFLAGS="$CPPFLAGS -I$libreplacedir"
45 # look for a method of finding the list of network interfaces
47 AC_CACHE_CHECK([for iface getifaddrs],libreplace_cv_HAVE_IFACE_GETIFADDRS,[
49 #define HAVE_IFACE_GETIFADDRS 1
51 #define AUTOCONF_TEST 1
52 #define SOCKET_WRAPPER_NOT_REPLACE
53 #include "$libreplacedir/replace.c"
54 #include "$libreplacedir/inet_ntop.c"
55 #include "$libreplacedir/snprintf.c"
56 #include "$libreplacedir/getifaddrs.c"
57 #define getifaddrs_test main
58 #include "$libreplacedir/test/getifaddrs.c"],
59 libreplace_cv_HAVE_IFACE_GETIFADDRS=yes,libreplace_cv_HAVE_IFACE_GETIFADDRS=no,libreplace_cv_HAVE_IFACE_GETIFADDRS=cross)])
60 if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then
61 iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available])
63 LIBREPLACEOBJ="${LIBREPLACEOBJ} getifaddrs.o"
67 if test $iface = no; then
68 AC_CACHE_CHECK([for iface AIX],libreplace_cv_HAVE_IFACE_AIX,[
70 #define HAVE_IFACE_AIX 1
72 #define AUTOCONF_TEST 1
73 #undef _XOPEN_SOURCE_EXTENDED
74 #define SOCKET_WRAPPER_NOT_REPLACE
75 #include "$libreplacedir/replace.c"
76 #include "$libreplacedir/inet_ntop.c"
77 #include "$libreplacedir/snprintf.c"
78 #include "$libreplacedir/getifaddrs.c"
79 #define getifaddrs_test main
80 #include "$libreplacedir/test/getifaddrs.c"],
81 libreplace_cv_HAVE_IFACE_AIX=yes,libreplace_cv_HAVE_IFACE_AIX=no,libreplace_cv_HAVE_IFACE_AIX=cross)])
82 if test x"$libreplace_cv_HAVE_IFACE_AIX" = x"yes"; then
83 iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
88 if test $iface = no; then
89 AC_CACHE_CHECK([for iface ifconf],libreplace_cv_HAVE_IFACE_IFCONF,[
91 #define HAVE_IFACE_IFCONF 1
93 #define AUTOCONF_TEST 1
94 #define SOCKET_WRAPPER_NOT_REPLACE
95 #include "$libreplacedir/replace.c"
96 #include "$libreplacedir/inet_ntop.c"
97 #include "$libreplacedir/snprintf.c"
98 #include "$libreplacedir/getifaddrs.c"
99 #define getifaddrs_test main
100 #include "$libreplacedir/test/getifaddrs.c"],
101 libreplace_cv_HAVE_IFACE_IFCONF=yes,libreplace_cv_HAVE_IFACE_IFCONF=no,libreplace_cv_HAVE_IFACE_IFCONF=cross)])
102 if test x"$libreplace_cv_HAVE_IFACE_IFCONF" = x"yes"; then
103 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
107 if test $iface = no; then
108 AC_CACHE_CHECK([for iface ifreq],libreplace_cv_HAVE_IFACE_IFREQ,[
110 #define HAVE_IFACE_IFREQ 1
111 #define NO_CONFIG_H 1
112 #define AUTOCONF_TEST 1
113 #define SOCKET_WRAPPER_NOT_REPLACE
114 #include "$libreplacedir/replace.c"
115 #include "$libreplacedir/inet_ntop.c"
116 #include "$libreplacedir/snprintf.c"
117 #include "$libreplacedir/getifaddrs.c"
118 #define getifaddrs_test main
119 #include "$libreplacedir/test/getifaddrs.c"],
120 libreplace_cv_HAVE_IFACE_IFREQ=yes,libreplace_cv_HAVE_IFACE_IFREQ=no,libreplace_cv_HAVE_IFACE_IFREQ=cross)])
121 if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then
122 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
127 CPPFLAGS="$SAVE_CPPFLAGS"