#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <ifaddrs.h>
+
+#ifdef SUNOS_HAVE_IFADDRS
+# include <ifaddrs.h>
+#endif
Handle<Value> Platform::GetInterfaceAddresses() {
HandleScope scope;
+
+#ifndef SUNOS_HAVE_IFADDRS
+ return ThrowException(Exception::Error(String::New(
+ "This version of sunos doesn't support getifaddrs")));
+#else
struct ::ifaddrs *addrs, *ent;
struct ::sockaddr_in *in4;
struct ::sockaddr_in6 *in6;
freeifaddrs(addrs);
return scope.Close(ret);
+
+#endif // SUNOS_HAVE_IFADDRS
}
conf.env.append_value('CPPFLAGS', '-DHAVE_MONOTONIC_CLOCK=0')
if sys.platform.startswith("sunos"):
+ code = """
+ #include <ifaddrs.h>
+ int main(void) {
+ struct ifaddrs hello;
+ return 0;
+ }
+ """
+
+ if conf.check_cc(msg="Checking for ifaddrs on solaris", fragment=code):
+ conf.env.append_value('CPPFLAGS', '-DSUNOS_HAVE_IFADDRS')
+
if not conf.check(lib='socket', uselib_store="SOCKET"):
conf.fatal("Cannot find socket library")
if not conf.check(lib='nsl', uselib_store="NSL"):