Browse Source

app_lua: search for for lua 5.1 compilation flags

- lua 5.2 embedded api is not compatible with 5.1
- an upgrade to c code in app_lua is required, till then, lua-5.1 has to
  be installed (can co-exist with lua 5.2)
Daniel-Constantin Mierla 11 years ago
parent
commit
04da8d891c
1 changed files with 17 additions and 7 deletions
  1. 17 7
      modules/app_lua/Makefile

+ 17 - 7
modules/app_lua/Makefile

@@ -8,12 +8,12 @@ auto_gen=
 NAME=app_lua.so
 
 ifeq ($(CROSS_COMPILE),)
-BUILDER = $(shell which lua-config)
+	BUILDER = $(shell which lua-config)
 endif
 
 ifeq ($(BUILDER),)
 	ifeq ($(CROSS_COMPILE),)
-	BUILDER = $(shell which pkg-config)
+		BUILDER = $(shell which pkg-config)
 	endif
 	ifeq ($(BUILDER),)
 		LUA51 = $(shell ls $(LOCALBASE)/lib/liblua* | grep liblua5.1)
@@ -28,14 +28,19 @@ ifeq ($(BUILDER),)
 		endif
 	else
 		LUAVER=XX
-		LUALIBS = $(shell pkg-config --silence-errors --libs lua)
+		LUALIBS = $(shell pkg-config --silence-errors --libs lua-5.1)
 		ifeq ($(LUALIBS),)
 			LUALIBS = $(shell pkg-config --silence-errors --libs lua5.1)
-			ifneq ($(LUALIBS),)
+			ifeq ($(LUALIBS),)
+				LUALIBS = $(shell pkg-config --silence-errors --libs lua)
+				ifneq ($(LUALIBS),)
+					LUAVER=5X
+				endif
+			else
 				LUAVER=51
 			endif
 		else
-			LUAVER=5X
+			LUAVER=51X
 		endif
 		ifeq ($(LUAVER),XX)
 			LUA51 = $(shell ls /usr/lib/liblua* | grep liblua5.1)
@@ -51,8 +56,13 @@ ifeq ($(BUILDER),)
 				DEFS+= $(shell pkg-config --cflags lua5.1 | sed -e "s/\\\\/'/" -e "s/\\\\\"/\"'/")
 				LIBS = $(shell pkg-config --libs lua5.1)
 			else
-				DEFS+= $(shell pkg-config --cflags lua)
-				LIBS = $(shell pkg-config --libs lua)
+				ifeq ($(LUAVER),51X)
+					DEFS+= $(shell pkg-config --cflags lua-5.1)
+					LIBS = $(shell pkg-config --libs lua-5.1)
+				else
+					DEFS+= $(shell pkg-config --cflags lua)
+					LIBS = $(shell pkg-config --libs lua)
+				endif
 			endif
 		endif
 	endif