more fixes for endian portability.

This commit is contained in:
TLINDEN
2013-10-29 22:51:06 +01:00
parent 08ce1c1b8e
commit bfc9f5cb5f
4 changed files with 122 additions and 44 deletions

View File

@@ -173,6 +173,7 @@ if test -n "$_ldlib"; then
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${_ldlib}"
AC_MSG_RESULT([LD_LIBRARY_PATH: $LD_LIBRARY_PATH])
fi
AC_MSG_CHECKING([is libsodium compiled correctly])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
@@ -189,6 +190,26 @@ AC_LANG_PROGRAM([[
]
)
# check endianess
# program returns 0 on little and 1 on big endian systems
AC_MSG_CHECKING([are we on a big endian system])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[]],[[long one= 1; exit(!(*((char *)(&one)))); ]])],
[
AC_MSG_RESULT([no])
bigendian=""
],
[
AC_MSG_RESULT([yes])
bigendian=1
]
)
if test -n "$bigendian"; then
CFLAGS="$CFLAGS -D__BYTE_ORDER=__BIG_ENDIAN"
fi
# Specify output files
AC_CONFIG_FILES([Makefile libpcp/Makefile src/Makefile man/Makefile tests/Makefile])
AC_OUTPUT