about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-03-05 10:06:28 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-03-05 10:06:28 +0000
commit86f8e8de696404b85c334916bfe3d69bdd4291c6 (patch)
treea37c7c91bfe9f5b92bf574e56009ff86f49e3f0f /configure.ac
parent7614be7fe1b9a9692a6c8f5c5f471df3ef288366 (diff)
downloadzsh-86f8e8de696404b85c334916bfe3d69bdd4291c6.tar.gz
zsh-86f8e8de696404b85c334916bfe3d69bdd4291c6.tar.xz
zsh-86f8e8de696404b85c334916bfe3d69bdd4291c6.zip
30307 plus tweak suggsted by Wayne: use %lld for zlong when long long
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac31
1 files changed, 31 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 54999b164..82903ca81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1010,6 +1010,37 @@ main() { return sizeof(ino_t) < 8; }
     fi
   fi
 fi
+AH_TEMPLATE([ZLONG_IS_LONG_LONG],
+[Define to 1 if the zlong type uses long long int.])
+if test "$zsh_cv_64_bit_type" = "long long"; then
+  dnl Remember this so we can get (s)printf output right.
+  AC_DEFINE(ZLONG_IS_LONG_LONG)
+fi
+
+dnl We'll blithely assume (f)printf supports the same types as sprintf.
+AC_CACHE_CHECK(for %lld printf support, zsh_cv_printf_has_lld,
+[AC_TRY_RUN(
+[#include <stdio.h>
+#include <string.h>
+int main(int argc, char **argv)
+{
+   long long foo = ((long long)0xdead << 40) | 0xf00d;
+   char buf[80];
+   sprintf(buf, "before%lldafter", foo);
+   if (!strcmp(buf, "before62677660341432333after")) {
+      return 0;
+   }
+   return 1;
+}
+],
+zsh_cv_printf_has_lld=yes,
+zsh_cv_printf_has_lld=no,
+zsh_cv_printf_has_lld=no)])
+AH_TEMPLATE(PRINTF_HAS_LLD,
+[Define to 1 if printf and sprintf support %lld for long long.])
+if test x$zsh_cv_printf_has_lld = xyes; then
+  AC_DEFINE(PRINTF_HAS_LLD)
+fi
 
 dnl Check for sigset_t.  Currently I'm looking in
 dnl <sys/types.h> and <signal.h>.  Others might need