Debian Codegraph @

autoconf-macros/ax_nagios_get_paths

raw
1 # ===========================================================================
2 # SYNOPSIS
3 #
4 # AX_NAGIOS_GET_PATHS
5 #
6 # DESCRIPTION
7 #
8 # This macro figures out the installation & run paths for various systems
9 # The argument are:
10 # the O/S determined by the AX_NAGIOS_GET_OS macro.
11 # the distribution type as determined by AX_NAGIOS_GET_DISTRIB_TYPE
12 # the init type as determined by AX_NAGIOS_GET_INIT
13 # the inetd type as determined by AX_NAGIOS_GET_INETD
14 #
15 # LICENSE
16 #
17 # Copyright (c) 2016 Nagios Core Development Team
18 #
19 # This program is free software; you can redistribute it and/or modify it
20 # under the terms of the GNU General Public License as published by the
21 # Free Software Foundation; either version 2 of the License, or (at your
22 # option) any later version.
23 #
24 # This program is distributed in the hope that it will be useful, but
25 # WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
27 # Public License for more details.
28 #
29 # You should have received a copy of the GNU General Public License along
30 # with this program. If not, see <http://www.gnu.org/licenses/>.
31 #
32 # As a special exception, the respective Autoconf Macro's copyright owner
33 # gives unlimited permission to copy, distribute and modify the configure
34 # scripts that are the output of Autoconf when processing the Macro. You
35 # need not follow the terms of the GNU General Public License when using
36 # or distributing such scripts, even though portions of the text of the
37 # Macro appear in them. The GNU General Public License (GPL) does govern
38 # all other use of the material that constitutes the Autoconf Macro.
39 #
40 # This special exception to the GPL applies to versions of the Autoconf
41 # Macro released by the Autoconf Archive. When you make and distribute a
42 # modified version of the Autoconf Macro, you may extend this special
43 # exception to the GPL to apply to your modified version as well.
44 # ===========================================================================
45
46 AU_ALIAS([AC_NAGIOS_GET_PATHS], [AX_NAGIOS_GET_PATHS])
47 AC_DEFUN([AX_NAGIOS_GET_PATHS],
48 [
49
50 AC_SUBST(pkgsysconfdir)
51 AC_SUBST(objsysconfdir)
52 AC_SUBST(initname)
53 AC_SUBST(inetdname)
54 AC_SUBST(pluginsdir)
55 AC_SUBST(brokersdir)
56 AC_SUBST(cgibindir)
57 AC_SUBST(webdir)
58 AC_SUBST(privatesysconfdir)
59 AC_SUBST(pkglocalstatedir)
60 AC_SUBST(logdir)
61 AC_SUBST(piddir)
62 AC_SUBST(pipedir)
63 AC_SUBST(spooldir)
64 AC_SUBST(initdir)
65 AC_SUBST(initdiroverridden)
66 AC_SUBST(inetddir)
67 AC_SUBST(tmpfilesd)
68 AC_SUBST(subsyslockdir)
69 AC_SUBST(subsyslockfile)
70
71 if test x$DBG_PATHS != x; then
72 echo
73 echo Incoming paths:
74 echo " prefix $prefix"
75 echo " exec_prefix $exec_prefix"
76 echo " bindir $bindir"
77 echo " libexecdir $libexecdir"
78 echo " sysconfdir $sysconfdir"
79 echo " localstatedir $localstatedir"
80 echo " datarootdir $datarootdir"
81 echo " datadir $datadir"
82 echo " localedir $localedir"
83 echo
84 fi
85
86 AC_MSG_CHECKING(for which paths to use )
87
88 AC_ARG_ENABLE(install_method,
89 AS_HELP_STRING([--enable-install-method=<method>],
90 [sets the install method to use: 'default' (the default) will install to
91 /usr/local/nagios, 'os' will try to determine which method to use based
92 on OS type and distribution. Fine tuning using the '--bindir', etc.
93 overrides above will still work]),
94 install_method=$enableval,
95 install_method=default
96 )
97
98 AC_ARG_ENABLE(showdirs_only,
99 AS_HELP_STRING([--enable-showdirs-only=yes],
100 [This option will cause 'configure' to stop after determining the install
101 locations based on '--enable-install-method', so you can see the
102 destinations before a full './configure', 'make', 'make install'
103 process.]),
104 showdirs_only=$enableval,
105 showdirs_only=no
106 )
107
108 AS_CASE([$install_method],
109 [yes], install_method="os",
110 [no], install_method="default",
111 [default|os], :,
112 [*], echo >&6; AC_MSG_ERROR(['--enable-install-method=$install_method' is invalid])
113 )
114
115 if test $showdirs_only != "no"; then showdirs_only="yes"; fi
116
117 AS_CASE([$dist_type],
118 [*solaris*|*hp-ux*|*aix*|*osx*], opsys=unix)
119
120
121 # Does this package need to know:
122 need_cgi=no # where the cgi-bin directory is
123 need_web=no # where the website directory is
124 need_brk=no # where the event broker modules directory is
125 need_plg=no # where the plugins directory is
126 need_pipe=no # where the pipe directory is
127 need_spl=no # where the spool directory is
128 need_loc=no # where the locale directory is
129 need_log_subdir=no # where the loc sub-directory is
130 need_etc_subdir=no # where the etc sub-directory is
131 need_pls_dir=no # where the package locate state directory is
132
133 if test x"$INIT_PROG" = x; then
134 INIT_PROG="$PKG_NAME"
135 fi
136
137 AS_CASE([$PKG_NAME],
138 [nagios],
139 need_log_subdir=yes
140 need_etc_subdir=yes
141 need_pls_dir=yes
142 need_brk=yes
143 need_pipe=yes
144 need_spl=yes
145 need_loc=yes
146 need_cgi=yes
147 need_web=yes,
148
149 [ndoutils],
150 need_brk=yes
151 need_spl=yes,
152
153 [nrpe],
154 need_plg=yes,
155
156 [nsca],
157 need_cgi=no,
158
159 [plugins],
160 need_loc=yes
161 need_plg=yes
162 )
163
164 AC_ARG_WITH(pkgsysconfdir, AS_HELP_STRING([--with-pkgsysconfdir=DIR],
165 [where configuration files should be placed]),
166 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
167 pkgsysconfdir="$withval"
168 fi)
169 AC_ARG_WITH(objsysconfdir, AS_HELP_STRING([--with-objsysconfdir=DIR],
170 [where object configuration files should be placed]),
171 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
172 objsysconfdir="$withval"
173 fi)
174 AC_ARG_WITH(privatesysconfdir, AS_HELP_STRING([--with-privatesysconfdir=DIR],
175 [where private configuration files should be placed]),
176 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
177 privatesysconfdir="$withval"
178 fi)
179 AC_ARG_WITH(webdir, AS_HELP_STRING([--with-webdir=DIR],
180 [where the website files should be placed]),
181 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
182 webdir="$withval"
183 fi)
184 AC_ARG_WITH(pluginsdir, AS_HELP_STRING([--with-pluginsdir=DIR],
185 [where the plugins should be placed]),
186 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
187 pluginsdir="$withval"
188 fi)
189 AC_ARG_WITH(brokersdir, AS_HELP_STRING([--with-brokersdir=DIR],
190 [where the broker modules should be placed]),
191 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
192 brokersdir="$withval"
193 fi)
194 AC_ARG_WITH(cgibindir, AS_HELP_STRING([--with-cgibindir=DIR],
195 [where the CGI programs should be placed]),
196 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
197 cgibindir="$withval"
198 fi)
199 AC_ARG_WITH(logdir, AS_HELP_STRING([--with-logdir=DIR],
200 [where log files should be placed]),
201 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
202 logdir="$withval"
203 fi)
204 AC_ARG_WITH(piddir, AS_HELP_STRING([--with-piddir=DIR],
205 [where the PID file should be placed]),
206 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
207 piddir="$withval"
208 fi)
209 AC_ARG_WITH(pipedir, AS_HELP_STRING([--with-pipedir=DIR],
210 [where socket and pipe files should be placed]),
211 if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
212 pipedir="$withval"
213 fi)
214
215
216 #
217 # Setup the base directory
218 #
219
220 if test $install_method = "default"; then
221 if test $opsys = "unix"; then
222 if test x"$prefix" = "xNONE"; then prefix="/usr/local/nagios"; fi
223 else
224 if test x"$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi
225 fi
226 datarootdir=${datarootdir="$prefix"}
227
228 else
229 if test x"$datadir" = x'${datarootdir}'; then AS_UNSET(datadir); fi
230 if test x"$sysconfdir" = x'${prefix}/etc'; then AS_UNSET(sysconfdir); fi
231
232 if test x"$prefix" = "xNONE"; then
233 if test $dist_type = freebsd -o $dist_type = openbsd -o $dist_type = osx; then
234 prefix="/usr/local"
235 elif test $dist_type = netbsd; then
236 prefix="/usr/pkg"
237 else
238 prefix="/usr"
239 fi
240 fi
241 if test x"$exec_prefix" = "xNONE"; then exec_prefix=$prefix; fi
242 if test x"$localstatedir" = x'${prefix}/var'; then
243 if test $dist_type = "osx"; then
244 localstatedir="/private/var"
245 else
246 localstatedir="/var"
247 fi
248 fi
249
250 if test $opsys = "unix"; then
251 if test x"$datarootdir" = x'${prefix}/share'; then
252 if test $dist_type = "hp-ux"; then
253 datarootdir="/usr/local/share"
254 if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
255 libexecdir="/usr/nagios"
256 fi
257 elif test $dist_type = "osx"; then
258 datarootdir="/usr/local/share"
259 if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
260 libexecdir="/usr/local/nagios"
261 fi
262 elif test x"$libexecdir" = x'${exec_prefix}/libexec'; then
263 libexecdir="/usr/lib/nagios"
264 fi
265 fi
266 if test $dist_type = "osx"; then
267 if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
268 libexecdir="/usr/local/libexec/nagios"
269 fi
270 fi
271 elif test $opsys = "bsd"; then
272 if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
273 libexecdir=${exec_prefix}/libexec/nagios;
274 fi
275 elif test x"$libexecdir" = x'${exec_prefix}/lib'; then
276 libexecdir=${libexecdir}/nagios;
277 elif test x"$libexecdir" = x'${exec_prefix}/libexec'; then
278 libexecdir=${exec_prefix}/lib/nagios;
279 fi
280
281 fi
282
283 if test x"$exec_prefix" = "xNONE"; then exec_prefix=${prefix}; fi
284
285 tmpfilesd=${tmpfilesd="/usr/lib/tmpfiles.d"}
286 if test ! -d "$tmpfilesd"; then
287 tmpfilesd="N/A"
288 else
289 tmpfilesd="$tmpfilesd/$INIT_PROG.conf"
290 fi
291 subsyslockdir=${subsyslockdir="/run"}
292 if test ! -d "$subsyslockdir"; then
293 subsyslockdir="N/A"
294 subsyslockfile="N/A"
295 else
296 subsyslockfile="$subsyslockdir/$INIT_PROG.lock"
297 fi
298 if test "$need_loc" = no; then
299 localedir="N/A"
300 fi
301
302 if test $install_method = "default" ; then
303 #
304 # Do the default setup
305 #
306 datadir=${datadir="$datarootdir"}
307 if test $need_web = yes; then
308 webdir=${webdir="$datadir"}
309 else
310 webdir="N/A"
311 fi
312 if test $opsys = "unix"; then
313 sysconfdir=${sysconfdir="/etc/opt"}
314 fi
315 pkgsysconfdir=${pkgsysconfdir="$sysconfdir"}
316 if test $need_etc_subdir = yes; then
317 objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
318 else
319 objsysconfdir="N/A"
320 fi
321 privatesysconfdir=${privatesysconfdir="$pkgsysconfdir"}
322 logdir=${logdir="$localstatedir"}
323 piddir=${piddir="$localstatedir"}
324 if test "$need_pipe" = yes; then
325 pipedir=${pipedir="$localstatedir/rw"}
326 else
327 pipedir="N/A"
328 fi
329 if test "$need_pls_dir" = yes; then
330 pkglocalstatedir=${pkglocalstatedir="$localstatedir"}
331 else
332 pkglocalstatedir="N/A"
333 fi
334 if test "$need_spl" = yes; then
335 spooldir=${spooldir="$localstatedir/var"}
336 else
337 spooldir="N/A"
338 fi
339 if test $need_brk = yes; then
340 brokersdir=${brokersdir="$bindir"}
341 else
342 brokersdir="N/A"
343 fi
344 if test $need_plg = yes; then
345 pluginsdir=${pluginsdir="$libexecdir"}
346 else
347 pluginsdir="N/A"
348 fi
349 if test $need_cgi = yes; then
350 cgibindir=${cgibindir="$prefix/sbin"}
351 else
352 cgibindir="N/A"
353 fi
354
355 elif test $opsys = "linux"; then
356
357 #
358 # Linux "Standard" install
359 #
360 install_method="$install_method : FHS"
361 datadir=${datadir="$datarootdir/nagios"}
362 if test $need_web = yes; then
363 webdir=${webdir="$datadir/html"}
364 else
365 webdir="N/A"
366 fi
367 sysconfdir=${sysconfdir="/etc"}
368 pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
369 if test $need_etc_subdir = yes; then
370 objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
371 else
372 objsysconfdir="N/A"
373 fi
374 privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
375 if test $need_log_subdir = yes; then
376 logdir=${logdir="$localstatedir/log/$INIT_PROG"}
377 else
378 logdir=${logdir="$localstatedir/log"}
379 fi
380 piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
381 if test "$need_pipe" = yes; then
382 pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
383 else
384 pipedir="N/A"
385 fi
386 if test "$need_pls_dir" = yes; then
387 pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
388 else
389 pkglocalstatedir="N/A"
390 fi
391 if test "$need_spl" = yes; then
392 spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
393 else
394 spooldir="N/A"
395 fi
396 if test $need_brk = yes; then
397 brokersdir=${brokersdir="$libexecdir/brokers"}
398 else
399 brokersdir="N/A"
400 fi
401 if test $need_plg = yes; then
402 pluginsdir=${pluginsdir="$libexecdir/plugins"}
403 else
404 pluginsdir="N/A"
405 fi
406 if test $need_cgi = yes; then
407 cgibindir=${cgibindir="$libexecdir/cgi-bin"}
408 else
409 cgibindir="N/A"
410 fi
411
412 elif test $opsys = "unix"; then
413
414 #
415 # "Standard" Unix install
416 #
417 install_method="$install_method : Unix Standard"
418 if test $dist_type = osx; then
419 install_method="$install_method : OS X Standard"
420 fi
421 datadir=${datadir="$datarootdir/nagios"}
422 if test $need_web = yes; then
423 webdir=${webdir="$datadir/html"}
424 else
425 webdir="N/A"
426 fi
427 if test $dist_type = osx; then
428 sysconfdir=${sysconfdir="/private/etc"}
429 else
430 sysconfdir=${sysconfdir="/etc"}
431 fi
432 pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
433 if test $need_etc_subdir = yes; then
434 objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
435 else
436 objsysconfdir="N/A"
437 fi
438 privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
439 if test "$need_pls_dir" = yes; then
440 pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
441 else
442 pkglocalstatedir="N/A"
443 fi
444 if test "$need_loc" = yes; then
445 localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
446 fi
447 if test "$need_spl" = yes; then
448 spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
449 else
450 spooldir="N/A"
451 fi
452 if test $need_brk = yes; then
453 brokersdir=${brokersdir="$libexecdir/brokers"}
454 else
455 brokersdir="N/A"
456 fi
457 if test $need_plg = yes; then
458 pluginsdir=${pluginsdir="$libexecdir/plugins"}
459 else
460 pluginsdir="N/A"
461 fi
462 if test $need_cgi = yes; then
463 cgibindir=${cgibindir="$libexecdir/cgi-bin"}
464 else
465 cgibindir="N/A"
466 fi
467 AS_CASE([$dist_type],
468 [*hp-ux*],
469 piddir=${piddir="$pkgsysconfdir"}
470 pipedir=${pipedir="$pkglocalstatedir"}
471 logdir=${logdir="$pkglocalstatedir/log"},
472
473 [*],
474 piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
475 if test "$need_pipe" = yes; then
476 pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
477 else
478 pipedir="N/A"
479 fi
480 if test $need_log_subdir = yes; then
481 logdir=${logdir="$localstatedir/log/$INIT_PROG"}
482 else
483 logdir=${logdir="$localstatedir/log"}
484 fi
485 )
486
487 elif test $opsys = "bsd"; then
488
489 #
490 # "Standard" BSD install
491 #
492 install_method="$install_method : BSD"
493 if test $dist_type = freebsd -o $dist_type = openbsd; then
494 prefix=${prefix="/usr/local"}
495 exec_prefix=${exec_prefix="/usr/local"}
496 if test $dist_type = freebsd; then
497 install_method="$install_method : FreeBSD"
498 else
499 install_method="$install_method : OpenBSD"
500 fi
501 elif test $dist_type = netbsd; then
502 prefix=${prefix="/usr/pkg"}
503 exec_prefix=${exec_prefix="/usr/pkg"}
504 install_method="$install_method : NetBSD"
505 fi
506 datadir=${datadir="$datarootdir/nagios"}
507 if test $need_web = yes -o $need_cgi = yes; then
508 if test $dist_type = freebsd; then
509 webdir=${webdir="$prefix/www/nagios"}
510 elif test $dist_type = netbsd; then
511 webdir=${webdir="$prefix/share/nagios"}
512 elif test $dist_type = openbsd; then
513 webdir=${webdir="/var/www/nagios"}
514 fi
515 else
516 webdir="N/A"
517 fi
518 if test $dist_type = freebsd; then
519 sysconfdir=${sysconfdir="/usr/local/etc"}
520 else
521 sysconfdir=${sysconfdir="/etc"}
522 fi
523 pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
524 if test $need_etc_subdir = yes; then
525 objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
526 else
527 objsysconfdir="N/A"
528 fi
529 privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
530 if test "$need_pls_dir" = yes; then
531 pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
532 else
533 pkglocalstatedir="N/A"
534 fi
535 if test "$need_loc" = yes; then
536 localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
537 fi
538 if test "$need_spl" = yes; then
539 spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
540 else
541 spooldir="N/A"
542 fi
543 if test $need_brk = yes; then
544 brokersdir=${brokersdir="$libexecdir/brokers"}
545 else
546 brokersdir="N/A"
547 fi
548 if test $need_plg = yes; then
549 pluginsdir=${pluginsdir="$libexecdir/plugins"}
550 else
551 pluginsdir="N/A"
552 fi
553 if test $need_cgi = yes; then
554 if test $dist_type = freebsd; then
555 cgibindir=${cgibindir="$webdir/cgi-bin"}
556 elif test $dist_type = netbsd; then
557 cgibindir=${pluginsdir="$libexecdir/cgi-bin"}
558 elif test $dist_type = openbsd; then
559 cgibindir=${pluginsdir="/var/www/cgi-bin/nagios"}
560 fi
561 else
562 cgibindir="N/A"
563 fi
564 piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
565 if test "$need_pipe" = yes; then
566 pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
567 else
568 pipedir="N/A"
569 fi
570 if test $need_log_subdir = yes; then
571 logdir=${logdir="$localstatedir/log/$INIT_PROG"}
572 else
573 logdir=${logdir="$localstatedir/log"}
574 fi
575
576 else
577
578 #
579 # Unknown install
580 #
581 install_method="unknown"
582 webdir=unknown
583 pkgsysconfdir=unknown
584 objsysconfdir=unknown
585 privatesysconfdir=unknown
586 logdir=unknown
587 piddir=unknown
588 pipedir=unknown
589 pkglocalstatedir=unknown
590 spooldir=unknown
591 brokersdir=unknown
592 pluginsdir=unknown
593 cgibindir=unknown
594
595 fi
596
597 eval prefix=$prefix
598 eval exec_prefix=$exec_prefix
599 eval bindir=$bindir
600 eval datarootdir=$datarootdir
601 eval datadir=$datadir
602 eval libexecdir=$libexecdir
603 eval brokersdir=$brokersdir
604 eval pluginsdir=$pluginsdir
605 eval cgibindir=$cgibindir
606 eval localstatedir=$localstatedir
607 eval pkglocalstatedir=$pkglocalstatedir
608 eval webdir=$webdir
609 eval localedir=$localedir
610 eval sysconfdir=$sysconfdir
611 eval pkgsysconfdir=$pkgsysconfdir
612 eval piddir=$piddir
613
614
615 # We test systemd first because in case
616 # someone tries to install Nagios on a
617 # system with a newer version, that doesn't
618 # have the defined versions ..we can just
619 # (hopefully) fall back to SysV
620 # And if that doesn't work, well...
621 AS_CASE([$init_type],
622
623 [systemd],
624 if test -d "/lib/systemd/system"; then
625 initdir=${initdir="/lib/systemd/system"}
626 elif test -d "/usr/lib/systemd/system"; then
627 initdir=${initdir="/usr/lib/systemd/system"}
628 elif test -d "/usr/local/lib/systemd/system"; then
629 initdir=${initdir="/usr/local/lib/systemd/system"}
630 elif test -d "/run/systemd/system"; then
631 initdir=${initdir="/run/systemd/system"}
632 elif test -d "/etc/systemd/system"; then
633 initdir=${initdir="/etc/systemd/system"}
634 elif test -d "/etc/systemd/user"; then
635 initdir=${initdir="/etc/systemd/user"}
636 elif test -d "/run/systemd/user"; then
637 initdir=${initdir="/run/systemd/user"}
638 elif test -d "/usr/lib/systemd/user"; then
639 initdir=${initdir="/usr/lib/systemd/user"}
640 elif test -d "/usr/local/lib/systemd/user"; then
641 initdir=${initdir="/usr/local/lib/systemd/user"}
642 elif test -d "/usr/share/systemd/user"; then
643 initdir=${initdir="/usr/share/systemd/user"}
644 elif test -d "/usr/local/share/systemd/user"; then
645 initdir=${initdir="/usr/local/share/systemd/user"}
646 elif test -d "$HOME/.config/systemd/user"; then
647 initdir=${initdir="$HOME/.config/systemd/user"}
648 elif test -d "$HOME/.local/share/systemd/user"; then
649 initdir=${initdir="$HOME/.local/share/systemd/user"}
650 elif test -d "$XDG_CONFIG_HOME/systemd/user/"; then
651 initdir=${initdir="$XDG_CONFIG_HOME/systemd/user/"}
652 elif test -d "$XDG_RUNTIME_DIR/systemd/user/"; then
653 initdir=${initdir="$XDG_RUNTIME_DIR/systemd/user/"}
654 elif test -d "$XDG_DATA_HOME/systemd/user/"; then
655 initdir=${initdir="$XDG_DATA_HOME/systemd/user/"}
656 else
657 init_type="sysv"
658 fi
659 initname=${initname="$INIT_PROG.service"},
660 )
661
662 #
663 # Init scripts/files
664 #
665 AS_CASE([$init_type],
666
667 [sysv],
668 if test $dist_type = "hp-ux"; then
669 initdir=${initdir="/sbin/init.d"}
670 else
671 initdir=${initdir="/etc/init.d"}
672 fi
673 initname=${initname="$INIT_PROG"}
674 initconfdir=${initconfdir="/etc/conf.d"}
675 initconf=${initconf="$initconfdir/$INIT_PROG"},
676
677
678 [bsd],
679 if test $dist_type = "aix"; then
680 initdir=${initdir="/sbin/rc.d/init.d"}
681 initname=${initname="$INIT_PROG"}
682 else
683 initdir=${initdir="/etc/rc.d"}
684 initname=${initname="rc.$INIT_PROG"}
685 fi,
686
687 [newbsd],
688 initdir=${initdir="/usr/local/etc/rc.d"}
689 initname=${initname="$INIT_PROG"},
690
691 [gentoo],
692 initdir=${initdir="/etc/init.d"}
693 initname=${initname="$INIT_PROG"}
694 initconfdir=${initconfdir="/etc/init.d"}
695 initconf=${initconf="$initconfdir/$INIT_PROG"},
696
697 [openrc],
698 initdir=${initdir="/etc/init.d"}
699 initname=${initname="$INIT_PROG"}
700 initconfdir=${initconfdir="/etc/conf.d"}
701 initconf=${initconf="$initconfdir/$INIT_PROG"},
702
703 [smf*],
704 if test $init_type = smf10; then
705 initdir=${initdir="/var/svc/manifest/network/nagios"}
706 else
707 initdir=${initdir="/lib/svc/manifest/network/nagios"}
708 fi
709 initname=${initname="$INIT_PROG.xml"}
710 initconfdir=unknown
711 initconf=unknown,
712
713 [upstart],
714 initdir=${initdir="/etc/init"}
715 initname=${initname="$INIT_PROG.conf"}
716 initconfdir=${initconfdir="/etc/default"}
717 initconf=${initconf="$initconfdir/$INIT_PROG"},
718
719 [launchd],
720 initdir=${initdir="/Library/LaunchDaemons"}
721 initname=${initname="org.nagios.$INIT_PROG.plist"},
722 # initconfdir=${initconfdir="/private/etc"}
723 # initconf=${initconf="$initconfdir/$INIT_PROG"},
724
725 [systemd],
726 init_type=systemd,
727
728 [*],
729 initdir=unknown
730 initname=unknown)
731
732 # Now see if they supplied any overwriting values
733 initdiroverridden=no
734 AC_ARG_WITH(initdir,
735 AS_HELP_STRING([--with-initdir=<path>],
736 [overrides path for initdir]),
737 initdir=$withval
738 initdiroverridden=yes,
739 initdir=$initdir
740 )
741
742 #
743 # Inetd (per connection) scripts/files
744 #
745 AS_CASE([$inetd_type],
746 [inetd*],
747 inetddir=${inetddir="/etc"}
748 inetdname=${inetdname="inetd.conf"},
749
750 [xinetd],
751 inetddir=${inetddir="/etc/xinetd.d"}
752 inetdname=${inetdname="$INIT_PROG"},
753
754 [systemd],
755 if test $dist_type = "debian"; then
756 inetddir=${inetddir="/lib/systemd/system"}
757 else
758 inetddir=${inetddir="/usr/lib/systemd/system"}
759 fi
760 netdname=${inetdname="$INIT_PROG.socket"},
761
762 [smf*],
763 if test $init_type = smf10; then
764 inetddir=${inetddir="/var/svc/manifest/network/nagios"}
765 else
766 inetddir=${inetddir="/lib/svc/manifest/network/nagios"}
767 fi
768 inetdname=${inetdname="$INIT_PROG.xml"},
769
770 # [upstart],
771 # inetddir=${inetddir="/etc/init.d"}
772 # inetdname=${inetdname="$INIT_PROG"},
773
774 [launchd],
775 inetddir=${inetddir="/Library/LaunchDaemons"}
776 inetdname=${inetdname="org.nagios.$INIT_PROG.plist"},
777
778 [*],
779 inetddir=${inetddir="unknown"}
780 inetdname=${inetdname="unknown"})
781
782 AC_MSG_RESULT($install_method)
783 ])