From 111305c1bdc14546e515c8cf3f2975d610aafa84 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 5 Jul 2011 18:31:33 -0700 Subject: [PATCH] Support SunOS 121. Check for ifaddrs in wscript for SunOS build. --- src/platform_sunos.cc | 12 +++++++++++- wscript | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/platform_sunos.cc b/src/platform_sunos.cc index 3a1cedbb1061ca..76946fdec9cee6 100644 --- a/src/platform_sunos.cc +++ b/src/platform_sunos.cc @@ -36,7 +36,10 @@ #include #include #include -#include + +#ifdef SUNOS_HAVE_IFADDRS +# include +#endif @@ -297,6 +300,11 @@ int Platform::GetLoadAvg(Local *loads) { Handle 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; @@ -355,6 +363,8 @@ Handle Platform::GetInterfaceAddresses() { freeifaddrs(addrs); return scope.Close(ret); + +#endif // SUNOS_HAVE_IFADDRS } diff --git a/wscript b/wscript index 1e35c0f4fe1801..cdc1c886a2b81e 100644 --- a/wscript +++ b/wscript @@ -351,6 +351,17 @@ def configure(conf): conf.env.append_value('CPPFLAGS', '-DHAVE_MONOTONIC_CLOCK=0') if sys.platform.startswith("sunos"): + code = """ + #include + 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"):