summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bcf9f86)
raw | patch | inline | side by side (parent: bcf9f86)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Mon, 15 Aug 2016 13:55:22 +0000 (15:55 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Mon, 15 Aug 2016 13:55:22 +0000 (15:55 +0200) |
Not all distro's have a lua.pc file.
This looks for the most common ones, newest versions first.
This looks for the most common ones, newest versions first.
configure.ac | patch | blob | history | |
src/Makefile.am | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index e27b046edc02dbccb0926d1d6b060ecc1d07ece3..d7e5355a1df06cb489a86ed11a33e7f75c5a2e56 100644 (file)
--- a/configure.ac
+++ b/configure.ac
# }}}
# --with-liblua {{{
-with_liblua_cppflags=""
-with_liblua_ldflags=""
-with_liblua_libs=""
-with_liblua="yes"
-
AC_ARG_VAR([LIBLUA_PKG_CONFIG_NAME], [Name of liblua used by pkg-config])
-if test "x$LIBLUA_PKG_CONFIG_NAME" = "x"
+if test "x$LIBLUA_PKG_CONFIG_NAME" != "x"
then
- LIBLUA_PKG_CONFIG_NAME="lua"
+ PKG_CHECK_MODULES([LUA], [$LIBLUA_PKG_CONFIG_NAME],
+ [with_liblua="yes"],
+ [with_liblua="no"]
+ )
+else
+ PKG_CHECK_MODULES([LUA], [lua],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua-5.3],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua5.3],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua-5.2],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua5.2],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua-5.1],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua5.1],
+ [with_liblua="yes"],
+ [with_liblua="no (pkg-config cannot find liblua)"]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
fi
if test "x$with_liblua" = "xyes"
then
- $PKG_CONFIG --exists $LIBLUA_PKG_CONFIG_NAME 2>/dev/null
- lua_config_status=$?
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $LUA_CFLAGS"
- if test 0 -ne $lua_config_status
- then
- with_liblua="no"
- fi
-fi
+ AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
+ [with_liblua="yes"],
+ [with_liblua="no (header not found)"]
+ )
-if test "x$with_liblua" = "xyes"
-then
- with_liblua_cppflags=`$PKG_CONFIG --cflags-only-I $LIBLUA_PKG_CONFIG_NAME` || with_liblua="no"
- with_liblua_ldflags=`$PKG_CONFIG --libs-only-L $LIBLUA_PKG_CONFIG_NAME` || with_liblua="no"
- with_liblua_libs=`$PKG_CONFIG --libs-only-l $LIBLUA_PKG_CONFIG_NAME` || with_liblua="no"
+ CFLAGS="$SAVE_CFLAGS"
fi
-if test "x$with_liblua" = "xyes"
-then
- SAVE_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $with_liblua_cppflags"
- AC_CHECK_HEADERS(lua.h lauxlib.h lualib.h, [], [with_liblua="no (header not found)"], [])
-
- CPPFLAGS="$SAVE_CPPFLAGS"
-fi
if test "x$with_liblua" = "xyes"
then
- SAVE_LDFLAGS="$LDFLAGS"
- SAVE_LIBS="$LIBS"
- LDFLAGS="$SAVE_LDFLAGS $with_liblua_ldflags"
- LIBS="$LIBS $with_liblua_libs"
+ SAVE_LIBS="$LIBS"
+ LIBS="$LIBS $LUA_LIBS"
- AC_CHECK_FUNC(lua_settop, [with_liblua="yes"], [with_liblua="no (symbol 'lua_settop' not found)"])
+ AC_CHECK_FUNC([lua_settop],
+ [with_liblua="yes"],
+ [with_liblua="no (symbol 'lua_settop' not found)"]
+ )
- LDFLAGS="$SAVE_LDFLAGS"
- LIBS="$SAVE_LIBS"
+ LIBS="$SAVE_LIBS"
fi
+
if test "x$with_liblua" = "xyes"
then
- BUILD_WITH_LIBLUA_CPPFLAGS="$with_liblua_cppflags"
- BUILD_WITH_LIBLUA_LDFLAGS="$with_liblua_ldflags"
- BUILD_WITH_LIBLUA_LIBS="$with_liblua_libs"
+ BUILD_WITH_LIBLUA_CFLAGS="$LUA_CFLAGS"
+ BUILD_WITH_LIBLUA_LIBS="$LUA_LIBS"
fi
-AC_SUBST(BUILD_WITH_LIBLUA_CPPFLAGS)
-AC_SUBST(BUILD_WITH_LIBLUA_LDFLAGS)
+AC_SUBST(BUILD_WITH_LIBLUA_CFLAGS)
AC_SUBST(BUILD_WITH_LIBLUA_LIBS)
# }}}
diff --git a/src/Makefile.am b/src/Makefile.am
index ce2f9854f3647b9cbe2c498ac30de2be3892d5fc..dbd5bb91430d76a94dead7f929ce09bd56d608e9 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
pkglib_LTLIBRARIES += lua.la
lua_la_SOURCES = lua.c \
utils_lua.c utils_lua.h
-lua_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBLUA_CPPFLAGS)
-lua_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBLUA_LDFLAGS)
+lua_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBLUA_CFLAGS)
+lua_la_LDFLAGS = $(PLUGIN_LDFLAGS)
lua_la_LIBADD = $(BUILD_WITH_LIBLUA_LIBS)
endif