File tree 2 files changed +22
-1
lines changed 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 36
36
#include < net/if.h>
37
37
#include < netinet/in.h>
38
38
#include < arpa/inet.h>
39
- #include < ifaddrs.h>
39
+
40
+ #ifdef SUNOS_HAVE_IFADDRS
41
+ # include < ifaddrs.h>
42
+ #endif
40
43
41
44
42
45
@@ -297,6 +300,11 @@ int Platform::GetLoadAvg(Local<Array> *loads) {
297
300
298
301
Handle <Value> Platform::GetInterfaceAddresses () {
299
302
HandleScope scope;
303
+
304
+ #ifndef SUNOS_HAVE_IFADDRS
305
+ return ThrowException (Exception::Error (String::New (
306
+ " This version of sunos doesn't support getifaddrs" )));
307
+ #else
300
308
struct ::ifaddrs *addrs, *ent;
301
309
struct ::sockaddr_in *in4;
302
310
struct ::sockaddr_in6 *in6;
@@ -355,6 +363,8 @@ Handle<Value> Platform::GetInterfaceAddresses() {
355
363
freeifaddrs (addrs);
356
364
357
365
return scope.Close (ret);
366
+
367
+ #endif // SUNOS_HAVE_IFADDRS
358
368
}
359
369
360
370
Original file line number Diff line number Diff line change @@ -351,6 +351,17 @@ def configure(conf):
351
351
conf .env .append_value ('CPPFLAGS' , '-DHAVE_MONOTONIC_CLOCK=0' )
352
352
353
353
if sys .platform .startswith ("sunos" ):
354
+ code = """
355
+ #include <ifaddrs.h>
356
+ int main(void) {
357
+ struct ifaddrs hello;
358
+ return 0;
359
+ }
360
+ """
361
+
362
+ if conf .check_cc (msg = "Checking for ifaddrs on solaris" , fragment = code ):
363
+ conf .env .append_value ('CPPFLAGS' , '-DSUNOS_HAVE_IFADDRS' )
364
+
354
365
if not conf .check (lib = 'socket' , uselib_store = "SOCKET" ):
355
366
conf .fatal ("Cannot find socket library" )
356
367
if not conf .check (lib = 'nsl' , uselib_store = "NSL" ):
You can’t perform that action at this time.
0 commit comments