diff --git a/Makefile b/Makefile index 5f824426c9d7..a8cfa466f8a0 100644 --- a/Makefile +++ b/Makefile @@ -205,7 +205,7 @@ BOLT_DEPS := $(BOLT_GEN) ALL_PROGRAMS = CPPFLAGS += -DBINTOPKGLIBEXECDIR="\"$(shell sh tools/rel.sh $(bindir) $(pkglibexecdir))\"" -CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(COPTFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLUDE_FLAGS) -I . -I/usr/local/include $(FEATURES) $(COVFLAGS) $(DEV_CFLAGS) -DSHACHAIN_BITS=48 -DJSMN_PARENT_LINKS $(PIE_CFLAGS) $(COMPAT_CFLAGS) -DBUILD_ELEMENTS=1 +CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(COPTFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLUDE_FLAGS) -I . -I/usr/local/include $(POSTGRES_INCLUDE) $(FEATURES) $(COVFLAGS) $(DEV_CFLAGS) -DSHACHAIN_BITS=48 -DJSMN_PARENT_LINKS $(PIE_CFLAGS) $(COMPAT_CFLAGS) -DBUILD_ELEMENTS=1 # If CFLAGS is already set in the environment of make (to whatever value, it # does not matter) then it would export it to subprocesses with the above value # we set, including CWARNFLAGS which by default contains -Wall -Werror. This diff --git a/configure b/configure index 91dce80e70c1..2311d917ac18 100755 --- a/configure +++ b/configure @@ -229,8 +229,14 @@ fi # Doesn't set a var, but makes sure it exists require 'python3-mako' "You need the mako module for python3: see doc/INSTALL.md" python3 -c 'import mako' +POSTGRES_INCLUDE="" +if command -v pg_config 2> /dev/null; then + POSTGRES_INCLUDE="-I$(pg_config --includedir)" +fi + rm -f $CONFIG_VAR_FILE.$$ -$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 < +#include #include int main(void) @@ -353,6 +359,7 @@ add_var CONFIGURATOR_CC "$CONFIGURATOR_CC" add_var CWARNFLAGS "$CWARNFLAGS" add_var CDEBUGFLAGS "$CDEBUGFLAGS" add_var COPTFLAGS "$COPTFLAGS" +add_var POSTGRES_INCLUDE "$POSTGRES_INCLUDE" add_var VALGRIND "$VALGRIND" add_var DEVELOPER "$DEVELOPER" $CONFIG_HEADER add_var EXPERIMENTAL_FEATURES "$EXPERIMENTAL_FEATURES" $CONFIG_HEADER diff --git a/wallet/db_postgres.c b/wallet/db_postgres.c index 1c465e3aade4..19e3b183e3d6 100644 --- a/wallet/db_postgres.c +++ b/wallet/db_postgres.c @@ -8,7 +8,7 @@ #if HAVE_POSTGRES /* Indented in order not to trigger the inclusion order check */ - #include + #include /* Cherry-picked from here: libpq/src/interfaces/ecpg/ecpglib/pg_type.h */ #define BYTEAOID 17