Skip to content

Commit dea2adb

Browse files
committed
updated for version 7.4a.045
Problem: Configure does not always find the right library for Lua. Missing support for LuaJit. Solution: Improve the configure detection of Lua. (Hiroshi Shirosaki)
1 parent de295a6 commit dea2adb

4 files changed

Lines changed: 339 additions & 78 deletions

File tree

src/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,12 @@ CClink = $(CC)
381381
# LUA
382382
# Uncomment one of these when you want to include the Lua interface.
383383
# First one is for static linking, second one for dynamic loading.
384+
# Use --with-luajit if you want to use LuaJIT instead of Lua.
385+
# Set PATH environment variable to find lua or luajit executable.
384386
#CONF_OPT_LUA = --enable-luainterp
385387
#CONF_OPT_LUA = --enable-luainterp=dynamic
388+
#CONF_OPT_LUA = --enable-luainterp --with-luajit
389+
#CONF_OPT_LUA = --enable-luainterp=dynamic --with-luajit
386390
# Lua installation dir (when not set uses $LUA_PREFIX or defaults to /usr)
387391
#CONF_OPT_LUA_PREFIX = --with-lua-prefix=/usr/local
388392

src/auto/configure

Lines changed: 213 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ LUA_LIBS
674674
LUA_PRO
675675
LUA_OBJ
676676
LUA_SRC
677+
vi_cv_path_plain_lua
678+
vi_cv_path_luajit
677679
vi_cv_path_lua
678680
compiledby
679681
dogvimdiff
@@ -758,6 +760,7 @@ enable_xsmp
758760
enable_xsmp_interact
759761
enable_luainterp
760762
with_lua_prefix
763+
with_luajit
761764
enable_mzschemeinterp
762765
with_plthome
763766
enable_perlinterp
@@ -1469,6 +1472,7 @@ Optional Packages:
14691472
--with-features=TYPE tiny, small, normal, big or huge (default: normal)
14701473
--with-compiledby=NAME name to show in :version message
14711474
--with-lua-prefix=PFX Prefix where Lua is installed.
1475+
--with-luajit Link with LuaJIT instead of Lua.
14721476
--with-plthome=PLTHOME Use PLTHOME.
14731477
--with-python-config-dir=PATH Python's config directory
14741478
--with-python3-config-dir=PATH Python's config directory
@@ -4646,18 +4650,95 @@ $as_echo "not set, default to /usr" >&6; }
46464650
fi
46474651
fi
46484652

4653+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-luajit" >&5
4654+
$as_echo_n "checking --with-luajit... " >&6; }
4655+
4656+
# Check whether --with-luajit was given.
4657+
if test "${with_luajit+set}" = set; then :
4658+
withval=$with_luajit; vi_cv_with_luajit="$withval"
4659+
else
4660+
vi_cv_with_luajit="no"
4661+
fi
4662+
4663+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_with_luajit" >&5
4664+
$as_echo "$vi_cv_with_luajit" >&6; }
4665+
46494666
LUA_INC=
46504667
if test "X$vi_cv_path_lua_pfx" != "X"; then
4651-
# Extract the first word of "lua", so it can be a program name with args.
4668+
if test "x$vi_cv_with_luajit" != "xno"; then
4669+
# Extract the first word of "luajit", so it can be a program name with args.
4670+
set dummy luajit; ac_word=$2
4671+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4672+
$as_echo_n "checking for $ac_word... " >&6; }
4673+
if test "${ac_cv_path_vi_cv_path_luajit+set}" = set; then :
4674+
$as_echo_n "(cached) " >&6
4675+
else
4676+
case $vi_cv_path_luajit in
4677+
[\\/]* | ?:[\\/]*)
4678+
ac_cv_path_vi_cv_path_luajit="$vi_cv_path_luajit" # Let the user override the test with a path.
4679+
;;
4680+
*)
4681+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4682+
for as_dir in $PATH
4683+
do
4684+
IFS=$as_save_IFS
4685+
test -z "$as_dir" && as_dir=.
4686+
for ac_exec_ext in '' $ac_executable_extensions; do
4687+
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4688+
ac_cv_path_vi_cv_path_luajit="$as_dir/$ac_word$ac_exec_ext"
4689+
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
4690+
break 2
4691+
fi
4692+
done
4693+
done
4694+
IFS=$as_save_IFS
4695+
4696+
;;
4697+
esac
4698+
fi
4699+
vi_cv_path_luajit=$ac_cv_path_vi_cv_path_luajit
4700+
if test -n "$vi_cv_path_luajit"; then
4701+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_luajit" >&5
4702+
$as_echo "$vi_cv_path_luajit" >&6; }
4703+
else
4704+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4705+
$as_echo "no" >&6; }
4706+
fi
4707+
4708+
4709+
if test "X$vi_cv_path_luajit" != "X"; then
4710+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LuaJIT version" >&5
4711+
$as_echo_n "checking LuaJIT version... " >&6; }
4712+
if test "${vi_cv_version_luajit+set}" = set; then :
4713+
$as_echo_n "(cached) " >&6
4714+
else
4715+
vi_cv_version_luajit=`${vi_cv_path_luajit} -v | sed 's/LuaJIT \([0-9.]*\)\.[0-9] .*/\1/'`
4716+
fi
4717+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_version_luajit" >&5
4718+
$as_echo "$vi_cv_version_luajit" >&6; }
4719+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Lua version of LuaJIT" >&5
4720+
$as_echo_n "checking Lua version of LuaJIT... " >&6; }
4721+
if test "${vi_cv_version_lua_luajit+set}" = set; then :
4722+
$as_echo_n "(cached) " >&6
4723+
else
4724+
vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'`
4725+
fi
4726+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_version_lua_luajit" >&5
4727+
$as_echo "$vi_cv_version_lua_luajit" >&6; }
4728+
vi_cv_path_lua="$vi_cv_path_luajit"
4729+
vi_cv_version_lua="$vi_cv_version_lua_luajit"
4730+
fi
4731+
else
4732+
# Extract the first word of "lua", so it can be a program name with args.
46524733
set dummy lua; ac_word=$2
46534734
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
46544735
$as_echo_n "checking for $ac_word... " >&6; }
4655-
if test "${ac_cv_path_vi_cv_path_lua+set}" = set; then :
4736+
if test "${ac_cv_path_vi_cv_path_plain_lua+set}" = set; then :
46564737
$as_echo_n "(cached) " >&6
46574738
else
4658-
case $vi_cv_path_lua in
4739+
case $vi_cv_path_plain_lua in
46594740
[\\/]* | ?:[\\/]*)
4660-
ac_cv_path_vi_cv_path_lua="$vi_cv_path_lua" # Let the user override the test with a path.
4741+
ac_cv_path_vi_cv_path_plain_lua="$vi_cv_path_plain_lua" # Let the user override the test with a path.
46614742
;;
46624743
*)
46634744
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -4667,7 +4748,7 @@ do
46674748
test -z "$as_dir" && as_dir=.
46684749
for ac_exec_ext in '' $ac_executable_extensions; do
46694750
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
4670-
ac_cv_path_vi_cv_path_lua="$as_dir/$ac_word$ac_exec_ext"
4751+
ac_cv_path_vi_cv_path_plain_lua="$as_dir/$ac_word$ac_exec_ext"
46714752
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
46724753
break 2
46734754
fi
@@ -4678,91 +4759,179 @@ IFS=$as_save_IFS
46784759
;;
46794760
esac
46804761
fi
4681-
vi_cv_path_lua=$ac_cv_path_vi_cv_path_lua
4682-
if test -n "$vi_cv_path_lua"; then
4683-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_lua" >&5
4684-
$as_echo "$vi_cv_path_lua" >&6; }
4762+
vi_cv_path_plain_lua=$ac_cv_path_vi_cv_path_plain_lua
4763+
if test -n "$vi_cv_path_plain_lua"; then
4764+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_plain_lua" >&5
4765+
$as_echo "$vi_cv_path_plain_lua" >&6; }
46854766
else
46864767
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
46874768
$as_echo "no" >&6; }
46884769
fi
46894770

46904771

4691-
if test "X$vi_cv_path_lua" != "X"; then
4692-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Lua version" >&5
4772+
if test "X$vi_cv_path_plain_lua" != "X"; then
4773+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Lua version" >&5
46934774
$as_echo_n "checking Lua version... " >&6; }
4694-
if test "${vi_cv_version_lua+set}" = set; then :
4775+
if test "${vi_cv_version_plain_lua+set}" = set; then :
46954776
$as_echo_n "(cached) " >&6
46964777
else
4697-
vi_cv_version_lua=`${vi_cv_path_lua} -e "print(_VERSION)" | sed 's/.* //'`
4778+
vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'`
46984779
fi
4699-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_version_lua" >&5
4700-
$as_echo "$vi_cv_version_lua" >&6; }
4780+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_version_plain_lua" >&5
4781+
$as_echo "$vi_cv_version_plain_lua" >&6; }
4782+
fi
4783+
vi_cv_path_lua="$vi_cv_path_plain_lua"
4784+
vi_cv_version_lua="$vi_cv_version_plain_lua"
47014785
fi
4702-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include" >&5
4786+
if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then
4787+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit" >&5
4788+
$as_echo_n "checking if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit... " >&6; }
4789+
if test -f $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h; then
4790+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4791+
$as_echo "yes" >&6; }
4792+
LUA_INC=/luajit-$vi_cv_version_luajit
4793+
fi
4794+
fi
4795+
if test "X$LUA_INC" = "X"; then
4796+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include" >&5
47034797
$as_echo_n "checking if lua.h can be found in $vi_cv_path_lua_pfx/include... " >&6; }
4704-
if test -f $vi_cv_path_lua_pfx/include/lua.h; then
4705-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4798+
if test -f $vi_cv_path_lua_pfx/include/lua.h; then
4799+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
47064800
$as_echo "yes" >&6; }
4707-
else
4708-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4801+
else
4802+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
47094803
$as_echo "no" >&6; }
4710-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua" >&5
4804+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua" >&5
47114805
$as_echo_n "checking if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua... " >&6; }
4712-
if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then
4713-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4806+
if test -f $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h; then
4807+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
47144808
$as_echo "yes" >&6; }
4715-
LUA_INC=/lua$vi_cv_version_lua
4716-
else
4717-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4809+
LUA_INC=/lua$vi_cv_version_lua
4810+
else
4811+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
47184812
$as_echo "no" >&6; }
4719-
vi_cv_path_lua_pfx=
4813+
vi_cv_path_lua_pfx=
4814+
fi
47204815
fi
47214816
fi
47224817
fi
47234818

47244819
if test "X$vi_cv_path_lua_pfx" != "X"; then
4725-
if test "X$LUA_INC" != "X"; then
4726-
LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
4820+
if test "x$vi_cv_with_luajit" != "xno"; then
4821+
multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
4822+
if test "X$multiarch" != "X"; then
4823+
lib_multiarch="lib/${multiarch}"
4824+
else
4825+
lib_multiarch="lib"
4826+
fi
4827+
if test "X$vi_cv_version_lua" = "X"; then
4828+
LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit"
4829+
else
4830+
LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua"
4831+
fi
47274832
else
4728-
LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
4833+
if test "X$LUA_INC" != "X"; then
4834+
LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
4835+
else
4836+
LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
4837+
fi
47294838
fi
4730-
LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
4731-
LUA_SRC="if_lua.c"
4732-
LUA_OBJ="objects/if_lua.o"
4733-
LUA_PRO="if_lua.pro"
4734-
$as_echo "#define FEAT_LUA 1" >>confdefs.h
4839+
if test "$enable_luainterp" = "dynamic"; then
4840+
lua_ok="yes"
4841+
else
4842+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if link with ${LUA_LIBS} is sane" >&5
4843+
$as_echo_n "checking if link with ${LUA_LIBS} is sane... " >&6; }
4844+
libs_save=$LIBS
4845+
LIBS="$LIBS $LUA_LIBS"
4846+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4847+
/* end confdefs.h. */
4848+
4849+
int
4850+
main ()
4851+
{
47354852
4853+
;
4854+
return 0;
4855+
}
4856+
_ACEOF
4857+
if ac_fn_c_try_link "$LINENO"; then :
4858+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4859+
$as_echo "yes" >&6; }; lua_ok="yes"
4860+
else
4861+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4862+
$as_echo "no" >&6; }; lua_ok="no"; LUA_LIBS=""
4863+
fi
4864+
rm -f core conftest.err conftest.$ac_objext \
4865+
conftest$ac_exeext conftest.$ac_ext
4866+
LIBS=$libs_save
4867+
fi
4868+
if test "x$lua_ok" = "xyes"; then
4869+
LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
4870+
LUA_SRC="if_lua.c"
4871+
LUA_OBJ="objects/if_lua.o"
4872+
LUA_PRO="if_lua.pro"
4873+
$as_echo "#define FEAT_LUA 1" >>confdefs.h
4874+
4875+
fi
47364876
if test "$enable_luainterp" = "dynamic"; then
4877+
if test "x$vi_cv_with_luajit" != "xno"; then
4878+
luajit="jit"
4879+
fi
47374880
if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
47384881
vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
47394882
else
4740-
multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
4741-
if test "X$multiarch" != "X"; then
4742-
lib_multiarch="lib/${multiarch}"
4883+
if test "x$MACOSX" = "xyes"; then
4884+
ext="dylib"
4885+
indexes=""
4886+
else
4887+
ext="so"
4888+
indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9"
4889+
multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
4890+
if test "X$multiarch" != "X"; then
4891+
lib_multiarch="lib/${multiarch}"
4892+
fi
47434893
fi
4744-
for subdir in "${lib_multiarch}" lib64 lib; do
4894+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx" >&5
4895+
$as_echo_n "checking if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx... " >&6; }
4896+
for subdir in "${lib_multiarch}" lib64 lib; do
47454897
if test -z "$subdir"; then
47464898
continue
47474899
fi
4748-
for sover in "${vi_cv_version_lua}.so" "-${vi_cv_version_lua}.so" ".so.${vi_cv_version_lua}"; do
4749-
for i in .0 .1 .2 .3 .4 .5 .6 .7 .8 .9 ""; do
4750-
if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${sover}$i"; then
4900+
for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \
4901+
".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do
4902+
for i in $indexes ""; do
4903+
if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then
47514904
sover2="$i"
47524905
break 3
47534906
fi
47544907
done
47554908
done
4909+
sover=""
47564910
done
4757-
vi_cv_dll_name_lua="liblua${sover}$sover2"
4911+
if test "X$sover" = "X"; then
4912+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4913+
$as_echo "no" >&6; }
4914+
lua_ok="no"
4915+
vi_cv_dll_name_lua="liblua${luajit}.${ext}"
4916+
else
4917+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4918+
$as_echo "yes" >&6; }
4919+
lua_ok="yes"
4920+
vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2"
4921+
fi
47584922
fi
47594923
$as_echo "#define DYNAMIC_LUA 1" >>confdefs.h
47604924

47614925
LUA_LIBS=""
47624926
LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS"
47634927
fi
4928+
if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \
4929+
test "x$MACOSX" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \
4930+
test "`(uname -m) 2>/dev/null`" = "x86_64"; then
4931+
LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS"
4932+
fi
47644933
fi
4765-
if test "$fail_if_missing" = "yes" -a -z "$LUA_SRC"; then
4934+
if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then
47664935
as_fn_error "could not configure lua" "$LINENO" 5
47674936
fi
47684937

0 commit comments

Comments
 (0)