diff --git a/Makefile b/Makefile index 5cd4628db0f2..0198ec82118c 100644 --- a/Makefile +++ b/Makefile @@ -263,7 +263,7 @@ LIBRARY_PATH := /usr/local/lib endif CPPFLAGS += -DCLN_NEXT_VERSION="\"$(CLN_NEXT_VERSION)\"" -DPKGLIBEXECDIR="\"$(pkglibexecdir)\"" -DBINDIR="\"$(bindir)\"" -DPLUGINDIR="\"$(plugindir)\"" -DCCAN_TAL_NEVER_RETURN_NULL=1 -CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(COPTFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLUDE_FLAGS) -I . -I$(CPATH) $(SQLITE3_CFLAGS) $(POSTGRES_INCLUDE) $(FEATURES) $(COVFLAGS) $(DEV_CFLAGS) -DSHACHAIN_BITS=48 -DJSMN_PARENT_LINKS $(PIE_CFLAGS) $(COMPAT_CFLAGS) $(CSANFLAGS) +CFLAGS = $(CPPFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(COPTFLAGS) -I $(CCANDIR) $(EXTERNAL_INCLUDE_FLAGS) -I . -I$(CPATH) $(SQLITE3_CFLAGS) $(SODIUM_CFLAGS) $(POSTGRES_INCLUDE) $(FEATURES) $(COVFLAGS) $(DEV_CFLAGS) -DSHACHAIN_BITS=48 -DJSMN_PARENT_LINKS $(PIE_CFLAGS) $(COMPAT_CFLAGS) $(CSANFLAGS) # 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 diff --git a/configure b/configure index cde3b8e37afc..c72981610b2a 100755 --- a/configure +++ b/configure @@ -355,6 +355,13 @@ if command -v "${PKG_CONFIG}" >/dev/null; then SQLITE3_LDLIBS="$("${PKG_CONFIG}" --silence-errors --libs sqlite3 || :)" fi +SODIUM_CFLAGS="" +SODIUM_LDLIBS="-lsodium" +if command -v "${PKG_CONFIG}" >/dev/null; then + SODIUM_CFLAGS="$("${PKG_CONFIG}" --silence-errors --cflags libsodium || :)" + SODIUM_LDLIBS="$("${PKG_CONFIG}" --silence-errors --libs libsodium || :)" +fi + POSTGRES_INCLUDE="" POSTGRES_LDLIBS="" if command -v "${PG_CONFIG}" >/dev/null; then @@ -365,7 +372,7 @@ fi # Clean up on exit. trap "rm -f $CONFIG_VAR_FILE.$$" 0 -$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 $CSANFLAGS -I$CPATH -L$LIBRARY_PATH $SQLITE3_CFLAGS $POSTGRES_INCLUDE < #include @@ -553,6 +560,8 @@ add_var SQLITE3_CFLAGS "$SQLITE3_CFLAGS" add_var SQLITE3_LDLIBS "$SQLITE3_LDLIBS" add_var POSTGRES_INCLUDE "$POSTGRES_INCLUDE" add_var POSTGRES_LDLIBS "$POSTGRES_LDLIBS" +add_var SODIUM_CFLAGS "$SODIUM_CFLAGS" +add_var SODIUM_LDLIBS "$SODIUM_LDLIBS" add_var VALGRIND "$VALGRIND" add_var DEBUGBUILD "$DEBUGBUILD" add_var COMPAT "$COMPAT" $CONFIG_HEADER.$$ diff --git a/external/Makefile b/external/Makefile index a289032a5f68..7ca251205191 100644 --- a/external/Makefile +++ b/external/Makefile @@ -50,7 +50,7 @@ EXTERNAL_INCLUDE_FLAGS += -I external/libsodium/src/libsodium/include \ -I $(TARGET_DIR)/libsodium-build/src/libsodium/include EXTERNAL_LIBS += ${TARGET_DIR}/libsodium.a else -LDLIBS += -lsodium +LDLIBS += $(SODIUM_LDLIBS) endif ifeq ($(HAVE_ZLIB),1)