Fix type mismatch between get_crc_table() and crc_table.
crc_table is made using a four-byte integer (when that can be determined). However get_crc_table() returned a pointer to an unsigned long, which could be eight bytes. This fixes that by creating a new z_crc_t type for the crc_table. This type is also used for the BYFOUR crc calculations that depend on a four-byte type. The four-byte type can now be determined by ./configure, which also solves a problem where ./configure --solo would never use BYFOUR. No the Z_U4 #define indicates that four- byte integer was found either by ./configure or by zconf.h.
This commit is contained in:
27
configure
vendored
27
configure
vendored
@@ -698,6 +698,32 @@ EOF
|
||||
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
|
||||
|
||||
# clean up files produced by running the compiler and linker
|
||||
rm -f $test.[co] $test $test$shared_ext $test.gcno
|
||||
|
||||
@@ -724,6 +750,7 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log
|
||||
echo STATICLIB = $STATICLIB >> configure.log
|
||||
echo TEST = $TEST >> configure.log
|
||||
echo VER = $VER >> configure.log
|
||||
echo Z_U4 = $Z_U4 >> configure.log
|
||||
echo exec_prefix = $exec_prefix >> configure.log
|
||||
echo includedir = $includedir >> configure.log
|
||||
echo libdir = $libdir >> configure.log
|
||||
|
||||
Reference in New Issue
Block a user