File 0005-configure-don-t-use-pkgconfig-to-find-the-engines-di.patch of Package openssl_tpm_engine
From 39f3517a7883291668d2e1a4a1812c31ddf3de3f Mon Sep 17 00:00:00 2001
From: James Bottomley <James.Bottomley@HansenPartnership.com>
Date: Sat, 14 Jul 2018 14:41:16 -0700
Subject: [PATCH 5/5] configure: don't use pkgconfig to find the engines
directory
For some reason it's giving the wrong one, so do an open coded test
copied from openssl_tpm2_engine.
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
configure.in | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/configure.in b/configure.in
index bbfdca7..bf63689 100644
--- a/configure.in
+++ b/configure.in
@@ -70,15 +70,39 @@ AC_TRY_COMPILE(
)
AM_CONDITIONAL([OPENSSL_11], [test x$openssl_11 = xtrue])
-PKG_CHECK_MODULES([libcrypto], [libcrypto],
- [libcrypto_enginesdir=`$PKG_CONFIG --variable=enginesdir libcrypto`],
- [libcrypto_enginesdir="\${libdir}/openssl/engines"]
-)
+##
+# this check fails ... probably an opensuse issue
+#
+#PKG_CHECK_MODULES([libcrypto], [libcrypto],
+# [libcrypto_enginesdir=`$PKG_CONFIG --variable=enginesdir libcrypto`],
+# [libcrypto_enginesdir="\${libdir}/openssl/engines"]
+#)
+##
+# so do an alternative test to get openssl to tell you where engines are
+##
+
+AC_LANG(C)
+AC_LANG_CONFTEST(
+ [AC_LANG_PROGRAM(
+ [[#define HEADER_CRYPTLIB_H
+ #include <openssl/crypto.h>
+ #include <stdio.h>]],
+ [[#if OPENSSL_VERSION_NUMBER < 0x10100000
+ puts(ENGINESDIR);
+ #else
+ puts(OpenSSL_version(OPENSSL_ENGINES_DIR));
+ #endif
+ ]])])
+gcc $CFLAGS conftest.c -lcrypto
+enginesdir=`./a.out|sed 's/ENGINESDIR: //'`
+if test -z "$enginesdir" ; then
+ AC_MSG_FAILURE([Failed to find SSL engines directory])
+fi
AC_ARG_WITH([enginedir],
[AS_HELP_STRING([--with-enginedir=DIR], [engine directory])],
[enginedir=$withval],
- [enginedir="$libcrypto_enginesdir"])
+ [enginedir="$enginesdir"])
AC_SUBST([enginedir], [$enginedir])
CFLAGS="$CFLAGS -Wall"
--
2.13.7