acinclude.m4 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. dnl cloned from autoconf 2.13 acspecific.m4
  2. AC_DEFUN(AC_C_LONG_LONG,
  3. [AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
  4. [if test "$GCC" = yes; then
  5. ac_cv_c_long_long=yes
  6. else
  7. AC_TRY_RUN([int main() {
  8. long long foo = 0;
  9. exit(sizeof(long long) < sizeof(long)); }],
  10. ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
  11. fi])
  12. if test $ac_cv_c_long_long = yes; then
  13. AC_DEFINE(HAVE_LONG_LONG)
  14. fi
  15. ])
  16. dnl from autoconf 2.13 acgeneral.m4, with patch:
  17. dnl Date: Fri, 15 Jan 1999 05:52:41 -0800
  18. dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com>
  19. dnl From: eggert@twinsun.com (Paul Eggert)
  20. dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars
  21. dnl Newsgroups: gnu.utils.bug
  22. dnl from autoconf 2.13 acspecific.m4, with changes to check for daylight
  23. AC_DEFUN(AC_STRUCT_TIMEZONE_DAYLIGHT,
  24. [AC_REQUIRE([AC_STRUCT_TM])dnl
  25. AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
  26. [AC_TRY_COMPILE([#include <sys/types.h>
  27. #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
  28. ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
  29. if test "$ac_cv_struct_tm_zone" = yes; then
  30. AC_DEFINE(HAVE_TM_ZONE)
  31. fi
  32. AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
  33. [AC_TRY_LINK(
  34. changequote(<<, >>)dnl
  35. <<#include <time.h>
  36. #ifndef tzname /* For SGI. */
  37. extern char *tzname[]; /* RS6000 and others reject char **tzname. */
  38. #endif>>,
  39. changequote([, ])dnl
  40. [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
  41. if test $ac_cv_var_tzname = yes; then
  42. AC_DEFINE(HAVE_TZNAME)
  43. fi
  44. AC_CACHE_CHECK([for tm_isdst in struct tm], ac_cv_struct_tm_isdst,
  45. [AC_TRY_COMPILE([#include <sys/types.h>
  46. #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_isdst;],
  47. ac_cv_struct_tm_isdst=yes, ac_cv_struct_tm_isdst=no)])
  48. if test "$ac_cv_struct_tm_isdst" = yes; then
  49. AC_DEFINE(HAVE_TM_ISDST)
  50. fi
  51. AC_CACHE_CHECK(for daylight, ac_cv_var_daylight,
  52. [AC_TRY_LINK(
  53. changequote(<<, >>)dnl
  54. <<#include <time.h>
  55. #ifndef daylight /* In case IRIX #defines this, too */
  56. extern int daylight;
  57. #endif>>,
  58. changequote([, ])dnl
  59. [atoi(daylight);], ac_cv_var_daylight=yes, ac_cv_var_daylight=no)])
  60. if test $ac_cv_var_daylight = yes; then
  61. AC_DEFINE(HAVE_DAYLIGHT)
  62. fi
  63. ])
  64. dnl AC_CHECK_TYPE2(TYPE, DEFAULT)
  65. AC_DEFUN(AC_CHECK_TYPE2,
  66. [AC_REQUIRE([AC_HEADER_STDC])dnl
  67. AC_MSG_CHECKING(for $1)
  68. AC_CACHE_VAL(ac_cv_type_$1,
  69. [AC_EGREP_CPP(dnl
  70. changequote(<<,>>)dnl
  71. <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
  72. changequote([,]), [#include <sys/types.h>
  73. #if STDC_HEADERS
  74. #include <stdlib.h>
  75. #include <stddef.h>
  76. #endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl
  77. if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then
  78. AC_MSG_RESULT(yes)
  79. else
  80. AC_MSG_RESULT(no)
  81. AC_DEFINE_UNQUOTED($1, $2)
  82. fi
  83. ])
  84. dnl from autoconf 2.13 acgeneral.m4, with additional third argument
  85. dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]])
  86. AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES,
  87. [changequote(<<, >>)dnl
  88. dnl The name to #define.
  89. define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
  90. dnl The cache variable name.
  91. define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
  92. changequote([, ])dnl
  93. AC_MSG_CHECKING(size of $1)
  94. AC_CACHE_VAL(AC_CV_NAME,
  95. [AC_TRY_RUN([$3
  96. #include <stdio.h>
  97. main()
  98. {
  99. FILE *f=fopen("conftestval", "w");
  100. if (!f) exit(1);
  101. fprintf(f, "%d\n", sizeof($1));
  102. exit(0);
  103. }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
  104. AC_MSG_RESULT($AC_CV_NAME)
  105. AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
  106. undefine([AC_TYPE_NAME])dnl
  107. undefine([AC_CV_NAME])dnl
  108. ])
  109. dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE])
  110. AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS,
  111. [AC_CHECK_SIZEOF_INCLUDES($1, $2,
  112. [#include <sys/types.h>
  113. #ifdef STDC_HEADERS
  114. #include <stdlib.h>
  115. #endif
  116. ])
  117. ])