[Asterisk-code-review] test: Check for the presence of open_memstream() to configure (asterisk[master])

Philip Prindeville asteriskteam at digium.com
Tue May 3 13:16:47 CDT 2022


Philip Prindeville has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18524 )


Change subject: test: Check for the presence of open_memstream() to configure
......................................................................

test: Check for the presence of open_memstream() to configure

ASTERISK-30037

Change-Id: Ifeaaf292dec21aa8076eab7acf8f42d05bedfaf7
Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
---
M configure
M configure.ac
M include/asterisk/autoconfig.h.in
M main/tcptls.c
4 files changed, 22 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/24/18524/1

diff --git a/configure b/configure
index ac26b46..305eb4c 100755
--- a/configure
+++ b/configure
@@ -18441,6 +18441,12 @@
   printf "%s\n" "#define HAVE_NEWLOCALE 1" >>confdefs.h
 
 fi
+ac_fn_c_check_func "$LINENO" "open_memstream" "ac_cv_func_open_memstream"
+if test "x$ac_cv_func_open_memstream" = xyes
+then :
+  printf "%s\n" "#define HAVE_OPEN_MEMSTREAM 1" >>confdefs.h
+
+fi
 ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2"
 if test "x$ac_cv_func_pipe2" = xyes
 then :
@@ -18653,6 +18659,10 @@
 fi
 
 
+if test "x$ac_cv_func_open_memstream" != "xyes"; then
+	as_fn_error $? "*** Require open_memstream() but it's not detected!" "$LINENO" 5
+fi
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for htonll" >&5
 printf %s "checking for htonll... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
diff --git a/configure.ac b/configure.ac
index b92db5d..b4be643 100644
--- a/configure.ac
+++ b/configure.ac
@@ -840,7 +840,11 @@
 AC_FUNC_STRTOD
 AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale pipe2 ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv uselocale utime vasprintf getpeereid sysctl swapctl malloc_trim])
+AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap newlocale open_memstream pipe2 ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv uselocale utime vasprintf getpeereid sysctl swapctl malloc_trim])
+
+if test "x$ac_cv_func_open_memstream" != "xyes"; then
+	AC_MSG_ERROR([*** Require open_memstream() but it's not detected!])
+fi
 
 AC_MSG_CHECKING(for htonll)
 AC_LINK_IFELSE(
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 40b9285..563a499 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -580,6 +580,9 @@
 /* Define to 1 if CRYPTO has the OpenSSL BIO Method Support feature. */
 #undef HAVE_OPENSSL_BIO_METHOD
 
+/* Define to 1 if you have the `open_memstream' function. */
+#undef HAVE_OPEN_MEMSTREAM
+
 /* Define to 1 if you have the Opus library. */
 #undef HAVE_OPUS
 
diff --git a/main/tcptls.c b/main/tcptls.c
index b2756d1..729f787 100644
--- a/main/tcptls.c
+++ b/main/tcptls.c
@@ -108,6 +108,9 @@
 	return ret;
 }
 
+#ifndef HAVE_OPEN_MEMSTREAM
+#error Require open_memstream() but not detected!
+#else
 static void write_openssl_error_to_log(void)
 {
 	FILE *fp;
@@ -129,6 +132,7 @@
 	ast_free(buffer);
 }
 #endif
+#endif
 
 /*! \brief
 * creates a FILE * from the fd passed by the accept thread.

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18524
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ifeaaf292dec21aa8076eab7acf8f42d05bedfaf7
Gerrit-Change-Number: 18524
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/20220503/76ee47ef/attachment.html>


More information about the asterisk-code-review mailing list