summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-03-09 21:36:20 -0300
committerHisham Muhammad <hisham@gobolinux.org>2012-03-09 21:36:20 -0300
commit37aded056fae788088855b36281b1d23b0131fdb (patch)
tree32562f8400a8ff3a1ea298cb662e5bf3929d565d /configure
parent9b9df2fa3475531aba8e41e38ba7d452d802cfb6 (diff)
downloadluarocks-37aded056fae788088855b36281b1d23b0131fdb.tar.gz
luarocks-37aded056fae788088855b36281b1d23b0131fdb.tar.bz2
luarocks-37aded056fae788088855b36281b1d23b0131fdb.zip
Further steps for Lua 5.2 support
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure120
1 files changed, 84 insertions, 36 deletions
diff --git a/configure b/configure
index 2be69a68..041a1dc8 100755
--- a/configure
+++ b/configure
@@ -13,6 +13,7 @@ LUA_DIR="/usr"
13LUA_BINDIR="/usr/bin" 13LUA_BINDIR="/usr/bin"
14LUA_INCDIR="/usr/include" 14LUA_INCDIR="/usr/include"
15LUA_LIBDIR="/usr/lib" 15LUA_LIBDIR="/usr/lib"
16LUA_VERSION="5.1"
16 17
17# ---------------------------------------------------------------------------- 18# ----------------------------------------------------------------------------
18# FUNCTION DEFINITIONS 19# FUNCTION DEFINITIONS
@@ -37,6 +38,8 @@ system's package manager.
37--rocks-tree=FILE Root of the local tree of installed rocks. 38--rocks-tree=FILE Root of the local tree of installed rocks.
38 Default is \$PREFIX 39 Default is \$PREFIX
39 40
41--lua-version=VERSION Use specific Lua version: 5.1 or 5.2 (EXPERIMENTAL)
42 Default is "$LUA_VERSION"
40--lua-suffix=SUFFIX Versioning suffix to use in Lua filenames. 43--lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
41 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...) 44 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
42--with-lua=PREFIX Use Lua from given prefix. 45--with-lua=PREFIX Use Lua from given prefix.
@@ -83,6 +86,14 @@ find_program() {
83 fi 86 fi
84} 87}
85 88
89die() {
90 echo "$*"
91 echo
92 echo "configure failed."
93 echo
94 exit 1
95}
96
86find_helper() { 97find_helper() {
87 explanation="$1" 98 explanation="$1"
88 shift 99 shift
@@ -99,8 +110,7 @@ find_helper() {
99 shift 110 shift
100 done 111 done
101 echo "Could not find a $explanation. Tried: $tried." 112 echo "Could not find a $explanation. Tried: $tried."
102 echo "Make sure one of them is installed and available in your PATH." 113 die "Make sure one of them is installed and available in your PATH."
103 exit 1
104} 114}
105 115
106case `echo -n x` in 116case `echo -n x` in
@@ -112,11 +122,6 @@ echo_n() {
112 echo $echo_n_flag "$*" 122 echo $echo_n_flag "$*"
113} 123}
114 124
115die() {
116 echo "$*"
117 exit 1
118}
119
120# ---------------------------------------------------------------------------- 125# ----------------------------------------------------------------------------
121# MAIN PROGRAM 126# MAIN PROGRAM
122# ---------------------------------------------------------------------------- 127# ----------------------------------------------------------------------------
@@ -162,6 +167,12 @@ do
162 LUA_SUFFIX="$value" 167 LUA_SUFFIX="$value"
163 LUA_SUFFIX_SET=yes 168 LUA_SUFFIX_SET=yes
164 ;; 169 ;;
170 --lua-version)
171 [ -n "$value" ] || die "Missing value in flag $key."
172 LUA_VERSION="$value"
173 [ "$LUA_VERSION" = "5.1" -o "$LUA_VERSION" = "5.2" ] || die "Invalid Lua version in flag $key."
174 LUA_VERSION_SET=yes
175 ;;
165 --with-lua) 176 --with-lua)
166 [ -n "$value" ] || die "Missing value in flag $key." 177 [ -n "$value" ] || die "Missing value in flag $key."
167 LUA_DIR="$value" 178 LUA_DIR="$value"
@@ -181,7 +192,7 @@ do
181 [ -n "$value" ] || die "Missing value in flag $key." 192 [ -n "$value" ] || die "Missing value in flag $key."
182 case "$value" in 193 case "$value" in
183 wget|curl) LUAROCKS_DOWNLOADER="$value" ;; 194 wget|curl) LUAROCKS_DOWNLOADER="$value" ;;
184 *) echo "Invalid option: $value. See --help." ; exit 1 ;; 195 *) die "Invalid option: $value. See --help." ;;
185 esac 196 esac
186 LUAROCKS_DOWNLOADER_SET=yes 197 LUAROCKS_DOWNLOADER_SET=yes
187 ;; 198 ;;
@@ -189,19 +200,17 @@ do
189 [ -n "$value" ] || die "Missing value in flag $key." 200 [ -n "$value" ] || die "Missing value in flag $key."
190 case "$value" in 201 case "$value" in
191 md5sum|openssl|md5) LUAROCKS_MD5CHECKER="$value" ;; 202 md5sum|openssl|md5) LUAROCKS_MD5CHECKER="$value" ;;
192 *) echo "Invalid option: $value. See --help." ; exit 1 ;; 203 *) die "Invalid option: $value. See --help." ;;
193 esac 204 esac
194 LUAROCKS_MD5CHECKER_SET=yes 205 LUAROCKS_MD5CHECKER_SET=yes
195 ;; 206 ;;
196 *) 207 *)
197 echo "Error: Unknown flag: $1" 208 die "Error: Unknown flag: $1"
198 exit 1
199 ;; 209 ;;
200 esac 210 esac
201 shift 211 shift
202done 212done
203 213
204
205if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ] 214if [ "$PREFIX_SET" = "yes" -a ! "$SYSCONFDIR_SET" = "yes" ]
206then 215then
207 if [ "$PREFIX" = "/usr" ] 216 if [ "$PREFIX" = "/usr" ]
@@ -216,28 +225,70 @@ then
216 ROCKS_TREE=$PREFIX 225 ROCKS_TREE=$PREFIX
217fi 226fi
218 227
219if [ "$LUA_SUFFIX_SET" != "yes" ] 228detect_lua_version() {
220then 229 detected_lua=`$1 -e 'print(_VERSION:sub(5))' 2> /dev/null`
221 for suffix in "" "5.1" "51" "" 230 if [ "$detected_lua" = "5.1" -o "$detected_lua" = "5.2" ]
222 do 231 then
223 LUA_SUFFIX="$suffix" 232 echo "Lua version detected: $detected_lua"
224 if [ "$LUA_DIR_SET" = "yes" ] 233 if [ "$LUA_VERSION_SET" != "yes" ]
234 then
235 LUA_VERSION=$detected_lua
236 elif [ "$LUA_VERSION" != "$detected_lua" ]
225 then 237 then
226 if [ -f "$LUA_DIR/bin/lua$suffix" ] 238 die "This clashes with the value of --with-lua-version. Please check your configuration."
227 then
228 find_lua="$LUA_DIR"
229 fi
230 else
231 find_lua=`find_program lua$suffix`
232 fi 239 fi
233 if [ -n "$find_lua" ] 240 fi
241}
242
243search_interpreter() {
244 LUA_SUFFIX="$1"
245 if [ "$LUA_DIR_SET" = "yes" ]
246 then
247 if [ -f "$LUA_DIR/bin/lua$suffix" ]
234 then 248 then
235 echo "Lua interpreter found: $find_lua/lua$suffix..." 249 find_lua="$LUA_DIR/bin"
236 break
237 fi 250 fi
251 else
252 find_lua=`find_program lua$suffix`
253 fi
254 if [ -n "$find_lua" ]
255 then
256 echo "Lua interpreter found: $find_lua/lua$suffix..."
257 detect_lua_version "$find_lua/lua$suffix"
258 return 0
259 fi
260 return 1
261}
262
263if [ "$LUA_SUFFIX_SET" != "yes" ]
264then
265 if [ "$LUA_VERSION_SET" = "yes" -a "$LUA_VERSION" = "5.1" ]
266 then
267 suffixes="5.1 51"
268 elif [ "$LUA_VERSION_SET" = "yes" -a "$LUA_VERSION" = "5.2" ]
269 then
270 suffixes="5.2 52"
271 else
272 suffixes="5.2 52 5.1 51"
273 fi
274 for suffix in "" `echo $suffixes` ""
275 do
276 search_interpreter "$suffix" && break
238 done 277 done
239fi 278fi
240 279
280if [ "$LUA_VERSION" = "5.2" ]
281then
282 echo "******************************"
283 echo "WARNING: Lua 5.2 support is still experimental."
284 echo "Bug reports, patches and pull requests are welcome"
285 echo "at the GitHub project:"
286 echo "http://github.com/keplerproject/luarocks"
287 echo "and the mailing list:"
288 echo "https://lists.sourceforge.net/lists/listinfo/luarocks-developers"
289 echo "******************************"
290fi
291
241if [ "$LUA_DIR_SET" != "yes" ] 292if [ "$LUA_DIR_SET" != "yes" ]
242then 293then
243 echo_n "Looking for Lua... " 294 echo_n "Looking for Lua... "
@@ -253,8 +304,7 @@ then
253 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua" 304 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua"
254 else 305 else
255 echo "lua$LUA_SUFFIX not found in \$PATH." 306 echo "lua$LUA_SUFFIX not found in \$PATH."
256 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help." 307 die "You may want to use the flags --with-lua and/or --lua-suffix. See --help."
257 exit 1
258 fi 308 fi
259fi 309fi
260 310
@@ -279,15 +329,14 @@ if [ -f "$lua_h" ]
279then 329then
280 echo "lua.h found in $lua_h" 330 echo "lua.h found in $lua_h"
281else 331else
282 LUA_INCDIR="$LUA_INCDIR/lua5.1" 332 LUA_INCDIR="$LUA_INCDIR/lua/$LUA_VERSION"
283 d_lua_h="$LUA_INCDIR/lua.h" 333 d_lua_h="$LUA_INCDIR/lua.h"
284 if [ -f "$d_lua_h" ] 334 if [ -f "$d_lua_h" ]
285 then 335 then
286 echo "lua.h found in $d_lua_h (Debian/Ubuntu)" 336 echo "lua.h found in $d_lua_h (Debian/Ubuntu)"
287 else 337 else
288 echo "lua.h not found (looked in $lua_h)" 338 echo "lua.h not found (looked in $lua_h)"
289 echo "You may want to use the flag --with-lua-include. See --help." 339 die "You may want to use the flag --with-lua-include. See --help."
290 exit 1
291 fi 340 fi
292fi 341fi
293 342
@@ -308,16 +357,14 @@ if uname -s
308then 357then
309 LUAROCKS_UNAME_S=`uname -s` 358 LUAROCKS_UNAME_S=`uname -s`
310else 359else
311 echo "Could not determine operating system. 'uname -s' failed." 360 die "Could not determine operating system. 'uname -s' failed."
312 exit 1
313fi 361fi
314echo_n "Configuring for architecture... " 362echo_n "Configuring for architecture... "
315if uname -m 363if uname -m
316then 364then
317 LUAROCKS_UNAME_M=`uname -m` 365 LUAROCKS_UNAME_M=`uname -m`
318else 366else
319 echo "Could not determine processor architecture. 'uname -m' failed." 367 die "Could not determine processor architecture. 'uname -m' failed."
320 exit 1
321fi 368fi
322 369
323if [ -f config.unix ]; then 370if [ -f config.unix ]; then
@@ -334,6 +381,7 @@ cat <<EOF > config.unix
334# This file was automatically generated by the configure script. 381# This file was automatically generated by the configure script.
335# Run "./configure --help" for details. 382# Run "./configure --help" for details.
336 383
384LUA_VERSION=$LUA_VERSION
337PREFIX=$PREFIX 385PREFIX=$PREFIX
338SYSCONFDIR=$SYSCONFDIR 386SYSCONFDIR=$SYSCONFDIR
339ROCKS_TREE=$ROCKS_TREE 387ROCKS_TREE=$ROCKS_TREE