Debian Codegraph @

macros/ax_nagios_get_inetd

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