From 8177ec7a32ef7f4c12756d8b272d15a9239a154d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 14 Jul 2015 20:08:49 +0000 Subject: check for the existence of linux/tcp.h The linux/tcp.h header may not exist on alternative libc implementations such as musl. Noticed-by: Doug Forster --- ext/raindrops/extconf.rb | 1 + ext/raindrops/linux_tcp_info.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/raindrops/extconf.rb b/ext/raindrops/extconf.rb index f012808..74ed8f9 100644 --- a/ext/raindrops/extconf.rb +++ b/ext/raindrops/extconf.rb @@ -6,6 +6,7 @@ have_func('munmap', 'sys/mman.h') or abort 'munmap() not found' $CPPFLAGS += " -D_GNU_SOURCE " have_func('mremap', 'sys/mman.h') +have_header('linux/tcp.h') $CPPFLAGS += " -D_BSD_SOURCE " have_func("getpagesize", "unistd.h") diff --git a/ext/raindrops/linux_tcp_info.c b/ext/raindrops/linux_tcp_info.c index dcdb153..5e25d4d 100644 --- a/ext/raindrops/linux_tcp_info.c +++ b/ext/raindrops/linux_tcp_info.c @@ -1,4 +1,4 @@ -#ifdef __linux__ +#if defined(__linux__) && defined(HAVE_LINUX_TCP_H) #include #include #include @@ -170,4 +170,4 @@ void Init_raindrops_linux_tcp_info(void) TCPI_DEFINE_METHOD(total_retrans); } #endif /* TCP_INFO */ -#endif /* __linux__ */ +#endif /* defined(__linux__) && defined(HAVE_LINUX_TCP_H) */ -- cgit v1.2.3-24-ge0c7