|
Lines 2132-2137
if test -z "$have_llong_max"; then
Link Here
|
| 2132 |
#define __USE_ISOC99 |
2132 |
#define __USE_ISOC99 |
| 2133 |
#include <limits.h> |
2133 |
#include <limits.h> |
| 2134 |
#define DATA "conftest.llminmax" |
2134 |
#define DATA "conftest.llminmax" |
|
|
2135 |
#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a)) |
| 2136 |
|
| 2137 |
/* |
| 2138 |
* printf in libc on some platforms (eg old Tru64) does not understand %lld so |
| 2139 |
* we do this the hard way. |
| 2140 |
*/ |
| 2141 |
static int |
| 2142 |
fprint_ll(FILE *f, long long n) |
| 2143 |
{ |
| 2144 |
unsigned int i; |
| 2145 |
int l[sizeof(long long) * 8]; |
| 2146 |
|
| 2147 |
if (n < 0) |
| 2148 |
if (fprintf(f, "-") < 0) |
| 2149 |
return -1; |
| 2150 |
for (i = 0; n != 0; i++) { |
| 2151 |
l[i] = my_abs(n % 10); |
| 2152 |
n /= 10; |
| 2153 |
} |
| 2154 |
do { |
| 2155 |
if (fprintf(f, "%d", l[--i]) < 0) |
| 2156 |
return -1; |
| 2157 |
} while (i != 0); |
| 2158 |
if (fprintf(f, " ") < 0) |
| 2159 |
return -1; |
| 2160 |
return 0; |
| 2161 |
} |
| 2162 |
|
| 2135 |
int main(void) { |
2163 |
int main(void) { |
| 2136 |
FILE *f; |
2164 |
FILE *f; |
| 2137 |
long long i, llmin, llmax = 0; |
2165 |
long long i, llmin, llmax = 0; |
|
Lines 2153-2166
int main(void) {
Link Here
|
| 2153 |
|
2181 |
|
| 2154 |
/* Sanity check */ |
2182 |
/* Sanity check */ |
| 2155 |
if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax |
2183 |
if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax |
| 2156 |
|| llmax - 1 > llmax) { |
2184 |
|| llmax - 1 > llmax || llmin == llmax || llmin == 0 |
|
|
2185 |
|| llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) { |
| 2157 |
fprintf(f, "unknown unknown\n"); |
2186 |
fprintf(f, "unknown unknown\n"); |
| 2158 |
exit(2); |
2187 |
exit(2); |
| 2159 |
} |
2188 |
} |
| 2160 |
|
2189 |
|
| 2161 |
if (fprintf(f ,"%lld %lld", llmin, llmax) < 0) |
2190 |
if (fprint_ll(f, llmin) < 0) |
| 2162 |
exit(3); |
2191 |
exit(3); |
| 2163 |
|
2192 |
if (fprint_ll(f, llmax) < 0) |
|
|
2193 |
exit(4); |
| 2194 |
if (fclose(f) < 0) |
| 2195 |
exit(5); |
| 2164 |
exit(0); |
2196 |
exit(0); |
| 2165 |
} |
2197 |
} |
| 2166 |
]])], |
2198 |
]])], |
|
Lines 2168-2184
int main(void) {
Link Here
|
| 2168 |
llong_min=`$AWK '{print $1}' conftest.llminmax` |
2200 |
llong_min=`$AWK '{print $1}' conftest.llminmax` |
| 2169 |
llong_max=`$AWK '{print $2}' conftest.llminmax` |
2201 |
llong_max=`$AWK '{print $2}' conftest.llminmax` |
| 2170 |
|
2202 |
|
| 2171 |
# snprintf on some Tru64s doesn't understand "%lld" |
|
|
| 2172 |
case "$host" in |
| 2173 |
alpha-dec-osf*) |
| 2174 |
if test "x$ac_cv_sizeof_long_long_int" = "x8" && |
| 2175 |
test "x$llong_max" = "xld"; then |
| 2176 |
llong_min="-9223372036854775808" |
| 2177 |
llong_max="9223372036854775807" |
| 2178 |
fi |
| 2179 |
;; |
| 2180 |
esac |
| 2181 |
|
| 2182 |
AC_MSG_RESULT($llong_max) |
2203 |
AC_MSG_RESULT($llong_max) |
| 2183 |
AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL], |
2204 |
AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL], |
| 2184 |
[max value of long long calculated by configure]) |
2205 |
[max value of long long calculated by configure]) |