diff options
author | Darren Tucker <dtucker@zip.com.au> | 2006-03-13 19:06:51 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2006-03-13 19:06:51 +1100 |
commit | d1450dbe2ab1cc06fd54af265014dfcf68c08cc1 (patch) | |
tree | 77000db836b0a6344a740d92e83850bdba953a88 | |
parent | f35014af79c7a94e7c39d3ed4b3fb276115d9705 (diff) |
- (dtucker) [configure.ac] Bug #1171: Don't use printf("%lld", longlong)
since not all platforms support it. Instead, use internal equivalent while
computing LLONG_MIN and LLONG_MAX. Remove special case for alpha-dec-osf*
as it's no longer required. Tested by Bernhard Simon, ok djm@
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | configure.ac | 53 |
2 files changed, 44 insertions, 17 deletions
@@ -1,3 +1,9 @@ | |||
1 | 20060313 | ||
2 | - (dtucker) [configure.ac] Bug #1171: Don't use printf("%lld", longlong) | ||
3 | since not all platforms support it. Instead, use internal equivalent while | ||
4 | computing LLONG_MIN and LLONG_MAX. Remove special case for alpha-dec-osf* | ||
5 | as it's no longer required. Tested by Bernhard Simon, ok djm@ | ||
6 | |||
1 | 20060304 | 7 | 20060304 |
2 | - (dtucker) [contrib/cygwin/ssh-host-config] Require use of lastlog as a | 8 | - (dtucker) [contrib/cygwin/ssh-host-config] Require use of lastlog as a |
3 | file rather than directory, required as Cygwin will be importing lastlog(1). | 9 | file rather than directory, required as Cygwin will be importing lastlog(1). |
@@ -3892,4 +3898,4 @@ | |||
3892 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | 3898 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM |
3893 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | 3899 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu |
3894 | 3900 | ||
3895 | $Id: ChangeLog,v 1.4138 2006/03/03 22:00:19 dtucker Exp $ | 3901 | $Id: ChangeLog,v 1.4139 2006/03/13 08:06:51 dtucker Exp $ |
diff --git a/configure.ac b/configure.ac index 0781d59fe..adef4f675 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.332 2006/02/26 01:31:49 dtucker Exp $ | 1 | # $Id: configure.ac,v 1.333 2006/03/13 08:06:51 dtucker Exp $ |
2 | # | 2 | # |
3 | # Copyright (c) 1999-2004 Damien Miller | 3 | # Copyright (c) 1999-2004 Damien Miller |
4 | # | 4 | # |
@@ -15,7 +15,7 @@ | |||
15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | 16 | ||
17 | AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) | 17 | AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) |
18 | AC_REVISION($Revision: 1.332 $) | 18 | AC_REVISION($Revision: 1.333 $) |
19 | AC_CONFIG_SRCDIR([ssh.c]) | 19 | AC_CONFIG_SRCDIR([ssh.c]) |
20 | 20 | ||
21 | AC_CONFIG_HEADER(config.h) | 21 | AC_CONFIG_HEADER(config.h) |
@@ -2132,6 +2132,34 @@ if test -z "$have_llong_max"; then | |||
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; |
@@ -2153,14 +2181,18 @@ int main(void) { | |||
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 | ]])], |
@@ -2168,17 +2200,6 @@ int main(void) { | |||
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]) |