acinclude.m4 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. dnl acinclude.m4 for guile
  2. dnl Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
  3. dnl This file is part of GUILE.
  4. dnl
  5. dnl GUILE is free software; you can redistribute it and/or modify
  6. dnl it under the terms of the GNU General Public License as
  7. dnl published by the Free Software Foundation; either version 2, or
  8. dnl (at your option) any later version.
  9. dnl
  10. dnl GUILE is distributed in the hope that it will be useful, but
  11. dnl WITHOUT ANY WARRANTY; without even the implied warranty of
  12. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. dnl GNU General Public License for more details.
  14. dnl
  15. dnl You should have received a copy of the GNU General Public
  16. dnl License along with GUILE; see the file COPYING. If not, write
  17. dnl to the Free Software Foundation, Inc., 59 Temple Place, Suite
  18. dnl 330, Boston, MA 02111-1307 USA
  19. dnl On the NeXT, #including <utime.h> doesn't give you a definition for
  20. dnl struct utime, unless you #define _POSIX_SOURCE.
  21. AC_DEFUN(GUILE_STRUCT_UTIMBUF, [
  22. AC_CACHE_CHECK([whether we need POSIX to get struct utimbuf],
  23. guile_cv_struct_utimbuf_needs_posix,
  24. [AC_TRY_CPP([
  25. #ifdef __EMX__
  26. #include <sys/utime.h>
  27. #else
  28. #include <utime.h>
  29. #endif
  30. struct utime blah;
  31. ],
  32. guile_cv_struct_utimbuf_needs_posix=no,
  33. guile_cv_struct_utimbuf_needs_posix=yes)])
  34. if test "$guile_cv_struct_utimbuf_needs_posix" = yes; then
  35. AC_DEFINE([UTIMBUF_NEEDS_POSIX], 1,
  36. [Define this if <utime.h> doesn't define struct utimbuf unless
  37. _POSIX_SOURCE is defined. See GUILE_STRUCT_UTIMBUF in aclocal.m4.])
  38. fi])
  39. dnl
  40. dnl Apparently, at CMU they have a weird version of libc.h that is
  41. dnl installed in /usr/local/include and conflicts with unistd.h.
  42. dnl In these situations, we should not #include libc.h.
  43. dnl This test arranges to #define LIBC_H_WITH_UNISTD_H iff libc.h is
  44. dnl present on the system, and is safe to #include.
  45. dnl
  46. AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD],
  47. [
  48. AC_CHECK_HEADERS(libc.h unistd.h)
  49. AC_CACHE_CHECK(
  50. [whether libc.h and unistd.h can be included together],
  51. guile_cv_header_libc_with_unistd,
  52. [
  53. if test "$ac_cv_header_libc_h" = "no"; then
  54. guile_cv_header_libc_with_unistd="no"
  55. elif test "$ac_cv_header_unistd_h" = "no"; then
  56. guile_cv_header_libc_with_unistd="yes"
  57. else
  58. AC_TRY_COMPILE(
  59. [
  60. # include <libc.h>
  61. # include <unistd.h>
  62. ],
  63. [],
  64. [guile_cv_header_libc_with_unistd=yes],
  65. [guile_cv_header_libc_with_unistd=no]
  66. )
  67. fi
  68. ]
  69. )
  70. if test "$guile_cv_header_libc_with_unistd" = yes; then
  71. AC_DEFINE(LIBC_H_WITH_UNISTD_H, 1,
  72. [Define this if we should include <libc.h> when we've already
  73. included <unistd.h>. On some systems, they conflict, and libc.h
  74. should be omitted. See GUILE_HEADER_LIBC_WITH_UNISTD in
  75. aclocal.m4.])
  76. fi
  77. ]
  78. )
  79. dnl This is needed when we want to check for the same function repeatedly
  80. dnl with other parameters, such as libraries, varying.
  81. dnl
  82. dnl GUILE_NAMED_CHECK_FUNC(FUNCTION, TESTNAME,
  83. dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  84. AC_DEFUN(GUILE_NAMED_CHECK_FUNC,
  85. [AC_MSG_CHECKING([for $1])
  86. AC_CACHE_VAL(ac_cv_func_$1_$2,
  87. [AC_TRY_LINK(
  88. dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
  89. dnl which includes <sys/select.h> which contains a prototype for
  90. dnl select. Similarly for bzero.
  91. [/* System header to define __stub macros and hopefully few prototypes,
  92. which can conflict with char $1(); below. */
  93. #include <assert.h>
  94. /* Override any gcc2 internal prototype to avoid an error. */
  95. #ifdef __cplusplus
  96. extern "C"
  97. #endif
  98. /* We use char because int might match the return type of a gcc2
  99. builtin and then its argument prototype would still apply. */
  100. char $1();
  101. ], [
  102. /* The GNU C library defines this for functions which it implements
  103. to always fail with ENOSYS. Some functions are actually named
  104. something starting with __ and the normal name is an alias. */
  105. #if defined (__stub_$1) || defined (__stub___$1)
  106. choke me
  107. #else
  108. $1();
  109. #endif
  110. ], eval "ac_cv_func_$1_$2=yes", eval "ac_cv_func_$1_$2=no")])
  111. if eval "test \"`echo '$ac_cv_func_'$1'_'$2`\" = yes"; then
  112. AC_MSG_RESULT(yes)
  113. ifelse([$3], , :, [$3])
  114. else
  115. AC_MSG_RESULT(no)
  116. ifelse([$4], , , [$4
  117. ])dnl
  118. fi
  119. ])