summaryrefslogtreecommitdiff
path: root/m4/ax_lua.m4
diff options
context:
space:
mode:
authorJimmy Jazz <Jimmy.jazz@gmx.net>2014-10-15 10:32:43 +0200
committerPeter Simons <simons@cryp.to>2014-10-15 10:32:43 +0200
commit825427776a2a1223b64c29c9a458ee31874a8e82 (patch)
tree2dd1df998cedac5ef33f88cc49662648481fcda0 /m4/ax_lua.m4
parent170f2369a0657fd1947d9593c598a4f984cf4244 (diff)
downloadautoconf-archive-825427776a2a1223b64c29c9a458ee31874a8e82.tar.gz
AX_LUA: fix initialization of ac_cv_header_lua_h.
Diffstat (limited to 'm4/ax_lua.m4')
-rw-r--r--m4/ax_lua.m4102
1 files changed, 36 insertions, 66 deletions
diff --git a/m4/ax_lua.m4 b/m4/ax_lua.m4
index 15376af..4c04c40 100644
--- a/m4/ax_lua.m4
+++ b/m4/ax_lua.m4
@@ -180,7 +180,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 28
+#serial 29
dnl =========================================================================
dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION],
@@ -410,7 +410,9 @@ AC_DEFUN([AX_LUA_HEADERS],
dnl Some default directories to search.
LUA_SHORT_VERSION=`echo "$LUA_VERSION" | sed 's|\.||'`
m4_define_default([_AX_LUA_INCLUDE_LIST],
- [ /usr/include/lua$LUA_VERSION \
+ [ [$LUA_INCLUDE] \
+ /usr/include \
+ /usr/include/lua$LUA_VERSION \
/usr/include/lua/$LUA_VERSION \
/usr/include/lua$LUA_SHORT_VERSION \
/usr/local/include/lua$LUA_VERSION \
@@ -420,49 +422,15 @@ AC_DEFUN([AX_LUA_HEADERS],
])
dnl Try to find the headers.
- _ax_lua_saved_cppflags=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
- AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h])
- CPPFLAGS=$_ax_lua_saved_cppflags
-
- dnl Try some other directories if LUA_INCLUDE was not set.
- AS_IF([test "x$LUA_INCLUDE" = 'x' &&
- test "x$ac_cv_header_lua_h" != 'xyes'],
- [ dnl Try some common include paths.
- for _ax_include_path in _AX_LUA_INCLUDE_LIST; do
- test ! -d "$_ax_include_path" && continue
-
- AC_MSG_CHECKING([for Lua headers in])
- AC_MSG_RESULT([$_ax_include_path])
-
- AS_UNSET([ac_cv_header_lua_h])
- AS_UNSET([ac_cv_header_lualib_h])
- AS_UNSET([ac_cv_header_lauxlib_h])
- AS_UNSET([ac_cv_header_luaconf_h])
-
- _ax_lua_saved_cppflags=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -I$_ax_include_path"
- AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h])
- CPPFLAGS=$_ax_lua_saved_cppflags
-
- AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'],
- [ LUA_INCLUDE="-I$_ax_include_path"
- break
- ])
- done
- ])
-
- AS_IF([test "x$ac_cv_header_lua_h" = 'xyes' && test "x$cross_compiling" != 'xyes'],
- [ dnl Make a program to print LUA_VERSION defined in the header.
- dnl TODO This probably shouldn't be a runtime test.
-
- AC_CACHE_CHECK([for Lua header version],
- [ax_cv_lua_header_version],
- [ _ax_lua_saved_cppflags=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
- AC_RUN_IFELSE(
- [ AC_LANG_SOURCE([[
-#include <lua.h>
+ AS_VAR_SET([LUA_SAVED_CPPFLAGS], [$CPPFLAGS])
+
+ AS_FOR([LUA_INCLUDE], [_ax_include_path], [_AX_LUA_INCLUDE_LIST], [
+ CPPFLAGS="-I$_ax_include_path"
+ AC_CHECK_HEADERS([lua.h lualib.h lauxlib.h luaconf.h])
+ AS_IF([test x$ac_cv_header_lua_h = xyes], [
+ AC_RUN_IFELSE([
+ AC_LANG_SOURCE([[
+#include "lua.h"
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char ** argv)
@@ -471,28 +439,31 @@ int main(int argc, char ** argv)
exit(EXIT_SUCCESS);
}
]])
- ],
- [ ax_cv_lua_header_version=`./conftest$EXEEXT p | \
- sed "s|^Lua \(.*\)|\1|" | \
- grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"`
- ],
- [ax_cv_lua_header_version='unknown'])
- CPPFLAGS=$_ax_lua_saved_cppflags
- ])
-
- dnl Compare this to the previously found LUA_VERSION.
- AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION])
- AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"],
- [ AC_MSG_RESULT([yes])
- ax_header_version_match='yes'
],
- [ AC_MSG_RESULT([no])
- ax_header_version_match='no'
- ])
- ],
- [
+ [ LUA_HEADER_VERSION=`./conftest$EXEEXT p | \
+ sed "s|^Lua \(.*\)|\1|" | \
+ grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"`
+ ],
+ [LUA_HEADER_VERSION='unknown'])
+ dnl Compare this to the previously found LUA_VERSION.
+ AC_MSG_CHECKING([if Lua header version $LUA_HEADER_VERSION matches $LUA_VERSION])
+ AS_IF([test "x$LUA_HEADER_VERSION" = "x$LUA_VERSION"], [
+ AC_MSG_RESULT([yes])
ax_header_version_match='yes'
- ])
+ [LUA_INCLUDE="-I$_ax_include_path"]
+ [ax_cv_lua_luaincludedir="$_ax_include_path"]
+ AC_SUBST([luaincludedir], [$ax_cv_lua_luaincludedir])
+ ],
+ [ AC_MSG_RESULT([no])
+ ax_header_version_match='no'
+ ])
+ ])
+
+ AS_IF([test x$ax_header_version_match = xyes], [break])
+ ])
+
+ CPPFLAGS="$LUA_SAVED_CPPFLAGS"
+ AS_UNSET([LUA_SAVED_CPPFLAGS])
dnl Was LUA_INCLUDE specified?
AS_IF([test "x$ax_header_version_match" != 'xyes' &&
@@ -510,7 +481,6 @@ AC_DEFUN([AX_LUA_HEADERS_VERSION],
AC_MSG_WARN([[$0 is deprecated, please use AX_LUA_HEADERS]])
])
-
dnl =========================================================================
dnl AX_LUA_LIBS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl =========================================================================