]> andersk Git - openssh.git/commitdiff
- (dtucker) [configure.ac] Continue the hunt for LLONG_MIN and LLONG_MAX:
authordtucker <dtucker>
Tue, 7 Jun 2005 07:53:40 +0000 (07:53 +0000)
committerdtucker <dtucker>
Tue, 7 Jun 2005 07:53:40 +0000 (07:53 +0000)
   in today's episode we attempt to coax it from limits.h where it may be
   hiding, failing that we take the DIY approach.  Tested by tim@

ChangeLog
configure.ac

index 6e112cd91c5ac188f336c94d684c42dfa6407eb5..249313054711439fd10461459e693f63a346dd8c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+20050607
+ - (dtucker) [configure.ac] Continue the hunt for LLONG_MIN and LLONG_MAX:
+   in today's episode we attempt to coax it from limits.h where it may be
+   hiding, failing that we take the DIY approach.  Tested by tim@
+
 20050603
  - (dtucker) [configure.ac] Only try gcc -std=gnu99 if LLONG_MAX isn't
    defined, and check that it helps before keeping it in CFLAGS.  Some old
index 709a8998b79bca8d0a166aab1932f685d190908e..fae6fdea9b1cd4c525ad2b2d17103c3a5bb6d453 100644 (file)
@@ -96,6 +96,70 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
        fi
 fi
 
+if test -z "$have_llong_max"; then
+       AC_MSG_CHECKING([for max value of long long])
+       AC_RUN_IFELSE(
+               [AC_LANG_SOURCE([[
+#include <stdio.h>
+/* Why is this so damn hard? */
+#ifdef __GNUC__
+# undef __GNUC__
+#endif
+#define __USE_ISOC99
+#include <limits.h>
+#define DATA "conftest.llminmax"
+int main(void) {
+       FILE *f;
+       long long i, llmin, llmax = 0;
+
+       if((f = fopen(DATA,"w")) == NULL)
+               exit(1);
+
+#if defined(LLONG_MIN) && defined(LLONG_MAX)
+       fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
+       llmin = LLONG_MIN;
+       llmax = LLONG_MAX;
+#else
+       fprintf(stderr, "Calculating  LLONG_MIN and LLONG_MAX\n");
+       /* This will work on one's complement and two's complement */
+       for (i = 1; i > llmax; i <<= 1, i++)
+               llmax = i;
+       llmin = llmax + 1LL;    /* wrap */
+#endif
+
+       /* Sanity check */
+       if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
+           || llmax - 1 > llmax) {
+               fprintf(f, "unknown unknown\n");
+               exit(2);
+       }
+
+       if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
+               exit(3);
+
+       exit(0);
+}
+               ]])],
+               [
+                       llong_min=`$AWK '{print $1}' conftest.llminmax`
+                       llong_max=`$AWK '{print $2}' conftest.llminmax`
+                       AC_MSG_RESULT($llong_max)
+                       AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
+                           [max value of long long calculated by configure])
+                       AC_MSG_CHECKING([for min value of long long])
+                       AC_MSG_RESULT($llong_min)
+                       AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
+                           [min value of long long calculated by configure])
+               ],
+               [
+                       AC_MSG_RESULT(not found)
+               ],
+               [
+                       AC_MSG_WARN([cross compiling: not checking])
+               ]
+       )
+fi
+
 AC_ARG_WITH(rpath,
        [  --without-rpath         Disable auto-added -R linker paths],
        [
This page took 0.049856 seconds and 5 git commands to generate.