Skip to content

Instantly share code, notes, and snippets.

@Pugio
Created October 26, 2015 15:03
Show Gist options
  • Save Pugio/c40450beac87029fb159 to your computer and use it in GitHub Desktop.
Save Pugio/c40450beac87029fb159 to your computer and use it in GitHub Desktop.
Possible refactor of rubinius configure.
def detect_functions
[ [ "HAVE_CLOCK_GETTIME", "clock_gettime", ["time.h"], ]
[ "HAVE_NL_LANGINFO", "nl_langinfo", ["langinfo.h"]]
[ "HAVE_SETPROCTITLE", "setproctitle", ["sys/types.h", "unistd.h"]]
[ "HAVE_POSIX_FADVISE", "posix_fadvise", ["fcntl.h"]]
[ "HAVE_STRNLEN", "strnlen", ["string.h"]]
[ "HAVE_KQUEUE", "kqueue", ["sys/types.h", "sys/event.h", "sys/time.h"]]
[ "HAVE_TIMERFD", "timerfd_create", ["sys/timerfd.h"]]
[ "HAVE_INOTIFY", "inotify_init", ["sys/inotify.h"]]
[ "HAVE_GETTID", "gettid", ["unistd.d", "sys/types.h"]] ].each do |konst, func, sources|
if has_function(func, sources)
@defines << konst
end
end
[["HAVE_STRUCT_STAT_ST_ATIM", "st_atim", ["sys/stat.h"]]
["HAVE_STRUCT_STAT_ST_ATIMESPEC", "st_atimespec", ["sys/stat.h"]]
["HAVE_STRUCT_STAT_ST_ATIMENSEC", "st_atimensec", ["sys/stat.h"]]
["HAVE_STRUCT_STAT_ST_MTIM", "st_mtim", ["sys/stat.h"]]
["HAVE_STRUCT_STAT_ST_MTIMESPEC", "st_mtimespec", ["sys/stat.h"]]
["HAVE_STRUCT_STAT_ST_MTIMENSEC", "st_mtimensec", ["sys/stat.h"]]
["HAVE_STRUCT_STAT_ST_CTIM", "st_ctim", ["sys/stat.h"]]
["HAVE_STRUCT_STAT_ST_CTIMESPEC", "st_ctimespec", ["sys/stat.h"]]
["HAVE_STRUCT_STAT_ST_CTIMENSEC", "st_ctimensec", ["sys/stat.h"]]].each do |konst, member, sources|
if has_struct_member("stat", member, sources)
@defines << konst
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment