From: Paul Eggert Date: Wed, 8 Nov 2006 06:25:34 +0000 (+0000) Subject: * lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT): Detect bug in X-Git-Tag: AUTOCONF-2.61~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bb5b9260b97a92e7d7a16bd515ae2558828a25f;p=thirdparty%2Fautoconf.git * lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT): Detect bug in Tandem NonStop Kernel (OSS) cc -O circa 2004, reported by Matthew Woehlke. --- diff --git a/ChangeLog b/ChangeLog index 9a14f1fa6..46c90f750 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-11-07 Paul Eggert + + * lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT): Detect bug in + Tandem NonStop Kernel (OSS) cc -O circa 2004, reported by + Matthew Woehlke. + 2006-10-28 Ralf Wildenhues * tests/torture.at (Configuring subdirectories): Do not skip diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4 index 606eafeba..ab2f6b962 100644 --- a/lib/autoconf/types.m4 +++ b/lib/autoconf/types.m4 @@ -480,10 +480,34 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], int i = 63;]], [[long long int llmax = 9223372036854775807ll; return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | llmax / ll | llmax % ll);]])], - [ac_cv_type_long_long_int=yes], + | (llmax / ll) | (llmax % ll));]])], + [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. + dnl If cross compiling, assume the bug isn't important, since + dnl nobody cross compiles for this platform as far as we know. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include + @%:@ifndef LLONG_MAX + @%:@ define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + @%:@ define LLONG_MAX (HALF - 1 + HALF) + @%:@endif]], + [[long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0;]])], + [ac_cv_type_long_long_int=yes], + [ac_cv_type_long_long_int=no], + [ac_cv_type_long_long_int=cross-compiling])], [ac_cv_type_long_long_int=no])]) - if test $ac_cv_type_long_long_int = yes; then + if test $ac_cv_type_long_long_int != no; then AC_DEFINE([HAVE_LONG_LONG_INT], 1, [Define to 1 if the system has the type `long long int'.]) fi