From: Edmund Grimley Evans <edmund.grimley.evans@gmail.com>
Subject: Guess stack direction
Bug-Debian: http://bugs.debian.org/744619

Index: librep.git/configure.in
===================================================================
--- librep.git.orig/configure.in	2016-01-01 14:33:31.000000000 +0000
+++ librep.git/configure.in	2016-01-01 14:51:52.015284872 +0000
@@ -544,8 +544,14 @@ if test "${with_stack_direction}" = unkn
   esac
 fi
 if test "${with_stack_direction}" = unknown; then
-  AC_TRY_RUN([ void inner (char *foo) { char bar; exit (!(foo >= &bar)); }
-	       void main () { char foo; inner (&foo); } ],
+  AC_TRY_RUN([
+#include <stdio.h>
+#include <string.h>
+int inner(int *a) { int b; char sa[50], sb[50];
+  sprintf(sa, "%049llu", (unsigned long long)a);
+  sprintf(sb, "%049llu", (unsigned long long)&b);
+  return strcmp(sa, sb); }
+int main() { int x; return inner(&x) < 0; } ],
    [AC_MSG_RESULT([downwards])
     with_stack_direction=-1],
    [AC_MSG_RESULT([upwards])
