diff options
author | 2018-02-08 08:34:03 -0800 | |
---|---|---|
committer | 2018-02-08 09:14:52 -0800 | |
commit | 0c89b3ccba7c9b7332ab67ae1936aff51ca62367 (patch) | |
tree | 70c1b1d160d4c6d0a83395ca9a87c1264d0d3439 /SoftHSMv2/m4/acx_openssl.m4 | |
parent | 945613b4db4e07f75d2bc7463db580ddfaa700fd (diff) |
Initial sshsm project structure
Issue-ID: AAF-94
Change-Id: I5e82fff418e7567b161acf9b98013a9b85ffc5b4
Signed-off-by: NingSun <ning.sun@intel.com>
Diffstat (limited to 'SoftHSMv2/m4/acx_openssl.m4')
-rw-r--r-- | SoftHSMv2/m4/acx_openssl.m4 | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/SoftHSMv2/m4/acx_openssl.m4 b/SoftHSMv2/m4/acx_openssl.m4 new file mode 100644 index 0000000..e90c78f --- /dev/null +++ b/SoftHSMv2/m4/acx_openssl.m4 @@ -0,0 +1,60 @@ +AC_DEFUN([ACX_OPENSSL],[ + AC_ARG_WITH(openssl, + AC_HELP_STRING([--with-openssl=PATH],[Specify prefix of path of OpenSSL]), + [ + OPENSSL_PATH="$withval" + ], + [ + OPENSSL_PATH="/usr/local" + ]) + + AC_MSG_CHECKING(what are the OpenSSL includes) + OPENSSL_INCLUDES="-I$OPENSSL_PATH/include" + AC_MSG_RESULT($OPENSSL_INCLUDES) + + AC_MSG_CHECKING(what are the OpenSSL libs) + OPENSSL_LIBS="-L$OPENSSL_PATH/lib -lcrypto" + AC_MSG_RESULT($OPENSSL_LIBS) + + tmp_CPPFLAGS=$CPPFLAGS + tmp_LIBS=$LIBS + + CPPFLAGS="$CPPFLAGS $OPENSSL_INCLUDES" + LIBS="$OPENSSL_LIBS $LIBS" + + AC_CHECK_HEADERS([openssl/ssl.h],,[AC_MSG_ERROR([Can't find OpenSSL headers])]) + AC_CHECK_LIB(crypto, BN_new,,[AC_MSG_ERROR([Can't find OpenSSL library])]) + + AC_MSG_CHECKING([for OpenSSL version]) + CHECK_OPENSSL_VERSION=m4_format(0x%02x%02x%02x000L, $1, $2, $3) + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_SOURCE([[ + #include <openssl/ssl.h> + #include <openssl/opensslv.h> + int main() + { + #ifndef OPENSSL_VERSION_NUMBER + return -1; + #endif + #if OPENSSL_VERSION_NUMBER >= $CHECK_OPENSSL_VERSION + return 0; + #else + return 1; + #endif + } + ]]) + ],[ + AC_MSG_RESULT([>= $1.$2.$3]) + ],[ + AC_MSG_RESULT([< $1.$2.$3]) + AC_MSG_ERROR([OpenSSL library too old ($1.$2.$3 or later required)]) + ],[]) + AC_LANG_POP([C]) + + CPPFLAGS=$tmp_CPPFLAGS + LIBS=$tmp_LIBS + + AC_SUBST(OPENSSL_INCLUDES) + AC_SUBST(OPENSSL_LIBS) +]) |