aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/Makefile.template
diff options
context:
space:
mode:
authorGravatar jboeuf <jboeuf@users.noreply.github.com>2015-07-07 16:43:11 -0700
committerGravatar jboeuf <jboeuf@users.noreply.github.com>2015-07-07 16:43:11 -0700
commit44a4ef3b5a8c59530ddfc75b3bd98a94d975d9cd (patch)
tree04d4ba2e0c7278cbab301246db08efde51c5c452 /templates/Makefile.template
parent772187cdf0ff9dfafd2e693474c51eeddfe4c800 (diff)
parentbe2d3a3d7c951a438a66c10cbcaf80f448d7462d (diff)
Merge pull request #2174 from nicolasnoble/makefile-npn-check
Adding a check to find NPN-capable OpenSSL.
Diffstat (limited to 'templates/Makefile.template')
-rw-r--r--templates/Makefile.template35
1 files changed, 29 insertions, 6 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template
index f0cd0d97e3..52eb593cc8 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -397,6 +397,7 @@ endif
ifeq ($(HAS_PKG_CONFIG),true)
OPENSSL_ALPN_CHECK_CMD = pkg-config --atleast-version=1.0.2 openssl
+OPENSSL_NPN_CHECK_CMD = pkg-config --alteast-version=1.0.1 openssl
ZLIB_CHECK_CMD = pkg-config --exists zlib
PERFTOOLS_CHECK_CMD = pkg-config --exists profiler
PROTOBUF_CHECK_CMD = pkg-config --atleast-version=3.0.0-alpha-3 protobuf
@@ -409,12 +410,14 @@ OPENSSL_LIBS = ssl crypto
endif
OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS)
+OPENSSL_NPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS)
ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS)
PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS)
PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS)
ifeq ($(OPENSSL_REQUIRES_DL),true)
OPENSSL_ALPN_CHECK_CMD += -ldl
+OPENSSL_NPN_CHECK_CMD += -ldl
endif
endif # HAS_PKG_CONFIG
@@ -435,11 +438,17 @@ endif
HAS_SYSTEM_PROTOBUF_VERIFY = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo true || echo false)
ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG)
HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
+ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true)
+HAS_SYSTEM_OPENSSL_NPN = true
+else
+HAS_SYSTEM_OPENSSL_NPN = $(shell $(OPENSSL_NPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
+endif
HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false)
HAS_SYSTEM_PROTOBUF = $(HAS_SYSTEM_PROTOBUF_VERIFY)
else
# override system libraries if the config requires a custom compiled library
HAS_SYSTEM_OPENSSL_ALPN = false
+HAS_SYSTEM_OPENSSL_NPN = false
HAS_SYSTEM_ZLIB = false
HAS_SYSTEM_PROTOBUF = false
endif
@@ -463,6 +472,9 @@ HAS_SYSTEMTAP = true
endif
endif
+# Note that for testing purposes, one can do:
+# make HAS_EMBEDDED_OPENSSL_ALPN=false
+# to emulate the fact we do not have OpenSSL in the third_party folder.
ifeq ($(wildcard third_party/openssl/ssl/ssl.h),)
HAS_EMBEDDED_OPENSSL_ALPN = false
else
@@ -531,6 +543,7 @@ endif
endif
else
ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true)
+USE_SYSTEM_OPENSSL = false
OPENSSL_DEP = $(LIBDIR)/$(CONFIG)/openssl/libssl.a
OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/openssl/libssl.a $(LIBDIR)/$(CONFIG)/openssl/libcrypto.a
# need to prefix these to ensure overriding system libraries
@@ -540,9 +553,18 @@ ifeq ($(OPENSSL_REQUIRES_DL),true)
LIBS_SECURE = dl
endif
else
+ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true)
+USE_SYSTEM_OPENSSL = true
+CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0
+LIBS_SECURE = $(OPENSSL_LIBS)
+ifeq ($(OPENSSL_REQUIRES_DL),true)
+LIBS_SECURE += dl
+endif
+else
NO_SECURE = true
endif
endif
+endif
ifeq ($(OPENSSL_PKG_CONFIG),true)
LDLIBS_SECURE += $(shell pkg-config --libs-only-l openssl)
@@ -693,7 +715,7 @@ openssl_dep_message:
@echo
@echo "DEPENDENCY ERROR"
@echo
- @echo "The target you are trying to run requires OpenSSL with ALPN support."
+ @echo "The target you are trying to run requires OpenSSL."
@echo "Your system doesn't have it, and neither does the third_party directory."
@echo
@echo "Please consult INSTALL to get more information."
@@ -751,6 +773,7 @@ ${tgt.name}: $(BINDIR)/$(CONFIG)/${tgt.name}
run_dep_checks:
$(OPENSSL_ALPN_CHECK_CMD) || true
+ $(OPENSSL_NPN_CHECK_CMD) || true
$(ZLIB_CHECK_CMD) || true
$(PERFTOOLS_CHECK_CMD) || true
$(PROTOBUF_CHECK_CMD) || true
@@ -771,7 +794,7 @@ ifeq ($(SYSTEM),Darwin)
else
ifeq ($(SYSTEM),MINGW32)
@echo "We currently don't have a good way to compile OpenSSL in-place under msys."
- @echo "Please provide an ALPN-capable OpenSSL in your mingw32 system."
+ @echo "Please provide a OpenSSL in your mingw32 system."
@echo
@echo "Note that you can find a compatible version of the libraries here:"
@echo
@@ -1299,11 +1322,11 @@ PUBLIC_HEADERS_C += \\
LIB${lib.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC))))
-## If the library requires OpenSSL with ALPN, let's add some restrictions.
+## If the library requires OpenSSL, let's add some restrictions.
% if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check':
ifeq ($(NO_SECURE),true)
-# You can't build secure libraries if you don't have OpenSSL with ALPN.
+# You can't build secure libraries if you don't have OpenSSL.
$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: openssl_dep_error
@@ -1443,7 +1466,7 @@ endif
% endif
% if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check':
## If the lib was secure, we have to close the Makefile's if that tested
-## the presence of an ALPN-capable OpenSSL.
+## the presence of OpenSSL.
endif
% endif
@@ -1484,7 +1507,7 @@ ${tgt.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(b
% if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check':
ifeq ($(NO_SECURE),true)
-# You can't build secure targets if you don't have OpenSSL with ALPN.
+# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/${tgt.name}: openssl_dep_error