From 16e6698bf53cbe5099ca8f3c5f608acd20d7d210 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Fri, 23 Aug 2013 16:32:08 +0200 Subject: [PATCH] Move the thrice-repeated "64bitint is buggy?" test from hints to Configure. OpenBSD and its two* forks each have the same "is 64 bit int support buggy?" test code as a callback unit duplicated in their hints files. As the code is portable C, there seems to be no harm in moving it to Configure, and running the test on all platforms. This reduces code duplication, and will reduce it further if another OpenBSD fork appears. * This week. --- Configure | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ hints/bitrig.sh | 59 -------------------------------------------------------- hints/mirbsd.sh | 59 -------------------------------------------------------- hints/openbsd.sh | 59 -------------------------------------------------------- 4 files changed, 53 insertions(+), 177 deletions(-) diff --git a/Configure b/Configure index e4e4075..df7c5cd 100755 --- a/Configure +++ b/Configure @@ -5859,6 +5859,59 @@ if $test -f use64bitint.cbu; then fi case "$use64bitint" in "$define"|true|[yY]*) + : This test was common to all the OpenBSD forks, and seems harmless for + : other platforms: + echo " " + echo "Checking if your C library has broken 64-bit functions..." >&4 + $cat >try.c < +typedef $uquadtype myULL; +int main (void) +{ + struct { + double d; + myULL u; + } *p, test[] = { + {4294967303.15, 4294967303ULL}, + {4294967294.2, 4294967294ULL}, + {4294967295.7, 4294967295ULL}, + {0.0, 0ULL} + }; + for (p = test; p->u; p++) { + myULL x = (myULL)p->d; + if (x != p->u) { + printf("buggy\n"); + return 0; + } + } + printf("ok\n"); + return 0; +} +EOCP + set try + if eval $compile_ok; then + libcquad=`./try` + echo "Your C library's 64-bit functions are $libcquad." + else + echo "(I can't seem to compile the test program.)" + echo "Assuming that your C library's 64-bit functions are ok." + libcquad="ok" + fi + $rm -f try.c try + + case "$libcquad" in + buggy*) + cat >&4 < UU/use64bitint.cbu <<'EOCBU' -case "$use64bitint" in -$define|true|[yY]*) - echo " " - echo "Checking if your C library has broken 64-bit functions..." >&4 - $cat >check.c < -typedef $uquadtype myULL; -int main (void) -{ - struct { - double d; - myULL u; - } *p, test[] = { - {4294967303.15, 4294967303ULL}, - {4294967294.2, 4294967294ULL}, - {4294967295.7, 4294967295ULL}, - {0.0, 0ULL} - }; - for (p = test; p->u; p++) { - myULL x = (myULL)p->d; - if (x != p->u) { - printf("buggy\n"); - return 0; - } - } - printf("ok\n"); - return 0; -} -EOCP - set check - if eval $compile_ok; then - libcquad=`./check` - echo "Your C library's 64-bit functions are $libcquad." - else - echo "(I can't seem to compile the test program.)" - echo "Assuming that your C library's 64-bit functions are ok." - libcquad="ok" - fi - $rm -f check.c check - - case "$libcquad" in - buggy*) - cat >&4 < UU/use64bitint.cbu <<'EOCBU' -case "$use64bitint" in -$define|true|[yY]*) - echo " " - echo "Checking if your C library has broken 64-bit functions..." >&4 - $cat >check.c < -typedef $uquadtype myULL; -int main (void) -{ - struct { - double d; - myULL u; - } *p, test[] = { - {4294967303.15, 4294967303ULL}, - {4294967294.2, 4294967294ULL}, - {4294967295.7, 4294967295ULL}, - {0.0, 0ULL} - }; - for (p = test; p->u; p++) { - myULL x = (myULL)p->d; - if (x != p->u) { - printf("buggy\n"); - return 0; - } - } - printf("ok\n"); - return 0; -} -EOCP - set check - if eval $compile_ok; then - libcquad=$(./check) - echo "Your C library's 64-bit functions are $libcquad." - else - echo "(I can't seem to compile the test program.)" - echo "Assuming that your C library's 64-bit functions are ok." - libcquad="ok" - fi - $rm -f check.c check - - case "$libcquad" in - buggy*) - cat >&4 < UU/use64bitint.cbu <<'EOCBU' -case "$use64bitint" in -$define|true|[yY]*) - echo " " - echo "Checking if your C library has broken 64-bit functions..." >&4 - $cat >check.c < -typedef $uquadtype myULL; -int main (void) -{ - struct { - double d; - myULL u; - } *p, test[] = { - {4294967303.15, 4294967303ULL}, - {4294967294.2, 4294967294ULL}, - {4294967295.7, 4294967295ULL}, - {0.0, 0ULL} - }; - for (p = test; p->u; p++) { - myULL x = (myULL)p->d; - if (x != p->u) { - printf("buggy\n"); - return 0; - } - } - printf("ok\n"); - return 0; -} -EOCP - set check - if eval $compile_ok; then - libcquad=`./check` - echo "Your C library's 64-bit functions are $libcquad." - else - echo "(I can't seem to compile the test program.)" - echo "Assuming that your C library's 64-bit functions are ok." - libcquad="ok" - fi - $rm -f check.c check - - case "$libcquad" in - buggy*) - cat >&4 <