diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2012-04-29 16:18:12 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2012-04-29 16:18:12 -0700 |
commit | 6c9bd474aa08312ef2e2e9655a80e18db24a1680 (patch) | |
tree | 2539e04a1037206dc3853fbdbb33194bb2690aaa /configure | |
parent | 1be117908397b0ce065c07c60fa2b4ae778ff112 (diff) | |
download | zlib-6c9bd474aa08312ef2e2e9655a80e18db24a1680.tar.gz zlib-6c9bd474aa08312ef2e2e9655a80e18db24a1680.tar.bz2 zlib-6c9bd474aa08312ef2e2e9655a80e18db24a1680.zip |
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.
Diffstat (limited to '')
-rwxr-xr-x | configure | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -698,6 +698,32 @@ EOF | |||
698 | fi | 698 | fi |
699 | fi | 699 | fi |
700 | 700 | ||
701 | echo >> configure.log | ||
702 | |||
703 | # find a four-byte unsiged integer type for crc calculations | ||
704 | cat > $test.c <<EOF | ||
705 | #include <stdio.h> | ||
706 | #define is32(n,t) for(n=1,k=0;n;n<<=1,k++);if(k==32){puts(t);return 0;} | ||
707 | int main() { | ||
708 | int k; | ||
709 | unsigned i; | ||
710 | unsigned long l; | ||
711 | unsigned short s; | ||
712 | is32(i, "unsigned") | ||
713 | is32(l, "unsigned long") | ||
714 | is32(s, "unsigned short") | ||
715 | return 1; | ||
716 | } | ||
717 | EOF | ||
718 | Z_U4="" | ||
719 | if try $CC $CFLAGS $test.c -o $test && Z_U4=`$test` && test -n "$Z_U4"; then | ||
720 | sed < zconf.h "/#define Z_U4/s/\/\* \.\/configure may/#define Z_U4 $Z_U4 \/* .\/configure put the/" > zconf.temp.h | ||
721 | mv zconf.temp.h zconf.h | ||
722 | echo "Looking for a four-byte integer type... Found." | tee -a configure.log | ||
723 | else | ||
724 | echo "Looking for a four-byte integer type... Not found." | tee -a configure.log | ||
725 | fi | ||
726 | |||
701 | # clean up files produced by running the compiler and linker | 727 | # clean up files produced by running the compiler and linker |
702 | rm -f $test.[co] $test $test$shared_ext $test.gcno | 728 | rm -f $test.[co] $test $test$shared_ext $test.gcno |
703 | 729 | ||
@@ -724,6 +750,7 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log | |||
724 | echo STATICLIB = $STATICLIB >> configure.log | 750 | echo STATICLIB = $STATICLIB >> configure.log |
725 | echo TEST = $TEST >> configure.log | 751 | echo TEST = $TEST >> configure.log |
726 | echo VER = $VER >> configure.log | 752 | echo VER = $VER >> configure.log |
753 | echo Z_U4 = $Z_U4 >> configure.log | ||
727 | echo exec_prefix = $exec_prefix >> configure.log | 754 | echo exec_prefix = $exec_prefix >> configure.log |
728 | echo includedir = $includedir >> configure.log | 755 | echo includedir = $includedir >> configure.log |
729 | echo libdir = $libdir >> configure.log | 756 | echo libdir = $libdir >> configure.log |