aboutsummaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure198
1 files changed, 108 insertions, 90 deletions
diff --git a/configure b/configure
index 0fe186b5..784d7339 100755
--- a/configure
+++ b/configure
@@ -23,10 +23,11 @@ EXCERTS="yes"
PRNG=
PRNGLIBS=
-CFLAGS="-fPIC -Wall -pedantic -std=c99"
+CFLAGS="-fPIC -std=c99"
+CFLAGS="$CFLAGS -Wall -pedantic -Wextra -Wshadow -Wformat=2"
LDFLAGS="-shared"
-IDN_LIBRARY="idn"
+IDN_LIBRARY="icu"
# Help
show_help() {
@@ -62,8 +63,8 @@ Configure $APP_NAME prior to building.
--with-idn=LIB The name of the IDN library to link with.
Default is $IDN_LIB
--idn-library=(idn|icu) Select library to use for IDNA functionality.
- idn: use GNU libidn (default)
- icu: use ICU from IBM
+ idn: use GNU libidn
+ icu: use ICU from IBM (default)
--with-ssl=LIB The name of the SSL to link with.
Default is $OPENSSL_LIB
--with-random=METHOD CSPRNG backend to use. One of
@@ -107,7 +108,8 @@ die() {
exit 1
}
-# shellcheck disable=SC2039
+# COMPAT SC2039 has been phased out, remove in the future
+# shellcheck disable=SC2039,SC3037
case $(echo -n x) in
-n*) echo_n_flag='';;
*) echo_n_flag='-n';;
@@ -152,74 +154,8 @@ do
SYSCONFDIR_SET=yes
;;
--ostype)
- # TODO make this a switch?
OSPRESET="$value"
- if [ "$OSPRESET" = "debian" ]; then
- if [ "$LUA_SUFFIX_SET" != "yes" ]; then
- LUA_SUFFIX="5.1";
- LUA_SUFFIX_SET=yes
- fi
- if [ "$RUNWITH_SET" != "yes" ]; then
- RUNWITH="lua$LUA_SUFFIX";
- RUNWITH_SET=yes
- fi
- LUA_INCDIR="/usr/include/lua$LUA_SUFFIX"
- LUA_INCDIR_SET=yes
- CFLAGS="$CFLAGS -ggdb"
- fi
- if [ "$OSPRESET" = "macosx" ]; then
- LUA_INCDIR=/usr/local/include;
- LUA_INCDIR_SET=yes
- LUA_LIBDIR=/usr/local/lib
- LUA_LIBDIR_SET=yes
- CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
- LDFLAGS="-bundle -undefined dynamic_lookup"
- fi
- if [ "$OSPRESET" = "linux" ]; then
- LUA_INCDIR=/usr/local/include;
- LUA_INCDIR_SET=yes
- LUA_LIBDIR=/usr/local/lib
- LUA_LIBDIR_SET=yes
- CFLAGS="$CFLAGS -ggdb"
- fi
- if [ "$OSPRESET" = "freebsd" ] || [ "$OSPRESET" = "openbsd" ]; then
- LUA_INCDIR="/usr/local/include/lua51"
- LUA_INCDIR_SET=yes
- CFLAGS="-Wall -fPIC -I/usr/local/include"
- LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
- LUA_SUFFIX="51"
- LUA_SUFFIX_SET=yes
- LUA_DIR=/usr/local
- LUA_DIR_SET=yes
- CC=cc
- LD=ld
- fi
- if [ "$OSPRESET" = "openbsd" ]; then
- LUA_INCDIR="/usr/local/include";
- LUA_INCDIR_SET="yes"
- fi
- if [ "$OSPRESET" = "netbsd" ]; then
- LUA_INCDIR="/usr/pkg/include/lua-5.1"
- LUA_INCDIR_SET=yes
- LUA_LIBDIR="/usr/pkg/lib/lua/5.1"
- LUA_LIBDIR_SET=yes
- CFLAGS="-Wall -fPIC -I/usr/pkg/include"
- LDFLAGS="-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib -shared"
- fi
- if [ "$OSPRESET" = "pkg-config" ]; then
- if [ "$LUA_SUFFIX_SET" != "yes" ]; then
- LUA_SUFFIX="5.1";
- LUA_SUFFIX_SET=yes
- fi
- LUA_CF="$(pkg-config --cflags-only-I lua$LUA_SUFFIX)"
- LUA_CF="${LUA_CF#*-I}"
- LUA_CF="${LUA_CF%% *}"
- if [ "$LUA_CF" != "" ]; then
- LUA_INCDIR="$LUA_CF"
- LUA_INCDIR_SET=yes
- fi
- CFLAGS="$CFLAGS"
- fi
+ OSPRESET_SET="yes"
;;
--libdir)
LIBDIR="$value"
@@ -237,7 +173,7 @@ do
--lua-version|--with-lua-version)
[ -n "$value" ] || die "Missing value in flag $key."
LUA_VERSION="$value"
- [ "$LUA_VERSION" = "5.1" ] || [ "$LUA_VERSION" = "5.2" ] || [ "$LUA_VERSION" = "5.3" ] || die "Invalid Lua version in flag $key."
+ [ "$LUA_VERSION" = "5.1" ] || [ "$LUA_VERSION" = "5.2" ] || [ "$LUA_VERSION" = "5.3" ] || [ "$LUA_VERSION" = "5.4" ] || die "Invalid Lua version in flag $key."
LUA_VERSION_SET=yes
;;
--with-lua)
@@ -318,6 +254,65 @@ do
shift
done
+if [ "$OSPRESET_SET" = "yes" ]; then
+ # TODO make this a switch?
+ if [ "$OSPRESET" = "debian" ]; then
+ CFLAGS="$CFLAGS -ggdb"
+ fi
+ if [ "$OSPRESET" = "macosx" ]; then
+ if [ "$LUA_INCDIR_SET" != "yes" ]; then
+ LUA_INCDIR=/usr/local/include;
+ LUA_INCDIR_SET=yes
+ fi
+ if [ "$LUA_LIBDIR_SET" != "yes" ]; then
+ LUA_LIBDIR=/usr/local/lib
+ LUA_LIBDIR_SET=yes
+ fi
+ CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
+ LDFLAGS="-bundle -undefined dynamic_lookup"
+ fi
+ if [ "$OSPRESET" = "linux" ]; then
+ CFLAGS="$CFLAGS -ggdb"
+ fi
+ if [ "$OSPRESET" = "freebsd" ] || [ "$OSPRESET" = "openbsd" ]; then
+ LUA_INCDIR="/usr/local/include/lua51"
+ LUA_INCDIR_SET=yes
+ CFLAGS="-Wall -fPIC -I/usr/local/include"
+ LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
+ LUA_SUFFIX="51"
+ LUA_SUFFIX_SET=yes
+ LUA_DIR=/usr/local
+ LUA_DIR_SET=yes
+ CC=cc
+ LD=ld
+ fi
+ if [ "$OSPRESET" = "openbsd" ]; then
+ LUA_INCDIR="/usr/local/include";
+ LUA_INCDIR_SET="yes"
+ fi
+ if [ "$OSPRESET" = "netbsd" ]; then
+ LUA_INCDIR="/usr/pkg/include/lua-5.1"
+ LUA_INCDIR_SET=yes
+ LUA_LIBDIR="/usr/pkg/lib/lua/5.1"
+ LUA_LIBDIR_SET=yes
+ CFLAGS="-Wall -fPIC -I/usr/pkg/include"
+ LDFLAGS="-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib -shared"
+ fi
+ if [ "$OSPRESET" = "pkg-config" ]; then
+ if [ "$LUA_SUFFIX_SET" != "yes" ]; then
+ LUA_SUFFIX="5.1";
+ LUA_SUFFIX_SET=yes
+ fi
+ LUA_CF="$(pkg-config --cflags-only-I lua$LUA_SUFFIX)"
+ LUA_CF="${LUA_CF#*-I}"
+ LUA_CF="${LUA_CF%% *}"
+ if [ "$LUA_CF" != "" ]; then
+ LUA_INCDIR="$LUA_CF"
+ LUA_INCDIR_SET=yes
+ fi
+ fi
+fi
+
if [ "$PREFIX_SET" = "yes" ] && [ ! "$SYSCONFDIR_SET" = "yes" ]
then
if [ "$PREFIX" = "/usr" ]
@@ -340,7 +335,7 @@ then
fi
detect_lua_version() {
- detected_lua=$("$1" -e 'print(_VERSION:match(" (5%.[123])$"))' 2> /dev/null)
+ detected_lua=$("$1" -e 'print(_VERSION:match(" (5%.[1234])$"))' 2> /dev/null)
if [ "$detected_lua" != "nil" ]
then
if [ "$LUA_VERSION_SET" != "yes" ]
@@ -403,8 +398,14 @@ then
elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.3" ]
then
suffixes="5.3 53 -5.3 -53"
+ elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.4" ]
+ then
+ suffixes="5.4 54 -5.4 -54"
else
- suffixes="5.1 51 -5.1 -51 5.2 52 -5.2 -52 5.3 53 -5.3 -53"
+ suffixes="5.1 51 -5.1 -51"
+ suffixes="$suffixes 5.2 52 -5.2 -52"
+ suffixes="$suffixes 5.3 53 -5.3 -53"
+ suffixes="$suffixes 5.4 54 -5.4 -54"
fi
for suffix in "" $suffixes
do
@@ -464,30 +465,46 @@ then
LUA_LIBDIR="$LUA_DIR/lib"
fi
-echo_n "Checking Lua includes... "
lua_h="$LUA_INCDIR/lua.h"
+echo_n "Looking for lua.h at $lua_h..."
if [ -f "$lua_h" ]
then
- echo "lua.h found in $lua_h"
+ echo found
else
- v_dir="$LUA_INCDIR/lua/$LUA_VERSION"
- lua_h="$v_dir/lua.h"
- if [ -f "$lua_h" ]
- then
- echo "lua.h found in $lua_h"
+ echo "not found"
+ for postfix in "$LUA_VERSION" "$LUA_SUFFIX"; do
+ if ! [ "$postfix" = "" ]; then
+ v_dir="$LUA_INCDIR/lua/$postfix";
+ else
+ v_dir="$LUA_INCDIR/lua";
+ fi
+ lua_h="$v_dir/lua.h"
+ echo_n "Looking for lua.h at $lua_h..."
+ if [ -f "$lua_h" ]
+ then
LUA_INCDIR="$v_dir"
- else
- d_dir="$LUA_INCDIR/lua$LUA_VERSION"
+ echo found
+ break;
+ else
+ echo "not found"
+ d_dir="$LUA_INCDIR/lua$postfix"
lua_h="$d_dir/lua.h"
+ echo_n "Looking for lua.h at $lua_h..."
if [ -f "$lua_h" ]
then
- echo "lua.h found in $lua_h (Debian/Ubuntu)"
- LUA_INCDIR="$d_dir"
+ echo found
+ LUA_INCDIR="$d_dir"
+ break;
else
- echo "lua.h not found (looked in $LUA_INCDIR, $v_dir, $d_dir)"
- die "You may want to use the flag --with-lua or --with-lua-include. See --help."
+ echo "not found"
fi
- fi
+ fi
+ done
+ if [ ! -f "$lua_h" ]; then
+ echo "lua.h not found."
+ echo
+ die "You may want to use the flag --with-lua or --with-lua-include. See --help."
+ fi
fi
if [ "$lua_interp_found" = "yes" ]
@@ -507,7 +524,7 @@ fi
if [ "$IDN_LIBRARY" = "icu" ]
then
IDNA_LIBS="$ICU_FLAGS"
- CFLAGS="$CFLAGS -DUSE_STRINGPREP_ICU"
+ IDNA_FLAGS="-DUSE_STRINGPREP_ICU"
fi
if [ "$IDN_LIBRARY" = "idn" ]
then
@@ -552,6 +569,7 @@ LUA_INCDIR=$LUA_INCDIR
LUA_LIBDIR=$LUA_LIBDIR
LUA_BINDIR=$LUA_BINDIR
IDN_LIB=$IDN_LIB
+IDNA_FLAGS=$IDNA_FLAGS
IDNA_LIBS=$IDNA_LIBS
OPENSSL_LIBS=$OPENSSL_LIBS
CFLAGS=$CFLAGS