From 6b34ed896ca9db333bfb225f3402aefcf9c817d8 Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing Date: Thu, 7 Jan 2016 19:41:57 +0100 Subject: Drop backwards compatibility with Lua < 5.2 ..and LuaJIT --- bin/lem.c | 26 - configure | 1646 ++++++++++++++++++++++------------------------------------ configure.ac | 17 +- lem/repl.lua | 3 - 4 files changed, 634 insertions(+), 1058 deletions(-) diff --git a/bin/lem.c b/bin/lem.c index 0f660e9..d1f9747 100644 --- a/bin/lem.c +++ b/bin/lem.c @@ -191,30 +191,10 @@ lem_queue(lua_State *T, int nargs) static void thread_error(lua_State *T) { -#ifdef HAVE_TRACEBACK const char *msg = lua_tostring(T, -1); if (msg) luaL_traceback(L, T, msg, 0); -#else /* adapted from Lua 5.1 source */ - if (!lua_isstring(T, -1)) /* 'message' not a string? */ - return; - lua_getfield(T, LUA_GLOBALSINDEX, "debug"); - if (!lua_istable(T, -1)) { - lua_pop(T, 1); - goto merror; - } - lua_getfield(T, -1, "traceback"); - if (!lua_isfunction(T, -1)) { - lua_pop(T, 2); - goto merror; - } - lua_pushvalue(T, -3); /* pass error message */ - lua_pushinteger(T, 1); /* skip traceback */ - lua_call(T, 2, 1); /* call debug.traceback */ -merror: - lua_xmove(T, L, 1); /* move error message to L */ -#endif } static void @@ -250,11 +230,7 @@ runqueue_pop(EV_P_ struct ev_idle *w, int revents) rq.first &= rq.mask; /* run Lua thread */ -#if LUA_VERSION_NUM >= 502 switch (lua_resume(T, NULL, nargs)) { -#else - switch (lua_resume(T, nargs)) { -#endif case LUA_OK: /* thread finished successfully */ lem_debug("thread finished successfully"); lem_forgetthread(T); @@ -266,10 +242,8 @@ runqueue_pop(EV_P_ struct ev_idle *w, int revents) case LUA_ERRERR: /* error running error handler */ lem_debug("thread errored while running error handler"); -#if LUA_VERSION_NUM >= 502 case LUA_ERRGCMM: lem_debug("error in __gc metamethod"); -#endif case LUA_ERRRUN: /* runtime error */ lem_debug("thread errored"); thread_error(T); diff --git a/configure b/configure index 9a4ac6e..7450246 100755 --- a/configure +++ b/configure @@ -3760,407 +3760,69 @@ headers="ev-config.h ev.h $headers" CPPFLAGS_ADD="$CPPFLAGS_ADD -Ilibev" # Configure Lua -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif +case "x$with_lua" in #( + xbuiltin) : + ;; #( + xcheck) : -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi + pkg_failed=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - + else + pkg_failed=untried fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried fi -done -case "x$with_lua" in #( - xbuiltin) : - ;; #( - xcheck) : +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.2" 2>&1` + else + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$Lua_PKG_ERRORS" >&5 + pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 @@ -4170,12 +3832,12 @@ if test -n "$Lua_CFLAGS"; then pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua52\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua52") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua" 2>/dev/null` + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua52" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4187,12 +3849,12 @@ if test -n "$Lua_LIBS"; then pkg_cv_Lua_LIBS="$Lua_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua52\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua52") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua" 2>/dev/null` + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua52" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4213,9 +3875,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua52" 2>&1` else - Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua52" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$Lua_PKG_ERRORS" >&5 @@ -4229,12 +3891,12 @@ if test -n "$Lua_CFLAGS"; then pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.2" 2>/dev/null` + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4246,12 +3908,12 @@ if test -n "$Lua_LIBS"; then pkg_cv_Lua_LIBS="$Lua_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.2" 2>/dev/null` + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4272,13 +3934,32 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.2" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua" 2>&1` else - Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.2" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$Lua_PKG_ERRORS" >&5 + with_lua=builtin +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + with_lua=builtin +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + if test "x$($PKG_CONFIG --variable=V lua)" = 'x5.2'; then : + with_lua=lua +else + with_lua=builtin +fi +fi +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 @@ -4288,12 +3969,12 @@ if test -n "$Lua_CFLAGS"; then pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.1" 2>/dev/null` + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4305,12 +3986,12 @@ if test -n "$Lua_LIBS"; then pkg_cv_Lua_LIBS="$Lua_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.1" 2>/dev/null` + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4331,124 +4012,35 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.1" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua" 2>&1` else - Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.1" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$Lua_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 -$as_echo_n "checking for lua_newstate in -llua... " >&6; } -if ${ac_cv_lib_lua_lua_newstate+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char lua_newstate (); -int -main () -{ -return lua_newstate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua_lua_newstate=yes -else - ac_cv_lib_lua_lua_newstate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 -$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } -if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : - with_lua=lua - Lua_CFLAGS='' - Lua_LIBS='-llua' -else - with_lua=builtin -fi - - -else - with_lua=builtin -fi - + with_lua=builtin elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 -$as_echo_n "checking for lua_newstate in -llua... " >&6; } -if ${ac_cv_lib_lua_lua_newstate+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char lua_newstate (); -int -main () -{ -return lua_newstate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua_lua_newstate=yes + with_lua=builtin else - ac_cv_lib_lua_lua_newstate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 -$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } -if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + if test "x$($PKG_CONFIG --variable=V lua)" = 'x5.2'; then : with_lua=lua - Lua_CFLAGS='' - Lua_LIBS='-llua' else with_lua=builtin fi - - -else - with_lua=builtin fi - else Lua_CFLAGS=$pkg_cv_Lua_CFLAGS Lua_LIBS=$pkg_cv_Lua_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - with_lua=lua5.1 + with_lua=lua52 fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -4462,12 +4054,12 @@ if test -n "$Lua_CFLAGS"; then pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua52\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua52") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.1" 2>/dev/null` + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua52" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4479,12 +4071,12 @@ if test -n "$Lua_LIBS"; then pkg_cv_Lua_LIBS="$Lua_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua52\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua52") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.1" 2>/dev/null` + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua52" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4505,131 +4097,87 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.1" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua52" 2>&1` else - Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.1" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua52" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$Lua_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 -$as_echo_n "checking for lua_newstate in -llua... " >&6; } -if ${ac_cv_lib_lua_lua_newstate+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char lua_newstate (); -int -main () -{ -return lua_newstate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua_lua_newstate=yes +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 +$as_echo_n "checking for Lua... " >&6; } + +if test -n "$Lua_CFLAGS"; then + pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else - ac_cv_lib_lua_lua_newstate=no + pkg_failed=yes fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + else + pkg_failed=untried fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 -$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } -if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : - with_lua=lua - Lua_CFLAGS='' - Lua_LIBS='-llua' +if test -n "$Lua_LIBS"; then + pkg_cv_Lua_LIBS="$Lua_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else - with_lua=builtin + pkg_failed=yes fi - - -else - with_lua=builtin + else + pkg_failed=untried fi -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 -$as_echo_n "checking for lua_newstate in -llua... " >&6; } -if ${ac_cv_lib_lua_lua_newstate+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char lua_newstate (); -int -main () -{ -return lua_newstate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua_lua_newstate=yes -else - ac_cv_lib_lua_lua_newstate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 -$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } -if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : - with_lua=lua - Lua_CFLAGS='' - Lua_LIBS='-llua' -else - with_lua=builtin -fi +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes else - with_lua=builtin + _pkg_short_errors_supported=no fi + if test $_pkg_short_errors_supported = yes; then + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua" 2>&1` + else + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$Lua_PKG_ERRORS" >&5 + with_lua=builtin +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + with_lua=builtin else Lua_CFLAGS=$pkg_cv_Lua_CFLAGS Lua_LIBS=$pkg_cv_Lua_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - with_lua=lua5.1 -fi + if test "x$($PKG_CONFIG --variable=V lua)" = 'x5.2'; then : + with_lua=lua else - Lua_CFLAGS=$pkg_cv_Lua_CFLAGS - Lua_LIBS=$pkg_cv_Lua_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - with_lua=lua5.2 + with_lua=builtin +fi fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -4643,12 +4191,12 @@ if test -n "$Lua_CFLAGS"; then pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.2" 2>/dev/null` + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4660,12 +4208,12 @@ if test -n "$Lua_LIBS"; then pkg_cv_Lua_LIBS="$Lua_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lua") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.2" 2>/dev/null` + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4686,13 +4234,44 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.2" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua" 2>&1` else - Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.2" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$Lua_PKG_ERRORS" >&5 + with_lua=builtin +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + with_lua=builtin +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + if test "x$($PKG_CONFIG --variable=V lua)" = 'x5.2'; then : + with_lua=lua +else + with_lua=builtin +fi +fi +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_lua=lua52 +fi +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_lua=lua5.2 +fi ;; #( + *) : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 @@ -4702,12 +4281,12 @@ if test -n "$Lua_CFLAGS"; then pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\"\$with_lua\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors ""$with_lua"") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.1" 2>/dev/null` + pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags ""$with_lua"" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4719,12 +4298,12 @@ if test -n "$Lua_LIBS"; then pkg_cv_Lua_LIBS="$Lua_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\"\$with_lua\"\""; } >&5 + ($PKG_CONFIG --exists --print-errors ""$with_lua"") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.1" 2>/dev/null` + pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs ""$with_lua"" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -4745,20 +4324,34 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.1" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs ""$with_lua"" 2>&1` else - Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.1" 2>&1` + Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs ""$with_lua"" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$Lua_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 -$as_echo_n "checking for lua_newstate in -llua... " >&6; } -if ${ac_cv_lib_lua_lua_newstate+:} false; then : + as_fn_error $? "\"pkg-config package '$with_lua' not found\"" "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "\"pkg-config package '$with_lua' not found\"" "$LINENO" 5 +else + Lua_CFLAGS=$pkg_cv_Lua_CFLAGS + Lua_LIBS=$pkg_cv_Lua_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi ;; +esac + +if test "x$with_lua" = 'xbuiltin'; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sin" >&5 +$as_echo_n "checking for library containing sin... " >&6; } +if ${ac_cv_search_sin+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua $LIBS" + ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4768,51 +4361,53 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char lua_newstate (); +char sin (); int main () { -return lua_newstate (); +return sin (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua_lua_newstate=yes -else - ac_cv_lib_lua_lua_newstate=no +for ac_lib in '' m; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_sin=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + conftest$ac_exeext + if ${ac_cv_search_sin+:} false; then : + break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 -$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } -if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : - with_lua=lua - Lua_CFLAGS='' - Lua_LIBS='-llua' +done +if ${ac_cv_search_sin+:} false; then : + else - with_lua=builtin + ac_cv_search_sin=no fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sin" >&5 +$as_echo "$ac_cv_search_sin" >&6; } +ac_res=$ac_cv_search_sin +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -else - with_lua=builtin fi -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 -$as_echo_n "checking for lua_newstate in -llua... " >&6; } -if ${ac_cv_lib_lua_lua_newstate+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if ${ac_cv_search_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua $LIBS" + ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4822,460 +4417,475 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char lua_newstate (); +char dlopen (); int main () { -return lua_newstate (); +return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua_lua_newstate=yes -else - ac_cv_lib_lua_lua_newstate=no +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 -$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } -if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : - with_lua=lua - Lua_CFLAGS='' - Lua_LIBS='-llua' -else - with_lua=builtin + conftest$ac_exeext + if ${ac_cv_search_dlopen+:} false; then : + break fi - +done +if ${ac_cv_search_dlopen+:} false; then : else - with_lua=builtin + ac_cv_search_dlopen=no fi - -else - Lua_CFLAGS=$pkg_cv_Lua_CFLAGS - Lua_LIBS=$pkg_cv_Lua_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - with_lua=lua5.1 +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS fi -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 -$as_echo_n "checking for Lua... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -if test -n "$Lua_CFLAGS"; then - pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags "lua5.1" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes fi - else - pkg_failed=untried + + objects="bin/lua.o $objects" + headers="luaconf.h lua.h lauxlib.h $headers" + CPPFLAGS_ADD="$CPPFLAGS_ADD -Ilua" + Lua_CFLAGS='' + Lua_LIBS='' + ac_cv_func_luaL_traceback=yes + if test "x$lmoddir" = 'x'; then : + lmoddir="\${datarootdir}/lua/$builtin_lua_version" fi -if test -n "$Lua_LIBS"; then - pkg_cv_Lua_LIBS="$Lua_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "lua5.1") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs "lua5.1" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes + if test "x$cmoddir" = 'x'; then : + cmoddir="\${libdir}/lua/$builtin_lua_version" fi - else - pkg_failed=untried fi +CPPFLAGS_ADD="$CPPFLAGS_ADD $Lua_CFLAGS" +LIBS="$Lua_LIBS $LIBS" +if test "x$lmoddir" = 'x'; then : + lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD $with_lua`" +fi +if test "x$cmoddir" = 'x'; then : + cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD $with_lua`" +fi - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no +if test "x$lmoddir" = 'x'; then : + as_fn_error $? "unable to deduce Lua module directory, please use --with-lmoddir=path" "$LINENO" 5 +fi +if test "x$cmoddir" = 'x'; then : + as_fn_error $? "unable to deduce Lua C module directory, please use --with-cmoddir=path" "$LINENO" 5 fi - if test $_pkg_short_errors_supported = yes; then - Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lua5.1" 2>&1` - else - Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lua5.1" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$Lua_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 -$as_echo_n "checking for lua_newstate in -llua... " >&6; } -if ${ac_cv_lib_lua_lua_newstate+:} false; then : +# Checks for header files. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#ifdef __STDC__ +# include +#else +# include #endif -char lua_newstate (); -int -main () -{ -return lua_newstate (); - ; - return 0; -} + Syntax error _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua_lua_newstate=yes +if ac_fn_c_try_cpp "$LINENO"; then : + else - ac_cv_lib_lua_lua_newstate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + # Broken: fails on valid input. +continue fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 -$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } -if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : - with_lua=lua - Lua_CFLAGS='' - Lua_LIBS='-llua' +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue else - with_lua=builtin + # Passes both tests. +ac_preproc_ok=: +break fi +rm -f conftest.err conftest.i conftest.$ac_ext - -else - with_lua=builtin +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break fi -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_newstate in -llua" >&5 -$as_echo_n "checking for lua_newstate in -llua... " >&6; } -if ${ac_cv_lib_lua_lua_newstate+:} false; then : - $as_echo_n "(cached) " >&6 + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#ifdef __STDC__ +# include +#else +# include #endif -char lua_newstate (); -int -main () -{ -return lua_newstate (); - ; - return 0; -} + Syntax error _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua_lua_newstate=yes +if ac_fn_c_try_cpp "$LINENO"; then : + else - ac_cv_lib_lua_lua_newstate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + # Broken: fails on valid input. +continue fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_lua_newstate" >&5 -$as_echo "$ac_cv_lib_lua_lua_newstate" >&6; } -if test "x$ac_cv_lib_lua_lua_newstate" = xyes; then : - ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default" -if test "x$ac_cv_header_lua_h" = xyes; then : - with_lua=lua - Lua_CFLAGS='' - Lua_LIBS='-llua' +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue else - with_lua=builtin + # Passes both tests. +ac_preproc_ok=: +break fi +rm -f conftest.err conftest.i conftest.$ac_ext +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : else - with_lua=builtin + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi -else - Lua_CFLAGS=$pkg_cv_Lua_CFLAGS - Lua_LIBS=$pkg_cv_Lua_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - with_lua=lua5.1 -fi -else - Lua_CFLAGS=$pkg_cv_Lua_CFLAGS - Lua_LIBS=$pkg_cv_Lua_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - with_lua=lua5.2 -fi -else - Lua_CFLAGS=$pkg_cv_Lua_CFLAGS - Lua_LIBS=$pkg_cv_Lua_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - with_lua=lua -fi ;; #( - *) : +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Lua" >&5 -$as_echo_n "checking for Lua... " >&6; } -if test -n "$Lua_CFLAGS"; then - pkg_cv_Lua_CFLAGS="$Lua_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\"\$with_lua\"\""; } >&5 - ($PKG_CONFIG --exists --print-errors ""$with_lua"") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_Lua_CFLAGS=`$PKG_CONFIG --cflags ""$with_lua"" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$Lua_LIBS"; then - pkg_cv_Lua_LIBS="$Lua_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\"\$with_lua\"\""; } >&5 - ($PKG_CONFIG --exists --print-errors ""$with_lua"") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_Lua_LIBS=`$PKG_CONFIG --libs ""$with_lua"" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - pkg_failed=yes -fi - else - pkg_failed=untried + ac_cv_path_GREP=$GREP fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - _pkg_short_errors_supported=no + ac_cv_path_EGREP=$EGREP fi - if test $_pkg_short_errors_supported = yes; then - Lua_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs ""$with_lua"" 2>&1` - else - Lua_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs ""$with_lua"" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$Lua_PKG_ERRORS" >&5 - as_fn_error $? "\"pkg-config package '$with_lua' not found\"" "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "\"pkg-config package '$with_lua' not found\"" "$LINENO" 5 -else - Lua_CFLAGS=$pkg_cv_Lua_CFLAGS - Lua_LIBS=$pkg_cv_Lua_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" -fi ;; -esac -if test "x$with_lua" = 'xbuiltin'; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sin" >&5 -$as_echo_n "checking for library containing sin... " >&6; } -if ${ac_cv_search_sin+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#include +#include +#include -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sin (); int main () { -return sin (); + ; return 0; } _ACEOF -for ac_lib in '' m; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_sin=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_sin+:} false; then : - break +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no fi -done -if ${ac_cv_search_sin+:} false; then : +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : else - ac_cv_search_sin=no + ac_cv_header_stdc=no fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +rm -f conftest* + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sin" >&5 -$as_echo "$ac_cv_search_sin" >&6; } -ac_res=$ac_cv_search_sin -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no fi +rm -f conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if ${ac_cv_search_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif -char dlopen (); + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { -return dlopen (); - ; + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; return 0; } _ACEOF -for ac_lib in '' dl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_dlopen=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_dlopen+:} false; then : - break -fi -done -if ${ac_cv_search_dlopen+:} false; then : +if ac_fn_c_try_run "$LINENO"; then : else - ac_cv_search_dlopen=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS + ac_cv_header_stdc=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - objects="bin/lua.o $objects" - headers="luaconf.h lua.h lauxlib.h $headers" - CPPFLAGS_ADD="$CPPFLAGS_ADD -Ilua" - Lua_CFLAGS='' - Lua_LIBS='' - ac_cv_func_luaL_traceback=yes - if test "x$lmoddir" = 'x'; then : - lmoddir="\${datarootdir}/lua/$builtin_lua_version" -fi - if test "x$cmoddir" = 'x'; then : - cmoddir="\${libdir}/lua/$builtin_lua_version" fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then -CPPFLAGS_ADD="$CPPFLAGS_ADD $Lua_CFLAGS" -LIBS="$Lua_LIBS $LIBS" -if test "x$lmoddir" = 'x'; then : - lmoddir="`$PKG_CONFIG --variable=INSTALL_LMOD $with_lua`" -fi -if test "x$cmoddir" = 'x'; then : - cmoddir="`$PKG_CONFIG --variable=INSTALL_CMOD $with_lua`" -fi +$as_echo "#define STDC_HEADERS 1" >>confdefs.h -if test "x$lmoddir" = 'x'; then : - as_fn_error $? "unable to deduce Lua module directory, please use --with-lmoddir=path" "$LINENO" 5 -fi -if test "x$cmoddir" = 'x'; then : - as_fn_error $? "unable to deduce Lua C module directory, please use --with-cmoddir=path" "$LINENO" 5 fi -ac_fn_c_check_func "$LINENO" "luaL_traceback" "ac_cv_func_luaL_traceback" -if test "x$ac_cv_func_luaL_traceback" = xyes; then : - CPPFLAGS_ADD="$CPPFLAGS_ADD -DHAVE_TRACEBACK" +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi +done + -# Checks for header files. for ac_header in stddef.h stdlib.h string.h unistd.h sys/time.h time.h pthread.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` diff --git a/configure.ac b/configure.ac index d0562f5..2b6ed69 100644 --- a/configure.ac +++ b/configure.ac @@ -60,16 +60,13 @@ AS_CASE(["x$with_lua"], [xbuiltin], [], [xcheck], - [PKG_CHECK_MODULES([Lua], [lua], [with_lua=lua], [PKG_CHECK_MODULES([Lua], [lua5.2], [with_lua=lua5.2], - [PKG_CHECK_MODULES([Lua], [lua5.1], [with_lua=lua5.1], - [AC_CHECK_LIB([lua], [lua_newstate], - [AC_CHECK_HEADER([lua.h], - [with_lua=lua] - [Lua_CFLAGS=''] - [Lua_LIBS='-llua'], - [with_lua=builtin])], - [with_lua=builtin])])])])], + [PKG_CHECK_MODULES([Lua], [lua52], [with_lua=lua52], + [PKG_CHECK_MODULES([Lua], [lua], + [AS_IF([test "x$($PKG_CONFIG --variable=V lua)" = 'x5.2'], + [with_lua=lua], + [with_lua=builtin])], + [with_lua=builtin])])])], [PKG_CHECK_MODULES([Lua], ["$with_lua"], [], [AC_MSG_ERROR(["pkg-config package '$with_lua' not found"])])]) @@ -95,8 +92,6 @@ AS_IF([test "x$lmoddir" = 'x'], AS_IF([test "x$cmoddir" = 'x'], [AC_MSG_ERROR([unable to deduce Lua C module directory, please use --with-cmoddir=path])]) -AC_CHECK_FUNC([luaL_traceback], [CPPFLAGS_ADD="$CPPFLAGS_ADD -DHAVE_TRACEBACK"]) - # Checks for header files. AC_CHECK_HEADERS([stddef.h stdlib.h string.h unistd.h sys/time.h time.h pthread.h]) AC_CHECK_HEADERS([sys/eventfd.h sys/epoll.h sys/event.h]) diff --git a/lem/repl.lua b/lem/repl.lua index c913f7a..7366cca 100644 --- a/lem/repl.lua +++ b/lem/repl.lua @@ -17,9 +17,6 @@ -- local load = load -if _VERSION == 'Lua 5.1' then - load = loadstring -end local format = string.format local concat = table.concat -- cgit v1.2.1