aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/m4/odp_openssl.m4
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux-generic/m4/odp_openssl.m4')
-rw-r--r--platform/linux-generic/m4/odp_openssl.m460
1 files changed, 30 insertions, 30 deletions
diff --git a/platform/linux-generic/m4/odp_openssl.m4 b/platform/linux-generic/m4/odp_openssl.m4
index 1d520077c..4f51b6b01 100644
--- a/platform/linux-generic/m4/odp_openssl.m4
+++ b/platform/linux-generic/m4/odp_openssl.m4
@@ -1,37 +1,37 @@
-##########################################################################
-# Set optional OpenSSL path
-##########################################################################
-AC_ARG_WITH([openssl-path],
-AC_HELP_STRING([--with-openssl-path=DIR path to openssl libs and headers],
- [(or in the default path if not specified).]),
- [OPENSSL_PATH=$withval
- OPENSSL_CPPFLAGS="-I$OPENSSL_PATH/include"
- OPENSSL_LIBS="-L$OPENSSL_PATH/lib"
- ],[])
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2015 Linaro Limited
+#
##########################################################################
-# Save and set temporary compilation flags
-##########################################################################
-OLD_LDFLAGS=$LDFLAGS
-OLD_CPPFLAGS=$CPPFLAGS
-LIBS="$OPENSSL_LIBS $LIBS"
-CPPFLAGS="$OPENSSL_CPPFLAGS $CPPFLAGS"
+# Enable/disable usage of OpenSSL library
+##########################################################################
+AC_ARG_WITH([openssl],
+ [AS_HELP_STRING([--without-openssl],
+ [compile without OpenSSL (may result in disabled crypto and random support)]
+ [[default=with] (linux-generic)])],
+ [],
+ [with_openssl=yes])
+AS_IF([test "$with_openssl" != "no"],
+ [ODP_OPENSSL
+ have_openssl=1], [have_openssl=0])
+AM_CONDITIONAL([WITH_OPENSSL], [test x$with_openssl != xno])
+AC_DEFINE_UNQUOTED([_ODP_OPENSSL], [$have_openssl],
+ [Define to 1 to enable OpenSSL support])
##########################################################################
-# Check for OpenSSL availability
+# Enable/disable usage of OpenSSL for random data
##########################################################################
-AC_CHECK_LIB([crypto], [EVP_EncryptInit], [OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto"
- OPENSSL_STATIC_LIBS="$OPENSSL_LIBS -ldl"],
- [AC_MSG_FAILURE([OpenSSL libraries required])])
-AC_CHECK_HEADERS([openssl/des.h openssl/rand.h openssl/hmac.h openssl/evp.h], [],
- [AC_MSG_ERROR([OpenSSL headers required])])
+have_openssl_rand=1
+AC_ARG_ENABLE([openssl-rand],
+ [AS_HELP_STRING([--disable-openssl-rand],
+ [disable OpenSSL random data (use arch-specific instead)]
+ [[default=enabled] (linux-generic)])],
+ [if test "x$enableval" = "xno"; then
+ have_openssl_rand=0
+ fi])
-AC_SUBST([OPENSSL_CPPFLAGS])
-AC_SUBST([OPENSSL_LIBS])
-AC_SUBST([OPENSSL_STATIC_LIBS])
+AS_IF([test "$have_openssl" != "1"], [have_openssl_rand=0])
+AS_IF([test "$have_openssl_rand" = "1"], [openssl_rand=yes], [openssl_rand=no])
-##########################################################################
-# Restore old saved variables
-##########################################################################
-LIBS=$OLD_LIBS
-CPPFLAGS=$OLD_CPPFLAGS
+AC_DEFINE_UNQUOTED([_ODP_OPENSSL_RAND], [$have_openssl_rand],
+ [Define to 1 to enable OpenSSL support])