From 506df426dbeb0187bbd3654bd286b4100628fb16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>
Date: Tue, 29 Aug 2017 00:44:57 -0700
Subject: [PATCH] autotools: confirm openssl is working before using

latest versions of macOS provide pkg-config and libraries for an ancient
version of openssl as part of the system, but no headers

diff --git a/m4/libevent_openssl.m4 b/m4/libevent_openssl.m4
index c2040595..7b458134 100644
--- a/m4/libevent_openssl.m4
+++ b/m4/libevent_openssl.m4
@@ -39,6 +39,10 @@ case "$enable_openssl" in
 	done
 	;;
     esac
+    CPPFLAGS_SAVE=$CPPFLAGS
+    CPPFLAGS+=$OPENSSL_INCS
+    AC_CHECK_HEADERS([openssl/ssl.h], [], [have_openssl=no])
+    CPPFLAGS=$CPPFLAGS_SAVE
     AC_SUBST(OPENSSL_INCS)
     AC_SUBST(OPENSSL_LIBS)
     case "$have_openssl" in
-- 
2.17.0

