ax_nagios_get_inetd 4.2 KB

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