Remove runtime check in configure for four-byte integer type.
That didn't work when cross-compiling. Simply rely on limits.h. If a compiler does not have limits.h, then zconf.h.in should be modified to define Z_U4 as an unsiged four-byte integer type in order for crc32() to be fast. This also simplifies and makes more portable to check for a four- byte type using limits.h.
This commit is contained in:
26
configure
vendored
26
configure
vendored
@@ -740,32 +740,6 @@ EOF
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# find a four-byte unsiged integer type for crc calculations
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
#define is32(n,t) for(n=1,k=0;n;n<<=1,k++);if(k==32){puts(t);return 0;}
|
|
||||||
int main() {
|
|
||||||
int k;
|
|
||||||
unsigned i;
|
|
||||||
unsigned long l;
|
|
||||||
unsigned short s;
|
|
||||||
is32(i, "unsigned")
|
|
||||||
is32(l, "unsigned long")
|
|
||||||
is32(s, "unsigned short")
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
Z_U4=""
|
|
||||||
if try $CC $CFLAGS $test.c -o $test && Z_U4=`./$test` && test -n "$Z_U4"; then
|
|
||||||
sed < zconf.h "/#define Z_U4/s/\/\* \.\/configure may/#define Z_U4 $Z_U4 \/* .\/configure put the/" > zconf.temp.h
|
|
||||||
mv zconf.temp.h zconf.h
|
|
||||||
echo "Looking for a four-byte integer type... Found." | tee -a configure.log
|
|
||||||
else
|
|
||||||
echo "Looking for a four-byte integer type... Not found." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
|
|
||||||
# show the results in the log
|
# show the results in the log
|
||||||
echo >> configure.log
|
echo >> configure.log
|
||||||
echo ALL = $ALL >> configure.log
|
echo ALL = $ALL >> configure.log
|
||||||
|
|||||||
12
zconf.h
12
zconf.h
@@ -390,22 +390,16 @@ typedef uLong FAR uLongf;
|
|||||||
typedef Byte *voidp;
|
typedef Byte *voidp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ./configure may #define Z_U4 here */
|
|
||||||
|
|
||||||
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
# if (UINT_MAX == 0xffffffffUL)
|
# if (UINT_MAX == 4294967295)
|
||||||
# define Z_U4 unsigned
|
# define Z_U4 unsigned
|
||||||
# else
|
# elif (ULONG_MAX == 4294967295)
|
||||||
# if (ULONG_MAX == 0xffffffffUL)
|
|
||||||
# define Z_U4 unsigned long
|
# define Z_U4 unsigned long
|
||||||
# else
|
# elif (USHRT_MAX == 4294967295)
|
||||||
# if (USHRT_MAX == 0xffffffffUL)
|
|
||||||
# define Z_U4 unsigned short
|
# define Z_U4 unsigned short
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Z_U4
|
#ifdef Z_U4
|
||||||
typedef Z_U4 z_crc_t;
|
typedef Z_U4 z_crc_t;
|
||||||
|
|||||||
@@ -392,22 +392,16 @@ typedef uLong FAR uLongf;
|
|||||||
typedef Byte *voidp;
|
typedef Byte *voidp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ./configure may #define Z_U4 here */
|
|
||||||
|
|
||||||
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
# if (UINT_MAX == 0xffffffffUL)
|
# if (UINT_MAX == 4294967295)
|
||||||
# define Z_U4 unsigned
|
# define Z_U4 unsigned
|
||||||
# else
|
# elif (ULONG_MAX == 4294967295)
|
||||||
# if (ULONG_MAX == 0xffffffffUL)
|
|
||||||
# define Z_U4 unsigned long
|
# define Z_U4 unsigned long
|
||||||
# else
|
# elif (USHRT_MAX == 4294967295)
|
||||||
# if (USHRT_MAX == 0xffffffffUL)
|
|
||||||
# define Z_U4 unsigned short
|
# define Z_U4 unsigned short
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Z_U4
|
#ifdef Z_U4
|
||||||
typedef Z_U4 z_crc_t;
|
typedef Z_U4 z_crc_t;
|
||||||
|
|||||||
12
zconf.h.in
12
zconf.h.in
@@ -390,22 +390,16 @@ typedef uLong FAR uLongf;
|
|||||||
typedef Byte *voidp;
|
typedef Byte *voidp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ./configure may #define Z_U4 here */
|
|
||||||
|
|
||||||
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
# if (UINT_MAX == 0xffffffffUL)
|
# if (UINT_MAX == 4294967295)
|
||||||
# define Z_U4 unsigned
|
# define Z_U4 unsigned
|
||||||
# else
|
# elif (ULONG_MAX == 4294967295)
|
||||||
# if (ULONG_MAX == 0xffffffffUL)
|
|
||||||
# define Z_U4 unsigned long
|
# define Z_U4 unsigned long
|
||||||
# else
|
# elif (USHRT_MAX == 4294967295)
|
||||||
# if (USHRT_MAX == 0xffffffffUL)
|
|
||||||
# define Z_U4 unsigned short
|
# define Z_U4 unsigned short
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Z_U4
|
#ifdef Z_U4
|
||||||
typedef Z_U4 z_crc_t;
|
typedef Z_U4 z_crc_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user