summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2022-08-13 09:50:52 +0000
committerBastien Roucariès <rouca@debian.org>2022-08-13 09:50:52 +0000
commit95b398029b6298be9d22f4aefb9cb0f5c2d7f27c (patch)
treec3d87fabdc5a97089fcc02a5a73a536c78f1551b
parent1c36de1e6aae83c1f3c63fbe76534f892fb291f0 (diff)
downloadautoconf-archive-95b398029b6298be9d22f4aefb9cb0f5c2d7f27c.tar.gz
Fix AX_LUA_HEADERS uses AC_RUN_IFELSE
telegram-cli fails to cross build from source, because it uses AX_LUA_HEADERS, which happens to use AC_RUN_IFELSE to compute the lua version. As it turns out, the version is also available as an integer, which allows using the cross-friendly AC_COMPUTE_INT. The attached patch updates AX_LUA_HEADERS to use AC_COMPUTE_INT. Signed-off-by: Bastien Roucariès <rouca@debian.org> debian-bug: https://bugs.debian.org/956713
-rw-r--r--m4/ax_lua.m425
1 files changed, 10 insertions, 15 deletions
diff --git a/m4/ax_lua.m4 b/m4/ax_lua.m4
index 5920167..8d1401e 100644
--- a/m4/ax_lua.m4
+++ b/m4/ax_lua.m4
@@ -524,22 +524,17 @@ AC_DEFUN([AX_LUA_HEADERS],
[ax_cv_lua_header_version],
[ _ax_lua_saved_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
- AC_RUN_IFELSE(
- [ AC_LANG_SOURCE([[
+ AC_COMPUTE_INT(ax_cv_lua_header_version_major,[LUA_VERSION_NUM/100],[AC_INCLUDES_DEFAULT
#include <lua.h>
-#include <stdlib.h>
-#include <stdio.h>
-int main(int argc, char ** argv)
-{
- if(argc > 1) printf("%s", LUA_VERSION);
- exit(EXIT_SUCCESS);
-}
-]])
- ],
- [ ax_cv_lua_header_version=`./conftest$EXEEXT p | \
- $SED -n "s|^Lua \(@<:@0-9@:>@\{1,\}\.@<:@0-9@:>@\{1,\}\).\{0,\}|\1|p"`
- ],
- [ax_cv_lua_header_version='unknown'])
+],[ax_cv_lua_header_version_major=unknown])
+ AC_COMPUTE_INT(ax_cv_lua_header_version_minor,[LUA_VERSION_NUM%100],[AC_INCLUDES_DEFAULT
+#include <lua.h>
+],[ax_cv_lua_header_version_minor=unknown])
+ AS_IF([test "x$ax_cv_lua_header_version_major" = xunknown || test "x$ax_cv_lua_header_version_minor" = xunknown],[
+ ax_cv_lua_header_version=unknown
+ ],[
+ ax_cv_lua_header_version="$ax_cv_lua_header_version_major.$ax_cv_lua_header_version_minor"
+ ])
CPPFLAGS=$_ax_lua_saved_cppflags
])