diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2013-03-23 22:27:43 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2013-03-23 22:30:09 -0700 |
commit | 03ff48cc67937fbb026a7952c0351615ef9be4e5 (patch) | |
tree | 3050209fccaad5c9f29f9495f053f9dacde92d6f | |
parent | 66fcefbb2fb867f3f941b71140532de8593f29d6 (diff) | |
download | zlib-03ff48cc67937fbb026a7952c0351615ef9be4e5.tar.gz zlib-03ff48cc67937fbb026a7952c0351615ef9be4e5.tar.bz2 zlib-03ff48cc67937fbb026a7952c0351615ef9be4e5.zip |
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.
-rwxr-xr-x | configure | 26 | ||||
-rw-r--r-- | zconf.h | 16 | ||||
-rw-r--r-- | zconf.h.cmakein | 16 | ||||
-rw-r--r-- | zconf.h.in | 16 |
4 files changed, 15 insertions, 59 deletions
@@ -740,32 +740,6 @@ EOF | |||
740 | fi | 740 | fi |
741 | fi | 741 | fi |
742 | 742 | ||
743 | echo >> configure.log | ||
744 | |||
745 | # find a four-byte unsiged integer type for crc calculations | ||
746 | cat > $test.c <<EOF | ||
747 | #include <stdio.h> | ||
748 | #define is32(n,t) for(n=1,k=0;n;n<<=1,k++);if(k==32){puts(t);return 0;} | ||
749 | int main() { | ||
750 | int k; | ||
751 | unsigned i; | ||
752 | unsigned long l; | ||
753 | unsigned short s; | ||
754 | is32(i, "unsigned") | ||
755 | is32(l, "unsigned long") | ||
756 | is32(s, "unsigned short") | ||
757 | return 1; | ||
758 | } | ||
759 | EOF | ||
760 | Z_U4="" | ||
761 | if try $CC $CFLAGS $test.c -o $test && Z_U4=`./$test` && test -n "$Z_U4"; then | ||
762 | sed < zconf.h "/#define Z_U4/s/\/\* \.\/configure may/#define Z_U4 $Z_U4 \/* .\/configure put the/" > zconf.temp.h | ||
763 | mv zconf.temp.h zconf.h | ||
764 | echo "Looking for a four-byte integer type... Found." | tee -a configure.log | ||
765 | else | ||
766 | echo "Looking for a four-byte integer type... Not found." | tee -a configure.log | ||
767 | fi | ||
768 | |||
769 | # show the results in the log | 743 | # show the results in the log |
770 | echo >> configure.log | 744 | echo >> configure.log |
771 | echo ALL = $ALL >> configure.log | 745 | echo ALL = $ALL >> configure.log |
@@ -390,20 +390,14 @@ typedef uLong FAR uLongf; | |||
390 | typedef Byte *voidp; | 390 | typedef Byte *voidp; |
391 | #endif | 391 | #endif |
392 | 392 | ||
393 | /* ./configure may #define Z_U4 here */ | ||
394 | |||
395 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | 393 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) |
396 | # include <limits.h> | 394 | # include <limits.h> |
397 | # if (UINT_MAX == 0xffffffffUL) | 395 | # if (UINT_MAX == 4294967295) |
398 | # define Z_U4 unsigned | 396 | # define Z_U4 unsigned |
399 | # else | 397 | # elif (ULONG_MAX == 4294967295) |
400 | # if (ULONG_MAX == 0xffffffffUL) | 398 | # define Z_U4 unsigned long |
401 | # define Z_U4 unsigned long | 399 | # elif (USHRT_MAX == 4294967295) |
402 | # else | 400 | # define Z_U4 unsigned short |
403 | # if (USHRT_MAX == 0xffffffffUL) | ||
404 | # define Z_U4 unsigned short | ||
405 | # endif | ||
406 | # endif | ||
407 | # endif | 401 | # endif |
408 | #endif | 402 | #endif |
409 | 403 | ||
diff --git a/zconf.h.cmakein b/zconf.h.cmakein index 028be15..9254e9a 100644 --- a/zconf.h.cmakein +++ b/zconf.h.cmakein | |||
@@ -392,20 +392,14 @@ typedef uLong FAR uLongf; | |||
392 | typedef Byte *voidp; | 392 | typedef Byte *voidp; |
393 | #endif | 393 | #endif |
394 | 394 | ||
395 | /* ./configure may #define Z_U4 here */ | ||
396 | |||
397 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | 395 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) |
398 | # include <limits.h> | 396 | # include <limits.h> |
399 | # if (UINT_MAX == 0xffffffffUL) | 397 | # if (UINT_MAX == 4294967295) |
400 | # define Z_U4 unsigned | 398 | # define Z_U4 unsigned |
401 | # else | 399 | # elif (ULONG_MAX == 4294967295) |
402 | # if (ULONG_MAX == 0xffffffffUL) | 400 | # define Z_U4 unsigned long |
403 | # define Z_U4 unsigned long | 401 | # elif (USHRT_MAX == 4294967295) |
404 | # else | 402 | # define Z_U4 unsigned short |
405 | # if (USHRT_MAX == 0xffffffffUL) | ||
406 | # define Z_U4 unsigned short | ||
407 | # endif | ||
408 | # endif | ||
409 | # endif | 403 | # endif |
410 | #endif | 404 | #endif |
411 | 405 | ||
@@ -390,20 +390,14 @@ typedef uLong FAR uLongf; | |||
390 | typedef Byte *voidp; | 390 | typedef Byte *voidp; |
391 | #endif | 391 | #endif |
392 | 392 | ||
393 | /* ./configure may #define Z_U4 here */ | ||
394 | |||
395 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | 393 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) |
396 | # include <limits.h> | 394 | # include <limits.h> |
397 | # if (UINT_MAX == 0xffffffffUL) | 395 | # if (UINT_MAX == 4294967295) |
398 | # define Z_U4 unsigned | 396 | # define Z_U4 unsigned |
399 | # else | 397 | # elif (ULONG_MAX == 4294967295) |
400 | # if (ULONG_MAX == 0xffffffffUL) | 398 | # define Z_U4 unsigned long |
401 | # define Z_U4 unsigned long | 399 | # elif (USHRT_MAX == 4294967295) |
402 | # else | 400 | # define Z_U4 unsigned short |
403 | # if (USHRT_MAX == 0xffffffffUL) | ||
404 | # define Z_U4 unsigned short | ||
405 | # endif | ||
406 | # endif | ||
407 | # endif | 401 | # endif |
408 | #endif | 402 | #endif |
409 | 403 | ||