?RCS: $Id: d_getifaddrs.U 11674 2006-08-22 16:50:23Z rmanfredi $ ?RCS: ?RCS: @COPYRIGHT@ ?RCS: ?MAKE:d_getifaddrs: Myread Setvar cat rm +cc +ccflags +ldflags i_netif ?MAKE: -pick add $@ %< ?S:d_getifaddrs: ?S: This variable conditionally defines the HAS_GETIFADDRS symbol, which ?S: indicates to the C program that getifaddrs() support is available. ?S:. ?C:HAS_GETIFADDRS: ?C: This symbol is defined when getifaddrs() can be used. ?C:. ?H:#$d_getifaddrs HAS_GETIFADDRS ?H:. ?T:flags ?LINT: set d_getifaddrs : can we use getifaddrs? echo " " echo "Checking whether getifaddrs() is available ..." >&4 val="$define" $cat >try.c <<'EOC' #include #include #ifdef I_NET_IF #include #endif #include int main(void) { struct ifaddrs *ifa0, *ifa; static int ret; ret |= getifaddrs(&ifa0); for (ifa = ifa0; ifa; ifa = ifa->ifa_next) { (void) ifa->ifa_flags; (void) ifa->ifa_addr; (void) ifa->ifa_addr->sa_family; (void) ifa->ifa_netmask; if ((IFF_LOOPBACK | IFF_UP | IFF_RUNNING) & ifa->ifa_flags) break; } freeifaddrs(ifa0); return 0; } EOC case "$i_netif" in "$define") flags='-DI_NET_IF';; esac if $cc $ccflags $flags $ldflags -o try try.c >/dev/null 2>&1; then $cat <<'EOM' It looks like getifaddrs() is usable on your system, good. EOM else echo "Sorry, I will not be using getifaddrs()." val="$undef" fi $rm -f try try.c set d_getifaddrs eval $setvar