acinclude.m4 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. dnl On the NeXT, #including <utime.h> doesn't give you a definition for
  2. dnl struct utime, unless you #define _POSIX_SOURCE.
  3. AC_DEFUN([GUILE_STRUCT_UTIMBUF], [
  4. AC_CACHE_CHECK([whether we need POSIX to get struct utimbuf],
  5. guile_cv_struct_utimbuf_needs_posix,
  6. [AC_TRY_CPP([
  7. #ifdef __EMX__
  8. #include <sys/utime.h>
  9. #else
  10. #include <utime.h>
  11. #endif
  12. struct utime blah;
  13. ],
  14. guile_cv_struct_utimbuf_needs_posix=no,
  15. guile_cv_struct_utimbuf_needs_posix=yes)])
  16. if test "$guile_cv_struct_utimbuf_needs_posix" = yes; then
  17. AC_DEFINE([UTIMBUF_NEEDS_POSIX], 1,
  18. [Define this if <utime.h> doesn't define struct utimbuf unless
  19. _POSIX_SOURCE is defined. See GUILE_STRUCT_UTIMBUF in aclocal.m4.])
  20. fi])
  21. dnl
  22. dnl Apparently, at CMU they have a weird version of libc.h that is
  23. dnl installed in /usr/local/include and conflicts with unistd.h.
  24. dnl In these situations, we should not #include libc.h.
  25. dnl This test arranges to #define LIBC_H_WITH_UNISTD_H iff libc.h is
  26. dnl present on the system, and is safe to #include.
  27. dnl
  28. AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD],
  29. [
  30. AC_CHECK_HEADERS(libc.h unistd.h)
  31. AC_CACHE_CHECK(
  32. [whether libc.h and unistd.h can be included together],
  33. guile_cv_header_libc_with_unistd,
  34. [
  35. if test "$ac_cv_header_libc_h" = "no"; then
  36. guile_cv_header_libc_with_unistd="no"
  37. elif test "$ac_cv_header_unistd_h" = "no"; then
  38. guile_cv_header_libc_with_unistd="yes"
  39. else
  40. AC_TRY_COMPILE(
  41. [
  42. # include <libc.h>
  43. # include <unistd.h>
  44. ],
  45. [],
  46. [guile_cv_header_libc_with_unistd=yes],
  47. [guile_cv_header_libc_with_unistd=no]
  48. )
  49. fi
  50. ]
  51. )
  52. if test "$guile_cv_header_libc_with_unistd" = yes; then
  53. AC_DEFINE(LIBC_H_WITH_UNISTD_H, 1,
  54. [Define this if we should include <libc.h> when we've already
  55. included <unistd.h>. On some systems, they conflict, and libc.h
  56. should be omitted. See GUILE_HEADER_LIBC_WITH_UNISTD in
  57. aclocal.m4.])
  58. fi
  59. ])
  60. dnl This is needed when we want to check for the same function repeatedly
  61. dnl with other parameters, such as libraries, varying.
  62. dnl
  63. dnl GUILE_NAMED_CHECK_FUNC(FUNCTION, TESTNAME,
  64. dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  65. AC_DEFUN([GUILE_NAMED_CHECK_FUNC],
  66. [AC_MSG_CHECKING([for $1])
  67. AC_CACHE_VAL(ac_cv_func_$1_$2,
  68. [AC_TRY_LINK(
  69. dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
  70. dnl which includes <sys/select.h> which contains a prototype for
  71. dnl select. Similarly for bzero.
  72. [/* System header to define __stub macros and hopefully few prototypes,
  73. which can conflict with char $1(); below. */
  74. #include <assert.h>
  75. /* Override any gcc2 internal prototype to avoid an error. */
  76. #ifdef __cplusplus
  77. extern "C"
  78. #endif
  79. /* We use char because int might match the return type of a gcc2
  80. builtin and then its argument prototype would still apply. */
  81. char $1();
  82. ], [
  83. /* The GNU C library defines this for functions which it implements
  84. to always fail with ENOSYS. Some functions are actually named
  85. something starting with __ and the normal name is an alias. */
  86. #if defined (__stub_$1) || defined (__stub___$1)
  87. choke me
  88. #else
  89. $1();
  90. #endif
  91. ], eval "ac_cv_func_$1_$2=yes", eval "ac_cv_func_$1_$2=no")])
  92. if eval "test \"`echo '$ac_cv_func_'$1'_'$2`\" = yes"; then
  93. AC_MSG_RESULT(yes)
  94. ifelse([$3], , :, [$3])
  95. else
  96. AC_MSG_RESULT(no)
  97. ifelse([$4], , , [$4
  98. ])dnl
  99. fi
  100. ])