luaposix: musl compatibility with XOPEN_REALTIME 5500/head
authorKarl Palsson <karlp@etactica.com>
Thu, 25 Jan 2018 15:11:46 +0000 (15:11 +0000)
committerKarl Palsson <karlp@etactica.com>
Thu, 25 Jan 2018 15:11:46 +0000 (15:11 +0000)
musl-libc doesn't define _XOPEN_REALTIME as it doesn't implement the
full set of the realtime operations.  However, it _does_ implement
POSIX_TIMERS, which is what luaposix _should_ be checking for in the
posix.time module.

I've filed https://github.com/luaposix/luaposix/issues/295 to track this
upstream, but this is a simpler, verified fix for our older version of
luaposix.

This restores functions like posix.time.clock_gettime(CLOCK_MONOTONIC)
for instance, which was available with pre-musl builds of luaposix.

Signed-off-by: Karl Palsson <karlp@etactica.com>
lang/luaposix/Makefile

index abc1e52bbe10b64ae05b87c8900c85460c75f4b4..92ff86d0e5528951428e152bdfe0301ee910f92d 100644 (file)
@@ -44,6 +44,9 @@ CONFIGURE_VARS += ac_cv_path_LDOC="true"
 TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99
 ifeq ($(CONFIG_USE_MUSL),y)
   TARGET_CFLAGS += -D_POSIX_PRIORITY_SCHEDULING
+  # Musl doesn't do all of XOPEN_REALTIME, but it does for luaposix.
+  # see https://github.com/luaposix/luaposix/issues/295
+  TARGET_CFLAGS += -D_XOPEN_REALTIME=1
 endif
 
 ifneq ($(CONFIG_USE_GLIBC),)