1 1.1 christos # stdint.m4 serial 4 2 1.1 christos dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc. 3 1.1 christos dnl This file is free software; the Free Software Foundation 4 1.1 christos dnl gives unlimited permission to copy and/or distribute it, 5 1.1 christos dnl with or without modifications, as long as this notice is preserved. 6 1.1 christos 7 1.1 christos dnl From Bruno Haible. 8 1.1 christos dnl Test whether <stdint.h> is supported or must be substituted. 9 1.1 christos 10 1.1 christos AC_DEFUN([gl_STDINT_H], 11 1.1 christos [dnl Check for <inttypes.h>. 12 1.1 christos AC_REQUIRE([gt_HEADER_INTTYPES_H]) 13 1.1 christos dnl Check for <sys/inttypes.h>. 14 1.1 christos AC_CHECK_HEADERS([sys/inttypes.h]) 15 1.1 christos 16 1.1 christos AC_MSG_CHECKING([for stdint.h]) 17 1.1 christos AC_CACHE_VAL(gl_cv_header_stdint_h, [ 18 1.1 christos AC_TRY_COMPILE([#include <stdint.h>], [], 19 1.1 christos gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)]) 20 1.1 christos AC_MSG_RESULT([$gl_cv_header_stdint_h]) 21 1.1 christos if test $gl_cv_header_stdint_h = yes; then 22 1.1 christos AC_DEFINE(HAVE_STDINT_H, 1, 23 1.1 christos [Define if you have a working <stdint.h> header file.]) 24 1.1 christos STDINT_H='' 25 1.1 christos else 26 1.1 christos STDINT_H='stdint.h' 27 1.1 christos 28 1.1 christos dnl Is long == int64_t ? 29 1.1 christos AC_CACHE_CHECK([whether 'long' is 64 bit wide], gl_cv_long_bitsize_64, [ 30 1.1 christos AC_TRY_COMPILE([ 31 1.1 christos #define POW63 ((((((long) 1 << 15) << 15) << 15) << 15) << 3) 32 1.1 christos #define POW64 ((((((long) 1 << 15) << 15) << 15) << 15) << 4) 33 1.1 christos typedef int array [2 * (POW63 != 0 && POW64 == 0) - 1]; 34 1.1 christos ], , gl_cv_long_bitsize_64=yes, gl_cv_long_bitsize_64=no)]) 35 1.1 christos if test $gl_cv_long_bitsize_64 = yes; then 36 1.1 christos HAVE_LONG_64BIT=1 37 1.1 christos else 38 1.1 christos HAVE_LONG_64BIT=0 39 1.1 christos fi 40 1.1 christos AC_SUBST(HAVE_LONG_64BIT) 41 1.1 christos 42 1.1 christos dnl Is long long == int64_t ? 43 1.1 christos AC_CACHE_CHECK([whether 'long long' is 64 bit wide], gl_cv_longlong_bitsize_64, [ 44 1.1 christos AC_TRY_COMPILE([ 45 1.1 christos #define POW63 ((((((long long) 1 << 15) << 15) << 15) << 15) << 3) 46 1.1 christos #define POW64 ((((((long long) 1 << 15) << 15) << 15) << 15) << 4) 47 1.1 christos typedef int array [2 * (POW63 != 0 && POW64 == 0) - 1]; 48 1.1 christos ], , gl_cv_longlong_bitsize_64=yes, gl_cv_longlong_bitsize_64=no)]) 49 1.1 christos if test $gl_cv_longlong_bitsize_64 = yes; then 50 1.1 christos HAVE_LONG_LONG_64BIT=1 51 1.1 christos else 52 1.1 christos HAVE_LONG_LONG_64BIT=0 53 1.1 christos fi 54 1.1 christos AC_SUBST(HAVE_LONG_LONG_64BIT) 55 1.1 christos 56 1.1 christos fi 57 1.1 christos AC_SUBST(STDINT_H) 58 1.1 christos ]) 59