Index: configure =================================================================== --- configure (revision 201526) +++ configure (working copy) @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 182946 . +# From configure.ac Revision: 183249 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for asterisk 1.6. # @@ -805,6 +805,10 @@ LUA_INCLUDE LUA_DIR PBX_LUA +LUA51_LIB +LUA51_INCLUDE +LUA51_DIR +PBX_LUA51 MISDN_LIB MISDN_INCLUDE MISDN_DIR @@ -1616,6 +1620,7 @@ --with-ldap=PATH use OpenLDAP files in PATH --with-ltdl=PATH use libtool files in PATH --with-lua=PATH use Lua files in PATH + --with-=PATH use Lua 5.1 files in PATH --with-misdn=PATH use mISDN User Library files in PATH --with-nbs=PATH use Network Broadcast Sound files in PATH --with-ncurses=PATH use ncurses files in PATH @@ -8558,6 +8563,34 @@ + LUA51_DESCRIP="Lua 5.1" + LUA51_OPTION="" + +# Check whether --with- was given. +if test "${with_+set}" = set; then + withval=$with_; + case ${withval} in + n|no) + USE_LUA51=no + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} LUA51" + ;; + *) + LUA51_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} LUA51" + ;; + esac + +fi + + PBX_LUA51=0 + + + + + + MISDN_DESCRIP="mISDN User Library" MISDN_OPTION="misdn" @@ -42679,19 +42712,19 @@ fi -if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then +if test "x${PBX_LUA51}" != "x1" -a "${USE_LUA51}" != "no"; then pbxlibdir="" - # if --with-LUA=DIR has been specified, use it. - if test "x${LUA_DIR}" != "x"; then - if test -d ${LUA_DIR}/lib; then - pbxlibdir="-L${LUA_DIR}/lib" + # if --with-LUA51=DIR has been specified, use it. + if test "x${LUA51_DIR}" != "x"; then + if test -d ${LUA51_DIR}/lib; then + pbxlibdir="-L${LUA51_DIR}/lib" else - pbxlibdir="-L${LUA_DIR}" + pbxlibdir="-L${LUA51_DIR}" fi fi pbxfuncname="luaL_newstate" if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers - AST_LUA_FOUND=yes + AST_LUA51_FOUND=yes else as_ac_Lib=`echo "ac_cv_lib_lua5.1_${pbxfuncname}" | $as_tr_sh` { echo "$as_me:$LINENO: checking for ${pbxfuncname} in -llua5.1" >&5 @@ -42700,7 +42733,7 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-llua5.1 ${pbxlibdir} $LIBS" +LIBS="-llua5.1 ${pbxlibdir} -lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -42757,26 +42790,26 @@ { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Lib'}'` = yes; then - AST_LUA_FOUND=yes + AST_LUA51_FOUND=yes else - AST_LUA_FOUND=no + AST_LUA51_FOUND=no fi fi # now check for the header. - if test "${AST_LUA_FOUND}" = "yes"; then - LUA_LIB="${pbxlibdir} -llua5.1 " - # if --with-LUA=DIR has been specified, use it. - if test "x${LUA_DIR}" != "x"; then - LUA_INCLUDE="-I${LUA_DIR}/include" + if test "${AST_LUA51_FOUND}" = "yes"; then + LUA51_LIB="${pbxlibdir} -llua5.1 -lm" + # if --with-LUA51=DIR has been specified, use it. + if test "x${LUA51_DIR}" != "x"; then + LUA51_INCLUDE="-I${LUA51_DIR}/include" fi - LUA_INCLUDE="${LUA_INCLUDE} " + LUA51_INCLUDE="${LUA51_INCLUDE} " if test "xlua5.1/lua.h" = "x" ; then # no header, assume found - LUA_HEADER_FOUND="1" + LUA51_HEADER_FOUND="1" else # check for the header saved_cppflags="${CPPFLAGS}" - CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" + CPPFLAGS="${CPPFLAGS} ${LUA51_INCLUDE}" if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then { echo "$as_me:$LINENO: checking for lua5.1/lua.h" >&5 echo $ECHO_N "checking for lua5.1/lua.h... $ECHO_C" >&6; } @@ -42908,6 +42941,268 @@ fi if test $ac_cv_header_lua5_1_lua_h = yes; then + LUA51_HEADER_FOUND=1 +else + LUA51_HEADER_FOUND=0 +fi + + + CPPFLAGS="${saved_cppflags}" + fi + if test "x${LUA51_HEADER_FOUND}" = "x0" ; then + LUA51_LIB="" + LUA51_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + LUA51_LIB="" + fi + PBX_LUA51=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED + +cat >>confdefs.h <<_ACEOF +#define HAVE_LUA51 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_LUA51_VERSION +_ACEOF + + fi + fi +fi + +# Some distributions (like SuSE) remove the 5.1 suffix. + +if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then + pbxlibdir="" + # if --with-LUA=DIR has been specified, use it. + if test "x${LUA_DIR}" != "x"; then + if test -d ${LUA_DIR}/lib; then + pbxlibdir="-L${LUA_DIR}/lib" + else + pbxlibdir="-L${LUA_DIR}" + fi + fi + pbxfuncname="luaL_register" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_LUA_FOUND=yes + else + as_ac_Lib=`echo "ac_cv_lib_lua_${pbxfuncname}" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -llua" >&5 +echo $ECHO_N "checking for ${pbxfuncname} in -llua... $ECHO_C" >&6; } +if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-llua ${pbxlibdir} -lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 ${pbxfuncname} (); +int +main () +{ +return ${pbxfuncname} (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Lib=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +ac_res=`eval echo '${'$as_ac_Lib'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + AST_LUA_FOUND=yes +else + AST_LUA_FOUND=no +fi + + fi + + # now check for the header. + if test "${AST_LUA_FOUND}" = "yes"; then + LUA_LIB="${pbxlibdir} -llua -lm" + # if --with-LUA=DIR has been specified, use it. + if test "x${LUA_DIR}" != "x"; then + LUA_INCLUDE="-I${LUA_DIR}/include" + fi + LUA_INCLUDE="${LUA_INCLUDE} " + if test "xlua.h" = "x" ; then # no header, assume found + LUA_HEADER_FOUND="1" + else # check for the header + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}" + if test "${ac_cv_header_lua_h+set}" = set; then + { echo "$as_me:$LINENO: checking for lua.h" >&5 +echo $ECHO_N "checking for lua.h... $ECHO_C" >&6; } +if test "${ac_cv_header_lua_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_lua_h" >&5 +echo "${ECHO_T}$ac_cv_header_lua_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking lua.h usability" >&5 +echo $ECHO_N "checking lua.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking lua.h presence" >&5 +echo $ECHO_N "checking lua.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: lua.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: lua.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: lua.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: lua.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: lua.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: lua.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: lua.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: lua.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: lua.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: lua.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: lua.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: lua.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: lua.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: lua.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: lua.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: lua.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------- ## +## Report this to www.asterisk.org ## +## ------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for lua.h" >&5 +echo $ECHO_N "checking for lua.h... $ECHO_C" >&6; } +if test "${ac_cv_header_lua_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_lua_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_lua_h" >&5 +echo "${ECHO_T}$ac_cv_header_lua_h" >&6; } + +fi +if test $ac_cv_header_lua_h = yes; then LUA_HEADER_FOUND=1 else LUA_HEADER_FOUND=0 @@ -42939,6 +43234,17 @@ fi fi +if test "x${PBX_LUA51}" = "x1" -a "x${PBX_LUA}" != "x1"; then + PBX_LUA=1 + AST_LUA_FOUND=yes + LUA_LIB=${LUA51_LIB} + LUA_INCLUDE=${LUA51_INCLUDE} + LUA_HEADER_FOUND="1" + cat >>confdefs.h <<_ACEOF +#define HAVE_LUA 1 +#define HAVE_LUA_VERSION +_ACEOF +fi if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then @@ -51134,14 +51440,14 @@ LUA_INCLUDE!$LUA_INCLUDE$ac_delim LUA_DIR!$LUA_DIR$ac_delim PBX_LUA!$PBX_LUA$ac_delim +LUA51_LIB!$LUA51_LIB$ac_delim +LUA51_INCLUDE!$LUA51_INCLUDE$ac_delim +LUA51_DIR!$LUA51_DIR$ac_delim +PBX_LUA51!$PBX_LUA51$ac_delim MISDN_LIB!$MISDN_LIB$ac_delim MISDN_INCLUDE!$MISDN_INCLUDE$ac_delim MISDN_DIR!$MISDN_DIR$ac_delim PBX_MISDN!$PBX_MISDN$ac_delim -NBS_LIB!$NBS_LIB$ac_delim -NBS_INCLUDE!$NBS_INCLUDE$ac_delim -NBS_DIR!$NBS_DIR$ac_delim -PBX_NBS!$PBX_NBS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -51183,6 +51489,10 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +NBS_LIB!$NBS_LIB$ac_delim +NBS_INCLUDE!$NBS_INCLUDE$ac_delim +NBS_DIR!$NBS_DIR$ac_delim +PBX_NBS!$PBX_NBS$ac_delim NCURSES_LIB!$NCURSES_LIB$ac_delim NCURSES_INCLUDE!$NCURSES_INCLUDE$ac_delim NCURSES_DIR!$NCURSES_DIR$ac_delim @@ -51276,10 +51586,6 @@ SPEEXDSP_DIR!$SPEEXDSP_DIR$ac_delim PBX_SPEEXDSP!$PBX_SPEEXDSP$ac_delim SQLITE_LIB!$SQLITE_LIB$ac_delim -SQLITE_INCLUDE!$SQLITE_INCLUDE$ac_delim -SQLITE_DIR!$SQLITE_DIR$ac_delim -PBX_SQLITE!$PBX_SQLITE$ac_delim -SQLITE3_LIB!$SQLITE3_LIB$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -51321,6 +51627,10 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +SQLITE_INCLUDE!$SQLITE_INCLUDE$ac_delim +SQLITE_DIR!$SQLITE_DIR$ac_delim +PBX_SQLITE!$PBX_SQLITE$ac_delim +SQLITE3_LIB!$SQLITE3_LIB$ac_delim SQLITE3_INCLUDE!$SQLITE3_INCLUDE$ac_delim SQLITE3_DIR!$SQLITE3_DIR$ac_delim PBX_SQLITE3!$PBX_SQLITE3$ac_delim @@ -51411,7 +51721,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 88; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 92; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Index: pbx/pbx_lua.c =================================================================== --- pbx/pbx_lua.c (revision 201526) +++ pbx/pbx_lua.c (working copy) @@ -42,9 +42,15 @@ #include "asterisk/paths.h" #include "asterisk/hashtab.h" +#ifdef HAVE_LUA51 #include #include #include +#else +#include +#include +#include +#endif static char *config = "extensions.lua"; static char *registrar = "pbx_lua"; Index: configure.ac =================================================================== --- configure.ac (revision 201526) +++ configure.ac (working copy) @@ -234,6 +234,7 @@ AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap]) AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl]) AST_EXT_LIB_SETUP([LUA], [Lua], [lua]) +AST_EXT_LIB_SETUP([LUA51], [Lua 5.1]) AST_EXT_LIB_SETUP([MISDN], [mISDN User Library], [misdn]) AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs]) AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses]) @@ -1408,7 +1409,20 @@ [${PWLIB_INCLUDE}], [${PWLIB_LIB}]) fi -AST_EXT_LIB_CHECK([LUA], [lua5.1], [luaL_newstate], [lua5.1/lua.h]) +AST_EXT_LIB_CHECK([LUA51], [lua5.1], [luaL_newstate], [lua5.1/lua.h], [-lm]) +# Some distributions (like SuSE) remove the 5.1 suffix. +AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm]) +if test "x${PBX_LUA51}" = "x1" -a "x${PBX_LUA}" != "x1"; then + PBX_LUA=1 + AST_LUA_FOUND=yes + LUA_LIB=${LUA51_LIB} + LUA_INCLUDE=${LUA51_INCLUDE} + LUA_HEADER_FOUND="1" + cat >>confdefs.h <<_ACEOF +#define HAVE_LUA 1 +#define HAVE_LUA_VERSION +_ACEOF +fi AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h]) Index: include/asterisk/autoconfig.h.in =================================================================== --- include/asterisk/autoconfig.h.in (revision 201526) +++ include/asterisk/autoconfig.h.in (working copy) @@ -470,6 +470,12 @@ /* Define this to indicate the ${LUA_DESCRIP} library */ #undef HAVE_LUA +/* Define this to indicate the ${LUA51_DESCRIP} library */ +#undef HAVE_LUA51 + +/* Define to indicate the ${LUA51_DESCRIP} library version */ +#undef HAVE_LUA51_VERSION + /* Define to indicate the ${LUA_DESCRIP} library version */ #undef HAVE_LUA_VERSION