Skip to content

Commit

Permalink
build-sys: Implemet AX_CHECK_DEFINE and use for OpenSSL #define's
Browse files Browse the repository at this point in the history
Some of the functions that OpenSSL uses are #define's for which
we need to check using a new AX_CHECK_DEFINE.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Jun 20, 2019
1 parent a047006 commit ac39b9d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ AS_IF([test "x$enable_use_openssl_functions" != "xno"], [
AC_CHECK_LIB([crypto], [EVP_PKEY_verify_init],, not_found=1)
AC_CHECK_LIB([crypto], [EVP_PKEY_verify],, not_found=1)
AC_CHECK_LIB([crypto], [EVP_get_digestbyname],, not_found=1)
AX_CHECK_DEFINE([<openssl/rsa.h>], [EVP_PKEY_CTX_set0_rsa_oaep_label],, not_found=1)
AX_CHECK_DEFINE([<openssl/rsa.h>], [EVP_PKEY_CTX_set_rsa_padding],, not_found=1)
AX_CHECK_DEFINE([<openssl/rsa.h>], [EVP_PKEY_CTX_set_rsa_oaep_md],, not_found=1)
AX_CHECK_DEFINE([<openssl/evp.h>], [EVP_PKEY_CTX_set_signature_md],, not_found=1)
if test "x$not_found" = "x0"; then
use_openssl_functions_rsa=1
use_openssl_functions_for="${use_openssl_functions_for}RSA "
Expand Down
30 changes: 30 additions & 0 deletions m4/ax_check_define.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SYNOPSIS
#
# AX_CHECK_DEFINE(includefile, define, [ACTION-SUCCESS], [ACTION-FAILURE])
#
# DESCRIPTION
#
# Check whether the given #define is available in the given #include file
#
# LICENSE
#
# See the root directory of the libtpms project for the LICENSE
#
AC_DEFUN([AX_CHECK_DEFINE],
[AC_PREREQ(2.64)
AC_MSG_CHECKING(whether $2 is defined in $1)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include $1]],
[[#ifndef $2
#error $2 not defined
#endif]])],
[
AC_MSG_RESULT([yes])
[$3]
],
[
AC_MSG_RESULT([no])
[$4]
])
]
)

0 comments on commit ac39b9d

Please sign in to comment.