From b76a78228f7e238adac0c15a2a4b3fc755dde483 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Fri, 27 Mar 2026 15:52:02 +0300 Subject: [PATCH] Detect OpenSSL / pam libraries in Makefiles --- .github/workflows/c-cpp.yml | 3 --- Makefile.FreeBSD | 12 +++++++++++- Makefile.Linux | 10 +++++++++- Makefile.unix | 13 +++++++++++-- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 0ea3c4e..e45564b 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -35,9 +35,6 @@ jobs: - name: dirs Windows if: ${{ startsWith(matrix.target, 'windows') }} run: cmd /C 'echo LIBS := -L "c:/program files/openssl/lib/VC/x64/MT" $(LIBS) >>Makefile.win && echo CFLAGS := -I "c:/program files/openssl/include" $(CFLAGS) >>Makefile.win && type Makefile.win && dir "c:/program files/openssl/lib"' - - name: SSLPlugin Linux - if: ${{ startsWith(matrix.target, 'ubuntu') }} - run: "sed -i '/^PLUGIN/s/$/ SSLPlugin/' Makefile && sed -i '/^LIBS/s/$/ -lcrypto -lssl/' Makefile" - name: make run: make - name: mkdir diff --git a/Makefile.FreeBSD b/Makefile.FreeBSD index a9494f9..e1ccfc5 100644 --- a/Makefile.FreeBSD +++ b/Makefile.FreeBSD @@ -29,7 +29,17 @@ AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Mak TYPECOMMAND = cat COMPATLIBS = MAKEFILE = Makefile.FreeBSD -PLUGINS ?= StringsPlugin TrafficPlugin PCREPlugin PamAuth TransparentPlugin +PLUGINS ?= StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin +OPENSSL_CHECK = $(shell echo "\#include \\n int main(){return 0;}" | cc -x c -l crypto -l ssl -o testssl - && rm testssl && echo true||echo false) +ifeq ($(OPENSSL_CHECK), true) + LIBS += -l crypto -l ssl + PLUGINS += SSLPlugin +endif +PAM_CHECK = $(shell echo "\#include \\n int main(){return 0;}" | cc -x c -l pam -o testpam - && rm testpam && echo true||echo false) +ifeq ($(OPENSSL_CHECK), true) + PLUGINS += PamAuth +endif + include Makefile.inc diff --git a/Makefile.Linux b/Makefile.Linux index 913a242..20756fc 100644 --- a/Makefile.Linux +++ b/Makefile.Linux @@ -36,7 +36,15 @@ MAKEFILE = Makefile.Linux LIBS ?= -ldl #PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth PLUGINS ?= StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin - +OPENSSL_CHECK = $(shell echo "\#include \\n int main(){return 0;}" | cc -x c -l crypto -l ssl -o testssl - && rm testssl && echo true||echo false) +ifeq ($(OPENSSL_CHECK), true) + LIBS += -l crypto -l ssl + PLUGINS += SSLPlugin +endif +PAM_CHECK = $(shell echo "\#include \\n int main(){return 0;}" | cc -x c -l pam -o testpam - && rm testpam && echo true||echo false) +ifeq ($(OPENSSL_CHECK), true) + PLUGINS += PamAuth +endif include Makefile.inc allplugins: diff --git a/Makefile.unix b/Makefile.unix index 7bf21de..f287ac8 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -20,7 +20,7 @@ LDFLAGS = -O2 -fno-strict-aliasing -pthread DCFLAGS = -fPIC DLFLAGS = -shared DLSUFFICS = .ld.so -LIBS = +LIBS ?= LIBSPREFIX = -l LIBSSUFFIX = LNOUT = -o @@ -33,7 +33,16 @@ AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Mak TYPECOMMAND = cat COMPATLIBS = MAKEFILE = Makefile.unix -PLUGINS = StringsPlugin TrafficPlugin PCREPlugin PamAuth TransparentPlugin +PLUGINS ?= StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin +OPENSSL_CHECK = $(shell echo "\#include \\n int main(){return 0;}" | cc -x c -l crypto -l ssl -o testssl - && rm testssl && echo true||echo false) +ifeq ($(OPENSSL_CHECK), true) + LIBS += -l crypto -l ssl + PLUGINS += SSLPlugin +endif +PAM_CHECK = $(shell echo "\#include \\n int main(){return 0;}" | cc -x c -l pam -o testpam - && rm testpam && echo true||echo false) +ifeq ($(OPENSSL_CHECK), true) + PLUGINS += PamAuth +endif include Makefile.inc