prereq.m4 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #serial 21
  2. dnl These are the prerequisite macros for files in the lib/
  3. dnl directories of the fileutils, sh-utils, and textutils packages.
  4. AC_DEFUN([jm_PREREQ],
  5. [
  6. jm_PREREQ_ADDEXT
  7. jm_PREREQ_CANON_HOST
  8. jm_PREREQ_DIRNAME
  9. jm_PREREQ_ERROR
  10. jm_PREREQ_EXCLUDE
  11. jm_PREREQ_GETPAGESIZE
  12. jm_PREREQ_HASH
  13. jm_PREREQ_HUMAN
  14. jm_PREREQ_MBSWIDTH
  15. jm_PREREQ_MEMCHR
  16. jm_PREREQ_QUOTEARG
  17. jm_PREREQ_READUTMP
  18. jm_PREREQ_REGEX
  19. jm_PREREQ_TEMPNAME # called by mkstemp
  20. ])
  21. AC_DEFUN([jm_PREREQ_ADDEXT],
  22. [
  23. dnl For addext.c.
  24. AC_SYS_LONG_FILE_NAMES
  25. AC_CHECK_FUNCS(pathconf)
  26. AC_CHECK_HEADERS(limits.h string.h unistd.h)
  27. ])
  28. AC_DEFUN([jm_PREREQ_CANON_HOST],
  29. [
  30. dnl Add any libraries as early as possible.
  31. dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
  32. dnl so we have to add -lnsl to LIBS before checking for that function.
  33. AC_SEARCH_LIBS(gethostbyname, [inet nsl])
  34. dnl These come from -lnsl on Solaris5.5.1.
  35. AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
  36. AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
  37. AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
  38. netinet/in.h arpa/inet.h)
  39. ])
  40. AC_DEFUN([jm_PREREQ_DIRNAME],
  41. [
  42. AC_HEADER_STDC
  43. AC_CHECK_HEADERS(string.h)
  44. ])
  45. AC_DEFUN([jm_PREREQ_EXCLUDE],
  46. [
  47. jm_FUNC_FNMATCH
  48. AC_CHECK_HEADERS(stdbool.h)
  49. ])
  50. AC_DEFUN([jm_PREREQ_GETPAGESIZE],
  51. [
  52. AC_CHECK_FUNCS(getpagesize)
  53. AC_CHECK_HEADERS(OS.h unistd.h)
  54. ])
  55. AC_DEFUN([jm_PREREQ_HASH],
  56. [
  57. AC_CHECK_HEADERS(stdlib.h stdbool.h)
  58. AC_REQUIRE([jm_CHECK_DECLS])
  59. ])
  60. # If you use human.c, you need the following files:
  61. # inttypes.m4 ulonglong.m4
  62. AC_DEFUN([jm_PREREQ_HUMAN],
  63. [
  64. AC_CHECK_HEADERS(limits.h stdlib.h string.h)
  65. AC_CHECK_DECLS([getenv])
  66. AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
  67. ])
  68. AC_DEFUN([jm_PREREQ_MEMCHR],
  69. [
  70. AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
  71. ])
  72. AC_DEFUN([jm_PREREQ_QUOTEARG],
  73. [
  74. AC_CHECK_FUNCS(isascii iswprint)
  75. jm_FUNC_MBRTOWC
  76. AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
  77. AC_HEADER_STDC
  78. AC_C_BACKSLASH_A
  79. AC_MBSTATE_T
  80. AM_C_PROTOTYPES
  81. ])
  82. AC_DEFUN([jm_PREREQ_READUTMP],
  83. [
  84. AC_HEADER_STDC
  85. AC_CHECK_HEADERS(string.h utmp.h utmpx.h sys/param.h)
  86. AC_CHECK_FUNCS(utmpname)
  87. AC_CHECK_FUNCS(utmpxname)
  88. AM_C_PROTOTYPES
  89. if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
  90. utmp_includes="\
  91. $ac_includes_default
  92. #ifdef HAVE_UTMPX_H
  93. # include <utmpx.h>
  94. #endif
  95. #ifdef HAVE_UTMP_H
  96. # include <utmp.h>
  97. #endif
  98. "
  99. AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
  100. AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
  101. AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
  102. AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
  103. AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
  104. AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
  105. AC_LIBOBJ(readutmp)
  106. fi
  107. ])
  108. AC_DEFUN([jm_PREREQ_REGEX],
  109. [
  110. dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
  111. dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
  112. dnl to get them.
  113. AC_CHECK_FUNCS(bzero bcopy isascii btowc)
  114. AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
  115. AC_HEADER_STDC
  116. AC_FUNC_ALLOCA
  117. ])
  118. AC_DEFUN([jm_PREREQ_TEMPNAME],
  119. [
  120. AC_HEADER_STDC
  121. AC_HEADER_STAT
  122. AC_CHECK_HEADERS(fcntl.h sys/time.h stdint.h unistd.h)
  123. AC_CHECK_FUNCS(__secure_getenv gettimeofday)
  124. ])