diff --git a/ncat/Makefile.in b/ncat/Makefile.in index f8975f111..4632a78c8 100644 --- a/ncat/Makefile.in +++ b/ncat/Makefile.in @@ -60,7 +60,7 @@ STRIP = @STRIP@ OPENSSL_LIBS = @OPENSSL_LIBS@ HAVE_OPENSSL = @HAVE_OPENSSL@ PCAP_LIBS = @PCAP_LIBS@ -HAVE_LUA = @LIBLUA_LIBS@ +NOLUA = @NOLUA@ LIBLUADIR = @LIBLUADIR@ LUA_CFLAGS = @LUA_CFLAGS@ @@ -83,7 +83,7 @@ OBJS += http_digest.o DATAFILES = certs/ca-bundle.crt endif -ifneq ($(HAVE_LUA),) +ifneq ($(NOLUA),yes) LUA_SRCS = ncat_lua.c LUA_OBJS = ncat_lua.o LUA_LIBS = @LIBLUA_LIBS@ -lm diff --git a/ncat/config.h.in b/ncat/config.h.in index be72c67ab..76df805d3 100644 --- a/ncat/config.h.in +++ b/ncat/config.h.in @@ -154,3 +154,10 @@ /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc + +/* Defines for locating Lua */ +#undef LUA_INCLUDED +#undef HAVE_LUA5_3_LUA_H +#undef HAVE_LUA_5_3_LUA_H +#undef HAVE_LUA_H +#undef HAVE_LUA_LUA_H diff --git a/ncat/configure b/ncat/configure index 2ae20c54c..b6181baa4 100755 --- a/ncat/configure +++ b/ncat/configure @@ -627,9 +627,7 @@ LUA_BUILD LUA_DEPENDS LIBLUADIR LIBLUA_LIBS -ac_ct_CXX -CXXFLAGS -CXX +NOLUA LUA_CFLAGS PCAP_LIBS PCAP_DIST_CLEAN @@ -715,10 +713,7 @@ CFLAGS LDFLAGS LIBS CPPFLAGS -CPP -CXX -CXXFLAGS -CCC' +CPP' # Initialize some variables set by options. @@ -1358,8 +1353,6 @@ Some influential environment variables: CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1888,86 +1881,6 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_cxx_try_run LINENO -# ------------------------ -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_cxx_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_run cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -5200,7 +5113,10 @@ if test "${with_liblua+set}" = set; then : LUA_BUILD="build-lua" LUA_CLEAN="clean-lua" LUA_DIST_CLEAN="distclean-lua" - have_lua="yes" + have_lua="yes" + +$as_echo "#define LUA_INCLUDED 1" >>confdefs.h + ;; no) @@ -5221,6 +5137,7 @@ LUA_CFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" # They don't want lua if test "$no_lua" = "yes"; then CPPFLAGS="-DNOLUA $CPPFLAGS" + NOLUA="yes" LIBLUA_LIBS="" LUA_DEPENDS="" LUA_BUILD="" @@ -5240,405 +5157,92 @@ 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_isyieldable in -llua5.3" >&5 -$as_echo_n "checking for lua_isyieldable in -llua5.3... " >&6; } -if ${ac_cv_lib_lua5_3_lua_isyieldable+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua5.3 -lm $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_isyieldable (); -int -main () -{ -return lua_isyieldable (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua5_3_lua_isyieldable=yes -else - ac_cv_lib_lua5_3_lua_isyieldable=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_lua5_3_lua_isyieldable" >&5 -$as_echo "$ac_cv_lib_lua5_3_lua_isyieldable" >&6; } -if test "x$ac_cv_lib_lua5_3_lua_isyieldable" = xyes; then : - have_lua=yes; LIBLUA_LIBS="-llua5.3"; CPPFLAGS="-I/usr/include/lua5.3 $CPPFLAGS"; break -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_isyieldable in -llua53" >&5 -$as_echo_n "checking for lua_isyieldable in -llua53... " >&6; } -if ${ac_cv_lib_lua53_lua_isyieldable+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua53 -lm $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_isyieldable (); -int -main () -{ -return lua_isyieldable (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua53_lua_isyieldable=yes -else - ac_cv_lib_lua53_lua_isyieldable=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_lua53_lua_isyieldable" >&5 -$as_echo "$ac_cv_lib_lua53_lua_isyieldable" >&6; } -if test "x$ac_cv_lib_lua53_lua_isyieldable" = xyes; then : - have_lua=yes; LIBLUA_LIBS="-llua53"; CPPFLAGS="-I/usr/include/lua53 $CPPFLAGS"; break -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lua_isyieldable in -llua" >&5 -$as_echo_n "checking for lua_isyieldable in -llua... " >&6; } -if ${ac_cv_lib_lua_lua_isyieldable+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llua -lm $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_isyieldable (); -int -main () -{ -return lua_isyieldable (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lua_lua_isyieldable=yes -else - ac_cv_lib_lua_lua_isyieldable=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_isyieldable" >&5 -$as_echo "$ac_cv_lib_lua_lua_isyieldable" >&6; } -if test "x$ac_cv_lib_lua_lua_isyieldable" = xyes; then : - have_lua=yes; LIBLUA_LIBS="-llua"; CPPFLAGS="-I/usr/include/lua $CPPFLAGS"; break -fi - - + break fi done + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing lua_isyieldable" >&5 +$as_echo_n "checking for library containing lua_isyieldable... " >&6; } +if ${ac_cv_search_lua_isyieldable+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +/* 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_isyieldable (); +int +main () +{ +return lua_isyieldable (); + ; + return 0; +} +_ACEOF +for ac_lib in '' lua5.3 lua53 lua; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib -lm $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_lua_isyieldable=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_lua_isyieldable+:} false; then : + break +fi +done +if ${ac_cv_search_lua_isyieldable+:} false; then : + +else + ac_cv_search_lua_isyieldable=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_lua_isyieldable" >&5 +$as_echo "$ac_cv_search_lua_isyieldable" >&6; } +ac_res=$ac_cv_search_lua_isyieldable +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + have_lua=yes +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 lua version >= 503" >&5 $as_echo_n "checking for lua version >= 503... " >&6; } - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int -main () -{ -#ifndef __GNUC__ - choke me -#endif + #ifdef HAVE_LUA5_3_LUA_H + #include + #elif defined HAVE_LUA_5_3_LUA_H + #include + #elif defined HAVE_LUA_H || defined LUA_INCLUDED + #include + #elif defined HAVE_LUA_LUA_H + #include + #endif - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + #if (LUA_VERSION_NUM < 503) + #error Incorrect Lua version + #endif -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compiling -- assuming yes" >&5 -$as_echo "cross-compiling -- assuming yes" >&6; }; have_lua=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #include int main () { @@ -5647,15 +5251,12 @@ if(LUA_VERSION_NUM < 503) return 1; return 0; } _ACEOF -if ac_fn_cxx_try_run "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO"; then : have_lua=yes else have_lua=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - +rm -f conftest.err conftest.i conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5699,6 +5300,7 @@ fi + ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF diff --git a/ncat/configure.ac b/ncat/configure.ac index 6c4cc5f3d..8e2234cf0 100644 --- a/ncat/configure.ac +++ b/ncat/configure.ac @@ -227,7 +227,8 @@ AC_HELP_STRING([--without-liblua], [Compile without lua (this will exclude all o LUA_BUILD="build-lua" LUA_CLEAN="clean-lua" LUA_DIST_CLEAN="distclean-lua" - have_lua="yes" + have_lua="yes" + AC_DEFINE([LUA_INCLUDED], [1], [Using included liblua]) ;; no) @@ -246,6 +247,7 @@ AC_SUBST(LUA_CFLAGS) # They don't want lua if test "$no_lua" = "yes"; then CPPFLAGS="-DNOLUA $CPPFLAGS" + NOLUA="yes" LIBLUA_LIBS="" LUA_DEPENDS="" LUA_BUILD="" @@ -257,19 +259,29 @@ else # If they didn't specify it, we try to find it if test $have_lua != yes; then - AC_CHECK_HEADERS([lua5.3/lua.h lua/5.3/lua.h lua.h lua/lua.h], - AC_CHECK_LIB(lua5.3, lua_isyieldable, [have_lua=yes; LIBLUA_LIBS="-llua5.3"; CPPFLAGS="-I/usr/include/lua5.3 $CPPFLAGS"; break],, [-lm]) - AC_CHECK_LIB(lua53, lua_isyieldable, [have_lua=yes; LIBLUA_LIBS="-llua53"; CPPFLAGS="-I/usr/include/lua53 $CPPFLAGS"; break],, [-lm]) - AC_CHECK_LIB(lua, lua_isyieldable, [have_lua=yes; LIBLUA_LIBS="-llua"; CPPFLAGS="-I/usr/include/lua $CPPFLAGS"; break],, [-lm]) - ) - - AC_LANG_PUSH(C++) + AC_CHECK_HEADERS([lua5.3/lua.h lua/5.3/lua.h lua.h lua/lua.h], [break]) + AC_SEARCH_LIBS(lua_isyieldable, [lua5.3 lua53 lua], [have_lua=yes],, [-lm]) + AC_LANG_PUSH(C) AC_MSG_CHECKING([for lua version >= 503]) - AC_RUN_IFELSE([ AC_LANG_PROGRAM( - [[#include ]], + AC_PREPROC_IFELSE([ AC_LANG_PROGRAM( + [[ + #ifdef HAVE_LUA5_3_LUA_H + #include + #elif defined HAVE_LUA_5_3_LUA_H + #include + #elif defined HAVE_LUA_H || defined LUA_INCLUDED + #include + #elif defined HAVE_LUA_LUA_H + #include + #endif + + #if (LUA_VERSION_NUM < 503) + #error Incorrect Lua version + #endif + ]], [[if(LUA_VERSION_NUM < 503) return 1;]])], - have_lua=yes, have_lua=no, AC_MSG_RESULT(cross-compiling -- assuming yes); have_lua=yes) - AC_LANG_POP(C++) + [have_lua=yes], [have_lua=no]) + AC_LANG_POP(C) LUA_DEPENDS="" LUA_BUILD="" @@ -286,7 +298,7 @@ else LUA_BUILD="build-lua" LUA_CLEAN="clean-lua" LUA_DIST_CLEAN="distclean-lua" - AC_DEFINE([LUA_INCLUDED], [1], [Define to 1 if you have LUA]) + AC_DEFINE([LUA_INCLUDED], [1], [Using included liblua]) else AC_MSG_RESULT(yes) fi @@ -294,6 +306,7 @@ else INSTALLNSE="install-nse" fi +AC_SUBST(NOLUA) AC_SUBST(LIBLUA_LIBS) AC_SUBST(LIBLUADIR) AC_SUBST(LUA_DEPENDS) diff --git a/ncat/ncat_lua.h b/ncat/ncat_lua.h index f1622a597..8a9e5d07c 100644 --- a/ncat/ncat_lua.h +++ b/ncat/ncat_lua.h @@ -134,9 +134,23 @@ extern "C" { #endif -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" +#ifdef HAVE_LUA5_3_LUA_H + #include + #include + #include +#elif defined HAVE_LUA_5_3_LUA_H + #include + #include + #include +#elif defined HAVE_LUA_H || defined LUA_INCLUDED + #include + #include + #include +#elif defined HAVE_LUA_LUA_H + #include + #include + #include +#endif #ifdef __cplusplus }