From a3605b82897bd796509f801a283d5f0fbd56acb0 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Sat, 22 Aug 2026 10:39:05 +0300 Subject: [PATCH] Fix library detection under shells whose echo does not expand escapes The OpenSSL, wolfSSL, PCRE2 and PAM probes built their test program with echo "...\n...". make runs recipes through /bin/sh, which is dash on Debian and Ubuntu, where the builtin echo expands \n. On distributions where /bin/sh is bash - every RPM based distribution, and macOS - it does not, so the probe compiled #include n int main(){return 0;} which is not valid C. Every probe therefore failed and the build silently dropped TLS, PCRE2 and PAM support with no diagnostic. Use printf, which expands escapes the same way everywhere. --- Makefile.FreeBSD | 8 ++++---- Makefile.Linux | 8 ++++---- Makefile.Solaris | 6 +++--- Makefile.unix | 8 ++++---- Makefile.win | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Makefile.FreeBSD b/Makefile.FreeBSD index ed75eee..a6ba7a8 100644 --- a/Makefile.FreeBSD +++ b/Makefile.FreeBSD @@ -52,14 +52,14 @@ ifeq ($(LIBSTATIC), true) STATIC_SUFFIX = -Wl,-Bdynamic ZLIB = -lz -lzstd endif -WOLFSSL_CHECK ?= $(shell echo "\#include \\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestwssl testwssl.o $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) 2>/dev/null && rm testwssl testwssl.o && echo true||echo false) +WOLFSSL_CHECK ?= $(shell printf "\#include \\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestwssl testwssl.o $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) 2>/dev/null && rm testwssl testwssl.o && echo true||echo false) ifeq ($(WOLFSSL_CHECK), true) LIBS += $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL -DWITH_WOLFSSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) ZLIB := else -OPENSSL_CHECK ?= $(shell echo "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false) +OPENSSL_CHECK ?= $(shell printf "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false) ifeq ($(OPENSSL_CHECK), true) LIBS += $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL @@ -68,13 +68,13 @@ else ZLIB := endif endif -PCRE_CHECK ?= $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -lpcre2-8 2>/dev/null && rm testpcre testpcre.o && echo true||echo false) +PCRE_CHECK ?= $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -lpcre2-8 2>/dev/null && rm testpcre testpcre.o && echo true||echo false) ifeq ($(PCRE_CHECK), true) CFLAGS += -DWITH_PCRE PCRE_OBJS = pcre$(OBJSUFFICS) PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) endif -PAM_CHECK ?= $(shell echo "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false) +PAM_CHECK ?= $(shell printf "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false) ifeq ($(PAM_CHECK), true) PLUGINS += PamAuth endif diff --git a/Makefile.Linux b/Makefile.Linux index ab6a8a7..e399f60 100644 --- a/Makefile.Linux +++ b/Makefile.Linux @@ -60,14 +60,14 @@ ifeq ($(LIBSTATIC), true) ZLIB = -lz -lzstd endif -WOLFSSL_CHECK ?= $(shell echo "\#include \\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestwssl testwssl.o $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) 2>/dev/null && rm testwssl testwssl.o && echo true||echo false) +WOLFSSL_CHECK ?= $(shell printf "\#include \\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestwssl testwssl.o $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) 2>/dev/null && rm testwssl testwssl.o && echo true||echo false) ifeq ($(WOLFSSL_CHECK), true) LIBS += $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL -DWITH_WOLFSSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) ZLIB := else -OPENSSL_CHECK ?= $(shell echo "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false) +OPENSSL_CHECK ?= $(shell printf "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false) ifeq ($(OPENSSL_CHECK), true) LIBS += $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL @@ -76,13 +76,13 @@ else ZLIB := endif endif -PCRE_CHECK ?= $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) 2>/dev/null && rm testpcre testpcre.o && echo true||echo false) +PCRE_CHECK ?= $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) 2>/dev/null && rm testpcre testpcre.o && echo true||echo false) ifeq ($(PCRE_CHECK), true) CFLAGS += -DWITH_PCRE PCRE_OBJS = pcre$(OBJSUFFICS) PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) endif -PAM_CHECK ?= $(shell echo "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false) +PAM_CHECK ?= $(shell printf "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false) ifeq ($(PAM_CHECK), true) PLUGINS += PamAuth endif diff --git a/Makefile.Solaris b/Makefile.Solaris index 2140a37..2def1c9 100644 --- a/Makefile.Solaris +++ b/Makefile.Solaris @@ -31,20 +31,20 @@ COMPATLIBS = MAKEFILE = Makefile.Solaris PLUGINS = StringsPlugin TrafficPlugin TransparentPlugin FilePlugin -WOLFSSL_CHECK = $(shell echo "\#include \\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testwssl testwssl.o -lwolfssl 2>/dev/null && rm testwssl testwssl.o && echo true||echo false) +WOLFSSL_CHECK = $(shell printf "\#include \\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testwssl testwssl.o -lwolfssl 2>/dev/null && rm testwssl testwssl.o && echo true||echo false) ifeq ($(WOLFSSL_CHECK), true) LIBS += -lwolfssl CFLAGS += -DWITH_SSL -DWITH_WOLFSSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) else -OPENSSL_CHECK = $(shell echo "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testssl testssl.o -lcrypto -lssl 2>/dev/null && rm testssl testssl.o && echo true||echo false) +OPENSSL_CHECK = $(shell printf "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testssl testssl.o -lcrypto -lssl 2>/dev/null && rm testssl testssl.o && echo true||echo false) ifeq ($(OPENSSL_CHECK), true) LIBS += -l crypto -l ssl CFLAGS += -DWITH_SSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) endif endif -PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic 2>/dev/null && rm testpcre testpcre.o && echo true||echo false) +PCRE_CHECK = $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic 2>/dev/null && rm testpcre testpcre.o && echo true||echo false) ifeq ($(PCRE_CHECK), true) CFLAGS += -DWITH_PCRE PCRE_OBJS = pcre$(OBJSUFFICS) diff --git a/Makefile.unix b/Makefile.unix index 8031214..7337396 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -54,14 +54,14 @@ ifeq ($(LIBSTATIC), true) STATIC_SUFFIX = -Wl,-Bdynamic ZLIB = -lz -lzstd endif -WOLFSSL_CHECK ?= $(shell echo "\#include \\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestwssl testwssl.o $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) 2>/dev/null && rm testwssl testwssl.o && echo true||echo false) +WOLFSSL_CHECK ?= $(shell printf "\#include \\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestwssl testwssl.o $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) 2>/dev/null && rm testwssl testwssl.o && echo true||echo false) ifeq ($(WOLFSSL_CHECK), true) LIBS += $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL -DWITH_WOLFSSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) ZLIB := else -OPENSSL_CHECK ?= $(shell echo "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false) +OPENSSL_CHECK ?= $(shell printf "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false) ifeq ($(OPENSSL_CHECK), true) LIBS += $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL @@ -70,13 +70,13 @@ else ZLIB := endif endif -PCRE_CHECK ?= $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) 2>/dev/null && rm testpcre testpcre.o && echo true||echo false) +PCRE_CHECK ?= $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) 2>/dev/null && rm testpcre testpcre.o && echo true||echo false) ifeq ($(PCRE_CHECK), true) CFLAGS += -DWITH_PCRE PCRE_OBJS = pcre$(OBJSUFFICS) PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) endif -PAM_CHECK ?= $(shell echo "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false) +PAM_CHECK ?= $(shell printf "\#include \\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false) ifeq ($(PAM_CHECK), true) PLUGINS += PamAuth endif diff --git a/Makefile.win b/Makefile.win index 1b38198..3c76abc 100644 --- a/Makefile.win +++ b/Makefile.win @@ -47,14 +47,14 @@ ifeq ($(LIBSTATIC), true) STATIC_SUFFIX = -Wl,-Bdynamic ZLIB = -lz endif -WOLFSSL_CHECK = $(shell echo "\#include \\n\#include \\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) -o testwssl - 2>/dev/null && rm testwssl && echo true||echo false) +WOLFSSL_CHECK = $(shell printf "\#include \\n\#include \\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) -o testwssl - 2>/dev/null && rm testwssl && echo true||echo false) ifeq ($(WOLFSSL_CHECK), true) LIBS += $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) -lws2_32 CFLAGS += -DWITH_SSL -DWITH_WOLFSSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) ZLIB := else -OPENSSL_CHECK = $(shell echo "\#include \\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX) -o testssl - 2>/dev/null && rm testssl && echo true||echo false) +OPENSSL_CHECK = $(shell printf "\#include \\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX) -o testssl - 2>/dev/null && rm testssl && echo true||echo false) ifeq ($(OPENSSL_CHECK), true) LIBS += $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX) -lcrypt32 CFLAGS += -DWITH_SSL @@ -63,11 +63,11 @@ else ZLIB := endif endif -PAM_CHECK = $(shell echo "\#include \\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false) +PAM_CHECK = $(shell printf "\#include \\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false) ifeq ($(PAM_CHECK), true) PLUGINS += PamAuth endif -PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n#include \\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false) +PCRE_CHECK = $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n#include \\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false) ifeq ($(PCRE_CHECK), true) CFLAGS += -DWITH_PCRE PCRE_OBJS = pcre$(OBJSUFFICS)