diff options
author | Omar Polo <op@omarpolo.com> | 2023-07-02 09:14:44 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-07-02 09:14:44 +0000 |
commit | 5d2f4b1611d724a3dbf0d4b8629119cf1ad11e87 (patch) | |
tree | b97025c500d44a54cd27168712535b883b946d5d /configure | |
parent | c9c44c657187b6b312a863f01afa6ea5956cb84d (diff) |
add compat for endian (now required by imsg)
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -244,6 +244,22 @@ if ! runtest wait_any WAIT_ANY; then CFLAGS="${CFLAGS} -DWAIT_ANY=-1" fi +HAVE_ENDIAN_H=0 +HAVE_SYS_ENDIAN_H=0 +HAVE_MACHINE_ENDIAN=0 + +runtest endian_h ENDIAN_H || \ +runtest sys_endian_h SYS_ENDIAN_H || \ +runtest machine_endian MACHINE_ENDIAN || true + +if [ ${HAVE_ENDIAN_H} -eq 0 -a \ + ${HAVE_SYS_ENDIAN_H} -eq 0 -a \ + ${HAVE_MACHINE_ENDIAN} -eq 0 ]; then + echo "FATAL: no endian header found" 1>&2 + echo "FATAL: no endian header found" 1>&3 + exit 1 +fi + runtest err ERR || true runtest explicit_bzero EXPLICIT_BZERO || true runtest freezero FREEZERO || true @@ -349,6 +365,20 @@ cat <<__HEREDOC__ __HEREDOC__ +if [ ${HAVE_ENDIAN_H} -eq 1 ]; then + echo "#include <endian.h>" +elif [ ${HAVE_SYS_ENDIAN_H} -eq 1 ]; then + echo "#include <sys/endian.h>" +elif [ ${HAVE_MACHINE_ENDIAN} -eq 1 ]; then + cat <<__HEREDOC__ +#include <machine/endian.h> +#include <libkern/OSByteOrder.h> +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htobe64(x) OSSwapHostToBigInt64(x) +__HEREDOC__ +fi + [ ${HAVE_EXPLICIT_BZERO} -eq 0 -o \ ${HAVE_FREEZERO} -eq 0 -o \ ${HAVE_REALLOCARRAY} -eq 0 -o \ |