forked from Mirror/frr
build: improve AX_LUA_HEADERS for crosscompile
The preprocessor is something configure can invoke. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
8b11dfcaec
commit
6fc9987217
33
m4/ax_lua.m4
33
m4/ax_lua.m4
|
@ -514,33 +514,14 @@ AC_DEFUN([AX_LUA_HEADERS],
|
||||||
])
|
])
|
||||||
|
|
||||||
AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'],
|
AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'],
|
||||||
[ dnl Make a program to print LUA_VERSION defined in the header.
|
|
||||||
dnl TODO It would be really nice if we could do this without compiling a
|
|
||||||
dnl program, then it would work when cross compiling. But I'm not sure how
|
|
||||||
dnl to do this reliably. For now, assume versions match when cross compiling.
|
|
||||||
|
|
||||||
AS_IF([test "x$cross_compiling" != 'xyes'],
|
|
||||||
[ AC_CACHE_CHECK([for Lua header version],
|
[ AC_CACHE_CHECK([for Lua header version],
|
||||||
[ax_cv_lua_header_version],
|
[ax_cv_lua_header_version],
|
||||||
[ _ax_lua_saved_cppflags=$CPPFLAGS
|
[
|
||||||
CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
|
ax_cv_lua_header_version=`echo LUA_VERSION | \
|
||||||
AC_RUN_IFELSE(
|
$CC -P -E $LUA_INCLUDE -imacros lua.h - | \
|
||||||
[ AC_LANG_SOURCE([[
|
$SED -e 's%"\s*"%%g' -e 's%^\s*%%' | \
|
||||||
#include <lua.h>
|
tr -d '"\n' | \
|
||||||
#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"`
|
$SED -n "s|^Lua \(@<:@0-9@:>@\{1,\}\.@<:@0-9@:>@\{1,\}\).\{0,\}|\1|p"`
|
||||||
],
|
|
||||||
[ax_cv_lua_header_version='unknown'])
|
|
||||||
CPPFLAGS=$_ax_lua_saved_cppflags
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Compare this to the previously found LUA_VERSION.
|
dnl Compare this to the previously found LUA_VERSION.
|
||||||
|
@ -552,10 +533,6 @@ int main(int argc, char ** argv)
|
||||||
[ AC_MSG_RESULT([no])
|
[ AC_MSG_RESULT([no])
|
||||||
ax_header_version_match='no'
|
ax_header_version_match='no'
|
||||||
])
|
])
|
||||||
],
|
|
||||||
[ AC_MSG_WARN([cross compiling so assuming header version number matches])
|
|
||||||
ax_header_version_match='yes'
|
|
||||||
])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Was LUA_INCLUDE specified?
|
dnl Was LUA_INCLUDE specified?
|
||||||
|
|
Loading…
Reference in a new issue