[Asterisk-code-review] BuildSystem: compile-time check for bio_method being exposed (asterisk[master])
Philip Prindeville
asteriskteam at digium.com
Sat Mar 26 17:02:37 CDT 2022
Philip Prindeville has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18300 )
Change subject: BuildSystem: compile-time check for bio_method being exposed
......................................................................
BuildSystem: compile-time check for bio_method being exposed
Change-Id: Ie47ce13dfa64b21ae9a803ad559808ab2f387cbe
---
M configure
M configure.ac
M include/asterisk/autoconfig.h.in
3 files changed, 67 insertions(+), 19 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/00/18300/1
diff --git a/configure b/configure
index ac26b46..daa54b2 100755
--- a/configure
+++ b/configure
@@ -10201,6 +10201,44 @@
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if BIO_METHOD internals are exposed" >&5
+$as_echo_n "checking if BIO_METHOD internals are exposed... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <openssl/bio.h>
+
+int
+main ()
+{
+static BIO_METHOD bio_methods = {
+ .type = BIO_TYPE_BIO,
+ .name = "bio test for conifgure",
+ .bwrite = NULL,
+ .ctrl = NULL,
+ .create = NULL,
+ .destroy = NULL,
+ };
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define HAVE_OPENSSL_BIO_METHOD 1" >>confdefs.h
+
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
# If neither --without-ssl (PBX_OPENSSL=-1) nor --without-crypto (PBX_CRYPTO=-1)
# and there were no directories atdded to --with-ssl and --with-crypto, and
# pkg-config is installed (which is should be by install_prereq).
@@ -10389,13 +10427,9 @@
fi
fi
- if test $PBX_OPENSSL -eq 1 ; then
- printf "%s\n" "#define HAVE_OPENSSL_BIO_METHOD 1" >>confdefs.h
-
- PBX_OPENSSL_BIO_METHOD=1
- else
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking fallback system openssl" >&5
-printf "%s\n" "$as_me: checking fallback system openssl" >&6;}
+ if test $PBX_OPENSSL -ne 1 ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking fallback system openssl" >&5
+$as_echo "$as_me: checking fallback system openssl" >&6;}
if test "x${PBX_OPENSSL}" != "x1" -a "${USE_OPENSSL}" != "no"; then
@@ -10484,10 +10518,8 @@
fi
fi
- fi
-
- if test $PBX_OPENSSL -eq 1; then
- printf "%s\n" "#define HAVE_CRYPTO 1" >>confdefs.h
+ else
+ $as_echo "#define HAVE_CRYPTO 1" >>confdefs.h
PBX_CRYPTO=1
fi
diff --git a/configure.ac b/configure.ac
index b92db5d..3e436a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -472,6 +472,27 @@
AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
AST_EXT_LIB_SETUP_OPTIONAL([OPENSSL_BIO_METHOD], [OpenSSL BIO Method Support], [CRYPTO], [crypto])
+AC_MSG_CHECKING(if BIO_METHOD internals are exposed)
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <openssl/bio.h>
+ ],
+ [static BIO_METHOD bio_methods = {
+ .type = BIO_TYPE_BIO,
+ .name = "bio_methods test for configure",
+ .bwrite = NULL,
+ .ctrl = NULL,
+ .create = NULL,
+ .destroy = NULL,
+ };])],
+ [
+ AC_MSG_RESULT(yes)
+ ],[
+ AC_MSG_RESULT(no)
+ AC_DEFINE([HAVE_OPENSSL_BIO_METHOD], 1, [Define if your system doesn't expose BIO_METHOD structure internals])
+ ]
+)
+
# If neither --without-ssl (PBX_OPENSSL=-1) nor --without-crypto (PBX_CRYPTO=-1)
# and there were no directories atdded to --with-ssl and --with-crypto, and
# pkg-config is installed (which is should be by install_prereq).
@@ -483,15 +504,10 @@
AC_MSG_NOTICE(checking whether alternate openssl11 is installed)
AST_PKG_CONFIG_CHECK([OPENSSL], [openssl11])
fi
- if test $PBX_OPENSSL -eq 1 ; then
- AC_DEFINE([HAVE_OPENSSL_BIO_METHOD], 1)
- PBX_OPENSSL_BIO_METHOD=1
- else
+ if test $PBX_OPENSSL -ne 1 ; then
AC_MSG_NOTICE(checking fallback system openssl)
AST_PKG_CONFIG_CHECK([OPENSSL], [openssl])
- fi
-
- if test $PBX_OPENSSL -eq 1; then
+ else
AC_DEFINE([HAVE_CRYPTO], 1)
PBX_CRYPTO=1
fi
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 40b9285..14a2d7b 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -577,7 +577,7 @@
/* Define if your system has the OPENSSL libraries. */
#undef HAVE_OPENSSL
-/* Define to 1 if CRYPTO has the OpenSSL BIO Method Support feature. */
+/* Define if your system doesn't expose BIO_METHOD structure internals */
#undef HAVE_OPENSSL_BIO_METHOD
/* Define to 1 if you have the Opus library. */
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18300
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ie47ce13dfa64b21ae9a803ad559808ab2f387cbe
Gerrit-Change-Number: 18300
Gerrit-PatchSet: 1
Gerrit-Owner: Philip Prindeville <philipp at redfish-solutions.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220326/90d7ef2b/attachment.html>
More information about the asterisk-code-review
mailing list