summaryrefslogtreecommitdiffstats
path: root/macros
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:05:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:05:42 +0000
commit305857535615c13098272b678a72000b021a7fc3 (patch)
tree588d04c9a14561b6bc6d3e5ef09d413692a36771 /macros
parentInitial commit. (diff)
downloadnagios-nrpe-upstream.tar.xz
nagios-nrpe-upstream.zip
Adding upstream version 4.0.3.upstream/4.0.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'macros')
-rw-r--r--macros/.gitignore1
-rw-r--r--macros/CHANGELOG.md7
-rw-r--r--macros/LICENSE264
l---------macros/LICENSE.md1
-rw-r--r--macros/README.md199
-rwxr-xr-xmacros/add_group_user140
-rw-r--r--macros/ax_nagios_get_distrib160
-rw-r--r--macros/ax_nagios_get_files131
-rw-r--r--macros/ax_nagios_get_inetd146
-rw-r--r--macros/ax_nagios_get_init200
-rw-r--r--macros/ax_nagios_get_os101
-rw-r--r--macros/ax_nagios_get_paths738
-rw-r--r--macros/ax_nagios_get_ssl303
13 files changed, 2391 insertions, 0 deletions
diff --git a/macros/.gitignore b/macros/.gitignore
new file mode 100644
index 0000000..80f408e
--- /dev/null
+++ b/macros/.gitignore
@@ -0,0 +1 @@
+nbproject/
diff --git a/macros/CHANGELOG.md b/macros/CHANGELOG.md
new file mode 100644
index 0000000..f71288f
--- /dev/null
+++ b/macros/CHANGELOG.md
@@ -0,0 +1,7 @@
+1.0.1
+-----
+ * Fix bug determining inetd,xinetd if neither are running (Bryan Heden)
+
+1.0.0
+-----
+ * Initial Release (John Frickson) \ No newline at end of file
diff --git a/macros/LICENSE b/macros/LICENSE
new file mode 100644
index 0000000..a983462
--- /dev/null
+++ b/macros/LICENSE
@@ -0,0 +1,264 @@
+The GNU General Public License, Version 2, June 1991 (GPLv2)
+============================================================
+
+> Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+> 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+
+Preamble
+--------
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to most
+of the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you can
+do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a
+fee, you must give the recipients all the rights that you have. You must make
+sure that they, too, receive or can get the source code. And you must show them
+these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer
+you this license which gives you legal permission to copy, distribute and/or
+modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced by
+others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish
+to avoid the danger that redistributors of a free program will individually
+obtain patent licenses, in effect making the program proprietary. To prevent
+this, we have made it clear that any patent must be licensed for everyone's free
+use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+
+Terms And Conditions For Copying, Distribution And Modification
+---------------------------------------------------------------
+
+**0.** This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program or
+work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language. (Hereinafter, translation is included without
+limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is not
+restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+**1.** You may copy and distribute verbatim copies of the Program's source code
+as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the Program
+a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at
+your option offer warranty protection in exchange for a fee.
+
+**2.** You may modify your copy or copies of the Program or any portion of it,
+thus forming a work based on the Program, and copy and distribute such
+modifications or work under the terms of Section 1 above, provided that you also
+meet all of these conditions:
+
+* **a)** You must cause the modified files to carry prominent notices stating
+ that you changed the files and the date of any change.
+
+* **b)** You must cause any work that you distribute or publish, that in whole
+ or in part contains or is derived from the Program or any part thereof, to
+ be licensed as a whole at no charge to all third parties under the terms of
+ this License.
+
+* **c)** If the modified program normally reads commands interactively when
+ run, you must cause it, when started running for such interactive use in the
+ most ordinary way, to print or display an announcement including an
+ appropriate copyright notice and a notice that there is no warranty (or
+ else, saying that you provide a warranty) and that users may redistribute
+ the program under these conditions, and telling the user how to view a copy
+ of this License. (Exception: if the Program itself is interactive but does
+ not normally print such an announcement, your work based on the Program is
+ not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works. But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the entire whole,
+and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on the
+Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+**3.** You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and 2
+above provided that you also do one of the following:
+
+* **a)** Accompany it with the complete corresponding machine-readable source
+ code, which must be distributed under the terms of Sections 1 and 2 above on
+ a medium customarily used for software interchange; or,
+
+* **b)** Accompany it with a written offer, valid for at least three years, to
+ give any third party, for a charge no more than your cost of physically
+ performing source distribution, a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of Sections 1
+ and 2 above on a medium customarily used for software interchange; or,
+
+* **c)** Accompany it with the information you received as to the offer to
+ distribute corresponding source code. (This alternative is allowed only for
+ noncommercial distribution and only if you received the program in object
+ code or executable form with such an offer, in accord with Subsection b
+ above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all the
+source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable. However, as a special exception, the source code distributed
+need not include anything that is normally distributed (in either source or
+binary form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component itself
+accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source code
+from the same place counts as distribution of the source code, even though third
+parties are not compelled to copy the source along with the object code.
+
+**4.** You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+**5.** You are not required to accept this License, since you have not signed
+it. However, nothing else grants you permission to modify or distribute the
+Program or its derivative works. These actions are prohibited by law if you do
+not accept this License. Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+**6.** Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these terms and
+conditions. You may not impose any further restrictions on the recipients'
+exercise of the rights granted herein. You are not responsible for enforcing
+compliance by third parties to this License.
+
+**7.** If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License. If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution of
+the Program by all those who receive copies directly or indirectly through you,
+then the only way you could satisfy both it and this License would be to refrain
+entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and the
+section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices. Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+**8.** If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original copyright
+holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded. In such
+case, this License incorporates the limitation as if written in the body of this
+License.
+
+**9.** The Free Software Foundation may publish revised and/or new versions of
+the General Public License from time to time. Such new versions will be similar
+in spirit to the present version, but may differ in detail to address new
+problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies
+a version number of this License which applies to it and "any later version",
+you have the option of following the terms and conditions either of that version
+or of any later version published by the Free Software Foundation. If the
+Program does not specify a version number of this License, you may choose any
+version ever published by the Free Software Foundation.
+
+**10.** If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+
+No Warranty
+-----------
+
+**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
+"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \ No newline at end of file
diff --git a/macros/LICENSE.md b/macros/LICENSE.md
new file mode 120000
index 0000000..7a694c9
--- /dev/null
+++ b/macros/LICENSE.md
@@ -0,0 +1 @@
+LICENSE \ No newline at end of file
diff --git a/macros/README.md b/macros/README.md
new file mode 100644
index 0000000..608b2ec
--- /dev/null
+++ b/macros/README.md
@@ -0,0 +1,199 @@
+autoconf-macros
+===============
+
+The purpose of Nagios autoconf-macros is to have a central place for
+autoconf macros that can be maintained in one place, but be used by any
+of the Nagios software. It is intended to be used as a git subtree.
+See the [Usage](#usage) and [References](#references) sections below.
+
+Since this project will be included in several parent projects, any
+changes must be as project-neutral as possible.
+
+Make sure to check out the [CHANGELOG](CHANGELOG.md) for relevant
+information, as well.
+
+
+Contents
+--------
+
+The collection consists of the following macros:
+
+### AX_NAGIOS_GET_OS alias AC_NAGIOS_GET_OS
+
+> Output Variable : `opsys`
+
+This macro detects the operating system, and transforms it into a generic
+label. The most common OS's that use Nagios software are recognized and
+used in subsequent macros.
+
+### AX_NAGIOS_GET_DISTRIB_TYPE alias AC_NAGIOS_GET_DISTRIB_TYPE
+
+> Output Variables : `dist_type`, `dist_ver`
+
+This macro detects the distribution type. For Linux, this would be rh
+(for Red Hat and derivitives), suse (OpenSUSE, SLES, derivitives), gentoo
+(Gentoo and derivitives), debian (Debian and derivitives), and so on.
+For BSD, this would be openbsd, netbsd, freebsd, dragonfly, etc. It can
+also be aix, solaris, osx, and so on for Unix operating systems.
+
+### AX_NAGIOS_GET_INIT alias AC_NAGIOS_GET_INIT
+
+> Output Variable : `init_type`
+
+This macro detects what software is used to start daemons on bootup
+or on request, generally knows as the "init system". The init_type
+will generally be one of sysv (many), bsd (Slackware), newbsd (*BSD),
+launchd (OS X), smf10 or smf11 (Solaris), systemd (newer Linux),
+gentoo (older Gentoo), upstart (several), or unknown.
+
+### AX_NAGIOS_GET_INETD alias AC_NAGIOS_GET_INETD
+
+> Output Variable : `inetd_type`
+
+This macro detects what software is used to start daemons or services
+on demand, which historically has been "inetd". The inetd_type
+will generally be one of inetd, xinetd, launchd (OS X), smf10 or smf11
+(Solaris), systemd (newer Linux), upstart (several), or unknown.
+
+### AX_NAGIOS_GET_PATHS alias AC_NAGIOS_GET_PATHS
+
+> Output Variables : **many!**
+
+This macro determines the installation paths for binaries, config files,
+PID files, and so on. For a "standard" install of Nagios, NRPE, NDO Utils,
+etc., most will be in the /usr/local/nagios hierarchy with startup files
+located in /etc. For distributions or software repositories, the
+"--enable-install-method=os" option can be used. This will determine the
+O/S dependant directories, such as /usr/bin, /usr/sbin, /var/lib/nagios,
+/usr/lib/nagios, etc. or for OS X, /Library/LaunchDaemons.
+
+### AX_NAGIOS_GET_FILES alias AC_NAGIOS_GET_FILES
+
+> Output Variables : `src_init`, `src_inetd`, `src_tmpfile`
+
+Each Nagios project will have a top-level directory named "/startup/".
+In that directory will be "*.in" files for the various "init_type" and
+"inetd_type" systems. This macro will determine which file(s) from
+that directory will be needed.
+
+### AX_NAGIOS_GET_SSL alias AC_NAGIOS_GET_SSL
+
+> Output Variables : `HAVE_KRB5_H`, `HAVE_SSL`, `SSL_INC_DIR`, `SSL_LIB_DIR`, `CFLAGS`, `LDFLAGS`, `LIBS`
+
+This macro checks various directories for SSL libraries and header files.
+The searches are based on known install locations on various operating
+systems and distributions, for openssl, gnutls-openssl, and nss_compat_ossl.
+If it finds the headers and libraries, it will then do an `AC_LINK_IFELSE`
+on a simple program to make sure a compile and link will work correctly.
+
+
+Usage
+-----
+
+This repo is intended to be used as a git subtree, so changes will
+automatically propogate, and still be reasonably easy to use.
+
+* First, Create, checkout, clone, or branch your project. If you do an
+`ls -AF` it might look something like this:
+
+ .git/ .gitignore ChangeLog LICENSE Makefile.in
+ README configure.ac include/ src/
+
+* Then make a reference to _this_ project inside your project.
+
+ git remote add autoconf-macros git@github.com:NagiosEnterprises/autoconf-macros
+ git subtree add --prefix=macros/ autoconf-macros master
+
+* After executing the above two commands, if you do an `ls -AF` now,
+it should look like this:
+
+ .git/ .gitignore ChangeLog LICENSE Makefile.in
+ README configure.ac include/ macros/ src/
+
+* The `macros/` directory has been added.
+
+* Now do a `git push` to save everything.
+
+* If you make any changes to autoconf-macros, commit them separately
+from any parent-project changes to keep from polluting the commit
+history with unrelated comments.
+
+* To submit your changes to autoconf-macros:
+
+ git subtree push --prefix=macros autoconf-macros peters-updates
+This will create a new branch called `peters-updates`. You then need to
+create a _pull request_ to get your changes merged into autoconf-macros
+master.
+
+* To get the latest version of `autoconf-macros` into your parent project:
+
+ git subtgree pull --squash --prefix=macros autoconf-macros master
+
+
+References
+----------
+
+Now that autoconf-macros is available to your project, you will need to
+reference it.
+
+* Create (or add these lines to) file `YourProject/aclocal.m4`
+
+ m4_include([macros/ax_nagios_get_os])
+ m4_include([macros/ax_nagios_get_distrib])
+ m4_include([macros/ax_nagios_get_init])
+ m4_include([macros/ax_nagios_get_inetd])
+ m4_include([macros/ax_nagios_get_paths])
+ m4_include([macros/ax_nagios_get_files])
+ m4_include([macros/ax_nagios_get_ssl])
+
+* In your `YourProject/configure.ac` add the following lines. A good place
+to put them would be right after any `AC_PROG_*` entries:
+
+ AC_NAGIOS_GET_OS
+ AC_NAGIOS_GET_DISTRIB_TYPE
+ AC_NAGIOS_GET_INIT
+ AC_NAGIOS_GET_INETD
+ AC_NAGIOS_GET_PATHS
+ AC_NAGIOS_GET_FILES
+
+* If you need SSL functionality, add the following to `YourProject/configure.ac`
+where you want to check for SSL:
+
+ AC_NAGIOS_GET_SSL
+
+* You will now be able to reference any of the variables in `config.h.in`
+and any files listed in the `AC_CONFIG_FILES` macro in `configure.ac`.
+
+
+License Notice
+--------------
+
+Copyright (c) 2016-2017 Nagios Enterprises, LLC
+
+This work is made available to you under the terms of Version 2 of
+the GNU General Public License. A copy of that license should have
+been provided with this software, but in any event can be obtained
+from http://www.fsf.org.
+
+This work is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 or visit their web page on the internet at
+http://www.fsf.org.
+
+
+Questions?
+----------
+
+If you have questions about this addon, or problems getting things
+working, first try searching the nagios-users mailing list archives.
+Details on searching the list archives can be found at
+http://www.nagios.org
+
+If you don't find an answer there, post a message in the Nagios
+Plugin Development forum at https://support.nagios.com/forum/viewforum.php?f=35
diff --git a/macros/add_group_user b/macros/add_group_user
new file mode 100755
index 0000000..5d1c212
--- /dev/null
+++ b/macros/add_group_user
@@ -0,0 +1,140 @@
+#!/bin/sh
+
+#----------------------
+# Initialize variables
+#----------------------
+dist="$1"
+uid="$2"
+gid="$3"
+rc=0
+
+#-------------------------------------
+# Check if the specified group exists
+#-------------------------------------
+group_exists(){
+ case $dist in
+ osx) rc=`dscl . -read /Groups/$gid >/dev/null 2>&1; echo $?` ;;
+ hpux) rc=`grget -n $gid >/dev/null 2>&1; echo $?` ;;
+ aix) rc=`lsgroup -a $gid >/dev/null 2>&1; echo $?` ;;
+ *) rc=`getent group $gid > /dev/null 2>&1; echo $?` ;;
+ esac
+
+ echo $rc
+}
+
+#------------------------
+# Add the specified user
+#------------------------
+add_user(){
+ rc=`id "$uid" > /dev/null 2>&1; echo $?`
+ if test $rc -eq 0; then
+ echo "User $uid already exists" > /dev/stderr
+ echo 0
+ return
+ fi
+
+ case $dist in
+ aix)
+ echo useradd -g $gid $uid > /dev/stderr
+ rc=`useradd -g $gid $uid; echo $?`
+ ;;
+
+ hpux)
+ echo useradd -m -g $gid $uid > /dev/stderr
+ rc=`useradd -m -g $gid $uid; echo $?`
+ ;;
+
+ solaris)
+ echo useradd -m -d /export/home/$uid -g $gid $uid > /dev/stderr
+ rc=`useradd -m -d /export/home/$uid -g $gid $uid; echo $?`
+ ;;
+
+ osx)
+ newid=`dscl . -list /Users UniqueID | tr -s ' ' | cut -d' ' -f2 | sort -n | tail -1`
+ newid=`expr 1 + $newid`
+ echo dscl . -create /Users/$uid > /dev/stderr
+ dscl . -create /Users/$uid
+ echo dscl . -create /Users/$uid UniqueID $newid > /dev/stderr
+ dscl . -create /Users/$uid UniqueID $newid
+ echo dscl . -create /Users/$uid UserShell /usr/bin/false > /dev/stderr
+ dscl . -create /Users/$uid UserShell /usr/bin/false
+ echo dscl . -create /Users/$uid PrimaryGroupID 20 > /dev/stderr
+ dscl . -create /Users/$uid PrimaryGroupID 20
+ echo dscl . -append /Groups/$gid GroupMembership $uid > /dev/stderr
+ rc=`dscl . -append /Groups/$gid GroupMembership $uid; echo $?`
+ ;;
+
+ freebsd)
+ echo pw add user $uid -g $gid -s /usr/bin/false > /dev/stderr
+ rc=`pw add user $uid -g $gid -s /usr/bin/false; echo $?`
+ ;;
+
+ netbsd|openbsd)
+ echo useradd -g $gid $uid > /dev/stderr
+ rc=`useradd -g $gid $uid; echo $?`
+ ;;
+
+ *)
+ echo useradd -r -g $gid $uid > /dev/stderr
+ rc=`useradd -r -g $gid $uid; echo $?`
+ ;;
+ esac
+
+ echo $rc
+}
+
+#-------------------------
+# Add the specified group
+#-------------------------
+add_group(){
+ rc=`group_exists`
+ if test $rc -eq 0; then
+ echo "Group $gid already exists" > /dev/stderr
+ echo 0
+ return
+ fi
+
+ case $dist in
+ aix)
+ echo mkgroup $gid > /dev/stderr
+ rc=`mkgroup "$gid"; echo $?`
+ ;;
+
+ hpux|solaris)
+ echo groupadd $gid > /dev/stderr
+ rc=`groupadd "$gid"; echo $?`
+ ;;
+
+ osx)
+ newid=`dscl . -list /Groups gid | tr -s ' ' | cut -d' ' -f2 | sort -n | tail -1`
+ newid=`expr 1 + $newid`
+ echo dscl . -create /Groups/$gid gid $newid > /dev/stderr
+ rc=`dscl . -create /Groups/$gid gid $newid; echo $?`
+ ;;
+
+ freebsd)
+ echo pw add group $gid > /dev/stderr
+ rc=`pw add group $gid; echo $?`
+ ;;
+
+ netbsd|openbsd)
+ echo groupadd $gid > /dev/stderr
+ rc=`groupadd $gid; echo $?`
+ ;;
+
+ *)
+ echo groupadd -r $gid > /dev/stderr
+ rc=`groupadd -r $gid; echo $?`
+ ;;
+ esac
+
+ echo $rc
+}
+
+
+rc=`add_group`
+if test $rc -ne 0; then
+ exit 1;
+fi
+rc=`add_user`
+exit $rc
diff --git a/macros/ax_nagios_get_distrib b/macros/ax_nagios_get_distrib
new file mode 100644
index 0000000..3bb26b0
--- /dev/null
+++ b/macros/ax_nagios_get_distrib
@@ -0,0 +1,160 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_DISTRIB_TYPE
+#
+# DESCRIPTION
+#
+# This macro determines the O/S distribution of the computer it is run on.
+# $dist_type will be set and will be one of:
+# unknown (could not be determined)
+# freebsd, netbsd, openbsd, dragonfly, etc (The BSDs)
+# suse, rh, debian, gentoo (and possibly their descendants)
+# Other major Linux distributions (and possibly their descendants)
+# The O/S name for the rest
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_DISTRIB_TYPE], [AX_NAGIOS_GET_DISTRIB_TYPE])
+AC_DEFUN([AX_NAGIOS_GET_DISTRIB_TYPE],
+[
+
+AC_SUBST(dist_type)
+AC_SUBST(dist_ver)
+
+#
+# Get user hints for possible cross-compile
+#
+ AC_MSG_CHECKING(what the distribution type is )
+ AC_ARG_WITH(dist-type, AC_HELP_STRING([--with-dist-type=type],
+ [specify distribution type (suse, rh, debian, etc.)]),
+ [
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ dist_type_wanted=yes
+ else
+ dist_type_wanted=no
+ dist_type="$withval"
+ dist_ver="unknown"
+ AC_MSG_RESULT($dist_type)
+ fi
+ ], [
+ #
+ # Run this if --with was not specified
+ #
+ dist_type_wanted=yes
+ ])
+
+ if test x$dist_type = xno; then
+ dist_type_wanted=yes
+ elif test x$dist_type = xyes; then
+ AC_MSG_ERROR([you must enter a distribution type if '--with-dist-type' is specified])
+ fi
+
+ #
+ # Determine distribution type if it wasn't supplied
+ #
+ dist_ver="unknown"
+
+ if test $dist_type_wanted=yes; then
+ dist_type="unknown"
+
+ if test "$opsys" != "linux"; then
+ dist_type="$opsys"
+ AS_CASE([$opsys],
+ [bsd],
+ dist_type=`uname -s | tr ["[A-Z]" "[a-z]"]`
+ dist_ver=`uname -r`,
+ [aix],
+ dist_ver="`uname -v`.`uname -r`",
+ [hp-ux],
+ dist_ver=`uname -r | cut -d'.' -f1-3`,
+ [solaris],
+ dist_ver=`uname -r | cut -d'.' -f2`,
+ [*],
+ dist_ver=$OSTYPE
+ )
+
+ else
+
+ if test -r "/etc/gentoo-release"; then
+ dist_type="gentoo"
+ dist_ver=`cat /etc/gentoo-release`
+
+ elif test -r "/etc/os-release"; then
+ . /etc/os-release
+ if test x"$ID_LIKE" != x; then
+ dist_type=`echo $ID_LIKE | cut -d' ' -f1 | tr ["[A-Z]" "[a-z]"]`
+ elif test x"$ID" = xol; then
+ dist_type=rh
+ else
+ dist_type=`echo $ID | tr ["[A-Z]" "[a-z]"]`
+ fi
+ if test x"$dist_type" = sles; then
+ dist_type=suse
+ fi
+ if test x"$VERSION_ID" != x; then
+ dist_ver=$VERSION_ID
+ elif test x"$VERSION" != x; then
+ dist_ver=`echo $VERSION | cut -d'.' -f1 | tr -d [:alpha:][:blank:][:punct:]`
+ fi
+
+ elif test -r "/etc/redhat-release"; then
+ dist_type=rh
+ dist_ver=`cat /etc/redhat-release`
+
+ elif test -r "/etc/debian_version"; then
+ dist_type="debian"
+ if test -r "/etc/lsb-release"; then
+ . /etc/lsb-release
+ dist_ver=`echo "$DISTRIB_RELEASE"`
+ else
+ dist_ver=`cat /etc/debian_version`
+ fi
+
+ elif test -r "/etc/SuSE-release"; then
+ dist_type=suse
+ dist_ver=`grep VERSION /etc/SuSE-release`
+
+ fi
+
+ fi
+
+ if test "$dist_ver" != "unknown"; then
+ dist_ver=`echo "$dist_ver" | cut -d'.' -f1 | tr -d [:alpha:][:blank:][:punct:]`
+ fi
+ fi
+
+ AC_MSG_RESULT($dist_type)
+])
diff --git a/macros/ax_nagios_get_files b/macros/ax_nagios_get_files
new file mode 100644
index 0000000..f8c5a9b
--- /dev/null
+++ b/macros/ax_nagios_get_files
@@ -0,0 +1,131 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_FILES
+#
+# DESCRIPTION
+#
+# This macro figures out which init and/or inetd files to use based
+# on the results of the AX_NAGIOS_GET_OS, AX_NAGIOS_GET_DISTRIB_TYPE,
+# AX_NAGIOS_GET_INIT and AX_NAGIOS_GET_INETD macros. It will select
+# the appropriate files(s) from the 'startup' directory and copy it.
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_FILES], [AX_NAGIOS_GET_FILES])
+AC_DEFUN([AX_NAGIOS_GET_FILES],
+[
+
+AC_SUBST(src_init)
+AC_SUBST(src_inetd)
+AC_SUBST(src_tmpfile)
+AC_SUBST(bsd_enable)
+
+src_inetd=""
+src_init=""
+bsd_enable=""
+
+AC_MSG_CHECKING(for which init file to use )
+
+AS_CASE([$init_type],
+
+ [sysv],
+ src_init=default-init,
+
+ [systemd],
+ src_tmpfile=tmpfile.conf
+ src_init=default-service,
+
+ [bsd],
+ src_init=bsd-init,
+
+ [newbsd],
+ if test $dist_type = freebsd ; then
+ bsd_enable="_enable"
+ src_init=newbsd-init
+ elif test $dist_type = openbsd ; then
+ bsd_enable="_flags"
+ src_init=openbsd-init
+ elif test $dist_type = netbsd ; then
+ bsd_enable=""
+ src_init=newbsd-init
+ fi,
+
+# [gentoo],
+
+ [openrc],
+ src_init=openrc-init,
+
+ [smf*],
+ src_init="solaris-init.xml"
+ src_inetd="solaris-inetd.xml",
+
+ [upstart],
+ if test $dist_type = rh ; then
+ src_init=rh-upstart-init
+ else
+ src_init=upstart-init
+ fi,
+
+ [launchd],
+ src_init="mac-init.plist",
+
+ [*],
+ src_init="unknown"
+)
+AC_MSG_RESULT($src_init)
+
+AC_MSG_CHECKING(for which inetd files to use )
+
+if test x$src_inetd = x; then
+
+ AS_CASE([$inetd_type],
+ [inetd*],
+ src_inetd=default-inetd,
+
+ [xinetd],
+ src_inetd=default-xinetd,
+
+ [systemd],
+ src_inetd=default-socket,
+
+ [launchd],
+ src_inetd="mac-inetd.plist",
+
+ [*],
+ src_inetd="unknown"
+ )
+
+fi
+AC_MSG_RESULT($src_inetd)
+
+])
diff --git a/macros/ax_nagios_get_inetd b/macros/ax_nagios_get_inetd
new file mode 100644
index 0000000..7c75372
--- /dev/null
+++ b/macros/ax_nagios_get_inetd
@@ -0,0 +1,146 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_INETD
+#
+# DESCRIPTION
+#
+# This macro determines whether inetd or xinetd is being used
+# The argument are:
+# the init type as determined by AX_NAGIOS_GET_INIT
+# $inetd_type will be set and will be one of:
+# unknown (could not be determined)
+# launchd (Mac OS X)
+# smf10 (Solaris)
+# smf11 (Solaris)
+# upstart (Older Debian)
+# xinetd (Most Linux, BSD)
+# inetd (The rest)
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_INETD], [AX_NAGIOS_GET_INETD])
+AC_DEFUN([AX_NAGIOS_GET_INETD],
+[
+
+AC_SUBST(inetd_type)
+
+#
+# Get user hints for possible cross-compile
+#
+ AC_MSG_CHECKING(what inetd is being used )
+ AC_ARG_WITH(inetd_type, AC_HELP_STRING([--with-inetd-type=type],
+ [which super-server the system runs (inetd, xinetd, systemd, launchd,
+ smf10, smf11, etc.)]),
+ [
+ inetd_type_wanted=yes
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ inetd_type_wanted=yes
+ else
+ inetd_type_wanted=no
+ inetd_type="$withval"
+ AC_MSG_RESULT($inetd_type)
+ fi
+ ], [
+ #
+ # Run this if --with was not specified
+ #
+ inetd_type_wanted=yes
+ ])
+
+ if test x$inetd_type = xno; then
+ inetd_type_wanted=yes
+ elif test x$inetd_type = xyes; then
+ AC_MSG_ERROR([you must enter an inetd type if '--with-inetd-type' is specified])
+ fi
+
+ #
+ # Determine inetd type if it wasn't supplied
+ #
+ if test $inetd_type_wanted = yes; then
+
+ inetd_disabled=""
+
+ AS_CASE([$dist_type],
+ [solaris],
+ if test x"$init_type" = "xsmf10" -o x"$init_type" = "xsmf11"; then
+ inetd_type="$init_type"
+ else
+ inetd_type="inetd"
+ fi,
+
+ [*bsd*],
+ inetd_type=`ps -A -o comm -c | grep inetd`,
+
+ [osx],
+ inetd_type=`launchd`,
+
+ [aix|hp-ux],
+ inetd_type=`UNIX95= ps -A -o comm | grep inetd | head -1`,
+
+ [*],
+ inetd_type=[`ps -C "inetd,xinetd" -o fname | grep -vi COMMAND | head -1`])
+
+ if test x"$inetd_type" = x; then
+ if test -f /etc/xinetd.conf -a -d /etc/xinetd.d; then
+ inetd_disabled="(Not running)"
+ inetd_type=xinetd
+ elif test -f /etc/inetd.conf -o -f /usr/sbin/inetd; then
+ inetd_type=inetd
+ inetd_disabled="(Not running)"
+ fi
+ fi
+
+ if test x"$inetd_type" = x; then
+ if test x"$init_type" = "xupstart"; then
+ inetd_type="upstart"
+ fi
+ fi
+
+ if test x"$inetd_type" = x; then
+ if test x"$init_type" = "xsystemd"; then
+ inetd_type="systemd"
+ else
+ inetd_type="unknown"
+ fi
+ fi
+
+ if test -n "$inetd_disabled"; then
+ AC_MSG_RESULT($inetd_type $inetd_disabled)
+ else
+ AC_MSG_RESULT($inetd_type)
+ fi
+ fi
+])
diff --git a/macros/ax_nagios_get_init b/macros/ax_nagios_get_init
new file mode 100644
index 0000000..5ef27f4
--- /dev/null
+++ b/macros/ax_nagios_get_init
@@ -0,0 +1,200 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_INIT
+#
+# DESCRIPTION
+#
+# This macro determines the O/S distribution of the computer it is run on.
+# $init_type will be set and will be one of:
+# unknown (could not be determined)
+# launchd (Mac OS X)
+# bsd (Slackware Linux)
+# newbsd (FreeBSD, OpenBSD, NetBSD, Dragonfly, etc)
+# smf10 (Solaris)
+# smf11 (Solaris)
+# systemd (Linux SystemD)
+# gentoo (Older Gentoo)
+# openrc (Recent Gentoo and some others)
+# upstart (Older Debian)
+# sysv (The rest)
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_INIT], [AX_NAGIOS_GET_INIT])
+AC_DEFUN([AX_NAGIOS_GET_INIT],
+[
+
+AC_SUBST(init_type)
+
+#
+# Get user hints for possible cross-compile
+#
+ AC_MSG_CHECKING(what init system is being used )
+ AC_ARG_WITH(init_type,AC_HELP_STRING([--with-init-type=type],
+ [specify init type (bsd, sysv, systemd, launchd, smf10, smf11, upstart,
+ openrc, etc.)]),
+ [
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ init_type_wanted=yes
+ else
+ init_type_wanted=no
+ init_type="$withval"
+ AC_MSG_RESULT($init_type)
+ fi
+ ], [
+ #
+ # Run this if --with was not specified
+ #
+ init_type_wanted=yes
+ ])
+
+ if test x$init_type = xno; then
+ init_type_wanted=yes
+ elif test x$init_type = xyes; then
+ AC_MSG_ERROR([you must enter an init type if '--with-init-type' is specified])
+ fi
+
+ #
+ # Determine init type if it wasn't supplied
+ #
+ if test $init_type_wanted = yes; then
+ init_type=""
+
+ if test x"$opsys" = x; then
+ init_type="unknown"
+ init_type_wanted=no
+ elif test x"$dist_type" = x; then
+ init_type="unknown"
+ init_type_wanted=no
+ elif test "$opsys" = "osx"; then
+ init_type="launchd"
+ init_type_wanted=no
+ elif test "$opsys" = "bsd"; then
+ init_type="newbsd"
+ init_type_wanted=no
+ elif test "$dist_type" = "solaris"; then
+ if test -d "/lib/svc/manifest"; then
+ init_type="smf11"
+ init_type_wanted=no
+ elif test -d "/lib/svc/monitor"; then
+ init_type="smf10"
+ init_type_wanted=no
+ else
+ init_type="sysv"
+ init_type_wanted=no
+ fi
+ elif test "$dist_type" = "slackware"; then
+ init_type="bsd"
+ init_type_wanted=no
+ elif test "$dist_type" = "aix"; then
+ init_type="bsd"
+ init_type_wanted=no
+ elif test "$dist_type" = "hp-ux"; then
+ init_type="unknown"
+ init_type_wanted=no
+ fi
+ fi
+
+ PSCMD="ps -p1 -o args"
+ if test $dist_type = solaris; then
+ PSCMD="env UNIX95=1; ps -p1 -o args"
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ pid1=`$PSCMD | grep -vi COMMAND | cut -d' ' -f1`
+ if test x"$pid1" = "x"; then
+ init_type="unknown"
+ init_type_wanted=no
+ fi
+ if `echo $pid1 | grep "systemd" > /dev/null`; then
+ init_type="systemd"
+ init_type_wanted=no
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ if test "$pid1" = "init"; then
+ if test -e "/sbin/init"; then
+ pid1="/sbin/init";
+ elif test -e "/usr/sbin/init"; then
+ pid1="/usr/sbin/init"
+ else
+ init_type="unknown"
+ init_type_wanted=no
+ fi
+ fi
+ if test -L "$pid1"; then
+ pid1=`readlink "$pid1"`
+ fi
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ if `echo $pid1 | grep "systemd" > /dev/null`; then
+ init_type="systemd"
+ init_type_wanted=no
+ elif test -f "/sbin/rc"; then
+ if test -f /sbin/runscript; then
+ init_type_wanted=no
+ if `/sbin/start-stop-daemon -V | grep "OpenRC" > /dev/null`; then
+ init_type="openrc"
+ else
+ init_type="gentoo"
+ fi
+ fi
+ fi
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ if test "$pid1" = "/sbin/init" -o "$pid1" = "/usr/sbin/init"; then
+ if `$pid1 --version 2>/dev/null | grep "upstart" >/dev/null`; then
+ init_type="upstart"
+ init_type_wanted=no
+ elif test -f "/etc/rc" -a ! -L "/etc/rc"; then
+ init_type="newbsd"
+ init_type_wanted=no
+ else
+ init_type="sysv"
+ init_type_wanted=no
+ fi
+ fi
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ init_type="unknown"
+ fi
+ fi
+
+ AC_MSG_RESULT($init_type)
+])
diff --git a/macros/ax_nagios_get_os b/macros/ax_nagios_get_os
new file mode 100644
index 0000000..5683158
--- /dev/null
+++ b/macros/ax_nagios_get_os
@@ -0,0 +1,101 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_OS
+#
+# DESCRIPTION
+#
+# This macro determines the operating system of the computer it is run on.
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_OS], [AX_NAGIOS_GET_OS])
+AC_DEFUN([AX_NAGIOS_GET_OS],
+[
+
+AC_SUBST(opsys)
+AC_SUBST(arch)
+
+#
+# Get user hints
+#
+ AC_MSG_CHECKING(what the operating system is )
+ AC_ARG_WITH(opsys, AC_HELP_STRING([--with-opsys=OS],
+ [specify operating system (linux, osx, bsd, solaris, irix, cygwin,
+ aix, hp-ux, etc.)]),
+ [
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ opsys_wanted=yes
+ else
+ opsys_wanted=no
+ opsys="$withval"
+ AC_MSG_RESULT($opsys)
+ fi
+ ], [
+ #
+ # Run this if --with was not specified
+ #
+ opsys_wanted=yes
+ ])
+
+ if test x$opsys = xno; then
+ opsys=""
+ opsys_wanted=yes
+ elif test x$opsys = xyes; then
+ AC_MSG_ERROR([you must enter an O/S type if '--with-opsys' is specified])
+ fi
+
+ #
+ # Determine operating system if it wasn't supplied
+ #
+ if test $opsys_wanted=yes; then
+ opsys=`uname -s | tr ["[A-Z]" "[a-z]"]`
+ if test x"$opsys" = "x"; then opsys="unknown"; fi
+ AS_CASE([$opsys],
+ [darwin*], opsys="osx",
+ [*bsd*], opsys="bsd",
+ [dragonfly], opsys="bsd",
+ [sunos], opsys="solaris",
+ [gnu/hurd], opsys="linux",
+ [irix*], opsys="irix",
+ [cygwin*], opsys="cygwin",
+ [mingw*], opsys="mingw",
+ [msys*], opsys="msys")
+ fi
+
+ arch=`uname -m | tr ["[A-Z]" "[a-z]"]`
+
+ AC_MSG_RESULT($opsys)
+])
diff --git a/macros/ax_nagios_get_paths b/macros/ax_nagios_get_paths
new file mode 100644
index 0000000..4fde1cb
--- /dev/null
+++ b/macros/ax_nagios_get_paths
@@ -0,0 +1,738 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_PATHS
+#
+# DESCRIPTION
+#
+# This macro figures out the installation & run paths for various systems
+# The argument are:
+# the O/S determined by the AX_NAGIOS_GET_OS macro.
+# the distribution type as determined by AX_NAGIOS_GET_DISTRIB_TYPE
+# the init type as determined by AX_NAGIOS_GET_INIT
+# the inetd type as determined by AX_NAGIOS_GET_INETD
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_PATHS], [AX_NAGIOS_GET_PATHS])
+AC_DEFUN([AX_NAGIOS_GET_PATHS],
+[
+
+AC_SUBST(pkgsysconfdir)
+AC_SUBST(objsysconfdir)
+AC_SUBST(sbindir)
+AC_SUBST(initname)
+AC_SUBST(inetdname)
+AC_SUBST(pluginsdir)
+AC_SUBST(brokersdir)
+AC_SUBST(cgibindir)
+AC_SUBST(webdir)
+AC_SUBST(privatesysconfdir)
+AC_SUBST(pkglocalstatedir)
+AC_SUBST(logdir)
+AC_SUBST(piddir)
+AC_SUBST(pipedir)
+AC_SUBST(spooldir)
+AC_SUBST(initdir)
+AC_SUBST(inetddir)
+AC_SUBST(tmpfilesd)
+AC_SUBST(subsyslockdir)
+AC_SUBST(subsyslockfile)
+
+if test x$DBG_PATHS != x; then
+ echo
+ echo Incoming paths:
+ echo " prefix $prefix"
+ echo " exec_prefix $exec_prefix"
+ echo " bindir $bindir"
+ echo " sbindir $sbindir"
+ echo " libexecdir $libexecdir"
+ echo " sysconfdir $sysconfdir"
+ echo " localstatedir $localstatedir"
+ echo " datarootdir $datarootdir"
+ echo " datadir $datadir"
+ echo " localedir $localedir"
+ echo
+fi
+
+AC_MSG_CHECKING(for which paths to use )
+
+AC_ARG_ENABLE(install_method,
+ AC_HELP_STRING([--enable-install-method=<method>],
+ [sets the install method to use: 'default' (the default) will install to
+ /usr/local/nagios, 'os' will try to determine which method to use based
+ on OS type and distribution. Fine tuning using the '--bindir', etc.
+ overrides above will still work]),
+ install_method=$enableval,
+ install_method=default
+)
+
+AC_ARG_ENABLE(showdirs_only,
+ AC_HELP_STRING([--enable-showdirs-only=yes],
+ [This option will cause 'configure' to stop after determining the install
+ locations based on '--enable-install-method', so you can see the
+ destinations before a full './configure', 'make', 'make install'
+ process.]),
+ showdirs_only=$enableval,
+ showdirs_only=no
+)
+
+AS_CASE([$install_method],
+ [yes], install_method="os",
+ [no], install_method="default",
+ [default|os], :,
+ [*], echo >&6; AC_MSG_ERROR(['--enable-install-method=$install_method' is invalid])
+)
+
+if test $showdirs_only != "no"; then showdirs_only="yes"; fi
+
+AS_CASE([$dist_type],
+ [*solaris*|*hp-ux*|*aix*|*osx*], opsys=unix)
+
+
+ # Does this package need to know:
+need_cgi=no # where the cgi-bin directory is
+need_web=no # where the website directory is
+need_brk=no # where the event broker modules directory is
+need_plg=no # where the plugins directory is
+need_pipe=no # where the pipe directory is
+need_spl=no # where the spool directory is
+need_loc=no # where the locale directory is
+need_log_subdir=no # where the loc sub-directory is
+need_etc_subdir=no # where the etc sub-directory is
+need_pls_dir=no # where the package locate state directory is
+
+if test x"$INIT_PROG" = x; then
+ INIT_PROG="$PKG_NAME"
+fi
+
+AS_CASE([$PKG_NAME],
+ [nagios],
+ need_log_subdir=yes
+ need_etc_subdir=yes
+ need_pls_dir=yes
+ need_brk=yes
+ need_pipe=yes
+ need_spl=yes
+ need_loc=yes
+ need_cgi=yes
+ need_web=yes,
+
+ [ndoutils],
+ need_brk=yes
+ need_spl=yes,
+
+ [nrpe],
+ need_plg=yes,
+
+ [nsca],
+ need_cgi=no,
+
+ [plugins],
+ need_loc=yes
+ need_plg=yes
+)
+
+AC_ARG_WITH(pkgsysconfdir, AC_HELP_STRING([--with-pkgsysconfdir=DIR],
+ [where configuration files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ pkgsysconfdir="$withval"
+ fi)
+AC_ARG_WITH(objsysconfdir, AC_HELP_STRING([--with-objsysconfdir=DIR],
+ [where object configuration files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ objsysconfdir="$withval"
+ fi)
+AC_ARG_WITH(privatesysconfdir, AC_HELP_STRING([--with-privatesysconfdir=DIR],
+ [where private configuration files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ privatesysconfdir="$withval"
+ fi)
+AC_ARG_WITH(webdir, AC_HELP_STRING([--with-webdir=DIR],
+ [where the website files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ webdir="$withval"
+ fi)
+AC_ARG_WITH(pluginsdir, AC_HELP_STRING([--with-pluginsdir=DIR],
+ [where the plugins should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ pluginsdir="$withval"
+ fi)
+AC_ARG_WITH(brokersdir, AC_HELP_STRING([--with-brokersdir=DIR],
+ [where the broker modules should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ brokersdir="$withval"
+ fi)
+AC_ARG_WITH(cgibindir, AC_HELP_STRING([--with-cgibindir=DIR],
+ [where the CGI programs should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ cgibindir="$withval"
+ fi)
+AC_ARG_WITH(logdir, AC_HELP_STRING([--with-logdir=DIR],
+ [where log files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ logdir="$withval"
+ fi)
+AC_ARG_WITH(piddir, AC_HELP_STRING([--with-piddir=DIR],
+ [where the PID file should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ piddir="$withval"
+ fi)
+AC_ARG_WITH(pipedir, AC_HELP_STRING([--with-pipedir=DIR],
+ [where socket and pipe files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ pipedir="$withval"
+ fi)
+
+
+#
+# Setup the base directory
+#
+
+if test $install_method = "default"; then
+ if test $opsys = "unix"; then
+ if test x"$prefix" = "xNONE"; then prefix="/usr/local/nagios"; fi
+ else
+ if test x"$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi
+ fi
+ datarootdir=${datarootdir="$prefix"}
+
+else
+ if test x"$datadir" = x'${datarootdir}'; then AS_UNSET(datadir); fi
+ if test x"$sysconfdir" = x'${prefix}/etc'; then AS_UNSET(sysconfdir); fi
+
+ if test x"$prefix" = "xNONE"; then
+ if test $dist_type = freebsd -o $dist_type = openbsd -o $dist_type = osx; then
+ prefix="/usr/local"
+ elif test $dist_type = netbsd; then
+ prefix="/usr/pkg"
+ else
+ prefix="/usr"
+ fi
+ fi
+ if test x"$exec_prefix" = "xNONE"; then exec_prefix=$prefix; fi
+ if test x"$localstatedir" = x'${prefix}/var'; then
+ if test $dist_type = "osx"; then
+ localstatedir="/private/var"
+ else
+ localstatedir="/var"
+ fi
+ fi
+
+ if test $opsys = "unix"; then
+ if test x"$datarootdir" = x'${prefix}/share'; then
+ if test $dist_type = "hp-ux"; then
+ datarootdir="/usr/local/share"
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/nagios"
+ fi
+ elif test $dist_type = "osx"; then
+ datarootdir="/usr/local/share"
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/local/nagios"
+ fi
+ elif test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/lib/nagios"
+ fi
+ fi
+ if test $dist_type = "osx"; then
+ if test x"$sbindir" = x'${exec_prefix}/sbin'; then
+ sbindir="$libexecdir"
+ fi
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/local/libexec/nagios"
+ fi
+ fi
+ elif test $opsys = "bsd"; then
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir=${exec_prefix}/libexec/nagios;
+ fi
+ elif test x"$libexecdir" = x'${exec_prefix}/lib'; then
+ libexecdir=${libexecdir}/nagios;
+ elif test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir=${exec_prefix}/lib/nagios;
+ fi
+
+fi
+
+if test x"$exec_prefix" = "xNONE"; then exec_prefix=${prefix}; fi
+
+tmpfilesd=${tmpfilesd="/usr/lib/tmpfiles.d"}
+if test ! -d "$tmpfilesd"; then
+ tmpfilesd="N/A"
+else
+ tmpfilesd="$tmpfilesd/$INIT_PROG.conf"
+fi
+subsyslockdir=${subsyslockdir="/var/lock/subsys"}
+if test ! -d "$subsyslockdir"; then
+ subsyslockdir="N/A"
+ subsyslockfile="N/A"
+else
+ subsyslockfile="$subsyslockdir/$INIT_PROG"
+fi
+if test "$need_loc" = no; then
+ localedir="N/A"
+fi
+
+if test $install_method = "default" ; then
+ #
+ # Do the default setup
+ #
+ sbindir=${bindir}
+ datadir=${datadir="$datarootdir"}
+ if test $need_web = yes; then
+ webdir=${webdir="$datadir"}
+ else
+ webdir="N/A"
+ fi
+ if test $opsys = "unix"; then
+ sysconfdir=${sysconfdir="/etc/opt"}
+ fi
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir"}
+ logdir=${logdir="$localstatedir"}
+ piddir=${piddir="$localstatedir"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/rw"}
+ else
+ pipedir="N/A"
+ fi
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/var"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$bindir"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ cgibindir=${cgibindir="$prefix/sbin"}
+ else
+ cgibindir="N/A"
+ fi
+
+elif test $opsys = "linux"; then
+
+ #
+ # Linux "Standard" install
+ #
+ install_method="$install_method : FHS"
+ datadir=${datadir="$datarootdir/nagios"}
+ if test $need_web = yes; then
+ webdir=${webdir="$datadir/html"}
+ else
+ webdir="N/A"
+ fi
+ sysconfdir=${sysconfdir="/etc"}
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
+ if test $need_log_subdir = yes; then
+ logdir=${logdir="$localstatedir/log/$INIT_PROG"}
+ else
+ logdir=${logdir="$localstatedir/log"}
+ fi
+ piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
+ else
+ pipedir="N/A"
+ fi
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$libexecdir/brokers"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir/plugins"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ cgibindir=${cgibindir="$libexecdir/cgi-bin"}
+ else
+ cgibindir="N/A"
+ fi
+
+elif test $opsys = "unix"; then
+
+ #
+ # "Standard" Unix install
+ #
+ install_method="$install_method : Unix Standard"
+ if test $dist_type = osx; then
+ install_method="$install_method : OS X Standard"
+ sbindir=${sbindir="/usr/local/libexec"}
+ fi
+ datadir=${datadir="$datarootdir/nagios"}
+ if test $need_web = yes; then
+ webdir=${webdir="$datadir/html"}
+ else
+ webdir="N/A"
+ fi
+ if test $dist_type = osx; then
+ sysconfdir=${sysconfdir="/private/etc"}
+ else
+ sysconfdir=${sysconfdir="/etc"}
+ fi
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_loc" = yes; then
+ localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$libexecdir/brokers"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir/plugins"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ cgibindir=${cgibindir="$libexecdir/cgi-bin"}
+ else
+ cgibindir="N/A"
+ fi
+ AS_CASE([$dist_type],
+ [*hp-ux*],
+ piddir=${piddir="$pkgsysconfdir"}
+ pipedir=${pipedir="$pkglocalstatedir"}
+ logdir=${logdir="$pkglocalstatedir/log"},
+
+ [*],
+ piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
+ else
+ pipedir="N/A"
+ fi
+ if test $need_log_subdir = yes; then
+ logdir=${logdir="$localstatedir/log/$INIT_PROG"}
+ else
+ logdir=${logdir="$localstatedir/log"}
+ fi
+ )
+
+elif test $opsys = "bsd"; then
+
+ #
+ # "Standard" BSD install
+ #
+ install_method="$install_method : BSD"
+ if test $dist_type = freebsd -o $dist_type = openbsd; then
+ prefix=${prefix="/usr/local"}
+ exec_prefix=${exec_prefix="/usr/local"}
+ if test $dist_type = freebsd; then
+ install_method="$install_method : FreeBSD"
+ else
+ install_method="$install_method : OpenBSD"
+ fi
+ elif test $dist_type = netbsd; then
+ prefix=${prefix="/usr/pkg"}
+ exec_prefix=${exec_prefix="/usr/pkg"}
+ install_method="$install_method : NetBSD"
+ fi
+ datadir=${datadir="$datarootdir/nagios"}
+ if test $need_web = yes -o $need_cgi = yes; then
+ if test $dist_type = freebsd; then
+ webdir=${webdir="$prefix/www/nagios"}
+ elif test $dist_type = netbsd; then
+ webdir=${webdir="$prefix/share/nagios"}
+ elif test $dist_type = openbsd; then
+ webdir=${webdir="/var/www/nagios"}
+ fi
+ else
+ webdir="N/A"
+ fi
+ if test $dist_type = freebsd; then
+ sysconfdir=${sysconfdir="/usr/local/etc"}
+ else
+ sysconfdir=${sysconfdir="/etc"}
+ fi
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_loc" = yes; then
+ localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$libexecdir/brokers"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir/plugins"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ if test $dist_type = freebsd; then
+ cgibindir=${cgibindir="$webdir/cgi-bin"}
+ elif test $dist_type = netbsd; then
+ cgibindir=${pluginsdir="$libexecdir/cgi-bin"}
+ elif test $dist_type = openbsd; then
+ cgibindir=${pluginsdir="/var/www/cgi-bin/nagios"}
+ fi
+ else
+ cgibindir="N/A"
+ fi
+ piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
+ else
+ pipedir="N/A"
+ fi
+ if test $need_log_subdir = yes; then
+ logdir=${logdir="$localstatedir/log/$INIT_PROG"}
+ else
+ logdir=${logdir="$localstatedir/log"}
+ fi
+
+else
+
+ #
+ # Unknown install
+ #
+ install_method="unknown"
+ webdir=unknown
+ pkgsysconfdir=unknown
+ objsysconfdir=unknown
+ privatesysconfdir=unknown
+ logdir=unknown
+ piddir=unknown
+ pipedir=unknown
+ pkglocalstatedir=unknown
+ spooldir=unknown
+ brokersdir=unknown
+ pluginsdir=unknown
+ cgibindir=unknown
+
+fi
+
+eval prefix=$prefix
+eval exec_prefix=$exec_prefix
+eval bindir=$bindir
+eval sbindir=$sbindir
+eval datarootdir=$datarootdir
+eval datadir=$datadir
+eval libexecdir=$libexecdir
+eval brokersdir=$brokersdir
+eval pluginsdir=$pluginsdir
+eval cgibindir=$cgibindir
+eval localstatedir=$localstatedir
+eval pkglocalstatedir=$pkglocalstatedir
+eval webdir=$webdir
+eval localedir=$localedir
+eval sysconfdir=$sysconfdir
+eval pkgsysconfdir=$pkgsysconfdir
+eval logdir=$logdir
+eval piddir=$piddir
+
+#
+# Init scripts/files
+#
+AS_CASE([$init_type],
+
+ [sysv],
+ if test $dist_type = "hp-ux"; then
+ initdir=${initdir="/sbin/init.d"}
+ else
+ initdir=${initdir="/etc/init.d"}
+ fi
+ initname=${initname="$INIT_PROG"}
+ initconfdir=${initconfdir="/etc/conf.d"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+ [systemd],
+ if test $dist_type = "debian"; then
+ initdir=${initdir="/lib/systemd/system"}
+ else
+ initdir=${initdir="/usr/lib/systemd/system"}
+ fi
+ initname=${initname="$INIT_PROG.service"},
+
+ [bsd],
+ if test $dist_type = "aix"; then
+ initdir=${initdir="/sbin/rc.d/init.d"}
+ initname=${initname="$INIT_PROG"}
+ else
+ initdir=${initdir="/etc/rc.d"}
+ initname=${initname="rc.$INIT_PROG"}
+ fi,
+
+ [newbsd],
+ initdir=${initdir="/etc/rc.d"}
+ initname=${initname="$INIT_PROG"},
+
+ [gentoo],
+ initdir=${initdir="/etc/init.d"}
+ initname=${initname="$INIT_PROG"}
+ initconfdir=${initconfdir="/etc/init.d"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+ [openrc],
+ initdir=${initdir="/etc/init.d"}
+ initname=${initname="$INIT_PROG"}
+ initconfdir=${initconfdir="/etc/conf.d"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+ [smf*],
+ if test $init_type = smf10; then
+ initdir=${initdir="/var/svc/manifest/network/nagios"}
+ else
+ initdir=${initdir="/lib/svc/manifest/network/nagios"}
+ fi
+ initname=${initname="$INIT_PROG.xml"}
+ initconfdir=unknown
+ initconf=unknown,
+
+ [upstart],
+ initdir=${initdir="/etc/init"}
+ initname=${initname="$INIT_PROG.conf"}
+ initconfdir=${initconfdir="/etc/default"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+ [launchd],
+ initdir=${initdir="/Library/LaunchDaemons"}
+ initname=${initname="org.nagios.$INIT_PROG.plist"},
+# initconfdir=${initconfdir="/private/etc"}
+# initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+
+ [*],
+ initdir=unknown
+ initname=unknown)
+
+#
+# Inetd (per connection) scripts/files
+#
+AS_CASE([$inetd_type],
+ [inetd*],
+ inetddir=${inetddir="/etc"}
+ inetdname=${inetdname="inetd.conf"},
+
+ [xinetd],
+ inetddir=${inetddir="/etc/xinetd.d"}
+ inetdname=${inetdname="$INIT_PROG"},
+
+ [systemd],
+ if test $dist_type = "debian"; then
+ inetddir=${inetddir="/lib/systemd/system"}
+ else
+ inetddir=${inetddir="/usr/lib/systemd/system"}
+ fi
+ netdname=${inetdname="$INIT_PROG.socket"},
+
+ [smf*],
+ if test $init_type = smf10; then
+ inetddir=${inetddir="/var/svc/manifest/network/nagios"}
+ else
+ inetddir=${inetddir="/lib/svc/manifest/network/nagios"}
+ fi
+ inetdname=${inetdname="$INIT_PROG.xml"},
+
+# [upstart],
+# inetddir=${inetddir="/etc/init.d"}
+# inetdname=${inetdname="$INIT_PROG"},
+
+ [launchd],
+ inetddir=${inetddir="/Library/LaunchDaemons"}
+ inetdname=${inetdname="org.nagios.$INIT_PROG.plist"},
+
+ [*],
+ inetddir=${inetddir="unknown"}
+ inetdname=${inetdname="unknown"})
+
+AC_MSG_RESULT($install_method)
+])
diff --git a/macros/ax_nagios_get_ssl b/macros/ax_nagios_get_ssl
new file mode 100644
index 0000000..ca32333
--- /dev/null
+++ b/macros/ax_nagios_get_ssl
@@ -0,0 +1,303 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_SSL
+#
+# DESCRIPTION
+#
+# This macro finds the openssl binary, the header files directory and
+# the library files directory. It will also search for the gnutls
+# compatibility library/headers and the nss compatibility library/headers.
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_SSL], [AX_NAGIOS_GET_SSL])
+AC_DEFUN([AX_NAGIOS_GET_SSL],
+[
+
+# -------------------------------
+# SSL library and include paths
+# -------------------------------
+
+SSL_TYPE=openssl
+try_pkg_config=1
+ssl_dir=
+ssl_inc_dir=
+ssl_lib_dir=
+SSL_INC_DIR=
+SSL_INC_PREFIX=
+SSL_HDR=
+SSL_LIB_DIR=
+
+AC_SUBST(HAVE_SSL)
+AC_SUBST(SSL_TYPE)
+AC_SUBST(SSL_INC_DIR)
+AC_SUBST(SSL_HDR)
+AC_SUBST(SSL_INC_PREFIX)
+AC_SUBST(SSL_LIB_DIR)
+
+
+# gnutls/openssl.h
+# nss_compat_ossl/nss_compat_ossl.h
+
+dnl # Which type - openssl, gnutls-openssl, nss
+dnl AC_ARG_WITH([ssl-type],
+dnl dnl AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls or nss to use one of these instead of openssl]),
+dnl AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls to use that instead of openssl]),
+dnl [SSL_TYPE=$withval])
+
+AC_ARG_WITH([ssl],
+ AS_HELP_STRING([--with-ssl=DIR],[sets location of the SSL installation]),
+ [ssl_dir=$withval])
+AC_ARG_WITH([ssl-inc],
+ AS_HELP_STRING([--with-ssl-inc=DIR],
+ [sets location of the SSL include files]),
+ [ssl_inc_dir=$withval])
+AC_ARG_WITH([ssl-lib],
+ AS_HELP_STRING([--with-ssl-lib=DIR],[sets location of the SSL libraries]),
+ [ssl_lib_dir=$withval])
+
+if test x$ssl_inc_dir != x -o x$ssl_lib_dir != x; then
+ try_pkg_config=0
+fi
+
+AC_ARG_WITH([kerberos-inc],
+ AS_HELP_STRING([--with-kerberos-inc=DIR],
+ [sets location of the Kerberos include files]),
+ [kerberos_inc_dir=$withval])
+
+if test x$SSL_TYPE = xyes; then
+ SSL_TYPE=openssl
+fi
+
+
+dflt_hdrs="$ssl_inc_dir $ssl_dir $ssl_inc_dir/include $ssl_dir/include \
+ /usr/local/opt/{BBB} /usr/include/{BBB} /usr/local/include/{BBB} \
+ /usr/local/{AAA} /usr/local/{BBB} /usr/lib/{AAA} /usr/lib/{BBB} \
+ /usr/{AAA} /usr/pkg /usr/local /usr /usr/freeware/lib/{BBB} \
+ /usr/sfw /usr/sfw/include /opt/{BBB}"
+
+dflt_libs="$ssl_lib_dir {ssldir} {ssldir}/lib {ssldir}/lib64 /usr/lib64 \
+ /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu \
+ /usr/local/lib /usr/lib/{AAA} /usr/{AAA}/lib /usr/{BBB}/lib \
+ /usr/pkg/lib /usr/freeware/lib/{BBB} /usr/sfw/lib /opt/freeware/lib \
+ /opt/{BBB}/lib/hpux64 /opt/{BBB}/lib/pa20_64 /opt/{BBB}/lib/hpux32 \
+ /opt/{BBB}/lib /opt/{BBB}";
+
+
+AS_CASE([$SSL_TYPE],
+ [no], [SSL_TYPE=NONE],
+ [yes|openssl],
+ [ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
+ ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
+ SSL_INC_PREFIX=openssl
+ SSL_HDR=ssl.h
+ ssl_lib=libssl],
+ [gnutls],
+ [ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
+ ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
+ SSL_INC_PREFIX=gnutls
+ SSL_TYPE=gnutls_compat
+ SSL_HDR=compat.h
+ ssl_lib=libgnutls],
+ [nss],
+ [ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
+ ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
+ SSL_HDR=nss_compat_ossl.h
+ ssl_lib=libnss_compat],
+ [*], echo >&6; AC_MSG_ERROR(['--with-ssl-type=$SSL_TYPE' is invalid])
+)
+
+
+# Check for SSL support
+
+if test x$SSL_TYPE != xNONE; then
+
+ found_ssl=no
+
+ # RedHat 8.0 and 9.0 include openssl compiled with kerberos,
+ # so we must include header file
+ # Must come before openssl checks for Redhat EL 3
+ AC_MSG_CHECKING(for Kerberos include files)
+ found_kerberos=no
+ for dir in $kerberos_inc_dir /usr/kerberos/include /usr/include/krb5 \
+ /usr/include; do
+ kerbdir="$dir"
+ if test -f "$dir/krb5.h"; then
+ found_kerberos=yes
+ CFLAGS="$CFLAGS -I$kerbdir"
+ AC_DEFINE_UNQUOTED(HAVE_KRB5_H,[1],[Have the krb5.h header file])
+ break
+ fi
+ done
+
+ if test x_$found_kerberos != x_yes; then
+ AC_MSG_WARN(could not find include files)
+ else
+ AC_MSG_RESULT(found Kerberos include files in $kerbdir)
+ fi
+
+ # First, try using pkg_config
+ AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
+ if test x"$PKG_CONFIG" != x -a $try_pkg_config -ne 0 ; then
+ cflags=`$PKG_CONFIG $SSL_TYPE --cflags-only-I 2>/dev/null`
+ if test $? -eq 0; then
+ CFLAGS="$CFLAGS $cflags"
+ LDFLAGS="$LDFLAGS `$PKG_CONFIG $SSL_TYPE --libs-only-L 2>/dev/null`"
+ LIBS="$LIBS `$PKG_CONFIG $SSL_TYPE --libs-only-l 2>/dev/null`"
+ found_ssl=yes
+ AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support])
+ fi
+ fi
+
+ if test x_$found_ssl != x_yes; then
+
+ # Find the SSL Headers
+ AC_MSG_CHECKING(for SSL headers)
+ for dir in $ssl_hdr_dirs; do
+ if test "$dir" = "/include"; then
+ continue
+ fi
+ ssldir="$dir"
+ if test -f "$dir/include/$SSL_INC_PREFIX/$SSL_HDR"; then
+ found_ssl=yes
+ CFLAGS="$CFLAGS -I$dir/include/$SSL_INC_PREFIX -I$ssldir/include"
+ SSL_INC_DIR="$dir/include/$SSL_INC_PREFIX"
+ break
+ fi
+ if test -f "$dir/include/$SSL_HDR"; then
+ found_ssl=yes
+ if test "$SSL_HDR" != compat.h ; then
+ SSL_INC_PREFIX=""
+ fi
+ CFLAGS="$CFLAGS -I$dir/include"
+ SSL_INC_DIR="$dir/include"
+ break
+ fi
+ if test -f "$dir/$SSL_HDR"; then
+ found_ssl=yes
+ SSL_INC_PREFIX=""
+ CFLAGS="$CFLAGS -I$dir"
+ SSL_INC_DIR="$dir"
+ break
+ fi
+ if test -f "$dir/$SSL_INC_PREFIX/$SSL_HDR"; then
+ found_ssl=yes
+ CFLAGS="$CFLAGS -I$dir/$SSL_INC_PREFIX"
+ SSL_INC_DIR="$dir/$SSL_INC_PREFIX"
+ ssldir="$dir/.."
+ break
+ fi
+ done
+
+ if test x_$found_ssl != x_yes; then
+ AC_MSG_ERROR(Cannot find ssl headers)
+ else
+ AC_MSG_RESULT(found in $ssldir)
+
+ # Now try and find SSL libraries
+
+ AC_MSG_CHECKING(for SSL libraries)
+ found_ssl=no
+ ssl_lib_dirs=`echo "$ssl_lib_dirs" | sed -e "s|{ssldir}|$ssldir|g"`
+
+ if test "`uname -s`" = "Darwin" ; then
+ soext="dylib"
+ elif test "`uname -s`" = "HP-UX" ; then
+ if test x$arch = "xia64"; then
+ soext="so"
+ else
+ soext="sl"
+ fi
+ elif test "`uname -s`" = "AIX" ; then
+ soext="a"
+ else
+ soext="so"
+ fi
+
+ for dir in $ssl_lib_dirs; do
+ if test -f "$dir/$ssl_lib.$soext"; then
+ found_ssl=yes
+ SSL_LIB_DIR="$dir"
+ break
+ fi
+ done
+
+ if test x_$found_ssl != x_yes; then
+ AC_MSG_ERROR(Cannot find ssl libraries)
+ else
+ AC_MSG_RESULT(found in $SSL_LIB_DIR)
+
+ LDFLAGS="$LDFLAGS -L$SSL_LIB_DIR";
+ LIBS="$LIBS -l`echo $ssl_lib | sed -e 's/^lib//'` -lcrypto";
+ AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support])
+ fi
+ fi
+ fi
+
+ if test x$found_ssl = xyes ; then
+ if test -n "$SSL_INC_PREFIX" ; then
+ SSL_INC_PREFIX="${SSL_INC_PREFIX}/"
+ fi
+
+ # try to compile and link to see if SSL is set up properly
+ AC_MSG_CHECKING([whether compiling and linking against SSL works])
+
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([#include <${SSL_INC_PREFIX}${SSL_HDR}>], [SSL_new(NULL)])],
+ [
+ AC_MSG_RESULT([yes])
+ $1
+ ], [
+ AC_MSG_ERROR([no])
+ $2
+ ])
+ fi
+
+ if test x$found_ssl = xyes -a x$need_dh = xyes; then
+
+ # Find the openssl program
+
+ if test x$need_dh = xyes; then
+ AC_PATH_PROG(sslbin,openssl,value-if-not-found,$ssl_dir/sbin$PATH_SEPARATOR$ssl_dir/bin$PATH_SEPARATOR$PATH)
+ AC_DEFINE(USE_SSL_DH)
+ # Generate DH parameters
+ if test -f "$sslbin"; then
+ echo ""
+ echo "*** Generating DH Parameters for SSL/TLS ***"
+ # awk to strip off meta data at bottom of dhparam output
+ $sslbin dhparam -C 2048 | awk '/^-----/ {exit} {print}' > include/dh.h
+ fi
+ fi
+ fi
+fi
+])