summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-01-12 07:45:26 +0000
committerJim Meyering <jim@meyering.net>2006-01-12 07:45:26 +0000
commite9a7b4934279e0cc06fbda563bf6573eefb36258 (patch)
tree36d6008c67d6e654044b62dfd163662bb095466c /m4
parent395cb7a6b959db6235626385fc6330192c051732 (diff)
downloadcoreutils-e9a7b4934279e0cc06fbda563bf6573eefb36258.tar.xz
from gnulib
Diffstat (limited to 'm4')
-rw-r--r--m4/stdint.m460
1 files changed, 60 insertions, 0 deletions
diff --git a/m4/stdint.m4 b/m4/stdint.m4
new file mode 100644
index 000000000..d4a6994c4
--- /dev/null
+++ b/m4/stdint.m4
@@ -0,0 +1,60 @@
+# stdint.m4 serial 5
+dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether <stdint.h> is supported or must be substituted.
+
+AC_DEFUN([gl_STDINT_H],
+[dnl Check for <inttypes.h>.
+AC_REQUIRE([gt_HEADER_INTTYPES_H])
+dnl Check for <sys/inttypes.h>.
+AC_CHECK_HEADERS([sys/inttypes.h])
+dnl Check for <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
+AC_CHECK_HEADERS([sys/bitypes.h])
+
+AC_MSG_CHECKING([for stdint.h])
+AC_CACHE_VAL(gl_cv_header_stdint_h, [
+ AC_TRY_COMPILE([#include <stdint.h>], [],
+ gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)])
+AC_MSG_RESULT([$gl_cv_header_stdint_h])
+if test $gl_cv_header_stdint_h = yes; then
+ AC_DEFINE(HAVE_STDINT_H, 1,
+ [Define if you have a working <stdint.h> header file.])
+ STDINT_H=''
+else
+ STDINT_H='stdint.h'
+
+ dnl Is long == int64_t ?
+ AC_CACHE_CHECK([whether 'long' is 64 bit wide], gl_cv_long_bitsize_64, [
+ AC_TRY_COMPILE([
+#define POW63 ((((((long) 1 << 15) << 15) << 15) << 15) << 3)
+#define POW64 ((((((long) 1 << 15) << 15) << 15) << 15) << 4)
+typedef int array [2 * (POW63 != 0 && POW64 == 0) - 1];
+], , gl_cv_long_bitsize_64=yes, gl_cv_long_bitsize_64=no)])
+ if test $gl_cv_long_bitsize_64 = yes; then
+ HAVE_LONG_64BIT=1
+ else
+ HAVE_LONG_64BIT=0
+ fi
+ AC_SUBST(HAVE_LONG_64BIT)
+
+ dnl Is long long == int64_t ?
+ AC_CACHE_CHECK([whether 'long long' is 64 bit wide], gl_cv_longlong_bitsize_64, [
+ AC_TRY_COMPILE([
+#define POW63 ((((((long long) 1 << 15) << 15) << 15) << 15) << 3)
+#define POW64 ((((((long long) 1 << 15) << 15) << 15) << 15) << 4)
+typedef int array [2 * (POW63 != 0 && POW64 == 0) - 1];
+], , gl_cv_longlong_bitsize_64=yes, gl_cv_longlong_bitsize_64=no)])
+ if test $gl_cv_longlong_bitsize_64 = yes; then
+ HAVE_LONG_LONG_64BIT=1
+ else
+ HAVE_LONG_LONG_64BIT=0
+ fi
+ AC_SUBST(HAVE_LONG_LONG_64BIT)
+
+fi
+AC_SUBST(STDINT_H)
+])