acinclude.m4 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. dnl
  2. dnl read lib version from file (and trim trailing newline)
  3. dnl
  4. define([EL_RELEASE], [patsubst(esyscmd([. src/shlib_version; echo $major.$minor]), [
  5. ])])
  6. dnl
  7. dnl read cvsexport timestamp from file (and trim trailing newline)
  8. dnl
  9. define([EL_TIMESTAMP], [patsubst(esyscmd([date +"%Y%m%d"]), [
  10. ])])
  11. dnl
  12. dnl NetBSD use the -mdoc macro package for manpages, but e.g.
  13. dnl AIX and Solaris only support the -man package.
  14. dnl
  15. AC_DEFUN([EL_MANTYPE],
  16. [
  17. MANTYPE=
  18. TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
  19. AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
  20. if ${NROFF} -mdoc ${srcdir}/doc/editrc.5.roff >/dev/null 2>&1; then
  21. MANTYPE=mdoc
  22. fi
  23. AC_SUBST(MANTYPE)
  24. ])
  25. dnl
  26. dnl Check if getpwnam_r and getpwuid_r are POSIX.1 compatible
  27. dnl POSIX draft version returns 'struct passwd *' (used on Solaris)
  28. dnl NOTE: getpwent_r is not POSIX so we always use getpwent
  29. dnl
  30. AC_DEFUN([EL_GETPW_R_POSIX],
  31. [
  32. AC_MSG_CHECKING([whether getpwnam_r and getpwuid_r are posix like])
  33. # The prototype for the POSIX version is:
  34. # int getpwnam_r(char *, struct passwd *, char *, size_t, struct passwd **)
  35. # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
  36. AC_TRY_LINK([#include <stdlib.h>
  37. #include <sys/types.h>
  38. #include <pwd.h>],
  39. [getpwnam_r(NULL, NULL, NULL, (size_t)0, NULL);
  40. getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
  41. [AC_DEFINE([HAVE_GETPW_R_POSIX], 1, [Define to 1 if you have getpwnam_r and getpwuid_r that are POSIX.1 compatible.])
  42. AC_MSG_RESULT(yes)],
  43. [AC_MSG_RESULT(no)])
  44. ])
  45. AC_DEFUN([EL_GETPW_R_DRAFT],
  46. [
  47. AC_MSG_CHECKING([whether getpwnam_r and getpwuid_r are posix _draft_ like])
  48. # The prototype for the POSIX draft version is:
  49. # struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int);
  50. # struct passwd *getpwnam_r(char *, struct passwd *, char *, int);
  51. AC_TRY_LINK([#include <stdlib.h>
  52. #include <sys/types.h>
  53. #include <pwd.h>],
  54. [getpwnam_r(NULL, NULL, NULL, (size_t)0);
  55. getpwuid_r((uid_t)0, NULL, NULL, (size_t)0);],
  56. [AC_DEFINE([HAVE_GETPW_R_DRAFT], 1, [Define to 1 if you have getpwnam_r and getpwuid_r that are draft POSIX.1 versions.])
  57. AC_MSG_RESULT(yes)],
  58. [AC_MSG_RESULT(no)])
  59. ])
  60. dnl
  61. dnl use option --enable-widec to turn on use of wide-character support
  62. dnl
  63. AC_DEFUN([EL_ENABLE_WIDEC],
  64. [
  65. AC_MSG_CHECKING(if you want wide-character code)
  66. AC_ARG_ENABLE(widec,
  67. [ --enable-widec compile with wide-char/UTF-8 code],
  68. [with_widec=$enableval],
  69. [with_widec=no])
  70. AC_MSG_RESULT($with_widec)
  71. if test "$with_widec" = yes ; then
  72. AC_DEFINE(WIDECHAR, 1, [Define to 1 if you want wide-character code])
  73. fi
  74. AM_CONDITIONAL([WIDECHAR], [test "$with_widec" = yes])
  75. ])