From 8251fa1315dfe27090430cca36978990855907b0 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 29 Mar 2012 02:13:33 +0900 Subject: [PATCH] Made OpenSSL not mandatory. Don't build examples if OpenSSL is not found. Spdylay library itself does not depend on OpenSSL. The example programs in examples directory do. Spdylay library should be built without OpenSSL. --- configure.ac | 13 ++++++++++++- examples/Makefile.am | 4 ++++ tests/Makefile.am | 8 +++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index abd64af..bb47bfa 100644 --- a/configure.ac +++ b/configure.ac @@ -88,7 +88,16 @@ fi AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ]) # openssl (for examples) -PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1]) +PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1], + [have_openssl=yes], [have_openssl=no]) +if test "x${have_openssl}" = "xno"; then + AC_MSG_NOTICE($OPENSSL_PKG_ERRORS) + AC_MSG_NOTICE([The example programs will not be built.]) +fi + +# The example programs depend on OpenSSL +enable_examples=$have_openssl +AM_CONDITIONAL([ENABLE_EXAMPLES], [ test "x${enable_examples}" = "xyes" ]) # Checks for header files. AC_CHECK_HEADERS([ \ @@ -152,4 +161,6 @@ AC_MSG_NOTICE([summary of build options: CFlags: ${CFLAGS} Library types: Shared=${enable_shared}, Static=${enable_static} CUnit: ${have_cunit} + OpenSSL: ${have_openssl} + Examples: ${enable_examples} ]) diff --git a/examples/Makefile.am b/examples/Makefile.am index 8e2f5ec..6b135c0 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -21,6 +21,8 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +if ENABLE_EXAMPLES + AM_CFLAGS = -Wall AM_CPPFLAGS = -Wall -I$(srcdir)/../lib/includes -I$(builddir)/../lib/includes \ @OPENSSL_CFLAGS@ @DEFS@ @@ -63,3 +65,5 @@ spdynative_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} \ ${SPDY_SERVER_OBJECTS} ${SPDY_SERVER_HFILES} \ spdy.h spdynative.cc endif # HAVE_STDCXX_11 + +endif # ENABLE_EXAMPLES diff --git a/tests/Makefile.am b/tests/Makefile.am index 6b88052..03e1904 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -40,6 +40,12 @@ main_LDFLAGS = -static @CUNIT_LIBS@ AM_CFLAGS = -Wall -g -O2 -I${top_srcdir}/lib -I${top_srcdir}/lib/includes -I${top_builddir}/lib/includes \ @CUNIT_CFLAGS@ @DEFS@ -TESTS = main end_to_end.py +TESTS = main + +if ENABLE_EXAMPLES + +TESTS += end_to_end.py + +endif # ENABLE_EXAMPLES endif # HAVE_CUNIT