summaryrefslogtreecommitdiff
path: root/src/configure
diff options
context:
space:
mode:
Diffstat (limited to 'src/configure')
-rwxr-xr-xsrc/configure26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/configure b/src/configure
index 944acd7..f5e7050 100755
--- a/src/configure
+++ b/src/configure
@@ -33,7 +33,7 @@ TARGET=`uname -s`
EBUILD_COMPAT=0
CFLAGS='-g -O2'
-LDFLAGS='-g -Wall -O2 -ldl -lm'
+LDFLAGS='-g -Wall -O2 -lm'
CRYPTO_LIB='gnutls'
LUA_DIR=''
@@ -121,6 +121,7 @@ rm -f version.h
rm -f include.mk
case $TARGET in
Linux)
+ LDFLAGS=$LDFLAGS' -ldl'
;;
OpenBSD|FreeBSD|NetBSD|GNU/kFreeBSD)
CFLAGS=$CFLAGS' -I/usr/local/include'
@@ -151,7 +152,7 @@ test_lua_version()
LUA_VERSION_NUM=`cat $1 | grep "#define LUA_VERSION_NUM" | awk '{ print $3 }'`
LUA_RELEASE=`cat $1 | grep "#define LUA_RELEASE[ ]" | cut -f2-`
- if [ $LUA_VERSION_NUM -ge 500 ]; then
+ if [ $LUA_VERSION_NUM -ge 501 ]; then
return 1;
else
return 0;
@@ -171,26 +172,35 @@ if [ -z "$LUA_DIR" ]; then
break
fi
else
- for dir in $prefix/include/lua*; do
+ for dir in `ls -d $prefix/include/lua* 2> /dev/null`; do
if [ -e $dir/lua.h ]; then
test_lua_version $dir/lua.h
if [ $? -eq 1 ]; then
echo "using Lua $LUA_VERSION ($LUA_RELEASE) found at $dir"
CFLAGS="$CFLAGS -I$dir"
- LDFLAGS="$LDFLAGS -L$prefix/lib -llua$LUA_VERSION"
- LUA=$prefix/bin/lua$LUA_VERSION
- LUAC=$prefix/bin/luac$LUA_VERSION
+ if [ -x "$prefix/bin/lua$LUA_VERSION" ]; then
+ LDFLAGS="$LDFLAGS -L$prefix/lib -llua$LUA_VERSION"
+ LUA=$prefix/bin/lua$LUA_VERSION
+ LUAC=$prefix/bin/luac$LUA_VERSION
+ elif [ -x "$prefix/bin/lua-$LUA_VERSION" ]; then
+ LDFLAGS="$LDFLAGS -L$prefix/lib -llua-$LUA_VERSION"
+ LUA=$prefix/bin/lua-$LUA_VERSION
+ LUAC=$prefix/bin/luac-$LUA_VERSION
+ else
+ echo "ERROR: found lua.h at $dir/lua.h but no matching lua and luac"
+ return 1
+ fi
break
fi
fi
done
- if [ -n $LUAC ]; then
+ if [ -n "$LUAC" ]; then
break
fi
fi
done
- if [ -z $LUAC ]; then
+ if [ -z "$LUAC" ]; then
echo "ERROR: no suitable lua found .. please install lua 5.1 or higher or use --with-lua"
return 1
fi