Commit c6136b0b by Jonas Termansen

Add endianness detection fallbacks.

parent 04b93162
......@@ -9,3 +9,4 @@ genfixed
gentrees
config.status
Makefile
endian.h
......@@ -124,7 +124,7 @@ clean:
rm -rf conftest.* conftest
distclean: clean
rm -f Makefile config.status
rm -f Makefile config.status endian.h
maintainer-clean: distclean
rm -f crc32.h inffixed.h trees.h
......
......@@ -26,7 +26,6 @@ TODO:
* What's with inflateMark doing `return -1L << 16;'?
* The windowBits code in inflateReset2 is needlessly hard to read.
* Probably delete the version checks, we're not going to break the ABI.
* endian.h is a problem, either use machine/endian.h on OS X or pikhq's CRC.
* Perhaps restore gzflags that was removed in 1.2.7 for ABI compatibility.
* I'd like to see a proof that compressBound is correct.
* Do we need to modify deflate_copyright?
......
......@@ -683,6 +683,46 @@ if check c_compile "for _FILE_OFFSET_BITS value needed for large files on build"
fi
rm -f conftest.c
#
# Detect endian detection or fallbacks.
#
rm -f endian.h
cat > conftest.c << EOF
#ifdef TRY_ENDIAN_H
#include <endian.h>
#endif
#ifdef TRY_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
#ifdef TRY_MACHINE_ENDIAN_H
#include <machine/endian.h>
#endif
#if !defined(BYTE_ORDER)
#error "not satisfied"
#endif
EOF
if check c_compile "for endian.h on host" \
"$CC" "$CFLAGS" "$CPPFLAGS -DTRY_ENDIAN_H" "$LDFLAGS" "$LIBS"; then
:
elif check c_compile "for sys/endian.h on host" \
"$CC" "$CFLAGS" "$CPPFLAGS -DTRY_SYS_ENDIAN_H" "$LDFLAGS" "$LIBS"; then
echo "#include <sys/endian.h>" > endian.h
elif check c_compile "for machine/endian.h on host" \
"$CC" "$CFLAGS" "$CPPFLAGS -DTRY_MACHINE_ENDIAN_H" "$LDFLAGS" "$LIBS"; then
echo "#include <machine/endian.h>" > endian.h
else
cat > endian.h << EOF
#ifndef ENDIAN_H
#define ENDIAN_H
#define BYTE_ORDER 0000
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321
#endif
EOF
fi
#
# Detect the kind of shared libaries.
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment