ax_nagios_get_inetd 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. AU_ALIAS([AC_NAGIOS_GET_INETD], [AX_NAGIOS_GET_INETD])
  51. AC_DEFUN([AX_NAGIOS_GET_INETD],
  52. [
  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, AC_HELP_STRING([--with-inetd-type=type],
  58. [which super-server the system runs (inetd, xinetd, systemd, launchd,
  59. smf10, smf11, etc.)]),
  60. [
  61. inetd_type_wanted=yes
  62. #
  63. # Run this if --with was specified
  64. #
  65. if test "x$withval" = x -o x$withval = xno; then
  66. inetd_type_wanted=yes
  67. else
  68. inetd_type_wanted=no
  69. inetd_type="$withval"
  70. AC_MSG_RESULT($inetd_type)
  71. fi
  72. ], [
  73. #
  74. # Run this if --with was not specified
  75. #
  76. inetd_type_wanted=yes
  77. ])
  78. if test x$inetd_type = xno; then
  79. inetd_type_wanted=yes
  80. elif test x$inetd_type = xyes; then
  81. AC_MSG_ERROR([you must enter an inetd type if '--with-inetd-type' is specified])
  82. fi
  83. #
  84. # Determine inetd type if it wasn't supplied
  85. #
  86. if test $inetd_type_wanted = yes; then
  87. inetd_disabled=""
  88. if test x"$init_type" = "xupstart"; then
  89. inetd_type="upstart"
  90. elif test "$opsys" = "osx"; then
  91. inetd_type="launchd"
  92. fi
  93. if test x"$inetd_type" = x; then
  94. AS_CASE([$dist_type],
  95. [solaris],
  96. if test x"$init_type" = "xsmf10" -o x"$init_type" = "xsmf11"; then
  97. inetd_type="$init_type"
  98. else
  99. inetd_type="inetd"
  100. fi,
  101. [*bsd*],
  102. inetd_type=`ps -A -o comm -c | grep inetd`,
  103. [aix|hp-ux],
  104. inetd_type=`UNIX95= ps -A -o comm | grep inetd | head -1`,
  105. [*],
  106. inetd_type=[`ps -C "inetd,xinetd" -o fname | grep -vi COMMAND`])
  107. fi
  108. if test x"$inetd_type" = x; then
  109. if test -f /etc/xinetd.conf -a -d /etc/xinetd.d; then
  110. inetd_disabled="(Not running)"
  111. inetd_type=xinetd
  112. elif test -f /etc/inetd.conf -o -f /usr/sbin/inetd; then
  113. inetd_type=inetd
  114. inetd_disabled="(Not running)"
  115. fi
  116. fi
  117. if test x"$inetd_type" = x; then
  118. if test x"$init_type" = "xsystemd"; then
  119. inetd_type="systemd"
  120. else
  121. inetd_type="unknown"
  122. fi
  123. fi
  124. if test -n "$inetd_disabled"; then
  125. AC_MSG_RESULT($inetd_type $inetd_disabled)
  126. else
  127. AC_MSG_RESULT($inetd_type)
  128. fi
  129. fi
  130. ])