Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect 'isascii' at configuration stage #8158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

redbaron
Copy link
Contributor

@redbaron redbaron commented Nov 7, 2024

Description

Detect 'isascii' at configuration stage

Previously platforms without isascii had to manually
indicate it's absence with NO_STDLIB_ISASCII define.

It is trivial to detect function availability, so do that.

Testing

Built on platform with no isascii available

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

Previously platforms without isascii had to manually
indicate it's absence with `NO_STDLIB_ISASCII` define.

It is trivial to detect function availability, so do that.
@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

@@ -2504,7 +2504,6 @@ extern void uITRON4_free(void *p) ;
#define WOLFSSL_DH_CONST
#define WOLFSSL_HAVE_MAX
#define NO_WRITEV
#define NO_STDLIB_ISASCII
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just occurred to me, that HAVE_ISASCII is stored in config.h which is optional. Maybe this define should stay as is?

@embhorn
Copy link
Member

embhorn commented Nov 12, 2024

@redbaron is approved as a wolfSSL contributor

Copy link
Contributor

@douzzer douzzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an improvement to me, but you do need to accommodate autotools too:

diff --git a/configure.ac b/configure.ac
index 16af3bb24..7b0e35912 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,7 +119,7 @@ then
     AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_EXPERIMENTAL_SETTINGS"
 fi
 
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h time.h sys/ioctl.h sys/socket.h sys/time.h errno.h sys/un.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h time.h sys/ioctl.h sys/socket.h sys/time.h errno.h sys/un.h ctype.h])
 AC_CHECK_LIB([network],[socket])
 AC_C_BIGENDIAN
 AC_C___ATOMIC
@@ -128,8 +128,8 @@ AC_CHECK_HEADER(stdatomic.h, [AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSL_HAVE_ATOMIC_H"
 # check if functions of interest are linkable, but also check if
 # they're declared by the expected headers, and if not, supersede the
 # unusable positive from AC_CHECK_FUNCS().
-AC_CHECK_FUNCS([gethostbyname getaddrinfo gettimeofday gmtime_r gmtime_s inet_ntoa memset socket strftime atexit])
-AC_CHECK_DECLS([gethostbyname, getaddrinfo, gettimeofday, gmtime_r, gmtime_s, inet_ntoa, memset, socket, strftime, atexit], [], [
+AC_CHECK_FUNCS([gethostbyname getaddrinfo gettimeofday gmtime_r gmtime_s inet_ntoa memset socket strftime atexit isascii])
+AC_CHECK_DECLS([gethostbyname, getaddrinfo, gettimeofday, gmtime_r, gmtime_s, inet_ntoa, memset, socket, strftime, atexit, isascii], [], [
 if test "$(eval echo \$"$(eval 'echo ac_cv_func_${as_decl_name}')")" = "yes"
 then
     AC_MSG_NOTICE([    note: earlier check for $(eval 'echo ${as_decl_name}') superseded.])
@@ -159,6 +159,9 @@ fi
 #ifdef HAVE_STDLIB_H
     #include <stdlib.h>
 #endif
+#ifdef HAVE_CTYPE_H
+    #include <ctype.h>
+#endif
 ]])
 
 AC_PROG_INSTALL

@douzzer douzzer assigned redbaron and unassigned wolfSSL-Bot Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants