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],samba_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 samba_cv_HAVE_GETIFADDRS=yes,samba_cv_HAVE_GETIFADDRS=no)])
28 if test x"$samba_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="$NSL_LIBS $SOCKET_LIBS"
40 LIBS="$NSL_LIBS $SOCKET_LIBS"
43 # look for a method of finding the list of network interfaces
45 AC_CACHE_CHECK([for iface getifaddrs],samba_cv_HAVE_IFACE_GETIFADDRS,[
46 SAVE_CPPFLAGS="$CPPFLAGS"
47 CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
50 #define HAVE_IFACE_GETIFADDRS 1
51 #define AUTOCONF_TEST 1
52 #include "$libreplacedir/replace.c"
53 #include "$libreplacedir/getifaddrs.c"],
54 samba_cv_HAVE_IFACE_GETIFADDRS=yes,samba_cv_HAVE_IFACE_GETIFADDRS=no,samba_cv_HAVE_IFACE_GETIFADDRS=cross)])
55 CPPFLAGS="$SAVE_CPPFLAGS"
56 if test x"$samba_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then
57 iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available])
59 LIBREPLACEOBJ="${LIBREPLACEOBJ} getifaddrs.o"
63 if test $iface = no; then
64 AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
66 #define HAVE_IFACE_AIX 1
67 #define AUTOCONF_TEST 1
68 #undef _XOPEN_SOURCE_EXTENDED
69 #include "$libreplacedir/getifaddrs.c"],
70 samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
71 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
72 iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
77 if test $iface = no; then
78 AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
80 #define HAVE_IFACE_IFCONF 1
81 #define AUTOCONF_TEST 1
82 #include "$libreplacedir/getifaddrs.c"],
83 samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
84 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
85 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
89 if test $iface = no; then
90 AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[
92 #define HAVE_IFACE_IFREQ 1
93 #define AUTOCONF_TEST 1
94 #include "$libreplacedir/getifaddrs.c"],
95 samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
96 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
97 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])