2018-06-06 05:35:27 +02:00
|
|
|
#! /bin/sh
|
|
|
|
# Simple configure script for c-lightning.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
CONFIGURATOR=ccan/tools/configurator/configurator
|
|
|
|
CONFIG_VAR_FILE=config.vars
|
|
|
|
CONFIG_HEADER=ccan/config.h
|
2019-05-25 10:25:18 +02:00
|
|
|
BASE_WARNFLAGS="-Wall -Wundef -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wold-style-definition -Werror"
|
2018-06-06 05:35:27 +02:00
|
|
|
|
2020-08-29 10:13:52 +02:00
|
|
|
: ${PKG_CONFIG=pkg-config}
|
|
|
|
|
2020-08-29 04:58:19 +02:00
|
|
|
# You can set PG_CONFIG in the environment to direct configure to call
|
|
|
|
# a specific 'pg_config' binary. If you set it to an empty string, then
|
|
|
|
# PostgreSQL support will be explicitly disabled, even if a 'pg_config'
|
|
|
|
# binary exists in your PATH. If you leave it unset, then the following
|
|
|
|
# line enables the automagic detection that most users want.
|
|
|
|
: ${PG_CONFIG=pg_config}
|
|
|
|
|
2018-06-06 05:35:27 +02:00
|
|
|
usage_with_default()
|
|
|
|
{
|
|
|
|
if [ $# = 4 ]; then
|
2018-06-14 04:14:14 +02:00
|
|
|
if [ "$2" = 1 ]; then
|
2018-06-06 05:35:27 +02:00
|
|
|
DEF=$3
|
2018-06-14 04:14:14 +02:00
|
|
|
else
|
|
|
|
DEF=$4
|
2018-06-06 05:35:27 +02:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
DEF=$2
|
|
|
|
fi
|
|
|
|
echo " $1 (default $DEF)"
|
|
|
|
}
|
|
|
|
|
2019-05-25 09:43:43 +02:00
|
|
|
# Given DEVELOPER, what COPTFLAGS do we default to.
|
|
|
|
default_coptflags()
|
|
|
|
{
|
|
|
|
if [ "$1" = 0 ]; then
|
|
|
|
echo "-Og"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-05-25 10:25:18 +02:00
|
|
|
# Given COPTFLAGS, HAVE_GCC and HAVE_MODERN_GCC, what CWARNFLAGS to default to?
|
2019-05-25 09:43:43 +02:00
|
|
|
default_cwarnflags()
|
|
|
|
{
|
2019-05-25 10:25:18 +02:00
|
|
|
F=$BASE_WARNFLAGS
|
2019-07-31 12:29:26 +02:00
|
|
|
# Clang doesn't like -Wno-maybe-uninitialized, but doesn't seem
|
2019-05-25 10:25:18 +02:00
|
|
|
# to give spurious warnings, either.
|
|
|
|
if [ "$2" = 1 ]; then
|
|
|
|
# With old gccs, or optimization != -O3, we need to suppress some warnings.
|
|
|
|
if [ -n "${1##*-O3*}" ] || [ "$3" != "1" ]; then
|
2019-07-31 12:29:26 +02:00
|
|
|
F="$F -Wno-maybe-uninitialized"
|
2019-05-25 10:25:18 +02:00
|
|
|
fi
|
2019-05-25 09:43:43 +02:00
|
|
|
fi
|
2019-05-25 10:25:18 +02:00
|
|
|
echo "$F"
|
2019-05-25 09:43:43 +02:00
|
|
|
}
|
|
|
|
|
2019-06-06 02:51:41 +02:00
|
|
|
default_pytest()
|
|
|
|
{
|
|
|
|
PYTEST_BINS="pytest-3 pytest3 pytest py.test"
|
|
|
|
for p in $PYTEST_BINS; do
|
|
|
|
if [ "$(which $p)" != "" ] ; then
|
|
|
|
"$p" --version 2>&1 | grep -q "python3" || continue
|
|
|
|
echo "$p"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
PYTHON_BINS="python python3"
|
|
|
|
for p in $PYTHON_BINS; do
|
|
|
|
if [ "$(which $p)" != "" ] ; then
|
|
|
|
$p --version 2>&1 | grep -q "Python 3." || continue
|
|
|
|
if $p -c "import pytest" 2>/dev/null ; then
|
|
|
|
echo "$p -m pytest"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2020-08-31 03:22:59 +02:00
|
|
|
check_command()
|
2019-08-21 02:52:51 +02:00
|
|
|
{
|
|
|
|
name="$1"
|
2020-08-31 03:22:59 +02:00
|
|
|
shift 1
|
2019-08-21 02:52:51 +02:00
|
|
|
|
|
|
|
echo -n "checking for $name... "
|
2020-09-23 09:24:21 +02:00
|
|
|
if "$@" >/dev/null 2>&1; then
|
2019-08-21 02:52:51 +02:00
|
|
|
echo 'found'
|
2020-08-31 03:22:59 +02:00
|
|
|
return 0
|
2019-08-21 02:52:51 +02:00
|
|
|
fi
|
|
|
|
echo 'not found'
|
2020-08-31 03:22:59 +02:00
|
|
|
return 1
|
2019-08-21 02:52:51 +02:00
|
|
|
}
|
|
|
|
|
2019-06-06 02:51:41 +02:00
|
|
|
default_valgrind_setting()
|
|
|
|
{
|
|
|
|
# Valgrind must accept all these options (might exit with error 7 though
|
|
|
|
# if /bin/true leaks mem on your system!)
|
|
|
|
if valgrind -q --error-exitcode=7 --track-origins=yes --leak-check=full --show-reachable=yes --errors-for-leak-kinds=all /bin/true >/dev/null 2>&1 || [ $? = 7 ]; then
|
|
|
|
echo 1
|
|
|
|
else
|
|
|
|
echo 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_defaults()
|
|
|
|
{
|
|
|
|
# Default values, loaded from environment or canned.
|
|
|
|
# Note that ":-" means substitute if empty or unset, "-" means only if unset
|
|
|
|
# which matters since you might explicitly set of these blank.
|
|
|
|
PREFIX=${PREFIX:-/usr/local}
|
|
|
|
CC=${CC:-cc}
|
|
|
|
CDEBUGFLAGS=${CDEBUGFLAGS--std=gnu11 -g -fstack-protector}
|
|
|
|
DEVELOPER=${DEVELOPER:-0}
|
|
|
|
EXPERIMENTAL_FEATURES=${EXPERIMENTAL_FEATURES:-0}
|
|
|
|
COMPAT=${COMPAT:-1}
|
|
|
|
STATIC=${STATIC:-0}
|
|
|
|
ASAN=${ASAN:-0}
|
|
|
|
PYTEST=${PYTEST-$(default_pytest)}
|
|
|
|
COPTFLAGS=${COPTFLAGS-$(default_coptflags "$DEVELOPER")}
|
|
|
|
CONFIGURATOR_CC=${CONFIGURATOR_CC-$CC}
|
|
|
|
VALGRIND=${VALGRIND:-$(default_valgrind_setting)}
|
2019-04-10 23:37:15 +02:00
|
|
|
TEST_NETWORK=${TEST_NETWORK:-regtest}
|
2019-06-06 02:51:41 +02:00
|
|
|
}
|
|
|
|
|
2018-06-06 05:35:27 +02:00
|
|
|
usage()
|
|
|
|
{
|
|
|
|
echo "Usage: ./configure [--reconfigure] [setting=value] [options]"
|
2019-05-25 09:43:43 +02:00
|
|
|
echo "If --reconfigure is specified, $CONFIG_VAR_FILE will set defaults."
|
2018-06-06 05:35:27 +02:00
|
|
|
echo "Default settings:"
|
2019-06-06 02:51:41 +02:00
|
|
|
set_defaults
|
2019-05-25 09:43:43 +02:00
|
|
|
DEFAULT_COPTFLAGS="$(default_coptflags $DEVELOPER)"
|
2019-05-25 10:25:18 +02:00
|
|
|
# We assume we have a modern gcc.
|
2019-06-06 02:51:41 +02:00
|
|
|
DEFAULT_CWARNFLAGS="$(default_cwarnflags ""$DEFAULT_COPTFLAGS"" 1 1)"
|
2018-06-06 05:35:27 +02:00
|
|
|
usage_with_default "CC" "$CC"
|
2019-05-25 09:43:43 +02:00
|
|
|
usage_with_default "CWARNFLAGS" "$DEFAULT_CWARNFLAGS"
|
|
|
|
usage_with_default "COPTFLAGS" "$DEFAULT_COPTFLAGS"
|
2018-06-06 05:35:27 +02:00
|
|
|
usage_with_default "CDEBUGFLAGS" "$CDEBUGFLAGS"
|
2019-05-25 10:25:18 +02:00
|
|
|
usage_with_default "CONFIGURATOR_CC" "${CONFIGURATOR_CC:-$CC}"
|
2018-06-06 05:35:27 +02:00
|
|
|
echo " To override compile line for configurator itself"
|
2019-05-25 09:43:43 +02:00
|
|
|
usage_with_default "PYTEST" "$PYTEST"
|
2019-06-06 02:51:41 +02:00
|
|
|
usage_with_default "VALGRIND" "$VALGRIND"
|
2018-06-06 05:35:27 +02:00
|
|
|
|
|
|
|
echo "Options include:"
|
|
|
|
usage_with_default "--prefix=" "$PREFIX"
|
|
|
|
echo " Prefix for make install"
|
|
|
|
usage_with_default "--enable/disable-developer" "$DEVELOPER" "enable" "disable"
|
|
|
|
echo " Developer mode, good for testing"
|
2018-12-10 02:03:33 +01:00
|
|
|
usage_with_default "--enable/disable-experimental-features" "$EXPERIMENTAL_FEATURES" "enable" "disable"
|
2019-12-10 21:29:21 +01:00
|
|
|
echo " Enable experimental features"
|
2018-06-06 05:35:27 +02:00
|
|
|
usage_with_default "--enable/disable-compat" "$COMPAT" "enable" "disable"
|
|
|
|
echo " Compatibility mode, good to disable to see if your software breaks"
|
2018-06-06 05:36:27 +02:00
|
|
|
usage_with_default "--enable/disable-valgrind" "(autodetect)"
|
2019-12-10 21:29:21 +01:00
|
|
|
echo " Run tests with Valgrind"
|
2019-01-21 12:21:20 +01:00
|
|
|
usage_with_default "--enable/disable-static" "$STATIC" "enable" "disable"
|
2019-10-14 05:15:34 +02:00
|
|
|
echo " Static link sqlite3, gmp and zlib libraries"
|
2019-01-21 12:21:20 +01:00
|
|
|
usage_with_default "--enable/disable-address-sanitizer" "$ASAN" "enable" "disable"
|
|
|
|
echo " Compile with address-sanitizer"
|
2018-06-06 05:35:27 +02:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
add_var()
|
|
|
|
{
|
2018-12-18 04:32:52 +01:00
|
|
|
if [ -n "$2" ]; then
|
|
|
|
echo "Setting $1... $2"
|
|
|
|
else
|
|
|
|
echo "$1 not found"
|
|
|
|
fi
|
2020-09-17 06:10:40 +02:00
|
|
|
echo "$1=$2" >> $CONFIG_VAR_FILE.$$
|
2018-06-06 05:35:27 +02:00
|
|
|
[ -z "$3" ] || echo "#define $1 $2" >> "$3"
|
|
|
|
}
|
|
|
|
|
|
|
|
for opt in "$@"; do
|
|
|
|
case "$opt" in
|
|
|
|
--reconfigure)
|
2019-05-25 09:43:43 +02:00
|
|
|
# Figure out what defaulT COPTFLAGS was for this config.vars
|
|
|
|
DEFAULT_COPTFLAGS=
|
|
|
|
# Set from values if not already set.
|
|
|
|
while IFS='=' read VAR VAL; do
|
|
|
|
if eval [ -z \${$VAR+x} ]; then eval $VAR=\"$VAL\"; fi
|
|
|
|
if [ "$VAR" = DEVELOPER ]; then
|
|
|
|
DEFAULT_COPTFLAGS=$(default_coptflags "$VAL")
|
|
|
|
fi
|
|
|
|
done < $CONFIG_VAR_FILE
|
|
|
|
# If we were those defaults, unset so we get new defaults in
|
|
|
|
# case DEVELOPER has changed.
|
|
|
|
if [ x"$COPTFLAGS" = x"$DEFAULT_COPTFLAGS" ]; then
|
|
|
|
unset COPTFLAGS
|
|
|
|
fi
|
2018-06-06 05:35:27 +02:00
|
|
|
;;
|
|
|
|
CC=*) CC="${opt#CC=}";;
|
|
|
|
CONFIGURATOR_CC=*) CONFIGURATOR_CC="${opt#CONFIGURATOR_CC=}";;
|
|
|
|
CWARNFLAGS=*) CWARNFLAGS="${opt#CWARNFLAGS=}";;
|
|
|
|
CDEBUGFLAGS=*) CDEBUGFLAGS="${opt#CDEBUGFLAGS=}";;
|
2019-05-15 12:48:27 +02:00
|
|
|
COPTFLAGS=*) COPTFLAGS="${opt#COPTFLAGS=}";;
|
2018-06-09 09:08:59 +02:00
|
|
|
PYTEST=*) PYTEST="${opt#PYTEST=}";;
|
2018-06-06 05:35:27 +02:00
|
|
|
--prefix=*) PREFIX="${opt#--prefix=}";;
|
|
|
|
--enable-developer) DEVELOPER=1;;
|
|
|
|
--disable-developer) DEVELOPER=0;;
|
2018-12-03 00:04:06 +01:00
|
|
|
--enable-experimental-features) EXPERIMENTAL_FEATURES=1;;
|
|
|
|
--disable-experimental-features) EXPERIMENTAL_FEATURES=0;;
|
2018-06-06 05:35:27 +02:00
|
|
|
--enable-compat) COMPAT=1;;
|
|
|
|
--disable-compat) COMPAT=0;;
|
2018-06-06 05:36:27 +02:00
|
|
|
--enable-valgrind) VALGRIND=1;;
|
|
|
|
--disable-valgrind) VALGRIND=0;;
|
2018-12-10 07:38:43 +01:00
|
|
|
--enable-static) STATIC=1;;
|
|
|
|
--disable-static) STATIC=0;;
|
2019-01-21 12:21:20 +01:00
|
|
|
--enable-address-sanitizer) ASAN=1;;
|
|
|
|
--disable-address-sanitizer) ASAN=0;;
|
2018-06-06 05:35:27 +02:00
|
|
|
--help|-h) usage;;
|
|
|
|
*)
|
|
|
|
echo "Unknown option '$opt'" >&2
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2019-06-06 02:51:41 +02:00
|
|
|
# Now fill in any unset vars.
|
|
|
|
set_defaults
|
2019-05-15 12:48:27 +02:00
|
|
|
|
2019-05-25 10:25:18 +02:00
|
|
|
# We assume warning flags don't affect congfigurator that much!
|
2018-06-06 05:35:27 +02:00
|
|
|
echo -n "Compiling $CONFIGURATOR..."
|
2019-06-06 02:51:41 +02:00
|
|
|
$CC ${CWARNFLAGS-$BASE_WARNFLAGS} $CDEBUGFLAGS $COPTFLAGS -o $CONFIGURATOR $CONFIGURATOR.c
|
2018-06-06 05:35:27 +02:00
|
|
|
echo "done"
|
|
|
|
|
2019-01-21 12:21:20 +01:00
|
|
|
if [ "$ASAN" = "1" ]; then
|
2019-02-27 23:46:50 +01:00
|
|
|
if [ "$CC" = "clang" ]; then
|
2019-01-21 12:21:20 +01:00
|
|
|
echo "Address sanitizer (ASAN) is currently only supported with gcc"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ "$VALGRIND" = "1" ]; then
|
|
|
|
echo "Address sanitizer (ASAN) and valgrind cannot be enabled at the same time"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-08-29 10:13:52 +02:00
|
|
|
SQLITE3_CFLAGS=""
|
|
|
|
SQLITE3_LDLIBS="-lsqlite3"
|
|
|
|
if command -v "${PKG_CONFIG}" >/dev/null; then
|
|
|
|
SQLITE3_CFLAGS="$("${PKG_CONFIG}" --silence-errors --cflags sqlite3 || :)"
|
|
|
|
SQLITE3_LDLIBS="$("${PKG_CONFIG}" --silence-errors --libs sqlite3 || :)"
|
|
|
|
fi
|
|
|
|
|
2020-08-27 14:40:24 +02:00
|
|
|
POSTGRES_INCLUDE=""
|
2020-08-28 09:26:12 +02:00
|
|
|
POSTGRES_LDLIBS=""
|
2020-08-29 04:58:19 +02:00
|
|
|
if command -v "${PG_CONFIG}" >/dev/null; then
|
|
|
|
POSTGRES_INCLUDE="-I$("${PG_CONFIG}" --includedir)"
|
|
|
|
POSTGRES_LDLIBS="-L$("${PG_CONFIG}" --libdir) -lpq"
|
2020-08-27 14:40:24 +02:00
|
|
|
fi
|
|
|
|
|
2020-09-19 05:11:01 +02:00
|
|
|
# Clean up on exit.
|
|
|
|
trap "rm -f $CONFIG_VAR_FILE.$$" 0
|
|
|
|
|
2020-08-29 10:13:52 +02:00
|
|
|
$CONFIGURATOR --extra-tests --autotools-style --var-file=$CONFIG_VAR_FILE.$$ --header-file=$CONFIG_HEADER --configurator-cc="$CONFIGURATOR_CC" --wrapper="$CONFIGURATOR_WRAPPER" "$CC" ${CWARNFLAGS-$BASE_WARNFLAGS} $CDEBUGFLAGS $COPTFLAGS -I/usr/local/include -L/usr/local/lib $SQLITE3_CFLAGS $POSTGRES_INCLUDE <<EOF
|
2020-08-27 14:40:24 +02:00
|
|
|
|
2019-02-07 21:36:50 +01:00
|
|
|
var=HAVE_GOOD_LIBSODIUM
|
|
|
|
desc=libsodium with IETF chacha20 variants
|
|
|
|
style=DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE
|
|
|
|
link=-lsodium
|
|
|
|
code=
|
|
|
|
#include <sodium.h>
|
|
|
|
#include <stdio.h>
|
2019-10-17 10:24:33 +02:00
|
|
|
#include <string.h>
|
2019-02-07 21:36:50 +01:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2019-10-17 10:24:33 +02:00
|
|
|
crypto_secretstream_xchacha20poly1305_state crypto_state;
|
|
|
|
unsigned char header[crypto_secretstream_xchacha20poly1305_HEADERBYTES];
|
|
|
|
unsigned char data[] = { 1, 2, 3 };
|
|
|
|
|
|
|
|
crypto_secretstream_xchacha20poly1305_init_push(&crypto_state, header,
|
|
|
|
data);
|
2019-02-07 21:36:50 +01:00
|
|
|
printf("%p\n", crypto_aead_chacha20poly1305_ietf_encrypt);
|
2019-03-02 15:07:44 +01:00
|
|
|
printf("%d\n", crypto_aead_chacha20poly1305_ietf_NPUBBYTES);
|
2019-03-18 03:40:32 +01:00
|
|
|
return 0;
|
2019-02-07 21:36:50 +01:00
|
|
|
}
|
|
|
|
/*END*/
|
2019-03-18 03:40:32 +01:00
|
|
|
var=HAVE_SQLITE3_EXPANDED_SQL
|
|
|
|
desc=sqlite3_expanded_sql
|
|
|
|
style=DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE
|
2020-08-29 10:13:52 +02:00
|
|
|
link=$SQLITE3_LDLIBS
|
2019-03-18 03:40:32 +01:00
|
|
|
code=
|
|
|
|
#include <sqlite3.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
printf("%p\n", sqlite3_expanded_sql);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/*END*/
|
2019-07-24 18:29:03 +02:00
|
|
|
var=HAVE_SQLITE3
|
|
|
|
desc=sqlite3
|
|
|
|
style=DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE
|
2020-08-29 10:13:52 +02:00
|
|
|
link=$SQLITE3_LDLIBS
|
2019-07-24 18:29:03 +02:00
|
|
|
code=
|
|
|
|
#include <sqlite3.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
printf("%p\n", sqlite3_prepare_v2);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/*END*/
|
2019-08-30 13:47:52 +02:00
|
|
|
var=HAVE_POSTGRES
|
|
|
|
desc=postgres
|
|
|
|
style=DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE
|
2020-08-28 09:26:12 +02:00
|
|
|
link=$POSTGRES_LDLIBS
|
2019-08-30 13:47:52 +02:00
|
|
|
code=
|
2020-08-27 14:40:24 +02:00
|
|
|
#include <libpq-fe.h>
|
2019-08-30 13:47:52 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
printf("libpq version %d\n", PQlibVersion());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/*END*/
|
2019-05-25 10:25:18 +02:00
|
|
|
var=HAVE_GCC
|
|
|
|
desc=compiler is GCC
|
|
|
|
style=OUTSIDE_MAIN
|
|
|
|
code=
|
|
|
|
#ifndef __GNUC__
|
|
|
|
#error "Not GCC"
|
|
|
|
#endif
|
|
|
|
#ifdef __clang__
|
|
|
|
#error "clang"
|
|
|
|
#endif
|
|
|
|
/*END*/
|
|
|
|
var=HAVE_MODERN_GCC
|
|
|
|
desc=GCC version is 7 or above
|
|
|
|
style=OUTSIDE_MAIN
|
|
|
|
code=
|
|
|
|
#if __GNUC__ < 7
|
|
|
|
#error "Not modern GCC"
|
|
|
|
#endif
|
|
|
|
/*END*/
|
2019-09-11 01:52:52 +02:00
|
|
|
var=HAVE_PWRITEV
|
|
|
|
desc=pwritev() defined
|
|
|
|
style=DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE
|
|
|
|
code=
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
struct iovec iov[2];
|
|
|
|
int fd = open("/dev/null", O_WRONLY);
|
|
|
|
|
|
|
|
iov[0].iov_base = "hello";
|
|
|
|
iov[0].iov_len = 5;
|
|
|
|
iov[1].iov_base = " world";
|
|
|
|
iov[1].iov_len = 6;
|
|
|
|
if (pwritev(fd, iov, 2, 0) == 11)
|
|
|
|
return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
/*END*/
|
2019-02-07 21:36:50 +01:00
|
|
|
EOF
|
2020-08-31 03:22:59 +02:00
|
|
|
|
|
|
|
if check_command 'python3-mako' python3 -c 'import mako'; then
|
|
|
|
HAVE_PYTHON3_MAKO=1
|
|
|
|
else
|
|
|
|
HAVE_PYTHON3_MAKO=0
|
|
|
|
fi
|
|
|
|
|
2020-09-23 09:24:21 +02:00
|
|
|
if echo | check_command sha256sum sha256sum; then
|
|
|
|
SHA256SUM=sha256sum
|
|
|
|
elif echo | check_command "shasum -a 256" shasum -a 256; then
|
|
|
|
SHA256SUM="shasum -a 256"
|
|
|
|
else
|
|
|
|
echo "*** We need sha256sum or shasum -a 256!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-05-25 10:25:18 +02:00
|
|
|
# Now we can finally set our warning flags
|
|
|
|
if [ -z ${CWARNFLAGS+x} ]; then
|
|
|
|
CWARNFLAGS=$(default_cwarnflags "$COPTFLAGS" \
|
2020-09-17 06:10:40 +02:00
|
|
|
$(sed -n 's/^HAVE_GCC=//p' < $CONFIG_VAR_FILE.$$) \
|
|
|
|
$(sed -n 's/^HAVE_MODERN_GCC=//p' < $CONFIG_VAR_FILE.$$) )
|
2019-05-25 10:25:18 +02:00
|
|
|
fi
|
|
|
|
|
2018-06-06 05:35:27 +02:00
|
|
|
add_var PREFIX "$PREFIX"
|
|
|
|
add_var CC "$CC"
|
|
|
|
add_var CONFIGURATOR_CC "$CONFIGURATOR_CC"
|
|
|
|
add_var CWARNFLAGS "$CWARNFLAGS"
|
|
|
|
add_var CDEBUGFLAGS "$CDEBUGFLAGS"
|
2019-05-15 12:48:27 +02:00
|
|
|
add_var COPTFLAGS "$COPTFLAGS"
|
2020-08-29 10:13:52 +02:00
|
|
|
add_var SQLITE3_CFLAGS "$SQLITE3_CFLAGS"
|
|
|
|
add_var SQLITE3_LDLIBS "$SQLITE3_LDLIBS"
|
2020-08-27 14:40:24 +02:00
|
|
|
add_var POSTGRES_INCLUDE "$POSTGRES_INCLUDE"
|
2020-08-28 09:26:12 +02:00
|
|
|
add_var POSTGRES_LDLIBS "$POSTGRES_LDLIBS"
|
2018-06-06 05:36:27 +02:00
|
|
|
add_var VALGRIND "$VALGRIND"
|
2018-06-06 05:35:27 +02:00
|
|
|
add_var DEVELOPER "$DEVELOPER" $CONFIG_HEADER
|
2018-12-03 00:04:06 +01:00
|
|
|
add_var EXPERIMENTAL_FEATURES "$EXPERIMENTAL_FEATURES" $CONFIG_HEADER
|
2018-06-06 05:35:27 +02:00
|
|
|
add_var COMPAT "$COMPAT" $CONFIG_HEADER
|
2018-06-09 09:08:59 +02:00
|
|
|
add_var PYTEST "$PYTEST"
|
2018-12-10 07:38:43 +01:00
|
|
|
add_var STATIC "$STATIC"
|
2019-01-21 12:21:20 +01:00
|
|
|
add_var ASAN "$ASAN"
|
2019-04-10 23:37:15 +02:00
|
|
|
add_var TEST_NETWORK "$TEST_NETWORK"
|
2020-08-31 03:22:59 +02:00
|
|
|
add_var HAVE_PYTHON3_MAKO "$HAVE_PYTHON3_MAKO"
|
2020-09-23 09:24:21 +02:00
|
|
|
add_var SHA256SUM "$SHA256SUM"
|
2018-06-14 03:35:58 +02:00
|
|
|
|
|
|
|
# Hack to avoid sha256 name clash with libwally: will be fixed when that
|
|
|
|
# becomes a standalone shared lib.
|
|
|
|
echo '#include "ccan_compat.h"' >> $CONFIG_HEADER
|
2020-09-17 06:10:40 +02:00
|
|
|
|
|
|
|
# Now we set them all and check.
|
|
|
|
while IFS='=' read VAR VAL; do
|
|
|
|
eval $VAR=\"$VAL\"
|
|
|
|
done < $CONFIG_VAR_FILE.$$
|
|
|
|
|
|
|
|
if [ "$HAVE_SQLITE3" = 0 -a "$HAVE_POSTGRES" = 0 ]; then
|
|
|
|
# I have no database yet I must schema!)
|
|
|
|
echo "*** We need a database, but neither sqlite3 nor postgres found" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mv $CONFIG_VAR_FILE.$$ $CONFIG_VAR_FILE
|