timelib.m4 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. dnl
  2. dnl $Id$
  3. dnl
  4. dnl
  5. dnl TL_DEF_HAVE(what [, why])
  6. dnl
  7. dnl Generates 'AC_DEFINE(HAVE_WHAT, 1, [WHY])'
  8. dnl
  9. AC_DEFUN([TL_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_.-,A-Z___),1,[ $2 ])])dnl
  10. dnl
  11. dnl TL_CHECK_INT_TYPE(type)
  12. dnl
  13. AC_DEFUN([TL_CHECK_INT_TYPE],[
  14. AC_CACHE_CHECK([for $1], ac_cv_int_type_$1, [
  15. AC_TRY_COMPILE([
  16. #if HAVE_SYS_TYPES_H
  17. # include <sys/types.h>
  18. #endif
  19. #if HAVE_INTTYPES_H
  20. # include <inttypes.h>
  21. #elif HAVE_STDINT_H
  22. # include <stdint.h>
  23. #endif],
  24. [if (($1 *) 0)
  25. return 0;
  26. if (sizeof ($1))
  27. return 0;
  28. ], [ac_cv_int_type_$1=yes], [ac_cv_int_type_$1=no])
  29. ])
  30. if test "$ac_cv_int_type_$1" = "yes"; then
  31. TL_DEF_HAVE($1, [Define if $1 type is present.])
  32. fi
  33. ])dnl
  34. dnl
  35. dnl AC_TIMELIB_C_BIGENDIAN
  36. dnl Replacement macro for AC_C_BIGENDIAN
  37. dnl
  38. AC_DEFUN([AC_TIMELIB_C_BIGENDIAN],
  39. [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
  40. [
  41. ac_cv_c_bigendian_php=unknown
  42. AC_TRY_RUN(
  43. [
  44. int main(void)
  45. {
  46. short one = 1;
  47. char *cp = (char *)&one;
  48. if (*cp == 0) {
  49. return(0);
  50. } else {
  51. return(1);
  52. }
  53. }
  54. ], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
  55. ])
  56. if test $ac_cv_c_bigendian_php = yes; then
  57. AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word])
  58. fi
  59. ])dnl
  60. dnl Check for types, sizes, etc. needed by timelib
  61. AC_CHECK_SIZEOF(long, 8)
  62. AC_CHECK_SIZEOF(int, 4)
  63. TL_CHECK_INT_TYPE(int32_t)
  64. TL_CHECK_INT_TYPE(uint32_t)
  65. dnl Check for headers needed by timelib
  66. AC_CHECK_HEADERS([ \
  67. sys/types.h \
  68. inttypes.h \
  69. stdint.h \
  70. string.h \
  71. stdlib.h
  72. ])
  73. dnl Check for strtoll, atoll
  74. AC_CHECK_FUNCS(strtoll atoll strftime)