ax_nagios_get_inetd.m4 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # ===========================================================================
  2. # SYNOPSIS
  3. #
  4. # AX_NAGIOS_GET_INETD
  5. #
  6. # DESCRIPTION
  7. #
  8. # This macro determines whether inetd or xinetd is being used
  9. # The argument are:
  10. # the init type as determined by AX_NAGIOS_GET_INIT
  11. # $inetd_type will be set and will be one of:
  12. # unknown (could not be determined)
  13. # launchd (Mac OS X)
  14. # smf10 (Solaris)
  15. # smf11 (Solaris)
  16. # upstart (Older Debian)
  17. # xinetd (Most Linux, BSD)
  18. # inetd (The rest)
  19. #
  20. # LICENSE
  21. #
  22. # Copyright (c) 2016 Nagios Core Development Team
  23. #
  24. # This program is free software; you can redistribute it and/or modify it
  25. # under the terms of the GNU General Public License as published by the
  26. # Free Software Foundation; either version 2 of the License, or (at your
  27. # option) any later version.
  28. #
  29. # This program is distributed in the hope that it will be useful, but
  30. # WITHOUT ANY WARRANTY; without even the implied warranty of
  31. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  32. # Public License for more details.
  33. #
  34. # You should have received a copy of the GNU General Public License along
  35. # with this program. If not, see <http://www.gnu.org/licenses/>.
  36. #
  37. # As a special exception, the respective Autoconf Macro's copyright owner
  38. # gives unlimited permission to copy, distribute and modify the configure
  39. # scripts that are the output of Autoconf when processing the Macro. You
  40. # need not follow the terms of the GNU General Public License when using
  41. # or distributing such scripts, even though portions of the text of the
  42. # Macro appear in them. The GNU General Public License (GPL) does govern
  43. # all other use of the material that constitutes the Autoconf Macro.
  44. #
  45. # This special exception to the GPL applies to versions of the Autoconf
  46. # Macro released by the Autoconf Archive. When you make and distribute a
  47. # modified version of the Autoconf Macro, you may extend this special
  48. # exception to the GPL to apply to your modified version as well.
  49. # ===========================================================================
  50. AC_DEFUN([AX_NAGIOS_GET_INETD],
  51. [
  52. AC_SUBST(inetd_type)
  53. #
  54. # Get user hints for possible cross-compile
  55. #
  56. AC_MSG_CHECKING(what inetd is being used )
  57. AC_ARG_WITH(inetd_type, AS_HELP_STRING([--with-inetd-type=type],[which super-server the system runs (inetd, xinetd, systemd, launchd,
  58. smf10, smf11, etc.)]),
  59. [
  60. inetd_type_wanted=yes
  61. #
  62. # Run this if --with was specified
  63. #
  64. if test "x$withval" = x -o x$withval = xno; then
  65. inetd_type_wanted=yes
  66. else
  67. inetd_type_wanted=no
  68. inetd_type="$withval"
  69. AC_MSG_RESULT($inetd_type)
  70. fi
  71. ], [
  72. #
  73. # Run this if --with was not specified
  74. #
  75. inetd_type_wanted=yes
  76. ])
  77. if test x$inetd_type = xno; then
  78. inetd_type_wanted=yes
  79. elif test x$inetd_type = xyes; then
  80. AC_MSG_ERROR([you must enter an inetd type if '--with-inetd-type' is specified])
  81. fi
  82. #
  83. # Determine inetd type if it wasn't supplied
  84. #
  85. if test $inetd_type_wanted = yes; then
  86. inetd_disabled=""
  87. AS_CASE([$dist_type],
  88. [solaris],
  89. if test x"$init_type" = "xsmf10" -o x"$init_type" = "xsmf11"; then
  90. inetd_type="$init_type"
  91. else
  92. inetd_type="inetd"
  93. fi,
  94. [*bsd*],
  95. inetd_type=`ps -A -o comm -c | grep inetd`,
  96. [osx],
  97. inetd_type=`launchd`,
  98. [aix|hp-ux],
  99. inetd_type=`UNIX95= ps -A -o comm | grep inetd | head -1`,
  100. [*],
  101. inetd_type=[`ps -C "inetd,xinetd" -o fname | grep -vi COMMAND | head -1`])
  102. if test x"$inetd_type" = x; then
  103. if test -f /etc/xinetd.conf -a -d /etc/xinetd.d; then
  104. inetd_disabled="(Not running)"
  105. inetd_type=xinetd
  106. elif test -f /etc/inetd.conf -o -f /usr/sbin/inetd; then
  107. inetd_type=inetd
  108. inetd_disabled="(Not running)"
  109. fi
  110. fi
  111. if test x"$inetd_type" = x; then
  112. if test x"$init_type" = "xupstart"; then
  113. inetd_type="upstart"
  114. fi
  115. fi
  116. if test x"$inetd_type" = x; then
  117. if test x"$init_type" = "xsystemd"; then
  118. inetd_type="systemd"
  119. else
  120. inetd_type="unknown"
  121. fi
  122. fi
  123. if test -n "$inetd_disabled"; then
  124. AC_MSG_RESULT($inetd_type $inetd_disabled)
  125. else
  126. AC_MSG_RESULT($inetd_type)
  127. fi
  128. fi
  129. ])