diff --git a/Makefile.FreeBSD b/Makefile.FreeBSD index af9b850..4468d38 100644 --- a/Makefile.FreeBSD +++ b/Makefile.FreeBSD @@ -35,9 +35,14 @@ TYPECOMMAND = cat COMPATLIBS = MAKEFILE = Makefile.FreeBSD PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin FilePlugin -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 -lcrypto -lssl 2>/dev/null && rm testssl testssl.o && echo true||echo false) +ifeq ($(STATIC), true) + STATIC_PREFIX = -Wl,-Bstatic + STATIC_SUFFIX = -Wl,-Bdynamic + ZLIB = -lz +endif +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) -lcrypto -lssl $(ZLIB) $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false) ifeq ($(OPENSSL_CHECK), true) - LIBS += -l crypto -l ssl + LIBS += $(STATIC_PREFIX) -l crypto -l ssl $(ZLIB) $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) endif @@ -45,7 +50,7 @@ PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#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) diff --git a/Makefile.Linux b/Makefile.Linux index 5f74ed6..08bc41f 100644 --- a/Makefile.Linux +++ b/Makefile.Linux @@ -37,17 +37,23 @@ MAKEFILE = Makefile.Linux LIBS ?= -ldl #PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin FilePlugin -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 -lcrypto -lssl 2>/dev/null && rm testssl testssl.o && echo true||echo false) +ifeq ($(STATIC), true) + STATIC_PREFIX = -Wl,-Bstatic + STATIC_SUFFIX = -Wl,-Bdynamic + ZLIB = -lz +endif + +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) -lcrypto -lssl $(ZLIB) $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false) ifeq ($(OPENSSL_CHECK), true) - LIBS += -Wl,-Bstatic -l crypto -l ssl -Wl,-Bdynamic + LIBS += $(STATIC_PREFIX) -lcrypto -lssl $(ZLIB) $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) 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 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) ifeq ($(PCRE_CHECK), true) CFLAGS += -DWITH_PCRE PCRE_OBJS = pcre$(OBJSUFFICS) - PCRE_LIBS = -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic + 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) ifeq ($(PAM_CHECK), true) diff --git a/Makefile.unix b/Makefile.unix index 858e66e..b86f1aa 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -37,17 +37,22 @@ TYPECOMMAND = cat COMPATLIBS = MAKEFILE = Makefile.unix PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin FilePlugin -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 -lcrypto -lssl 2>/dev/null && rm testssl testssl.o && echo true||echo false) +ifeq ($(STATIC), true) + STATIC_PREFIX = -Wl,-Bstatic + STATIC_SUFFIX = -Wl,-Bdynamic + ZLIB = -lz +endif +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) -lcrypto -lssl $(ZLIB) $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false) ifeq ($(OPENSSL_CHECK), true) - LIBS += -l crypto -l ssl + LIBS += $(STATIC_PREFIX) -lcrypto -lssl $(ZLIB) $(STATIC_SUFFIX) CFLAGS += -DWITH_SSL SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS) 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 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) ifeq ($(PCRE_CHECK), true) CFLAGS += -DWITH_PCRE PCRE_OBJS = pcre$(OBJSUFFICS) - PCRE_LIBS = -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic + 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) ifeq ($(PAM_CHECK), true)