Skip to content

Commit ec2ee80

Browse files
committed
Remove hardcoded 5.1 lua version and iterate through all possible versions
1 parent 28b80b7 commit ec2ee80

1 file changed

Lines changed: 20 additions & 53 deletions

File tree

build/find_lua.m4

Lines changed: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -83,59 +83,26 @@ else
8383
dnl Hack to just try to find the lib and include
8484
AC_MSG_CHECKING([for lua install])
8585
for x in ${test_paths}; do
86-
for y in ${LUA_SONAMES}; do
87-
if test -e "${x}/liblua5.1.${y}"; then
88-
lua_lib_path="${x}"
89-
lua_lib_name="lua5.1"
90-
break
91-
elif test -e "${x}/lib/liblua5.1.${y}"; then
92-
lua_lib_path="${x}/lib"
93-
lua_lib_name="lua5.1"
94-
break
95-
elif test -e "${x}/lib64/liblua5.1.${y}"; then
96-
lua_lib_path="${x}/lib64"
97-
lua_lib_name="lua5.1"
98-
break
99-
elif test -e "${x}/lib32/liblua5.1.${y}"; then
100-
lua_lib_path="${x}/lib32"
101-
lua_lib_name="lua5.1"
102-
break
103-
elif test -e "${x}/liblua51.${y}"; then
104-
lua_lib_path="${x}"
105-
lua_lib_name="lua51"
106-
break
107-
elif test -e "${x}/lib/liblua51.${y}"; then
108-
lua_lib_path="${x}/lib"
109-
lua_lib_name="lua51"
110-
break
111-
elif test -e "${x}/lib64/liblua51.${y}"; then
112-
lua_lib_path="${x}/lib64"
113-
lua_lib_name="lua51"
114-
break
115-
elif test -e "${x}/lib32/liblua51.${y}"; then
116-
lua_lib_path="${x}/lib32"
117-
lua_lib_name="lua51"
118-
break
119-
elif test -e "${x}/liblua.${y}"; then
120-
lua_lib_path="${x}"
121-
lua_lib_name="lua"
122-
break
123-
elif test -e "${x}/lib/liblua.${y}"; then
124-
lua_lib_path="${x}/lib"
125-
lua_lib_name="lua"
126-
break
127-
elif test -e "${x}/lib64/liblua.${y}"; then
128-
lua_lib_path="${x}/lib64"
129-
lua_lib_name="lua"
130-
break
131-
elif test -e "${x}/lib32/liblua.${y}"; then
132-
lua_lib_path="${x}/lib32"
133-
lua_lib_name="lua"
134-
break
135-
else
136-
lua_lib_path=""
137-
lua_lib_name=""
138-
fi
86+
for v in 5.5 5.4 5.3 5.2 5.1 ""; do
87+
# Generate the necessary names: lua5.5, lua5.4 ... or just simply lua
88+
curr_lib="lua${v}"
89+
if test -z "${v}"; then curr_lib="lua"; fi
90+
91+
for y in ${LUA_SONAMES}; do
92+
if test -e "${x}/lib${curr_lib}.${y}"; then
93+
lua_lib_path="${x}"
94+
lua_lib_name="${curr_lib}"
95+
break 2 # exit from two inner loops
96+
elif test -e "${x}/lib/${curr_lib}.${y}"; then
97+
lua_lib_path="${x}/lib"
98+
lua_lib_name="${curr_lib}"
99+
break 2
100+
elif test -e "${x}/lib64/lib${curr_lib}.${y}"; then
101+
lua_lib_path="${x}/lib64"
102+
lua_lib_name="${curr_lib}"
103+
break 2
104+
fi
105+
done
139106
done
140107
if test -n "$lua_lib_path"; then
141108
break

0 commit comments

Comments
 (0)