Annotate

configure @ 12206:77ac0d96ac24

mod_s2s: Enable outgoing Direct TLS connections Makes it faster by cutting out the roundtrips involved in <starttls/>, at the cost of making an additional SRV lookup. Since we already ignore a missing <starttls/> offer and try anyway there is not much difference in security. The fact that XMPP is used and the hostnames involved might still be visible until the future Encrypted ClientHello extension allows hiding those too.
author Kim Alvefur <zash@zash.se>
date Fri, 21 Jan 2022 17:59:19 +0100
parent 11966:4c5087ce3c2e
child 12570:e6f68b6c87e1
child 12825:ee5fcfef5200
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 #!/bin/sh
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 # Defaults
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
5 APP_NAME="Prosody"
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
6 APP_DIRNAME="prosody"
7609
01df17dc06a4 configure: Quote strings
Kim Alvefur <zash@zash.se>
parents: 7608
diff changeset
7 PREFIX="/usr/local"
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
8 SYSCONFDIR="$PREFIX/etc/$APP_DIRNAME"
6574
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 5933
diff changeset
9 LIBDIR="$PREFIX/lib"
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
10 DATADIR="$PREFIX/var/lib/$APP_DIRNAME"
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 LUA_SUFFIX=""
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 LUA_DIR="/usr"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 LUA_BINDIR="/usr/bin"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 LUA_INCDIR="/usr/include"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 LUA_LIBDIR="/usr/lib"
7609
01df17dc06a4 configure: Quote strings
Kim Alvefur <zash@zash.se>
parents: 7608
diff changeset
16 IDN_LIB="idn"
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
17 ICU_FLAGS="-licui18n -licudata -licuuc"
7609
01df17dc06a4 configure: Quote strings
Kim Alvefur <zash@zash.se>
parents: 7608
diff changeset
18 OPENSSL_LIB="crypto"
01df17dc06a4 configure: Quote strings
Kim Alvefur <zash@zash.se>
parents: 7608
diff changeset
19 CC="gcc"
01df17dc06a4 configure: Quote strings
Kim Alvefur <zash@zash.se>
parents: 7608
diff changeset
20 LD="gcc"
01df17dc06a4 configure: Quote strings
Kim Alvefur <zash@zash.se>
parents: 7608
diff changeset
21 RUNWITH="lua"
01df17dc06a4 configure: Quote strings
Kim Alvefur <zash@zash.se>
parents: 7608
diff changeset
22 EXCERTS="yes"
7187
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
23 PRNG=
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
24 PRNGLIBS=
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25
9860
2cf3dcf93d74 configure: Separate flags related to compiler warnings
Kim Alvefur <zash@zash.se>
parents: 9679
diff changeset
26 CFLAGS="-fPIC -std=c99"
9861
84916bbe5985 configure: Enable more compiler warnings
Kim Alvefur <zash@zash.se>
parents: 9860
diff changeset
27 CFLAGS="$CFLAGS -Wall -pedantic -Wextra -Wshadow -Wformat=2"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
28 LDFLAGS="-shared"
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
29
11528
d3b0049e50f5 configure: Make ICU the default library for IDNA and JID normalization
Kim Alvefur <zash@zash.se>
parents: 11009
diff changeset
30 IDN_LIBRARY="icu"
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
31 # Help
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
32
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
33 show_help() {
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
34 cat <<EOF
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
35 Configure $APP_NAME prior to building.
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
36
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
37 --help This help.
7632
2b14e2121700 configure: Add ostype preset for NetBSD
Holger Weiss <holger@zedat.fu-berlin.de>
parents: 7618
diff changeset
38 --ostype=OS Use one of the OS presets. May be one of:
2b14e2121700 configure: Add ostype preset for NetBSD
Holger Weiss <holger@zedat.fu-berlin.de>
parents: 7618
diff changeset
39 debian, macosx, linux, freebsd, openbsd, netbsd
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
40 --prefix=DIR Prefix where $APP_NAME should be installed.
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
41 Default is $PREFIX
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
42 --sysconfdir=DIR Location where the config file should be installed.
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
43 Default is \$PREFIX/etc/$APP_DIRNAME
6574
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 5933
diff changeset
44 --libdir=DIR Location where the server files should be stored.
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 5933
diff changeset
45 Default is \$PREFIX/lib
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
46 --datadir=DIR Location where the server data should be stored.
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
47 Default is \$PREFIX/var/lib/$APP_DIRNAME
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
48 --lua-version=VERSION Use specific Lua version: 5.1, 5.2, or 5.3
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
49 Default is auto-detected.
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
50 --lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
51 Default is "$LUA_SUFFIX" (lua$LUA_SUFFIX...)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
52 --with-lua=PREFIX Use Lua from given prefix.
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
53 Default is auto-detected (the parent directory of \$LUA_BINDIR).
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
54 --with-lua-bin=DIR You can also specify Lua's bin dir.
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
55 Default is the directory of the auto-detected Lua interpreter,
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
56 or \$LUA_DIR/bin if --with-lua is used.
5421
a3f0fe9431cf configure: Add RUNWITH to --help
Kim Alvefur <zash@zash.se>
parents: 5401
diff changeset
57 --runwith=BINARY What Lua binary to set as runtime environment.
a3f0fe9431cf configure: Add RUNWITH to --help
Kim Alvefur <zash@zash.se>
parents: 5401
diff changeset
58 Default is $RUNWITH
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
59 --with-lua-include=DIR You can also specify Lua's includes dir.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
60 Default is \$LUA_DIR/include
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
61 --with-lua-lib=DIR You can also specify Lua's libraries dir.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
62 Default is \$LUA_DIR/lib
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
63 --with-idn=LIB The name of the IDN library to link with.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
64 Default is $IDN_LIB
5422
396072d62695 configure: Replaces tabs with spaces in --help
Kim Alvefur <zash@zash.se>
parents: 5421
diff changeset
65 --idn-library=(idn|icu) Select library to use for IDNA functionality.
11528
d3b0049e50f5 configure: Make ICU the default library for IDNA and JID normalization
Kim Alvefur <zash@zash.se>
parents: 11009
diff changeset
66 idn: use GNU libidn
d3b0049e50f5 configure: Make ICU the default library for IDNA and JID normalization
Kim Alvefur <zash@zash.se>
parents: 11009
diff changeset
67 icu: use ICU from IBM (default)
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
68 --with-ssl=LIB The name of the SSL to link with.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
69 Default is $OPENSSL_LIB
7187
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
70 --with-random=METHOD CSPRNG backend to use. One of
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
71 getrandom: Linux kernel
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
72 arc4random: OpenBSD kernel
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
73 openssl: OpenSSL RAND method
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
74 Default is to use /dev/urandom
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
75 --cflags=FLAGS Flags to pass to the compiler
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
76 Default is $CFLAGS
8282
9495e2cbe666 configure: Add new but undocumented flags to --help
Kim Alvefur <zash@zash.se>
parents: 8281
diff changeset
77 --add-cflags=FLAGS Adds additional CFLAGS, preserving defaults.
9495e2cbe666 configure: Add new but undocumented flags to --help
Kim Alvefur <zash@zash.se>
parents: 8281
diff changeset
78 Can be repeated.
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
79 --ldflags=FLAGS Flags to pass to the linker
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
80 Default is $LDFLAGS
8282
9495e2cbe666 configure: Add new but undocumented flags to --help
Kim Alvefur <zash@zash.se>
parents: 8281
diff changeset
81 --add-ldflags=FLAGS Adds additional linker flags, preserving defaults.
9495e2cbe666 configure: Add new but undocumented flags to --help
Kim Alvefur <zash@zash.se>
parents: 8281
diff changeset
82 Can be repeated.
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
83 --c-compiler=CC The C compiler to use when building modules.
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
84 Default is $CC
8282
9495e2cbe666 configure: Add new but undocumented flags to --help
Kim Alvefur <zash@zash.se>
parents: 8281
diff changeset
85 --compiler-wrapper=WRAPPER Adds a prefix to compiler and linker calls,
9495e2cbe666 configure: Add new but undocumented flags to --help
Kim Alvefur <zash@zash.se>
parents: 8281
diff changeset
86 usable for eg distcc or ccache.
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
87 --linker=CC The linker to use when building modules.
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
88 Default is $LD
5933
56b1f151f4a3 Makefile, configure: Add option for disabling generation of example certificates
Kim Alvefur <zash@zash.se>
parents: 5422
diff changeset
89 --no-example-certs Disables generation of example certificates.
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
90 EOF
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
91 }
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
92
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
93 # Helper functions
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
94
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
95 find_program() {
9418
44a2609d1535 configure: Replace backticks with $()
Matthew Wild <mwild1@gmail.com>
parents: 9417
diff changeset
96 prog=$(command -v "$1" 2>/dev/null)
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
97 if [ -n "$prog" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
98 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
99 dirname "$prog"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
100 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
101 }
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
102
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
103 die() {
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
104 echo "$*"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
105 echo
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
106 echo "configure failed."
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
107 echo
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
108 exit 1
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
109 }
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
110
11966
4c5087ce3c2e configure: Silence warning about echo -n [shellcheck]
Kim Alvefur <zash@zash.se>
parents: 11965
diff changeset
111 # COMPAT SC2039 has been phased out, remove in the future
4c5087ce3c2e configure: Silence warning about echo -n [shellcheck]
Kim Alvefur <zash@zash.se>
parents: 11965
diff changeset
112 # shellcheck disable=SC2039,SC3037
9422
b7aad88c537b configure: Add shellcheck directives to suppress warnings on harmless lines
Matthew Wild <mwild1@gmail.com>
parents: 9421
diff changeset
113 case $(echo -n x) in
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
114 -n*) echo_n_flag='';;
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
115 *) echo_n_flag='-n';;
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
116 esac
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
117
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
118 echo_n() {
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
119 echo $echo_n_flag "$*"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
120 }
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
121
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
122 # ----------------------------------------------------------------------------
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
123 # MAIN PROGRAM
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
124 # ----------------------------------------------------------------------------
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
125
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
126 # Parse options
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
127
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
128 while [ -n "$1" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
129 do
9418
44a2609d1535 configure: Replace backticks with $()
Matthew Wild <mwild1@gmail.com>
parents: 9417
diff changeset
130 value=$(echo "$1" | sed 's/[^=]*.\(.*\)/\1/')
44a2609d1535 configure: Replace backticks with $()
Matthew Wild <mwild1@gmail.com>
parents: 9417
diff changeset
131 key=$(echo "$1" | sed 's/=.*//')
9427
460f08008521 configure: Suppress warning about '~' [SC2088]
Matthew Wild <mwild1@gmail.com>
parents: 9426
diff changeset
132 # shellcheck disable=SC2088
9418
44a2609d1535 configure: Replace backticks with $()
Matthew Wild <mwild1@gmail.com>
parents: 9417
diff changeset
133 if echo "$value" | grep "~" >/dev/null 2>/dev/null
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
134 then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
135 echo
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
136 echo '*WARNING*: the "~" sign is not expanded in flags.'
9422
b7aad88c537b configure: Add shellcheck directives to suppress warnings on harmless lines
Matthew Wild <mwild1@gmail.com>
parents: 9421
diff changeset
137 # shellcheck disable=SC2016
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
138 echo 'If you mean the home directory, use $HOME instead.'
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
139 echo
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
140 fi
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
141 case "$key" in
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
142 --help)
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
143 show_help
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
144 exit 0
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
145 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
146 --prefix)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
147 [ -n "$value" ] || die "Missing value in flag $key."
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
148 PREFIX="$value"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
149 PREFIX_SET=yes
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
150 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
151 --sysconfdir)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
152 [ -n "$value" ] || die "Missing value in flag $key."
1063
b873715ffd96 configure: Honour --sysconfdir parameter; thanks to Michael Scherer
Matthew Wild <mwild1@gmail.com>
parents: 998
diff changeset
153 SYSCONFDIR="$value"
b873715ffd96 configure: Honour --sysconfdir parameter; thanks to Michael Scherer
Matthew Wild <mwild1@gmail.com>
parents: 998
diff changeset
154 SYSCONFDIR_SET=yes
b873715ffd96 configure: Honour --sysconfdir parameter; thanks to Michael Scherer
Matthew Wild <mwild1@gmail.com>
parents: 998
diff changeset
155 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
156 --ostype)
9419
78c58a1089ea configure: Rename OSTYPE variable due to conflict with magic variable with same name on some shells/platforms
Matthew Wild <mwild1@gmail.com>
parents: 9418
diff changeset
157 OSPRESET="$value"
10008
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
158 OSPRESET_SET="yes"
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
159 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
160 --libdir)
6574
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 5933
diff changeset
161 LIBDIR="$value"
6579
5a82ee60e07e configure: Fix for commit cd0088c73daf - update LIBDIR if --prefix is set and --libdir isn't (thanks Medics)
Matthew Wild <mwild1@gmail.com>
parents: 6574
diff changeset
162 LIBDIR_SET=yes
6574
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 5933
diff changeset
163 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
164 --datadir)
7607
d17bc0d0748e configure: Normalize whitespace
Kim Alvefur <zash@zash.se>
parents: 7548
diff changeset
165 DATADIR="$value"
d17bc0d0748e configure: Normalize whitespace
Kim Alvefur <zash@zash.se>
parents: 7548
diff changeset
166 DATADIR_SET=yes
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
167 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
168 --lua-suffix)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
169 [ -n "$value" ] || die "Missing value in flag $key."
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
170 LUA_SUFFIX="$value"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
171 LUA_SUFFIX_SET=yes
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
172 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
173 --lua-version|--with-lua-version)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
174 [ -n "$value" ] || die "Missing value in flag $key."
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
175 LUA_VERSION="$value"
9658
597653fe8ea4 configure: Recognise 5.4 as a valid Lua version
Kim Alvefur <zash@zash.se>
parents: 9657
diff changeset
176 [ "$LUA_VERSION" = "5.1" ] || [ "$LUA_VERSION" = "5.2" ] || [ "$LUA_VERSION" = "5.3" ] || [ "$LUA_VERSION" = "5.4" ] || die "Invalid Lua version in flag $key."
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
177 LUA_VERSION_SET=yes
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
178 ;;
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
179 --with-lua)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
180 [ -n "$value" ] || die "Missing value in flag $key."
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
181 LUA_DIR="$value"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
182 LUA_DIR_SET=yes
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
183 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
184 --with-lua-bin)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
185 [ -n "$value" ] || die "Missing value in flag $key."
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
186 LUA_BINDIR="$value"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
187 LUA_BINDIR_SET=yes
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
188 ;;
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
189 --with-lua-include)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
190 [ -n "$value" ] || die "Missing value in flag $key."
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
191 LUA_INCDIR="$value"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
192 LUA_INCDIR_SET=yes
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
193 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
194 --with-lua-lib)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
195 [ -n "$value" ] || die "Missing value in flag $key."
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
196 LUA_LIBDIR="$value"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
197 LUA_LIBDIR_SET=yes
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
198 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
199 --with-idn)
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
200 IDN_LIB="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
201 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
202 --idn-library)
7607
d17bc0d0748e configure: Normalize whitespace
Kim Alvefur <zash@zash.se>
parents: 7548
diff changeset
203 IDN_LIBRARY="$value"
d17bc0d0748e configure: Normalize whitespace
Kim Alvefur <zash@zash.se>
parents: 7548
diff changeset
204 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
205 --with-ssl)
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
206 OPENSSL_LIB="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
207 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
208 --with-random)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
209 case "$value" in
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
210 getrandom)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
211 PRNG=GETRANDOM
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
212 ;;
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
213 openssl)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
214 PRNG=OPENSSL
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
215 ;;
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
216 arc4random)
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
217 PRNG=ARC4RANDOM
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
218 ;;
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
219 esac
7187
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
220 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
221 --cflags)
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
222 CFLAGS="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
223 ;;
8129
69f8b22b0472 configure: --add-cflags to amend $CFLAGS without replacing existing value(s) #858
Kim Alvefur <zash@zash.se>
parents: 8087
diff changeset
224 --add-cflags)
69f8b22b0472 configure: --add-cflags to amend $CFLAGS without replacing existing value(s) #858
Kim Alvefur <zash@zash.se>
parents: 8087
diff changeset
225 CFLAGS="$CFLAGS $value"
69f8b22b0472 configure: --add-cflags to amend $CFLAGS without replacing existing value(s) #858
Kim Alvefur <zash@zash.se>
parents: 8087
diff changeset
226 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
227 --ldflags)
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
228 LDFLAGS="$value"
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
229 ;;
8130
12440a0043ab configure: --add-ldflags to amend $LDFLAGS without overriding previous value #858
Kim Alvefur <zash@zash.se>
parents: 8129
diff changeset
230 --add-ldflags)
12440a0043ab configure: --add-ldflags to amend $LDFLAGS without overriding previous value #858
Kim Alvefur <zash@zash.se>
parents: 8129
diff changeset
231 LDFLAGS="$LDFLAGS $value"
12440a0043ab configure: --add-ldflags to amend $LDFLAGS without overriding previous value #858
Kim Alvefur <zash@zash.se>
parents: 8129
diff changeset
232 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
233 --c-compiler)
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
234 CC="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
235 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
236 --linker)
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
237 LD="$value"
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
238 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
239 --runwith)
5145
53f741a5a73a configure, Makefile: Allow runtime to be overridden.
Kim Alvefur <zash@zash.se>
parents: 5048
diff changeset
240 RUNWITH="$value"
7943
da791f11e20c configure: Set RUNWITH to lua + lua-suffix unless --runwith is given (fixes #721, #777)
Kim Alvefur <zash@zash.se>
parents: 7942
diff changeset
241 RUNWITH_SET=yes
5145
53f741a5a73a configure, Makefile: Allow runtime to be overridden.
Kim Alvefur <zash@zash.se>
parents: 5048
diff changeset
242 ;;
5933
56b1f151f4a3 Makefile, configure: Add option for disabling generation of example certificates
Kim Alvefur <zash@zash.se>
parents: 5422
diff changeset
243 --no-example-certs)
56b1f151f4a3 Makefile, configure: Add option for disabling generation of example certificates
Kim Alvefur <zash@zash.se>
parents: 5422
diff changeset
244 EXCERTS=
56b1f151f4a3 Makefile, configure: Add option for disabling generation of example certificates
Kim Alvefur <zash@zash.se>
parents: 5422
diff changeset
245 ;;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
246 --compiler-wrapper)
7618
5a09c1166d89 configure: Add --compiler-wrapper flag for using things like ccache or distcc
Kim Alvefur <zash@zash.se>
parents: 7617
diff changeset
247 CC="$value $CC"
5a09c1166d89 configure: Add --compiler-wrapper flag for using things like ccache or distcc
Kim Alvefur <zash@zash.se>
parents: 7617
diff changeset
248 LD="$value $LD"
5a09c1166d89 configure: Add --compiler-wrapper flag for using things like ccache or distcc
Kim Alvefur <zash@zash.se>
parents: 7617
diff changeset
249 ;;
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
250 *)
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
251 die "Error: Unknown flag: $1"
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
252 ;;
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
253 esac
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
254 shift
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
255 done
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
256
10008
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
257 if [ "$OSPRESET_SET" = "yes" ]; then
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
258 # TODO make this a switch?
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
259 if [ "$OSPRESET" = "debian" ]; then
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
260 CFLAGS="$CFLAGS -ggdb"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
261 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
262 if [ "$OSPRESET" = "macosx" ]; then
10010
34bfefb39937 configure: Respect previously set paths in macosx preset
Kim Alvefur <zash@zash.se>
parents: 10009
diff changeset
263 if [ "$LUA_INCDIR_SET" != "yes" ]; then
34bfefb39937 configure: Respect previously set paths in macosx preset
Kim Alvefur <zash@zash.se>
parents: 10009
diff changeset
264 LUA_INCDIR=/usr/local/include;
34bfefb39937 configure: Respect previously set paths in macosx preset
Kim Alvefur <zash@zash.se>
parents: 10009
diff changeset
265 LUA_INCDIR_SET=yes
34bfefb39937 configure: Respect previously set paths in macosx preset
Kim Alvefur <zash@zash.se>
parents: 10009
diff changeset
266 fi
34bfefb39937 configure: Respect previously set paths in macosx preset
Kim Alvefur <zash@zash.se>
parents: 10009
diff changeset
267 if [ "$LUA_LIBDIR_SET" != "yes" ]; then
34bfefb39937 configure: Respect previously set paths in macosx preset
Kim Alvefur <zash@zash.se>
parents: 10009
diff changeset
268 LUA_LIBDIR=/usr/local/lib
34bfefb39937 configure: Respect previously set paths in macosx preset
Kim Alvefur <zash@zash.se>
parents: 10009
diff changeset
269 LUA_LIBDIR_SET=yes
34bfefb39937 configure: Respect previously set paths in macosx preset
Kim Alvefur <zash@zash.se>
parents: 10009
diff changeset
270 fi
10008
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
271 CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
272 LDFLAGS="-bundle -undefined dynamic_lookup"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
273 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
274 if [ "$OSPRESET" = "linux" ]; then
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
275 CFLAGS="$CFLAGS -ggdb"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
276 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
277 if [ "$OSPRESET" = "freebsd" ] || [ "$OSPRESET" = "openbsd" ]; then
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
278 LUA_INCDIR="/usr/local/include/lua51"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
279 LUA_INCDIR_SET=yes
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
280 CFLAGS="-Wall -fPIC -I/usr/local/include"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
281 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
282 LUA_SUFFIX="51"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
283 LUA_SUFFIX_SET=yes
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
284 LUA_DIR=/usr/local
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
285 LUA_DIR_SET=yes
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
286 CC=cc
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
287 LD=ld
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
288 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
289 if [ "$OSPRESET" = "openbsd" ]; then
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
290 LUA_INCDIR="/usr/local/include";
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
291 LUA_INCDIR_SET="yes"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
292 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
293 if [ "$OSPRESET" = "netbsd" ]; then
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
294 LUA_INCDIR="/usr/pkg/include/lua-5.1"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
295 LUA_INCDIR_SET=yes
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
296 LUA_LIBDIR="/usr/pkg/lib/lua/5.1"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
297 LUA_LIBDIR_SET=yes
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
298 CFLAGS="-Wall -fPIC -I/usr/pkg/include"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
299 LDFLAGS="-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib -shared"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
300 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
301 if [ "$OSPRESET" = "pkg-config" ]; then
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
302 if [ "$LUA_SUFFIX_SET" != "yes" ]; then
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
303 LUA_SUFFIX="5.1";
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
304 LUA_SUFFIX_SET=yes
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
305 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
306 LUA_CF="$(pkg-config --cflags-only-I lua$LUA_SUFFIX)"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
307 LUA_CF="${LUA_CF#*-I}"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
308 LUA_CF="${LUA_CF%% *}"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
309 if [ "$LUA_CF" != "" ]; then
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
310 LUA_INCDIR="$LUA_CF"
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
311 LUA_INCDIR_SET=yes
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
312 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
313 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
314 fi
272c436ca5d1 configure: Handle ostype preset after argument processing
Kim Alvefur <zash@zash.se>
parents: 9999
diff changeset
315
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
316 if [ "$PREFIX_SET" = "yes" ] && [ ! "$SYSCONFDIR_SET" = "yes" ]
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
317 then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
318 if [ "$PREFIX" = "/usr" ]
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
319 then SYSCONFDIR=/etc/$APP_DIRNAME
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
320 else SYSCONFDIR=$PREFIX/etc/$APP_DIRNAME
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
321 fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
322 fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
323
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
324 if [ "$PREFIX_SET" = "yes" ] && [ ! "$DATADIR_SET" = "yes" ]
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
325 then
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
326 if [ "$PREFIX" = "/usr" ]
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
327 then DATADIR=/var/lib/$APP_DIRNAME
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
328 else DATADIR=$PREFIX/var/lib/$APP_DIRNAME
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
329 fi
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
330 fi
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
331
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
332 if [ "$PREFIX_SET" = "yes" ] && [ ! "$LIBDIR_SET" = "yes" ]
7945
1f4a0e0b7167 configure: Fix setting libdir if prefix changed
Kim Alvefur <zash@zash.se>
parents: 7943
diff changeset
333 then
1f4a0e0b7167 configure: Fix setting libdir if prefix changed
Kim Alvefur <zash@zash.se>
parents: 7943
diff changeset
334 LIBDIR=$PREFIX/lib
1f4a0e0b7167 configure: Fix setting libdir if prefix changed
Kim Alvefur <zash@zash.se>
parents: 7943
diff changeset
335 fi
1f4a0e0b7167 configure: Fix setting libdir if prefix changed
Kim Alvefur <zash@zash.se>
parents: 7943
diff changeset
336
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
337 detect_lua_version() {
9658
597653fe8ea4 configure: Recognise 5.4 as a valid Lua version
Kim Alvefur <zash@zash.se>
parents: 9657
diff changeset
338 detected_lua=$("$1" -e 'print(_VERSION:match(" (5%.[1234])$"))' 2> /dev/null)
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
339 if [ "$detected_lua" != "nil" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
340 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
341 if [ "$LUA_VERSION_SET" != "yes" ]
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
342 then
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
343 echo "Lua version detected: $detected_lua"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
344 LUA_VERSION=$detected_lua
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
345 return 0
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
346 elif [ "$LUA_VERSION" = "$detected_lua" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
347 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
348 return 0
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
349 fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
350 fi
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
351 return 1
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
352 }
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
353
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
354 search_interpreter() {
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
355 suffix="$1"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
356 if [ "$LUA_BINDIR_SET" = "yes" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
357 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
358 find_lua="$LUA_BINDIR"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
359 elif [ "$LUA_DIR_SET" = "yes" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
360 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
361 LUA_BINDIR="$LUA_DIR/bin"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
362 if [ -f "$LUA_BINDIR/lua$suffix" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
363 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
364 find_lua="$LUA_BINDIR"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
365 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
366 else
9418
44a2609d1535 configure: Replace backticks with $()
Matthew Wild <mwild1@gmail.com>
parents: 9417
diff changeset
367 find_lua=$(find_program lua"$suffix")
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
368 fi
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
369 if [ -n "$find_lua" ] && [ -x "$find_lua/lua$suffix" ]
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
370 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
371 if detect_lua_version "$find_lua/lua$suffix"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
372 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
373 echo "Lua interpreter found: $find_lua/lua$suffix..."
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
374 if [ "$LUA_BINDIR_SET" != "yes" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
375 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
376 LUA_BINDIR="$find_lua"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
377 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
378 if [ "$LUA_DIR_SET" != "yes" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
379 then
9418
44a2609d1535 configure: Replace backticks with $()
Matthew Wild <mwild1@gmail.com>
parents: 9417
diff changeset
380 LUA_DIR=$(dirname "$find_lua")
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
381 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
382 LUA_SUFFIX="$suffix"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
383 return 0
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
384 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
385 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
386 return 1
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
387 }
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
388
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
389 lua_interp_found=no
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
390 if [ "$LUA_SUFFIX_SET" != "yes" ]
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
391 then
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
392 if [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.1" ]
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
393 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
394 suffixes="5.1 51 -5.1 -51"
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
395 elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.2" ]
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
396 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
397 suffixes="5.2 52 -5.2 -52"
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
398 elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.3" ]
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
399 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
400 suffixes="5.3 53 -5.3 -53"
9658
597653fe8ea4 configure: Recognise 5.4 as a valid Lua version
Kim Alvefur <zash@zash.se>
parents: 9657
diff changeset
401 elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.4" ]
597653fe8ea4 configure: Recognise 5.4 as a valid Lua version
Kim Alvefur <zash@zash.se>
parents: 9657
diff changeset
402 then
597653fe8ea4 configure: Recognise 5.4 as a valid Lua version
Kim Alvefur <zash@zash.se>
parents: 9657
diff changeset
403 suffixes="5.4 54 -5.4 -54"
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
404 else
9657
bd75edf0e0e2 configure: Split list of possible suffixes into a line per Lua version
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
405 suffixes="5.1 51 -5.1 -51"
bd75edf0e0e2 configure: Split list of possible suffixes into a line per Lua version
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
406 suffixes="$suffixes 5.2 52 -5.2 -52"
bd75edf0e0e2 configure: Split list of possible suffixes into a line per Lua version
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
407 suffixes="$suffixes 5.3 53 -5.3 -53"
9658
597653fe8ea4 configure: Recognise 5.4 as a valid Lua version
Kim Alvefur <zash@zash.se>
parents: 9657
diff changeset
408 suffixes="$suffixes 5.4 54 -5.4 -54"
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
409 fi
9420
3b8c4b2c6ba1 configure: Remove unnecessary 'echo'
Matthew Wild <mwild1@gmail.com>
parents: 9419
diff changeset
410 for suffix in "" $suffixes
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
411 do
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
412 search_interpreter "$suffix" && {
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
413 lua_interp_found=yes
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
414 break
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
415 }
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
416 done
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
417 else
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
418 search_interpreter "$LUA_SUFFIX" && {
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
419 lua_interp_found=yes
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
420 }
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
421 fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
422
9998
c8646f65767a configure: Handle lua being found in /bin (workaround for #1353)
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
423 # See #1353
c8646f65767a configure: Handle lua being found in /bin (workaround for #1353)
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
424 if [ "$LUA_DIR_SET" != "yes" ] && [ "$LUA_DIR" = "/" ]
c8646f65767a configure: Handle lua being found in /bin (workaround for #1353)
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
425 then
c8646f65767a configure: Handle lua being found in /bin (workaround for #1353)
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
426 LUA_DIR="/usr"
c8646f65767a configure: Handle lua being found in /bin (workaround for #1353)
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
427 fi
c8646f65767a configure: Handle lua being found in /bin (workaround for #1353)
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
428
c8646f65767a configure: Handle lua being found in /bin (workaround for #1353)
Kim Alvefur <zash@zash.se>
parents: 9427
diff changeset
429
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
430 if [ "$lua_interp_found" != "yes" ] && [ "$RUNWITH_SET" != "yes" ]
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
431 then
9421
03b50f5bd8cd configure: Replace logic constructs with explicit if/else statements
Matthew Wild <mwild1@gmail.com>
parents: 9420
diff changeset
432 if [ "$LUA_VERSION_SET" ]; then
03b50f5bd8cd configure: Replace logic constructs with explicit if/else statements
Matthew Wild <mwild1@gmail.com>
parents: 9420
diff changeset
433 interp="Lua $LUA_VERSION";
03b50f5bd8cd configure: Replace logic constructs with explicit if/else statements
Matthew Wild <mwild1@gmail.com>
parents: 9420
diff changeset
434 else
03b50f5bd8cd configure: Replace logic constructs with explicit if/else statements
Matthew Wild <mwild1@gmail.com>
parents: 9420
diff changeset
435 interp="Lua";
03b50f5bd8cd configure: Replace logic constructs with explicit if/else statements
Matthew Wild <mwild1@gmail.com>
parents: 9420
diff changeset
436 fi
9426
e290a60f1f09 configure: Replace use of '-o' with '||' [SC2166]
Matthew Wild <mwild1@gmail.com>
parents: 9425
diff changeset
437 if [ "$LUA_DIR_SET" ] || [ "$LUA_BINDIR_SET" ]; then
9421
03b50f5bd8cd configure: Replace logic constructs with explicit if/else statements
Matthew Wild <mwild1@gmail.com>
parents: 9420
diff changeset
438 where="$LUA_BINDIR";
03b50f5bd8cd configure: Replace logic constructs with explicit if/else statements
Matthew Wild <mwild1@gmail.com>
parents: 9420
diff changeset
439 else
03b50f5bd8cd configure: Replace logic constructs with explicit if/else statements
Matthew Wild <mwild1@gmail.com>
parents: 9420
diff changeset
440 where="\$PATH";
03b50f5bd8cd configure: Replace logic constructs with explicit if/else statements
Matthew Wild <mwild1@gmail.com>
parents: 9420
diff changeset
441 fi
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
442 echo "$interp interpreter not found in $where"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
443 die "You may want to use the flags --with-lua, --with-lua-bin and/or --lua-suffix. See --help."
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
444 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
445
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
446 if [ "$LUA_VERSION_SET" = "yes" ] && [ "$RUNWITH_SET" != "yes" ]
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
447 then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
448 echo_n "Checking if $LUA_BINDIR/lua$LUA_SUFFIX is Lua version $LUA_VERSION... "
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
449 if detect_lua_version "$LUA_BINDIR/lua$LUA_SUFFIX"
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
450 then
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
451 echo "yes"
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
452 else
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
453 echo "no"
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
454 die "You may want to use the flags --with-lua, --with-lua-bin and/or --lua-suffix. See --help."
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
455 fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
456 fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
457
6810
533fd843d91f configure, Makefile: Make compatible with plain Bourne shell as used on Solaris. Fixes #418 (thanks jcea)
Matthew Wild <mwild1@gmail.com>
parents: 6635
diff changeset
458 if [ "$LUA_INCDIR_SET" != "yes" ]
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
459 then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
460 LUA_INCDIR="$LUA_DIR/include"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
461 fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
462
6810
533fd843d91f configure, Makefile: Make compatible with plain Bourne shell as used on Solaris. Fixes #418 (thanks jcea)
Matthew Wild <mwild1@gmail.com>
parents: 6635
diff changeset
463 if [ "$LUA_LIBDIR_SET" != "yes" ]
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
464 then
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
465 LUA_LIBDIR="$LUA_DIR/lib"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
466 fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
467
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
468 lua_h="$LUA_INCDIR/lua.h"
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
469 echo_n "Looking for lua.h at $lua_h..."
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
470 if [ -f "$lua_h" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
471 then
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
472 echo found
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
473 else
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
474 echo "not found"
9678
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
475 for postfix in "$LUA_VERSION" "$LUA_SUFFIX"; do
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
476 if ! [ "$postfix" = "" ]; then
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
477 v_dir="$LUA_INCDIR/lua/$postfix";
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
478 else
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
479 v_dir="$LUA_INCDIR/lua";
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
480 fi
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
481 lua_h="$v_dir/lua.h"
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
482 echo_n "Looking for lua.h at $lua_h..."
9678
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
483 if [ -f "$lua_h" ]
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
484 then
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
485 LUA_INCDIR="$v_dir"
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
486 echo found
9678
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
487 break;
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
488 else
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
489 echo "not found"
9678
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
490 d_dir="$LUA_INCDIR/lua$postfix"
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
491 lua_h="$d_dir/lua.h"
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
492 echo_n "Looking for lua.h at $lua_h..."
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
493 if [ -f "$lua_h" ]
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
494 then
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
495 echo found
9678
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
496 LUA_INCDIR="$d_dir"
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
497 break;
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
498 else
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
499 echo "not found"
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
500 fi
9678
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
501 fi
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
502 done
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
503 if [ ! -f "$lua_h" ]; then
9679
4f02aaf40ee9 configure: Refactor header search to make it more portable
Matthew Wild <mwild1@gmail.com>
parents: 9678
diff changeset
504 echo "lua.h not found."
9678
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
505 echo
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
506 die "You may want to use the flag --with-lua or --with-lua-include. See --help."
6178b491fe28 configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
Matthew Wild <mwild1@gmail.com>
parents: 9658
diff changeset
507 fi
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
508 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
509
8087
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
510 if [ "$lua_interp_found" = "yes" ]
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
511 then
8087
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
512 echo_n "Checking if Lua header version matches that of the interpreter... "
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
513 header_version=$(sed -n 's/.*LUA_VERSION_NUM.*5.\(.\).*/5.\1/p' "$lua_h")
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
514 if [ "$header_version" = "$LUA_VERSION" ]
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
515 then
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
516 echo "yes"
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
517 else
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
518 echo "no"
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
519 echo "lua.h version mismatch (interpreter: $LUA_VERSION; lua.h: $header_version)."
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
520 die "You may want to use the flag --with-lua or --with-lua-include. See --help."
eb38f3b919be configure: Skip some interpreter checks if --runwith is set
Kim Alvefur <zash@zash.se>
parents: 8086
diff changeset
521 fi
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
522 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
523
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
524 if [ "$IDN_LIBRARY" = "icu" ]
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
525 then
7607
d17bc0d0748e configure: Normalize whitespace
Kim Alvefur <zash@zash.se>
parents: 7548
diff changeset
526 IDNA_LIBS="$ICU_FLAGS"
11009
74ef9f2334f3 configure: Pass compiler flag to enable ICU only when building util.encodings
Kim Alvefur <zash@zash.se>
parents: 10010
diff changeset
527 IDNA_FLAGS="-DUSE_STRINGPREP_ICU"
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
528 fi
5641
92ffddd02c96 configure: Fix poor layout
James Callahan <james@chatid.com>
parents: 5422
diff changeset
529 if [ "$IDN_LIBRARY" = "idn" ]
3764
323169f229fa Make libidn default when not specifiying a IDN lib.
Tobias Markmann <tm@ayena.de>
parents: 3763
diff changeset
530 then
7607
d17bc0d0748e configure: Normalize whitespace
Kim Alvefur <zash@zash.se>
parents: 7548
diff changeset
531 IDNA_LIBS="-l$IDN_LIB"
3764
323169f229fa Make libidn default when not specifiying a IDN lib.
Tobias Markmann <tm@ayena.de>
parents: 3763
diff changeset
532 fi
323169f229fa Make libidn default when not specifiying a IDN lib.
Tobias Markmann <tm@ayena.de>
parents: 3763
diff changeset
533
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
534 if [ -f config.unix ]; then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
535 rm -f config.unix
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
536 fi
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
537
7943
da791f11e20c configure: Set RUNWITH to lua + lua-suffix unless --runwith is given (fixes #721, #777)
Kim Alvefur <zash@zash.se>
parents: 7942
diff changeset
538 if [ "$RUNWITH_SET" != yes ]; then
da791f11e20c configure: Set RUNWITH to lua + lua-suffix unless --runwith is given (fixes #721, #777)
Kim Alvefur <zash@zash.se>
parents: 7942
diff changeset
539 RUNWITH="lua$LUA_SUFFIX"
da791f11e20c configure: Set RUNWITH to lua + lua-suffix unless --runwith is given (fixes #721, #777)
Kim Alvefur <zash@zash.se>
parents: 7942
diff changeset
540 fi
da791f11e20c configure: Set RUNWITH to lua + lua-suffix unless --runwith is given (fixes #721, #777)
Kim Alvefur <zash@zash.se>
parents: 7942
diff changeset
541
6886
27f5a76e3fa5 configure,util-src/Makefile: Make a variable that includes -l for OpenSSL (like with IDNA_LIBS)
Kim Alvefur <zash@zash.se>
parents: 6878
diff changeset
542 OPENSSL_LIBS="-l$OPENSSL_LIB"
27f5a76e3fa5 configure,util-src/Makefile: Make a variable that includes -l for OpenSSL (like with IDNA_LIBS)
Kim Alvefur <zash@zash.se>
parents: 6878
diff changeset
543
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
544 if [ "$PRNG" = "OPENSSL" ]; then
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
545 PRNGLIBS=$OPENSSL_LIBS
9425
b741e9b9593b configure: Fix incorrect syntax of '&&' in previous commit
Matthew Wild <mwild1@gmail.com>
parents: 9424
diff changeset
546 elif [ "$PRNG" = "ARC4RANDOM" ] && [ "$(uname)" = "Linux" ]; then
8448
f516a52f19e8 util.crand: Make it possible to use arc4random on Linux (needs libbsd)
Kim Alvefur <zash@zash.se>
parents: 8284
diff changeset
547 PRNGLIBS="-lbsd"
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
548 fi
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
549
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
550 # Write config
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
551
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
552 echo "Writing configuration..."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
553 echo
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
554
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
555 rm -f built
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
556 cat <<EOF > config.unix
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
557 # This file was automatically generated by the configure script.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
558 # Run "./configure --help" for details.
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
559
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
560 LUA_VERSION=$LUA_VERSION
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
561 PREFIX=$PREFIX
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
562 SYSCONFDIR=$SYSCONFDIR
6574
cd0088c73daf configure, Makefile: Add --libdir option to ./configure, allowing you to override the $PREFIX/lib/ default. Fixes #470.
Matthew Wild <mwild1@gmail.com>
parents: 5933
diff changeset
563 LIBDIR=$LIBDIR
502
21dc299387a6 Installation improvements (auto-creation of data directories)
Matthew Wild <mwild1@gmail.com>
parents: 467
diff changeset
564 DATADIR=$DATADIR
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
565 LUA_SUFFIX=$LUA_SUFFIX
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
566 LUA_DIR=$LUA_DIR
7942
21a25b29ebeb configure: Merge with configure from LuaRocks (which it was originally based on apparently)
Kim Alvefur <zash@zash.se>
parents: 7935
diff changeset
567 LUA_DIR_SET=$LUA_DIR_SET
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
568 LUA_INCDIR=$LUA_INCDIR
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
569 LUA_LIBDIR=$LUA_LIBDIR
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
570 LUA_BINDIR=$LUA_BINDIR
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
571 IDN_LIB=$IDN_LIB
11009
74ef9f2334f3 configure: Pass compiler flag to enable ICU only when building util.encodings
Kim Alvefur <zash@zash.se>
parents: 10010
diff changeset
572 IDNA_FLAGS=$IDNA_FLAGS
3762
f02bac902a1e util.encodings: Support for ICU for IDNA operations.
Tobias Markmann <tm@ayena.de>
parents: 3352
diff changeset
573 IDNA_LIBS=$IDNA_LIBS
6886
27f5a76e3fa5 configure,util-src/Makefile: Make a variable that includes -l for OpenSSL (like with IDNA_LIBS)
Kim Alvefur <zash@zash.se>
parents: 6878
diff changeset
574 OPENSSL_LIBS=$OPENSSL_LIBS
511
f9ab28562fda Potential fixes for building on Mac OSX
Matthew Wild <mwild1@gmail.com>
parents: 502
diff changeset
575 CFLAGS=$CFLAGS
2315
174b4a83f5b7 configure: Add 'linux' ostype and rename lflags to LDFLAGS to match expectations.
Brian Cully <bjc@junctionnetworks.com>
parents: 1081
diff changeset
576 LDFLAGS=$LDFLAGS
798
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
577 CC=$CC
2a92b58144a9 Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!
Matthew Wild <mwild1@gmail.com>
parents: 536
diff changeset
578 LD=$LD
5145
53f741a5a73a configure, Makefile: Allow runtime to be overridden.
Kim Alvefur <zash@zash.se>
parents: 5048
diff changeset
579 RUNWITH=$RUNWITH
5933
56b1f151f4a3 Makefile, configure: Add option for disabling generation of example certificates
Kim Alvefur <zash@zash.se>
parents: 5422
diff changeset
580 EXCERTS=$EXCERTS
7187
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
581 RANDOM=$PRNG
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
582 RANDOM_LIBS=$PRNGLIBS
3d2c2f0809ee util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Kim Alvefur <zash@zash.se>
parents: 6886
diff changeset
583
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
584
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
585 EOF
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
586
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
587 echo "Installation prefix: $PREFIX"
7987
b3ee697158b5 configure: Move name and directory name into a variable for easier comparison with similar scripts
Kim Alvefur <zash@zash.se>
parents: 7964
diff changeset
588 echo "$APP_NAME configuration directory: $SYSCONFDIR"
463
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
589 echo "Using Lua from: $LUA_DIR"
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
590
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
591 make clean > /dev/null 2> /dev/null
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
592
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
593 echo
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
594 echo "Done. You can now run 'make' to build."
a2452d3bd828 Add a top-level Makefile and ./configure script. Update util-src Makefile for this.
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
595 echo