commit bcaaee4445ab10918c1c5e1256bf515b563fee8c
parent fbeaa5098054b66d13b5dbbaee6d6cde6d8df234
Author: Gaute Hope <eg@gaute.vetsj.com>
Date: Wed, 12 Mar 2014 22:01:10 +0100
Fix #25: include sys/time.h if available
Diffstat:
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/extconf.rb b/extconf.rb
@@ -175,6 +175,11 @@ if have_func("clock_gettime")
$CFLAGS += " -DHAVE_CLOCK_GETTIME"
end
+# check if we have sys/time.h, should increase portability
+# https://github.com/sup-heliotrope/ncursesw-ruby/issues/25
+# http://stackoverflow.com/questions/7889678/how-can-adding-a-header-increase-portability-sys-time-h
+have_header("sys/time.h")
+
$CXXFLAGS = $CFLAGS
create_makefile('ncursesw_bin')
diff --git a/ncurses_wrap.c b/ncurses_wrap.c
@@ -75,6 +75,10 @@
#include <time.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
VALUE mNcurses; /* module Ncurses */
VALUE cWINDOW; /* class Ncurses::WINDOW */
VALUE cSCREEN; /* class Ncurses::SCREEN */