Hi,
I think depending on the OS (Linux vs BSD vs OS X vs ...) you really want to
check for
different variations of the Lua installation with pkg-config, e.g.:
“lua5.2" vs "lua-5.2" vs just “lua” or even “luajit"
Also, I do not think that checking luajit first makes sense, as it might have
the best
performance, but ist not the most widespread!?
So I suggest Instead of your:
for i in luajit lua lua5.2 lua5.1; do
do something like:
for i in lua lua5.2 lua-5.2 lua5.1 lua-5.1 luajit; do
This already looks a bit messy to me, so for future versions you may
also want to separate the version into an own variable, something like:
LUA_V=5.2
[...]
for i in lua lua${LUA_V} lua-${LUA_V} luajit; do
Thanks,
Regards,
Jörg
> On 28 May 2015, at 16:44, Jason A. Donenfeld <[email protected]> wrote:
>
> ---
> configure.ac | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 72 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index a1755c3..13c71df 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1923,6 +1923,7 @@ AC_ARG_WITH([filter-lua],
> AC_DEFINE([HAVE_FILTER_LUA], [1],
> [Define if you have filter lua])
> HAVE_FILTER_LUA=yes
> + need_lua=yes
> fi
> ]
> )
> @@ -2299,6 +2300,24 @@ AC_ARG_WITH([perl],
> ]
> )
>
> +AC_ARG_WITH([lua],
> + [ --with-lua=PATH Specify prefix of lua installation ],
> + [
> + if test "x$withval" != "xno" ; then
> + lua_prefix="${withval}"
> + fi
> + ]
> +
> +)
> +AC_ARG_WITH([lua-type],
> + [ --with-lua-type=PATH Specify the type of lua used (automatic if
> unspecified, otherwise luajit, lua5.1, or lua5.2) ],
> + [
> + if test "x$withval" != "xno" ; then
> + lua_type="${withval}"
> + fi
> + ]
> +)
> +
> #
> # check for python
> #
> @@ -2357,6 +2376,53 @@ fi
> AC_SUBST([PERL_CPPFLAGS])
> AC_SUBST([PERL_LDFLAGS])
>
> +#
> +# check for lua
> +#
> +LUA_CPPFLAGS=
> +LUA_LDFLAGS=
> +if test x"${need_lua}" = x"yes"; then
> + LUA_CONFIG=
> + for path in /usr/local/bin /usr/bin; do
> + if test -f ${path}/pkg-config; then
> + LUA_CONFIG=${path}/pkg-config
> + break
> + fi
> + done
> +
> + # if lua provided --with-lua, override
> + if test x"${with_lua}" != x""; then
> + LUA_CONFIG="${lua_prefix}/bin/pkg-config"
> + fi
> +
> + if ! test -f $LUA_CONFIG; then
> + if test x"${lua_type}" = x""; then
> + for i in luajit lua lua5.2 lua5.1; do
> + if test -d ${lua_prefix:-/usr/local}/include/${i}*; then
> + lua_type=$i
> + break
> + fi
> + done
> + fi
> + LUA_CPPFLAGS="-I${lua_prefix:-/usr/local}/include/${lua_type}"
> + LUA_LDFLAGS="-L${lua_prefix:-/usr/local}/lib -l${lua_type} -lm"
> + else
> + if test x"${lua_type}" = x""; then
> + for i in luajit lua lua5.2 lua5.1; do
> + if $LUA_CONFIG --exists $i 2>/dev/null; then
> + lua_type=$i
> + break
> + fi
> + done
> + fi
> + LUA_CPPFLAGS="`$LUA_CONFIG --cflags $lua_type`"
> + LUA_LDFLAGS="`$LUA_CONFIG --libs $lua_type`"
> + fi
> +fi
> +AC_SUBST([LUA_CPPFLAGS])
> +AC_SUBST([LUA_LDFLAGS])
> +
> +
> ##chl (based on OpenSSL checks, see above)
> # Search for libevent
> saved_CPPFLAGS="$CPPFLAGS"
> @@ -2527,3 +2593,9 @@ echo " LDFLAGS: ${PERL_LDFLAGS}"
> echo ""
> fi
>
> +if test x"${need_lua}" = x"yes"; then
> +echo "Built with Lua support:"
> +echo " CPPFLAGS: ${LUA_CPPFLAGS}"
> +echo " LDFLAGS: ${LUA_LDFLAGS}"
> +echo ""
> +fi
> --
> 2.4.2
>
>
> --
> You received this mail because you are subscribed to [email protected]
> To unsubscribe, send a mail to: [email protected]
>
--
You received this mail because you are subscribed to [email protected]
To unsubscribe, send a mail to: [email protected]