From 1bb4f8bb9e7406c14961365a652ce2e16ab7664c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 5 Aug 2016 23:15:08 +0000 Subject: The concept of endianness seems to be somewhat newfangled, so the respective conversion functions are not yet properly standardized. Rumour has it that POSIX is working on it, though. For now, sprinkle some configuration glue. --- configure | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'configure') diff --git a/configure b/configure index def91028..f5d8f3e1 100755 --- a/configure +++ b/configure @@ -50,6 +50,7 @@ BUILD_CGI=0 HAVE_DIRENT_NAMLEN= HAVE_EFTYPE= +HAVE_ENDIAN= HAVE_ERR= HAVE_FTS= HAVE_GETLINE= @@ -57,6 +58,7 @@ HAVE_GETSUBOPT= HAVE_ISBLANK= HAVE_MKDTEMP= HAVE_NANOSLEEP= +HAVE_NTOHL= HAVE_OHASH= HAVE_PATH_MAX= HAVE_PLEDGE= @@ -72,6 +74,7 @@ HAVE_STRLCPY= HAVE_STRPTIME= HAVE_STRSEP= HAVE_STRTONUM= +HAVE_SYS_ENDIAN= HAVE_VASPRINTF= HAVE_WCHAR= @@ -197,6 +200,8 @@ get_locale() { # --- library functions --- runtest dirent-namlen DIRENT_NAMLEN || true +runtest be32toh ENDIAN || true +runtest be32toh SYS_ENDIAN -DSYS_ENDIAN || true runtest EFTYPE EFTYPE || true runtest err ERR || true runtest fts FTS || true @@ -204,6 +209,7 @@ runtest getline GETLINE || true runtest getsubopt GETSUBOPT || true runtest isblank ISBLANK || true runtest mkdtemp MKDTEMP || true +runtest ntohl NTOHL || true runtest PATH_MAX PATH_MAX || true runtest pledge PLEDGE || true runtest sandbox_init SANDBOX_INIT || true @@ -220,6 +226,14 @@ runtest strsep STRSEP || true runtest strtonum STRTONUM || true runtest vasprintf VASPRINTF || true +if [ ${HAVE_ENDIAN} -eq 0 -a \ + ${HAVE_SYS_ENDIAN} -eq 0 -a \ + ${HAVE_NTOHL} -eq 0 ]; then + echo "FATAL: no endian conversion functions found" 1>&2 + echo "FATAL: no endian conversion functions found" 1>&3 + exit 1 +fi + # --- wide character and locale support --- if get_locale; then runtest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true @@ -296,15 +310,21 @@ echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\"" [ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\"" [ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL" [ ${HAVE_PATH_MAX} -eq 0 ] && echo "#define PATH_MAX 4096" +if [ ${HAVE_ENDIAN} -eq 0 -a ${HAVE_SYS_ENDIAN} -eq 0 ]; then + echo "#define be32toh ntohl" + echo "#define htobe32 htonl" +fi cat << __HEREDOC__ #define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN} +#define HAVE_ENDIAN ${HAVE_ENDIAN} #define HAVE_ERR ${HAVE_ERR} #define HAVE_FTS ${HAVE_FTS} #define HAVE_GETLINE ${HAVE_GETLINE} #define HAVE_GETSUBOPT ${HAVE_GETSUBOPT} #define HAVE_ISBLANK ${HAVE_ISBLANK} #define HAVE_MKDTEMP ${HAVE_MKDTEMP} +#define HAVE_NTOHL ${HAVE_NTOHL} #define HAVE_PLEDGE ${HAVE_PLEDGE} #define HAVE_PROGNAME ${HAVE_PROGNAME} #define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY} @@ -318,6 +338,7 @@ cat << __HEREDOC__ #define HAVE_STRPTIME ${HAVE_STRPTIME} #define HAVE_STRSEP ${HAVE_STRSEP} #define HAVE_STRTONUM ${HAVE_STRTONUM} +#define HAVE_SYS_ENDIAN ${HAVE_SYS_ENDIAN} #define HAVE_VASPRINTF ${HAVE_VASPRINTF} #define HAVE_WCHAR ${HAVE_WCHAR} #define HAVE_OHASH ${HAVE_OHASH} -- cgit