Software /
code /
prosody
Comparison
configure @ 7944:36a9a4af1873
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 02 Mar 2017 23:03:02 +0100 |
parent | 7943:da791f11e20c |
child | 7945:1f4a0e0b7167 |
comparison
equal
deleted
inserted
replaced
7923:81f3068fc30c | 7944:36a9a4af1873 |
---|---|
19 RUNWITH="lua" | 19 RUNWITH="lua" |
20 EXCERTS="yes" | 20 EXCERTS="yes" |
21 PRNG= | 21 PRNG= |
22 PRNGLIBS= | 22 PRNGLIBS= |
23 | 23 |
24 CFLAGS="-fPIC -Wall -pedantic -std=c89" | 24 CFLAGS="-fPIC -Wall -pedantic -std=c99" |
25 LDFLAGS="-shared" | 25 LDFLAGS="-shared" |
26 | 26 |
27 IDN_LIBRARY="idn" | 27 IDN_LIBRARY="idn" |
28 # Help | 28 # Help |
29 | 29 |
40 Default is \$PREFIX/etc/prosody | 40 Default is \$PREFIX/etc/prosody |
41 --libdir=DIR Location where the server files should be stored. | 41 --libdir=DIR Location where the server files should be stored. |
42 Default is \$PREFIX/lib | 42 Default is \$PREFIX/lib |
43 --datadir=DIR Location where the server data should be stored. | 43 --datadir=DIR Location where the server data should be stored. |
44 Default is \$PREFIX/var/lib/prosody | 44 Default is \$PREFIX/var/lib/prosody |
45 --lua-version=VERSION Use specific Lua version: 5.1, 5.2, or 5.3 | |
46 Default is auto-detected. | |
45 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames. | 47 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames. |
46 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...) | 48 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...) |
47 --with-lua=PREFIX Use Lua from given prefix. | 49 --with-lua=PREFIX Use Lua from given prefix. |
48 Default is $LUA_DIR | 50 Default is auto-detected (the parent directory of \$LUA_BINDIR). |
51 --with-lua-bin=DIR You can also specify Lua's bin dir. | |
52 Default is the directory of the auto-detected Lua interpreter, | |
53 or \$LUA_DIR/bin if --with-lua is used. | |
49 --runwith=BINARY What Lua binary to set as runtime environment. | 54 --runwith=BINARY What Lua binary to set as runtime environment. |
50 Default is $RUNWITH | 55 Default is $RUNWITH |
51 --with-lua-include=DIR You can also specify Lua's includes dir. | 56 --with-lua-include=DIR You can also specify Lua's includes dir. |
52 Default is \$LUA_DIR/include | 57 Default is \$LUA_DIR/include |
53 --with-lua-lib=DIR You can also specify Lua's libraries dir. | 58 --with-lua-lib=DIR You can also specify Lua's libraries dir. |
76 it fails to find a configuration file | 81 it fails to find a configuration file |
77 --no-example-certs Disables generation of example certificates. | 82 --no-example-certs Disables generation of example certificates. |
78 EOF | 83 EOF |
79 } | 84 } |
80 | 85 |
81 | 86 # Helper functions |
82 while [ "$1" ] | 87 |
88 find_program() { | |
89 prog=`command -v "$1" 2>/dev/null` | |
90 if [ -n "$prog" ] | |
91 then | |
92 dirname "$prog" | |
93 fi | |
94 } | |
95 | |
96 die() { | |
97 echo "$*" | |
98 echo | |
99 echo "configure failed." | |
100 echo | |
101 exit 1 | |
102 } | |
103 | |
104 find_helper() { | |
105 explanation="$1" | |
106 shift | |
107 tried="$*" | |
108 while [ -n "$1" ] | |
83 do | 109 do |
84 value="$(echo "$1" | sed 's/[^=]*=\(.*\)/\1/')" | 110 found=`find_program "$1"` |
85 if echo "$value" | grep -q "~" | 111 if [ -n "$found" ] |
112 then | |
113 echo "$1 found at $found" | |
114 HELPER=$1 | |
115 return | |
116 fi | |
117 shift | |
118 done | |
119 echo "Could not find $explanation. Tried: $tried." | |
120 die "Make sure one of them is installed and available in your PATH." | |
121 } | |
122 | |
123 case `echo -n x` in | |
124 -n*) echo_n_flag='';; | |
125 *) echo_n_flag='-n';; | |
126 esac | |
127 | |
128 echo_n() { | |
129 echo $echo_n_flag "$*" | |
130 } | |
131 | |
132 # ---------------------------------------------------------------------------- | |
133 # MAIN PROGRAM | |
134 # ---------------------------------------------------------------------------- | |
135 | |
136 # Parse options | |
137 | |
138 while [ -n "$1" ] | |
139 do | |
140 value="`echo $1 | sed 's/[^=]*.\(.*\)/\1/'`" | |
141 key="`echo $1 | sed 's/=.*//'`" | |
142 if `echo "$value" | grep "~" >/dev/null 2>/dev/null` | |
86 then | 143 then |
87 echo | 144 echo |
88 echo '*WARNING*: the "~" sign is not expanded in flags.' | 145 echo '*WARNING*: the "~" sign is not expanded in flags.' |
89 echo 'If you mean the home directory, use $HOME instead.' | 146 echo 'If you mean the home directory, use $HOME instead.' |
90 echo | 147 echo |
91 fi | 148 fi |
92 case "$1" in | 149 case "$key" in |
93 --help) | 150 --help) |
94 show_help | 151 show_help |
95 exit 0 | 152 exit 0 |
96 ;; | 153 ;; |
97 --prefix=*) | 154 --prefix) |
155 [ -n "$value" ] || die "Missing value in flag $key." | |
98 PREFIX="$value" | 156 PREFIX="$value" |
99 PREFIX_SET=yes | 157 PREFIX_SET=yes |
100 ;; | 158 ;; |
101 --sysconfdir=*) | 159 --sysconfdir) |
160 [ -n "$value" ] || die "Missing value in flag $key." | |
102 SYSCONFDIR="$value" | 161 SYSCONFDIR="$value" |
103 SYSCONFDIR_SET=yes | 162 SYSCONFDIR_SET=yes |
104 ;; | 163 ;; |
105 --ostype=*) | 164 --ostype) |
165 # TODO make this a switch? | |
106 OSTYPE="$value" | 166 OSTYPE="$value" |
107 OSTYPE_SET=yes | 167 OSTYPE_SET=yes |
108 if [ "$OSTYPE" = "debian" ]; then | 168 if [ "$OSTYPE" = "debian" ]; then |
109 if [ "$LUA_SUFFIX_SET" != "yes" ]; then | 169 if [ "$LUA_SUFFIX_SET" != "yes" ]; then |
110 LUA_SUFFIX="5.1"; | 170 LUA_SUFFIX="5.1"; |
111 LUA_SUFFIX_SET=yes | 171 LUA_SUFFIX_SET=yes |
112 fi | 172 fi |
113 RUNWITH="lua$LUA_SUFFIX" | |
114 LUA_INCDIR="/usr/include/lua$LUA_SUFFIX" | 173 LUA_INCDIR="/usr/include/lua$LUA_SUFFIX" |
115 LUA_INCDIR_SET=yes | 174 LUA_INCDIR_SET=yes |
116 CFLAGS="$CFLAGS -ggdb -D_GNU_SOURCE" | 175 CFLAGS="$CFLAGS -ggdb" |
117 fi | 176 fi |
118 if [ "$OSTYPE" = "macosx" ]; then | 177 if [ "$OSTYPE" = "macosx" ]; then |
119 LUA_INCDIR=/usr/local/include; | 178 LUA_INCDIR=/usr/local/include; |
120 LUA_INCDIR_SET=yes | 179 LUA_INCDIR_SET=yes |
121 LUA_LIBDIR=/usr/local/lib | 180 LUA_LIBDIR=/usr/local/lib |
126 if [ "$OSTYPE" = "linux" ]; then | 185 if [ "$OSTYPE" = "linux" ]; then |
127 LUA_INCDIR=/usr/local/include; | 186 LUA_INCDIR=/usr/local/include; |
128 LUA_INCDIR_SET=yes | 187 LUA_INCDIR_SET=yes |
129 LUA_LIBDIR=/usr/local/lib | 188 LUA_LIBDIR=/usr/local/lib |
130 LUA_LIBDIR_SET=yes | 189 LUA_LIBDIR_SET=yes |
131 CFLAGS="$CFLAGS -ggdb -D_GNU_SOURCE" | 190 CFLAGS="$CFLAGS -ggdb" |
132 fi | 191 fi |
133 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]; then | 192 if [ "$OSTYPE" = "freebsd" -o "$OSTYPE" = "openbsd" ]; then |
134 LUA_INCDIR="/usr/local/include/lua51" | 193 LUA_INCDIR="/usr/local/include/lua51" |
135 LUA_INCDIR_SET=yes | 194 LUA_INCDIR_SET=yes |
136 CFLAGS="-Wall -fPIC -I/usr/local/include" | 195 CFLAGS="-Wall -fPIC -I/usr/local/include" |
145 if [ "$OSTYPE" = "openbsd" ]; then | 204 if [ "$OSTYPE" = "openbsd" ]; then |
146 LUA_INCDIR="/usr/local/include"; | 205 LUA_INCDIR="/usr/local/include"; |
147 LUA_INCDIR_SET="yes" | 206 LUA_INCDIR_SET="yes" |
148 fi | 207 fi |
149 if [ "$OSTYPE" = "netbsd" ]; then | 208 if [ "$OSTYPE" = "netbsd" ]; then |
150 RUNWITH="lua5.1" | |
151 LUA_INCDIR="/usr/pkg/include/lua-5.1" | 209 LUA_INCDIR="/usr/pkg/include/lua-5.1" |
152 LUA_INCDIR_SET=yes | 210 LUA_INCDIR_SET=yes |
153 LUA_LIBDIR="/usr/pkg/lib/lua/5.1" | 211 LUA_LIBDIR="/usr/pkg/lib/lua/5.1" |
154 LUA_LIBDIR_SET=yes | 212 LUA_LIBDIR_SET=yes |
155 CFLAGS="-Wall -fPIC -I/usr/pkg/include" | 213 CFLAGS="-Wall -fPIC -I/usr/pkg/include" |
165 LUA_CF="${LUA_CF%% *}" | 223 LUA_CF="${LUA_CF%% *}" |
166 if [ "$LUA_CF" != "" ]; then | 224 if [ "$LUA_CF" != "" ]; then |
167 LUA_INCDIR="$LUA_CF" | 225 LUA_INCDIR="$LUA_CF" |
168 LUA_INCDIR_SET=yes | 226 LUA_INCDIR_SET=yes |
169 fi | 227 fi |
170 CFLAGS="$CFLAGS -D_GNU_SOURCE" | 228 CFLAGS="$CFLAGS" |
171 fi | 229 fi |
172 ;; | 230 ;; |
173 --libdir=*) | 231 --libdir) |
174 LIBDIR="$value" | 232 LIBDIR="$value" |
175 LIBDIR_SET=yes | 233 LIBDIR_SET=yes |
176 ;; | 234 ;; |
177 --datadir=*) | 235 --datadir) |
178 DATADIR="$value" | 236 DATADIR="$value" |
179 DATADIR_SET=yes | 237 DATADIR_SET=yes |
180 ;; | 238 ;; |
181 --require-config) | 239 --require-config) |
182 REQUIRE_CONFIG=yes | 240 REQUIRE_CONFIG=yes |
183 ;; | 241 ;; |
184 --lua-suffix=*) | 242 --lua-suffix) |
243 [ -n "$value" ] || die "Missing value in flag $key." | |
185 LUA_SUFFIX="$value" | 244 LUA_SUFFIX="$value" |
186 LUA_SUFFIX_SET=yes | 245 LUA_SUFFIX_SET=yes |
187 ;; | 246 ;; |
188 --with-lua=*) | 247 --lua-version|--with-lua-version) |
248 [ -n "$value" ] || die "Missing value in flag $key." | |
249 LUA_VERSION="$value" | |
250 [ "$LUA_VERSION" = "5.1" -o "$LUA_VERSION" = "5.2" -o "$LUA_VERSION" = "5.3" ] || die "Invalid Lua version in flag $key." | |
251 LUA_VERSION_SET=yes | |
252 ;; | |
253 --with-lua) | |
254 [ -n "$value" ] || die "Missing value in flag $key." | |
189 LUA_DIR="$value" | 255 LUA_DIR="$value" |
190 LUA_DIR_SET=yes | 256 LUA_DIR_SET=yes |
191 ;; | 257 ;; |
192 --with-lua-include=*) | 258 --with-lua-bin) |
259 [ -n "$value" ] || die "Missing value in flag $key." | |
260 LUA_BINDIR="$value" | |
261 LUA_BINDIR_SET=yes | |
262 ;; | |
263 --with-lua-include) | |
264 [ -n "$value" ] || die "Missing value in flag $key." | |
193 LUA_INCDIR="$value" | 265 LUA_INCDIR="$value" |
194 LUA_INCDIR_SET=yes | 266 LUA_INCDIR_SET=yes |
195 ;; | 267 ;; |
196 --with-lua-lib=*) | 268 --with-lua-lib) |
197 LUA_LIBDIR="$value" LUA_LIBDIR_SET=yes | 269 [ -n "$value" ] || die "Missing value in flag $key." |
198 ;; | 270 LUA_LIBDIR="$value" |
199 --with-idn=*) | 271 LUA_LIBDIR_SET=yes |
272 ;; | |
273 --with-idn) | |
200 IDN_LIB="$value" | 274 IDN_LIB="$value" |
201 ;; | 275 ;; |
202 --idn-library=*) | 276 --idn-library) |
203 IDN_LIBRARY="$value" | 277 IDN_LIBRARY="$value" |
204 ;; | 278 ;; |
205 --with-ssl=*) | 279 --with-ssl) |
206 OPENSSL_LIB="$value" | 280 OPENSSL_LIB="$value" |
207 ;; | 281 ;; |
208 --with-random=getrandom) | 282 --with-random) |
209 PRNG=GETRANDOM | 283 case "$value" in |
210 ;; | 284 getrandom) |
211 --with-random=openssl) | 285 PRNG=GETRANDOM |
212 PRNG=OPENSSL | 286 ;; |
213 PRNGLIBS=-lcrypto | 287 openssl) |
214 ;; | 288 PRNG=OPENSSL |
215 --with-random=arc4random) | 289 ;; |
216 PRNG=ARC4RANDOM | 290 arc4random) |
217 ;; | 291 PRNG=ARC4RANDOM |
218 --cflags=*) | 292 ;; |
293 esac | |
294 ;; | |
295 --cflags) | |
219 CFLAGS="$value" | 296 CFLAGS="$value" |
220 ;; | 297 ;; |
221 --ldflags=*) | 298 --ldflags) |
222 LDFLAGS="$value" | 299 LDFLAGS="$value" |
223 ;; | 300 ;; |
224 --c-compiler=*) | 301 --c-compiler) |
225 CC="$value" | 302 CC="$value" |
226 ;; | 303 ;; |
227 --linker=*) | 304 --linker) |
228 LD="$value" | 305 LD="$value" |
229 ;; | 306 ;; |
230 --runwith=*) | 307 --runwith) |
231 RUNWITH="$value" | 308 RUNWITH="$value" |
309 RUNWITH_SET=yes | |
232 ;; | 310 ;; |
233 --no-example-certs) | 311 --no-example-certs) |
234 EXCERTS= | 312 EXCERTS= |
235 ;; | 313 ;; |
236 --compiler-wrapper=*) | 314 --compiler-wrapper) |
237 CC="$value $CC" | 315 CC="$value $CC" |
238 LD="$value $LD" | 316 LD="$value $LD" |
239 ;; | 317 ;; |
240 *) | 318 *) |
241 echo "Error: Unknown flag: $1" | 319 die "Error: Unknown flag: $1" |
242 exit 1 | |
243 ;; | 320 ;; |
244 esac | 321 esac |
245 shift | 322 shift |
246 done | 323 done |
247 | 324 |
259 then DATADIR=/var/lib/prosody | 336 then DATADIR=/var/lib/prosody |
260 else DATADIR=$PREFIX/var/lib/prosody | 337 else DATADIR=$PREFIX/var/lib/prosody |
261 fi | 338 fi |
262 fi | 339 fi |
263 | 340 |
264 if [ "$PREFIX_SET" = "yes" -a ! "$LIBDIR_SET" = "yes" ] | 341 detect_lua_version() { |
265 then | 342 detected_lua=`$1 -e 'print(_VERSION:match(" (5%.[123])$"))' 2> /dev/null` |
266 LIBDIR=$PREFIX/lib | 343 if [ "$detected_lua" != "nil" ] |
267 fi | 344 then |
268 | 345 if [ "$LUA_VERSION_SET" != "yes" ] |
269 find_program() { | 346 then |
270 path="$PATH" | 347 echo "Lua version detected: $detected_lua" |
271 item="$(echo "$path" | sed 's/\([^:]*\):.*/\1/')" | 348 LUA_VERSION=$detected_lua |
272 path="$(echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p')" | 349 return 0 |
273 found="no" | 350 elif [ "$LUA_VERSION" = "$detected_lua" ] |
274 while [ "$item" ] | 351 then |
352 return 0 | |
353 fi | |
354 fi | |
355 return 1 | |
356 } | |
357 | |
358 search_interpreter() { | |
359 suffix="$1" | |
360 if [ "$LUA_BINDIR_SET" = "yes" ] | |
361 then | |
362 find_lua="$LUA_BINDIR" | |
363 elif [ "$LUA_DIR_SET" = "yes" ] | |
364 then | |
365 LUA_BINDIR="$LUA_DIR/bin" | |
366 if [ -f "$LUA_BINDIR/lua$suffix" ] | |
367 then | |
368 find_lua="$LUA_BINDIR" | |
369 fi | |
370 else | |
371 find_lua=`find_program lua$suffix` | |
372 fi | |
373 if [ -n "$find_lua" -a -x "$find_lua/lua$suffix" ] | |
374 then | |
375 if detect_lua_version "$find_lua/lua$suffix" | |
376 then | |
377 echo "Lua interpreter found: $find_lua/lua$suffix..." | |
378 if [ "$LUA_BINDIR_SET" != "yes" ] | |
379 then | |
380 LUA_BINDIR="$find_lua" | |
381 fi | |
382 if [ "$LUA_DIR_SET" != "yes" ] | |
383 then | |
384 LUA_DIR=`dirname "$find_lua"` | |
385 fi | |
386 LUA_SUFFIX="$suffix" | |
387 return 0 | |
388 fi | |
389 fi | |
390 return 1 | |
391 } | |
392 | |
393 lua_interp_found=no | |
394 if [ "$LUA_SUFFIX_SET" != "yes" ] | |
395 then | |
396 if [ "$LUA_VERSION_SET" = "yes" -a "$LUA_VERSION" = "5.1" ] | |
397 then | |
398 suffixes="5.1 51 -5.1 -51" | |
399 elif [ "$LUA_VERSION_SET" = "yes" -a "$LUA_VERSION" = "5.2" ] | |
400 then | |
401 suffixes="5.2 52 -5.2 -52" | |
402 elif [ "$LUA_VERSION_SET" = "yes" -a "$LUA_VERSION" = "5.3" ] | |
403 then | |
404 suffixes="5.3 53 -5.3 -53" | |
405 else | |
406 suffixes="5.1 51 -5.1 -51 5.2 52 -5.2 -52 5.3 53 -5.3 -53" | |
407 fi | |
408 for suffix in "" `echo $suffixes` | |
275 do | 409 do |
276 if [ -f "$item/$1" ] | 410 search_interpreter "$suffix" && { |
277 then | 411 lua_interp_found=yes |
278 found="yes" | 412 break |
279 break | 413 } |
280 fi | 414 done |
281 item="$(echo "$path" | sed 's/\([^:]*\):.*/\1/')" | 415 else |
282 path="$(echo "$path" | sed -n 's/[^:]*::*\(.*\)/\1/p')" | 416 search_interpreter "$LUA_SUFFIX" && { |
283 done | 417 lua_interp_found=yes |
284 if [ "$found" = "yes" ] | 418 } |
285 then | 419 fi |
286 echo "$item" | 420 |
421 if [ "$lua_interp_found" != "yes" ] | |
422 then | |
423 [ "$LUA_VERSION_SET" ] && { interp="Lua $LUA_VERSION" ;} || { interp="Lua" ;} | |
424 [ "$LUA_DIR_SET" -o "$LUA_BINDIR_SET" ] && { where="$LUA_BINDIR" ;} || { interp="\$PATH" ;} | |
425 echo "$interp interpreter not found in $where" | |
426 die "You may want to use the flags --with-lua, --with-lua-bin and/or --lua-suffix. See --help." | |
427 fi | |
428 | |
429 if [ "$LUA_VERSION_SET" = "yes" ] | |
430 then | |
431 echo_n "Checking if $LUA_BINDIR/lua$LUA_SUFFIX is Lua version $LUA_VERSION... " | |
432 if detect_lua_version "$LUA_BINDIR/lua$LUA_SUFFIX" | |
433 then | |
434 echo "yes" | |
287 else | 435 else |
288 echo "" | 436 echo "no" |
289 fi | 437 die "You may want to use the flags --with-lua, --with-lua-bin and/or --lua-suffix. See --help." |
290 } | 438 fi |
291 | 439 fi |
292 if [ "$LUA_SUFFIX_SET" != "yes" ] | 440 |
293 then | 441 if [ "$LUA_INCDIR_SET" != "yes" ] |
294 for suffix in "5.1" "51" "" | 442 then |
295 do | 443 LUA_INCDIR="$LUA_DIR/include" |
296 LUA_SUFFIX="$suffix" | 444 fi |
297 if [ "$LUA_DIR_SET" = "yes" ] | 445 |
298 then | 446 if [ "$LUA_LIBDIR_SET" != "yes" ] |
299 if [ -f "$LUA_DIR/bin/lua$suffix" ] | 447 then |
300 then | 448 LUA_LIBDIR="$LUA_DIR/lib" |
301 find_lua="$LUA_DIR" | 449 fi |
302 fi | 450 |
451 echo_n "Checking Lua includes... " | |
452 lua_h="$LUA_INCDIR/lua.h" | |
453 if [ -f "$lua_h" ] | |
454 then | |
455 echo "lua.h found in $lua_h" | |
456 else | |
457 v_dir="$LUA_INCDIR/lua/$LUA_VERSION" | |
458 lua_h="$v_dir/lua.h" | |
459 if [ -f "$lua_h" ] | |
460 then | |
461 echo "lua.h found in $lua_h" | |
462 LUA_INCDIR="$v_dir" | |
463 else | |
464 d_dir="$LUA_INCDIR/lua$LUA_VERSION" | |
465 lua_h="$d_dir/lua.h" | |
466 if [ -f "$lua_h" ] | |
467 then | |
468 echo "lua.h found in $lua_h (Debian/Ubuntu)" | |
469 LUA_INCDIR="$d_dir" | |
303 else | 470 else |
304 find_lua="$(find_program lua$suffix)" | 471 echo "lua.h not found (looked in $LUA_INCDIR, $v_dir, $d_dir)" |
305 fi | 472 die "You may want to use the flag --with-lua or --with-lua-include. See --help." |
306 if [ "$find_lua" ] | 473 fi |
307 then | 474 fi |
308 echo "Lua interpreter found: $find_lua/lua$suffix..." | 475 fi |
309 break | 476 |
310 fi | 477 echo_n "Checking if Lua header version matches that of the interpreter... " |
311 done | 478 header_version=$(sed -n 's/.*LUA_VERSION_NUM.*5.\(.\).*/5.\1/p' "$lua_h") |
312 fi | 479 if [ "$header_version" = "$LUA_VERSION" ] |
313 | 480 then |
314 if [ "$LUA_DIR_SET" != "yes" ] | 481 echo "yes" |
315 then | 482 else |
316 echo -n "Looking for Lua... " | 483 echo "no" |
317 if [ ! "$find_lua" ] | 484 echo "lua.h version mismatch (interpreter: $LUA_VERSION; lua.h: $header_version)." |
318 then | 485 die "You may want to use the flag --with-lua or --with-lua-include. See --help." |
319 find_lua="$(find_program lua$LUA_SUFFIX)" | 486 fi |
320 echo "lua$LUA_SUFFIX found in \$PATH: $find_lua" | 487 |
321 fi | 488 echo_n "Configuring for system... " |
322 if [ "$find_lua" ] | 489 if uname -s |
323 then | 490 then |
324 LUA_DIR="$(dirname $find_lua)" | 491 UNAME_S=`uname -s` |
325 LUA_BINDIR="$find_lua" | 492 else |
326 else | 493 die "Could not determine operating system. 'uname -s' failed." |
327 echo "lua$LUA_SUFFIX not found in \$PATH." | 494 fi |
328 echo "You may want to use the flags --with-lua and/or --lua-suffix. See --help." | 495 echo_n "Configuring for architecture... " |
329 exit 1 | 496 if uname -m |
330 fi | 497 then |
331 fi | 498 UNAME_M=`uname -m` |
332 | 499 else |
333 if [ "$LUA_INCDIR_SET" != "yes" ] | 500 die "Could not determine processor architecture. 'uname -m' failed." |
334 then | 501 fi |
335 LUA_INCDIR="$LUA_DIR/include" | 502 |
336 fi | 503 if [ "$UNAME_S" = Linux ] |
337 | 504 then |
338 if [ "$LUA_LIBDIR_SET" != "yes" ] | 505 GCC_ARCH=`gcc -print-multiarch 2>/dev/null` |
339 then | 506 if [ -n "$GCC_ARCH" -a -d "/usr/lib/$GCC_ARCH" ] |
340 LUA_LIBDIR="$LUA_DIR/lib" | 507 then |
341 fi | 508 MULTIARCH_SUBDIR="lib/$GCC_ARCH" |
342 | 509 elif [ -d "/usr/lib64" ] |
343 if [ "$LUA_DIR_SET" = "yes" ] | 510 then |
344 then | 511 # Useful for Fedora systems |
345 LUA_BINDIR="$LUA_DIR/bin" | 512 MULTIARCH_SUBDIR="lib64" |
513 fi | |
346 fi | 514 fi |
347 | 515 |
348 if [ "$IDN_LIBRARY" = "icu" ] | 516 if [ "$IDN_LIBRARY" = "icu" ] |
349 then | 517 then |
350 IDNA_LIBS="$ICU_FLAGS" | 518 IDNA_LIBS="$ICU_FLAGS" |
353 if [ "$IDN_LIBRARY" = "idn" ] | 521 if [ "$IDN_LIBRARY" = "idn" ] |
354 then | 522 then |
355 IDNA_LIBS="-l$IDN_LIB" | 523 IDNA_LIBS="-l$IDN_LIB" |
356 fi | 524 fi |
357 | 525 |
526 if [ -f config.unix ]; then | |
527 rm -f config.unix | |
528 fi | |
529 | |
530 if [ "$RUNWITH_SET" != yes ]; then | |
531 RUNWITH="lua$LUA_SUFFIX" | |
532 fi | |
533 | |
358 OPENSSL_LIBS="-l$OPENSSL_LIB" | 534 OPENSSL_LIBS="-l$OPENSSL_LIB" |
359 | 535 |
360 echo -n "Checking Lua includes... " | 536 if [ "$PRNG" = "OPENSSL" ]; then |
361 lua_h="$LUA_INCDIR/lua.h" | 537 PRNGLIBS=$OPENSSL_LIBS |
362 if [ -f "$lua_h" ] | |
363 then | |
364 echo "lua.h found in $lua_h" | |
365 else | |
366 echo "lua.h not found (looked in $lua_h)" | |
367 echo "You may want to use the flag --with-lua-include. See --help." | |
368 exit 1 | |
369 fi | 538 fi |
370 | 539 |
371 # Write config | 540 # Write config |
372 | 541 |
373 echo "Writing configuration..." | 542 echo "Writing configuration..." |
374 echo | 543 echo |
375 | 544 |
545 rm -f built | |
376 cat <<EOF > config.unix | 546 cat <<EOF > config.unix |
377 # This file was automatically generated by the configure script. | 547 # This file was automatically generated by the configure script. |
378 # Run "./configure --help" for details. | 548 # Run "./configure --help" for details. |
379 | 549 |
550 LUA_VERSION=$LUA_VERSION | |
380 PREFIX=$PREFIX | 551 PREFIX=$PREFIX |
381 SYSCONFDIR=$SYSCONFDIR | 552 SYSCONFDIR=$SYSCONFDIR |
382 LIBDIR=$LIBDIR | 553 LIBDIR=$LIBDIR |
383 DATADIR=$DATADIR | 554 DATADIR=$DATADIR |
384 LUA_SUFFIX=$LUA_SUFFIX | 555 LUA_SUFFIX=$LUA_SUFFIX |
385 LUA_DIR=$LUA_DIR | 556 LUA_DIR=$LUA_DIR |
557 LUA_DIR_SET=$LUA_DIR_SET | |
386 LUA_INCDIR=$LUA_INCDIR | 558 LUA_INCDIR=$LUA_INCDIR |
387 LUA_LIBDIR=$LUA_LIBDIR | 559 LUA_LIBDIR=$LUA_LIBDIR |
388 LUA_BINDIR=$LUA_BINDIR | 560 LUA_BINDIR=$LUA_BINDIR |
561 MULTIARCH_SUBDIR=$MULTIARCH_SUBDIR | |
389 REQUIRE_CONFIG=$REQUIRE_CONFIG | 562 REQUIRE_CONFIG=$REQUIRE_CONFIG |
390 IDN_LIB=$IDN_LIB | 563 IDN_LIB=$IDN_LIB |
391 IDNA_LIBS=$IDNA_LIBS | 564 IDNA_LIBS=$IDNA_LIBS |
392 OPENSSL_LIBS=$OPENSSL_LIBS | 565 OPENSSL_LIBS=$OPENSSL_LIBS |
393 CFLAGS=$CFLAGS | 566 CFLAGS=$CFLAGS |