[PATCH] Enable compilation on OpenBSD
by Richard Ipsum
---
Makefile | 4 ++--
findlua.mk | 8 ++++++++
luxio.c | 4 ++--
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 7b98d0b..5826b73 100644
--- a/Makefile
+++ b/Makefile
@@ -78,7 +78,7 @@ luxio-5.2: lua-5.2.c luxio-5.2.o
###
luxio-5.1.o: luxio.c luxio_constants.inc
- $(CC) $(CFLAGS) -fPIC $(LUA51_INC) -c $< -o $@
+ $(CC) $(CFLAGS) -fPIC $(EXTRA_INC) $(LUA51_INC) -c $< -o $@
luxio-5.2.o: luxio.c luxio_constants.inc
- $(CC) $(CFLAGS) -fPIC $(LUA52_INC) -c $< -o $@
+ $(CC) $(CFLAGS) -fPIC $(EXTRA_INC) $(LUA52_INC) -c $< -o $@
diff --git a/findlua.mk b/findlua.mk
index 45012b7..895ec1a 100644
--- a/findlua.mk
+++ b/findlua.mk
@@ -17,6 +17,14 @@ else
EXTRA_LIBS :=
endif
+ifeq ($(HOST_OS),OpenBSD)
+ # Linux and FreeBSD have a 'builtin' iconv
+ EXTRA_LIBS := $(EXTRA_LIBS) -L /usr/local/lib -liconv
+ EXTRA_INC := -I /usr/local/include
+else
+ EXTRA_INC :=
+endif
+
NAKED_LUA_VER := $(shell (pkg-config --exists lua && \
pkg-config --modversion lua || \
pkg-config --variable V lua) | cut -d. -f1-2)
diff --git a/luxio.c b/luxio.c
index e952c47..1dca902 100644
--- a/luxio.c
+++ b/luxio.c
@@ -2550,7 +2550,7 @@ luxio_nanosleep(lua_State *L) /* 14.2.5 */
POSIX message passing is not available on all platforms.
@section msgpass
*/
-#if defined(_POSIX_MESSAGE_PASSING)
+#if _POSIX_MESSAGE_PASSING >= 0
#include <mqueue.h>
@@ -4592,7 +4592,7 @@ luxio_functions[] = {
{ "nanosleep", luxio_nanosleep },
-#if defined(_POSIX_MESSAGE_PASSING)
+#if _POSIX_MESSAGE_PASSING >= 0
#if _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L
{ "mq_timedsend", luxio_mq_timedsend },
--
2.19.1
4 years, 6 months