diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae5bfca --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +Makefile +config.log +config.status +include/config.h +include/common.h +include/dh.h +nrpe.spec +paths +uninstall +.cproject +.project +nrpe.cbp +nrpe.layout +package/solaris/Makefile +sample-config/nrpe.cfg +src/Makefile +src/check_nrpe +src/nrpe +autom4te.cache/ +nbproject/ +.settings/ +startup/bsd-init +startup/debian-init +startup/default-inetd +startup/default-init +startup/default-service +startup/default-socket +startup/default-socket-svc +startup/default-xinetd +startup/mac-init.plist +startup/mac-inetd.plist +startup/newbsd-init +startup/openbsd-init +startup/openrc-conf +startup/openrc-init +startup/rh-upstart-init +startup/solaris-inetd.xml +startup/solaris-init.xml +startup/tmpfile.conf +startup/upstart-init + diff --git a/Changelog b/Changelog index e001957..c3afddf 100644 --- a/Changelog +++ b/Changelog @@ -2,11 +2,83 @@ NRPE Changelog ************** +3.0.1 - 2016-09-08 +------------------ +FIXES +- _set_rc: command not found reported by init script (John Frickson) +- Version string contains name (John Frickson) +- Changes to get 'rpmbuild' to work - nrpe.spec file outdated (John Frickson) +- typo in startup/default-xinetd.in (Philippe Kueck) +- debug output missing command name (Philippe Kueck) +- /usr/lib/tmpfiles.d/ndo2db.conf should have 'd' type, not 'D' (John Frickson) +- Fixes in parse_allowed_hosts() and called functions (Jobst Schmalenbach / John Frickson) +- nrpe.cfg: 'debug' statement needs to be first in file (Jobst Schmalenbach / John Frickson) + + +3.0 - 2016-08-01 +----------------- +SECURITY +- Fix for CVE-2014-2913 +- Added function to clean the environment before forking. (John Frickson) + +ENHANCEMENTS +- Added support for optional config file to check_nrpe. With the new SSL + parameters, the line was getting long. The config file is specified with + --config-file= or -f parameters. The config file must look + like command line options, but the options can be on separate lines. It + MUST NOT include --config-file (-f), --command (-c) or --args (-a). If any + options are in both the config file and on the command line, the command line + options are used. +- make can now add users and groups using "make install-groups-users" (John Frickson) +- Added "nrpe-uninstall" script to the same directory nrpe get installed to (John Frickson) +- Updated code so configure && make will work on AIX, HP-UX, Solaris, OS X. + There should be no errors or warnings. Let me know if any errors or + warning appear (John Frickson) +- Added command-line option to prevent forking, since some of the init + replacements (such as systemd, etc.) don't want daemons to fork (John Frickson) +- Added autoconf macros and additional files to better support multi-platform + config and compile. The default will still set up to install to + /usr/local/nagios but I added a new configure option: + '--enable-install-method='. If is 'opt', everything will + install to '/opt/nagios'. If is 'os', installation will be to O/S- + and distribution-specific locations, such as /usr/sbin, /usr/lib/nagios, + /etc/nagios, and so on. +- Added additional init and inetd config files to support more systems, + including SuSE, Debian, Slackware, Gentoo, *BSD, AIX, HP-UX, Solaris, OS X. +- Added listen_queue_size as configuration option (Vadim Antipov, Kaspersky Lab) +- Reworked SSL/TLS. See the README.SSL.md file for full info. (John Frickson) +- Added support for version 3 variable sized packets up to 64KB. nrpe will + accept either version from check_nrpe. check_nrpe will try to send a + version 3 packet first, and fall back to version 2. check_nrpe can be forced + to only send version 2 packets if the switch `-2` is used. (John Frickson) +- Added extended timeout syntax in the -t : format. (ABrist) + +FIXES +- Fixed configure to check more places for SSL headers/libs. (John Frickson) +- Added ifdefs for complete_SSL_shutdown to compile without SSL. (Matthew L. Daniel) +- Renamed configure.in to configure.ac and added check for sigaction (John Frickson) +- Replaced all instances of signal() with sigaction() + blocking (John Frickson) +- check_nrpe does not parse passed arguments correctly (John Frickson) +- NRPE should not start if cannot write pid file (John Frickson) +- Fixed out-of-bounds error (return code 255) for some failures (John Frickson) +- Connection Timeout and Connection Refused messages need a new line (Andrew Widdersheim) +- allowed_hosts doesn't work, if one of the hostnames can't be resolved by dns (John Frickson) +- allowed_hosts doesn't work with a hostname resolving to an IPv6 address (John Frickson) +- Return UNKNOWN when issues occur (Andrew Widdersheim) +- NRPE returns OK if check can't be executed (Andrew Widdersheim) +- nrpe 2.15 [regression in Added SRC support on AIX - 2.14] (frphoebus) +- compile nrpe - Solaris 9 doesn't have isblank() (lilo, John Frickson) +- sample configuration for check_load has crazy sample load avg (ernestoongaro) + + + 2.15 - 09/06/2013 ----------------- - Now compiles on HP-UX (Grant Byers) - Added support for IPv6 (Leo Baltus, Eric Stanley) + + 2.14 - 12/21/2012 ----------------- - Added configure option to allow bash command substitutions, disabled by default [bug #400] (Eric Stanley) @@ -15,6 +87,8 @@ NRPE Changelog - Updated RPM SPEC file to support creating RPMs on AIX (Eric Stanley) - Updated logging to support compiling on AIX (Eric Stanley) + + 2.13 - 11/11/2011 ----------------- - Applied Kaspersky Labs supplied patch for extending allowed_hosts (Konstantin Malov) @@ -22,6 +96,7 @@ NRPE Changelog - Updated to support compiling on Solaris 10 (thanks to Kevin Pendleton) + 2.12 - 03/10/2008 ----------------- - Fix for unterminated multiline plugin (garbage) output (Krzysztof Oledzki) @@ -35,6 +110,7 @@ NRPE Changelog - Added --with-log-facility option to control syslog logging (Ryan Ordway and Brian Seklecki) + 2.10 - 10/19/2007 ----------------- - Moved PDF docs to docs/ subdirectory, added OpenOffice source document diff --git a/Makefile.in b/Makefile.in index 0b896e3..4fb42f3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -9,77 +9,187 @@ SRC_BASE=./src/ SRC_INCLUDE=./include/ +# Mainly used for rpmbuild +# DESTDIR= + CC=@CC@ CFLAGS=@CFLAGS@ @DEFS@ LDFLAGS=@LDFLAGS@ @LIBS@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -CFGDIR=@sysconfdir@ -BINDIR=@bindir@ -SBINDIR=@sbindir@ -LIBEXECDIR=@libexecdir@ INSTALL=@INSTALL@ +GREP=@GREP@ +EGREP=@EGREP@ + +prefix=$(DESTDIR)@prefix@ +exec_prefix=$(DESTDIR)@exec_prefix@ +CFGDIR=$(DESTDIR)@pkgsysconfdir@ +BINDIR=$(DESTDIR)@bindir@ +SBINDIR=$(DESTDIR)@sbindir@ +LIBEXECDIR=$(DESTDIR)@libexecdir@ NAGIOS_INSTALL_OPTS=@NAGIOS_INSTALL_OPTS@ NRPE_INSTALL_OPTS=@NRPE_INSTALL_OPTS@ +OPSYS=@opsys@ +DIST=@dist_type@ +NRPE_USER=@nrpe_user@ +NRPE_GROUP=@nrpe_group@ +NAGIOS_USER=@nagios_user@ +NAGIOS_GROUP=@nagios_group@ -INIT_DIR=@init_dir@ +INIT_TYPE=@init_type@ +INIT_DIR=$(DESTDIR)@initdir@ INIT_OPTS=-o root -g root +INIT_FILE=@initname@ +INETD_TYPE=@inetd_type@ +INETD_DIR=$(DESTDIR)@inetddir@ +INETD_FILE=@inetdname@ +SRC_INETD=@src_inetd@ +SRC_INIT=@src_init@ +default: + @echo;\ + echo Please enter 'make [option]' where [option] is one of:;\ + echo;\ + echo " all builds nrpe and check_nrpe";\ + echo " nrpe builds nrpe only";\ + echo " check_nrpe builds check_nrpe only";\ + echo " install-groups-users add the users and groups if they do not exist";\ + echo " install install nrpe and check_nrpe";\ + echo " install-plugin install the check_nrpe plugin";\ + echo " install-daemon install the nrpe daemon";\ + echo " install-config install the nrpe configuration file";\ + echo " install-inetd install the startup files for inetd, launchd, etc.";\ + echo " install-init install the startup files for init, systemd, etc.";\ + echo + all: - cd $(SRC_BASE); $(MAKE) ; cd .. + cd $(SRC_BASE); $(MAKE) + + @echo "";\ + echo "*** Compile finished ***";\ + echo "";\ + echo "You can now continue with the installation or upgrade process.";\ + echo "";\ + echo "Read the PDF documentation (NRPE.pdf) for information on the next";\ + echo "steps you should take to complete the installation or upgrade.";\ + echo "" - @echo "" - @echo "*** Compile finished ***" - @echo "" - @echo "If the NRPE daemon and client compiled without any errors, you" - @echo "can continue with the installation or upgrade process." - @echo "" - @echo "Read the PDF documentation (NRPE.pdf) for information on the next" - @echo "steps you should take to complete the installation or upgrade." - @echo "" nrpe: - cd $(SRC_BASE); $(MAKE) ; cd .. + cd $(SRC_BASE); $(MAKE) check_nrpe: - cd $(SRC_BASE); $(MAKE) ; cd .. - + cd $(SRC_BASE); $(MAKE) install-plugin: - cd $(SRC_BASE) && $(MAKE) $@ + cd $(SRC_BASE); $(MAKE) $@ install-daemon: - cd $(SRC_BASE) && $(MAKE) $@ + cd $(SRC_BASE); $(MAKE) $@ install: - cd $(SRC_BASE) && $(MAKE) $@ + cd $(SRC_BASE); $(MAKE) $@ -install-xinetd: - $(INSTALL) -m 644 sample-config/nrpe.xinetd /etc/xinetd.d/nrpe +install-init: + @if test $(SRC_INIT) = unknown; then \ + echo No init file to install; \ + exit 1; \ + fi + @if test $(INIT_TYPE) = upstart; then\ + echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \ + $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \ + echo initctl reload-configuration; \ + initctl reload-configuration; \ + elif test $(INIT_TYPE) = systemd; then\ + echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \ + $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \ + elif test $(INIT_TYPE) = smf10 -o $(INIT_TYPE) = smf11; then \ + echo $(INSTALL) -m 775 -g sys -d $(INIT_DIR);\ + $(INSTALL) -m 775 -g sys -d $(INIT_DIR);\ + echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \ + $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \ + echo svccfg import $(INIT_DIR)/$(INIT_FILE); \ + svccfg import $(INIT_DIR)/$(INIT_FILE); \ + echo "*** Run 'svcadm enable nrpe' to start it"; \ + else\ + echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \ + $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \ + if test $(INIT_TYPE) = newbsd; then\ + if test $(DIST) = openbsd; then\ + echo "# nrpe@bsd_enable@=NO" >> /etc/rc.conf;\ + echo "nrpe@bsd_enable@=\"-d -c $(CFGDIR)/nrpe.cfg\"" >> /etc/rc.conf;\ + echo "Make sure to enable the nrpe daemon";\ + else\ + echo "nrpe@bsd_enable@=YES" >> /etc/rc.conf;\ + echo "nrpe_configfile=$(CFGDIR)/nrpe.cfg" >> /etc/rc.conf;\ + fi;\ + elif test $(INIT_TYPE) = launchd; then\ + launchctl load $(INIT_DIR)/$(INIT_FILE); \ + else\ + if test -f /sbin/chkconfig ; then \ + /sbin/chkconfig nrpe on;\ + else\ + echo "Make sure to enable the nrpe daemon";\ + fi;\ + fi;\ + fi -install-daemon-config: - $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR) - $(INSTALL) -m 644 $(NRPE_INSTALL_OPTS) sample-config/nrpe.cfg $(DESTDIR)$(CFGDIR) +install-inetd: + @if test $(SRC_INETD) = unknown; then \ + echo No inetd file to install; \ + exit 1; \ + fi + @if test $(INETD_TYPE) = inetd; then \ + $(EGREP) -q "^\W*nrpe\s+" $(INETD_DIR)/$(INETD_FILE) 2>/dev/null || \ + cat startup/$(SRC_INETD) >> $(INETD_DIR)/$(INETD_FILE); \ + elif test $(INETD_TYPE) = systemd; then \ + SRC_INETD_FILE=`echo "$(SRC_INETD)" | sed -e 's/socket/socket-svc/'`; \ + echo $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \ + $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \ + elif test $(INETD_TYPE) = smf10 -o $(INETD_TYPE) = smf11; then \ + echo $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\ + $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\ + echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \ + $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \ + $(INSTALL) -m 775 -d $(INETD_DIR);\ + echo svccfg import $(INETD_DIR)/$(INETD_FILE); \ + svccfg import $(INETD_DIR)/$(INETD_FILE); \ + echo "*** Run 'svcadm enable nrpe' to start it"; \ + elif test $(INIT_TYPE) = launchd; then\ + $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \ + launchctl load $(INETD_DIR)/$(INETD_FILE); \ + else\ + echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \ + $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \ + fi + @$(EGREP) -q "^nrpe[\t ]+@nrpe_port@/tcp" /etc/services || \ + echo "***** MAKE SURE 'nrpe @nrpe_port@/tcp' IS IN YOUR /etc/services FILE" -solaris-package: - @if [ `uname -s` != "SunOS" ] ; then \ - echo "It is recommended you be running on Solaris to build a Solaris package"; \ - else \ - cd package/solaris; $(MAKE) build ; $(MAKE) pkg ; cd ../..; \ +install-config: + $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(CFGDIR) + $(INSTALL) -m 644 $(NRPE_INSTALL_OPTS) sample-config/nrpe.cfg $(CFGDIR) + +install-groups-users: + @macros/add_group_user $(DIST) $(NAGIOS_USER) $(NAGIOS_GROUP) + @if test "$(NAGIOS_USER)" != "$(NRPE_USER)" -o "$(NAGIOS_GROUP)" != "$(NRPE_GROUP)"; then\ + macros/add_group_user $(DIST) $(NRPE_USER) $(NRPE_GROUP);\ fi clean: - cd $(SRC_BASE); $(MAKE) $@ ; cd .. - cd package/solaris; $(MAKE) $@ ; cd ../.. + cd $(SRC_BASE); $(MAKE) $@; cd .. rm -f core rm -f *~ */*~ distclean: clean - cd $(SRC_BASE); $(MAKE) $@ ; cd .. - cd package/solaris; $(MAKE) $@ ; cd ../.. - rm -f config.log config.status config.cache nrpe.cfg nrpe.xinetd subst $(SRC_INCLUDE)/config.h init-script init-script.debian init-script.freebsd init-script.suse - rm -f sample-config/*.cfg sample-config/*.xinetd + cd $(SRC_BASE); $(MAKE) $@; cd .. + rm -rf autom4te.cache + rm -f config.log config.status config.cache sample-config/nrpe.cfg $(SRC_INCLUDE)/config.h + rm -f startup/bsd-init startup/debian-init startup/default-init startup/default-inetd + rm -f startup/default-service startup/default-socket startup/default-socket-svc + rm -f startup/default-xinetd startup/mac-init.plist startup/mac-inetd.plist + rm -f startup/newbsd-init startup/openbsd-init startup/openrc-conf + rm -f startup/openrc-init startup/rh-upstart-init startup/solaris-init.xml + rm -f startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init + rm -f nrpe.spec uninstall include/common.h rm -f Makefile devclean: distclean diff --git a/README b/README deleted file mode 100644 index 65635a6..0000000 --- a/README +++ /dev/null @@ -1,234 +0,0 @@ ------------ -NRPE README ------------ - - -** UPDATED DOCUMENTATION! - -For installation instructions and information on the design overview -of the NRPE addon, please read the PDF documentation that is found in -this directory: NRPE.pdf - - - - -Purpose -------- -The purpose of this addon is to allow you to execute Nagios -plugins on a remote host in as transparent a manner as possible. - - -Contents --------- - -There are two pieces to this addon: - - 1) NRPE - This program runs as a background process on the - remote host and processes command execution requests - from the check_nrpe plugin on the Nagios host. - Upon receiving a plugin request from an authorized - host, it will execute the command line associated - with the command name it received and send the - program output and return code back to the - check_nrpe plugin - - 2) check_nrpe - This is a plugin that is run on the Nagios host - and is used to contact the NRPE process on remote - hosts. The plugin requests that a plugin be - executed on the remote host and wait for the NRPE - process to execute the plugin and return the result. - The plugin then uses the output and return code - from the plugin execution on the remote host for - its own output and return code. - - -Compiling ---------- - -The code is very basic and may not work on your particular -system without some tweaking. I just haven't put a lot of effort -into this addond. Most Linux users should be able to compile -NRPE and the check_nrpe plugin with the following commands... - -./configure -make all - -The binaries will be located in the src/ directory after you -run 'make all' and will have to be installed manually somewhere -on your system. - - -NOTE: Since the check_nrpe plugin and nrpe daemon run on different - machines (the plugin runs on the Nagios host and the daemon - runs on the remote host), you will have to compile the nrpe - daemon on the target machine. - - - -Installing ----------- - -The check_nrpe plugin should be placed on the Nagios host along -with your other plugins. In most cases, this will be in the -/usr/local/nagios/libexec directory. - -The nrpe program and the configuration file (nrpe.cfg) should -be placed somewhere on the remote host. Note that you will also -have to install some plugins on the remote host if you want to -make much use of this addon. - - - -Configuring ------------ - -Sample config files for the NRPE daemon are located in the -sample-config/ subdirectory. - - - -Running Under INETD or XINETD ------------------------------ - -If you plan on running nrpe under inetd or xinetd and making use -of TCP wrappers, you need to do the following things: - - - -1) Add a line to your /etc/services file as follows (modify the port - number as you see fit) - - nrpe 5666/tcp # NRPE - - - -2) Add entries for the NRPE daemon to either your inetd or xinetd - configuration files. Which one your use will depend on which - superserver is installed on your system. Both methods are described - below. NOTE: If you run nrpe under inetd or xinetd, the server_port - and allowed_hosts variables in the nrpe configuration file are - ignored. - - - ***** INETD ***** - If your system uses the inetd superserver WITH tcpwrappers, add an - entry to /etc/inetd.conf as follows: - - nrpe stream tcp nowait /usr/sbin/tcpd -c --inetd - - If your system uses the inetd superserver WITHOUT tcpwrappers, add an - entry to /etc/inetd.conf as follows: - - nrpe stream tcp nowait -c --inetd - - - - Replace with the name of the user that the nrpe server should run as. - Example: nagios - - Replace with the path to the nrpe binary on your system. - Example: /usr/local/nagios/nrpe - - Replace with the path to the nrpe config file on your system. - Example: /usr/local/nagios/nrpe.cfg - - - ***** XINETD ***** - If your system uses xinetd instead of inetd, you'll probably - want to create a file called 'nrpe' in your /etc/xinetd.d - directory that contains the following entries: - - - # default: on - # description: NRPE - service nrpe - { - flags = REUSE - socket_type = stream - wait = no - user = - server = - server_args = -c --inetd - log_on_failure += USERID - disable = no - only_from = ... - } - - - - Replace with the name of the user that the nrpe server should run as. - - Replace with the path to the nrpe binary on your system. - - Replace with the path to the nrpe config file on your system. - - Replace the fields with the IP addresses of hosts which - are allowed to connect to the NRPE daemon. This only works if xinetd was - compiled with support for tcpwrappers. - - - -3) Restart inetd or xinetd will the following command (pick the - on that is appropriate for your system: - - /etc/rc.d/init.d/inet restart - - /etc/rc.d/init.d/xinetd restart - - OpenBSD users can use the following command to restart inetd: - - kill -HUP `cat /var/run/inet.pid` - - - -4) Add entries to your /etc/hosts.allow and /etc/hosts.deny - file to enable TCP wrapper protection for the nrpe service. - This is optional, although highly recommended. - - - - -Configuring Things On The Nagios Host ---------------------------------------- - -Examples for configuring the nrpe daemon are found in the sample -nrpe.cfg file included in this distribution. That config file -resides on the remote host(s) along with the nrpe daemon. The -check_nrpe plugin gets installed on the Nagios host. In order -to use the check_nrpe plugin from within Nagios, you'll have -to define a few things in the host config file. An example -command definition for the check_nrpe plugin would look like this: - -define command{ - command_name check_nrpe - command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ - } - -In any service definitions that use the nrpe plugin/daemon to -get their results, you would set the service check command portion -of the definition to something like this (sample service definition -is simplified for this example): - -define service{ - host_name someremotehost - service_description someremoteservice - check_command check_nrpe!yourcommand - ... etc ... - } - -where "yourcommand" is a name of a command that you define in -your nrpe.cfg file on the remote host (see the docs in the -sample nrpe.cfg file for more information). - - - - -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 all else fails, you can email me and I'll try and respond as -soon as I get a chance. - - -- Ethan Galstad (nagios@nagios.org) - - - - diff --git a/README.SSL b/README.SSL deleted file mode 100644 index dadbda4..0000000 --- a/README.SSL +++ /dev/null @@ -1,34 +0,0 @@ -NRPE With SSL/TLS - -NRPE now has the option for Encrypting Network traffic using -SSL/TLS from openssl. - -The Encryption is done using a set encryption routine of -AES-256 Bit Encryption using SHA and Anon-DH. This encrypts -all traffic using the NRPE sockets from the client to the server. - -Since we are using Anon-DH this allows for an encrypted -SSL/TLS Connection without using pre-generated keys or -certificates. The key generation information used by the -program to dynaically create keys on daemon startup can be found -in the dh.h file in the nrpe src directory. This file was created -using the command: - -openssl dhparam -C 512 - -which outputs the C code in dh.h. For your own security you can replace -that file with your own dhparam generated code. - -As of this time you will need to have the latest greatest version of -OpenSSL (tested against version 0.9.7a) since not all versions have -the AES algorythm in them. - -I am not aware that at this time this code is restricted under export -restrictions but I leave that verification process up to you. - -Thoughts and suggestions are welcome and I can be reached on the -Nagios and NagiosPlug Mailing Lists. - - - Derrick - - diff --git a/README.SSL.md b/README.SSL.md new file mode 100644 index 0000000..bb6498f --- /dev/null +++ b/README.SSL.md @@ -0,0 +1,283 @@ +NRPE With SSL/TLS +================= + +##Contents +1. [Introduction](#intro) +2. [NRPE Changes](#nrpe) +3. [check_nrpe Changes](#chk) +4. [Certificate Generation Example](#xmp) + + + +------------ +###Introduction +------------ + +NRPE has had basic support for SSL/TLS for some time now, but it was +severely lacking. It only allowed anonymous Diffie Hellman (ADH) key +exchange, it used a fixed 512-bit key (generated at `./configure` +time and extremely insecure) and originally allowed SSLv2. In 2004, +SSLv2 and SSLv3 support was disabled. + +nrpe and check_nrpe have been updated to offer much more secure +encryption and more options. And the updates are done in a backward- +compatible way, allowing you to migrate to the newer versions +without having to do it all at once, and possibly miss updating some +machines, causing lost reporting. + + + +------------------------------------------ +###CHANGES IN THE CURRENT VERSION OF NRPE +------------------------------------------ + +Running `./configure` will now create a 2048-bit DH key instead +of the old 512-bit key. The most current versions of openSSL will +still not allow it. In my testing, openSSL 1.0.1e allowed DH keys +of 512 bits, and 1.0.1k would not allow 2048 bit keys. In addition +we now call `SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE)` so a +new key is generated on each connection, based on the 2048-bit +key generated. + +The NRPE configuration file has added new SSL/TLS options. The +defaults currently will allow old check_nrpe plugins to continue to +connect to the nrpe daemon, but can report on "old style" +connections, or enforce more secure communication as your migration +progresses. The new options are in the "SSL/TLS OPTIONS" section of +nrpe.cfg, about two-thirds of the way down. + +If you are upgrading NRPE from a prior version, you can run the +`update-cfg.pl` script to add the new parameters to your nrpe.cfg. + +The `ssl_version` directive lets you set which versions of SSL/TLS +you want to allow. SSLv2, SSLv3, TLSv1, TLSv1.1 and TLSv1.2 are +allowed, or those litereals with a `+` after them (as in TLSv1.1+). +Without the `+`, that version _only_ will be used. With the `+`, +that version _or above_ will be used. openSSL will always negotiate +the highest available allowed version available on both ends. This +directive currently defaults to `TLSv1+`. + +The `ssl_use_adh` directive is **DEPRECATED**, even though it is new. +Possible values are `0` to not allow ADH at all, `1` to allow ADH, +and `2` to require ADH. The `2` should never be required, but it's +there just in case it's needed, for whatever reason. `1` is currently +the default, which allows older check_nrpe plugins to connect using +ADH. When all the plugins are migrated to the newer version, it +should be set to `0`. In an upcoming version of NRPE, ADH will no +longer be allowed at all. Note that if you use a `2` here, NRPE will +override any `ssl_cipher_list` entries (below) to *only* allow ADH. + +The `ssl_cipher_list` directive lets you specify which ciphers you +want to allow. It currently defaults to `ALL:!MD5:@STRENGTH` but can +take any value allowed by openSSL. In an upcoming version of NRPE, it +will be changed to something more secure, something like +`ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!RC4:!MD5:@STRENGTH`. Note that +if you have `ssl_use_adh=2`, this string will be overridden with +`ADH` which only only allow ADH. + +The `ssl_cacert_file`, `ssl_cert_file` and `ssl_privatekey_file` +directives are used to specify which *.pem files are to be used for +Public-Key Encryption (PKE). Setting these will allow clients to use +PKE to communicate with the server, similar to how the HTTPS +protocol works. + +The `ssl_client_certs` directive specifies whether or not a client +certificate will be requested when a client tries to connect. A value +of `0` means the nrpe daemon will not ask for or require a client +certificate. A `1` will cause it to ask for a client certificate, but +not require one. A `2` will require the client to present a valid +certificate. This currently defaults to `0`. If you want to use +client certificates and are upgrading the clients over time, you can +set this to `1` once many have been upgraded, then set to `2` to +force the use of client certs. Note that the client certs _must_ be +signed by the CA cert specified in the `ssl_cacert_file` directive. + +The `ssl_logging` directive allows you to log some additional data +to syslog. OR (or add) values together to have more than one option +enabled. Values are `0` for no additional logging (the default), +`1` to log startup SSL/TLS parameters from the nrpe.cfg file, `2` to +log the SSL/TLS version of connections, `4` to log which cipher is +being used for the connection, `8` to log if the plugin has a cert, and +`16` to log details of plugin's certificate. `-1` will enable all. +This can be especially helpful during plugin migration, so you can +tell which plugins have certificates, what SSL/TLS version is being +used, and which ciphers are being used. + + + +------------------------------------------------ +###CHANGES IN THE CURRENT VERSION OF CHECK_NRPE +------------------------------------------------ + +The check_nrpe plugin has also been updated to provide more secure +encryption and allow the use of client certificates. The command line +has several new options, which are outlined below. Both the long and +short arguments are presented. + +`--no-adh` or `-d` will disable the use of ADH. This option is +**DEPRECATED**, even though it's new. It will be removed in a +future version. + +`--ssl-version=` or `-S ` specifies minimum SSL/TLS version +to use. See the `ssl_version` directive above for possible values. + +`--cipher-list=` determines which ciphers will +and won't be allowed. See the `ssl_cipher_list` directive above. + +`--client-cert=` or `-C ` specifies an optional client +certificate to use. If this value is entered, the next one below is +required. + +`--key-file=` or `-K ` specifies the client certificate +key file to use. This goes along with `--client-cert` above. + +`--ca-cert-file=` or `-A ` specifies the CA certificate +to use in order to validate the nrpe daemon's public key. + +`--no-adh` or `-d` is **DEPRECATED** + +`--use-adh` or `-d [num]` is **DEPRECATED**, even though it is new. +If you use `-d` or `-d 0` it acts the same way as as the old `-d`. +Otherwise, use `1` to allow ADH, and `2` to require ADH. + +`--ssl-logging=` or `-s ` allows you to log some additional +data to syslog. OR (or add) values together to have more than one +option enabled. See the description of the `ssl_logging` directive +from NRPE above. + + + +---------------------------------- +###Certificate Generation Example +---------------------------------- + +**Note** _The following example does not follow best practice for +creating and running a CA or creating certificates. It is for testing +or possibly for use in a small environment. Sloppy security is as bad +as no security._ + +In this example, we are going to put everything in the +`/usr/local/nagios/etc/ssl` directory. You may want to use the more +common `/etc/ssl` directory, or somewhere else entirely. + +We are going to assume your company name is Foo Widgets, LLC; the +server running the nagios process (and thus the check_nrpe program) +is called `nag_serv`; and there are two Linux machines that will +run the nrpe daemon: `db_server` and `bobs_workstation`. + + +####Set up the directories + +As root, do the following: + + mkdir -p -m 750 /usr/local/nagios/etc/ssl + chown root.nagios /usr/local/nagios/etc/ssl + cd /usr/local/nagios/etc/ssl + mkdir -m 750 ca + chown root.root ca + mkdir -m 750 server_certs + chown root.nagios server_certs + mkdir -m 750 client_certs + chown root.nagios client_certs + + +####Create Certificate Authority + +If you want to validate client or server certificates, you will need +to create a Certificate Authority (CA) that will sign all client and +server certificates. If your organization already has a CA, you can +use that. + +As root, do the following: + + cd /usr/local/nagios/etc/ssl/ca + openssl req -x509 -newkey rsa:4096 -keyout ca_key.pem \ + -out ca_cert.pem -utf8 -days 3650 + +When asked, enter a passphrase. Then follow the prompts. You will +probably want to include `CA` or `Certificate Authority` in for +`Organizational Unit Name` and `Common Name`. For example: + + Organization Name (eg, company) []:Foo Widgets LLC + Organizational Unit Name (eg, section) []:Foo Certificate Authority + Common Name (e.g. server FQDN or YOUR name) []:Foo Nagios CA + + +####Create NRPE Server Certificate Requests + +For each of the hosts that will be running the nrpe daemon, you will +need a server certificate. You can create a key, and the CSR +(Certificate Signing Request) separately, but the following commands +will do both with one command. As root, do the following: + + cd /usr/local/nagios/etc/ssl/server_certs + openssl req -new -newkey rsa:2048 -keyout db_server.key \ + -out db_server.csr -nodes + openssl req -new -newkey rsa:2048 -keyout bobs_workstation.key \ + -out bobs_workstation.csr -nodes + +Follow the prompts. The `-nodes` at the end of the lines tells +openssl to generate the key without a passphrase. Leave it off if you +want someone to enter a passphrase whenever the machine boots. + +Now you need to sign the CSRs with your CA key. + +If you have the default `/etc/openssl.cnf`, either change it, or as root, do: + + cd /usr/local/nagios/etc/ssl + mkdir demoCA + mkdir demoCA/newcerts + touch demoCA/index.txt + echo "01" > demoCA/serial + chown -R root.root demoCA + chmod 700 demoCA + chmod 700 demoCA/newcerts + chmod 600 demoCA/serial + chmod 600 demoCA/index.txt + +Now, sign the CSRs. As root, do the following: + + cd /usr/local/nagios/etc/ssl + openssl ca -days 365 -notext -md sha256 \ + -keyfile ca/ca_key.pem -cert ca/ca_cert.pem \ + -in server_certs/db_server.csr \ + -out server_certs/db_server.pem + chown root.nagios server_certs/db_server.pem + chmod 440 server_certs/db_server.pem + openssl ca -days 365 -notext -md sha256 \ + -keyfile ca/ca_key.pem -cert ca/ca_cert.pem \ + -in server_certs/bobs_workstation.csr \ + -out server_certs/bobs_workstation.pem + chown root.nagios server_certs/bobs_workstation.pem + chmod 440 server_certs/bobs_workstation.pem + +Now, copy the `db_server.pem` and `db_server.key` files to the +db_server machine, and the `bobs_workstation.pem` and +`bobs_workstation.key` files to bobs_workstation. Copy the +`ca/ca_cert.pem` file to both machines. + + +####Create NRPE Client Certificate Requests + +Now you need to do the same thing for the machine that will be +running the check_nrpe program. + + cd /usr/local/nagios/etc/ssl/client_certs + openssl req -new -newkey rsa:2048 -keyout nag_serv.key \ + -out nag_serv.csr -nodes + + cd /usr/local/nagios/etc/ssl + openssl ca -extensions usr_cert -days 365 -notext -md sha256 \ + -keyfile ca/ca_key.pem -cert ca/ca_cert.pem \ + -in client_certs/nag_serv.csr \ + -out client_certs/nag_serv.pem + chown root.nagios client_certs/nag_serv.pem + chmod 440 client_certs/nag_serv.pem + +Now, copy the `nag_serv.pem`, `nag_serv.key` and `ca/ca_cert.pem` +files to the nag_serv machine, if you did the above on a different +computer. + +Put the location of each computers' three files in the `nrpe.cfg` +file or in the check_nrpe command line. You should now have +encryption and, if desired, key validation. diff --git a/README.Solaris b/README.Solaris deleted file mode 100644 index 7d7e386..0000000 --- a/README.Solaris +++ /dev/null @@ -1,18 +0,0 @@ -Compiling on Solaris - -Several changes may be necessary in order to compile NRPE on Solaris. -This information is known to apply to Solaris 10 and may apply to other -verisions of Solaris. This has been tested on Solaris 10 x86. - -There are three things that you may need to compile NRPE on Solaris: - - 1. Add /usr/sfw/bin to your path - $ PATH="$PATH:/usr/sfw/bin" - 2. Specify the binary to be used for make-ing - $ MAKE=gmake ./configure - 3. Use gmake to build the code - $ gmake all - -Thanks to Kevin Pendleton at UtahSysAdmin.com -(http://www.utahsysadmin.com/2008/03/14/configuring-nagios-plugins-nrpe-on-solaris-10/) -for the instructions on finding the SSL libraries. diff --git a/README.md b/README.md new file mode 100644 index 0000000..25cd9e7 --- /dev/null +++ b/README.md @@ -0,0 +1,206 @@ +NRPE README +=========== + +For installation instructions and information on the design overview +of the NRPE addon, please read the PDF documentation that is found in +this directory: `docs/NRPE.pdf` + +If you are upgrading from a previous version, run 'update-cfg.pl' to +add the new SSL parameters to your config file. + + +Purpose +------- +The purpose of this addon is to allow you to execute Nagios +plugins on a remote host in as transparent a manner as possible. + + +Contents +-------- + +There are two pieces to this addon: + + 1) **NRPE** - This program runs as a background process on the + remote host and processes command execution requests + from the check_nrpe plugin on the Nagios host. + Upon receiving a plugin request from an authorized + host, it will execute the command line associated + with the command name it received and send the + program output and return code back to the + check_nrpe plugin + + 2) **check_nrpe** - This is a plugin that is run on the Nagios host + and is used to contact the NRPE process on remote + hosts. The plugin requests that a plugin be + executed on the remote host and wait for the NRPE + process to execute the plugin and return the result. + The plugin then uses the output and return code + from the plugin execution on the remote host for + its own output and return code. + + +Compiling +--------- + +The code is very basic and may not work on your particular +system without some tweaking. If you are having any problems +compiling on your system, please let us know, hopefully with +fixes. Most users should be able to compile NRPE and the +check_nrpe plugin with the following commands... + + ./configure + make all + +The binaries will be located in the `src/` directory after you +run `make all` and will have to be installed manually somewhere +on your system. + +_NOTE: Since the check_nrpe plugin and nrpe daemon run on different + machines (the plugin runs on the Nagios host and the daemon + runs on the remote host), you will have to compile the nrpe + daemon on the target machine._ + + +Installing +---------- + +The check_nrpe plugin should be placed on the Nagios host along +with your other plugins. In most cases, this will be in the +`/usr/local/nagios/libexec` directory. + +The nrpe program and the configuration file `nrpe.cfg` should +be placed somewhere on the remote host. Note that you will also +have to install some plugins on the remote host if you want to +make much use of this addon. + + +Configuring +----------- + +Sample config files for the NRPE daemon are located in the +`sample-config/` subdirectory. + + +Running Under INETD or XINETD +----------------------------- + +If you plan on running nrpe under inetd or xinetd and making use +of TCP wrappers, you need to add a line to your `/etc/services` +file as follows (modify the port number as you see fit) + + nrpe 5666/tcp # NRPE + +The run `make install-inetd` to copy the appropriate file, or +add the appropriate line to your `/etc/inetd.conf`. + + _NOTE: If you run nrpe under inetd or xinetd, the server_port + and allowed_hosts variables in the nrpe configuration file are + ignored._ + + +#### INETD + +After running `make install-inetd`, your `/etc/inetd.conf` file will +contain lines similar to the following: + +``` + # + # Enable the following entry to enable the nrpe daemon + #nrpe stream tcp nowait nagios /usr/local/nagios/bin/nrpe nrpe -c /usr/local/nagios/etc/nr + # Enable the following entry if the nrpe daemon didn't link with libwrap + #nrpe stream tcp nowait nagios /usr/sbin/tcpd /usr/local/nagios/bin/nrpe -c /usr/local/nag +``` + +Un-comment the appropriate line, then Restart inetd: + + /etc/rc.d/init.d/inet restart + +OpenBSD users can use the following command to restart inetd: + + kill -HUP `cat /var/run/inet.pid` + +Then add entries to your `/etc/hosts.allow` and `/etc/hosts.deny` +file to enable TCP wrapper protection for the nrpe service. +This is optional, although highly recommended. + + +#### XINETD + +If your system uses xinetd instead of inetd, `make install-inetd` +will create a file called `nrpe` in your `/etc/xinetd.d` +directory that contains a file similar to this: + +``` + # default: off + # description: NRPE (Nagios Remote Plugin Executor) + service nrpe + { + disable = yes + socket_type = stream + port = @NRPE_PORT@ + wait = no + user = nagios + group = nagios + server = /usr/local/nagios/bin/nrpe + server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd + only_from = 127.0.0.1 + log_on_failure += USERID + } +``` + +- Replace `disable = yes` with `disable = no` +- Replace the `127.0.0.1` field with the IP addresses of hosts which + are allowed to connect to the NRPE daemon. This only works if xinetd was + compiled with support for tcpwrappers. +- Add entries to your `/etc/hosts.allow` and `/etc/hosts.deny` + file to enable TCP wrapper protection for the nrpe service. + This is optional, although highly recommended. + +Restart xinetd: + + /etc/rc.d/init.d/xinetd restart + + +Configuring Things On The Nagios Host +--------------------------------------- + +Examples for configuring the nrpe daemon are found in the sample +`nrpe.cfg` file included in this distribution. That config file +resides on the remote host(s) along with the nrpe daemon. The +check_nrpe plugin gets installed on the Nagios host. In order +to use the check_nrpe plugin from within Nagios, you will have +to define a few things in the host config file. An example +command definition for the check_nrpe plugin would look like this: + + define command{ + command_name check_nrpe + command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ + } + +In any service definitions that use the nrpe plugin/daemon to +get their results, you would set the service check command portion +of the definition to something like this (sample service definition +is simplified for this example): + + define service{ + host_name someremotehost + service_description someremoteservice + check_command check_nrpe!yourcommand + ... etc ... + } + +where `yourcommand` is a name of a command that you define in +your nrpe.cfg file on the remote host (see the docs in the +sample nrpe.cfg file for more information). + + +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/SECURITY b/SECURITY.md similarity index 57% rename from SECURITY rename to SECURITY.md index 6138155..f5986ac 100644 --- a/SECURITY +++ b/SECURITY.md @@ -1,25 +1,20 @@ -******************** NRPE SECURITY README -******************** +==================== + +--- + +### TCP WRAPPER SUPPORT ### -TCP WRAPPER SUPPORT -=================== - -NRPE 2.x includes native support for TCP wrappers. The older -host access list directive was removed from the config file. -Make sure your system supports TCP wrappers before running NRPE. -Once you compile NRPE you can check to see if it has wrapper -support built in by running the daemon from the command line -without any arguments like this: +NRPE 2.x includes native support for TCP wrappers. Once you +compile NRPE you can check to see if it has wrapper support +built in by running the daemon from the command line without +any arguments like this: ./nrpe --help - - -COMMAND ARGUMENTS -================= +#### COMMAND ARGUMENTS #### NRPE 2.0 includes the ability for clients to supply arguments to commands which should be run. Please note that this feature @@ -27,60 +22,55 @@ should be considered a security risk, and you should only use it if you know what you're doing! -BASH COMMAND SUBSTITUTION -------------------------- +#### BASH COMMAND SUBSTITUTION #### Even with the metacharacter restrictions below, if command arguments -are enabled, it is still possible to send bash command substitions -in the form $(...) as an agrument. This is explicity disabled by +are enabled, it is still possible to send bash command substitutions +in the form `$(...)` as an argument. This is explicitly disabled by default, but can be enabled by a configure-time option and a -configuration file option. Enabling this option is VERY RISKY and -its use is HIGHLY DISCOURAGED. +configuration file option. Enabling this option is **VERY RISKY** +and its use is **HIGHLY DISCOURAGED**. -ENABLING ARGUMENTS ------------------- +#### ENABLING ARGUMENTS #### To enable support for command argument in the daemon, you must do two things: - 1. Run the configure script with the --enable-command-args + 1. Run the configure script with the `--enable-command-args` option - 2. Set the 'dont_blame_nrpe' directive in the NRPE config - file to 1. + 2. Set the `dont_blame_nrpe` directive in the NRPE config + file to `1`. -ENABLING BASH COMMAND SUBSTITUTION ----------------------------------- +#### ENABLING BASH COMMAND SUBSTITUTION #### To enable support for arguments containing bash command substitions, you must do two things: 1. Enable arguments as described above - 2. Include the --enable-bash-command-substitution configure + 2. Include the `--enable-bash-command-substitution` configure option when running the configure script - 3. Set the 'allow_bash_command_substitutions' directive in the - NRPE config file to 1. + 3. Set the `allow_bash_command_substitutions` directive in the + NRPE config file to `1`. -ILLEGAL METACHARS ------------------ +#### ILLEGAL METACHARS #### To help prevent some nasty things from being done by evil clients, the following metacharacters are not allowed in client command arguments: - | ` & > < ' " \ [ ] { } ; ! + | ` & > < ' " \ [ ] { } ; ! -Any client request which contains the abovementioned metachars +Any client request which contains the above mentioned metachars is discarded. -USER/GROUP RESTRICTIONS ------------------------ +#### USER/GROUP RESTRICTIONS #### The NRPE daemon cannot be run with (effective) root user/group privileges. You must run the daemon with an account that does @@ -89,21 +79,19 @@ directives in the config file to specify which user/group the daemon should run as. -ENCRYPTION ----------- +#### ENCRYPTION #### If you do enable support for command arguments in the NRPE daemon, make sure that you encrypt communications either by using: 1. Stunnel (see http://www.stunnel.org for more info) - 2. Native SSL support + 2. Native SSL support (See the `README.SSL.md` file for more info) -Do NOT assume that just because the daemon is behind a firewall +*Do NOT* assume that just because the daemon is behind a firewall that you are safe! Always encrypt NRPE traffic! -USING ARGUMENTS ---------------- +#### USING ARGUMENTS #### How do you use command arguments? Well, lets say you define a command in the NRPE config file that looks like this: @@ -123,9 +111,3 @@ like this: You can supply up to 16 arguments to be passed to the command for substitution in $ARG$ macros ($ARG1$ - $ARG16$). - - - - - -- Ethan Galstad (nagios@nagios.org) - diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..2eef4cb --- /dev/null +++ b/THANKS @@ -0,0 +1,43 @@ +Alex Weber +Andrea Morgan-Brist +Andrew Boyce-Lewis +Andrew Ryder +Andrew Widdersheim +Bartosz Woronicz +Bill Mitchell +Bjoern Beutel +Brian Seklecki +Derrick Bennett +Eric Mislivec +Eric Stanley +Gerhard Lausser +Graham Collinson +Grant Byers +GrĂ©gory Starck +James Peterson +Jari Takkala +Jason Cook +John Maag +Jon Andrews +Kaspersky Lab +Kevin Pendleton +Konstantin Malov +Krzysztof Oledzki +Leo Baltus +Mark Plaksin +Matthew L. Daniel +Matthias Flacke +Niels Endres +Patric Wust +Peter Palfrader +Rene Klootwijk +Robert Peaslee +Ryan McGarry +Ryan Ordway +Sean Finney +Spenser Reinhardt +Subhendu Ghosh +Thierry Bertaud +Ton Voon +Vadim Antipov +jaclu@grm.se diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100755 index 0000000..c64786b --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,7 @@ +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]) diff --git a/config.guess b/build-aux/config.guess similarity index 69% rename from config.guess rename to build-aux/config.guess index 17690ae..eab94e2 100755 --- a/config.guess +++ b/build-aux/config.guess @@ -1,13 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2006-01-02' +timestamp='2014-11-04' # This file 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 +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -16,26 +15,22 @@ timestamp='2006-01-02' # 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, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches to . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -55,8 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -106,7 +100,7 @@ set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; @@ -138,12 +132,43 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -160,6 +185,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -168,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -178,7 +204,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -199,21 +225,25 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-${VENDOR}-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) - echo powerppc-unknown-mirbsd${UNAME_RELEASE} + echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in @@ -221,7 +251,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -267,7 +297,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -278,13 +311,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 + echo m68k-${VENDOR}-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos + echo ${UNAME_MACHINE}-${VENDOR}-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos + echo ${UNAME_MACHINE}-${VENDOR}-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -293,13 +326,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-${VENDOR}-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp @@ -322,14 +355,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -373,23 +425,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-${VENDOR}-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -459,8 +511,8 @@ EOF echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -473,7 +525,7 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -530,15 +582,16 @@ EOF echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[45]) + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -573,52 +626,52 @@ EOF 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include - #include + #define _HPUX_SOURCE + #include + #include - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -638,7 +691,7 @@ EOF # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null + grep -q __LP64__ then HP_ARCH="hppa2.0w" else @@ -699,9 +752,9 @@ EOF exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk + echo ${UNAME_MACHINE}-${VENDOR}-osf1mk else - echo ${UNAME_MACHINE}-unknown-osf1 + echo ${UNAME_MACHINE}-${VENDOR}-osf1 fi exit ;; parisc*:Lites*:*:*) @@ -709,22 +762,22 @@ EOF exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -748,51 +801,70 @@ EOF exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} + echo sparc-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; - i*:MINGW*:*) + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + *:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - x86:Interix*:[345]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-${VENDOR}-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-${VENDOR}-interix${UNAME_RELEASE} + exit ;; + esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -803,92 +875,31 @@ EOF echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin + echo x86_64-${VENDOR}-cygwin exit ;; p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin + echo powerpcle-${VENDOR}-cygwin exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -899,99 +910,132 @@ EOF EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-${LIBC}"; exit; } + ;; + openrisc*:Linux:*:*) + echo or1k-${VENDOR}-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-${VENDOR}-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-${VENDOR}-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux-${LIBC} ;; + PA8*) echo hppa2.0-${VENDOR}-linux-${LIBC} ;; + *) echo hppa-${VENDOR}-linux-${LIBC} ;; esac exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-${VENDOR}-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-${VENDOR}-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-${VENDOR}-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-${VENDOR}-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -999,11 +1043,11 @@ EOF echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1012,16 +1056,16 @@ EOF echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop + echo ${UNAME_MACHINE}-${VENDOR}-stop exit ;; i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos + echo ${UNAME_MACHINE}-${VENDOR}-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-${VENODR}-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp @@ -1035,13 +1079,13 @@ EOF fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + echo ${UNAME_MACHINE}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then @@ -1063,10 +1107,13 @@ EOF exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1077,7 +1124,7 @@ EOF if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + echo i860-${VENODR}-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) @@ -1101,22 +1148,32 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} + echo m68k-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} + echo sparc-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} + echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} @@ -1135,10 +1192,10 @@ EOF echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -1164,11 +1221,11 @@ EOF exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-${VENDOR}-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1178,6 +1235,12 @@ EOF BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-${VENDOR}-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1187,6 +1250,15 @@ EOF SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1195,9 +1267,31 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1211,7 +1305,10 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1235,13 +1332,13 @@ EOF else UNAME_MACHINE="$cputype" fi - echo ${UNAME_MACHINE}-unknown-plan9 + echo ${UNAME_MACHINE}-${VENDOR}-plan9 exit ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 + echo pdp10-${VENDOR}-tops10 exit ;; *:TENEX:*:*) - echo pdp10-unknown-tenex + echo pdp10-${VENDOR}-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 @@ -1250,19 +1347,19 @@ EOF echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 + echo pdp10-${VENDOR}-tops20 exit ;; *:ITS:*:*) - echo pdp10-unknown-its + echo pdp10-${VENDOR}-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + echo ${UNAME_MACHINE}-${VENDOR}-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1277,159 +1374,14 @@ EOF i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 <. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -71,8 +68,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -119,12 +115,18 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -147,10 +149,13 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; + -bluegene*) + os=-cnk + ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -165,10 +170,10 @@ case $os in os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -213,6 +218,12 @@ case $os in -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -237,59 +248,90 @@ case $basic_machine in # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | epiphany \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ - | mips64vr | mips64vrel \ + | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | moxie \ | mt \ | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | riscv32 | riscv64 \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) basic_machine=$basic_machine-unknown ;; - m32c) - basic_machine=$basic_machine-unknown + c54x) + basic_machine=tic54x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -299,6 +341,21 @@ case $basic_machine in basic_machine=mt-unknown ;; + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -313,65 +370,87 @@ case $basic_machine in # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ + | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ | tron-* \ - | v850-* | v850e-* | vax-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-*) + | z8k-* | z80-*) ;; - m32c-*) + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -389,7 +468,7 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -435,6 +514,10 @@ case $basic_machine in basic_machine=m68k-apollo os=-bsd ;; + aros) + basic_machine=i386-pc + os=-aros + ;; aux) basic_machine=m68k-apple os=-aux @@ -443,10 +526,35 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -475,8 +583,8 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16c) - basic_machine=cr16c-unknown + cr16 | cr16-*) + basic_machine=cr16-unknown os=-elf ;; crds | unos) @@ -514,6 +622,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp @@ -629,7 +741,6 @@ case $basic_machine in i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -668,6 +779,17 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -679,10 +801,21 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -704,6 +837,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -711,10 +848,18 @@ case $basic_machine in ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i686-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -779,6 +924,12 @@ case $basic_machine in np1) basic_machine=np1-gould ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -809,6 +960,14 @@ case $basic_machine in basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; @@ -853,9 +1012,10 @@ case $basic_machine in ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -880,7 +1040,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -910,6 +1074,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux @@ -921,6 +1089,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -942,6 +1113,9 @@ case $basic_machine in basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -998,17 +1172,9 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown @@ -1077,6 +1243,9 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1085,6 +1254,10 @@ case $basic_machine in basic_machine=z8k-unknown os=-sim ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -1123,10 +1296,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sparc | sparcv8 | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) @@ -1170,9 +1343,12 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1193,29 +1369,31 @@ case $os in # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1254,7 +1432,7 @@ case $os in -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1303,7 +1481,7 @@ case $os in -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1339,12 +1517,14 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; -none) ;; *) @@ -1367,6 +1547,12 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1376,9 +1562,24 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff - ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1397,13 +1598,13 @@ case $basic_machine in ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1428,7 +1629,7 @@ case $basic_machine in *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) @@ -1533,7 +1734,7 @@ case $basic_machine in -sunos*) vendor=sun ;; - -aix*) + -cnk*|-aix*) vendor=ibm ;; -beos*) diff --git a/build-aux/custom_help.m4 b/build-aux/custom_help.m4 new file mode 100755 index 0000000..80c4f88 --- /dev/null +++ b/build-aux/custom_help.m4 @@ -0,0 +1,131 @@ +# _AC_INIT_HELP +# ------------- +# Handle the `configure --help' message. +m4_define([_AC_INIT_HELP], +[m4_divert_push([HELP_BEGIN])dnl + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures m4_ifset([AC_PACKAGE_STRING], + [AC_PACKAGE_STRING], + [this package]) to adapt to many kinds of systems. + +Usage: $[0] [[OPTION]]... [[VAR=VALUE]]... + +[To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [/usr/local/nagios] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`/usr/local/nagios/bin', \`/usr/local/nagios/lib' etc. You can specify +an installation prefix other than \`/usr/local/nagios' using \`--prefix', +for instance \`--prefix=$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR plugins, brokers, CGI [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR r/o arch.-independent data [DATAROOTDIR/PKG_NAME] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] +_ACEOF + + cat <<\_ACEOF] +m4_divert_pop([HELP_BEGIN])dnl +dnl The order of the diversions here is +dnl - HELP_BEGIN +dnl which may be extended by extra generic options such as with X or +dnl AC_ARG_PROGRAM. Displayed only in long --help. +dnl +dnl - HELP_CANON +dnl Support for cross compilation (--build, --host and --target). +dnl Display only in long --help. +dnl +dnl - HELP_ENABLE +dnl which starts with the trailer of the HELP_BEGIN, HELP_CANON section, +dnl then implements the header of the non generic options. +dnl +dnl - HELP_WITH +dnl +dnl - HELP_VAR +dnl +dnl - HELP_VAR_END +dnl +dnl - HELP_END +dnl initialized below, in which we dump the trailer (handling of the +dnl recursion for instance). +m4_divert_push([HELP_ENABLE])dnl +_ACEOF +fi + +if test -n "$ac_init_help"; then +m4_ifset([AC_PACKAGE_STRING], +[ case $ac_init_help in + short | recursive ) echo "Configuration of AC_PACKAGE_STRING:";; + esac]) + cat <<\_ACEOF +m4_divert_pop([HELP_ENABLE])dnl +m4_divert_push([HELP_END])dnl + +Report bugs to m4_ifset([AC_PACKAGE_BUGREPORT], [], + [the package provider]).dnl +m4_ifdef([AC_PACKAGE_NAME], [m4_ifset([AC_PACKAGE_URL], [ +AC_PACKAGE_NAME home page: .])dnl +m4_if(m4_index(m4_defn([AC_PACKAGE_NAME]), [GNU ]), [0], [ +General help using GNU software: .])]) +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + _AC_SRCDIRS(["$ac_dir"]) + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + AC_MSG_WARN([no configuration information is in $ac_dir]) + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +m4_divert_pop([HELP_END])dnl +])# _AC_INIT_HELP diff --git a/build-aux/install-sh b/build-aux/install-sh new file mode 100755 index 0000000..0b0fdcb --- /dev/null +++ b/build-aux/install-sh @@ -0,0 +1,501 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2013-12-25.23; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/configure b/configure index 6b9795c..a5dc351 100755 --- a/configure +++ b/configure @@ -1,83 +1,462 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for nrpe 2.15. +# Generated by GNU Autoconf 2.69 for nrpe 3.0.1. # # Report bugs to . # -# Copyright (C) 2003 Free Software Foundation, Inc. +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset + setopt NO_GLOB_SUBST else - as_unset=false + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: nagios-users@lists.sourceforge.net about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` - -# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -85,146 +464,91 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" # Exit status is that of the last command. exit } - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -233,91 +557,234 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -exec 6>&1 - # # Initializations. # ac_default_prefix=/usr/local +ac_clean_files= ac_config_libobj_dir=. +LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='nrpe' PACKAGE_TARNAME='nrpe' -PACKAGE_VERSION='2.15' -PACKAGE_STRING='nrpe 2.15' +PACKAGE_VERSION='3.0.1' +PACKAGE_STRING='nrpe 3.0.1' PACKAGE_BUGREPORT='nagios-users@lists.sourceforge.net' +PACKAGE_URL='https://www.nagios.org/downloads/nagios-core-addons/' ac_unique_file="src/nrpe.c" ac_default_prefix=/usr/local/nagios # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include -#else -# if HAVE_STDINT_H -# include -# endif #endif -#if HAVE_UNISTD_H +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PKG_NAME PKG_VERSION PKG_HOME_URL PKG_REL_DATE RPM_RELEASE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE CPP EGREP SNPRINTF_O OTHERLIBS SOCKETLIBS LIBWRAPLIBS HAVE_SSL log_facility nrpe_user nrpe_group NRPE_INSTALL_OPTS nrpe_port nagios_user nagios_group NAGIOS_INSTALL_OPTS TARGET_VER TARGET_OS TARGET_ARCH TARGET_PLATFORM PERL LIBOBJS LTLIBOBJS' +ac_subst_vars='PERL +sslbin +PKG_CONFIG +SSL_LIB_DIR +SSL_INC_PREFIX +SSL_HDR +SSL_INC_DIR +HAVE_SSL +EGREP +GREP +CPP +SET_MAKE +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +CFLAGS +CC +LTLIBOBJS +LIBOBJS +bsd_enable +src_tmpfile +src_inetd +src_init +subsyslockfile +subsyslockdir +tmpfilesd +inetddir +initdir +spooldir +pipedir +piddir +logdir +pkglocalstatedir +privatesysconfdir +webdir +cgibindir +brokersdir +pluginsdir +inetdname +initname +objsysconfdir +pkgsysconfdir +inetd_type +init_type +dist_ver +dist_type +arch +opsys +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +TARGET_PLATFORM +TARGET_ARCH +TARGET_OS +TARGET_VER +NAGIOS_INSTALL_OPTS +nagios_group +nagios_user +nrpe_port +nrpe_group +nrpe_user +log_facility +NRPE_INSTALL_OPTS +LIBWRAPLIBS +SOCKETLIBS +OTHERLIBS +LDFLAGS +SNPRINTF_O +INSTALL +RPM_RELEASE +PKG_REL_DATE +PKG_HOME_URL +PKG_VERSION +PKG_NAME +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' +ac_user_opts=' +enable_option_checking +with_opsys +with_dist_type +with_init_type +with_inetd_type +enable_install_method +enable_showdirs_only +with_pkgsysconfdir +with_objsysconfdir +with_privatesysconfdir +with_webdir +with_pluginsdir +with_brokersdir +with_cgibindir +with_logdir +with_piddir +with_pipedir +enable_ssl +with_ssl +with_ssl_inc +with_ssl_lib +with_kerberos_inc +with_log_facility +with_nrpe_user +with_nrpe_group +with_nrpe_port +with_nagios_user +with_nagios_group +enable_command_args +enable_bash_command_substitution +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + # Initialize some variables set by options. ac_init_help= ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -340,34 +807,49 @@ x_libraries=NONE # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' +datarootdir='${prefix}/share' +datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' ac_prev= +ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" + eval $ac_prev=\$ac_option ac_prev= continue fi - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -389,33 +871,59 @@ do --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) + -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; esac - eval "enable_$ac_feature='$ac_optarg'" ;; + eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -442,6 +950,12 @@ do -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; @@ -466,13 +980,16 @@ do | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -537,6 +1054,16 @@ do | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; @@ -587,26 +1114,36 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; esac - eval "with_$ac_package='$ac_optarg'" ;; + eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. @@ -626,27 +1163,26 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -654,31 +1190,36 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" fi -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac -done +fi -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir do - eval ac_val=$`echo $ac_var` + eval ac_val=\$$ac_var + # Remove trailing slashes. case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -692,8 +1233,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -705,74 +1244,72 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then + if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done # # Report the --help message. @@ -781,7 +1318,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures nrpe 2.15 to adapt to many kinds of systems. +\`configure' configures nrpe 3.0.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -795,60 +1332,62 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] -_ACEOF - - cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [/usr/local/nagios] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. +\`/usr/local/nagios/bin', \`/usr/local/nagios/lib' etc. You can specify +an installation prefix other than \`/usr/local/nagios' using \`--prefix', +for instance \`--prefix=$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR plugins, brokers, CGI [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR r/o arch.-independent data [DATAROOTDIR/PKG_NAME] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] _ACEOF cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of nrpe 2.15:";; + short | recursive ) echo "Configuration of nrpe 3.0.1:";; esac cat <<\_ACEOF Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-install-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 + --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. --enable-ssl enables native SSL support --enable-command-args allows clients to specify command arguments. *** THIS IS A SECURITY RISK! *** Read the SECURITY file @@ -862,6 +1401,26 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-opsys=OS specify operating system (linux, osx, bsd, solaris, + irix, cygwin, aix, hp-ux, etc.) + --with-dist-type=type specify distribution type (suse, rh, debian, etc.) + --with-init-type=type specify init type (bsd, sysv, systemd, launchd, + smf10, smf11, upstart, openrc, etc.) + --with-inetd-type=type which super-server the system runs (inetd, xinetd, + systemd, launchd, smf10, smf11, etc.) + --with-pkgsysconfdir=DIR + where configuration files should be placed + --with-objsysconfdir=DIR + where object configuration files should be placed + --with-privatesysconfdir=DIR + where private configuration files should be placed + --with-webdir=DIR where the website files should be placed + --with-pluginsdir=DIR where the plugins should be placed + --with-brokersdir=DIR where the broker modules should be placed + --with-cgibindir=DIR where the CGI programs should be placed + --with-logdir=DIR where log files should be placed + --with-piddir=DIR where the PID file should be placed + --with-pipedir=DIR where socket and pipe files should be placed --with-ssl=DIR sets location of the SSL installation --with-ssl-inc=DIR sets location of the SSL include files --with-ssl-lib=DIR sets location of the SSL libraries @@ -882,129 +1441,691 @@ Some influential environment variables: CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . +nrpe home page: . _ACEOF +ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. - ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue ac_builddir=. -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } done fi -test -n "$ac_init_help" && exit 0 +test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -nrpe configure 2.15 -generated by GNU Autoconf 2.59 +nrpe configure 3.0.1 +generated by GNU Autoconf 2.69 -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF - exit 0 + exit fi -exec 5>config.log -cat >&5 <<_ACEOF + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ------------------------------------------------- ## +## Report this to nagios-users@lists.sourceforge.net ## +## ------------------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 &5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by nrpe $as_me 2.15, which was -generated by GNU Autoconf 2.59. Invocation command line was +It was created by nrpe $as_me 3.0.1, which was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF +exec 5>>config.log { cat <<_ASUNAME ## --------- ## @@ -1023,7 +2144,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` @@ -1035,8 +2156,9 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS } >&5 @@ -1058,7 +2180,6 @@ _ACEOF ac_configure_args= ac_configure_args0= ac_configure_args1= -ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -1069,13 +2190,13 @@ do -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -1091,104 +2212,115 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, -{ +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} + esac | + sort +) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" echo for ac_var in $ac_subst_files do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo - sed "/^$/d" confdefs.h | sort + cat confdefs.h echo fi test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status - ' 0 +' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. @@ -1196,42 +2328,57 @@ cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + # Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -1239,53 +2386,63 @@ done # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do +for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1295,72 +2452,75 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - - ac_config_headers="$ac_config_headers include/config.h" - - ac_config_files="$ac_config_files Makefile subst src/Makefile package/solaris/Makefile init-script init-script.debian init-script.suse nrpe.spec sample-config/nrpe.cfg sample-config/nrpe.xinetd" - - - -PKG_NAME=nrpe -PKG_VERSION="2.15" -PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="09-06-2013" -RPM_RELEASE=1 - - - - - - ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then +for ac_dir in build-aux "$srcdir"/build-aux; do + if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break - elif test -f $ac_dir/install.sh; then + elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break - elif test -f $ac_dir/shtool; then + elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5 fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + + +PKG_NAME=nrpe +PKG_VERSION="3.0.1" +PKG_HOME_URL="http://www.nagios.org/" +PKG_REL_DATE="09-08-2016" +RPM_RELEASE=1 + +LANG=C +LC_ALL=C +LC_COLLATE=C +LC_CTYPE=C +LC_MESSAGES=C +LC_MONETARY=C +LC_NUMERIC=C +LC_TIME=C + + + + + + + + + + + + + + + + + + + + + + + + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -1375,22 +2535,23 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -1398,7 +2559,7 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -1408,30 +2569,43 @@ case $as_dir/ in # program-specific install script used by HP pwplus--don't use. : else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi fi fi done done ;; esac -done + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is - # removed, or if the path is relative. + # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -1443,60 +2617,2350 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + + + +# +# Get user hints +# + { $as_echo "$as_me:${as_lineno-$LINENO}: checking what the operating system is " >&5 +$as_echo_n "checking what the operating system is ... " >&6; } + +# Check whether --with-opsys was given. +if test "${with_opsys+set}" = set; then : + withval=$with_opsys; + # + # 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" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $opsys" >&5 +$as_echo "$opsys" >&6; } + fi + else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } + + # + # Run this if --with was not specified + # + opsys_wanted=yes fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test x$opsys = xno; then + opsys="" + opsys_wanted=yes + elif test x$opsys = xyes; then + as_fn_error $? "you must enter an O/S type if '--with-opsys' is specified" "$LINENO" 5 + 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 + case $opsys in #( + 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" ;; #( + *) : + ;; +esac + fi + + arch=`uname -m | tr "[A-Z]" "[a-z]"` + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $opsys" >&5 +$as_echo "$opsys" >&6; } + + + + + + +# +# Get user hints for possible cross-compile +# + { $as_echo "$as_me:${as_lineno-$LINENO}: checking what the distribution type is " >&5 +$as_echo_n "checking what the distribution type is ... " >&6; } + +# Check whether --with-dist-type was given. +if test "${with_dist_type+set}" = set; then : + withval=$with_dist_type; + # + # 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" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dist_type" >&5 +$as_echo "$dist_type" >&6; } + fi + else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } + + # + # Run this if --with was not specified + # + dist_type_wanted=yes fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + if test x$dist_type = xno; then + dist_type_wanted=yes + elif test x$dist_type = xyes; then + as_fn_error $? "you must enter a distribution type if '--with-dist-type' is specified" "$LINENO" 5 + 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" + case $opsys in #( + bsd) : + dist_type=`uname -s | tr "A-Z" "a-z"` + dist_ver=`uname -r` ;; #( + aix|hp-ux) : + dist_ver=$OSTYPE ;; #( + solaris) : + dist_ver=`echo $OSTYPE | cut -d'.' -f2` ;; #( + *) : + dist_ver=$OSTYPE + ;; #( + *) : + ;; +esac + + 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 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dist_type" >&5 +$as_echo "$dist_type" >&6; } + + + + + +# +# Get user hints for possible cross-compile +# + { $as_echo "$as_me:${as_lineno-$LINENO}: checking what init system is being used " >&5 +$as_echo_n "checking what init system is being used ... " >&6; } + +# Check whether --with-init_type was given. +if test "${with_init_type+set}" = set; then : + withval=$with_init_type; + # + # 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" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $init_type" >&5 +$as_echo "$init_type" >&6; } + fi + +else + + # + # Run this if --with was not specified + # + init_type_wanted=yes + +fi + + + if test x$init_type = xno; then + init_type_wanted=yes + elif test x$init_type = xyes; then + as_fn_error $? "you must enter an init type if '--with-init-type' is specified" "$LINENO" 5 + 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 + fi + fi + + PSCMD="ps -p1 -o args" + case $dist_type in #( + aix) : + PSCMD="env UNIX95=1; ps -p1 -o args" ;; #( + solaris) : + PSCMD="env UNIX95=1; ps -p1 -o args" ;; #( + hp-ux) : + PSCMD="env UNIX95=1; ps -p1 -o args" ;; #( + *) : + ;; +esac + + 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 `/sbin/init --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 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $init_type" >&5 +$as_echo "$init_type" >&6; } + + + + + +# +# Get user hints for possible cross-compile +# + { $as_echo "$as_me:${as_lineno-$LINENO}: checking what inetd is being used " >&5 +$as_echo_n "checking what inetd is being used ... " >&6; } + +# Check whether --with-inetd_type was given. +if test "${with_inetd_type+set}" = set; then : + withval=$with_inetd_type; + 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" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $inetd_type" >&5 +$as_echo "$inetd_type" >&6; } + fi + +else + + # + # Run this if --with was not specified + # + inetd_type_wanted=yes + +fi + + + if test x$inetd_type = xno; then + inetd_type_wanted=yes + elif test x$inetd_type = xyes; then + as_fn_error $? "you must enter an inetd type if '--with-inetd-type' is specified" "$LINENO" 5 + fi + + # + # Determine inetd type if it wasn't supplied + # + if test $inetd_type_wanted = yes; then + + inetd_disabled="" + + if test x"$init_type" = "xupstart"; then + inetd_type="upstart" + elif test "$opsys" = "osx"; then + inetd_type="launchd" + fi + + if test x"$inetd_type" = x; then + case $dist_type in #( + 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` ;; #( + 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` ;; #( + *) : + ;; +esac + fi + + 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" = "xsystemd"; then + inetd_type="systemd" + else + inetd_type="unknown" + fi + fi + + if test -n "$inetd_disabled"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $inetd_type $inetd_disabled" >&5 +$as_echo "$inetd_type $inetd_disabled" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $inetd_type" >&5 +$as_echo "$inetd_type" >&6; } + fi + fi + + + + + + + + + + + + + + + + + + + + + + + + +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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which paths to use " >&5 +$as_echo_n "checking for which paths to use ... " >&6; } + +# Check whether --enable-install_method was given. +if test "${enable_install_method+set}" = set; then : + enableval=$enable_install_method; install_method=$enableval +else + install_method=default + +fi + + +# Check whether --enable-showdirs_only was given. +if test "${enable_showdirs_only+set}" = set; then : + enableval=$enable_showdirs_only; showdirs_only=$enableval +else + showdirs_only=no + +fi + + +case $install_method in #( + yes) : + install_method="os" ;; #( + no) : + install_method="default" ;; #( + default|os) : + : ;; #( + *) : + echo >&6; as_fn_error $? "'--enable-install-method=$install_method' is invalid" "$LINENO" 5 + ;; #( + *) : + ;; +esac + +if test $showdirs_only != "no"; then showdirs_only="yes"; fi + +case $dist_type in #( + *solaris*|*hp-ux*|*aix*|*osx*) : + opsys=unix ;; #( + *) : + ;; +esac + + +need_cgi=no +need_web=no +need_brk=no +need_plg=no +need_pipe=no +need_spl=no +need_loc=no +need_log_subdir=no +need_etc_subdir=no +need_pls_dir=no + +case $PKG_NAME in #( + 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_spl=yes ;; #( + nrpe) : + need_plg=yes ;; #( + nsca) : + need_cgi=no ;; #( + plugins) : + need_loc=yes + need_plg=yes + ;; #( + *) : + ;; +esac + + +# Check whether --with-pkgsysconfdir was given. +if test "${with_pkgsysconfdir+set}" = set; then : + withval=$with_pkgsysconfdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + pkgsysconfdir="$withval" + fi +fi + + +# Check whether --with-objsysconfdir was given. +if test "${with_objsysconfdir+set}" = set; then : + withval=$with_objsysconfdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + objsysconfdir="$withval" + fi +fi + + +# Check whether --with-privatesysconfdir was given. +if test "${with_privatesysconfdir+set}" = set; then : + withval=$with_privatesysconfdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + privatesysconfdir="$withval" + fi +fi + + +# Check whether --with-webdir was given. +if test "${with_webdir+set}" = set; then : + withval=$with_webdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + webdir="$withval" + fi +fi + + +# Check whether --with-pluginsdir was given. +if test "${with_pluginsdir+set}" = set; then : + withval=$with_pluginsdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + pluginsdir="$withval" + fi +fi + + +# Check whether --with-brokersdir was given. +if test "${with_brokersdir+set}" = set; then : + withval=$with_brokersdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + brokersdir="$withval" + fi +fi + + +# Check whether --with-cgibindir was given. +if test "${with_cgibindir+set}" = set; then : + withval=$with_cgibindir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + cgibindir="$withval" + fi +fi + + +# Check whether --with-logdir was given. +if test "${with_logdir+set}" = set; then : + withval=$with_logdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + logdir="$withval" + fi +fi + + +# Check whether --with-piddir was given. +if test "${with_piddir+set}" = set; then : + withval=$with_piddir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + piddir="$withval" + fi +fi + + +# Check whether --with-pipedir was given. +if test "${with_pipedir+set}" = set; then : + withval=$with_pipedir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then + pipedir="$withval" + fi +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 { datadir=; unset datadir;}; fi + if test x"$sysconfdir" = x'${prefix}/etc'; then { sysconfdir=; 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/$PKG_NAME.conf" +fi +subsyslockdir=${subsyslockdir="/var/lock/subsys"} +if test ! -d "$subsyslockdir"; then + subsyslockdir="N/A" + subsyslockfile="N/A" +else + subsyslockfile="$subsyslockdir/$PKG_NAME" +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/$PKG_NAME"} + else + logdir=${logdir="$localstatedir/log"} + fi + piddir=${piddir="$localstatedir/run/${PKG_NAME}"} + if test "$need_pipe" = yes; then + pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + else + pipedir="N/A" + fi + if test "$need_pls_dir" = yes; then + pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"} + else + pkglocalstatedir="N/A" + fi + if test "$need_spl" = yes; then + spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"} + 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/$PKG_NAME"} + else + pkglocalstatedir="N/A" + fi + if test "$need_loc" = yes; then + localedir=${localedir="/usr/local/share/locale//LC_MESSAGES/nagios-plugins.mo"} + fi + if test "$need_spl" = yes; then + spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"} + 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 + case $dist_type in #( + *hp-ux*) : + piddir=${piddir="$pkgsysconfdir"} + pipedir=${pipedir="$pkglocalstatedir"} + logdir=${logdir="$pkglocalstatedir/log"} ;; #( + *) : + piddir=${piddir="$localstatedir/run/${PKG_NAME}"} + if test "$need_pipe" = yes; then + pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + else + pipedir="N/A" + fi + if test $need_log_subdir = yes; then + logdir=${logdir="$localstatedir/log/$PKG_NAME"} + else + logdir=${logdir="$localstatedir/log"} + fi + ;; #( + *) : + ;; +esac + +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/$PKG_NAME"} + else + pkglocalstatedir="N/A" + fi + if test "$need_loc" = yes; then + localedir=${localedir="/usr/local/share/locale//LC_MESSAGES/nagios-plugins.mo"} + fi + if test "$need_spl" = yes; then + spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"} + 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/${PKG_NAME}"} + if test "$need_pipe" = yes; then + pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + else + pipedir="N/A" + fi + if test $need_log_subdir = yes; then + logdir=${logdir="$localstatedir/log/$PKG_NAME"} + 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 pkglocalstatedir=$pkglocalstatedir +eval webdir=$webdir +eval localedir=$localedir +eval sysconfdir=$sysconfdir +eval pkgsysconfdir=$pkgsysconfdir +eval piddir=$piddir + +# +# Init scripts/files +# +case $init_type in #( + sysv) : + if test $dist_type = "hp-ux"; then + initdir=${initdir="/sbin/init.d"} + else + initdir=${initdir="/etc/init.d"} + fi + initname=${initname="$PKG_NAME"} + initconfdir=${initconfdir="/etc/conf.d"} + initconf=${initconf="$initconfdir/$PKG_NAME"} ;; #( + systemd) : + if test $dist_type = "debian"; then + initdir=${initdir="/lib/systemd/system"} + else + initdir=${initdir="/usr/lib/systemd/system"} + fi + initname=${initname="$PKG_NAME.service"} ;; #( + bsd) : + initdir=${initdir="/etc/rc.d"} + initname=${initname="rc.$PKG_NAME"} ;; #( + newbsd) : + initdir=${initdir="/etc/rc.d"} + initname=${initname="$PKG_NAME"} ;; #( + gentoo) : + initdir=${initdir="/etc/init.d"} + initname=${initname="$PKG_NAME"} + initconfdir=${initconfdir="/etc/init.d"} + initconf=${initconf="$initconfdir/$PKG_NAME"} ;; #( + openrc) : + initdir=${initdir="/etc/init.d"} + initname=${initname="$PKG_NAME"} + initconfdir=${initconfdir="/etc/conf.d"} + initconf=${initconf="$initconfdir/$PKG_NAME"} ;; #( + 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="$PKG_NAME.xml"} + initconfdir=unknown + initconf=unknown ;; #( + upstart) : + initdir=${initdir="/etc/init"} + initname=${initname="$PKG_NAME.conf"} + initconfdir=${initconfdir="/etc/default"} + initconf=${initconf="$initconfdir/$PKG_NAME"} ;; #( + launchd) : + initdir=${initdir="/Library/LaunchDaemons"} + initname=${initname="org.nagios.$PKG_NAME.plist"} ;; #( + # initconfdir=${initconfdir="/private/etc"} +# initconf=${initconf="$initconfdir/$PKG_NAME"}, + + + *) : + initdir=unknown + initname=unknown ;; #( + *) : + ;; +esac + +# +# Inetd (per connection) scripts/files +# +case $inetd_type in #( + inetd*) : + inetddir=${inetddir="/etc"} + inetdname=${inetdname="inetd.conf"} ;; #( + xinetd) : + inetddir=${inetddir="/etc/xinetd.d"} + inetdname=${inetdname="$PKG_NAME"} ;; #( + systemd) : + if test $dist_type = "debian"; then + inetddir=${inetddir="/lib/systemd/system"} + else + inetddir=${inetddir="/usr/lib/systemd/system"} + fi + netdname=${inetdname="$PKG_NAME.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="$PKG_NAME.xml"} ;; #( + # [upstart], +# inetddir=${inetddir="/etc/init.d"} +# inetdname=${inetdname="$PKG_NAME"}, + + launchd) : + inetddir=${inetddir="/Library/LaunchDaemons"} + inetdname=${inetdname="org.nagios.$PKG_NAME.plist"} ;; #( + *) : + inetddir=${inetddir="unknown"} + inetdname=${inetdname="unknown"} ;; #( + *) : + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $install_method" >&5 +$as_echo "$install_method" >&6; } + + + + + + + + +src_inetd="" +src_init="" +bsd_enable="" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which init file to use " >&5 +$as_echo_n "checking for which init file to use ... " >&6; } + +case $init_type in #( + 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" + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $src_init" >&5 +$as_echo "$src_init" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which inetd files to use " >&5 +$as_echo_n "checking for which inetd files to use ... " >&6; } + +if test x$src_inetd = x; then + + case $inetd_type in #( + inetd*) : + src_inetd=default-inetd ;; #( + xinetd) : + src_inetd=default-xinetd ;; #( + systemd) : + src_inetd=default-socket ;; #( + launchd) : + src_inetd="mac-inetd.plist" ;; #( + *) : + src_inetd="unknown" + ;; #( + *) : + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $src_inetd" >&5 +$as_echo "$src_inetd" >&6; } + + + +if test "$dist_type" = solaris -a "$dist_ver" != smf11; then + $as_echo "#define SOLARIS_10 yes" >>confdefs.h + +fi + +if test x${showdirs_only} = xyes; then + ac_config_files="$ac_config_files paths" + + + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by nrpe $as_me 3.0.1, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to . +nrpe home page: ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +nrpe config.status 3.0.1 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "paths") CONFIG_FILES="$CONFIG_FILES paths" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + chmod 755 paths + ./paths + exit 0 +fi + +ac_config_headers="$ac_config_headers include/config.h" + +ac_config_files="$ac_config_files Makefile src/Makefile nrpe.spec uninstall sample-config/nrpe.cfg startup/bsd-init startup/debian-init startup/default-init startup/default-inetd startup/default-service startup/default-socket startup/default-socket-svc startup/default-xinetd startup/mac-init.plist startup/mac-inetd.plist startup/newbsd-init startup/openbsd-init startup/openrc-conf startup/openrc-init startup/solaris-init.xml startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init startup/rh-upstart-init include/common.h" + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1506,10 +4970,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1519,35 +4983,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1557,39 +5023,50 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1599,77 +5076,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1680,18 +5117,19 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. @@ -1709,24 +5147,25 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1736,39 +5175,41 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1778,66 +5219,78 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$ac_ct_CC" && break done - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -1849,112 +5302,108 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. break;; * ) break;; esac done +test "$ac_cv_exeext" = no && ac_cv_exeext= + else - echo "$as_me: failed program was:" >&5 + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -1962,38 +5411,90 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext break;; * ) break;; esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2005,45 +5506,46 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi - rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2057,55 +5559,34 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no + ac_compiler_gnu=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2116,39 +5597,49 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -ac_cv_prog_cc_g=no +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -2164,23 +5655,18 @@ else CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_prog_cc_stdc=no + ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -2203,12 +5689,17 @@ static char *f (char * (*g) (char **, int), char **p, ...) /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get + as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ + that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2223,237 +5714,71 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; return 0; } _ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg fi -rm -f conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done -rm -f conftest.$ac_ext conftest.$ac_objext +rm -f conftest.$ac_ext CC=$ac_save_CC fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if test "x$ac_cv_prog_cc_c89" != xno; then : fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF +SHELL = /bin/sh all: - @echo 'ac_maketemp="$(MAKE)"' + @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac rm -f conftest.make fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } SET_MAKE= else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2464,15 +5789,15 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -2486,11 +5811,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2499,78 +5820,34 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : break fi @@ -2582,8 +5859,8 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -2593,11 +5870,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2606,85 +5879,40 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -2694,31 +5922,142 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -2733,51 +6072,23 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no + ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -2787,18 +6098,14 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -2808,16 +6115,13 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : : else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include +#include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) @@ -2837,54 +6141,35 @@ main () for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); + return 2; + return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -ac_cv_header_stdc=no +else + ac_cv_header_stdc=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + fi fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF +$as_echo "#define STDC_HEADERS 1" >>confdefs.h fi -echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 -if test "${ac_cv_header_time+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -2899,62 +6184,32 @@ return 0; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_time=no + ac_cv_header_time=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -echo "${ECHO_T}$ac_cv_header_time" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi -echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 -echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 -if test "${ac_cv_header_sys_wait_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if ${ac_cv_header_sys_wait_h+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) @@ -2970,112 +6225,31 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_sys_wait_h=no + ac_cv_header_sys_wait_h=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 +$as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_SYS_WAIT_H 1 -_ACEOF +$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -3083,174 +6257,64 @@ fi done - - - - - - - - - - - - - - - - - - - - - - - - - -for ac_header in ctype.h dirent.h errno.h fcntl.h getopt.h grp.h inttypes.h netdb.h pwd.h signal.h stdint.h strings.h string.h syslog.h tcpd.h unistd.h arpa/inet.h netinet/in.h socket.h sys/types.h sys/time.h sys/resource.h sys/wait.h sys/socket.h sys/stat.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------------- ## -## Report this to nagios-users@lists.sourceforge.net ## -## ------------------------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +for ac_header in ctype.h dirent.h errno.h fcntl.h getopt.h grp.h inttypes.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in netdb.h pwd.h signal.h stdint.h strings.h string.h syslog.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in tcpd.h unistd.h arpa/inet.h netinet/in.h socket.h sys/types.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in sys/time.h sys/resource.h sys/wait.h sys/socket.h sys/stat.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in paths.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default" +if test "x$ac_cv_header_paths_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PATHS_H 1 _ACEOF fi @@ -3258,29 +6322,25 @@ fi done -echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { -/* FIXME: Include the comments suggested by Paul. */ + #ifndef __cplusplus - /* Ultrix mips cc rejects this. */ + /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; - const charset x; + const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; + char const *const *pcpcc; + char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; @@ -3289,16 +6349,18 @@ main () an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; - ccp = &g + (g ? g-g : 0); + pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; - { /* SCO 3.2v4 cc rejects this. */ - char *t; + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; + if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; @@ -3310,71 +6372,43 @@ main () iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this saying + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; + if (!foo) return 0; } + return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_const=no + ac_cv_c_const=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -cat >>confdefs.h <<\_ACEOF -#define const -_ACEOF +$as_echo "#define const /**/" >>confdefs.h fi -echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 -echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 -if test "${ac_cv_struct_tm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 +$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } +if ${ac_cv_struct_tm+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3382,110 +6416,31 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -struct tm *tp; tp->tm_sec; +struct tm tm; + int *p = &tm.tm_sec; + return !p; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_struct_tm=sys/time.h + ac_cv_struct_tm=sys/time.h fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 -echo "${ECHO_T}$ac_cv_struct_tm" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 +$as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then -cat >>confdefs.h <<\_ACEOF -#define TM_IN_SYS_TIME 1 -_ACEOF +$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi -echo "$as_me:$LINENO: checking for mode_t" >&5 -echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 -if test "${ac_cv_type_mode_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((mode_t *) 0) - return 0; -if (sizeof (mode_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_mode_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" +if test "x$ac_cv_type_mode_t" = xyes; then : -ac_cv_type_mode_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 -echo "${ECHO_T}$ac_cv_type_mode_t" >&6 -if test $ac_cv_type_mode_t = yes; then - : else cat >>confdefs.h <<_ACEOF @@ -3494,64 +6449,9 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for pid_t" >&5 -echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 -if test "${ac_cv_type_pid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((pid_t *) 0) - return 0; -if (sizeof (pid_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_pid_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = xyes; then : -ac_cv_type_pid_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -echo "${ECHO_T}$ac_cv_type_pid_t" >&6 -if test $ac_cv_type_pid_t = yes; then - : else cat >>confdefs.h <<_ACEOF @@ -3560,157 +6460,62 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((size_t *) 0) - return 0; -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_size_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : -ac_cv_type_size_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 -if test $ac_cv_type_size_t = yes; then - : else cat >>confdefs.h <<_ACEOF -#define size_t unsigned +#define size_t unsigned int _ACEOF fi -echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 -if test "${ac_cv_type_signal+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } +if ${ac_cv_type_signal+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#ifdef signal -# undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif int main () { -int i; +return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_signal=void +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_signal=int else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_signal=int + ac_cv_type_signal=void fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -echo "${ECHO_T}$ac_cv_type_signal" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF -echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 -echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 -if test "${ac_cv_type_uid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +$as_echo_n "checking for uid_t in sys/types.h... " >&6; } +if ${ac_cv_type_uid_t+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then + $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no @@ -3718,37 +6523,29 @@ fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 -echo "${ECHO_T}$ac_cv_type_uid_t" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 +$as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then -cat >>confdefs.h <<\_ACEOF -#define uid_t int -_ACEOF +$as_echo "#define uid_t int" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define gid_t int -_ACEOF +$as_echo "#define gid_t int" >>confdefs.h fi -echo "$as_me:$LINENO: checking type of array argument to getgroups" >&5 -echo $ECHO_N "checking type of array argument to getgroups... $ECHO_C" >&6 -if test "${ac_cv_type_getgroups+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5 +$as_echo_n "checking type of array argument to getgroups... " >&6; } +if ${ac_cv_type_getgroups+:} false; then : + $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : ac_cv_type_getgroups=cross else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Mike Rendell for this test. */ -#include +$ac_includes_default #define NGID 256 #undef MAX #define MAX(x, y) ((x) > (y) ? (x) : (y)) @@ -3758,7 +6555,7 @@ main () { gid_t gidset[NGID]; int i, n; - union { gid_t gval; long lval; } val; + union { gid_t gval; long int lval; } val; val.lval = -1; for (i = 0; i < NGID; i++) @@ -3766,44 +6563,28 @@ main () n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, gidset); /* Exit non-zero if getgroups seems to require an array of ints. This - happens when gid_t is short but getgroups modifies an array of ints. */ - exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); + happens when gid_t is short int but getgroups modifies an array + of ints. */ + return n > 0 && gidset[n] != val.gval; } _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_run "$LINENO"; then : ac_cv_type_getgroups=gid_t else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_getgroups=int +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi -( exit $ac_status ) -ac_cv_type_getgroups=int -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi if test $ac_cv_type_getgroups = cross; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then + $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then : ac_cv_type_getgroups=gid_t else ac_cv_type_getgroups=int @@ -3812,8 +6593,8 @@ rm -f conftest* fi fi -echo "$as_me:$LINENO: result: $ac_cv_type_getgroups" >&5 -echo "${ECHO_T}$ac_cv_type_getgroups" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_getgroups" >&5 +$as_echo "$ac_cv_type_getgroups" >&6; } cat >>confdefs.h <<_ACEOF #define GETGROUPS_T $ac_cv_type_getgroups @@ -3821,1307 +6602,109 @@ _ACEOF -echo "$as_me:$LINENO: checking for int" >&5 -echo $ECHO_N "checking for int... $ECHO_C" >&6 -if test "${ac_cv_type_int+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if ${ac_cv_sizeof_int+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((int *) 0) - return 0; -if (sizeof (int)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_int=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : -ac_cv_type_int=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 -echo "${ECHO_T}$ac_cv_type_int" >&6 - -echo "$as_me:$LINENO: checking size of int" >&5 -echo $ECHO_N "checking size of int... $ECHO_C" >&6 -if test "${ac_cv_sizeof_int+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_int" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_int=0 + fi fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } -ac_lo= ac_hi= -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; -test_array [0] = 0 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr '(' $ac_mid ')' + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_int=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (int), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (int)); } -unsigned long ulongval () { return (long) (sizeof (int)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (int))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (int)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (int)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_int=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (int), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -rm -f conftest.val -else - ac_cv_sizeof_int=0 -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 -echo "${ECHO_T}$ac_cv_sizeof_int" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF -echo "$as_me:$LINENO: checking for short" >&5 -echo $ECHO_N "checking for short... $ECHO_C" >&6 -if test "${ac_cv_type_short+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 +$as_echo_n "checking size of short... " >&6; } +if ${ac_cv_sizeof_short+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((short *) 0) - return 0; -if (sizeof (short)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_short=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : -ac_cv_type_short=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 -echo "${ECHO_T}$ac_cv_type_short" >&6 - -echo "$as_me:$LINENO: checking size of short" >&5 -echo $ECHO_N "checking size of short... $ECHO_C" >&6 -if test "${ac_cv_sizeof_short+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_short" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (short) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_short=0 + fi fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +$as_echo "$ac_cv_sizeof_short" >&6; } -ac_lo= ac_hi= -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; -test_array [0] = 0 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr '(' $ac_mid ')' + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_short=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (short), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (short)); } -unsigned long ulongval () { return (long) (sizeof (short)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (short))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (short)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (short)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_short=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (short), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -rm -f conftest.val -else - ac_cv_sizeof_short=0 -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 -echo "${ECHO_T}$ac_cv_sizeof_short" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF -echo "$as_me:$LINENO: checking for long" >&5 -echo $ECHO_N "checking for long... $ECHO_C" >&6 -if test "${ac_cv_type_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if ${ac_cv_sizeof_long+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((long *) 0) - return 0; -if (sizeof (long)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_long=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : -ac_cv_type_long=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 -echo "${ECHO_T}$ac_cv_type_long" >&6 - -echo "$as_me:$LINENO: checking size of long" >&5 -echo $ECHO_N "checking size of long... $ECHO_C" >&6 -if test "${ac_cv_sizeof_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long" = yes; then - # The cast to unsigned long works around a bug in the HP C Compiler - # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects - # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. - # This bug is HP SR number 8606223364. - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long=0 + fi fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_lo=$ac_mid; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } -ac_lo= ac_hi= -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; -test_array [0] = 0 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_hi=$ac_mid -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_lo=`expr '(' $ac_mid ')' + 1` -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_long=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } ;; -esac -else - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -long longval () { return (long) (sizeof (long)); } -unsigned long ulongval () { return (long) (sizeof (long)); } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - exit (1); - if (((long) (sizeof (long))) < 0) - { - long i = longval (); - if (i != ((long) (sizeof (long)))) - exit (1); - fprintf (f, "%ld\n", i); - } - else - { - unsigned long i = ulongval (); - if (i != ((long) (sizeof (long)))) - exit (1); - fprintf (f, "%lu\n", i); - } - exit (ferror (f) || fclose (f) != 0); - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_long=`cat conftest.val` -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute sizeof (long), 77 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -rm -f conftest.val -else - ac_cv_sizeof_long=0 -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 -echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF -echo "$as_me:$LINENO: checking for uint32_t" >&5 -echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6 -if test "${ac_cv_type_uint32_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((uint32_t *) 0) - return 0; -if (sizeof (uint32_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_uint32_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" +if test "x$ac_cv_type_uint32_t" = xyes; then : -ac_cv_type_uint32_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 -echo "${ECHO_T}$ac_cv_type_uint32_t" >&6 -if test $ac_cv_type_uint32_t = yes; then - : else cat >>confdefs.h <<_ACEOF @@ -5130,64 +6713,9 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for u_int32_t" >&5 -echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6 -if test "${ac_cv_type_u_int32_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((u_int32_t *) 0) - return 0; -if (sizeof (u_int32_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_u_int32_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_fn_c_check_type "$LINENO" "u_int32_t" "ac_cv_type_u_int32_t" "$ac_includes_default" +if test "x$ac_cv_type_u_int32_t" = xyes; then : -ac_cv_type_u_int32_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 -echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6 -if test $ac_cv_type_u_int32_t = yes; then - : else cat >>confdefs.h <<_ACEOF @@ -5199,30 +6727,22 @@ fi if test "$ac_cv_type_u_int32_t" = no ; then if test "$ac_cv_type_u_int32_t" = yes ; then -cat >>confdefs.h <<\_ACEOF -#define U_INT32_T_IS_UINT32_T 1 -_ACEOF +$as_echo "#define U_INT32_T_IS_UINT32_T 1" >>confdefs.h else if test "$ac_cv_sizeof_int" = 4 ; then -cat >>confdefs.h <<\_ACEOF -#define U_INT32_T_IS_UINT 1 -_ACEOF +$as_echo "#define U_INT32_T_IS_UINT 1" >>confdefs.h else if test "$ac_cv_sizeof_long" = 4 ; then -cat >>confdefs.h <<\_ACEOF -#define U_INT32_T_IS_ULONG 1 -_ACEOF +$as_echo "#define U_INT32_T_IS_ULONG 1" >>confdefs.h else if test "$ac_cv_sizeof_short" = 4 ; then -cat >>confdefs.h <<\_ACEOF -#define U_INT32_T_IS_USHORT 1 -_ACEOF +$as_echo "#define U_INT32_T_IS_USHORT 1" >>confdefs.h fi fi @@ -5230,64 +6750,9 @@ _ACEOF fi fi -echo "$as_me:$LINENO: checking for int32_t" >&5 -echo $ECHO_N "checking for int32_t... $ECHO_C" >&6 -if test "${ac_cv_type_int32_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((int32_t *) 0) - return 0; -if (sizeof (int32_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_int32_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" +if test "x$ac_cv_type_int32_t" = xyes; then : -ac_cv_type_int32_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 -echo "${ECHO_T}$ac_cv_type_int32_t" >&6 -if test $ac_cv_type_int32_t = yes; then - : else cat >>confdefs.h <<_ACEOF @@ -5299,41 +6764,53 @@ fi if test "$ac_cv_type_int32_t" = no ; then if test "$ac_cv_sizeof_int" = 4 ; then -cat >>confdefs.h <<\_ACEOF -#define INT32_T_IS_UINT 1 -_ACEOF +$as_echo "#define INT32_T_IS_UINT 1" >>confdefs.h else if test "$ac_cv_sizeof_long" = 4 ; then -cat >>confdefs.h <<\_ACEOF -#define INT32_T_IS_ULONG 1 -_ACEOF +$as_echo "#define INT32_T_IS_ULONG 1" >>confdefs.h else if test "$ac_cv_sizeof_short" = 4 ; then -cat >>confdefs.h <<\_ACEOF -#define INT32_T_IS_USHORT 1 -_ACEOF +$as_echo "#define INT32_T_IS_USHORT 1" >>confdefs.h fi fi fi fi +ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" "#include +" +if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : -echo "$as_me:$LINENO: checking for va_copy" >&5 -echo $ECHO_N "checking for va_copy... $ECHO_C" >&6 -if test "${ac_cv_HAVE_VA_COPY+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +_ACEOF + + +fi + + +ac_fn_c_check_func "$LINENO" "seteuid" "ac_cv_func_seteuid" +if test "x$ac_cv_func_seteuid" = xyes; then : + $as_echo "#define SETEUID(id) seteuid(id)" >>confdefs.h + +else + $as_echo "#define SETEUID(id) setresuid((uid_t) -1, id, (uid_t) -1)" >>confdefs.h + + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5 +$as_echo_n "checking for va_copy... " >&6; } +if ${ac_cv_HAVE_VA_COPY+:} false; then : + $as_echo_n "(cached) " >&6 else -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include va_list ap1,ap2; @@ -5345,61 +6822,31 @@ va_copy(ap1,ap2); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_HAVE_VA_COPY=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_HAVE_VA_COPY=no + ac_cv_HAVE_VA_COPY=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_HAVE_VA_COPY" >&5 -echo "${ECHO_T}$ac_cv_HAVE_VA_COPY" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_HAVE_VA_COPY" >&5 +$as_echo "$ac_cv_HAVE_VA_COPY" >&6; } if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_VA_COPY 1 -_ACEOF +$as_echo "#define HAVE_VA_COPY 1" >>confdefs.h else - echo "$as_me:$LINENO: checking for __va_copy" >&5 -echo $ECHO_N "checking for __va_copy... $ECHO_C" >&6 -if test "${ac_cv_HAVE___VA_COPY+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __va_copy" >&5 +$as_echo_n "checking for __va_copy... " >&6; } +if ${ac_cv_HAVE___VA_COPY+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - va_list ap1,ap2; + va_list ap1,ap2; int main () { @@ -5408,674 +6855,153 @@ __va_copy(ap1,ap2); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_HAVE___VA_COPY=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_HAVE___VA_COPY=no + ac_cv_HAVE___VA_COPY=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_HAVE___VA_COPY" >&5 -echo "${ECHO_T}$ac_cv_HAVE___VA_COPY" >&6 - if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_HAVE___VA_COPY" >&5 +$as_echo "$ac_cv_HAVE___VA_COPY" >&6; } + if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE___VA_COPY 1 -_ACEOF +$as_echo "#define HAVE___VA_COPY 1" >>confdefs.h - fi + fi fi -echo "$as_me:$LINENO: checking for vsnprintf" >&5 -echo $ECHO_N "checking for vsnprintf... $ECHO_C" >&6 -if test "${ac_cv_func_vsnprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define vsnprintf to an innocuous variant, in case declares vsnprintf. - For example, HP-UX 11i declares gettimeofday. */ -#define vsnprintf innocuous_vsnprintf +ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" +if test "x$ac_cv_func_vsnprintf" = xyes; then : -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char vsnprintf (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef vsnprintf - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vsnprintf (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_vsnprintf) || defined (__stub___vsnprintf) -choke me -#else -char (*f) () = vsnprintf; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != vsnprintf; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_vsnprintf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_vsnprintf=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_vsnprintf" >&5 -echo "${ECHO_T}$ac_cv_func_vsnprintf" >&6 -if test $ac_cv_func_vsnprintf = yes; then - : else SNPRINTF_O=./snprintf.o fi -echo "$as_me:$LINENO: checking for snprintf" >&5 -echo $ECHO_N "checking for snprintf... $ECHO_C" >&6 -if test "${ac_cv_func_snprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define snprintf to an innocuous variant, in case declares snprintf. - For example, HP-UX 11i declares gettimeofday. */ -#define snprintf innocuous_snprintf +ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" +if test "x$ac_cv_func_snprintf" = xyes; then : -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char snprintf (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef snprintf - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char snprintf (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_snprintf) || defined (__stub___snprintf) -choke me -#else -char (*f) () = snprintf; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != snprintf; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_snprintf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_snprintf=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_snprintf" >&5 -echo "${ECHO_T}$ac_cv_func_snprintf" >&6 -if test $ac_cv_func_snprintf = yes; then - : else SNPRINTF_O=./snprintf.o fi -echo "$as_me:$LINENO: checking for asprintf" >&5 -echo $ECHO_N "checking for asprintf... $ECHO_C" >&6 -if test "${ac_cv_func_asprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define asprintf to an innocuous variant, in case declares asprintf. - For example, HP-UX 11i declares gettimeofday. */ -#define asprintf innocuous_asprintf +ac_fn_c_check_func "$LINENO" "asprintf" "ac_cv_func_asprintf" +if test "x$ac_cv_func_asprintf" = xyes; then : -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char asprintf (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef asprintf - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char asprintf (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_asprintf) || defined (__stub___asprintf) -choke me -#else -char (*f) () = asprintf; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != asprintf; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_asprintf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_asprintf=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_asprintf" >&5 -echo "${ECHO_T}$ac_cv_func_asprintf" >&6 -if test $ac_cv_func_asprintf = yes; then - : else SNPRINTF_O=./snprintf.o fi -echo "$as_me:$LINENO: checking for vasprintf" >&5 -echo $ECHO_N "checking for vasprintf... $ECHO_C" >&6 -if test "${ac_cv_func_vasprintf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define vasprintf to an innocuous variant, in case declares vasprintf. - For example, HP-UX 11i declares gettimeofday. */ -#define vasprintf innocuous_vasprintf +ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" +if test "x$ac_cv_func_vasprintf" = xyes; then : -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char vasprintf (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef vasprintf - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vasprintf (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_vasprintf) || defined (__stub___vasprintf) -choke me -#else -char (*f) () = vasprintf; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != vasprintf; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_vasprintf=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_vasprintf=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_vasprintf" >&5 -echo "${ECHO_T}$ac_cv_func_vasprintf" >&6 -if test $ac_cv_func_vasprintf = yes; then - : else SNPRINTF_O=./snprintf.o fi -echo "$as_me:$LINENO: checking for C99 vsnprintf" >&5 -echo $ECHO_N "checking for C99 vsnprintf... $ECHO_C" >&6 -if test "${ac_cv_HAVE_C99_VSNPRINTF+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C99 vsnprintf" >&5 +$as_echo_n "checking for C99 vsnprintf... " >&6; } +if ${ac_cv_HAVE_C99_VSNPRINTF+:} false; then : + $as_echo_n "(cached) " >&6 else -if test "$cross_compiling" = yes; then +if test "$cross_compiling" = yes; then : ac_cv_HAVE_C99_VSNPRINTF=cross else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include void foo(const char *format, ...) { - va_list ap; - int len; - char buf[5]; + va_list ap; + int len; + char buf[5]; - va_start(ap, format); - len = vsnprintf(buf, 0, format, ap); - va_end(ap); - if (len != 5) exit(1); + va_start(ap, format); + len = vsnprintf(buf, 0, format, ap); + va_end(ap); + if (len != 5) exit(1); - va_start(ap, format); - len = vsnprintf(0, 0, format, ap); - va_end(ap); - if (len != 5) exit(1); + va_start(ap, format); + len = vsnprintf(0, 0, format, ap); + va_end(ap); + if (len != 5) exit(1); - if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); + if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); - exit(0); + exit(0); } main() { foo("hello"); } _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_run "$LINENO"; then : ac_cv_HAVE_C99_VSNPRINTF=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_HAVE_C99_VSNPRINTF=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi -( exit $ac_status ) -ac_cv_HAVE_C99_VSNPRINTF=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_HAVE_C99_VSNPRINTF" >&5 -echo "${ECHO_T}$ac_cv_HAVE_C99_VSNPRINTF" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_HAVE_C99_VSNPRINTF" >&5 +$as_echo "$ac_cv_HAVE_C99_VSNPRINTF" >&6; } if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_C99_VSNPRINTF 1 -_ACEOF +$as_echo "#define HAVE_C99_VSNPRINTF 1" >>confdefs.h fi - - for ac_func in getopt_long -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then +do : + ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" +if test "x$ac_cv_func_getopt_long" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_GETOPT_LONG 1 _ACEOF else - echo "$as_me:$LINENO: checking for getopt_long in -liberty" >&5 -echo $ECHO_N "checking for getopt_long in -liberty... $ECHO_C" >&6 -if test "${ac_cv_lib_iberty_getopt_long+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getopt_long in -liberty" >&5 +$as_echo_n "checking for getopt_long in -liberty... " >&6; } +if ${ac_cv_lib_iberty_getopt_long+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liberty $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char getopt_long (); int main () { -getopt_long (); +return getopt_long (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_iberty_getopt_long=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_iberty_getopt_long=no + ac_cv_lib_iberty_getopt_long=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_iberty_getopt_long" >&5 -echo "${ECHO_T}$ac_cv_lib_iberty_getopt_long" >&6 -if test $ac_cv_lib_iberty_getopt_long = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iberty_getopt_long" >&5 +$as_echo "$ac_cv_lib_iberty_getopt_long" >&6; } +if test "x$ac_cv_lib_iberty_getopt_long" = xyes; then : OTHERLIBS="$OTHERLIBS -liberty" fi @@ -6083,460 +7009,209 @@ fi done - -echo "$as_me:$LINENO: checking for main in -lnsl" >&5 -echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6 -if test "${ac_cv_lib_nsl_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5 +$as_echo_n "checking for main in -lnsl... " >&6; } +if ${ac_cv_lib_nsl_main+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { -main (); +return main (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_main=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_nsl_main=no + ac_cv_lib_nsl_main=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6 -if test $ac_cv_lib_nsl_main = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_main" >&5 +$as_echo "$ac_cv_lib_nsl_main" >&6; } +if test "x$ac_cv_lib_nsl_main" = xyes; then : SOCKETLIBS="$SOCKETLIBS -lnsl" fi -echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 -echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_socket+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 +$as_echo_n "checking for socket in -lsocket... " >&6; } +if ${ac_cv_lib_socket_socket+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char socket (); int main () { -socket (); +return socket (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_socket_socket=no + ac_cv_lib_socket_socket=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 -if test $ac_cv_lib_socket_socket = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 +$as_echo "$ac_cv_lib_socket_socket" >&6; } +if test "x$ac_cv_lib_socket_socket" = xyes; then : SOCKETLIBS="$SOCKETLIBS -lsocket" fi - -echo "$as_me:$LINENO: checking for main in -lwrap" >&5 -echo $ECHO_N "checking for main in -lwrap... $ECHO_C" >&6 -if test "${ac_cv_lib_wrap_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lwrap" >&5 +$as_echo_n "checking for main in -lwrap... " >&6; } +if ${ac_cv_lib_wrap_main+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lwrap $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { -main (); +return main (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_wrap_main=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_wrap_main=no + ac_cv_lib_wrap_main=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_wrap_main" >&5 -echo "${ECHO_T}$ac_cv_lib_wrap_main" >&6 -if test $ac_cv_lib_wrap_main = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wrap_main" >&5 +$as_echo "$ac_cv_lib_wrap_main" >&6; } +if test "x$ac_cv_lib_wrap_main" = xyes; then : LIBWRAPLIBS="$LIBWRAPLIBS -lwrap" -cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBWRAP 1 -_ACEOF +$as_echo "#define HAVE_LIBWRAP 1" >>confdefs.h - -fi - - - - - - - -for ac_func in strdup strstr strtoul initgroups closesocket -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif +#include int main () { -return f != $ac_func; +int a = rfc931_timeout; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_link "$LINENO"; then : + $as_echo "#define HAVE_RFC931_TIMEOUT 1" >>confdefs.h -eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then + +for ac_func in strdup strstr strtoul strtok_r initgroups closesocket sigaction +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done -echo "$as_me:$LINENO: checking for socklen_t" >&5 -echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 -if test "${ac_cv_type_socklen_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include +ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include #include +" +if test "x$ac_cv_type_socklen_t" = xyes; then : -int -main () -{ -if ((socklen_t *) 0) - return 0; -if (sizeof (socklen_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_socklen_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_socklen_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 -echo "${ECHO_T}$ac_cv_type_socklen_t" >&6 -if test $ac_cv_type_socklen_t = yes; then - : else - echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5 -echo $ECHO_N "checking for socklen_t equivalent... $ECHO_C" >&6 - if test "${curl_cv_socklen_t_equiv+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5 +$as_echo_n "checking for socklen_t equivalent... " >&6; } + if ${curl_cv_socklen_t_equiv+:} false; then : + $as_echo_n "(cached) " >&6 else - # Systems have either "struct sockaddr *" or - # "void *" as the second argument to getpeername - curl_cv_socklen_t_equiv= - for arg2 in "struct sockaddr" void; do - for t in int size_t unsigned long "unsigned long"; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + # Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + curl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #ifdef HAVE_SYS_TYPES_H - #include - #endif - #ifdef HAVE_SYS_SOCKET_H - #include - #endif + #ifdef HAVE_SYS_TYPES_H + #include + #endif + #ifdef HAVE_SYS_SOCKET_H + #include + #endif - int getpeername (int, $arg2 *, $t *); + int getpeername (int, $arg2 *, $t *); int main () { - $t len; - getpeername(0,0,&len); + $t len; + getpeername(0,0,&len); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : - curl_cv_socklen_t_equiv="$t" - break - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + curl_cv_socklen_t_equiv="$t" + break fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - done - done +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + done - if test "x$curl_cv_socklen_t_equiv" = x; then - { { echo "$as_me:$LINENO: error: Cannot find a type to use in place of socklen_t" >&5 -echo "$as_me: error: Cannot find a type to use in place of socklen_t" >&2;} - { (exit 1); exit 1; }; } - fi + if test "x$curl_cv_socklen_t_equiv" = x; then + as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5 + fi fi - echo "$as_me:$LINENO: result: $curl_cv_socklen_t_equiv" >&5 -echo "${ECHO_T}$curl_cv_socklen_t_equiv" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_socklen_t_equiv" >&5 +$as_echo "$curl_cv_socklen_t_equiv" >&6; } cat >>confdefs.h <<_ACEOF #define socklen_t $curl_cv_socklen_t_equiv @@ -6546,13 +7221,9 @@ fi -echo "$as_me:$LINENO: checking for type of socket size" >&5 -echo $ECHO_N "checking for type of socket size... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of socket size" >&5 +$as_echo_n "checking for type of socket size... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -6566,62 +7237,22 @@ int a = send(1, (const void *)0, (size_t *) 0, (int *) 0); return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : -cat >>confdefs.h <<\_ACEOF -#define SOCKET_SIZE_TYPE size_t -_ACEOF - echo "$as_me:$LINENO: result: size_t" >&5 -echo "${ECHO_T}size_t" >&6 +$as_echo "#define SOCKET_SIZE_TYPE size_t" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: result: size_t" >&5 +$as_echo "size_t" >&6; } else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >>confdefs.h <<\_ACEOF -#define SOCKET_SIZE_TYPE int -_ACEOF - echo "$as_me:$LINENO: result: int" >&5 -echo "${ECHO_T}int" >&6 +$as_echo "#define SOCKET_SIZE_TYPE int" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: result: int" >&5 +$as_echo "int" >&6; } fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -#AC_CHECK_TYPE(socklen_t,int, -# AC_DEFINE(socklen_t,int, -# Define to `int' if does not define.),[ -# #ifdef HAVE_SYS_TYPES_H -# #include -# #endif -# #ifdef HAVE_SYS_SOCKET_H -# #include -# #endif -# ]) - -# Check whether --enable-ssl or --disable-ssl was given. -if test "${enable_ssl+set}" = set; then - enableval="$enable_ssl" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Check whether --enable-ssl was given. +if test "${enable_ssl+set}" = set; then : + enableval=$enable_ssl; if test x$enableval = xyes; then check_for_ssl=yes else @@ -6630,129 +7261,131 @@ if test "${enable_ssl+set}" = set; then else check_for_ssl=yes -fi; +fi + +if test x$check_for_ssl = xyes; then + # need_dh should only be set for NRPE + need_dh=yes + + +# ------------------------------- +# 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= -# Check whether --with-ssl or --without-ssl was given. -if test "${with_ssl+set}" = set; then - withval="$with_ssl" - ssl_dir=$withval -fi; -# Check whether --with-ssl-inc or --without-ssl-inc was given. -if test "${with_ssl_inc+set}" = set; then - withval="$with_ssl_inc" - ssl_inc_dir=$withval -fi; -# Check whether --with-ssl-lib or --without-ssl-lib was given. -if test "${with_ssl_lib+set}" = set; then - withval="$with_ssl_lib" - ssl_lib_dir=$withval -fi; -# Check whether --with-kerberos-inc or --without-kerberos-inc was given. -if test "${with_kerberos_inc+set}" = set; then - withval="$with_kerberos_inc" - kerberos_inc_dir=$withval -fi; -if test x$check_for_ssl = xyes; then - echo "$as_me:$LINENO: checking for SSL headers" >&5 -echo $ECHO_N "checking for SSL headers... $ECHO_C" >&6 + + + +# gnutls/openssl.h +# nss_compat_ossl/nss_compat_ossl.h + + + +# Check whether --with-ssl was given. +if test "${with_ssl+set}" = set; then : + withval=$with_ssl; ssl_dir=$withval +fi + + +# Check whether --with-ssl-inc was given. +if test "${with_ssl_inc+set}" = set; then : + withval=$with_ssl_inc; ssl_inc_dir=$withval +fi + + +# Check whether --with-ssl-lib was given. +if test "${with_ssl_lib+set}" = set; then : + withval=$with_ssl_lib; ssl_lib_dir=$withval +fi + + +if test x$ssl_inc_dir != x -o x$ssl_lib_dir != x; then + try_pkg_config=0 +fi + + +# Check whether --with-kerberos-inc was given. +if test "${with_kerberos_inc+set}" = set; then : + withval=$with_kerberos_inc; kerberos_inc_dir=$withval +fi + + +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}"; + + +case $SSL_TYPE in #( + 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; as_fn_error $? "'--with-ssl-type=$SSL_TYPE' is invalid" "$LINENO" 5 + ;; #( + *) : + ;; +esac + + +# Check for SSL support + +if test x$SSL_TYPE != xNONE; then + found_ssl=no - for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /usr/freeware/lib/openssl /usr/sfw/include; do - ssldir="$dir" - if test -f "$dir/include/openssl/ssl.h"; then - found_ssl=yes - CFLAGS="$CFLAGS -I$dir/include/openssl -I$ssldir/include" - sslincdir="$dir/include/openssl" - break - fi - if test -f "$dir/include/ssl.h"; then - found_ssl=yes - CFLAGS="$CFLAGS -I$dir/include" - sslincdir="$dir/include" - break - fi - if test -f "$dir/ssl.h"; then - found_ssl=yes - CFLAGS="$CFLAGS -I$dir" - sslincdir="$dir" - ssldir="$dir/.." - break - fi - if test -f "$dir/openssl/ssl.h"; then - found_ssl=yes - CFLAGS="$CFLAGS -I$dir/openssl" - sslincdir="$dir/openssl" - ssldir="$dir/.." - break - fi - done - if test x_$found_ssl != x_yes; then - { { echo "$as_me:$LINENO: error: Cannot find ssl headers" >&5 -echo "$as_me: error: Cannot find ssl headers" >&2;} - { (exit 1); exit 1; }; } - else - - printf "SSL headers found in $ssldir\n"; - - echo "$as_me:$LINENO: checking for SSL libraries" >&5 -echo $ECHO_N "checking for SSL libraries... $ECHO_C" >&6 - found_ssl=no - for dir in $ssl_lib_dir $ssl_dir /usr/lib64 /usr/lib /usr/local/lib /usr/lib/ssl /usr/ssl/lib /usr/openssl/lib /usr/pkg/lib /usr/freeware/lib/openssl /usr/sfw/lib /opt/freeware/lib; do - ssllibdir="$dir" - if test "`uname -s`" = "Darwin" ; then - soext="dylib" - elif test "`uname -s`" = "HP-UX" ; then - soext="sl" - else - soext="so" - fi - if test -f "$dir/libssl.$soext"; then - found_ssl=yes - break - fi - done - - if test x_$found_ssl != x_yes; then - { { echo "$as_me:$LINENO: error: Cannot find ssl libraries" >&5 -echo "$as_me: error: Cannot find ssl libraries" >&2;} - { (exit 1); exit 1; }; } - else - printf "SSL libraries found in $ssllibdir\n"; - - LDFLAGS="$LDFLAGS -L$ssllibdir"; - LIBS="$LIBS -lssl -lcrypto"; - - -cat >>confdefs.h <<_ACEOF -#define HAVE_SSL 1 -_ACEOF - - - - echo "" - echo "*** Generating DH Parameters for SSL/TLS ***" - if test -f "$ssldir/sbin/openssl"; then - sslbin=$ssldir/sbin/openssl - else - sslbin=$ssldir/bin/openssl - fi - # awk to strip off meta data at bottom of dhparam output - $sslbin dhparam -C 512 | awk '/^-----/ {exit} {print}' > include/dh.h - fi - fi - - echo "$as_me:$LINENO: checking for Kerberos include files" >&5 -echo $ECHO_N "checking for Kerberos include files... $ECHO_C" >&6 + # 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos include files" >&5 +$as_echo_n "checking for Kerberos include files... " >&6; } found_kerberos=no - for dir in $kerberos_inc_dir /usr/kerberos/include; do + 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 @@ -6762,27 +7395,323 @@ cat >>confdefs.h <<_ACEOF #define HAVE_KRB5_H 1 _ACEOF - break + break fi done if test x_$found_kerberos != x_yes; then - printf "could not find include files\n"; + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find include files" >&5 +$as_echo "$as_me: WARNING: could not find include files" >&2;} else - printf "found Kerberos include files in $kerbdir\n"; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found Kerberos include files in $kerbdir" >&5 +$as_echo "found Kerberos include files in $kerbdir" >&6; } fi + # First, try using pkg_config + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PKG_CONFIG"; then + ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PKG_CONFIG=$ac_cv_prog_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_PKG_CONFIG"; then + ac_ct_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_PKG_CONFIG"; then + ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_PKG_CONFIG="pkg-config" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG +if test -n "$ac_ct_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_PKG_CONFIG" >&5 +$as_echo "$ac_ct_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_ct_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_prog_PKG_CONFIG" +fi + + 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 + +cat >>confdefs.h <<_ACEOF +#define HAVE_SSL 1 +_ACEOF + + fi + fi + + if test x_$found_ssl != x_yes; then + + # Find the SSL Headers + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL headers" >&5 +$as_echo_n "checking for SSL headers... " >&6; } + 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 + as_fn_error $? "Cannot find ssl headers" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 +$as_echo "found in $ssldir" >&6; } + + # Now try and find SSL libraries + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL libraries" >&5 +$as_echo_n "checking for SSL libraries... " >&6; } + 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 + as_fn_error $? "Cannot find ssl libraries" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $SSL_LIB_DIR" >&5 +$as_echo "found in $SSL_LIB_DIR" >&6; } + + LDFLAGS="$LDFLAGS -L$SSL_LIB_DIR"; + LIBS="$LIBS -l`echo $ssl_lib | sed -e 's/^lib//'` -lcrypto"; + +cat >>confdefs.h <<_ACEOF +#define HAVE_SSL 1 +_ACEOF + + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiling and linking against SSL works" >&5 +$as_echo_n "checking whether compiling and linking against SSL works... " >&6; } + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <${SSL_INC_PREFIX}${SSL_HDR}> +int +main () +{ +SSL_new(NULL) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + +else + + as_fn_error $? "no" "$LINENO" 5 + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + + if test x$found_ssl = xyes -a x$need_dh = xyes; then + + # Find the openssl program + + if test x$need_dh = xyes; then + # Extract the first word of "openssl", so it can be a program name with args. +set dummy openssl; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_sslbin+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $sslbin in + [\\/]* | ?:[\\/]*) + ac_cv_path_sslbin="$sslbin" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $ssl_dir/sbin$PATH_SEPARATOR$ssl_dir/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_sslbin="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_sslbin" && ac_cv_path_sslbin="value-if-not-found" + ;; +esac +fi +sslbin=$ac_cv_path_sslbin +if test -n "$sslbin"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sslbin" >&5 +$as_echo "$sslbin" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + $as_echo "#define USE_SSL_DH 1" >>confdefs.h + + # 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 fi -# Check whether --with-log_facility or --without-log_facility was given. -if test "${with_log_facility+set}" = set; then - withval="$with_log_facility" - log_facility=$withval +# Check whether --with-log_facility was given. +if test "${with_log_facility+set}" = set; then : + withval=$with_log_facility; log_facility=$withval else log_facility=daemon -fi; +fi cat >>confdefs.h <<_ACEOF @@ -6791,117 +7720,87 @@ _ACEOF -# Check whether --with-nrpe_user or --without-nrpe_user was given. -if test "${with_nrpe_user+set}" = set; then - withval="$with_nrpe_user" - nrpe_user=$withval +# Check whether --with-nrpe_user was given. +if test "${with_nrpe_user+set}" = set; then : + withval=$with_nrpe_user; nrpe_user=$withval else nrpe_user=nagios -fi; +fi -# Check whether --with-nrpe_group or --without-nrpe_group was given. -if test "${with_nrpe_group+set}" = set; then - withval="$with_nrpe_group" - nrpe_group=$withval + +# Check whether --with-nrpe_group was given. +if test "${with_nrpe_group+set}" = set; then : + withval=$with_nrpe_group; nrpe_group=$withval else nrpe_group=nagios -fi; +fi -# Check whether --with-nrpe_port or --without-nrpe_port was given. -if test "${with_nrpe_port+set}" = set; then - withval="$with_nrpe_port" - nrpe_port=$withval + +# Check whether --with-nrpe_port was given. +if test "${with_nrpe_port+set}" = set; then : + withval=$with_nrpe_port; nrpe_port=$withval else nrpe_port=5666 -fi; - +fi NRPE_INSTALL_OPTS="-o $nrpe_user -g $nrpe_group" - - cat >>confdefs.h <<_ACEOF #define DEFAULT_SERVER_PORT $nrpe_port _ACEOF -# Check whether --with-nagios_user or --without-nagios_user was given. -if test "${with_nagios_user+set}" = set; then - withval="$with_nagios_user" - nagios_user=$withval +# Check whether --with-nagios_user was given. +if test "${with_nagios_user+set}" = set; then : + withval=$with_nagios_user; nagios_user=$withval else nagios_user=nagios -fi; +fi -# Check whether --with-nagios_group or --without-nagios_group was given. -if test "${with_nagios_group+set}" = set; then - withval="$with_nagios_group" - nagios_group=$withval + +# Check whether --with-nagios_group was given. +if test "${with_nagios_group+set}" = set; then : + withval=$with_nagios_group; nagios_group=$withval else nagios_group=nagios -fi; - +fi NAGIOS_INSTALL_OPTS="-o $nagios_user -g $nagios_group" - -# Determine target OS, version and architecture for package build macros -if test "x$target_ver" = "x" ; then - TARGET_VER=`uname -r` -else - TARGET_VER=$target_ver -fi - -if test "x$target_os" = "x" ; then - TARGET_OS=`uname -s` -else - TARGET_OS=$target_os -fi - -if test "x$target_cpu" = "x" ; then - TARGET_ARCH=`uname -p` -else - TARGET_ARCH=$target_cpu -fi - -TARGET_PLATFORM="" -if test "x$TARGET_OS" = "xSunOS" ; then - if test "x$TARGET_VER" = "x5.10" ; then - TARGET_PLATFORM="sol10" + if test "`uname -s`" = "HP-UX" ; then + LDFLAGS="$LDFLAGS -Wl,+allowdups"; fi -fi - - -# Check whether --enable-command-args or --disable-command-args was given. -if test "${enable_command_args+set}" = set; then - enableval="$enable_command_args" +# Check whether --enable-command-args was given. +if test "${enable_command_args+set}" = set; then : + enableval=$enable_command_args; cat >>confdefs.h <<_ACEOF #define ENABLE_COMMAND_ARGUMENTS 1 _ACEOF -fi; +fi -# Check whether --enable-bash-command-substitution or --disable-bash-command-substitution was given. -if test "${enable_bash_command_substitution+set}" = set; then - enableval="$enable_bash_command_substitution" +# Check whether --enable-bash-command-substitution was given. +if test "${enable_bash_command_substitution+set}" = set; then : + enableval=$enable_bash_command_substitution; cat >>confdefs.h <<_ACEOF #define ENABLE_BASH_COMMAND_SUBSTITUTION 1 _ACEOF -fi; +fi + # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_PERL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PERL+:} false; then : + $as_echo_n "(cached) " >&6 else case $PERL in [\\/]* | ?:[\\/]*) @@ -6913,60 +7812,48 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS ;; esac fi PERL=$ac_cv_path_PERL - if test -n "$PERL"; then - echo "$as_me:$LINENO: result: $PERL" >&5 -echo "${ECHO_T}$PERL" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +$as_echo "$PERL" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -6974,12 +7861,14 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -6989,81 +7878,253 @@ cat >$CONFIG_STATUS <<_ACEOF debug=false ac_cs_recheck=false ac_cs_silent=false + SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset + setopt NO_GLOB_SUBST else - as_unset=false + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` - -# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -7071,148 +8132,111 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -7221,31 +8245,20 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 -# Open the log real soon, to keep \$[0] and so on meaningful, and to +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by nrpe $as_me 2.15, which was -generated by GNU Autoconf 2.59. Invocation command line was +# values after options handling. +ac_log=" +This file was extended by nrpe $as_me 3.0.1, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7253,45 +8266,46 @@ generated by GNU Autoconf 2.59. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi +config_files="$ac_config_files" +config_headers="$ac_config_headers" -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE Configuration files: $config_files @@ -7299,84 +8313,91 @@ $config_files Configuration headers: $config_headers -Report bugs to ." +Report bugs to . +nrpe home page: ." + _ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -nrpe config.status 2.15 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" +nrpe config.status 3.0.1 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; - -*) + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; esac case $ac_option in # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" ;; + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; esac shift @@ -7390,40 +8411,70 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" fi _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - - -cat >>$CONFIG_STATUS <<\_ACEOF +# Handling of arguments. for ac_config_target in $ac_config_targets do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "subst" ) CONFIG_FILES="$CONFIG_FILES subst" ;; - "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "package/solaris/Makefile" ) CONFIG_FILES="$CONFIG_FILES package/solaris/Makefile" ;; - "init-script" ) CONFIG_FILES="$CONFIG_FILES init-script" ;; - "init-script.debian" ) CONFIG_FILES="$CONFIG_FILES init-script.debian" ;; - "init-script.suse" ) CONFIG_FILES="$CONFIG_FILES init-script.suse" ;; - "nrpe.spec" ) CONFIG_FILES="$CONFIG_FILES nrpe.spec" ;; - "sample-config/nrpe.cfg" ) CONFIG_FILES="$CONFIG_FILES sample-config/nrpe.cfg" ;; - "sample-config/nrpe.xinetd" ) CONFIG_FILES="$CONFIG_FILES sample-config/nrpe.xinetd" ;; - "include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + case $ac_config_target in + "paths") CONFIG_FILES="$CONFIG_FILES paths" ;; + "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "nrpe.spec") CONFIG_FILES="$CONFIG_FILES nrpe.spec" ;; + "uninstall") CONFIG_FILES="$CONFIG_FILES uninstall" ;; + "sample-config/nrpe.cfg") CONFIG_FILES="$CONFIG_FILES sample-config/nrpe.cfg" ;; + "startup/bsd-init") CONFIG_FILES="$CONFIG_FILES startup/bsd-init" ;; + "startup/debian-init") CONFIG_FILES="$CONFIG_FILES startup/debian-init" ;; + "startup/default-init") CONFIG_FILES="$CONFIG_FILES startup/default-init" ;; + "startup/default-inetd") CONFIG_FILES="$CONFIG_FILES startup/default-inetd" ;; + "startup/default-service") CONFIG_FILES="$CONFIG_FILES startup/default-service" ;; + "startup/default-socket") CONFIG_FILES="$CONFIG_FILES startup/default-socket" ;; + "startup/default-socket-svc") CONFIG_FILES="$CONFIG_FILES startup/default-socket-svc" ;; + "startup/default-xinetd") CONFIG_FILES="$CONFIG_FILES startup/default-xinetd" ;; + "startup/mac-init.plist") CONFIG_FILES="$CONFIG_FILES startup/mac-init.plist" ;; + "startup/mac-inetd.plist") CONFIG_FILES="$CONFIG_FILES startup/mac-inetd.plist" ;; + "startup/newbsd-init") CONFIG_FILES="$CONFIG_FILES startup/newbsd-init" ;; + "startup/openbsd-init") CONFIG_FILES="$CONFIG_FILES startup/openbsd-init" ;; + "startup/openrc-conf") CONFIG_FILES="$CONFIG_FILES startup/openrc-conf" ;; + "startup/openrc-init") CONFIG_FILES="$CONFIG_FILES startup/openrc-init" ;; + "startup/solaris-init.xml") CONFIG_FILES="$CONFIG_FILES startup/solaris-init.xml" ;; + "startup/solaris-inetd.xml") CONFIG_FILES="$CONFIG_FILES startup/solaris-inetd.xml" ;; + "startup/tmpfile.conf") CONFIG_FILES="$CONFIG_FILES startup/tmpfile.conf" ;; + "startup/upstart-init") CONFIG_FILES="$CONFIG_FILES startup/upstart-init" ;; + "startup/rh-upstart-init") CONFIG_FILES="$CONFIG_FILES startup/rh-upstart-init" ;; + "include/common.h") CONFIG_FILES="$CONFIG_FILES include/common.h" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done + # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely @@ -7434,590 +8485,550 @@ if $ac_need_defaults; then fi # Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, +# simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. $debug || { - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 } - # Create a (secure) tmp directory for tmp files. { - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" } || { - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + { - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@PKG_NAME@,$PKG_NAME,;t t -s,@PKG_VERSION@,$PKG_VERSION,;t t -s,@PKG_HOME_URL@,$PKG_HOME_URL,;t t -s,@PKG_REL_DATE@,$PKG_REL_DATE,;t t -s,@RPM_RELEASE@,$RPM_RELEASE,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@INSTALL@,$INSTALL,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@SNPRINTF_O@,$SNPRINTF_O,;t t -s,@OTHERLIBS@,$OTHERLIBS,;t t -s,@SOCKETLIBS@,$SOCKETLIBS,;t t -s,@LIBWRAPLIBS@,$LIBWRAPLIBS,;t t -s,@HAVE_SSL@,$HAVE_SSL,;t t -s,@log_facility@,$log_facility,;t t -s,@nrpe_user@,$nrpe_user,;t t -s,@nrpe_group@,$nrpe_group,;t t -s,@NRPE_INSTALL_OPTS@,$NRPE_INSTALL_OPTS,;t t -s,@nrpe_port@,$nrpe_port,;t t -s,@nagios_user@,$nagios_user,;t t -s,@nagios_group@,$nagios_group,;t t -s,@NAGIOS_INSTALL_OPTS@,$NAGIOS_INSTALL_OPTS,;t t -s,@TARGET_VER@,$TARGET_VER,;t t -s,@TARGET_OS@,$TARGET_OS,;t t -s,@TARGET_ARCH@,$TARGET_ARCH,;t t -s,@TARGET_PLATFORM@,$TARGET_PLATFORM,;t t -s,@PERL@,$PERL,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; esac - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || + ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac + case $ac_mode in + :F) + # + # CONFIG_FILE + # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + rm -f "$ac_tmp/stdin" case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - cat $tmp/config.h - rm -f $tmp/config.h + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi -done -_ACEOF + ;; -cat >>$CONFIG_STATUS <<\_ACEOF -{ (exit 0); exit 0; } + esac + +done # for ac_tag + + +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -8037,40 +9048,38 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi -perl subst init-script -perl subst init-script.debian -perl subst init-script.suse -perl subst sample-config/nrpe.cfg -perl subst sample-config/nrpe.xinetd - - echo "" echo "" -echo "$as_me:$LINENO: result: *** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:" >&5 -echo "${ECHO_T}*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: *** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:" >&5 +$as_echo "*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:" >&6; } -echo "" -echo " General Options:" +echo "";\ +echo " General Options:";\ echo " -------------------------" -echo "$as_me:$LINENO: result: NRPE port: $nrpe_port" >&5 -echo "${ECHO_T} NRPE port: $nrpe_port" >&6 -echo "$as_me:$LINENO: result: NRPE user: $nrpe_user" >&5 -echo "${ECHO_T} NRPE user: $nrpe_user" >&6 -echo "$as_me:$LINENO: result: NRPE group: $nrpe_group" >&5 -echo "${ECHO_T} NRPE group: $nrpe_group" >&6 -echo "$as_me:$LINENO: result: Nagios user: $nagios_user" >&5 -echo "${ECHO_T} Nagios user: $nagios_user" >&6 -echo "$as_me:$LINENO: result: Nagios group: $nagios_group" >&5 -echo "${ECHO_T} Nagios group: $nagios_group" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NRPE port: $nrpe_port" >&5 +$as_echo " NRPE port: $nrpe_port" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NRPE user: $nrpe_user" >&5 +$as_echo " NRPE user: $nrpe_user" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NRPE group: $nrpe_group" >&5 +$as_echo " NRPE group: $nrpe_group" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Nagios user: $nagios_user" >&5 +$as_echo " Nagios user: $nagios_user" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Nagios group: $nagios_group" >&5 +$as_echo " Nagios group: $nagios_group" >&6; } -echo "" -echo "" -echo "Review the options above for accuracy. If they look okay," -echo "type 'make all' to compile the NRPE daemon and client." +echo "";\ +echo "";\ +echo "Review the options above for accuracy. If they look okay,";\ +echo "type 'make all' to compile the NRPE daemon and client";\ +echo "or type 'make' to get a list of make options.";\ echo "" diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..47760b4 --- /dev/null +++ b/configure.ac @@ -0,0 +1,391 @@ +dnl Process this -*-m4-*- file with autoconf to produce a configure script. + +dnl Disable caching +define([AC_CACHE_LOAD],) +define([AC_CACHE_SAVE],) + +m4_include([build-aux/custom_help.m4]) +AC_INIT([nrpe],[3.0.1],[nagios-users@lists.sourceforge.net],[nrpe],[https://www.nagios.org/downloads/nagios-core-addons/]) +AC_CONFIG_SRCDIR([src/nrpe.c]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_PREFIX_DEFAULT(/usr/local/nagios) + +PKG_NAME=nrpe +PKG_VERSION="3.0.1" +PKG_HOME_URL="http://www.nagios.org/" +PKG_REL_DATE="09-08-2016" +RPM_RELEASE=1 + +LANG=C +LC_ALL=C +LC_COLLATE=C +LC_CTYPE=C +LC_MESSAGES=C +LC_MONETARY=C +LC_NUMERIC=C +LC_TIME=C + +AC_SUBST(PKG_NAME) +AC_SUBST(PKG_VERSION) +AC_SUBST(PKG_HOME_URL) +AC_SUBST(PKG_REL_DATE) +AC_SUBST(RPM_RELEASE) +AC_SUBST(INSTALL) +AC_SUBST(SNPRINTF_O) +AC_SUBST(LDFLAGS) +AC_SUBST(OTHERLIBS) +AC_SUBST(SOCKETLIBS) +AC_SUBST(LIBWRAPLIBS) +AC_SUBST(NRPE_INSTALL_OPTS) +AC_SUBST(log_facility) +AC_SUBST(nrpe_user) +AC_SUBST(nrpe_group) +AC_SUBST(nrpe_port) +AC_SUBST(nagios_user) +AC_SUBST(nagios_group) +AC_SUBST(NAGIOS_INSTALL_OPTS) +AC_SUBST(TARGET_VER) +AC_SUBST(TARGET_OS) +AC_SUBST(TARGET_ARCH) +AC_SUBST(TARGET_PLATFORM) + +dnl Figure out how to invoke "install" and what install options to use. +AC_PROG_INSTALL + +dnl Get O/S, Distribution, init, inetd, system-specific directories +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 test "$dist_type" = solaris -a "$dist_ver" != smf11; then + AC_DEFINE(SOLARIS_10,yes) +fi + +dnl Do they just want to see where things will go? +if test x${showdirs_only} = xyes; then + AC_CONFIG_FILES([paths]) + AC_OUTPUT() + chmod 755 paths + ./paths + exit 0 +fi + +AC_CONFIG_HEADERS([include/config.h]) +AC_CONFIG_FILES([Makefile + src/Makefile + nrpe.spec + uninstall + sample-config/nrpe.cfg + startup/bsd-init + startup/debian-init + startup/default-init + startup/default-inetd + startup/default-service + startup/default-socket + startup/default-socket-svc + startup/default-xinetd + startup/mac-init.plist + startup/mac-inetd.plist + startup/newbsd-init + startup/openbsd-init + startup/openrc-conf + startup/openrc-init + startup/solaris-init.xml + startup/solaris-inetd.xml + startup/tmpfile.conf + startup/upstart-init + startup/rh-upstart-init + include/common.h +]) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET + +dnl Checks for header files. +AC_HEADER_STDC +AC_HEADER_TIME +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(ctype.h dirent.h errno.h fcntl.h getopt.h grp.h inttypes.h) +AC_CHECK_HEADERS(netdb.h pwd.h signal.h stdint.h strings.h string.h syslog.h) +AC_CHECK_HEADERS(tcpd.h unistd.h arpa/inet.h netinet/in.h socket.h sys/types.h) +AC_CHECK_HEADERS(sys/time.h sys/resource.h sys/wait.h sys/socket.h sys/stat.h) +AC_CHECK_HEADERS(paths.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_STRUCT_TM +AC_TYPE_MODE_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SIGNAL +AC_TYPE_GETGROUPS + +dnl Check lengths for later tests of u_int32_t and int32_t +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(long) + +dnl Define u_int32_t if we don't have it already (Solaris, etc.) +AC_CHECK_TYPE(uint32_t,unsigned int) +AC_CHECK_TYPE(u_int32_t,unsigned int) +if test "$ac_cv_type_u_int32_t" = no ; then + if test "$ac_cv_type_u_int32_t" = yes ; then + AC_DEFINE(U_INT32_T_IS_UINT32_T,[1],[u_int32_t is uint32_t]) + else + if test "$ac_cv_sizeof_int" = 4 ; then + AC_DEFINE(U_INT32_T_IS_UINT,[1],[u_int32_t is uint]) + else + if test "$ac_cv_sizeof_long" = 4 ; then + AC_DEFINE(U_INT32_T_IS_ULONG,[1],[u_int32_t is ulong]) + else + if test "$ac_cv_sizeof_short" = 4 ; then + AC_DEFINE(U_INT32_T_IS_USHORT,[1],[u_int32_t is ushort]) + fi + fi + fi + fi +fi + +dnl Define int32_t if we don't have it already +AC_CHECK_TYPE(int32_t,int) +if test "$ac_cv_type_int32_t" = no ; then + if test "$ac_cv_sizeof_int" = 4 ; then + AC_DEFINE(INT32_T_IS_UINT,[1],[int32_t is uint]) + else + if test "$ac_cv_sizeof_long" = 4 ; then + AC_DEFINE(INT32_T_IS_ULONG,[1],[int32_t is ulong]) + else + if test "$ac_cv_sizeof_short" = 4 ; then + AC_DEFINE(INT32_T_IS_USHORT,[1],[int32_t is ushort]) + fi + fi + fi +fi + +dnl Check for struct sockaddr_storate +AC_CHECK_TYPES([struct sockaddr_storage],[],[],[#include ]) + +dnl Should we use seteuid() or setresuid()? +AC_CHECK_FUNC(seteuid, + AC_DEFINE(SETEUID(id),[seteuid(id)]), + AC_DEFINE(SETEUID(id),[setresuid((uid_t) -1, id, (uid_t) -1)]) +) + +dnl Check for asprintf() and friends... +AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[ +AC_TRY_LINK([#include +va_list ap1,ap2;], [va_copy(ap1,ap2);], +ac_cv_HAVE_VA_COPY=yes, +ac_cv_HAVE_VA_COPY=no)]) +if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then + AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available]) +else + AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[ + AC_TRY_LINK([#include + va_list ap1,ap2;], [__va_copy(ap1,ap2);], + ac_cv_HAVE___VA_COPY=yes, + ac_cv_HAVE___VA_COPY=no)]) + if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then + AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available]) + fi +fi + +AC_CHECK_FUNC(vsnprintf,,SNPRINTF_O=./snprintf.o) +AC_CHECK_FUNC(snprintf,,SNPRINTF_O=./snprintf.o) +AC_CHECK_FUNC(asprintf,,SNPRINTF_O=./snprintf.o) +AC_CHECK_FUNC(vasprintf,,SNPRINTF_O=./snprintf.o) + +AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[ +AC_TRY_RUN([ +#include +#include +void foo(const char *format, ...) { + va_list ap; + int len; + char buf[5]; + + va_start(ap, format); + len = vsnprintf(buf, 0, format, ap); + va_end(ap); + if (len != 5) exit(1); + + va_start(ap, format); + len = vsnprintf(0, 0, format, ap); + va_end(ap); + if (len != 5) exit(1); + + if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); + + exit(0); +} +main() { foo("hello"); } +], +ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)]) +if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then + AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf]) +fi + +dnl AC_CHECK_FUNC(snprintf,AC_DEFINE(HAVE_SNPRINTF),SNPRINTF_O=./snprintf.o) + +dnl Check for getopt_long (Solaris) +AC_CHECK_FUNCS([getopt_long],,AC_CHECK_LIB([iberty],[getopt_long],OTHERLIBS="$OTHERLIBS -liberty")) + +dnl Checks for library functions. +AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl") +AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket") +AC_CHECK_LIB(wrap,main,[ + LIBWRAPLIBS="$LIBWRAPLIBS -lwrap" + AC_DEFINE(HAVE_LIBWRAP,[1],[Have the TCP wrappers library]) + AC_TRY_LINK([#include + ],[int a = rfc931_timeout;],AC_DEFINE(HAVE_RFC931_TIMEOUT)) + ]) +AC_CHECK_FUNCS(strdup strstr strtoul strtok_r initgroups closesocket sigaction) + +dnl socklen_t check - from curl +AC_CHECK_TYPE([socklen_t], ,[ + AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([curl_cv_socklen_t_equiv], + [ + # Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + curl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ + #ifdef HAVE_SYS_TYPES_H + #include + #endif + #ifdef HAVE_SYS_SOCKET_H + #include + #endif + + int getpeername (int, $arg2 *, $t *); + ],[ + $t len; + getpeername(0,0,&len); + ],[ + curl_cv_socklen_t_equiv="$t" + break + ]) + done + done + + if test "x$curl_cv_socklen_t_equiv" = x; then + AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) + fi + ]) + AC_MSG_RESULT($curl_cv_socklen_t_equiv) + AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined])], + [#include +#include ]) + + +AC_MSG_CHECKING(for type of socket size) +AC_TRY_COMPILE([#include +#include +#include +], +[int a = send(1, (const void *)0, (size_t *) 0, (int *) 0);], +[AC_DEFINE(SOCKET_SIZE_TYPE, size_t, [Socket Size Type]) AC_MSG_RESULT(size_t)], +[AC_DEFINE(SOCKET_SIZE_TYPE, int, [Socket Size Type]) AC_MSG_RESULT(int)]) + +dnl Does user want to check for SSL? +AC_ARG_ENABLE([ssl], + AS_HELP_STRING([--enable-ssl],[enables native SSL support]),[ + if test x$enableval = xyes; then + check_for_ssl=yes + else + check_for_ssl=no + fi + ],check_for_ssl=yes) + +dnl Optional SSL library and include paths +if test x$check_for_ssl = xyes; then + # need_dh should only be set for NRPE + need_dh=yes + AC_NAGIOS_GET_SSL +fi + +AC_ARG_WITH([log_facility], + AS_HELP_STRING([--with-log-facility=], + [sets NRPE syslog facility]), + [log_facility=$withval], + [log_facility=daemon]) +AC_DEFINE_UNQUOTED(NRPE_LOG_FACILITY,["$log_facility"],[NRPE syslog facility]) + +AC_ARG_WITH([nrpe_user], + AS_HELP_STRING([--with-nrpe-user=],[sets user name to run NRPE]), + [nrpe_user=$withval], + [nrpe_user=nagios]) + +AC_ARG_WITH([nrpe_group], + AS_HELP_STRING([--with-nrpe-group=],[sets group name to run NRPE]), + [nrpe_group=$withval], + [nrpe_group=nagios]) + +AC_ARG_WITH([nrpe_port], + AS_HELP_STRING([--with-nrpe-port=], + [sets port number for NRPE to listen on]), + [nrpe_port=$withval], + [nrpe_port=5666]) +NRPE_INSTALL_OPTS="-o $nrpe_user -g $nrpe_group" +AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,$nrpe_port,[Default port for NRPE daemon]) + +AC_ARG_WITH([nagios_user], + AS_HELP_STRING([--with-nagios-user=], + [sets user name for file permissions]), + [nagios_user=$withval], + [nagios_user=nagios]) +AC_ARG_WITH([nagios_group], + AS_HELP_STRING([--with-nagios-group=], + [sets group name file permissions]), + [nagios_group=$withval], + [nagios_group=nagios]) +NAGIOS_INSTALL_OPTS="-o $nagios_user -g $nagios_group" + + dnl On HP-UX the compile will fail with a 'Duplicate symbol "setenv"' error + dnl in '/usr/local/lib/libwrap.a(setenv.o)' and '/usr/local/lib/libiberty.a(setenv.o)' + dnl so allow duplicate symbols, and use the first one + if test "`uname -s`" = "HP-UX" ; then + LDFLAGS="$LDFLAGS -Wl,+allowdups"; + fi + +AC_ARG_ENABLE([command-args], + AS_HELP_STRING([--enable-command-args],[allows clients to specify command arguments. *** THIS IS A SECURITY RISK! *** Read the SECURITY file before using this option!]), + AC_DEFINE_UNQUOTED(ENABLE_COMMAND_ARGUMENTS,[1],[Enable command-line arguments])) + +AC_ARG_ENABLE([bash-command-substitution], + AS_HELP_STRING([--enable-bash-command-substitution],[allows clients to pass bash command substitutions of the form $(command). *** THIS IS A HIGH SECURITY RISK! *** Read the SECURITY file before using this option!]), + AC_DEFINE_UNQUOTED(ENABLE_BASH_COMMAND_SUBSTITUTION,[1],[Enable bash command substitution])) + + +AC_PATH_PROG(PERL,perl) +AC_OUTPUT() + +dnl Review options +echo "" +echo "" +AC_MSG_RESULT([*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:]) + +echo "";\ +echo " General Options:";\ +echo " -------------------------" + +AC_MSG_RESULT([ NRPE port: $nrpe_port]) +AC_MSG_RESULT([ NRPE user: $nrpe_user]) +AC_MSG_RESULT([ NRPE group: $nrpe_group]) +AC_MSG_RESULT([ Nagios user: $nagios_user]) +AC_MSG_RESULT([ Nagios group: $nagios_group]) + + +echo "";\ +echo "";\ +echo "Review the options above for accuracy. If they look okay,";\ +echo "type 'make all' to compile the NRPE daemon and client";\ +echo "or type 'make' to get a list of make options.";\ +echo "" diff --git a/configure.in b/configure.in deleted file mode 100644 index 0453f69..0000000 --- a/configure.in +++ /dev/null @@ -1,481 +0,0 @@ -dnl Process this -*-m4-*- file with autoconf to produce a configure script. - -dnl Disable caching -define([AC_CACHE_LOAD],) -define([AC_CACHE_SAVE],) - -AC_INIT([nrpe],[2.15],[nagios-users@lists.sourceforge.net],[nrpe],[http://www.nagios.org]) -AC_CONFIG_SRCDIR([src/nrpe.c]) -AC_CONFIG_HEADERS([include/config.h]) -AC_CONFIG_FILES([Makefile - subst - src/Makefile - package/solaris/Makefile - init-script - init-script.debian - init-script.suse - nrpe.spec - sample-config/nrpe.cfg - sample-config/nrpe.xinetd]) -AC_PREFIX_DEFAULT(/usr/local/nagios) - -PKG_NAME=nrpe -PKG_VERSION="2.15" -PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="09-06-2013" -RPM_RELEASE=1 -AC_SUBST(PKG_NAME) -AC_SUBST(PKG_VERSION) -AC_SUBST(PKG_HOME_URL) -AC_SUBST(PKG_REL_DATE) -AC_SUBST(RPM_RELEASE) - -dnl Figure out how to invoke "install" and what install options to use. -AC_PROG_INSTALL -AC_SUBST(INSTALL) - -dnl What OS are we running? -AC_CANONICAL_HOST - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_MAKE_SET - -dnl Checks for header files. -AC_HEADER_STDC -AC_HEADER_TIME -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(ctype.h dirent.h errno.h fcntl.h getopt.h grp.h inttypes.h netdb.h pwd.h signal.h stdint.h strings.h string.h syslog.h tcpd.h unistd.h arpa/inet.h netinet/in.h socket.h sys/types.h sys/time.h sys/resource.h sys/wait.h sys/socket.h sys/stat.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_STRUCT_TM -AC_TYPE_MODE_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_SIGNAL -AC_TYPE_GETGROUPS - -dnl Check lengths for later tests of u_int32_t and int32_t -AC_CHECK_SIZEOF(int) -AC_CHECK_SIZEOF(short) -AC_CHECK_SIZEOF(long) - -dnl Define u_int32_t if we don't have it already (Solaris, etc.) -AC_CHECK_TYPE(uint32_t,unsigned int) -AC_CHECK_TYPE(u_int32_t,unsigned int) -if test "$ac_cv_type_u_int32_t" = no ; then - if test "$ac_cv_type_u_int32_t" = yes ; then - AC_DEFINE(U_INT32_T_IS_UINT32_T,[1],[u_int32_t is uint32_t]) - else - if test "$ac_cv_sizeof_int" = 4 ; then - AC_DEFINE(U_INT32_T_IS_UINT,[1],[u_int32_t is uint]) - else - if test "$ac_cv_sizeof_long" = 4 ; then - AC_DEFINE(U_INT32_T_IS_ULONG,[1],[u_int32_t is ulong]) - else - if test "$ac_cv_sizeof_short" = 4 ; then - AC_DEFINE(U_INT32_T_IS_USHORT,[1],[u_int32_t is ushort]) - fi - fi - fi - fi -fi - -dnl Define int32_t if we don't have it already -AC_CHECK_TYPE(int32_t,int) -if test "$ac_cv_type_int32_t" = no ; then - if test "$ac_cv_sizeof_int" = 4 ; then - AC_DEFINE(INT32_T_IS_UINT,[1],[int32_t is uint]) - else - if test "$ac_cv_sizeof_long" = 4 ; then - AC_DEFINE(INT32_T_IS_ULONG,[1],[int32_t is ulong]) - else - if test "$ac_cv_sizeof_short" = 4 ; then - AC_DEFINE(INT32_T_IS_USHORT,[1],[int32_t is ushort]) - fi - fi - fi -fi - - -dnl Check for asprintf() and friends... -AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[ -AC_TRY_LINK([#include -va_list ap1,ap2;], [va_copy(ap1,ap2);], -ac_cv_HAVE_VA_COPY=yes, -ac_cv_HAVE_VA_COPY=no)]) -if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then - AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available]) -else - AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[ - AC_TRY_LINK([#include - va_list ap1,ap2;], [__va_copy(ap1,ap2);], - ac_cv_HAVE___VA_COPY=yes, - ac_cv_HAVE___VA_COPY=no)]) - if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then - AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available]) - fi -fi - -AC_CHECK_FUNC(vsnprintf,,SNPRINTF_O=./snprintf.o) -AC_CHECK_FUNC(snprintf,,SNPRINTF_O=./snprintf.o) -AC_CHECK_FUNC(asprintf,,SNPRINTF_O=./snprintf.o) -AC_CHECK_FUNC(vasprintf,,SNPRINTF_O=./snprintf.o) - -AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[ -AC_TRY_RUN([ -#include -#include -void foo(const char *format, ...) { - va_list ap; - int len; - char buf[5]; - - va_start(ap, format); - len = vsnprintf(buf, 0, format, ap); - va_end(ap); - if (len != 5) exit(1); - - va_start(ap, format); - len = vsnprintf(0, 0, format, ap); - va_end(ap); - if (len != 5) exit(1); - - if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); - - exit(0); -} -main() { foo("hello"); } -], -ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)]) -if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then - AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf]) -fi - -dnl AC_CHECK_FUNC(snprintf,AC_DEFINE(HAVE_SNPRINTF),SNPRINTF_O=./snprintf.o) -AC_SUBST(SNPRINTF_O) - -dnl Check for getopt_long (Solaris) -AC_CHECK_FUNCS([getopt_long],,AC_CHECK_LIB([iberty],[getopt_long],OTHERLIBS="$OTHERLIBS -liberty")) -AC_SUBST(OTHERLIBS) - -dnl Checks for library functions. -AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl") -AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket") -AC_SUBST(SOCKETLIBS) -AC_CHECK_LIB(wrap,main,[ - LIBWRAPLIBS="$LIBWRAPLIBS -lwrap" - AC_DEFINE(HAVE_LIBWRAP,[1],[Have the TCP wrappers library]) - ]) -AC_SUBST(LIBWRAPLIBS) -AC_CHECK_FUNCS(strdup strstr strtoul initgroups closesocket) - -dnl socklen_t check - from curl -AC_CHECK_TYPE([socklen_t], ,[ - AC_MSG_CHECKING([for socklen_t equivalent]) - AC_CACHE_VAL([curl_cv_socklen_t_equiv], - [ - # Systems have either "struct sockaddr *" or - # "void *" as the second argument to getpeername - curl_cv_socklen_t_equiv= - for arg2 in "struct sockaddr" void; do - for t in int size_t unsigned long "unsigned long"; do - AC_TRY_COMPILE([ - #ifdef HAVE_SYS_TYPES_H - #include - #endif - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - - int getpeername (int, $arg2 *, $t *); - ],[ - $t len; - getpeername(0,0,&len); - ],[ - curl_cv_socklen_t_equiv="$t" - break - ]) - done - done - - if test "x$curl_cv_socklen_t_equiv" = x; then - AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) - fi - ]) - AC_MSG_RESULT($curl_cv_socklen_t_equiv) - AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv, - [type to use in place of socklen_t if not defined])], - [#include -#include ]) - - -AC_MSG_CHECKING(for type of socket size) -AC_TRY_COMPILE([#include -#include -#include -], -[int a = send(1, (const void *)0, (size_t *) 0, (int *) 0);], -[AC_DEFINE(SOCKET_SIZE_TYPE, size_t, [Socket Size Type]) AC_MSG_RESULT(size_t)], -[AC_DEFINE(SOCKET_SIZE_TYPE, int, [Socket Size Type]) AC_MSG_RESULT(int)]) - -dnl Stolen from Python code: loewis@users.sourceforge.net -#AC_CHECK_TYPE(socklen_t,int, -# AC_DEFINE(socklen_t,int, -# Define to `int' if does not define.),[ -# #ifdef HAVE_SYS_TYPES_H -# #include -# #endif -# #ifdef HAVE_SYS_SOCKET_H -# #include -# #endif -# ]) - -dnl Does user want to check for SSL? -AC_ARG_ENABLE([ssl], - AS_HELP_STRING([--enable-ssl],[enables native SSL support]),[ - if test x$enableval = xyes; then - check_for_ssl=yes - else - check_for_ssl=no - fi - ],check_for_ssl=yes) - -dnl Optional SSL library and include paths -ssl_dir= -ssl_inc_dir= -ssl_lib_dir= -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]) -AC_ARG_WITH([kerberos-inc], - AS_HELP_STRING([--with-kerberos-inc=DIR], - [sets location of the Kerberos include files]), - [kerberos_inc_dir=$withval]) - -dnl Check for SSL support -dnl Modified version of Mark Ethan Trostler's macro -if test x$check_for_ssl = xyes; then - AC_MSG_CHECKING(for SSL headers) - found_ssl=no - for dir in $ssl_inc_dir $ssl_dir /usr/local/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /usr/freeware/lib/openssl /usr/sfw/include; do - ssldir="$dir" - if test -f "$dir/include/openssl/ssl.h"; then - found_ssl=yes - CFLAGS="$CFLAGS -I$dir/include/openssl -I$ssldir/include" - sslincdir="$dir/include/openssl" - break - fi - if test -f "$dir/include/ssl.h"; then - found_ssl=yes - CFLAGS="$CFLAGS -I$dir/include" - sslincdir="$dir/include" - break - fi - if test -f "$dir/ssl.h"; then - found_ssl=yes - CFLAGS="$CFLAGS -I$dir" - sslincdir="$dir" - ssldir="$dir/.." - break - fi - if test -f "$dir/openssl/ssl.h"; then - found_ssl=yes - CFLAGS="$CFLAGS -I$dir/openssl" - sslincdir="$dir/openssl" - ssldir="$dir/.." - break - fi - done - - if test x_$found_ssl != x_yes; then - AC_MSG_ERROR(Cannot find ssl headers) - else - - printf "SSL headers found in $ssldir\n"; - - dnl Now try and find SSL libraries - AC_MSG_CHECKING(for SSL libraries) - found_ssl=no - for dir in $ssl_lib_dir $ssl_dir /usr/lib64 /usr/lib /usr/local/lib /usr/lib/ssl /usr/ssl/lib /usr/openssl/lib /usr/pkg/lib /usr/freeware/lib/openssl /usr/sfw/lib /opt/freeware/lib; do - ssllibdir="$dir" - if test "`uname -s`" = "Darwin" ; then - soext="dylib" - elif test "`uname -s`" = "HP-UX" ; then - soext="sl" - else - soext="so" - fi - if test -f "$dir/libssl.$soext"; then - found_ssl=yes - break - fi - done - - if test x_$found_ssl != x_yes; then - AC_MSG_ERROR(Cannot find ssl libraries) - else - printf "SSL libraries found in $ssllibdir\n"; - - LDFLAGS="$LDFLAGS -L$ssllibdir"; - LIBS="$LIBS -lssl -lcrypto"; - - AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support]) - AC_SUBST(HAVE_SSL) - - dnl Generate DH parameters - echo "" - echo "*** Generating DH Parameters for SSL/TLS ***" - if test -f "$ssldir/sbin/openssl"; then - sslbin=$ssldir/sbin/openssl - else - sslbin=$ssldir/bin/openssl - fi - # awk to strip off meta data at bottom of dhparam output - $sslbin dhparam -C 512 | awk '/^-----/ {exit} {print}' > include/dh.h - fi - fi - - dnl RedHat 8.0 and 9.0 include openssl compiled with kerberos, so we must include header file - AC_MSG_CHECKING(for Kerberos include files) - found_kerberos=no - for dir in $kerberos_inc_dir /usr/kerberos/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]) - dnl AC_CHECK_HEADERS(krb5.h) - break - fi - done - - if test x_$found_kerberos != x_yes; then - printf "could not find include files\n"; - else - printf "found Kerberos include files in $kerbdir\n"; - fi - - -fi - -AC_ARG_WITH([log_facility], - AS_HELP_STRING([--with-log-facility=], - [sets NRPE syslog facility]), - [log_facility=$withval], - [log_facility=daemon]) -AC_SUBST(log_facility) -AC_DEFINE_UNQUOTED(NRPE_LOG_FACILITY,["$log_facility"],[NRPE syslog facility]) - -AC_ARG_WITH([nrpe_user], - AS_HELP_STRING([--with-nrpe-user=],[sets user name to run NRPE]), - [nrpe_user=$withval], - [nrpe_user=nagios]) - -AC_ARG_WITH([nrpe_group], - AS_HELP_STRING([--with-nrpe-group=],[sets group name to run NRPE]), - [nrpe_group=$withval], - [nrpe_group=nagios]) - -AC_ARG_WITH([nrpe_port], - AS_HELP_STRING([--with-nrpe-port=], - [sets port number for NRPE to listen on]), - [nrpe_port=$withval], - [nrpe_port=5666]) -AC_SUBST(nrpe_user) -AC_SUBST(nrpe_group) -NRPE_INSTALL_OPTS="-o $nrpe_user -g $nrpe_group" -AC_SUBST(NRPE_INSTALL_OPTS) -AC_SUBST(nrpe_port) -AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,$nrpe_port,[Default port for NRPE daemon]) - -AC_ARG_WITH([nagios_user], - AS_HELP_STRING([--with-nagios-user=], - [sets user name for file permissions]), - [nagios_user=$withval], - [nagios_user=nagios]) -AC_ARG_WITH([nagios_group], - AS_HELP_STRING([--with-nagios-group=], - [sets group name file permissions]), - [nagios_group=$withval], - [nagios_group=nagios]) -AC_SUBST(nagios_user) -AC_SUBST(nagios_group) -NAGIOS_INSTALL_OPTS="-o $nagios_user -g $nagios_group" -AC_SUBST(NAGIOS_INSTALL_OPTS) - -# Determine target OS, version and architecture for package build macros -if test "x$target_ver" = "x" ; then - TARGET_VER=`uname -r` -else - TARGET_VER=$target_ver -fi -AC_SUBST(TARGET_VER) -if test "x$target_os" = "x" ; then - TARGET_OS=`uname -s` -else - TARGET_OS=$target_os -fi -AC_SUBST(TARGET_OS) -if test "x$target_cpu" = "x" ; then - TARGET_ARCH=`uname -p` -else - TARGET_ARCH=$target_cpu -fi -AC_SUBST(TARGET_ARCH) -TARGET_PLATFORM="" -if test "x$TARGET_OS" = "xSunOS" ; then - if test "x$TARGET_VER" = "x5.10" ; then - TARGET_PLATFORM="sol10" - fi -fi -AC_SUBST(TARGET_PLATFORM) - -AC_ARG_ENABLE([command-args], - AS_HELP_STRING([--enable-command-args],[allows clients to specify command arguments. *** THIS IS A SECURITY RISK! *** Read the SECURITY file before using this option!]), - AC_DEFINE_UNQUOTED(ENABLE_COMMAND_ARGUMENTS,[1],[Enable command-line arguments])) - -AC_ARG_ENABLE([bash-command-substitution], - AS_HELP_STRING([--enable-bash-command-substitution],[allows clients to pass bash command substitutions of the form $(command). *** THIS IS A HIGH SECURITY RISK! *** Read the SECURITY file before using this option!]), - AC_DEFINE_UNQUOTED(ENABLE_BASH_COMMAND_SUBSTITUTION,[1],[Enable bash command substitution])) - - -AC_PATH_PROG(PERL,perl) -AC_OUTPUT() - -perl subst init-script -perl subst init-script.debian -perl subst init-script.suse -perl subst sample-config/nrpe.cfg -perl subst sample-config/nrpe.xinetd - - -dnl Review options -echo "" -echo "" -AC_MSG_RESULT([*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:]) - -echo "" -echo " General Options:" -echo " -------------------------" - -AC_MSG_RESULT([ NRPE port: $nrpe_port]) -AC_MSG_RESULT([ NRPE user: $nrpe_user]) -AC_MSG_RESULT([ NRPE group: $nrpe_group]) -AC_MSG_RESULT([ Nagios user: $nagios_user]) -AC_MSG_RESULT([ Nagios group: $nagios_group]) - - -echo "" -echo "" -echo "Review the options above for accuracy. If they look okay," -echo "type 'make all' to compile the NRPE daemon and client." -echo "" diff --git a/docs/NRPE.odt b/docs/NRPE.odt index 2749e45..7cefad2 100644 Binary files a/docs/NRPE.odt and b/docs/NRPE.odt differ diff --git a/docs/NRPE.pdf b/docs/NRPE.pdf index b8e98a0..cdbd438 100644 Binary files a/docs/NRPE.pdf and b/docs/NRPE.pdf differ diff --git a/include/common.h b/include/common.h deleted file mode 100644 index 42dcfa2..0000000 --- a/include/common.h +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************ - * - * COMMON.H - NRPE Common Include File - * Copyright (c) 1999-2007 Ethan Galstad (nagios@nagios.org) - * Last Modified: 09-06-2013 - * - * License: - * - * 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, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - ************************************************************************/ - -#include "config.h" - -#define PROGRAM_VERSION "2.15" -#define MODIFICATION_DATE "09-06-2013" - -#define OK 0 -#define ERROR -1 - -#define TRUE 1 -#define FALSE 0 - -#define STATE_UNKNOWN 3 /* service state return codes */ -#define STATE_CRITICAL 2 -#define STATE_WARNING 1 -#define STATE_OK 0 - - -#define DEFAULT_SOCKET_TIMEOUT 10 /* timeout after 10 seconds */ -#define DEFAULT_CONNECTION_TIMEOUT 300 /* timeout if daemon is waiting for connection more than this time */ - -#define MAX_INPUT_BUFFER 2048 /* max size of most buffers we use */ -#define MAX_FILENAME_LENGTH 256 - -#define MAX_HOST_ADDRESS_LENGTH 256 /* max size of a host address */ - -#define NRPE_HELLO_COMMAND "_NRPE_CHECK" - -#define MAX_COMMAND_ARGUMENTS 16 - - -/**************** PACKET STRUCTURE DEFINITION **********/ - -#define QUERY_PACKET 1 /* id code for a packet containing a query */ -#define RESPONSE_PACKET 2 /* id code for a packet containing a response */ - -#define NRPE_PACKET_VERSION_3 3 /* packet version identifier */ -#define NRPE_PACKET_VERSION_2 2 -#define NRPE_PACKET_VERSION_1 1 /* older packet version identifiers (no longer supported) */ - -#define MAX_PACKETBUFFER_LENGTH 1024 /* max amount of data we'll send in one query/response */ - -typedef struct packet_struct{ - int16_t packet_version; - int16_t packet_type; - u_int32_t crc32_value; - int16_t result_code; - char buffer[MAX_PACKETBUFFER_LENGTH]; - }packet; - -/**************** OPERATING SYSTEM SPECIFIC DEFINITIONS **********/ -#if defined(__sun) || defined(__hpux) - -# ifndef LOG_AUTHPRIV -# define LOG_AUTHPRIV LOG_AUTH -# endif - -# ifndef LOG_FTP -# define LOG_FTP LOG_DAEMON -# endif - -#elif _AIX - -# include - -# ifndef LOG_FTP -# define LOG_FTP LOG_DAEMON -# endif - -#endif diff --git a/include/common.h.in b/include/common.h.in new file mode 100644 index 0000000..38d93c2 --- /dev/null +++ b/include/common.h.in @@ -0,0 +1,96 @@ +/************************************************************************ + * + * COMMON.H - NRPE Common Include File + * Copyright (c) 1999-2007 Ethan Galstad (nagios@nagios.org) + * Last Modified: 09-08-2016 + * + * License: + * + * 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + ************************************************************************/ + +#include "config.h" + +#ifdef HAVE_SSL +#include <@SSL_INC_PREFIX@@SSL_HDR@> +#endif + +#define PROGRAM_VERSION "3.0.1" +#define MODIFICATION_DATE "09-08-2016" + +#define OK 0 +#define ERROR -1 + +#define TRUE 1 +#define FALSE 0 + +#define STATE_UNKNOWN 3 /* service state return codes */ +#define STATE_CRITICAL 2 +#define STATE_WARNING 1 +#define STATE_OK 0 + + +#define DEFAULT_SOCKET_TIMEOUT 10 /* timeout after 10 seconds */ +#define DEFAULT_CONNECTION_TIMEOUT 300 /* timeout if daemon is waiting for connection more than this time */ + +#define MAX_INPUT_BUFFER 2048 /* max size of most buffers we use */ +#define MAX_FILENAME_LENGTH 256 +#define MAX_HOST_ADDRESS_LENGTH 256 /* max size of a host address */ +#define MAX_COMMAND_ARGUMENTS 16 + +#define NRPE_HELLO_COMMAND "_NRPE_CHECK" + +/**************** PACKET STRUCTURE DEFINITION **********/ + +#define QUERY_PACKET 1 /* id code for a packet containing a query */ +#define RESPONSE_PACKET 2 /* id code for a packet containing a response */ +#define NRPE_PACKET_VERSION_3 3 /* packet version identifier */ +#define NRPE_PACKET_VERSION_2 2 +#define NRPE_PACKET_VERSION_1 1 /* older packet version identifiers (no longer supported) */ + +#define MAX_PACKETBUFFER_LENGTH 1024 /* amount of data to send in one query/response vor version 2 */ + +typedef struct _v2_packet { + int16_t packet_version; + int16_t packet_type; + u_int32_t crc32_value; + int16_t result_code; + char buffer[MAX_PACKETBUFFER_LENGTH]; +} v2_packet; +typedef struct _v3_packet { + int16_t packet_version; + int16_t packet_type; + u_int32_t crc32_value; + int16_t result_code; + int16_t alignment; + int32_t buffer_length; + char buffer[1]; +} v3_packet; + +/**************** OPERATING SYSTEM SPECIFIC DEFINITIONS **********/ +#if defined(__sun) || defined(__hpux) + +# ifndef LOG_AUTHPRIV +# define LOG_AUTHPRIV LOG_AUTH +# endif +# ifndef LOG_FTP +# define LOG_FTP LOG_DAEMON +# endif +#elif defined(_AIX) +# include +# ifndef LOG_FTP +# define LOG_FTP LOG_DAEMON +# endif +#endif diff --git a/include/config.h.in b/include/config.h.in index 3ece168..f8fce61 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -33,26 +33,27 @@ #define NRPE_LOG_FACILITY @log_facility@ #undef ENABLE_COMMAND_ARGUMENTS - #undef ENABLE_BASH_COMMAND_SUBSTITUTION - #undef socklen_t - #undef HAVE_GETOPT_LONG - #undef HAVE_LIBWRAP - #undef STDC_HEADERS #undef HAVE_STRDUP #undef HAVE_STRSTR -#undef HAVE_STRTOUL +#undef HAVE_STRTOUL +#undef HAVE_STRTOK_R #undef HAVE_INITGROUPS #undef HAVE_CLOSESOCKET +#undef HAVE_SIGACTION +#undef HAVE_RFC931_TIMEOUT #undef SIZEOF_INT #undef SIZEOF_SHORT #undef SIZEOF_LONG +/* #undef const */ +#undef USE_SSL_DH + /* stupid stuff for u_int32_t */ #undef U_INT32_T_IS_USHORT #undef U_INT32_T_IS_UINT @@ -99,10 +100,16 @@ typedef int int32_t; #undef HAVE___VA_COPY - #define SOCKET_SIZE_TYPE "" #define GETGROUPS_T "" #define RETSIGTYPE "" +#undef HAVE_STRUCT_SOCKADDR_STORAGE + +/* Use seteuid() or setresuid() depending on the platform */ +#undef SETEUID + +/* Is this a Solaris 10 machine? */ +#undef SOLARIS_10 #undef HAVE_GETOPT_H #ifdef HAVE_GETOPT_H @@ -223,7 +230,7 @@ typedef int int32_t; #ifdef HAVE_PWD_H #include #endif - + #undef HAVE_GRP_H #ifdef HAVE_GRP_H #include @@ -235,15 +242,6 @@ typedef int int32_t; #endif #undef HAVE_SSL -#ifdef HAVE_SSL -#include -#include -#include -#include -#include -#include -#include -#endif #undef HAVE_KRB5_H #ifdef HAVE_KRB5_H diff --git a/include/dh.h b/include/dh.h deleted file mode 100644 index 1ad355a..0000000 --- a/include/dh.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef HEADER_DH_H -#include -#endif -DH *get_dh512() - { - static unsigned char dh512_p[]={ - 0xDA,0xD8,0xF0,0xA2,0x9A,0x64,0xC2,0x9F,0x22,0x9D,0x47,0xA1, - 0xB2,0xED,0xD6,0x89,0xB5,0x46,0x6D,0x4E,0x1F,0x14,0xF4,0xF4, - 0xEB,0xCA,0x4D,0x41,0x89,0x60,0x0D,0x1F,0xB3,0x50,0xC4,0x54, - 0xE1,0x60,0xB5,0xDD,0x57,0x0C,0xF9,0xF5,0x19,0x73,0x6C,0x0C, - 0x45,0x33,0xA9,0xC1,0xD7,0xF3,0x27,0x68,0xEE,0xDA,0x8C,0x4A, - 0x1C,0x52,0xA1,0x9B, - }; - static unsigned char dh512_g[]={ - 0x02, - }; - DH *dh; - - if ((dh=DH_new()) == NULL) return(NULL); - dh->p=BN_bin2bn(dh512_p,sizeof(dh512_p),NULL); - dh->g=BN_bin2bn(dh512_g,sizeof(dh512_g),NULL); - if ((dh->p == NULL) || (dh->g == NULL)) - { DH_free(dh); return(NULL); } - return(dh); - } diff --git a/include/nrpe.h b/include/nrpe.h index 63c2d23..a31d6da 100644 --- a/include/nrpe.h +++ b/include/nrpe.h @@ -22,44 +22,48 @@ * ************************************************************************/ - /* - * 08-10-2011 IPv4 subnetworks support added. - * Main change in nrpe.c is that is_an_allowed_host() moved to acl.c - * - */ - /**************** COMMAND STRUCTURE DEFINITION **********/ -typedef struct command_struct{ - char *command_name; - char *command_line; - struct command_struct *next; - }command; +typedef struct command_struct { + char *command_name; + char *command_line; + struct command_struct *next; +} command; -int process_arguments(int,char **); -void wait_for_connections(void); -void handle_connection(int); +int init(void); +void init_ssl(void); +void log_ssl_startup(void); +void usage(int); +void run_inetd(void); +void run_src(void); +void run_daemon(void); +void set_stdio_sigs(void); +void cleanup(void); int read_config_file(char *); int read_config_dir(char *); int get_log_facility(char *); int add_command(char *,char *); command *find_command(char *); -void sighandler(int); -int drop_privileges(char *,char *); -int check_privileges(void); - -int write_pid_file(void); -int remove_pid_file(void); - +void create_listener(struct addrinfo *ai); +void wait_for_connections(void); +void setup_wait_conn(void); +int wait_conn_fork(int sock); +void conn_check_peer(int sock); +void handle_connection(int); +void init_handle_conn(void); +int handle_conn_ssl(int sock, void *ssl_ptr); +int read_packet(int sock, void *ssl_ptr, v2_packet *v2_pkt, v3_packet **v3_pkt); void free_memory(void); -int validate_request(packet *); -int contains_nasty_metachars(char *); -int process_macros(char *,char *,int); -int my_system(char *,int,int *,char *,int); /* executes a command via popen(), but also protects against timeouts */ +int my_system(char*, int, int*, char**); /* executes a command via popen(), but also protects against timeouts */ void my_system_sighandler(int); /* handles timeouts when executing commands via my_system() */ void my_connection_sighandler(int); /* handles timeouts of connection */ - +int drop_privileges(char *,char *, int); +int write_pid_file(void); +int remove_pid_file(void); +int check_privileges(void); void sighandler(int); void child_sighandler(int); - - +int validate_request(v2_packet *, v3_packet *); +int contains_nasty_metachars(char *); +int process_macros(char *,char *,int); +int process_arguments(int,char **); diff --git a/include/utils.h b/include/utils.h index bf5cce7..37bfcc8 100644 --- a/include/utils.h +++ b/include/utils.h @@ -29,35 +29,27 @@ * ************************************************************************************************/ -#ifndef _UTILS_H -#define _UTILS_H +#ifndef NRPE_UTILS_H_INCLUDED +#define NRPE_UTILS_H_INCLUDED #include "../include/config.h" - void generate_crc32_table(void); -unsigned long calculate_crc32(char *, int); - -void randomize_buffer(char *,int); - -int my_tcp_connect(char *,int,int *); -int my_connect(const char *, struct sockaddr_storage *, u_short, int, - const char *); - -void add_listen_addr(struct addrinfo **, int, char *, int); - -void strip(char *); - -int sendall(int,char *,int *); -int recvall(int,char *,int *,int); - -char *my_strsep(char **,const char *); - +unsigned long calculate_crc32(char*, int); +void randomize_buffer(char*,int); +int my_tcp_connect(char*, int, int*); +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE +int my_connect(const char*, struct sockaddr_storage*, u_short, int, const char*); +#else +int my_connect(const char*, struct sockaddr*, u_short, int, const char*); +#endif +void add_listen_addr(struct addrinfo**, int, char*, int); +int clean_environ(const char *keep_env_vars, const char *nrpe_user); +char* strip(char*); +int sendall(int, char*, int*); +int recvall(int, char*, int*, int); +char *my_strsep(char**, const char*); +int b64_decode(unsigned char *encoded); void display_license(void); #endif - - - - - diff --git a/init-script.debian.in b/init-script.debian.in deleted file mode 100644 index 8965da9..0000000 --- a/init-script.debian.in +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# Start/stop the nrpe daemon. -# -# Contributed by Andrew Ryder 06-22-02 -# Slight mods by Ethan Galstad 07-09-02 - -NrpeBin=@bindir@/nrpe -NrpeCfg=@sysconfdir@/nrpe.cfg - -test -f $NrpeBin || exit 0 - -case "$1" in -start) echo -n "Starting nagios remote plugin daemon: nrpe" - start-stop-daemon --start --quiet --exec $NrpeBin -- -c $NrpeCfg -d - echo "." - ;; -stop) echo -n "Stopping nagios remote plugin daemon: nrpe" - start-stop-daemon --stop --quiet --exec $NrpeBin - echo "." - ;; -restart) echo -n "Restarting nagios remote plugin daemon: nrpe" - start-stop-daemon --stop --quiet --exec $NrpeBin - start-stop-daemon --start --quiet --exec $NrpeBin -- -c $NrpeCfg -d - echo "." - ;; -reload|force-reload) echo -n "Reloading configuration files for nagios remote plugin daemon: nrpe" - # nrpe reloads automatically - echo "." - ;; -*) echo "Usage: /etc/init.d/nrpe start|stop|restart|reload|force-reload" - exit 1 - ;; -esac -exit 0 diff --git a/init-script.in b/init-script.in deleted file mode 100644 index 07b17c7..0000000 --- a/init-script.in +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -# -# Created 2000-01-03 by jaclu@grm.se -# -# nrpe This shell script takes care of starting and stopping -# nrpe. -# -# chkconfig: 2345 80 30 -# description: nrpe is a daemon for a remote nagios server, \ -# running nagios plugins on this host. -# processname: nrpe -# config: /usr/local/nagios/etc/nrpe.cfg - - -# Source function library -if [ -f /etc/rc.d/init.d/functions ]; then -. /etc/rc.d/init.d/functions -elif [ -f /etc/init.d/functions ]; then -. /etc/init.d/functions -elif [ -f /etc/rc.d/functions ]; then -. /etc/rc.d/functions -fi - -# Source networking configuration. -. /etc/sysconfig/network - -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 - -NrpeBin=@bindir@/nrpe -NrpeCfg=@sysconfdir@/nrpe.cfg -LockFile=/var/lock/subsys/nrpe - -# See how we were called. -case "$1" in - start) - # Start daemons. - echo -n "Starting nrpe: " - daemon $NrpeBin -c $NrpeCfg -d - echo - touch $LockFile - ;; - stop) - # Stop daemons. - echo -n "Shutting down nrpe: " - killproc nrpe - echo - rm -f $LockFile - ;; - restart) - $0 stop - $0 start - ;; - status) - status nrpe - ;; - *) - echo "Usage: nrpe {start|stop|restart|status}" - exit 1 -esac - -exit 0 diff --git a/init-script.suse.in b/init-script.suse.in deleted file mode 100644 index 4dab941..0000000 --- a/init-script.suse.in +++ /dev/null @@ -1,84 +0,0 @@ -#! /bin/sh -# Copyright (c) 1996-2002 SuSE GmbH Nuernberg, Germany. All rights reserved. -# Modifications for NRPE Copyright (c) 2003 Subhendu Ghosh -# Author: Christopher Mahmood , Remo Behn -# Modifications for NRPE: Subhendu Ghosh -# -# /etc/init.d/nrpe -# -### BEGIN INIT INFO -# Provides: nrpe -# Required-Start: $network -# Required-Stop: -# Default-Start: 2 3 5 -# Default-Stop: 0 1 6 -# Description: start nrpe -### END INIT INFO - -NRPEBIN=@bindir@/nrpe -NRPECFG=@sysconfdir@/nrpe.cfg - -test -x $NRPEBIN || exit 5 - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -. /etc/rc.status - -# First reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - insufficient privilege -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signalling is not supported) are -# considered a success. - - -case "$1" in - start) - echo -n "Starting nrpe:" - startproc $NRPEBIN -c $NRPECFG -d - rc_status -v - rc_reset - - ;; - stop) - echo -n "Shutting down nrpe:" - killproc -TERM $NRPEBIN - rc_status -v ; rc_reset - ;; - restart) - $0 stop - $0 start - rc_status - ;; - status) - echo -n "Checking for service nrpe:" - checkproc $NRPEBIN - rc_status -v - rc_reset - - ;; - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; -esac -rc_exit - diff --git a/install-sh b/install-sh deleted file mode 100755 index ebc6691..0000000 --- a/install-sh +++ /dev/null @@ -1,250 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 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/LICENSE b/macros/LICENSE new file mode 100644 index 0000000..23cb790 --- /dev/null +++ b/macros/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + 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. + + GNU GENERAL PUBLIC LICENSE + 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. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/macros/README.md b/macros/README.md new file mode 100644 index 0000000..078eb3c --- /dev/null +++ b/macros/README.md @@ -0,0 +1,167 @@ +autoconf-macros README +====================== + +Sections below are: Purpose, Contents, Usage, References + + + +##Purpose + +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 and References section below. + +Since this project will be included in several parent projects, any +changes must be as project-neutral as possible. + + + +## 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`. 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..2ea11f4 --- /dev/null +++ b/macros/ax_nagios_get_distrib @@ -0,0 +1,158 @@ +# =========================================================================== +# 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 . +# +# 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|hp-ux], + dist_ver=$OSTYPE, + [solaris], + dist_ver=`echo $OSTYPE | 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..fd56735 --- /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 . +# +# 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..94ce32b --- /dev/null +++ b/macros/ax_nagios_get_inetd @@ -0,0 +1,145 @@ +# =========================================================================== +# 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 . +# +# 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="" + + if test x"$init_type" = "xupstart"; then + inetd_type="upstart" + elif test "$opsys" = "osx"; then + inetd_type="launchd" + fi + + if test x"$inetd_type" = x; then + 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`, + + [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`]) + fi + + 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" = "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..c43ef01 --- /dev/null +++ b/macros/ax_nagios_get_init @@ -0,0 +1,195 @@ +# =========================================================================== +# 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 . +# +# 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 + fi + fi + + PSCMD="ps -p1 -o args" + AS_CASE([$dist_type], + [aix], PSCMD="env UNIX95=1; ps -p1 -o args", + [solaris], PSCMD="env UNIX95=1; ps -p1 -o args", + [hp-ux], PSCMD="env UNIX95=1; ps -p1 -o args") + + 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 `/sbin/init --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 . +# +# 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..8a4ae37 --- /dev/null +++ b/macros/ax_nagios_get_paths @@ -0,0 +1,725 @@ +# =========================================================================== +# 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 . +# +# 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=], + [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) + + +need_cgi=no +need_web=no +need_brk=no +need_plg=no +need_pipe=no +need_spl=no +need_loc=no +need_log_subdir=no +need_etc_subdir=no +need_pls_dir=no + +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_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/$PKG_NAME.conf" +fi +subsyslockdir=${subsyslockdir="/var/lock/subsys"} +if test ! -d "$subsyslockdir"; then + subsyslockdir="N/A" + subsyslockfile="N/A" +else + subsyslockfile="$subsyslockdir/$PKG_NAME" +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/$PKG_NAME"} + else + logdir=${logdir="$localstatedir/log"} + fi + piddir=${piddir="$localstatedir/run/${PKG_NAME}"} + if test "$need_pipe" = yes; then + pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + else + pipedir="N/A" + fi + if test "$need_pls_dir" = yes; then + pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"} + else + pkglocalstatedir="N/A" + fi + if test "$need_spl" = yes; then + spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"} + 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/$PKG_NAME"} + else + pkglocalstatedir="N/A" + fi + if test "$need_loc" = yes; then + localedir=${localedir="/usr/local/share/locale//LC_MESSAGES/nagios-plugins.mo"} + fi + if test "$need_spl" = yes; then + spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"} + 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/${PKG_NAME}"} + if test "$need_pipe" = yes; then + pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + else + pipedir="N/A" + fi + if test $need_log_subdir = yes; then + logdir=${logdir="$localstatedir/log/$PKG_NAME"} + 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/$PKG_NAME"} + else + pkglocalstatedir="N/A" + fi + if test "$need_loc" = yes; then + localedir=${localedir="/usr/local/share/locale//LC_MESSAGES/nagios-plugins.mo"} + fi + if test "$need_spl" = yes; then + spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"} + 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/${PKG_NAME}"} + if test "$need_pipe" = yes; then + pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + else + pipedir="N/A" + fi + if test $need_log_subdir = yes; then + logdir=${logdir="$localstatedir/log/$PKG_NAME"} + 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 pkglocalstatedir=$pkglocalstatedir +eval webdir=$webdir +eval localedir=$localedir +eval sysconfdir=$sysconfdir +eval pkgsysconfdir=$pkgsysconfdir +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="$PKG_NAME"} + initconfdir=${initconfdir="/etc/conf.d"} + initconf=${initconf="$initconfdir/$PKG_NAME"}, + + [systemd], + if test $dist_type = "debian"; then + initdir=${initdir="/lib/systemd/system"} + else + initdir=${initdir="/usr/lib/systemd/system"} + fi + initname=${initname="$PKG_NAME.service"}, + + [bsd], + initdir=${initdir="/etc/rc.d"} + initname=${initname="rc.$PKG_NAME"}, + + [newbsd], + initdir=${initdir="/etc/rc.d"} + initname=${initname="$PKG_NAME"}, + + [gentoo], + initdir=${initdir="/etc/init.d"} + initname=${initname="$PKG_NAME"} + initconfdir=${initconfdir="/etc/init.d"} + initconf=${initconf="$initconfdir/$PKG_NAME"}, + + [openrc], + initdir=${initdir="/etc/init.d"} + initname=${initname="$PKG_NAME"} + initconfdir=${initconfdir="/etc/conf.d"} + initconf=${initconf="$initconfdir/$PKG_NAME"}, + + [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="$PKG_NAME.xml"} + initconfdir=unknown + initconf=unknown, + + [upstart], + initdir=${initdir="/etc/init"} + initname=${initname="$PKG_NAME.conf"} + initconfdir=${initconfdir="/etc/default"} + initconf=${initconf="$initconfdir/$PKG_NAME"}, + + [launchd], + initdir=${initdir="/Library/LaunchDaemons"} + initname=${initname="org.nagios.$PKG_NAME.plist"}, +# initconfdir=${initconfdir="/private/etc"} +# initconf=${initconf="$initconfdir/$PKG_NAME"}, + + + [*], + 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="$PKG_NAME"}, + + [systemd], + if test $dist_type = "debian"; then + inetddir=${inetddir="/lib/systemd/system"} + else + inetddir=${inetddir="/usr/lib/systemd/system"} + fi + netdname=${inetdname="$PKG_NAME.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="$PKG_NAME.xml"}, + +# [upstart], +# inetddir=${inetddir="/etc/init.d"} +# inetdname=${inetdname="$PKG_NAME"}, + + [launchd], + inetddir=${inetddir="/Library/LaunchDaemons"} + inetdname=${inetdname="org.nagios.$PKG_NAME.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..eda150e --- /dev/null +++ b/macros/ax_nagios_get_ssl @@ -0,0 +1,302 @@ +# =========================================================================== +# 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 . +# +# 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_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 +]) diff --git a/nrpe.spec b/nrpe.spec deleted file mode 100644 index 1b7af5c..0000000 --- a/nrpe.spec +++ /dev/null @@ -1,252 +0,0 @@ -%define isaix %(test "`uname -s`" = "AIX" && echo "1" || echo "0") -%define islinux %(test "`uname -s`" = "Linux" && echo "1" || echo "0") - -%if %{isaix} - %define _prefix /opt/nagios - %define _docdir %{_prefix}/doc/nrpe-2.15 - %define nshome /opt/nagios - %define _make gmake -%endif -%if %{islinux} - %define _init_dir /etc/init.d - %define _exec_prefix %{_prefix}/sbin - %define _bindir %{_prefix}/sbin - %define _sbindir %{_prefix}/lib/nagios/cgi - %define _libexecdir %{_prefix}/lib/nagios/plugins - %define _datadir %{_prefix}/share/nagios - %define _localstatedir /var/log/nagios - %define nshome /var/log/nagios - %define _make make -%endif -%define _sysconfdir /etc/nagios - -%define name nrpe -%define version 2.15 -%define release 1 -%define nsusr nagios -%define nsgrp nagios -%define nsport 5666 - -# Reserve option to override port setting with: -# rpm -ba|--rebuild --define 'nsport 5666' -%{?port:%define nsport %{port}} - -# Macro that print mesages to syslog at package (un)install time -%define nnmmsg logger -t %{name}/rpm - -Summary: Host/service/network monitoring agent for Nagios -URL: http://www.nagios.org -Name: %{name} -Version: %{version} -Release: %{release} -License: GPL -Group: Application/System -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-buildroot -Prefix: %{_prefix} -Prefix: /etc/init.d -Prefix: /etc/nagios -%if %{isaix} -Requires: nagios-plugins -%endif -%if %{islinux} -Requires: bash, grep, nagios-plugins, util-linux, chkconfig, shadow-utils, sed, initscripts, mktemp -%endif - -%description -NPRE (Nagios Remote Plugin Executor) is a system daemon that -will execute various Nagios plugins locally on behalf of a -remote (monitoring) host that uses the check_nrpe plugin. -Various plugins that can be executed by the daemon are available -at: http://sourceforge.net/projects/nagiosplug - -This package provides the client-side NRPE agent (daemon). - -%package plugin -Group: Application/System -Summary: Provides nrpe plugin for Nagios. -Requires: nagios-plugins - -%description plugin -NPRE (Nagios Remote Plugin Executor) is a system daemon that -will execute various Nagios plugins locally on behalf of a -remote (monitoring) host that uses the check_nrpe plugin. -Various plugins that can be executed by the daemon are available -at: http://sourceforge.net/projects/nagiosplug - -This package provides the server-side NRPE plugin for -Nagios-related applications. - -%prep -%setup -q - - -%pre -# Create `nagios' group on the system if necessary -%if %{isaix} -lsgroup %{nsgrp} > /dev/null 2> /dev/null -if [ $? -eq 2 ] ; then - mkgroup %{nsgrp} || %nnmmsg Unexpected error adding group "%{nsgrp}". Aborting install process. -fi -%endif -%if %{islinux} -getent group %{nsgrp} > /dev/null 2> /dev/null -if [ $? -ne 0 ] ; then - groupadd %{nsgrp} || %nnmmsg Unexpected error adding group "%{nsgrp}". Aborting install process. -fi -%endif - -# Create `nagios' user on the system if necessary -%if %{isaix} -lsuser %{nsusr} > /dev/null 2> /dev/null -if [ $? -eq 2 ] ; then - useradd -d %{nshome} -c "%{nsusr}" -g %{nsgrp} %{nsusr} || \ - %nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process. -fi -%endif -%if %{islinux} -getent passwd %{nsusr} > /dev/null 2> /dev/null -if [ $? -ne 0 ] ; then - useradd -r -d %{nshome} -c "%{nsusr}" -g %{nsgrp} %{nsusr} || \ - %nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process. -fi -%endif - -%if %{isaix} -# Check to see if the nrpe service is running and, if so, stop it. -/usr/bin/lssrc -s nrpe > /dev/null 2> /dev/null -if [ $? -eq 0 ] ; then - status=`/usr/bin/lssrc -s nrpe | /usr/bin/gawk '$1=="nrpe" {print $NF}'` - if [ "$status" = "active" ] ; then - /usr/bin/stopsrc -s nrpe - fi -fi -%endif - -%if %{islinux} -# if LSB standard /etc/init.d does not exist, -# create it as a symlink to the first match we find -if [ -d /etc/init.d -o -L /etc/init.d ]; then - : # we're done -elif [ -d /etc/rc.d/init.d ]; then - ln -s /etc/rc.d/init.d /etc/init.d -elif [ -d /usr/local/etc/rc.d ]; then - ln -s /usr/local/etc/rc.d /etc/init.d -elif [ -d /sbin/init.d ]; then - ln -s /sbin/init.d /etc/init.d -fi -%endif - -%if %{isaix} -%post -/usr/bin/lssrc -s nrpe > /dev/null 2> /dev/null -if [ $? -eq 1 ] ; then - /usr/bin/mkssys -p %{_bindir}/nrpe -s nrpe -u 0 -a "-c %{_sysconfdir}/nrpe.cfg -d -s" -Q -R -S -n 15 -f 9 -fi -/usr/bin/startsrc -s nrpe -%endif - -%preun -%if %{isaix} -status=`/usr/bin/lssrc -s nrpe | /usr/bin/gawk '$1=="nrpe" {print $NF}'` -if [ "$status" = "active" ] ; then - /usr/bin/stopsrc -s nrpe -fi -/usr/bin/rmssys -s nrpe -%endif -%if %{islinux} -if [ "$1" = 0 ]; then - /sbin/service nrpe stop > /dev/null 2>&1 - /sbin/chkconfig --del nrpe -fi -%endif - -%if %{islinux} -%postun -if [ "$1" -ge "1" ]; then - /sbin/service nrpe condrestart >/dev/null 2>&1 || : -fi -%endif - -%build -export PATH=$PATH:/usr/sbin -CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \ -MAKE=%{_make} ./configure \ - --with-init-dir=/etc/init.d \ - --with-nrpe-port=%{nsport} \ - --with-nrpe-user=%{nsusr} \ - --with-nrpe-group=%{nsgrp} \ - --prefix=%{_prefix} \ - --exec-prefix=%{_exec_prefix} \ - --bindir=%{_bindir} \ - --sbindir=%{_sbindir} \ - --libexecdir=%{_libexecdir} \ - --datadir=%{_datadir} \ - --sysconfdir=%{_sysconfdir} \ - --localstatedir=%{_localstatedir} \ - --enable-command-args -%{_make} all - -%install -[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT -%if %{islinux} -install -d -m 0755 ${RPM_BUILD_ROOT}%{_init_dir} -%endif -DESTDIR=${RPM_BUILD_ROOT} %{_make} install install-daemon-config -#install -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir} -#install -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir} -#install -d -m 0755 ${RPM_BUILD_ROOT}%{_libexecdir} - -# install templated configuration files -#cp sample-config/nrpe.cfg ${RPM_BUILD_ROOT}%{_sysconfdir}/nrpe.cfg -#%if %{isaix} -#cp init-script ${RPM_BUILD_ROOT}%{_init_dir}/nrpe -#%endif -#cp src/nrpe ${RPM_BUILD_ROOT}%{_bindir} -#cp src/check_nrpe ${RPM_BUILD_ROOT}%{_libexecdir} - -%clean -rm -rf $RPM_BUILD_ROOT - - -%files -%if %{islinux} -%defattr(755,root,root) -/etc/init.d/nrpe -%endif -%{_bindir}/nrpe -%dir %{_sysconfdir} -%defattr(600,%{nsusr},%{nsgrp}) -%config(noreplace) %{_sysconfdir}/*.cfg -%defattr(755,%{nsusr},%{nsgrp}) -%doc Changelog LEGAL README - -%files plugin -%defattr(755,%{nsusr},%{nsgrp}) -%{_libexecdir} -%defattr(644,%{nsusr},%{nsgrp}) -%doc Changelog LEGAL README - -%changelog -* Mon Mar 12 2012 Eric Stanley estanley<@>nagios.com -- Created autoconf input file -- Updated to support building on AIX -- Updated install to use make install* -* Mon Jan 23 2006 Andreas Kasenides ank<@>cs.ucy.ac.cy -- fixed nrpe.cfg relocation to sample-config -- replaced Copyright label with License -- added --enable-command-args to enable remote arg passing (if desired can be disabled by commenting out) - -* Wed Nov 12 2003 Ingimar Robertsson -- Added adding of nagios group if it does not exist. - -* Tue Jan 07 2003 James 'Showkilr' Peterson -- Removed the lines which removed the nagios user and group from the system -- changed the patch release version from 3 to 1 - -* Mon Jan 06 2003 James 'Showkilr' Peterson -- Removed patch files required for nrpe 1.5 -- Update spec file for version 1.6 (1.6-1) - -* Sat Dec 28 2002 James 'Showkilr' Peterson -- First RPM build (1.5-1) diff --git a/nrpe.spec.in b/nrpe.spec.in index 2bbf346..2f0d156 100644 --- a/nrpe.spec.in +++ b/nrpe.spec.in @@ -8,7 +8,7 @@ %define _make gmake %endif %if %{islinux} - %define _init_dir /etc/init.d + %define _init_dir @initdir@ %define _exec_prefix %{_prefix}/sbin %define _bindir %{_prefix}/sbin %define _sbindir %{_prefix}/lib/nagios/cgi @@ -26,6 +26,7 @@ %define nsusr @nrpe_user@ %define nsgrp @nrpe_group@ %define nsport @nrpe_port@ +%define ns_src_tmpfile "@src_tmpfile@" # Reserve option to override port setting with: # rpm -ba|--rebuild --define 'nsport 5666' @@ -44,7 +45,7 @@ Group: Application/System Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-buildroot Prefix: %{_prefix} -Prefix: /etc/init.d +Prefix: @initdir@ Prefix: /etc/nagios %if %{isaix} Requires: nagios-plugins @@ -80,38 +81,6 @@ Nagios-related applications. %prep %setup -q - -%pre -# Create `nagios' group on the system if necessary -%if %{isaix} -lsgroup %{nsgrp} > /dev/null 2> /dev/null -if [ $? -eq 2 ] ; then - mkgroup %{nsgrp} || %nnmmsg Unexpected error adding group "%{nsgrp}". Aborting install process. -fi -%endif -%if %{islinux} -getent group %{nsgrp} > /dev/null 2> /dev/null -if [ $? -ne 0 ] ; then - groupadd %{nsgrp} || %nnmmsg Unexpected error adding group "%{nsgrp}". Aborting install process. -fi -%endif - -# Create `nagios' user on the system if necessary -%if %{isaix} -lsuser %{nsusr} > /dev/null 2> /dev/null -if [ $? -eq 2 ] ; then - useradd -d %{nshome} -c "%{nsusr}" -g %{nsgrp} %{nsusr} || \ - %nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process. -fi -%endif -%if %{islinux} -getent passwd %{nsusr} > /dev/null 2> /dev/null -if [ $? -ne 0 ] ; then - useradd -r -d %{nshome} -c "%{nsusr}" -g %{nsgrp} %{nsusr} || \ - %nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process. -fi -%endif - %if %{isaix} # Check to see if the nrpe service is running and, if so, stop it. /usr/bin/lssrc -s nrpe > /dev/null 2> /dev/null @@ -123,20 +92,6 @@ if [ $? -eq 0 ] ; then fi %endif -%if %{islinux} -# if LSB standard /etc/init.d does not exist, -# create it as a symlink to the first match we find -if [ -d /etc/init.d -o -L /etc/init.d ]; then - : # we're done -elif [ -d /etc/rc.d/init.d ]; then - ln -s /etc/rc.d/init.d /etc/init.d -elif [ -d /usr/local/etc/rc.d ]; then - ln -s /usr/local/etc/rc.d /etc/init.d -elif [ -d /sbin/init.d ]; then - ln -s /sbin/init.d /etc/init.d -fi -%endif - %if %{isaix} %post /usr/bin/lssrc -s nrpe > /dev/null 2> /dev/null @@ -192,18 +147,8 @@ MAKE=%{_make} ./configure \ %if %{islinux} install -d -m 0755 ${RPM_BUILD_ROOT}%{_init_dir} %endif -DESTDIR=${RPM_BUILD_ROOT} %{_make} install install-daemon-config -#install -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir} -#install -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir} -#install -d -m 0755 ${RPM_BUILD_ROOT}%{_libexecdir} +DESTDIR=${RPM_BUILD_ROOT} %{_make} install-groups-users install install-config install-init -# install templated configuration files -#cp sample-config/nrpe.cfg ${RPM_BUILD_ROOT}%{_sysconfdir}/nrpe.cfg -#%if %{isaix} -#cp init-script ${RPM_BUILD_ROOT}%{_init_dir}/nrpe -#%endif -#cp src/nrpe ${RPM_BUILD_ROOT}%{_bindir} -#cp src/check_nrpe ${RPM_BUILD_ROOT}%{_libexecdir} %clean rm -rf $RPM_BUILD_ROOT @@ -212,26 +157,36 @@ rm -rf $RPM_BUILD_ROOT %files %if %{islinux} %defattr(755,root,root) -/etc/init.d/nrpe +@initdir@/@initname@ %endif %{_bindir}/nrpe %dir %{_sysconfdir} %defattr(600,%{nsusr},%{nsgrp}) %config(noreplace) %{_sysconfdir}/*.cfg %defattr(755,%{nsusr},%{nsgrp}) -%doc Changelog LEGAL README +%if %{ns_src_tmpfile} != "" +@tmpfilesd@ +%endif +%{_bindir}/nrpe-uninstall +%doc Changelog LEGAL README.md README.SSL.md SECURITY.md %files plugin %defattr(755,%{nsusr},%{nsgrp}) %{_libexecdir} %defattr(644,%{nsusr},%{nsgrp}) -%doc Changelog LEGAL README +%doc Changelog LEGAL README.md %changelog +* Thu Aug 18 2016 John Frickson jfrickson<@>nagios.com +- Changed 'make install-daemon-config' to 'make install-config' +- Added make targets 'install-groups-users' and 'install-init' +- Misc. changes + * Mon Mar 12 2012 Eric Stanley estanley<@>nagios.com - Created autoconf input file - Updated to support building on AIX - Updated install to use make install* + * Mon Jan 23 2006 Andreas Kasenides ank<@>cs.ucy.ac.cy - fixed nrpe.cfg relocation to sample-config - replaced Copyright label with License diff --git a/package/solaris/Makefile.in b/package/solaris/Makefile.in deleted file mode 100644 index 904d9b6..0000000 --- a/package/solaris/Makefile.in +++ /dev/null @@ -1,81 +0,0 @@ -################################### -# Makefile for NRPE Solaris Package -# -# Last Modified: 2 Dec 2011 -################################### - -TARGET_OS=@TARGET_OS@ -TARGET_VER=@TARGET_VER@ -TARGET_ARCH=@TARGET_ARCH@ -TARGET_PLATFORM=@TARGET_PLATFORM@ - -SOLARIS_CONFIG_OPTS=--prefix=/opt/nagios --sysconfdir=/etc/nagios --enable-command-args - -PKG_NAME=NGOSnrpe -PKG_VERSION=@PKG_VERSION@ -PKG_FILE=@PACKAGE_NAME@-$(PKG_VERSION)-$(TARGET_PLATFORM)-$(TARGET_ARCH)-local - -TOPDIR=@top_builddir@ -PKGDIR=@builddir@/pkg -SRCDIR=@builddir@/build/src -INSTALLDIR=@builddir@/install -ABSINSTALLDIR=@abs_builddir@/install - -build: - if [ ! -d build ] ; then mkdir build ; fi - if [ ! -d install ] ; then mkdir install ; fi - cd build; ../../../configure $(SOLARIS_CONFIG_OPTS); $(MAKE) all; DESTDIR=$(ABSINSTALLDIR) $(MAKE) install install-daemon-config - -prototype: $(PKGDIR) - @echo "i pkginfo" > $(PKGDIR)/prototype - @echo "i copyright=../$(TOPDIR)/LEGAL" >> $(PKGDIR)/prototype - @echo "i preinstall" >> $(PKGDIR)/prototype - @echo "i i.config" >> $(PKGDIR)/prototype - @echo "i r.config" >> $(PKGDIR)/prototype - @echo "i i.manifest=/usr/sadm/install/scripts/i.manifest" >> $(PKGDIR)/prototype - @echo "i r.manifest=/usr/sadm/install/scripts/r.manifest" >> $(PKGDIR)/prototype - @echo "d none /etc/nagios 0755 nagios nagios" >> $(PKGDIR)/prototype - @echo "f config /etc/nagios/nrpe.cfg=$(INSTALLDIR)/etc/nagios/nrpe.cfg 0600 nagios nagios" >> $(PKGDIR)/prototype - @echo "d none /opt/nagios/bin 0755 nagios bin" >> $(PKGDIR)/prototype - @echo "f none /opt/nagios/bin/nrpe=$(SRCDIR)/nrpe 0755 nagios bin" >> $(PKGDIR)/prototype - @echo "d none /opt/nagios/libexec 0755 nagios bin" >> $(PKGDIR)/prototype - @echo "f none /opt/nagios/libexec/check_nrpe=$(SRCDIR)/check_nrpe 0755 nagios bin" >> $(PKGDIR)/prototype - @echo "f none /lib/svc/method/nrpe=$(PKGDIR)/nrpe 0555 root bin" >> $(PKGDIR)/prototype - @echo "d none /var/svc/manifest/application/nagios 0755 root sys" >> $(PKGDIR)/prototype - @echo "f manifest /var/svc/manifest/application/nagios/nrpe.xml=$(PKGDIR)/nrpe.xml 0444 root sys" >> $(PKGDIR)/prototype - -pkginfo: $(PKGDIR) - @echo PKG="$(PKG_NAME)" > $(PKGDIR)/pkginfo - @echo NAME="Nagios Remote Plugin Executor $(PKG_VERSION)" >> $(PKGDIR)/pkginfo - @echo VERSION="$(PKG_VERSION)" >> $(PKGDIR)/pkginfo - @echo ARCH="$(TARGET_ARCH)" >> $(PKGDIR)/pkginfo - @echo CATEGORY="utility" >> $(PKGDIR)/pkginfo - @echo CLASSES="none config manifest" >> $(PKGDIR)/pkginfo - @echo VENDOR="www.nagios.org" >> $(PKGDIR)/pkginfo - @echo EMAIL="nagios-users@lists.sourceforge.net" >> $(PKGDIR)/pkginfo - @echo ISTATES="S s 1 2 3" >> $(PKGDIR)/pkginfo - @echo RSTATES="S s 1 2 3" >> $(PKGDIR)/pkginfo - @echo BASEDIR="/" >> $(PKGDIR)/pkginfo - -$(PKG_FILE): pkginfo prototype - pkgmk -o -d $(PKGDIR) -f $(PKGDIR)/prototype -r . - pkgtrans ./pkg $(PKG_FILE) $(PKG_NAME) - -pkg: $(PKG_FILE) - -all: pkg - -clean: - rm -rf build install package - rm -rf $(PKGDIR)/$(PKG_NAME) - rm -f $(PKGDIR)/prototype $(PKGDIR)/pkginfo - rm -f $(PKGDIR)/$(PKG_FILE) - rm -f core - rm -f *~ */*~ - -distclean: clean - rm -f Makefile - rm -f config.log - -devclean: distclean - diff --git a/package/solaris/pkg/i.config b/package/solaris/pkg/i.config deleted file mode 100644 index 2c58a34..0000000 --- a/package/solaris/pkg/i.config +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/sh - -create_cksum_file() { - srcfile=$1 - destfile=$2 - cksumfile=$3 - - echo "# DO NOT EDIT OR REMOVE THIS FILE - It is used to determine whether to" > $cksumfile - echo "# overwrite $destfile on package update or to remove" >> $cksumfile - echo "# it on package deletion." >> $cksumfile - /usr/bin/cat $srcfile | /usr/bin/cksum >> $cksumfile - /usr/bin/chmod 400 $cksumfile -} - -compare_cksum() { - destfile=$1 - cksumfile=$2 - - installed_cksum=`/usr/bin/tail -1 $cksumfile | /usr/bin/awk '{print $1}'` - current_cksum=`/usr/bin/cksum $destfile | /usr/bin/awk '{print $1}'` - test $installed_cksum = $current_cksum -} - -while read src dest ; do - destpath=`echo $dest | /usr/bin/sed -e 's/\/[^/]*$//'` - destbase=`/usr/bin/basename $dest` - cksumfile="${destpath}/.${destbase}.cksum" - if [ -f $dest ] ; then - if [ -f $cksumfile ] ; then - compare_cksum $dest $cksumfile - if [ $? -eq 0 ] ; then - /usr/bin/cp $src $dest - /usr/bin/chmod 600 $dest - /usr/bin/chown nagios:nagios $dest - else - echo "Existing $dest has been found --" - echo " installing $destbase as $dest.pkgnew" - /usr/bin/cp $src $dest.pkgnew - /usr/bin/chmod 600 $dest.pkgnew - /usr/bin/chown nagios:nagios $dest.pkgnew - fi - else - echo "Existing $dest has been found --" - echo " installing $destbase as $dest.pkgnew" - /usr/bin/cp $src $dest.pkgnew - /usr/bin/chmod 600 $dest.pkgnew - /usr/bin/chown nagios:nagios $dest.pkgnew - fi - else - create_cksum_file $src $dest $cksumfile - /usr/bin/cp $src $dest - /usr/bin/chmod 600 $dest - /usr/bin/chown nagios:nagios $dest - fi -done -if [ "$1" = "ENDOFCLASS" ] ; then - exit 0 -fi diff --git a/package/solaris/pkg/nrpe b/package/solaris/pkg/nrpe deleted file mode 100644 index c3d9593..0000000 --- a/package/solaris/pkg/nrpe +++ /dev/null @@ -1,32 +0,0 @@ -#!/sbin/sh -# - -NRPE=/opt/nagios/bin/nrpe -CFGFILE=/etc/nagios/nrpe.cfg -PIDFILE=/var/run/nrpe.pid - -case $1 in -'start') - $NRPE -c $CFGFILE -d - ;; - -'restart') - if [ -f "$PIDFILE" ]; then - /usr/bin/kill -HUP `/usr/bin/cat $PIDFILE` - fi - ;; - -'stop') - if [ -f "$PIDFILE" ]; then - /usr/bin/kill `/usr/bin/cat $PIDFILE` - /bin/rm -f $PIDFILE - fi - ;; - -*) - echo "Usage: $0 { start | restart | stop }" - exit 1 - ;; -esac - -exit $? diff --git a/package/solaris/pkg/nrpe.xml b/package/solaris/pkg/nrpe.xml deleted file mode 100644 index 1eb4913..0000000 --- a/package/solaris/pkg/nrpe.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/package/solaris/pkg/postinstall b/package/solaris/pkg/postinstall deleted file mode 100644 index b5f8db3..0000000 --- a/package/solaris/pkg/postinstall +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/sh - -echo "To begin using NRPE, first edit /etc/nagios/nrpe.cfg, update the" -echo "allowed_hosts line and any command lines. Then start the nrpe service" -echo "by running the command 'svcadm enable nrpe' as root." diff --git a/package/solaris/pkg/preinstall b/package/solaris/pkg/preinstall deleted file mode 100644 index c4cc269..0000000 --- a/package/solaris/pkg/preinstall +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/sh - -user="nagios" -uid=-1 -group="nagios" -gid=-1 - -/usr/bin/getent group $group > /dev/null 2> /dev/null -result=$? -if [ $result -eq 2 ] ; then - echo "Group $group does not exist. Creating..." - if [ $gid -ne -1 ] ; then - /usr/sbin/groupadd -g $gid $group - else - /usr/sbin/groupadd $group - fi -elif [ $result -ne 0 ] ; then - echo "An error occurred determining the existence of the groug $group. Terminating." - exit 1; -fi - -/usr/bin/getent passwd $user > /dev/null 2> /dev/null -result=$? -if [ $result -eq 2 ] ; then - echo "User $user does not exist. Creating..." - if [ $uid -ne -1 ] ; then - /usr/sbin/useradd -u $uid -g $group $user - else - /usr/sbin/useradd -g $group $user - fi -elif [ $result -ne 0 ] ; then - echo "An error occurred determining the existence of the user $user. Terminating." - exit 1; -fi - diff --git a/package/solaris/pkg/r.config b/package/solaris/pkg/r.config deleted file mode 100644 index 72871dd..0000000 --- a/package/solaris/pkg/r.config +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/sh - -compare_cksum() { - destfile=$1 - cksumfile=$2 - - installed_cksum=`/usr/bin/tail -1 $cksumfile | /usr/bin/awk '{print $1}'` - current_cksum=`/usr/bin/cksum $destfile | /usr/bin/awk '{print $1}'` - test $installed_cksum = $current_cksum -} - -while read path ; do - destpath=`echo $path | /usr/bin/sed -e 's/\/[^/]*$//'` - destbase=`/usr/bin/basename $path` - cksumfile="${destpath}/.${destbase}.cksum" - if [ -f $path ] ; then - if [ -f $cksumfile ] ; then - compare_cksum $path $cksumfile - if [ $? -eq 0 ] ; then - /usr/bin/rm -f $path $cksumfile - else - echo "$path has been modified since it was installed -- " - echo " leaving it in place." - fi - else - echo "$path may have been modified since it was installed -- " - echo " leaving it in place." - fi - fi -done -if [ "$1" = "ENDOFCLASS" ] ; then - exit 0 -fi diff --git a/paths.in b/paths.in new file mode 100755 index 0000000..fa1cc44 --- /dev/null +++ b/paths.in @@ -0,0 +1,85 @@ +#!/bin/sh + +wrout () { + if test "$2" != "N/A"; then printf " %-25s %s\n" "$1" "$2"; fi +} + +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "Detected Environment:" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +wrout "Operating System" "@opsys@" +wrout "Architecture" "@arch@" +wrout "Distribution type" "@dist_type@ Version @dist_ver@" +wrout "Init type" "@init_type@" +wrout "Inetd type" "@inetd_type@" +echo +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo "Paths are:" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +wrout "prefix" "@prefix@" +wrout "exec_prefix" "@prefix@" +if test "@PKG_NAME@" = "nagios"; then + wrout "bindir" "@bindir@" +fi +wrout "sbindir" "@sbindir@" +wrout "sysconfdir" "@sysconfdir@" +wrout "pkgsysconfdir" "@pkgsysconfdir@" +if test "@PKG_NAME@" = "nagios"; then + wrout "privatesysconfdir" "@privatesysconfdir@" +fi +wrout "localstatedir" "@localstatedir@" +wrout "pkglocalstatedir" "@pkglocalstatedir@" +wrout "datarootdir" "@datarootdir@" +wrout "datadir" "@datadir@" +wrout "webdir" "@webdir@" +wrout "localedir" "@localedir@" +wrout "logdir" "@logdir@" +wrout "piddir" "@piddir@" +wrout "pipedir" "@pipedir@" +wrout "spooldir" "@spooldir@" +wrout "libexecdir" "@libexecdir@" +wrout "brokersdir" "@brokersdir@" +wrout "pluginsdir" "@pluginsdir@" +wrout "cgibindir" "@cgibindir@" +wrout "initdir" "@initdir@" +wrout "inetddir" "@inetddir@" +wrout "subsyslockdir" "@subsyslockdir@" +echo +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo '@PKG_NAME@ files will be installed or created as follows:' +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +wrout "Config file" "@pkgsysconfdir@/@PKG_NAME@.cfg" +wrout "Object config dir" "@objsysconfdir@" +wrout "daemon" "@sbindir@/@PKG_NAME@" +if test "@PKG_NAME@" = "nrpe"; then + wrout "check_@PKG_NAME@" "@pluginsdir@/check_@PKG_NAME@" +fi +if test "@PKG_NAME@" = "nagios"; then + wrout "nagiostats (prog)" "@bindir@/nagiostats" + wrout "Website password file" "@pkgsysconfdir@/passwd" + wrout "resource.cfg" "@privatesysconfdir@/resource.cfg" + wrout "event handlers dir" "@brokersdir@" + wrout "cgi program dir" "@cgibindir@" + wrout "website file dir" "@webdir@" + wrout "status.dat" "@pkglocalstatedir@/status.dat" + wrout "retention.dat" "@pkglocalstatedir@/retention.dat" + wrout "object cache dir" "@pkglocalstatedir@" + wrout "log file" "@logdir@/@PKG_NAME@.log" + wrout "log archive dir" "@logdir@/archives" + wrout "@PKG_NAME@.configtest" "@logdir@/@PKG_NAME@.configtest" + wrout "@PKG_NAME@.cmd" "@pipedir@/@PKG_NAME@.cmd" + wrout "@PKG_NAME@.qh" "@pipedir@/@PKG_NAME@.qh" + wrout "perfdata file dir" "@spooldir@" + wrout "checkresult files" "@spooldir@/checkresults" +else + wrout "inetd config" "@inetddir@/@inetdname@" +fi +wrout "init script" "@initdir@/@initname@" +wrout "@PKG_NAME@.conf (tmpfiles.d)" "@tmpfilesd@" +wrout "@PKG_NAME@ lock file" "@piddir@/@PKG_NAME@.pid" +wrout "language files" "@localedir@" +wrout "init lock file" "@subsyslockfile@" +wrout "init source file" "@src_init@" +wrout "inetd source file" "@src_inetd@" +echo +echo "To show this list again, type './paths' at the prompt" diff --git a/sample-config/nrpe.cfg.in b/sample-config/nrpe.cfg.in index da6a280..0e1cff5 100644 --- a/sample-config/nrpe.cfg.in +++ b/sample-config/nrpe.cfg.in @@ -1,8 +1,8 @@ ############################################################################# -# Sample NRPE Config File +# Sample NRPE Config File # Written by: Ethan Galstad (nagios@nagios.org) -# -# Last Modified: 11-23-2007 +# +# Last Modified: 2016-05-10 # # NOTES: # This is a sample configuration file for the NRPE daemon. It needs to be @@ -18,12 +18,21 @@ log_facility=@log_facility@ +# DEBUGGING OPTION +# This option determines whether or not debugging messages are logged to the +# syslog facility. +# Values: 0=debugging off, 1=debugging on + +debug=0 + + + # PID FILE # The name of the file in which the NRPE daemon should write it's process ID # number. The file is only written if the NRPE daemon is started by the root # user and is running in standalone mode. -pid_file=/var/run/nrpe.pid +pid_file=@piddir@/nrpe.pid @@ -45,10 +54,18 @@ server_port=@nrpe_port@ +# LISTEN QUEUE SIZE +# Listen queue size (backlog) for serving incoming connections. +# You may want to increase this value under high load. + +#listen_queue_size=5 + + + # NRPE USER -# This determines the effective user that the NRPE daemon should run as. +# This determines the effective user that the NRPE daemon should run as. # You can either supply a username or a UID. -# +# # NOTE: This option is ignored if NRPE is running under either inetd or xinetd nrpe_user=@nrpe_user@ @@ -56,9 +73,9 @@ nrpe_user=@nrpe_user@ # NRPE GROUP -# This determines the effective group that the NRPE daemon should run as. +# This determines the effective group that the NRPE daemon should run as. # You can either supply a group name or a GID. -# +# # NOTE: This option is ignored if NRPE is running under either inetd or xinetd nrpe_group=@nrpe_group@ @@ -66,9 +83,9 @@ nrpe_group=@nrpe_group@ # ALLOWED HOST ADDRESSES -# This is an optional comma-delimited list of IP address or hostnames +# This is an optional comma-delimited list of IP address or hostnames # that are allowed to talk to the NRPE daemon. Network addresses with a bit mask -# (i.e. 192.168.1.0/24) are also supported. Hostname wildcards are not currently +# (i.e. 192.168.1.0/24) are also supported. Hostname wildcards are not currently # supported. # # Note: The daemon only does rudimentary checking of the client's IP @@ -79,16 +96,16 @@ nrpe_group=@nrpe_group@ # NOTE: This option is ignored if NRPE is running under either inetd or xinetd allowed_hosts=127.0.0.1 - + # COMMAND ARGUMENT PROCESSING # This option determines whether or not the NRPE daemon will allow clients # to specify arguments to commands that are executed. This option only works # if the daemon was configured with the --enable-command-args configure script -# option. +# option. # -# *** ENABLING THIS OPTION IS A SECURITY RISK! *** +# *** ENABLING THIS OPTION IS A SECURITY RISK! *** # Read the SECURITY file for information on some of the security implications # of enabling this variable. # @@ -101,15 +118,15 @@ dont_blame_nrpe=0 # BASH COMMAND SUBTITUTION # This option determines whether or not the NRPE daemon will allow clients # to specify arguments that contain bash command substitutions of the form -# $(...). This option only works if the daemon was configured with both -# the --enable-command-args and --enable-bash-command-substitution configure +# $(...). This option only works if the daemon was configured with both +# the --enable-command-args and --enable-bash-command-substitution configure # script options. # -# *** ENABLING THIS OPTION IS A HIGH SECURITY RISK! *** +# *** ENABLING THIS OPTION IS A HIGH SECURITY RISK! *** # Read the SECURITY file for information on some of the security implications # of enabling this variable. # -# Values: 0=do not allow bash command substitutions, +# Values: 0=do not allow bash command substitutions, # 1=allow bash command substitutions allow_bash_command_substitution=0 @@ -122,9 +139,9 @@ allow_bash_command_substitution=0 # command line from the command definition. # # *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! *** -# Usage scenario: +# Usage scenario: # Execute restricted commmands using sudo. For this to work, you need to add -# the nagios user to your /etc/sudoers. An example entry for alllowing +# the nagios user to your /etc/sudoers. An example entry for alllowing # execution of the plugins from might be: # # nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/ @@ -133,16 +150,7 @@ allow_bash_command_substitution=0 # without asking for a password. If you do this, make sure you don't give # random users write access to that directory or its contents! -# command_prefix=/usr/bin/sudo - - - -# DEBUGGING OPTION -# This option determines whether or not debugging messages are logged to the -# syslog facility. -# Values: 0=debugging off, 1=debugging on - -debug=0 +# command_prefix=/usr/bin/sudo @@ -165,7 +173,7 @@ connection_timeout=300 -# WEEK RANDOM SEED OPTION +# WEAK RANDOM SEED OPTION # This directive allows you to use SSL even if your system does not have # a /dev/random or /dev/urandom (on purpose or because the necessary patches # were not applied). The random number generator will be seeded from a file @@ -178,6 +186,66 @@ connection_timeout=300 +# SSL/TLS OPTIONS +# These directives allow you to specify how to use SSL/TLS. + +# SSL VERSION +# This can be any of: SSLv2 (only use SSLv2), SSLv2+ (use any version), +# SSLv3 (only use SSLv3), SSLv3+ (use SSLv3 or above), TLSv1 (only use +# TLSv1), TLSv1+ (use TLSv1 or above), TLSv1.1 (only use TLSv1.1), +# TLSv1.1+ (use TLSv1.1 or above), TLSv1.2 (only use TLSv1.2), +# TLSv1.2+ (use TLSv1.2 or above) +# If an "or above" version is used, the best will be negotiated. So if both +# ends are able to do TLSv1.2 and use specify SSLv2, you will get TLSv1.2. + +#ssl_version=SSLv2+ + +# SSL USE ADH +# This is for backward compatibility and is DEPRECATED. Set to 1 to enable +# ADH or 2 to require ADH. 1 is currently the default but will be changed +# in a later version. + +#ssl_use_adh=1 + +# SSL CIPHER LIST +# This lists which ciphers can be used. For backward compatibility, this +# defaults to 'ssl_cipher_list=ALL:!MD5:@STRENGTH' in this version but +# will be changed to something like the example below in a later version of NRPE. + +#ssl_cipher_list=ALL:!MD5:@STRENGTH +#ssl_cipher_list=ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!RC4:!MD5:@STRENGTH + +# SSL Certificate and Private Key Files + +#ssl_cacert_file=/etc/ssl/servercerts/ca-cert.pem +#ssl_cert_file=/etc/ssl/servercerts/nagios-cert.pem +#ssl_privatekey_file=/etc/ssl/servercerts/nagios-key.pem + +# SSL USE CLIENT CERTS +# This options determines client certificate usage. +# Values: 0 = Don't ask for or require client certificates (default) +# 1 = Ask for client certificates +# 2 = Require client certificates + +#ssl_client_certs=0 + +# SSL LOGGING +# This option determines which SSL messages are send to syslog. OR values +# together to specify multiple options. + +# Values: 0x00 (0) = No additional logging (default) +# 0x01 (1) = Log startup SSL/TLS parameters +# 0x02 (2) = Log remote IP address +# 0x04 (4) = Log SSL/TLS version of connections +# 0x08 (8) = Log which cipher is being used for the connection +# 0x10 (16) = Log if client has a certificate +# 0x20 (32) = Log details of client's certificate if it has one +# -1 or 0xff or 0x2f = All of the above + +#ssl_logging=0x00 + + + # INCLUDE CONFIG FILE # This directive allows you to include definitions from an external config file. @@ -216,20 +284,20 @@ connection_timeout=300 # The following examples use hardcoded command arguments... -command[check_users]=@libexecdir@/check_users -w 5 -c 10 -command[check_load]=@libexecdir@/check_load -w 15,10,5 -c 30,25,20 -command[check_hda1]=@libexecdir@/check_disk -w 20% -c 10% -p /dev/hda1 -command[check_zombie_procs]=@libexecdir@/check_procs -w 5 -c 10 -s Z -command[check_total_procs]=@libexecdir@/check_procs -w 150 -c 200 +command[check_users]=@pluginsdir@/check_users -w 5 -c 10 +command[check_load]=@pluginsdir@/check_load -w 15,10,5 -c 30,25,20 +command[check_hda1]=@pluginsdir@/check_disk -w 20% -c 10% -p /dev/hda1 +command[check_zombie_procs]=@pluginsdir@/check_procs -w 5 -c 10 -s Z +command[check_total_procs]=@pluginsdir@/check_procs -w 150 -c 200 # The following examples allow user-supplied arguments and can -# only be used if the NRPE daemon was compiled with support for +# only be used if the NRPE daemon was compiled with support for # command arguments *AND* the dont_blame_nrpe directive in this # config file is set to '1'. This poses a potential security risk, so # make sure you read the SECURITY file before doing this. -#command[check_users]=@libexecdir@/check_users -w $ARG1$ -c $ARG2$ -#command[check_load]=@libexecdir@/check_load -w $ARG1$ -c $ARG2$ -#command[check_disk]=@libexecdir@/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ -#command[check_procs]=@libexecdir@/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ +#command[check_users]=@pluginsdir@/check_users -w $ARG1$ -c $ARG2$ +#command[check_load]=@pluginsdir@/check_load -w $ARG1$ -c $ARG2$ +#command[check_disk]=@pluginsdir@/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ +#command[check_procs]=@pluginsdir@/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ diff --git a/sample-config/nrpe.xinetd.in b/sample-config/nrpe.xinetd.in deleted file mode 100644 index e49e627..0000000 --- a/sample-config/nrpe.xinetd.in +++ /dev/null @@ -1,16 +0,0 @@ -# default: on -# description: NRPE (Nagios Remote Plugin Executor) -service nrpe -{ - flags = REUSE - socket_type = stream - port = @nrpe_port@ - wait = no - user = @nrpe_user@ - group = @nrpe_group@ - server = @bindir@/nrpe - server_args = -c @sysconfdir@/nrpe.cfg --inetd - log_on_failure += USERID - disable = no - only_from = 127.0.0.1 -} diff --git a/src/Makefile.in b/src/Makefile.in index 68a7b88..9a1c0d4 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -10,6 +10,9 @@ srcdir=@srcdir@ SRC_INCLUDE=@srcdir@/../include CFG_INCLUDE=../include +# Mainly used for rpmbuild +# DESTDIR= + CC=@CC@ CFLAGS=@CFLAGS@ @DEFS@ -I $(CFG_INCLUDE) -I $(SRC_INCLUDE) LDFLAGS=@LDFLAGS@ @LIBS@ @@ -19,16 +22,22 @@ OTHERLIBS=@OTHERLIBS@ CP=@CP@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -CFGDIR=@sysconfdir@ -BINDIR=@bindir@ -SBINDIR=@sbindir@ -LIBEXECDIR=@libexecdir@ +prefix=$(DESTDIR)@prefix@ +exec_prefix=$(DESTDIR)@exec_prefix@ +CFGDIR=$(DESTDIR)@pkgsysconfdir@ +BINDIR=$(DESTDIR)@bindir@ +SBINDIR=$(DESTDIR)@sbindir@ +LIBEXECDIR=$(DESTDIR)@libexecdir@ INSTALL=@INSTALL@ NAGIOS_INSTALL_OPTS=@NAGIOS_INSTALL_OPTS@ NRPE_INSTALL_OPTS=@NRPE_INSTALL_OPTS@ +PLUGINSDIR=$(DESTDIR)@pluginsdir@ +PIDDIR=$(DESTDIR)@piddir@ +TMPFILESDIR=$(DESTDIR)@tmpfilesd@ +SRC_TMPFILE=@src_tmpfile@ + + # Generated automatically from configure script SNPRINTF_O=@SNPRINTF_O@ @@ -39,19 +48,33 @@ nrpe: $(srcdir)/nrpe.c $(srcdir)/utils.c $(srcdir)/acl.c $(SRC_INCLUDE)/nrpe.h $ $(CC) $(CFLAGS) -o $@ $(srcdir)/nrpe.c $(srcdir)/utils.c $(srcdir)/acl.c $(LDFLAGS) $(SOCKETLIBS) $(LIBWRAPLIBS) $(SNPRINTF_O) $(OTHERLIBS) check_nrpe: $(srcdir)/check_nrpe.c $(srcdir)/utils.c $(SRC_INCLUDE)/utils.h $(SRC_INCLUDE)/common.h $(CFG_INCLUDE)/config.h - $(CC) $(CFLAGS) -o $@ $(srcdir)/check_nrpe.c $(srcdir)/utils.c $(LDFLAGS) $(SOCKETLIBS) $(OTHERLIBS) + $(CC) $(CFLAGS) -o $@ $(srcdir)/check_nrpe.c $(srcdir)/utils.c $(LDFLAGS) $(SOCKETLIBS) $(SNPRINTF_O) $(OTHERLIBS) install: $(MAKE) install-plugin $(MAKE) install-daemon -install-plugin: - $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(DESTDIR)$(LIBEXECDIR) - $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) check_nrpe $(DESTDIR)$(LIBEXECDIR) +install-plugin: install-uninstall + $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(LIBEXECDIR) + $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(PLUGINSDIR) + $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) check_nrpe $(PLUGINSDIR) -install-daemon: - $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(DESTDIR)$(BINDIR) - $(INSTALL) -m 775 $(NRPE_INSTALL_OPTS) nrpe $(DESTDIR)$(BINDIR) +install-daemon: install-uninstall + $(INSTALL) -m 755 nrpe $(SBINDIR) + @if test ! -d "$(PIDDIR)" ; then \ + echo $(INSTALL) -m 755 $(NRPE_INSTALL_OPTS) -d $(PIDDIR); \ + $(INSTALL) -m 755 $(NRPE_INSTALL_OPTS) -d $(PIDDIR); \ + fi + @if test "$(TMPFILESDIR)" != "N/A" -a x$(SRC_TMPFILE) != x ; then \ + echo $(INSTALL) -m 755 -d `dirname $(TMPFILESDIR)`; \ + $(INSTALL) -m 755 -d `dirname $(TMPFILESDIR)`; \ + echo $(INSTALL) -m 644 ../startup/$(SRC_TMPFILE) $(TMPFILESDIR); \ + $(INSTALL) -m 644 ../startup/$(SRC_TMPFILE) $(TMPFILESDIR); \ + fi + +install-uninstall: + $(INSTALL) -m 755 -d $(SBINDIR) + $(INSTALL) -m 755 ../uninstall $(SBINDIR)/nrpe-uninstall clean: rm -f core nrpe check_nrpe $(SNPRINTF_O) diff --git a/src/acl.c b/src/acl.c index f5ec890..fdb59d1 100644 --- a/src/acl.c +++ b/src/acl.c @@ -28,6 +28,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "../include/config.h" + #include #include @@ -256,8 +258,7 @@ int add_ipv4_to_acl(char *ipv4) { int add_ipv6_to_acl(char *ipv6) { char *ipv6tmp; - char *addrtok; - char *addrsave; + char *addr_part, *mask_part; struct in6_addr addr; struct in6_addr mask; int maskval; @@ -275,23 +276,25 @@ int add_ipv6_to_acl(char *ipv6) { return 0; } + addr_part = ipv6tmp; + mask_part = strchr(ipv6tmp, '/'); + if (mask_part) { + *mask_part = '\0'; + ++mask_part; + } + /* Parse the address itself */ - addrtok = strtok_r(ipv6tmp, "/", &addrsave); - if(inet_pton(AF_INET6, addrtok, &addr) <= 0) { - syslog(LOG_ERR, "Invalid IPv6 address in ACL: %s\n", ipv6); + if(inet_pton(AF_INET6, addr_part, &addr) <= 0) { free(ipv6tmp); return 0; } /* Check whether there is a netmask */ - addrtok = strtok_r(NULL, "/", &addrsave); - if(NULL != addrtok) { + if (mask_part && *mask_part) { /* If so, build a netmask */ - /* Get the number of bits in the mask */ - maskval = atoi(addrtok); + maskval = atoi(mask_part); if(maskval < 0 || maskval > 128) { - syslog(LOG_ERR, "Invalid IPv6 netmask in ACL: %s\n", ipv6); free(ipv6tmp); return 0; } @@ -458,14 +461,15 @@ int add_domain_to_acl(char *domain) { * 0 - on failure */ -int is_an_allowed_host(int family, void *host) { - struct ip_acl *ip_acl_curr = ip_acl_head; - int nbytes; - int x; - struct dns_acl *dns_acl_curr = dns_acl_head; - struct in_addr addr; - struct in6_addr addr6; - struct hostent *he; +int is_an_allowed_host(int family, void *host) +{ + struct ip_acl *ip_acl_curr = ip_acl_head; + int nbytes; + int x; + struct dns_acl *dns_acl_curr = dns_acl_head; + struct sockaddr_in *addr; + struct sockaddr_in6 addr6; + struct addrinfo *res, *ai; while (ip_acl_curr != NULL) { if(ip_acl_curr->family == family) { @@ -498,34 +502,31 @@ int is_an_allowed_host(int family, void *host) { } while(dns_acl_curr != NULL) { - he = gethostbyname(dns_acl_curr->domain); - if (he == NULL) return 0; + if (!getaddrinfo(dns_acl_curr->domain, NULL, NULL, &res)) { - while (*he->h_addr_list) { - switch(he->h_addrtype) { - case AF_INET: - memmove((char *)&addr,*he->h_addr_list++, sizeof(addr)); - if (addr.s_addr == ((struct in_addr *)host)->s_addr) return 1; - break; - case AF_INET6: - memcpy((char *)&addr6, *he->h_addr_list++, sizeof(addr6)); - for(x = 0; x < nbytes; x++) { - if(addr6.s6_addr[x] != - ((struct in6_addr *)host)->s6_addr[x]) { - break; - } - } - if(x == nbytes) { - /* All bytes in host's address match the ACL */ - return 1; - } - break; + for (ai = res; ai; ai = ai->ai_next) { + + switch(ai->ai_family) { + + case AF_INET: + addr = (struct sockaddr_in*)(ai->ai_addr); + if (addr->sin_addr.s_addr == ((struct in_addr*)host)->s_addr) + return 1; + break; + + case AF_INET6: + memcpy((char*)&addr6, ai->ai_addr, sizeof(addr6)); + if (!memcmp(&addr6.sin6_addr, &host, sizeof(addr6.sin6_addr))) + return 1; + break; } } - dns_acl_curr = dns_acl_curr->next; + + dns_acl_curr = dns_acl_curr->next; } - return 0; } + return 0; +} /* The trim() function takes a source string and copies it to the destination string, * stripped of leading and training whitespace. The destination string must be @@ -535,8 +536,8 @@ int is_an_allowed_host(int family, void *host) { void trim( char *src, char *dest) { char *sptr, *dptr; - for( sptr = src; isblank( *sptr) && *sptr; sptr++); /* Jump past leading spaces */ - for( dptr = dest; !isblank( *sptr) && *sptr; ) { + for( sptr = src; isspace( *sptr) && *sptr; sptr++); /* Jump past leading spaces */ + for( dptr = dest; !isspace( *sptr) && *sptr; ) { *dptr = *sptr; sptr++; dptr++; @@ -545,20 +546,24 @@ void trim( char *src, char *dest) { return; } -/* This function splits allowed_hosts to substrings with comma(,) as a delimeter. +/* This function splits allowed_hosts to substrings with comma(,) as a delimiter. * It doesn't check validness of ACL record (add_ipv4_to_acl() and add_domain_to_acl() do), * just trims spaces from ACL records. * After this it sends ACL records to add_ipv4_to_acl() or add_domain_to_acl(). */ void parse_allowed_hosts(char *allowed_hosts) { - char *hosts = strdup( allowed_hosts); /* Copy since strtok* modifes original */ + char *hosts = strdup( allowed_hosts); /* Copy since strtok* modifies original */ char *saveptr; char *tok; const char *delim = ","; char *trimmed_tok; - tok = strtok_r( hosts, delim, &saveptr); +#ifdef HAVE_STRTOK_R + tok = strtok_r(hosts, delim, &saveptr); +#else + tok = strtok(hosts, delim); +#endif while( tok) { trimmed_tok = malloc( sizeof( char) * ( strlen( tok) + 1)); trim( tok, trimmed_tok); @@ -569,7 +574,11 @@ void parse_allowed_hosts(char *allowed_hosts) { } } free( trimmed_tok); - tok = strtok_r(( char *)0, delim, &saveptr); +#ifdef HAVE_STRTOK_R + tok = strtok_r(NULL, delim, &saveptr); +#else + tok = strtok(NULL, delim); +#endif } free( hosts); diff --git a/src/check_nrpe.c b/src/check_nrpe.c index 51c8874..f5d32d2 100644 --- a/src/check_nrpe.c +++ b/src/check_nrpe.c @@ -4,7 +4,7 @@ * Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org) * License: GPL * - * Last Modified: 09-06-2013 + * Last Modified: 09-08-2016 * * Command line: CHECK_NRPE -H [-p port] [-c command] [-to to_sec] * @@ -21,470 +21,1478 @@ #include "common.h" #include "utils.h" +#define DEFAULT_NRPE_COMMAND "_NRPE_CHECK" /* check version of NRPE daemon */ -#define DEFAULT_NRPE_COMMAND "_NRPE_CHECK" /* check version of NRPE daemon */ - -u_short server_port=DEFAULT_SERVER_PORT; -char *server_name=NULL; -char *bind_address=NULL; +u_short server_port = 0; +char *server_name = NULL; +char *bind_address = NULL; +char *config_file = NULL; +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE struct sockaddr_storage hostaddr; -int address_family=AF_UNSPEC; -char *command_name=NULL; -int socket_timeout=DEFAULT_SOCKET_TIMEOUT; -int timeout_return_code=STATE_CRITICAL; +#else +struct sockaddr hostaddr; +#endif +int address_family = AF_UNSPEC; +char *command_name = NULL; +int socket_timeout = DEFAULT_SOCKET_TIMEOUT; +char timeout_txt[10]; +int timeout_return_code = -1; int sd; -char query[MAX_INPUT_BUFFER]=""; +char rem_host[MAX_HOST_ADDRESS_LENGTH]; +char query[MAX_INPUT_BUFFER] = ""; -int show_help=FALSE; -int show_license=FALSE; -int show_version=FALSE; +int show_help = FALSE; +int show_license = FALSE; +int show_version = FALSE; +int packet_ver = NRPE_PACKET_VERSION_3; +int payload_size = 0; #ifdef HAVE_SSL -#ifdef __sun +# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux) SSL_METHOD *meth; -#else +# else const SSL_METHOD *meth; -#endif +# endif SSL_CTX *ctx; SSL *ssl; -int use_ssl=TRUE; +int use_ssl = TRUE; +int ssl_opts = SSL_OP_ALL; #else -int use_ssl=FALSE; +int use_ssl = FALSE; #endif +/* SSL/TLS parameters */ +typedef enum _SSL_VER { + SSL_Ver_Invalid = 0, SSLv2 = 1, SSLv2_plus, SSLv3, SSLv3_plus, + TLSv1, TLSv1_plus, TLSv1_1, TLSv1_1_plus, TLSv1_2, TLSv1_2_plus +} SslVer; -int process_arguments(int,char **); +typedef enum _CLNT_CERTS { Ask_For_Cert = 1, Require_Cert = 2 } ClntCerts; + +typedef enum _SSL_LOGGING { + SSL_NoLogging = 0, SSL_LogStartup = 1, SSL_LogIpAddr = 2, + SSL_LogVersion = 4, SSL_LogCipher = 8, SSL_LogIfClientCert = 16, + SSL_LogCertDetails = 32, +} SslLogging; + +struct _SSL_PARMS { + char *cert_file; + char *cacert_file; + char *privatekey_file; + char cipher_list[MAX_FILENAME_LENGTH]; + SslVer ssl_min_ver; + int allowDH; + ClntCerts client_certs; + SslLogging log_opts; +} sslprm = { +NULL, NULL, NULL, "", SSL_Ver_Invalid, -1, 0, SSL_NoLogging}; +int have_log_opts = FALSE; + +int process_arguments(int, char **, int); +int read_config_file(char *); +const char *state_text (int result); +int translate_state (char *state_text); +void set_timeout_state (char *state); +int parse_timeout_string (char *timeout_str); +void usage(int result); +void setup_ssl(); +void set_sig_hadlers(); +int connect_to_remote(); +int send_request(); +int read_response(); +int read_packet(int sock, void *ssl_ptr, v2_packet ** v2_pkt, v3_packet ** v3_pkt); +#ifdef HAVE_SSL +static int verify_callback(int ok, X509_STORE_CTX * ctx); +#endif void alarm_handler(int); -int graceful_close(int,int); +int graceful_close(int, int); - - - -int main(int argc, char **argv){ - u_int32_t packet_crc32; - u_int32_t calculated_crc32; +int main(int argc, char **argv) +{ int16_t result; - int rc; - packet send_packet; - packet receive_packet; - int bytes_to_send; - int bytes_to_recv; - result=process_arguments(argc,argv); + result = process_arguments(argc, argv, 0); - if(result!=OK || show_help==TRUE || show_license==TRUE || show_version==TRUE){ + if (result != OK || show_help == TRUE || show_license == TRUE || show_version == TRUE) + usage(result); /* usage() will call exit() */ - if(result!=OK) - printf("Incorrect command line arguments supplied\n"); - printf("\n"); - printf("NRPE Plugin for Nagios\n"); - printf("Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)\n"); - printf("Version: %s\n",PROGRAM_VERSION); - printf("Last Modified: %s\n",MODIFICATION_DATE); - printf("License: GPL v2 with exemptions (-l for more info)\n"); -#ifdef HAVE_SSL - printf("SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required\n"); -#endif - printf("\n"); - } + snprintf(timeout_txt, sizeof(timeout_txt), "%d", socket_timeout); - if(result!=OK || show_help==TRUE){ + if (server_port == 0) + server_port = DEFAULT_SERVER_PORT; + if (socket_timeout == -1) + socket_timeout = DEFAULT_SOCKET_TIMEOUT; + if (timeout_return_code == -1) + timeout_return_code = STATE_CRITICAL; + if (sslprm.cipher_list[0] == '\0') + strncpy(sslprm.cipher_list, "ALL:!MD5:@STRENGTH", MAX_FILENAME_LENGTH - 1); + if (sslprm.ssl_min_ver == SSL_Ver_Invalid) + sslprm.ssl_min_ver = TLSv1_plus; + if (sslprm.allowDH == -1) + sslprm.allowDH = TRUE; - printf("Usage: check_nrpe -H [ -b ] [-4] [-6] [-n] [-u] [-p ] [-t ] [-c ] [-a ]\n"); - printf("\n"); - printf("Options:\n"); - printf(" -n = Do no use SSL\n"); - printf(" -u = Make socket timeouts return an UNKNOWN state instead of CRITICAL\n"); - printf(" = The address of the host running the NRPE daemon\n"); - printf(" = bind to local address\n"); - printf(" -4 = user ipv4 only\n"); - printf(" -6 = user ipv6 only\n"); - printf(" [port] = The port on which the daemon is running (default=%d)\n",DEFAULT_SERVER_PORT); - printf(" [timeout] = Number of seconds before connection times out (default=%d)\n",DEFAULT_SOCKET_TIMEOUT); - printf(" [command] = The name of the command that the remote daemon should run\n"); - printf(" [arglist] = Optional arguments that should be passed to the command. Multiple\n"); - printf(" arguments should be separated by a space. If provided, this must be\n"); - printf(" the last option supplied on the command line.\n"); - printf("\n"); - printf("Note:\n"); - printf("This plugin requires that you have the NRPE daemon running on the remote host.\n"); - printf("You must also have configured the daemon to associate a specific plugin command\n"); - printf("with the [command] option you are specifying here. Upon receipt of the\n"); - printf("[command] argument, the NRPE daemon will run the appropriate plugin command and\n"); - printf("send the plugin output and return code back to *this* plugin. This allows you\n"); - printf("to execute plugins on remote hosts and 'fake' the results to make Nagios think\n"); - printf("the plugin is being run locally.\n"); - printf("\n"); - } - - if(show_license==TRUE) - display_license(); - - if(result!=OK || show_help==TRUE || show_license==TRUE || show_version==TRUE) - exit(STATE_UNKNOWN); - - - /* generate the CRC 32 table */ - generate_crc32_table(); - -#ifdef HAVE_SSL - /* initialize SSL */ - if(use_ssl==TRUE){ - SSL_library_init(); - SSLeay_add_ssl_algorithms(); - meth=SSLv23_client_method(); - SSL_load_error_strings(); - if((ctx=SSL_CTX_new(meth))==NULL){ - printf("CHECK_NRPE: Error - could not create SSL context.\n"); - exit(STATE_CRITICAL); - } - - /* ADDED 01/19/2004 */ - /* use only TLSv1 protocol */ - SSL_CTX_set_options(ctx,SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); - } -#endif - - /* initialize alarm signal handling */ - signal(SIGALRM,alarm_handler); - - /* set socket timeout */ - alarm(socket_timeout); - - /* try to connect to the host at the given port number */ - if((sd=my_connect(server_name, &hostaddr, server_port, address_family, - bind_address)) < 0 ) { - exit (255); - } - else { - result=STATE_OK; + generate_crc32_table(); /* generate the CRC 32 table */ + setup_ssl(); /* Do all the SSL/TLS set up */ + set_sig_hadlers(); /* initialize alarm signal handling */ + result = connect_to_remote(); /* Make the connection */ + if (result != STATE_OK) { + alarm(0); + return result; } -#ifdef HAVE_SSL - /* do SSL handshake */ - if(result==STATE_OK && use_ssl==TRUE){ - if((ssl=SSL_new(ctx))!=NULL){ - SSL_CTX_set_cipher_list(ctx,"ADH"); - SSL_set_fd(ssl,sd); - if((rc=SSL_connect(ssl))!=1){ - printf("CHECK_NRPE: Error - Could not complete SSL handshake.\n"); -#ifdef DEBUG - printf("SSL_connect=%d\n",rc); - /* - rc=SSL_get_error(ssl,rc); - printf("SSL_get_error=%d\n",rc); - printf("ERR_get_error=%lu\n",ERR_get_error()); - printf("%s\n",ERR_error_string(rc,NULL)); - */ - ERR_print_errors_fp(stdout); -#endif - result=STATE_CRITICAL; - } - } - else{ - printf("CHECK_NRPE: Error - Could not create SSL connection structure.\n"); - result=STATE_CRITICAL; - } + result = send_request(); /* Send the request */ + if (result != STATE_OK) + return result; - /* bail if we had errors */ - if(result!=STATE_OK){ - SSL_CTX_free(ctx); - close(sd); - exit(result); - } - } -#endif + result = read_response(); /* Get the response */ - /* we're connected and ready to go */ - if(result==STATE_OK){ + if (result == -1) { + /* Failure reading from remote, so try version 2 packet */ + syslog(LOG_NOTICE, "Remote %s does not support Version 3 Packets", rem_host); + packet_ver = NRPE_PACKET_VERSION_2; - /* clear the packet buffer */ - bzero(&send_packet,sizeof(send_packet)); + /* Rerun the setup */ + setup_ssl(); + set_sig_hadlers(); + result = connect_to_remote(); /* Connect */ + if (result != STATE_OK) { + alarm(0); + return result; + } - /* fill the packet with semi-random data */ - randomize_buffer((char *)&send_packet,sizeof(send_packet)); + result = send_request(); /* Send the request */ + if (result != STATE_OK) + return result; - /* initialize packet data */ - send_packet.packet_version=(int16_t)htons(NRPE_PACKET_VERSION_2); - send_packet.packet_type=(int16_t)htons(QUERY_PACKET); - strncpy(&send_packet.buffer[0],query,MAX_PACKETBUFFER_LENGTH); - send_packet.buffer[MAX_PACKETBUFFER_LENGTH-1]='\x0'; + result = read_response(); /* Get the response */ + } - /* calculate the crc 32 value of the packet */ - send_packet.crc32_value=(u_int32_t)0L; - calculated_crc32=calculate_crc32((char *)&send_packet,sizeof(send_packet)); - send_packet.crc32_value=(u_int32_t)htonl(calculated_crc32); - - - /***** ENCRYPT REQUEST *****/ - - - /* send the packet */ - bytes_to_send=sizeof(send_packet); - if(use_ssl==FALSE) - rc=sendall(sd,(char *)&send_packet,&bytes_to_send); -#ifdef HAVE_SSL - else{ - rc=SSL_write(ssl,&send_packet,bytes_to_send); - if(rc<0) - rc=-1; - } -#endif - if(rc==-1){ - printf("CHECK_NRPE: Error sending query to host.\n"); - close(sd); - return STATE_UNKNOWN; - } - - /* wait for the response packet */ - bytes_to_recv=sizeof(receive_packet); - if(use_ssl==FALSE) - rc=recvall(sd,(char *)&receive_packet,&bytes_to_recv,socket_timeout); -#ifdef HAVE_SSL - else - rc=SSL_read(ssl,&receive_packet,bytes_to_recv); -#endif - - /* reset timeout */ - alarm(0); - - /* close the connection */ -#ifdef HAVE_SSL - if(use_ssl==TRUE){ - SSL_shutdown(ssl); - SSL_free(ssl); - SSL_CTX_free(ctx); - } -#endif - graceful_close(sd,1000); - - /* recv() error */ - if(rc<0){ - printf("CHECK_NRPE: Error receiving data from daemon.\n"); - return STATE_UNKNOWN; - } - - /* server disconnected */ - else if(rc==0){ - printf("CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.\n"); - return STATE_UNKNOWN; - } - - /* receive underflow */ - else if(bytes_to_recv 0) break; /* process all arguments */ - switch(c){ + switch (c) { case '?': case 'h': - show_help=TRUE; + show_help = TRUE; break; + case 'b': - bind_address=strdup(optarg); + bind_address = strdup(optarg); break; + + case 'f': + if (from_config_file) { + printf("Error: The config file should not have a config-file (-f) option.\n"); + break; + } + config_file = strdup(optarg); + break; + case 'V': - show_version=TRUE; + show_version = TRUE; break; + case 'l': - show_license=TRUE; + show_license = TRUE; break; + case 't': - socket_timeout=atoi(optarg); - if(socket_timeout<=0) + if (from_config_file && socket_timeout != -1) { + syslog(LOG_WARNING, "WARNING: Command-line socket timeout overrides " + "the config file option."); + break; + } + socket_timeout=parse_timeout_string(optarg); + if (socket_timeout <= 0) return ERROR; break; + case 'p': - server_port=atoi(optarg); - if(server_port<=0) + if (from_config_file && server_port != 0) { + syslog(LOG_WARNING, "WARNING: Command-line server port overrides " + "the config file option."); + break; + } + server_port = atoi(optarg); + if (server_port <= 0) return ERROR; break; + + case 'P': + if (from_config_file && payload_size > 0) { + syslog(LOG_WARNING, "WARNING: Command-line payload-size (-P) overrides " + "the config file option."); + break; + } + payload_size = atoi(optarg); + if (payload_size < 0) + return ERROR; + break; + case 'H': - server_name=strdup(optarg); + if (from_config_file && server_name != NULL) { + syslog(LOG_WARNING, "WARNING: Command-line server name overrides " + "the config file option."); + break; + } + server_name = strdup(optarg); break; + case 'c': - command_name=strdup(optarg); + if (from_config_file) { + printf("Error: The config file should not have a command (-c) option.\n"); + return ERROR; + break; + } + command_name = strdup(optarg); break; + case 'a': - argindex=optind; + if (from_config_file) { + printf("Error: The config file should not have args (-a) arguments.\n"); + return ERROR; + break; + } + argindex = optind; break; + case 'n': - use_ssl=FALSE; + use_ssl = FALSE; break; + case 'u': - timeout_return_code=STATE_UNKNOWN; + if (from_config_file && timeout_return_code != -1) { + syslog(LOG_WARNING, "WARNING: Command-line unknown-timeout (-u) " + "overrides the config file option."); + break; + } + timeout_return_code = STATE_UNKNOWN; break; + + case '2': + if (from_config_file && packet_ver != NRPE_PACKET_VERSION_3) { + syslog(LOG_WARNING, "WARNING: Command-line v2-packets-only (-2) " + "overrides the config file option."); + break; + } + packet_ver = NRPE_PACKET_VERSION_2; + break; + case '4': - address_family=AF_INET; + if (from_config_file && address_family != AF_UNSPEC) { + syslog(LOG_WARNING, "WARNING: Command-line ipv4 (-4) " + "or ipv6 (-6) overrides the config file option."); + break; + } + address_family = AF_INET; break; + case '6': - address_family=AF_INET6; + if (from_config_file && address_family != AF_UNSPEC) { + syslog(LOG_WARNING, "WARNING: Command-line ipv4 (-4) " + "or ipv6 (-6) overrides the config file option."); + break; + } + address_family = AF_INET6; break; + + case 'd': + if (from_config_file && sslprm.allowDH != -1) { + syslog(LOG_WARNING, "WARNING: Command-line use-adh (-d) " + "overrides the config file option."); + break; + } + if (!optarg || optarg[0] < '0' || optarg[0] > '2') + return ERROR; + sslprm.allowDH = atoi(optarg); + break; + + case 'A': + if (from_config_file && sslprm.cacert_file != NULL) { + syslog(LOG_WARNING, "WARNING: Command-line ca-cert-file (-A) " + "overrides the config file option."); + break; + } + sslprm.cacert_file = strdup(optarg); + break; + + case 'C': + if (from_config_file && sslprm.cert_file != NULL) { + syslog(LOG_WARNING, "WARNING: Command-line client-cert (-C) " + "overrides the config file option."); + break; + } + sslprm.cert_file = strdup(optarg); + has_cert = 1; + break; + + case 'K': + if (from_config_file && sslprm.privatekey_file != NULL) { + syslog(LOG_WARNING, "WARNING: Command-line key-file (-K) " + "overrides the config file option."); + break; + } + sslprm.privatekey_file = strdup(optarg); + has_priv_key = 1; + break; + + case 'S': + if (from_config_file && sslprm.ssl_min_ver != SSL_Ver_Invalid) { + syslog(LOG_WARNING, "WARNING: Command-line ssl-version (-S) " + "overrides the config file option."); + break; + } + if (!strcmp(optarg, "SSLv2")) + sslprm.ssl_min_ver = SSLv2; + else if (!strcmp(optarg, "SSLv2+")) + sslprm.ssl_min_ver = SSLv2_plus; + else if (!strcmp(optarg, "SSLv3")) + sslprm.ssl_min_ver = SSLv3; + else if (!strcmp(optarg, "SSLv3+")) + sslprm.ssl_min_ver = SSLv3_plus; + else if (!strcmp(optarg, "TLSv1")) + sslprm.ssl_min_ver = TLSv1; + else if (!strcmp(optarg, "TLSv1+")) + sslprm.ssl_min_ver = TLSv1_plus; + else if (!strcmp(optarg, "TLSv1.1")) + sslprm.ssl_min_ver = TLSv1_1; + else if (!strcmp(optarg, "TLSv1.1+")) + sslprm.ssl_min_ver = TLSv1_1_plus; + else if (!strcmp(optarg, "TLSv1.2")) + sslprm.ssl_min_ver = TLSv1_2; + else if (!strcmp(optarg, "TLSv1.2+")) + sslprm.ssl_min_ver = TLSv1_2_plus; + else + return ERROR; + break; + + case 'L': + if (from_config_file && sslprm.cipher_list[0] != '\0') { + syslog(LOG_WARNING, "WARNING: Command-line cipher-list (-L) " + "overrides the config file option."); + break; + } + strncpy(sslprm.cipher_list, optarg, sizeof(sslprm.cipher_list) - 1); + sslprm.cipher_list[sizeof(sslprm.cipher_list) - 1] = '\0'; + break; + + case 's': + if (from_config_file && have_log_opts == TRUE) { + syslog(LOG_WARNING, "WARNING: Command-line ssl-logging (-s) " + "overrides the config file option."); + break; + } + sslprm.log_opts = strtoul(optarg, NULL, 0); + have_log_opts = TRUE; + break; + default: return ERROR; break; - } - } + } + } /* determine (base) command query */ - snprintf(query,sizeof(query),"%s",(command_name==NULL)?DEFAULT_NRPE_COMMAND:command_name); - query[sizeof(query)-1]='\x0'; + snprintf(query, sizeof(query), "%s", + (command_name == NULL) ? DEFAULT_NRPE_COMMAND : command_name); + query[sizeof(query) - 1] = '\x0'; /* get the command args */ - if(argindex>0){ + if (argindex > 0) { - for(c=argindex-1;c 0 && packet_ver != NRPE_PACKET_VERSION_2) { + printf("Error: if a fixed payload size is specified, " + "'-2' must also be specified\n"); + return ERROR; + } /* make sure required args were supplied */ - if(server_name==NULL && show_help==FALSE && show_version==FALSE && show_license==FALSE) + if (server_name == NULL && show_help == FALSE && show_version == FALSE + && show_license == FALSE) return ERROR; - return OK; - } +} +int read_config_file(char *fname) +{ + int rc, argc = 0; + FILE *f; + char *buf, *bufp, **argv; + char *delims = " \t\r\n"; + struct stat st; + size_t sz; + if (stat(fname, &st)) { + syslog(LOG_ERR, "Error: Could not stat config file %s", fname); + return ERROR; + } + if ((f = fopen(fname, "r")) == NULL) { + syslog(LOG_ERR, "Error: Could not open config file %s", fname); + return ERROR; + } + if ((buf = (char*)calloc(1, st.st_size + 2)) == NULL) { + fclose(f); + syslog(LOG_ERR, "Error: read_config_file fail to allocate memory"); + return ERROR; + } + if ((sz = fread(buf, 1, st.st_size, f)) != st.st_size) { + fclose(f); + free(buf); + syslog(LOG_ERR, "Error: Failed to completely read config file %s", fname); + return ERROR; + } + if ((argv = calloc(50, sizeof(char*))) == NULL) { + fclose(f); + free(buf); + syslog(LOG_ERR, "Error: read_config_file fail to allocate memory"); + return ERROR; + } -void alarm_handler(int sig){ + argv[argc++] = "check_nrpe"; - printf("CHECK_NRPE: Socket timeout after %d seconds.\n",socket_timeout); + bufp = buf; + while (argc < 50) { + if (*bufp == '\0') + break; + while (strchr(delims, *bufp)) + ++bufp; + argv[argc] = my_strsep(&bufp, delims); + if (!argv[argc++]) + break; + } - exit(timeout_return_code); - } + fclose(f); + if (argc == 50) { + free(buf); + free(argv); + syslog(LOG_ERR, "Error: too many parameters in config file %s", fname); + return ERROR; + } -/* submitted by Mark Plaksin 08/31/2006 */ -int graceful_close(int sd, int timeout){ - fd_set in; - struct timeval tv; - char buf[1000]; + rc = process_arguments(argc, argv, 1); + free(buf); + free(argv); + return rc; +} - /* send FIN packet */ - shutdown(sd,SHUT_WR); - for(;;){ +const char *state_text (int result) +{ + switch (result) { + case STATE_OK: + return "OK"; + case STATE_WARNING: + return "WARNING"; + case STATE_CRITICAL: + return "CRITICAL"; + default: + return "UNKNOWN"; + } +} - FD_ZERO(&in); - FD_SET(sd,&in); - tv.tv_sec=timeout/1000; - tv.tv_usec=(timeout % 1000)*1000; +int translate_state (char *state_text) { + if (!strcasecmp(state_text,"OK") || !strcmp(state_text,"0")) + return STATE_OK; + if (!strcasecmp(state_text,"WARNING") || !strcmp(state_text,"1")) + return STATE_WARNING; + if (!strcasecmp(state_text,"CRITICAL") || !strcmp(state_text,"2")) + return STATE_CRITICAL; + if (!strcasecmp(state_text,"UNKNOWN") || !strcmp(state_text,"3")) + return STATE_UNKNOWN; + return ERROR; +} - /* timeout or error */ - if(1!=select(sd+1,&in,NULL,NULL,&tv)) - break; +void set_timeout_state (char *state) { + if ((timeout_return_code = translate_state(state)) == ERROR) + printf("Timeout state must be a valid state name (OK, " + "WARNING, CRITICAL, UNKNOWN) or integer (0-3).\n"); +} - /* no more data (FIN or RST) */ - if(0>=recv(sd,buf,sizeof(buf),0)) +int parse_timeout_string (char *timeout_str) +{ + char *seperated_str; + char *timeout_val = NULL; + char *timeout_sta = NULL; + + if (strstr(timeout_str, ":") == NULL) + timeout_val = timeout_str; + else if (strncmp(timeout_str, ":", 1) == 0) { + seperated_str = strtok(timeout_str, ":"); + if (seperated_str != NULL) + timeout_sta = seperated_str; + } else { + seperated_str = strtok(timeout_str, ":"); + timeout_val = seperated_str; + seperated_str = strtok(NULL, ":"); + if (seperated_str != NULL) { + timeout_sta = seperated_str; + } + } + + if ( timeout_sta != NULL ) + set_timeout_state(timeout_sta); + + if ((timeout_val == NULL) || (timeout_val[0] == '\0')) + return socket_timeout; + else if (atoi(timeout_val) > 0) + return atoi(timeout_val); + else { + printf("Timeout value must be a positive integer\n"); + exit (STATE_UNKNOWN); + } +} + +void usage(int result) +{ + if (result != OK) + printf("Incorrect command line arguments supplied\n"); + printf("\n"); + printf("NRPE Plugin for Nagios\n"); + printf("Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)\n"); + printf("Version: %s\n", PROGRAM_VERSION); + printf("Last Modified: %s\n", MODIFICATION_DATE); + printf("License: GPL v2 with exemptions (-l for more info)\n"); +#ifdef HAVE_SSL + printf("SSL/TLS Available: OpenSSL 0.9.6 or higher required\n"); +#endif + printf("\n"); + + if (result != OK || show_help == TRUE) { + printf("Usage: check_nrpe -H [-2] [-4] [-6] [-n] [-u] [-V] [-l] [-d ]\n" + " [-P ] [-S ] [-L ] [-C ]\n" + " [-K ] [-A ] [-s ] [-b ]\n" + " [-f ] [-p ] [-t :]\n" + " [-c ] [-a ]\n"); + printf("\n"); + printf("Options:\n"); + printf(" = The address of the host running the NRPE daemon\n"); + printf(" -2 = Only use Version 2 packets, not Version 3\n"); + printf(" -4 = bind to ipv4 only\n"); + printf(" -6 = bind to ipv6 only\n"); + printf(" -n = Do no use SSL\n"); + printf + (" -u = (DEPRECATED) Make timeouts return UNKNOWN instead of CRITICAL\n"); + printf(" -V = Show version\n"); + printf(" -l = Show license\n"); + printf(" = Anonymous Diffie Hellman use:\n"); + printf(" 0 = Don't use Anonymous Diffie Hellman\n"); + printf(" (This will be the default in a future release.)\n"); + printf(" 1 = Allow Anonymous Diffie Hellman (default)\n"); + printf(" 2 = Force Anonymous Diffie Hellman\n"); + printf(" = Specify non-default payload size for NSClient++\n"); + printf + (" = The SSL/TLS version to use. Can be any one of: SSLv2 (only),\n"); + printf(" SSLv2+ (or above), SSLv3 (only), SSLv3+ (or above),\n"); + printf(" TLSv1 (only), TLSv1+ (or above DEFAULT), TLSv1.1 (only),\n"); + printf(" TLSv1.1+ (or above), TLSv1.2 (only), TLSv1.2+ (or above)\n"); + printf(" = The list of SSL ciphers to use (currently defaults\n"); + printf + (" to \"ALL:!MD5:@STRENGTH\". WILL change in a future release.)\n"); + printf(" = The client certificate to use for PKI\n"); + printf(" = The private key to use with the client certificate\n"); + printf(" = The CA certificate to use for PKI\n"); + printf(" = SSL Logging Options\n"); + printf(" = bind to local address\n"); + printf(" = configuration file to use\n"); + printf(" [port] = The port on which the daemon is running (default=%d)\n", + DEFAULT_SERVER_PORT); + printf(" [command] = The name of the command that the remote daemon should run\n"); + printf(" [arglist] = Optional arguments that should be passed to the command,\n"); + printf(" separated by a space. If provided, this must be the last\n"); + printf(" option supplied on the command line.\n"); + printf("\n"); + printf(" NEW TIMEOUT SYNTAX\n"); + printf(" -t :\n"); + printf(" = Number of seconds before connection times out (default=%d)\n",DEFAULT_SOCKET_TIMEOUT); + printf(" = Check state to exit with in the event of a timeout (default=CRITICAL)\n"); + printf(" Timeout state must be a valid state name (case-insensitive) or integer:\n"); + printf(" (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)\n"); + printf("\n"); + printf("Note:\n"); + printf + ("This plugin requires that you have the NRPE daemon running on the remote host.\n"); + printf + ("You must also have configured the daemon to associate a specific plugin command\n"); + printf("with the [command] option you are specifying here. Upon receipt of the\n"); + printf + ("[command] argument, the NRPE daemon will run the appropriate plugin command and\n"); + printf + ("send the plugin output and return code back to *this* plugin. This allows you\n"); + printf + ("to execute plugins on remote hosts and 'fake' the results to make Nagios think\n"); + printf("the plugin is being run locally.\n"); + printf("\n"); + } + + if (show_license == TRUE) + display_license(); + + exit(STATE_UNKNOWN); +} + +void setup_ssl() +{ +#ifdef HAVE_SSL + int vrfy; + + if (sslprm.log_opts & SSL_LogStartup) { + char *val; + + syslog(LOG_INFO, "SSL Certificate File: %s", + sslprm.cert_file ? sslprm.cert_file : "None"); + syslog(LOG_INFO, "SSL Private Key File: %s", + sslprm.privatekey_file ? sslprm.privatekey_file : "None"); + syslog(LOG_INFO, "SSL CA Certificate File: %s", + sslprm.cacert_file ? sslprm.cacert_file : "None"); + if (sslprm.allowDH < 2) + syslog(LOG_INFO, "SSL Cipher List: %s", sslprm.cipher_list); + else + syslog(LOG_INFO, "SSL Cipher List: ADH"); + syslog(LOG_INFO, "SSL Allow ADH: %s", + sslprm.allowDH == 0 ? "No" : (sslprm.allowDH == 1 ? "Allow" : "Require")); + syslog(LOG_INFO, "SSL Log Options: 0x%02x", sslprm.log_opts); + switch (sslprm.ssl_min_ver) { + case SSLv2: + val = "SSLv2"; + break; + case SSLv2_plus: + val = "SSLv2 And Above"; + break; + case SSLv3: + val = "SSLv3"; + break; + case SSLv3_plus: + val = "SSLv3_plus And Above"; + break; + case TLSv1: + val = "TLSv1"; + break; + case TLSv1_plus: + val = "TLSv1_plus And Above"; + break; + case TLSv1_1: + val = "TLSv1_1"; + break; + case TLSv1_1_plus: + val = "TLSv1_1_plus And Above"; + break; + case TLSv1_2: + val = "TLSv1_2"; + break; + case TLSv1_2_plus: + val = "TLSv1_2_plus And Above"; + break; + default: + val = "INVALID VALUE!"; break; } + syslog(LOG_INFO, "SSL Version: %s", val); + } + + /* initialize SSL */ + if (use_ssl == TRUE) { + SSL_load_error_strings(); + SSL_library_init(); + meth = SSLv23_client_method(); + +# ifndef OPENSSL_NO_SSL2 + if (sslprm.ssl_min_ver == SSLv2) + meth = SSLv2_client_method(); +# endif +# ifndef OPENSSL_NO_SSL3 + if (sslprm.ssl_min_ver == SSLv3) + meth = SSLv3_client_method(); +# endif + if (sslprm.ssl_min_ver == TLSv1) + meth = TLSv1_client_method(); +# ifdef SSL_TXT_TLSV1_1 + if (sslprm.ssl_min_ver == TLSv1_1) + meth = TLSv1_1_client_method(); +# ifdef SSL_TXT_TLSV1_2 + if (sslprm.ssl_min_ver == TLSv1_2) + meth = TLSv1_2_client_method(); +# endif +# endif + + if ((ctx = SSL_CTX_new(meth)) == NULL) { + printf("CHECK_NRPE: Error - could not create SSL context.\n"); + exit(STATE_CRITICAL); + } + + if (sslprm.ssl_min_ver >= SSLv3) { + ssl_opts |= SSL_OP_NO_SSLv2; + if (sslprm.ssl_min_ver >= TLSv1) + ssl_opts |= SSL_OP_NO_SSLv3; + } + SSL_CTX_set_options(ctx, ssl_opts); + + if (sslprm.cert_file != NULL && sslprm.privatekey_file != NULL) { + if (!SSL_CTX_use_certificate_file(ctx, sslprm.cert_file, SSL_FILETYPE_PEM)) { + SSL_CTX_free(ctx); + printf("Error: could not use certificate file '%s'.\n", sslprm.cert_file); + exit(STATE_CRITICAL); + } + if (!SSL_CTX_use_PrivateKey_file(ctx, sslprm.privatekey_file, SSL_FILETYPE_PEM)) { + SSL_CTX_free(ctx); + printf("Error: could not use private key file '%s'.\n", + sslprm.privatekey_file); + exit(STATE_CRITICAL); + } + } + + if (sslprm.cacert_file != NULL) { + vrfy = SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT; + SSL_CTX_set_verify(ctx, vrfy, verify_callback); + if (!SSL_CTX_load_verify_locations(ctx, sslprm.cacert_file, NULL)) { + SSL_CTX_free(ctx); + printf("Error: could not use CA certificate '%s'.\n", sslprm.cacert_file); + exit(STATE_CRITICAL); + } + } + + if (!sslprm.allowDH) { + if (strlen(sslprm.cipher_list) < sizeof(sslprm.cipher_list) - 6) { + strcat(sslprm.cipher_list, ":!ADH"); + if (sslprm.log_opts & SSL_LogStartup) + syslog(LOG_INFO, "New SSL Cipher List: %s", sslprm.cipher_list); + } + } else { + /* use anonymous DH ciphers */ + if (sslprm.allowDH == 2) + strcpy(sslprm.cipher_list, "ADH"); + } + + if (SSL_CTX_set_cipher_list(ctx, sslprm.cipher_list) == 0) { + SSL_CTX_free(ctx); + printf("Error: Could not set SSL/TLS cipher list: %s\n", sslprm.cipher_list); + exit(STATE_CRITICAL); + } + } +#endif +} + +void set_sig_hadlers() +{ +#ifdef HAVE_SIGACTION + struct sigaction sig_action; +#endif + +#ifdef HAVE_SIGACTION + sig_action.sa_sigaction = NULL; + sig_action.sa_handler = alarm_handler; + sigfillset(&sig_action.sa_mask); + sig_action.sa_flags = SA_NODEFER | SA_RESTART; + sigaction(SIGALRM, &sig_action, NULL); +#else + signal(SIGALRM, alarm_handler); +#endif /* HAVE_SIGACTION */ + + /* set socket timeout */ + alarm(socket_timeout); +} + +int connect_to_remote() +{ + struct sockaddr addr; + struct in_addr *inaddr; + socklen_t addrlen; + int result, rc, ssl_err, ern; + + /* try to connect to the host at the given port number */ + if ((sd = + my_connect(server_name, &hostaddr, server_port, address_family, bind_address)) < 0) + exit(STATE_CRITICAL); + + result = STATE_OK; + addrlen = sizeof(addr); + rc = getpeername(sd, (struct sockaddr *)&addr, &addrlen); + if (addr.sa_family == AF_INET) { + struct sockaddr_in *addrin = (struct sockaddr_in *)&addr; + inaddr = &addrin->sin_addr; + } else { + struct sockaddr_in6 *addrin = (struct sockaddr_in6 *)&addr; + inaddr = (struct in_addr *)&addrin->sin6_addr; + } + if (inet_ntop(addr.sa_family, inaddr, rem_host, sizeof(rem_host)) == NULL) + strncpy(rem_host, "Unknown", sizeof(rem_host)); + rem_host[MAX_HOST_ADDRESS_LENGTH - 1] = '\0'; + if ((sslprm.log_opts & SSL_LogIpAddr) != 0) + syslog(LOG_DEBUG, "Connected to %s", rem_host); + +#ifdef HAVE_SSL + if (use_ssl == FALSE) + return result; + + /* do SSL handshake */ + if ((ssl = SSL_new(ctx)) == NULL) { + printf("CHECK_NRPE: Error - Could not create SSL connection structure.\n"); + return STATE_CRITICAL; + } + + SSL_set_fd(ssl, sd); + if ((rc = SSL_connect(ssl)) != 1) { + ern = errno; + ssl_err = SSL_get_error(ssl, rc); + + if (sslprm.log_opts & (SSL_LogCertDetails | SSL_LogIfClientCert)) { + int x, nerrs = 0; + rc = 0; + while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) { + syslog(LOG_ERR, "Error: Could not complete SSL handshake with %s: %s", + rem_host, ERR_reason_error_string(x)); + ++nerrs; + } + if (nerrs == 0) + syslog(LOG_ERR, "Error: Could not complete SSL handshake with %s: rc=%d SSL-error=%d", + rem_host, rc, ssl_err); + + } else + syslog(LOG_ERR, "Error: Could not complete SSL handshake with %s: rc=%d SSL-error=%d", + rem_host, rc, ssl_err); + + if (ssl_err == 5) { + /* Often, errno will be zero, so print a generic message here */ + if (ern == 0) + printf("CHECK_NRPE: Error - Could not connect to %s. Check system logs on %s\n", + rem_host, rem_host); + else + printf("CHECK_NRPE: Error - Could not connect to %s: %s\n", + rem_host, strerror(ern)); + } else + printf("CHECK_NRPE: Error - Could not complete SSL handshake with %s: %d\n", + rem_host, ssl_err); + +# ifdef DEBUG + printf("SSL_connect=%d\n", rc); + /* + rc = SSL_get_error(ssl, rc); + printf("SSL_get_error=%d\n", rc); + printf("ERR_get_error=%lu\n", ERR_get_error()); + printf("%s\n",ERR_error_string(rc, NULL)); + */ + ERR_print_errors_fp(stdout); +# endif + result = STATE_CRITICAL; + + } else { + + if (sslprm.log_opts & SSL_LogVersion) + syslog(LOG_NOTICE, "Remote %s - SSL Version: %s", rem_host, SSL_get_version(ssl)); + + if (sslprm.log_opts & SSL_LogCipher) { +# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux) + SSL_CIPHER *c = SSL_get_current_cipher(ssl); +# else + const SSL_CIPHER *c = SSL_get_current_cipher(ssl); +# endif + syslog(LOG_NOTICE, "Remote %s - %s, Cipher is %s", rem_host, + SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c)); + } + + if ((sslprm.log_opts & SSL_LogIfClientCert) || (sslprm.log_opts & SSL_LogCertDetails)) { + char peer_cn[256], buffer[2048]; + X509 *peer = SSL_get_peer_certificate(ssl); + + if (peer) { + if (sslprm.log_opts & SSL_LogIfClientCert) + syslog(LOG_NOTICE, "SSL %s has %s certificate", + rem_host, peer->valid ? "a valid" : "an invalid"); + if (sslprm.log_opts & SSL_LogCertDetails) { + syslog(LOG_NOTICE, "SSL %s Cert Name: %s", rem_host, peer->name); + X509_NAME_oneline(X509_get_issuer_name(peer), buffer, sizeof(buffer)); + syslog(LOG_NOTICE, "SSL %s Cert Issuer: %s", rem_host, buffer); + } + + } else + syslog(LOG_NOTICE, "SSL Did not get certificate from %s", rem_host); + } + } + + /* bail if we had errors */ + if (result != STATE_OK) { + SSL_CTX_free(ctx); + close(sd); + exit(result); + } +#endif + + return result; +} + +int send_request() +{ + v2_packet *v2_send_packet = NULL; + v3_packet *v3_send_packet = NULL; + u_int32_t calculated_crc32; + int rc, bytes_to_send, pkt_size; + char *send_pkt; + + if (packet_ver == NRPE_PACKET_VERSION_2) { + pkt_size = sizeof(v2_packet); + if (payload_size > 0) + pkt_size = sizeof(v2_packet) - MAX_PACKETBUFFER_LENGTH + payload_size; + v2_send_packet = (v2_packet*)calloc(1, pkt_size); + send_pkt = (char *)v2_send_packet; + + /* fill the packet with semi-random data */ + randomize_buffer((char *)v2_send_packet, pkt_size); + + /* initialize response packet data */ + v2_send_packet->packet_version = htons(packet_ver); + v2_send_packet->packet_type = htons(QUERY_PACKET); + if (payload_size > 0) { + strncpy(&v2_send_packet->buffer[0], query, payload_size); + v2_send_packet->buffer[payload_size - 1] = '\x0'; + } else { + strncpy(&v2_send_packet->buffer[0], query, MAX_PACKETBUFFER_LENGTH); + v2_send_packet->buffer[MAX_PACKETBUFFER_LENGTH - 1] = '\x0'; + } + + /* calculate the crc 32 value of the packet */ + v2_send_packet->crc32_value = 0; + calculated_crc32 = calculate_crc32(send_pkt, pkt_size); + v2_send_packet->crc32_value = htonl(calculated_crc32); + + } else { + + pkt_size = (sizeof(v3_packet) - 1) + strlen(query) + 1; + if (pkt_size < sizeof(v2_packet)) + pkt_size = sizeof(v2_packet); + + v3_send_packet = calloc(1, pkt_size); + send_pkt = (char *)v3_send_packet; + /* initialize response packet data */ + v3_send_packet->packet_version = htons(packet_ver); + v3_send_packet->packet_type = htons(QUERY_PACKET); + v3_send_packet->alignment = 0; + v3_send_packet->buffer_length = htonl(pkt_size - sizeof(v3_packet) + 1); + strcpy(&v3_send_packet->buffer[0], query); + + /* calculate the crc 32 value of the packet */ + v3_send_packet->crc32_value = 0; + calculated_crc32 = calculate_crc32((char *)v3_send_packet, pkt_size); + v3_send_packet->crc32_value = htonl(calculated_crc32); + } + + /* send the request to the remote */ + bytes_to_send = pkt_size; + + if (use_ssl == FALSE) + rc = sendall(sd, (char *)send_pkt, &bytes_to_send); +#ifdef HAVE_SSL + else { + rc = SSL_write(ssl, send_pkt, bytes_to_send); + if (rc < 0) + rc = -1; + } +#endif + + if (v3_send_packet) + free(v3_send_packet); + if (v2_send_packet) + free(v2_send_packet); + + if (rc == -1) { + printf("CHECK_NRPE: Error sending query to host.\n"); + close(sd); + return STATE_UNKNOWN; + } + + return STATE_OK; +} + +int read_response() +{ + v2_packet *v2_receive_packet = NULL; + v3_packet *v3_receive_packet = NULL; + u_int32_t packet_crc32; + u_int32_t calculated_crc32; + int32_t pkt_size; + int rc, result; + + alarm(0); + set_sig_hadlers(); + +#ifdef HAVE_SSL + rc = read_packet(sd, ssl, &v2_receive_packet, &v3_receive_packet); +#else + rc = read_packet(sd, NULL, &v2_receive_packet, &v3_receive_packet); +#endif + + alarm(0); + + /* close the connection */ +#ifdef HAVE_SSL + if (use_ssl == TRUE) { + SSL_shutdown(ssl); + SSL_free(ssl); + SSL_CTX_free(ctx); + } +#endif + graceful_close(sd, 1000); + + /* recv() error */ + if (rc < 0) { + if (packet_ver == NRPE_PACKET_VERSION_3) { + if (v3_receive_packet) + free(v3_receive_packet); + return -1; + } + if (v2_receive_packet) + free(v2_receive_packet); + return STATE_UNKNOWN; + + } else if (rc == 0) { + + /* server disconnected */ + printf("CHECK_NRPE: Received 0 bytes from daemon. Check " + "the remote server logs for error messages.\n"); + if (packet_ver == NRPE_PACKET_VERSION_3) { + if (v3_receive_packet) + free(v3_receive_packet); + } else if (v2_receive_packet) + free(v2_receive_packet); + return STATE_UNKNOWN; + } + + /* check the crc 32 value */ + if (packet_ver == NRPE_PACKET_VERSION_3) { + pkt_size = (sizeof(v3_packet) - 1) + ntohl(v3_receive_packet->buffer_length); + packet_crc32 = ntohl(v3_receive_packet->crc32_value); + v3_receive_packet->crc32_value = 0L; + v3_receive_packet->alignment = 0; + calculated_crc32 = calculate_crc32((char *)v3_receive_packet, pkt_size); + } else { + pkt_size = sizeof(v2_packet); + if (payload_size > 0) + pkt_size = sizeof(v2_packet) - MAX_PACKETBUFFER_LENGTH + payload_size; + packet_crc32 = ntohl(v2_receive_packet->crc32_value); + v2_receive_packet->crc32_value = 0L; + calculated_crc32 = calculate_crc32((char *)v2_receive_packet, pkt_size); + } + + if (packet_crc32 != calculated_crc32) { + printf("CHECK_NRPE: Response packet had invalid CRC32.\n"); + close(sd); + if (packet_ver == NRPE_PACKET_VERSION_3) { + if (v3_receive_packet) + free(v3_receive_packet); + } else if (v2_receive_packet) + free(v2_receive_packet); + return STATE_UNKNOWN; + } + + /* get the return code from the remote plugin */ + /* and print the output returned by the daemon */ + if (packet_ver == NRPE_PACKET_VERSION_3) { + result = ntohs(v3_receive_packet->result_code); + if (v3_receive_packet->buffer_length == 0) + printf("CHECK_NRPE: No output returned from daemon.\n"); + else + printf("%s\n", v3_receive_packet->buffer); + } else { + result = ntohs(v2_receive_packet->result_code); + if (payload_size > 0) + v2_receive_packet->buffer[payload_size - 1] = '\x0'; + else + v2_receive_packet->buffer[MAX_PACKETBUFFER_LENGTH - 1] = '\x0'; + if (!strcmp(v2_receive_packet->buffer, "")) + printf("CHECK_NRPE: No output returned from daemon.\n"); + else if (strstr(v2_receive_packet->buffer, "Invalid packet version.3") != NULL) + /* NSClient++ doesn't recognize it */ + return -1; + else + printf("%s\n", v2_receive_packet->buffer); + } + + if (packet_ver == NRPE_PACKET_VERSION_3) { + if (v3_receive_packet) + free(v3_receive_packet); + } else if (v2_receive_packet) + free(v2_receive_packet); + + return result; +} + +int read_packet(int sock, void *ssl_ptr, v2_packet ** v2_pkt, v3_packet ** v3_pkt) +{ + v2_packet packet; + int32_t pkt_size, common_size, tot_bytes, bytes_to_recv, buffer_size, bytes_read = 0; + int rc; + char *buff_ptr; + + /* Read only the part that's common between versions 2 & 3 */ + common_size = tot_bytes = bytes_to_recv = (char *)packet.buffer - (char *)&packet; + + if (use_ssl == FALSE) { + rc = recvall(sock, (char *)&packet, &tot_bytes, socket_timeout); + + if (rc <= 0 || rc != bytes_to_recv) { + if (rc < bytes_to_recv) { + if (packet_ver != NRPE_PACKET_VERSION_3) + printf("CHECK_NRPE: Receive header underflow - " + "only %d bytes received (%ld expected).\n", + rc, sizeof(bytes_to_recv)); + } + return -1; + } + + packet_ver = ntohs(packet.packet_version); + if (packet_ver != NRPE_PACKET_VERSION_2 && packet_ver != NRPE_PACKET_VERSION_3) { + printf("CHECK_NRPE: Invalid packet version received from server.\n"); + return -1; + } + + if (ntohs(packet.packet_type) != RESPONSE_PACKET) { + printf("CHECK_NRPE: Invalid packet type received from server.\n"); + return -1; + } + + if (packet_ver == NRPE_PACKET_VERSION_2) { + pkt_size = sizeof(v2_packet); + if (payload_size > 0) { + pkt_size = common_size + payload_size; + buffer_size = payload_size; + } else + buffer_size = pkt_size - common_size; + if ((*v2_pkt = calloc(1, pkt_size)) == NULL) { + syslog(LOG_ERR, "Error: Could not allocate memory for packet"); + return -1; + } + memcpy(*v2_pkt, &packet, common_size); + buff_ptr = (*v2_pkt)->buffer; + memset(buff_ptr, 0, buffer_size); + } else { + pkt_size = sizeof(v3_packet) - 1; + + /* Read the alignment filler */ + bytes_to_recv = sizeof(int16_t); + rc = recvall(sock, (char *)&buffer_size, &bytes_to_recv, socket_timeout); + if (rc <= 0 || bytes_to_recv != sizeof(int16_t)) + return -1; + tot_bytes += rc; + + /* Read the buffer size */ + bytes_to_recv = sizeof(buffer_size); + rc = recvall(sock, (char *)&buffer_size, &bytes_to_recv, socket_timeout); + if (rc <= 0 || bytes_to_recv != sizeof(buffer_size)) + return -1; + tot_bytes += rc; + + buffer_size = ntohl(buffer_size); + pkt_size += buffer_size; + if ((*v3_pkt = calloc(1, pkt_size)) == NULL) { + syslog(LOG_ERR, "Error: Could not allocate memory for packet"); + return -1; + } + + memcpy(*v3_pkt, &packet, common_size); + (*v3_pkt)->buffer_length = htonl(buffer_size); + buff_ptr = (*v3_pkt)->buffer; + } + + bytes_to_recv = buffer_size; + rc = recvall(sock, buff_ptr, &bytes_to_recv, socket_timeout); + + if (rc <= 0 || rc != buffer_size) { + if (packet_ver == NRPE_PACKET_VERSION_3) { + free(*v3_pkt); + *v3_pkt = NULL; + } else { + free(*v2_pkt); + *v2_pkt = NULL; + } + if (rc < buffer_size) + printf("CHECK_NRPE: Receive underflow - only %d bytes received " + "(%ld expected).\n", rc, sizeof(buffer_size)); + return -1; + } else + tot_bytes += rc; + } +#ifdef HAVE_SSL + else { + SSL *ssl = (SSL *) ssl_ptr; + + while (((rc = SSL_read(ssl, &packet, bytes_to_recv)) <= 0) + && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) { + } + + if (rc <= 0 || rc != bytes_to_recv) { + if (rc < bytes_to_recv) { + if (packet_ver != NRPE_PACKET_VERSION_3) + printf("CHECK_NRPE: Receive header underflow - only %d bytes " + "received (%ld expected).\n", rc, sizeof(bytes_to_recv)); + } + return -1; + } + + packet_ver = ntohs(packet.packet_version); + if (packet_ver != NRPE_PACKET_VERSION_2 && packet_ver != NRPE_PACKET_VERSION_3) { + printf("CHECK_NRPE: Invalid packet version received from server.\n"); + return -1; + } + + if (ntohs(packet.packet_type) != RESPONSE_PACKET) { + printf("CHECK_NRPE: Invalid packet type received from server.\n"); + return -1; + } + + if (packet_ver == NRPE_PACKET_VERSION_2) { + pkt_size = sizeof(v2_packet); + if (payload_size > 0) { + pkt_size = common_size + payload_size; + buffer_size = payload_size; + } else + buffer_size = pkt_size - common_size; + if ((*v2_pkt = calloc(1, pkt_size)) == NULL) { + syslog(LOG_ERR, "Error: Could not allocate memory for packet"); + return -1; + } + memcpy(*v2_pkt, &packet, common_size); + buff_ptr = (*v2_pkt)->buffer; + memset(buff_ptr, 0, buffer_size); + } else { + pkt_size = sizeof(v3_packet) - 1; + + /* Read the alignment filler */ + bytes_to_recv = sizeof(int16_t); + while (((rc = SSL_read(ssl, &buffer_size, bytes_to_recv)) <= 0) + && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) { + } + + if (rc <= 0 || bytes_to_recv != sizeof(int16_t)) + return -1; + tot_bytes += rc; + + /* Read the buffer size */ + bytes_to_recv = sizeof(buffer_size); + while (((rc = SSL_read(ssl, &buffer_size, bytes_to_recv)) <= 0) + && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) { + } + + if (rc <= 0 || bytes_to_recv != sizeof(buffer_size)) + return -1; + tot_bytes += rc; + + buffer_size = ntohl(buffer_size); + pkt_size += buffer_size; + if ((*v3_pkt = calloc(1, pkt_size)) == NULL) { + syslog(LOG_ERR, "Error: Could not allocate memory for packet"); + return -1; + } + + memcpy(*v3_pkt, &packet, common_size); + (*v3_pkt)->buffer_length = htonl(buffer_size); + buff_ptr = (*v3_pkt)->buffer; + } + + bytes_to_recv = buffer_size; + for (;;) { + while (((rc = SSL_read(ssl, &buff_ptr[bytes_read], bytes_to_recv)) <= 0) + && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) { + } + + if (rc <= 0) + break; + bytes_read += rc; + bytes_to_recv -= rc; + } + + buff_ptr[bytes_read] = 0; + + if (rc < 0 || bytes_read != buffer_size) { + if (packet_ver == NRPE_PACKET_VERSION_3) { + free(*v3_pkt); + *v3_pkt = NULL; + } else { + free(*v2_pkt); + *v2_pkt = NULL; + } + if (bytes_read != buffer_size) { + if (packet_ver == NRPE_PACKET_VERSION_3) + printf("CHECK_NRPE: Receive buffer size - %ld bytes received " + "(%ld expected).\n", (long)bytes_read, sizeof(buffer_size)); + else + printf("CHECK_NRPE: Receive underflow - only %ld bytes received " + "(%ld expected).\n", (long)bytes_read, sizeof(buffer_size)); + } + return -1; + } else + tot_bytes += rc; + } +#endif + + return tot_bytes; +} + +#ifdef HAVE_SSL +int verify_callback(int preverify_ok, X509_STORE_CTX * ctx) +{ + char name[256], issuer[256]; + X509 *err_cert; + int err; + SSL *ssl; + + if (preverify_ok || ((sslprm.log_opts & SSL_LogCertDetails) == 0)) + return preverify_ok; + + err_cert = X509_STORE_CTX_get_current_cert(ctx); + err = X509_STORE_CTX_get_error(ctx); + + /* Get the pointer to the SSL of the current connection */ + ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); + + X509_NAME_oneline(X509_get_subject_name(err_cert), name, 256); + X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), issuer, 256); + + if (!preverify_ok && sslprm.client_certs >= Ask_For_Cert + && (sslprm.log_opts & SSL_LogCertDetails)) { + syslog(LOG_ERR, "SSL Client has an invalid certificate: %s (issuer=%s) err=%d:%s", + name, issuer, err, X509_verify_cert_error_string(err)); + } + + return preverify_ok; +} +#endif + +void alarm_handler(int sig) +{ + const char msg1[] = "CHECK_NRPE STATE "; + const char msg2[] = ": Socket timeout after "; + const char msg3[] = " seconds.\n"; + const char *text = state_text(timeout_return_code); + size_t lth1 = 0, lth2 = 0; + + for (lth1 = 0; lth1 < 10; ++lth1) + if (text[lth1] == 0) + break; + for (lth2 = 0; lth2 < 10; ++lth2) + if (timeout_txt[lth2] == 0) + break; + + write(STDOUT_FILENO, msg1, sizeof(msg1) - 1); + write(STDOUT_FILENO, text, lth1); + write(STDOUT_FILENO, msg2, sizeof(msg2) - 1); + write(STDOUT_FILENO, timeout_txt, lth2); + write(STDOUT_FILENO, msg3, sizeof(msg3) - 1); + + exit(timeout_return_code); +} + +/* submitted by Mark Plaksin 08/31/2006 */ +int graceful_close(int sd, int timeout) +{ + fd_set in; + struct timeval tv; + char buf[1000]; + + /* send FIN packet */ + shutdown(sd, SHUT_WR); + + for (;;) { + FD_ZERO(&in); + FD_SET(sd, &in); + tv.tv_sec = timeout / 1000; + tv.tv_usec = (timeout % 1000) * 1000; + + /* timeout or error */ + if (1 != select(sd + 1, &in, NULL, NULL, &tv)) + break; + + /* no more data (FIN or RST) */ + if (0 >= recv(sd, buf, sizeof(buf), 0)) + break; + } #ifdef HAVE_CLOSESOCKET - closesocket(sd); + closesocket(sd); #else close(sd); #endif return OK; - } +} diff --git a/src/nrpe.c b/src/nrpe.c index 381f0ac..dc93d97 100644 --- a/src/nrpe.c +++ b/src/nrpe.c @@ -1,11 +1,11 @@ /******************************************************************************* * * NRPE.C - Nagios Remote Plugin Executor + * + * Copyright (c) 2009 Nagios Core Development Team and Community Contributors * Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org) * License: GPL * - * Last Modified: 09-06-2013 - * * Command line: nrpe -c [--inetd | --daemon] * * Description: @@ -15,14 +15,14 @@ * plugin execution. It is useful for running "local" plugins * such as check_users, check_load, check_disk, etc. without * having to use rsh or ssh. - * + * ******************************************************************************/ /* * 08-10-2011 IPv4 subnetworks support added. * Main change in nrpe.c is that is_an_allowed_host() moved to acl.c. * now allowed_hosts is parsed by parse_allowed_hosts() from acl.c. - */ + */ #include "config.h" #include "common.h" @@ -31,146 +31,444 @@ #include "acl.h" #ifdef HAVE_SSL -#include "../include/dh.h" +# ifdef USE_SSL_DH +# include "../include/dh.h" +# endif +#endif +#ifndef HAVE_ASPRINTF +extern int asprintf(char **ptr, const char *format, ...); #endif #ifdef HAVE_LIBWRAP -int allow_severity=LOG_INFO; -int deny_severity=LOG_WARNING; +int allow_severity = LOG_INFO; +int deny_severity = LOG_WARNING; +# ifndef HAVE_RFC931_TIMEOUT +int rfc931_timeout=15; +# endif #endif #ifdef HAVE_SSL -#ifdef __sun +# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux) SSL_METHOD *meth; -#else +# else const SSL_METHOD *meth; -#endif -SSL_CTX *ctx; -int use_ssl=TRUE; +# endif +SSL_CTX *ctx; +int use_ssl = TRUE; #else -int use_ssl=FALSE; +int use_ssl = FALSE; #endif -#define DEFAULT_COMMAND_TIMEOUT 60 /* default timeout for execution of plugins */ -#define MAXFD 64 -#define NASTY_METACHARS "|`&><'\"\\[]{};" -#define howmany(x,y) (((x)+((y)-1))/(y)) -#define MAX_LISTEN_SOCKS 16 +#define DEFAULT_COMMAND_TIMEOUT 60 /* default timeout for execution of plugins */ +#define MAXFD 64 +#define NASTY_METACHARS "|`&><'\\[]{};\r\n" +#define MAX_LISTEN_SOCKS 16 +#define DEFAULT_LISTEN_QUEUE_SIZE 5 +#define DEFAULT_SSL_SHUTDOWN_TIMEOUT 15 + +#define how_many(x,y) (((x)+((y)-1))/(y)) + +extern int errno; +struct addrinfo *listen_addrs = NULL; +int listen_socks[MAX_LISTEN_SOCKS]; +char remote_host[MAX_HOST_ADDRESS_LENGTH]; +char *macro_argv[MAX_COMMAND_ARGUMENTS]; +char config_file[MAX_INPUT_BUFFER] = "nrpe.cfg"; +char server_address[NI_MAXHOST] = ""; +char *command_name = NULL; +int log_facility = LOG_DAEMON; +int server_port = DEFAULT_SERVER_PORT; +int num_listen_socks = 0; +int address_family = AF_UNSPEC; +int socket_timeout = DEFAULT_SOCKET_TIMEOUT; +int command_timeout = DEFAULT_COMMAND_TIMEOUT; +int connection_timeout = DEFAULT_CONNECTION_TIMEOUT; +int ssl_shutdown_timeout = DEFAULT_SSL_SHUTDOWN_TIMEOUT; +char *command_prefix = NULL; +int packet_ver = 0; +command *command_list = NULL; +char *nrpe_user = NULL; +char *nrpe_group = NULL; +char *allowed_hosts = NULL; +char *keep_env_vars = NULL; +char *pid_file = NULL; +int wrote_pid_file = FALSE; +int allow_arguments = FALSE; +int allow_bash_cmd_subst = FALSE; +int allow_weak_random_seed = FALSE; +int sigrestart = FALSE; +int sigshutdown = FALSE; +int show_help = FALSE; +int show_license = FALSE; +int show_version = FALSE; +int use_inetd = TRUE; +int debug = FALSE; +int use_src = FALSE; /* Define parameter for SRC option */ +int no_forking = FALSE; +int listen_queue_size = DEFAULT_LISTEN_QUEUE_SIZE; + +/* SSL/TLS parameters */ +typedef enum _SSL_VER { + SSLv2 = 1, SSLv2_plus, SSLv3, SSLv3_plus, TLSv1, + TLSv1_plus, TLSv1_1, TLSv1_1_plus, TLSv1_2, TLSv1_2_plus +} SslVer; + +typedef enum _CLNT_CERTS { + ClntCerts_Unknown = 0, Ask_For_Cert = 1, Require_Cert = 2 +} ClntCerts; + +typedef enum _SSL_LOGGING { + SSL_NoLogging = 0, SSL_LogStartup = 1, SSL_LogIpAddr = 2, + SSL_LogVersion = 4, SSL_LogCipher = 8, SSL_LogIfClientCert = 16, + SSL_LogCertDetails = 32 +} SslLogging; + +struct _SSL_PARMS { + char *cert_file; + char *cacert_file; + char *privatekey_file; + char cipher_list[MAX_FILENAME_LENGTH]; + SslVer ssl_min_ver; + int allowDH; + ClntCerts client_certs; + SslLogging log_opts; +} sslprm = { +NULL, NULL, NULL, "ALL:!MD5:@STRENGTH", TLSv1_plus, TRUE, 0, SSL_NoLogging}; -char *command_name=NULL; -char *macro_argv[MAX_COMMAND_ARGUMENTS]; - -char config_file[MAX_INPUT_BUFFER]="nrpe.cfg"; -int log_facility=LOG_DAEMON; -int server_port=DEFAULT_SERVER_PORT; -char server_address[NI_MAXHOST]=""; -struct addrinfo *listen_addrs=NULL; -int listen_socks[MAX_LISTEN_SOCKS]; -int num_listen_socks = 0; -int address_family=AF_UNSPEC; -int socket_timeout=DEFAULT_SOCKET_TIMEOUT; -int command_timeout=DEFAULT_COMMAND_TIMEOUT; -int connection_timeout=DEFAULT_CONNECTION_TIMEOUT; -char *command_prefix=NULL; - -command *command_list=NULL; - -char *nrpe_user=NULL; -char *nrpe_group=NULL; - -char *allowed_hosts=NULL; - -char *pid_file=NULL; -int wrote_pid_file=FALSE; - -int allow_arguments=FALSE; -int allow_bash_command_substitution=FALSE; - -int allow_weak_random_seed=FALSE; - -int sigrestart=FALSE; -int sigshutdown=FALSE; - -int show_help=FALSE; -int show_license=FALSE; -int show_version=FALSE; -int use_inetd=TRUE; -int debug=FALSE; -int use_src=FALSE; /* Define parameter for SRC option */ - - -void complete_SSL_shutdown( SSL *); - - -int main(int argc, char **argv){ - int result=OK; - int x; - char buffer[MAX_INPUT_BUFFER]; - char *env_string=NULL; #ifdef HAVE_SSL - DH *dh; - char seedfile[FILENAME_MAX]; - int i,c; +static int verify_callback(int ok, X509_STORE_CTX * ctx); +static void my_disconnect_sighandler(int sig); +static void complete_SSL_shutdown(SSL *); #endif - /* set some environment variables */ - asprintf(&env_string,"NRPE_MULTILINESUPPORT=1"); - putenv(env_string); - asprintf(&env_string,"NRPE_PROGRAMVERSION=%s",PROGRAM_VERSION); - putenv(env_string); +int main(int argc, char **argv) +{ + int result = OK; + int x; + uint32_t y; + char buffer[MAX_INPUT_BUFFER]; + + init(); /* process command-line args */ - result=process_arguments(argc,argv); + result = process_arguments(argc, argv); + if (result != OK || show_help == TRUE || show_license == TRUE || show_version == TRUE) + usage(result); - if(result!=OK || show_help==TRUE || show_license==TRUE || show_version==TRUE){ + /* make sure the config file uses an absolute path */ + if (config_file[0] != '/') { + + /* save the name of the config file */ + strncpy(buffer, config_file, sizeof(buffer)); + buffer[sizeof(buffer) - 1] = '\x0'; + + /* get absolute path of current working directory */ + strcpy(config_file, ""); + getcwd(config_file, sizeof(config_file)); + + /* append a forward slash */ + strncat(config_file, "/", sizeof(config_file) - 2); + config_file[sizeof(config_file) - 1] = '\x0'; + + /* append the config file to the path */ + strncat(config_file, buffer, sizeof(config_file) - strlen(config_file) - 1); + config_file[sizeof(config_file) - 1] = '\x0'; + } + + /* read the config file */ + result = read_config_file(config_file); + /* exit if there are errors... */ + if (result == ERROR) { + syslog(LOG_ERR, "Config file '%s' contained errors, aborting...", config_file); + return STATE_CRITICAL; + } + + /* initialize macros */ + for (x = 0; x < MAX_COMMAND_ARGUMENTS; x++) + macro_argv[x] = NULL; + + init_ssl(); + + /* if we're running under inetd... */ + if (use_inetd == TRUE) + run_inetd(); + + else if (use_src == TRUE || no_forking == TRUE) + run_src(); + + else + run_daemon(); - printf("\n"); - printf("NRPE - Nagios Remote Plugin Executor\n"); - printf("Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)\n"); - printf("Version: %s\n",PROGRAM_VERSION); - printf("Last Modified: %s\n",MODIFICATION_DATE); - printf("License: GPL v2 with exemptions (-l for more info)\n"); #ifdef HAVE_SSL - printf("SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required\n"); + if (use_ssl == TRUE) + SSL_CTX_free(ctx); +#endif + + /* We are now running in daemon mode, or the connection handed over by inetd has + been completed, so the parent process exits */ + return STATE_OK; +} + +int init(void) +{ + char *env_string = NULL; + int result = OK; + + /* set some environment variables */ + asprintf(&env_string, "NRPE_MULTILINESUPPORT=1"); + putenv(env_string); + asprintf(&env_string, "NRPE_PROGRAMVERSION=%s", PROGRAM_VERSION); + putenv(env_string); + + /* open a connection to the syslog facility */ + /* facility name may be overridden later */ + get_log_facility(NRPE_LOG_FACILITY); + openlog("nrpe", LOG_PID, log_facility); + + /* generate the CRC 32 table */ + generate_crc32_table(); + + return result; +} + +void init_ssl(void) +{ +#ifdef HAVE_SSL + DH *dh; + char seedfile[FILENAME_MAX]; + int i, c, x; + int ssl_opts = SSL_OP_ALL | SSL_OP_SINGLE_DH_USE, vrfy; + + if (use_ssl == FALSE) { + if (debug == TRUE) + syslog(LOG_INFO, "INFO: SSL/TLS NOT initialized. Network encryption DISABLED."); + return; + } + +#ifndef USE_SSL_DH + ssl_opts = SSL_OP_ALL; + sslprm.allowDH = 0; +#endif + + if (sslprm.log_opts & SSL_LogStartup) + log_ssl_startup(); + + /* initialize SSL */ + SSL_load_error_strings(); + SSL_library_init(); + + meth = SSLv23_server_method(); + + /* use week random seed if necessary */ + if (allow_weak_random_seed && (RAND_status() == 0)) { + if (RAND_file_name(seedfile, sizeof(seedfile) - 1)) + if (RAND_load_file(seedfile, -1)) + RAND_write_file(seedfile); + + if (RAND_status() == 0) { + syslog(LOG_ERR, + "Warning: SSL/TLS uses a weak random seed which is highly discouraged"); + srand(time(NULL)); + for (i = 0; i < 500 && RAND_status() == 0; i++) { + for (c = 0; c < sizeof(seedfile); c += sizeof(int)) { + *((int *)(seedfile + c)) = rand(); + } + RAND_seed(seedfile, sizeof(seedfile)); + } + } + } +# ifndef OPENSSL_NO_SSL2 + if (sslprm.ssl_min_ver == SSLv2) + meth = SSLv2_server_method(); +# endif +# ifndef OPENSSL_NO_SSL3 + if (sslprm.ssl_min_ver == SSLv3) + meth = SSLv3_server_method(); +# endif + if (sslprm.ssl_min_ver == TLSv1) + meth = TLSv1_server_method(); +# ifdef SSL_TXT_TLSV1_1 + if (sslprm.ssl_min_ver == TLSv1_1) + meth = TLSv1_1_server_method(); +# ifdef SSL_TXT_TLSV1_2 + if (sslprm.ssl_min_ver == TLSv1_2) + meth = TLSv1_2_server_method(); +# endif +# endif + + ctx = SSL_CTX_new(meth); + if (ctx == NULL) { + syslog(LOG_ERR, "Error: could not create SSL context"); + SSL_CTX_free(ctx); + exit(STATE_CRITICAL); + } + + if (sslprm.ssl_min_ver >= SSLv3) { + ssl_opts |= SSL_OP_NO_SSLv2; + if (sslprm.ssl_min_ver >= TLSv1) + ssl_opts |= SSL_OP_NO_SSLv3; + } + SSL_CTX_set_options(ctx, ssl_opts); + + if (sslprm.cert_file != NULL) { + if (!SSL_CTX_use_certificate_file(ctx, sslprm.cert_file, SSL_FILETYPE_PEM)) { + SSL_CTX_free(ctx); + while ((x = ERR_get_error()) != 0) + syslog(LOG_ERR, "Error: could not use certificate file %s : %s", + sslprm.cert_file, ERR_error_string(x, NULL)); + exit(STATE_CRITICAL); + } + if (!SSL_CTX_use_PrivateKey_file(ctx, sslprm.privatekey_file, SSL_FILETYPE_PEM)) { + SSL_CTX_free(ctx); + syslog(LOG_ERR, "Error: could not use private key file '%s'", + sslprm.privatekey_file); + exit(STATE_CRITICAL); + } + } + + if (sslprm.client_certs != 0) { + vrfy = SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE; + if ((sslprm.client_certs & Require_Cert) != 0) + vrfy |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT; + SSL_CTX_set_verify(ctx, vrfy, verify_callback); + if (!SSL_CTX_load_verify_locations(ctx, sslprm.cacert_file, NULL)) { + SSL_CTX_free(ctx); + syslog(LOG_ERR, "Error: could not use CA certificate '%s'", sslprm.cacert_file); + exit(STATE_CRITICAL); + } + } + + if (!sslprm.allowDH) { + if (strlen(sslprm.cipher_list) < sizeof(sslprm.cipher_list) - 6) + strcat(sslprm.cipher_list, ":!ADH"); + } else { + /* use anonymous DH ciphers */ + if (sslprm.allowDH == 2) + strcpy(sslprm.cipher_list, "ADH"); +#ifdef USE_SSL_DH + dh = get_dh2048(); + SSL_CTX_set_tmp_dh(ctx, dh); + DH_free(dh); +#endif + } + + if (SSL_CTX_set_cipher_list(ctx, sslprm.cipher_list) == 0) { + SSL_CTX_free(ctx); + syslog(LOG_ERR, "Error: Could not set SSL/TLS cipher list"); + exit(STATE_CRITICAL); + } + + if (debug == TRUE) + syslog(LOG_INFO, "INFO: SSL/TLS initialized. All network traffic will be encrypted."); +#endif +} + +void log_ssl_startup(void) +{ +#ifdef HAVE_SSL + char *vers; + + syslog(LOG_INFO, "SSL Certificate File: %s", sslprm.cert_file ? sslprm.cert_file : "None"); + syslog(LOG_INFO, "SSL Private Key File: %s", + sslprm.privatekey_file ? sslprm.privatekey_file : "None"); + syslog(LOG_INFO, "SSL CA Certificate File: %s", + sslprm.cacert_file ? sslprm.cacert_file : "None"); + if (sslprm.allowDH < 2) + syslog(LOG_INFO, "SSL Cipher List: %s", sslprm.cipher_list); + else + syslog(LOG_INFO, "SSL Cipher List: ADH"); + syslog(LOG_INFO, "SSL Allow ADH: %s", + sslprm.allowDH == 0 ? "No" : (sslprm.allowDH == 1 ? "Allow" : "Require")); + syslog(LOG_INFO, "SSL Client Certs: %s", + sslprm.client_certs == 0 ? "Don't Ask" : (sslprm.client_certs == + 1 ? "Accept" : "Require")); + syslog(LOG_INFO, "SSL Log Options: 0x%02x", sslprm.log_opts); + switch (sslprm.ssl_min_ver) { + case SSLv2: + vers = "SSLv2"; + break; + case SSLv2_plus: + vers = "SSLv2 And Above"; + break; + case SSLv3: + vers = "SSLv3"; + break; + case SSLv3_plus: + vers = "SSLv3 And Above"; + break; + case TLSv1: + vers = "TLSv1"; + break; + case TLSv1_plus: + vers = "TLSv1 And Above"; + break; + case TLSv1_1: + vers = "TLSv1_1"; + break; + case TLSv1_1_plus: + vers = "TLSv1_1 And Above"; + break; + case TLSv1_2: + vers = "TLSv1_2"; + break; + case TLSv1_2_plus: + vers = "TLSv1_2 And Above"; + break; + default: + vers = "INVALID VALUE!"; + break; + } + syslog(LOG_INFO, "SSL Version: %s", vers); +#endif +} + +void usage(int result) +{ + printf("\n"); + printf("NRPE - Nagios Remote Plugin Executor\n"); + printf("Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)\n"); + printf("Version: %s\n", PROGRAM_VERSION); + printf("Last Modified: %s\n", MODIFICATION_DATE); + printf("License: GPL v2 with exemptions (-l for more info)\n"); +#ifdef HAVE_SSL + printf("SSL/TLS Available, OpenSSL 0.9.6 or higher required\n"); #endif #ifdef HAVE_LIBWRAP - printf("TCP Wrappers Available\n"); + printf("TCP Wrappers Available\n"); #endif - printf("\n"); + printf("\n"); #ifdef ENABLE_COMMAND_ARGUMENTS - printf("***************************************************************\n"); - printf("** POSSIBLE SECURITY RISK - COMMAND ARGUMENTS ARE SUPPORTED! **\n"); - printf("** Read the NRPE SECURITY file for more information **\n"); - printf("***************************************************************\n"); - printf("\n"); + printf("***************************************************************\n"); + printf("** POSSIBLE SECURITY RISK - COMMAND ARGUMENTS ARE SUPPORTED! **\n"); + printf("** Read the NRPE SECURITY file for more information **\n"); + printf("***************************************************************\n"); + printf("\n"); #endif #ifndef HAVE_LIBWRAP - printf("***************************************************************\n"); - printf("** POSSIBLE SECURITY RISK - TCP WRAPPERS ARE NOT AVAILABLE! **\n"); - printf("** Read the NRPE SECURITY file for more information **\n"); - printf("***************************************************************\n"); - printf("\n"); + printf("***************************************************************\n"); + printf("** POSSIBLE SECURITY RISK - TCP WRAPPERS ARE NOT AVAILABLE! **\n"); + printf("** Read the NRPE SECURITY file for more information **\n"); + printf("***************************************************************\n"); + printf("\n"); #endif - } - if(show_license==TRUE) + if (show_license == TRUE) display_license(); - else if(result!=OK || show_help==TRUE){ - + if (result != OK || show_help == TRUE) { printf("Usage: nrpe [-n] -c [-4|-6] \n"); printf("\n"); printf("Options:\n"); - printf(" -n = Do not use SSL\n"); - printf(" = Name of config file to use\n"); - printf(" -4 = use ipv4 only\n"); - printf(" -6 = use ipv6 only\n"); - printf(" = One of the following operating modes:\n"); - printf(" -i = Run as a service under inetd or xinetd\n"); - printf(" -d = Run as a standalone daemon\n"); - /* Updates help section to indicate how to start under SRC on AIX */ - printf(" -d -s = Run as a subsystem under AIX\n"); + printf(" -n = Do not use SSL\n"); + printf(" -c = Name of config file to use\n"); + printf(" -4 = use ipv4 only\n"); + printf(" -6 = use ipv6 only\n"); + printf(" = One of the following operating modes:\n"); + printf(" -i = Run as a service under inetd or xinetd\n"); + printf(" -d = Run as a standalone daemon\n"); + printf(" -d -s = Run as a subsystem under AIX\n"); + printf(" -f = Don't fork() for systemd, launchd, etc.\n"); printf("\n"); printf("Notes:\n"); printf("This program is designed to process requests from the check_nrpe\n"); @@ -181,644 +479,590 @@ int main(int argc, char **argv){ printf("config file) and return the plugin output and return code to the\n"); printf("check_nrpe plugin.\n"); printf("\n"); - } - - if(result!=OK || show_help==TRUE || show_license==TRUE || show_version==TRUE) - exit(STATE_UNKNOWN); - - - /* open a connection to the syslog facility */ - /* facility name may be overridden later */ - get_log_facility(NRPE_LOG_FACILITY); - openlog("nrpe",LOG_PID,log_facility); - - /* make sure the config file uses an absolute path */ - if(config_file[0]!='/'){ - - /* save the name of the config file */ - strncpy(buffer,config_file,sizeof(buffer)); - buffer[sizeof(buffer)-1]='\x0'; - - /* get absolute path of current working directory */ - strcpy(config_file,""); - getcwd(config_file,sizeof(config_file)); - - /* append a forward slash */ - strncat(config_file,"/",sizeof(config_file)-2); - config_file[sizeof(config_file)-1]='\x0'; - - /* append the config file to the path */ - strncat(config_file,buffer,sizeof(config_file)-strlen(config_file)-1); - config_file[sizeof(config_file)-1]='\x0'; - } - - /* read the config file */ - result=read_config_file(config_file); - - /* exit if there are errors... */ - if(result==ERROR){ - syslog(LOG_ERR,"Config file '%s' contained errors, aborting...",config_file); - return STATE_CRITICAL; - } - - /* generate the CRC 32 table */ - generate_crc32_table(); - - /* initialize macros */ - for(x=0;xcurrent_cert), issuer, 256); + + if (!preverify_ok && (sslprm.log_opts & SSL_LogCertDetails)) { + syslog(LOG_ERR, "SSL Client has an invalid certificate: %s (issuer=%s) err=%d:%s", + name, issuer, err, X509_verify_cert_error_string(err)); + } + + return preverify_ok; +} +#endif /* read in the configuration file */ -int read_config_file(char *filename){ - FILE *fp; - char config_file[MAX_FILENAME_LENGTH]; - char input_buffer[MAX_INPUT_BUFFER]; - char *input_line; - char *temp_buffer; - char *varname; - char *varvalue; - int line=0; - int len=0; - int x=0; +int read_config_file(char *filename) +{ + struct stat st; + FILE *fp; + char config_file[MAX_FILENAME_LENGTH]; + char input_buffer[MAX_INPUT_BUFFER]; + char *input_line; + char *temp_buffer; + char *varname; + char *varvalue; + int line = 0; + int len = 0; + int x = 0; - - /* open the config file for reading */ - fp=fopen(filename,"r"); + fp = fopen(filename, "r"); /* open the config file for reading */ /* exit if we couldn't open the config file */ - if(fp==NULL){ - syslog(LOG_ERR,"Unable to open config file '%s' for reading\n",filename); + if (fp == NULL) { + syslog(LOG_ERR, "Unable to open config file '%s' for reading\n", filename); return ERROR; - } - - while(fgets(input_buffer,MAX_INPUT_BUFFER-1,fp)){ + } + while (fgets(input_buffer, MAX_INPUT_BUFFER - 1, fp)) { line++; - input_line=input_buffer; + input_line = input_buffer; /* skip leading whitespace */ - while(isspace(*input_line)) + while (isspace(*input_line)) ++input_line; /* trim trailing whitespace */ - len=strlen(input_line); - for(x=len-1;x>=0;x--){ - if(isspace(input_line[x])) - input_line[x]='\x0'; + len = strlen(input_line); + for (x = len - 1; x >= 0; x--) { + if (isspace(input_line[x])) + input_line[x] = '\x0'; else break; - } + } /* skip comments and blank lines */ - if(input_line[0]=='#') - continue; - if(input_line[0]=='\x0') - continue; - if(input_line[0]=='\n') + if (input_line[0] == '#' || input_line[0] == '\x0' || input_line[0] == '\n') continue; /* get the variable name */ - varname=strtok(input_line,"="); - if(varname==NULL){ - syslog(LOG_ERR,"No variable name specified in config file '%s' - Line %d\n",filename,line); + varname = strtok(input_line, "="); + if (varname == NULL) { + syslog(LOG_ERR, "No variable name specified in config file '%s' - Line %d\n", + filename, line); return ERROR; - } + } /* get the variable value */ - varvalue=strtok(NULL,"\n"); - if(varvalue==NULL){ - syslog(LOG_ERR,"No variable value specified in config file '%s' - Line %d\n",filename,line); + varvalue = strtok(NULL, "\n"); + if (varvalue == NULL) { + syslog(LOG_ERR, "No variable value specified in config file '%s' - Line %d\n", + filename, line); return ERROR; - } - /* allow users to specify directories to recurse into for config files */ - else if(!strcmp(varname,"include_dir")){ + } else if (!strcmp(varname, "include_dir")) { + /* allow users to specify directories to recurse into for config files */ - strncpy(config_file,varvalue,sizeof(config_file)-1); - config_file[sizeof(config_file)-1]='\x0'; + strncpy(config_file, varvalue, sizeof(config_file) - 1); + config_file[sizeof(config_file) - 1] = '\x0'; /* strip trailing / if necessary */ - if(config_file[strlen(config_file)-1]=='/') - config_file[strlen(config_file)-1]='\x0'; + if (config_file[strlen(config_file) - 1] == '/') + config_file[strlen(config_file) - 1] = '\x0'; /* process the config directory... */ - if(read_config_dir(config_file)==ERROR) - syslog(LOG_ERR,"Continuing with errors..."); - } + if (read_config_dir(config_file) == ERROR) + syslog(LOG_ERR, "Continuing with errors..."); - /* allow users to specify individual config files to include */ - else if(!strcmp(varname,"include") || !strcmp(varname,"include_file")){ + } else if (!strcmp(varname, "include") || !strcmp(varname, "include_file")) { + /* allow users to specify individual config files to include */ /* process the config file... */ - if(read_config_file(varvalue)==ERROR) - syslog(LOG_ERR,"Continuing with errors..."); - } + if (read_config_file(varvalue) == ERROR) + syslog(LOG_ERR, "Continuing with errors..."); - else if(!strcmp(varname,"server_port")){ - server_port=atoi(varvalue); - if(server_port<1024){ - syslog(LOG_ERR,"Invalid port number specified in config file '%s' - Line %d\n",filename,line); + } else if (!strcmp(varname, "server_port")) { + server_port = atoi(varvalue); + if (server_port < 1024) { + syslog(LOG_ERR, + "Invalid port number specified in config file '%s' - Line %d\n", + filename, line); return ERROR; - } - } - else if(!strcmp(varname,"command_prefix")) - command_prefix=strdup(varvalue); - - else if(!strcmp(varname,"server_address")){ - strncpy(server_address,varvalue,sizeof(server_address) - 1); - server_address[sizeof(server_address)-1]='\0'; - } - else if(!strcmp(varname,"allowed_hosts")) { - allowed_hosts=strdup(varvalue); - parse_allowed_hosts(allowed_hosts); - } - else if(strstr(input_line,"command[")){ - temp_buffer=strtok(varname,"["); - temp_buffer=strtok(NULL,"]"); - if(temp_buffer==NULL){ - syslog(LOG_ERR,"Invalid command specified in config file '%s' - Line %d\n",filename,line); - return ERROR; - } - add_command(temp_buffer,varvalue); - } - - else if(strstr(input_buffer,"debug")){ - debug=atoi(varvalue); - if(debug>0) - debug=TRUE; - else - debug=FALSE; - } - - else if(!strcmp(varname,"nrpe_user")) - nrpe_user=strdup(varvalue); - - else if(!strcmp(varname,"nrpe_group")) - nrpe_group=strdup(varvalue); - - else if(!strcmp(varname,"dont_blame_nrpe")) - allow_arguments=(atoi(varvalue)==1)?TRUE:FALSE; - - else if(!strcmp(varname,"allow_bash_command_substitution")) - allow_bash_command_substitution=(atoi(varvalue)==1)?TRUE:FALSE; - - else if(!strcmp(varname,"command_timeout")){ - command_timeout=atoi(varvalue); - if(command_timeout<1){ - syslog(LOG_ERR,"Invalid command_timeout specified in config file '%s' - Line %d\n",filename,line); - return ERROR; - } - } - - else if(!strcmp(varname,"connection_timeout")){ - connection_timeout=atoi(varvalue); - if(connection_timeout<1){ - syslog(LOG_ERR,"Invalid connection_timeout specified in config file '%s' - Line %d\n",filename,line); - return ERROR; - } - } - - else if(!strcmp(varname,"allow_weak_random_seed")) - allow_weak_random_seed=(atoi(varvalue)==1)?TRUE:FALSE; - - else if(!strcmp(varname,"pid_file")) - pid_file=strdup(varvalue); - - else if(!strcmp(varname,"log_facility")){ - if((get_log_facility(varvalue))==OK){ - /* re-open log using new facility */ - closelog(); - openlog("nrpe",LOG_PID,log_facility); - } - else - syslog(LOG_WARNING,"Invalid log_facility specified in config file '%s' - Line %d\n",filename,line); } - else{ - syslog(LOG_WARNING,"Unknown option specified in config file '%s' - Line %d\n",filename,line); + } else if (!strcmp(varname, "command_prefix")) + command_prefix = strdup(varvalue); + + else if (!strcmp(varname, "server_address")) { + strncpy(server_address, varvalue, sizeof(server_address) - 1); + server_address[sizeof(server_address) - 1] = '\0'; + + } else if (!strcmp(varname, "allowed_hosts")) { + allowed_hosts = strdup(varvalue); + parse_allowed_hosts(allowed_hosts); + + } else if (strstr(input_line, "command[")) { + temp_buffer = strtok(varname, "["); + temp_buffer = strtok(NULL, "]"); + if (temp_buffer == NULL) { + syslog(LOG_ERR, "Invalid command specified in config file '%s' - Line %d\n", + filename, line); + return ERROR; + } + add_command(temp_buffer, varvalue); + + } else if (strstr(input_buffer, "debug")) { + debug = atoi(varvalue); + if (debug > 0) + debug = TRUE; + else + debug = FALSE; + + } else if (!strcmp(varname, "nrpe_user")) + nrpe_user = strdup(varvalue); + + else if (!strcmp(varname, "nrpe_group")) + nrpe_group = strdup(varvalue); + + else if (!strcmp(varname, "dont_blame_nrpe")) + allow_arguments = (atoi(varvalue) == 1) ? TRUE : FALSE; + + else if (!strcmp(varname, "allow_bash_command_substitution")) + allow_bash_cmd_subst = (atoi(varvalue) == 1) ? TRUE : FALSE; + + else if (!strcmp(varname, "command_timeout")) { + command_timeout = atoi(varvalue); + if (command_timeout < 1) { + syslog(LOG_ERR, + "Invalid command_timeout specified in config file '%s' - Line %d\n", + filename, line); + return ERROR; + } + } else if (!strcmp(varname, "connection_timeout")) { + connection_timeout = atoi(varvalue); + if (connection_timeout < 1) { + syslog(LOG_ERR, + "Invalid connection_timeout specified in config file '%s' - Line %d\n", + filename, line); + return ERROR; + } + + } else if (!strcmp(varname, "ssl_shutdown_timeout")) { + ssl_shutdown_timeout = atoi(varvalue); + if (ssl_shutdown_timeout < 1) { + syslog(LOG_ERR, + "Invalid ssl_shutdown_timeout specified in config file '%s' - Line %d\n", + filename, line); + return ERROR; + } + + } else if (!strcmp(varname, "allow_weak_random_seed")) + allow_weak_random_seed = (atoi(varvalue) == 1) ? TRUE : FALSE; + + else if (!strcmp(varname, "pid_file")) + pid_file = strdup(varvalue); + + else if (!strcmp(varname, "listen_queue_size")) { + listen_queue_size = atoi(varvalue); + if (listen_queue_size == 0) { + syslog(LOG_ERR, + "Invalid listen queue size specified in config file '%s' - Line %d\n", + filename, line); + return ERROR; + } + + } else if (!strcmp(varname, "ssl_version")) { + if (!strcmp(varvalue, "SSLv2")) + sslprm.ssl_min_ver = SSLv2; + else if (!strcmp(varvalue, "SSLv2+")) + sslprm.ssl_min_ver = SSLv2_plus; + else if (!strcmp(varvalue, "SSLv3")) + sslprm.ssl_min_ver = SSLv3; + else if (!strcmp(varvalue, "SSLv3+")) + sslprm.ssl_min_ver = SSLv3_plus; + else if (!strcmp(varvalue, "TLSv1")) + sslprm.ssl_min_ver = TLSv1; + else if (!strcmp(varvalue, "TLSv1+")) + sslprm.ssl_min_ver = TLSv1_plus; + else if (!strcmp(varvalue, "TLSv1.1")) + sslprm.ssl_min_ver = TLSv1_1; + else if (!strcmp(varvalue, "TLSv1.1+")) + sslprm.ssl_min_ver = TLSv1_1_plus; + else if (!strcmp(varvalue, "TLSv1.2")) + sslprm.ssl_min_ver = TLSv1_2; + else if (!strcmp(varvalue, "TLSv1.2+")) + sslprm.ssl_min_ver = TLSv1_2_plus; + else { + syslog(LOG_ERR, "Invalid ssl version specified in config file '%s' - Line %d", + filename, line); + return ERROR; + } + + } else if (!strcmp(varname, "ssl_use_adh")) { + sslprm.allowDH = atoi(varvalue); + if (sslprm.allowDH < 0 || sslprm.allowDH > 2) { + syslog(LOG_ERR, + "Invalid use adh value specified in config file '%s' - Line %d", + filename, line); + return ERROR; + } + + } else if (!strcmp(varname, "ssl_logging")) + sslprm.log_opts = strtoul(varvalue, NULL, 0); + + else if (!strcmp(varname, "ssl_cipher_list")) { + strncpy(sslprm.cipher_list, varvalue, sizeof(sslprm.cipher_list) - 1); + sslprm.cipher_list[sizeof(sslprm.cipher_list) - 1] = '\0'; + + } else if (!strcmp(varname, "ssl_cert_file")) + sslprm.cert_file = strdup(varvalue); + + else if (!strcmp(varname, "ssl_cacert_file")) + sslprm.cacert_file = strdup(varvalue); + + else if (!strcmp(varname, "ssl_privatekey_file")) + sslprm.privatekey_file = strdup(varvalue); + + else if (!strcmp(varname, "ssl_client_certs")) { + sslprm.client_certs = atoi(varvalue); + if ((int)sslprm.client_certs < 0 || sslprm.client_certs > Require_Cert) { + syslog(LOG_ERR, + "Invalid client certs value specified in config file '%s' - Line %d", + filename, line); + return ERROR; + } + /* if requiring or logging client certs, make sure "Ask" is turned on */ + if (sslprm.client_certs & Require_Cert) + sslprm.client_certs |= Ask_For_Cert; + + } else if (!strcmp(varname, "log_facility")) { + if ((get_log_facility(varvalue)) == OK) { + /* re-open log using new facility */ + closelog(); + openlog("nrpe", LOG_PID, log_facility); + } else + syslog(LOG_WARNING, + "Invalid log_facility specified in config file '%s' - Line %d\n", + filename, line); + + } else if (!strcmp(varname, "keep_env_vars")) + keep_env_vars = strdup(varvalue); + + else { + syslog(LOG_WARNING, "Unknown option specified in config file '%s' - Line %d\n", + filename, line); continue; - } - - } - - - /* close the config file */ - fclose(fp); - - return OK; + } } + fclose(fp); /* close the config file */ + return OK; +} /* process all config files in a specific config directory (with directory recursion) */ -int read_config_dir(char *dirname){ - char config_file[MAX_FILENAME_LENGTH]; - DIR *dirp; +int read_config_dir(char *dirname) +{ struct dirent *dirfile; struct stat buf; - int result=OK; - int x; + char config_file[MAX_FILENAME_LENGTH]; + DIR *dirp; + int result = OK; + int x; /* open the directory for reading */ - dirp=opendir(dirname); - if(dirp==NULL){ - syslog(LOG_ERR,"Could not open config directory '%s' for reading.\n",dirname); + dirp = opendir(dirname); + if (dirp == NULL) { + syslog(LOG_ERR, "Could not open config directory '%s' for reading.\n", dirname); return ERROR; - } + } /* process all files in the directory... */ - while((dirfile=readdir(dirp))!=NULL){ + while ((dirfile = readdir(dirp)) != NULL) { /* create the full path to the config file or subdirectory */ - snprintf(config_file,sizeof(config_file)-1,"%s/%s",dirname,dirfile->d_name); - config_file[sizeof(config_file)-1]='\x0'; + snprintf(config_file, sizeof(config_file) - 1, "%s/%s", dirname, dirfile->d_name); + config_file[sizeof(config_file) - 1] = '\x0'; stat(config_file, &buf); /* process this if it's a config file... */ - x=strlen(dirfile->d_name); - if(x>4 && !strcmp(dirfile->d_name+(x-4),".cfg")){ + x = strlen(dirfile->d_name); + if (x > 4 && !strcmp(dirfile->d_name + (x - 4), ".cfg")) { /* only process normal files */ - if(!S_ISREG(buf.st_mode)) + if (!S_ISREG(buf.st_mode)) continue; /* process the config file */ - result=read_config_file(config_file); + result = read_config_file(config_file); /* break out if we encountered an error */ - if(result==ERROR) + if (result == ERROR) break; - } + } /* recurse into subdirectories... */ - if(S_ISDIR(buf.st_mode)){ + if (S_ISDIR(buf.st_mode)) { /* ignore current, parent and hidden directory entries */ - if(dirfile->d_name[0]=='.') + if (dirfile->d_name[0] == '.') continue; /* process the config directory */ - result=read_config_dir(config_file); + result = read_config_dir(config_file); /* break out if we encountered an error */ - if(result==ERROR) + if (result == ERROR) break; - } } - - closedir(dirp); - - return result; - } - - - -/* determines facility to use with syslog */ -int get_log_facility(char *varvalue){ - - if(!strcmp(varvalue,"kern")) - log_facility=LOG_KERN; - else if(!strcmp(varvalue,"user")) - log_facility=LOG_USER; - else if(!strcmp(varvalue,"mail")) - log_facility=LOG_MAIL; - else if(!strcmp(varvalue,"daemon")) - log_facility=LOG_DAEMON; - else if(!strcmp(varvalue,"auth")) - log_facility=LOG_AUTH; - else if(!strcmp(varvalue,"syslog")) - log_facility=LOG_SYSLOG; - else if(!strcmp(varvalue,"lrp")) - log_facility=LOG_LPR; - else if(!strcmp(varvalue,"news")) - log_facility=LOG_NEWS; - else if(!strcmp(varvalue,"uucp")) - log_facility=LOG_UUCP; - else if(!strcmp(varvalue,"cron")) - log_facility=LOG_CRON; - else if(!strcmp(varvalue,"authpriv")) - log_facility=LOG_AUTHPRIV; - else if(!strcmp(varvalue,"ftp")) - log_facility=LOG_FTP; - else if(!strcmp(varvalue,"local0")) - log_facility=LOG_LOCAL0; - else if(!strcmp(varvalue,"local1")) - log_facility=LOG_LOCAL1; - else if(!strcmp(varvalue,"local2")) - log_facility=LOG_LOCAL2; - else if(!strcmp(varvalue,"local3")) - log_facility=LOG_LOCAL3; - else if(!strcmp(varvalue,"local4")) - log_facility=LOG_LOCAL4; - else if(!strcmp(varvalue,"local5")) - log_facility=LOG_LOCAL5; - else if(!strcmp(varvalue,"local6")) - log_facility=LOG_LOCAL6; - else if(!strcmp(varvalue,"local7")) - log_facility=LOG_LOCAL7; - else{ - log_facility=LOG_DAEMON; - return ERROR; - } - - return OK; } + closedir(dirp); + return result; +} +/* determines facility to use with syslog */ +int get_log_facility(char *varvalue) +{ + if (!strcmp(varvalue, "kern")) + log_facility = LOG_KERN; + else if (!strcmp(varvalue, "user")) + log_facility = LOG_USER; + else if (!strcmp(varvalue, "mail")) + log_facility = LOG_MAIL; + else if (!strcmp(varvalue, "daemon")) + log_facility = LOG_DAEMON; + else if (!strcmp(varvalue, "auth")) + log_facility = LOG_AUTH; + else if (!strcmp(varvalue, "syslog")) + log_facility = LOG_SYSLOG; + else if (!strcmp(varvalue, "lrp")) + log_facility = LOG_LPR; + else if (!strcmp(varvalue, "news")) + log_facility = LOG_NEWS; + else if (!strcmp(varvalue, "uucp")) + log_facility = LOG_UUCP; + else if (!strcmp(varvalue, "cron")) + log_facility = LOG_CRON; + else if (!strcmp(varvalue, "authpriv")) + log_facility = LOG_AUTHPRIV; + else if (!strcmp(varvalue, "ftp")) + log_facility = LOG_FTP; + else if (!strcmp(varvalue, "local0")) + log_facility = LOG_LOCAL0; + else if (!strcmp(varvalue, "local1")) + log_facility = LOG_LOCAL1; + else if (!strcmp(varvalue, "local2")) + log_facility = LOG_LOCAL2; + else if (!strcmp(varvalue, "local3")) + log_facility = LOG_LOCAL3; + else if (!strcmp(varvalue, "local4")) + log_facility = LOG_LOCAL4; + else if (!strcmp(varvalue, "local5")) + log_facility = LOG_LOCAL5; + else if (!strcmp(varvalue, "local6")) + log_facility = LOG_LOCAL6; + else if (!strcmp(varvalue, "local7")) + log_facility = LOG_LOCAL7; + else { + log_facility = LOG_DAEMON; + return ERROR; + } + + return OK; +} /* adds a new command definition from the config file to the list in memory */ -int add_command(char *command_name, char *command_line){ - command *new_command; +int add_command(char *command_name, char *command_line) +{ + command *new_command; - if(command_name==NULL || command_line==NULL) + if (command_name == NULL || command_line == NULL) return ERROR; /* allocate memory for the new command */ - new_command=(command *)malloc(sizeof(command)); - if(new_command==NULL) + new_command = (command *) malloc(sizeof(command)); + if (new_command == NULL) return ERROR; - new_command->command_name=strdup(command_name); - if(new_command->command_name==NULL){ + new_command->command_name = strdup(command_name); + if (new_command->command_name == NULL) { free(new_command); return ERROR; - } - new_command->command_line=strdup(command_line); - if(new_command->command_line==NULL){ + } + new_command->command_line = strdup(command_line); + if (new_command->command_line == NULL) { free(new_command->command_name); free(new_command); return ERROR; - } + } /* add new command to head of list in memory */ - new_command->next=command_list; - command_list=new_command; + new_command->next = command_list; + command_list = new_command; - if(debug==TRUE) - syslog(LOG_DEBUG,"Added command[%s]=%s\n",command_name,command_line); + if (debug == TRUE) + syslog(LOG_DEBUG, "Added command[%s]=%s\n", command_name, command_line); return OK; - } - - +} /* given a command name, find the structure in memory */ -command *find_command(char *command_name){ - command *temp_command; +command *find_command(char *command_name) +{ + command *temp_command; - for(temp_command=command_list;temp_command!=NULL;temp_command=temp_command->next) - if(!strcmp(command_name,temp_command->command_name)) + for (temp_command = command_list; temp_command != NULL; temp_command = temp_command->next) + if (!strcmp(command_name, temp_command->command_name)) return temp_command; return NULL; - } - - -/* - * Close all listening sockets - */ -static void close_listen_socks(void) { - int i; - - for (i = 0; i <= num_listen_socks; i++) { - close(listen_socks[i]); - num_listen_socks--; - } - } +} /* Start listen on a particular port */ -void create_listener(struct addrinfo *ai) { +void create_listener(struct addrinfo *ai) +{ + int ret; + char ntop[NI_MAXHOST], strport[NI_MAXSERV]; + int listen_sock; + int flag = 1; - int ret; - char ntop[NI_MAXHOST], strport[NI_MAXSERV]; - int listen_sock; - int flag=1; + if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) + return; - if(ai->ai_family != AF_INET && ai->ai_family != AF_INET6) return; - - if(num_listen_socks >= MAX_LISTEN_SOCKS) { + if (num_listen_socks >= MAX_LISTEN_SOCKS) { syslog(LOG_ERR, "Too many listen sockets. Enlarge MAX_LISTEN_SOCKS"); exit(1); - } + } - if((ret = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), - strport, sizeof(strport), NI_NUMERICHOST|NI_NUMERICSERV)) != 0) { + if ((ret = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), + strport, sizeof(strport), NI_NUMERICHOST | NI_NUMERICSERV)) != 0) { syslog(LOG_ERR, "getnameinfo failed: %.100s", gai_strerror(ret)); return; - } + } /* Create socket for listening. */ listen_sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); @@ -826,1265 +1070,1535 @@ void create_listener(struct addrinfo *ai) { /* kernel may not support ipv6 */ syslog(LOG_ERR, "socket: %.100s", strerror(errno)); return; - } + } /* socket should be non-blocking */ - fcntl(listen_sock,F_SETFL,O_NONBLOCK); + fcntl(listen_sock, F_SETFL, O_NONBLOCK); - /* set the reuse address flag so we don't get errors when - restarting */ - if(setsockopt(listen_sock, SOL_SOCKET,SO_REUSEADDR, &flag, - sizeof(flag)) < 0) { + /* set the reuse address flag so we don't get errors when restarting */ + if (setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag)) < 0) { syslog(LOG_ERR, "setsockopt SO_REUSEADDR: %s", strerror(errno)); return; - } - + } #ifdef IPV6_V6ONLY /* Only communicate in IPv6 over AF_INET6 sockets. */ if (ai->ai_family == AF_INET6) { - if (setsockopt(listen_sock, IPPROTO_IPV6, IPV6_V6ONLY, &flag, - sizeof(flag)) == -1) { + if (setsockopt(listen_sock, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag)) == -1) { fprintf(stderr, "setsockopt IPV6_V6ONLY: %s", strerror(errno)); - } } + } #endif /* Bind the socket to the desired port. */ if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) { - syslog(LOG_ERR, "Bind to port %s on %s failed: %.200s.", strport, - ntop, strerror(errno)); close(listen_sock); + syslog(LOG_ERR, "Bind to port %s on %s failed: %.200s.", + strport, ntop, strerror(errno)); + close(listen_sock); return; - } + } listen_socks[num_listen_socks] = listen_sock; num_listen_socks++; /* Start listening on the port. */ - if (listen(listen_sock, 5) < 0) { - syslog(LOG_ERR, "listen on [%s]:%s: %.100s", ntop, strport, - strerror(errno)); + if (listen(listen_sock, listen_queue_size) < 0) { + syslog(LOG_ERR, "listen on [%s]:%s: %.100s", ntop, strport, strerror(errno)); exit(1); - } - - syslog(LOG_INFO, "Server listening on %s port %s.", ntop, strport); } + syslog(LOG_INFO, "Server listening on %s port %s.", ntop, strport); +} + +/* Close all listening sockets */ +static void close_listen_socks(void) +{ + int i; + + for (i = 0; i <= num_listen_socks; i++) { + close(listen_socks[i]); + num_listen_socks--; + } +} + /* wait for incoming connection requests */ -void wait_for_connections(void){ - struct addrinfo *ai; - fd_set *fdset=NULL; - int maxfd=0; +void wait_for_connections(void) +{ +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE struct sockaddr_storage from; +#else + struct sockaddr from; +#endif socklen_t fromlen; - char ipstr[INET6_ADDRSTRLEN]; - int i; - int r; + fd_set *fdset = NULL; + int maxfd = 0, new_sd = 0, i, rc, retval; - struct sockaddr_in myname; - struct sockaddr_in *nptr; - struct sockaddr_in6 *nptr6; - struct sockaddr_storage addr; - int rc; - int sock, new_sd; - socklen_t addrlen; - pid_t pid; - fd_set fdread; - struct timeval timeout; - int retval; -#ifdef HAVE_LIBWRAP - struct request_info req; -#endif - - add_listen_addr(&listen_addrs, address_family, - (strcmp(server_address, "") == 0) ? NULL : server_address, - server_port); - - for(ai = listen_addrs; ai; ai = ai->ai_next) { - create_listener(ai); - } - - if (!num_listen_socks) { - syslog(LOG_ERR, "Cannot bind to any address."); - exit(1); - } - - /* log warning about command arguments */ -#ifdef ENABLE_COMMAND_ARGUMENTS - if(allow_arguments==TRUE) - syslog(LOG_NOTICE,"Warning: Daemon is configured to accept command arguments from clients!"); -#ifdef ENABLE_BASH_COMMAND_SUBSTITUTION - if(TRUE==allow_bash_command_substitution) { - if(TRUE==allow_arguments) - syslog(LOG_NOTICE,"Warning: Daemon is configured to accept command arguments with bash command substitutions!"); - else - syslog(LOG_NOTICE,"Warning: Daemon is configured to accept command arguments with bash command substitutions, but is not configured to accept command argements from clients. Enable command arguments if you wish to allow command arguments with bash command substitutions."); - } -#endif -#endif - - syslog(LOG_INFO,"Listening for connections on port %d\n",htons(myname.sin_port)); - - if(allowed_hosts) - syslog(LOG_INFO,"Allowing connections from: %s\n",allowed_hosts); + setup_wait_conn(); /* listen for connection requests - fork() if we get one */ - while(1){ - + while (1) { /* bail out if necessary */ - if(sigrestart==TRUE || sigshutdown==TRUE) break; - - for(i = 0; i < num_listen_socks; i++) { - if (listen_socks[i] > maxfd) maxfd = listen_socks[i]; - } - - if(fdset != NULL) free(fdset); - fdset = (fd_set *)calloc(howmany(maxfd + 1, NFDBITS), sizeof(fd_mask)); - - for (i = 0; i < num_listen_socks; i++) FD_SET(listen_socks[i], fdset); - - /* Wait in select until there is a connection. */ - retval = select(maxfd+1, fdset, NULL, NULL, NULL); - - /* bail out if necessary */ - if(sigrestart==TRUE || sigshutdown==TRUE) break; - - /* error */ - if(retval<0) continue; + if (sigrestart == TRUE || sigshutdown == TRUE) + break; for (i = 0; i < num_listen_socks; i++) { - if (!FD_ISSET(listen_socks[i], fdset)) continue; - fromlen = sizeof(from); + if (listen_socks[i] > maxfd) + maxfd = listen_socks[i]; + } + + if (fdset != NULL) + free(fdset); + fdset = (fd_set *) calloc(how_many(maxfd + 1, NFDBITS), sizeof(fd_mask)); + + for (i = 0; i < num_listen_socks; i++) + FD_SET(listen_socks[i], fdset); + + /* Wait in select until there is a connection. */ + retval = select(maxfd + 1, fdset, NULL, NULL, NULL); + + /* bail out if necessary */ + if (sigrestart == TRUE || sigshutdown == TRUE) + break; + + /* error */ + if (retval < 0) + continue; + + for (i = 0; i < num_listen_socks; i++) { + if (!FD_ISSET(listen_socks[i], fdset)) + continue; + fromlen = (socklen_t)sizeof(from); /* accept a new connection request */ new_sd = accept(listen_socks[i], (struct sockaddr *)&from, &fromlen); /* some kind of error occurred... */ - if(new_sd<0){ - + if (new_sd < 0) { /* bail out if necessary */ - if(sigrestart==TRUE || sigshutdown==TRUE) + if (sigrestart == TRUE || sigshutdown == TRUE) break; - - /* retry */ - if(errno==EWOULDBLOCK || errno==EINTR) + if (errno == EWOULDBLOCK || errno == EINTR) /* retry */ continue; - /* socket is nonblocking and we don't have a connection yet */ - if(errno==EAGAIN) + if (errno == EAGAIN) + continue; + if (errno == ENOBUFS) /* fix for HP-UX 11.0 - just retry */ continue; - /* fix for HP-UX 11.0 - just retry */ - if(errno==ENOBUFS) - continue; + break; /* else handle the error later */ + } - /* else handle the error later */ - break; - } - /* child process should handle the connection */ - pid=fork(); - if(pid==0) { + rc = wait_conn_fork(new_sd); + if (rc == TRUE) + continue; /* Continue if this is the parent returning */ - /* fork again so we don't create zombies */ - pid=fork(); - if(pid==0) { + /* grandchild running here */ + conn_check_peer(new_sd); - /* hey, there was an error... */ - if(new_sd<0) { + /* handle the client connection */ + handle_connection(new_sd); - /* log error to syslog facility */ - syslog(LOG_ERR, "Network server accept failure (%d: %s)", - errno, strerror(errno)); + /* log info to syslog facility */ + if (debug == TRUE) + syslog(LOG_DEBUG, "Connection from %s closed.", remote_host); - /* close socket prioer to exiting */ - close(sock); - - return; - } + /* close socket prior to exiting */ + close(new_sd); - /* handle signals */ - signal(SIGQUIT,child_sighandler); - signal(SIGTERM,child_sighandler); - signal(SIGHUP,child_sighandler); + exit(STATE_OK); - /* grandchild does not need to listen for connections */ - close_listen_socks(); - - /* find out who just connected... */ - addrlen=sizeof(addr); - rc=getpeername(new_sd, (struct sockaddr *)&addr, &addrlen); - - if(rc<0) { - - /* log error to syslog facility */ - syslog(LOG_ERR, "Error: Network server getpeername() failure (%d: %s)", - errno, strerror(errno)); - - /* close socket prior to exiting */ - close(new_sd); - - return; - } - - /* is this is a blessed machine? */ - if(allowed_hosts) { - switch(addr.ss_family) { - case AF_INET: - nptr = (struct sockaddr_in *)&addr; - - /* log info to syslog facility */ - if(debug==TRUE) { - syslog(LOG_DEBUG, "Connection from %s port %d", - inet_ntoa(nptr->sin_addr), - nptr->sin_port); - } - if(!is_an_allowed_host(AF_INET, - (void *)&(nptr->sin_addr))) { - /* log error to syslog facility */ - syslog(LOG_ERR, - "Host %s is not allowed to talk to us!", - inet_ntoa(nptr->sin_addr)); - - /* log info to syslog facility */ - if ( debug==TRUE ) { - syslog(LOG_DEBUG, - "Connection from %s closed.", - inet_ntoa(nptr->sin_addr)); - } - - /* close socket prior to exiting */ - close(new_sd); - exit(STATE_OK); - } - else { - /* log info to syslog facility */ - if(debug==TRUE) { - syslog(LOG_DEBUG, - "Host address is in allowed_hosts"); - } - - } - break; - case AF_INET6: - nptr6 = (struct sockaddr_in6 *)&addr; - if(inet_ntop(AF_INET6, - (const void *)&(nptr6->sin6_addr), ipstr, - sizeof(ipstr)) == NULL) { - strncpy(ipstr, "Unknown", sizeof(ipstr)); - } - - /* log info to syslog facility */ - if(debug==TRUE) { - syslog(LOG_DEBUG, "Connection from %s port %d", - ipstr, nptr6->sin6_port); - } - if(!is_an_allowed_host(AF_INET6, - (void *)&(nptr6->sin6_addr))) { - /* log error to syslog facility */ - syslog(LOG_ERR, - "Host %s is not allowed to talk to us!", - ipstr); - - /* log info to syslog facility */ - if ( debug==TRUE ) { - syslog(LOG_DEBUG, - "Connection from %s closed.", - ipstr); - } - - /* close socket prior to exiting */ - close(new_sd); - exit(STATE_OK); - } - else { - /* log info to syslog facility */ - if(debug==TRUE) { - syslog(LOG_DEBUG, - "Host address is in allowed_hosts"); - } - - } - break; - } - } - -#ifdef HAVE_LIBWRAP - /* Check whether or not connections are allowed from this host */ - request_init(&req,RQ_DAEMON,"nrpe",RQ_FILE,new_sd,0); - fromhost(&req); - - if(!hosts_access(&req)){ - - syslog(LOG_DEBUG,"Connection refused by TCP wrapper"); - - /* refuse the connection */ - refuse(&req); - close(new_sd); - - /* should not be reached */ - syslog(LOG_ERR,"libwrap refuse() returns!"); - exit(STATE_CRITICAL); - } -#endif - - /* handle the client connection */ - handle_connection(new_sd); - - /* log info to syslog facility */ - if(debug==TRUE) { - syslog(LOG_DEBUG,"Connection from %s closed.",ipstr); - } - - /* close socket prior to exiting */ - close(new_sd); - - exit(STATE_OK); - } - - /* first child returns immediately, grandchild is inherited by - INIT process -> no zombies... */ - else - exit(STATE_OK); - } - - /* parent ... */ - else { - /* parent doesn't need the new connection */ - close(new_sd); - - /* parent waits for first child to exit */ - waitpid(pid,NULL,0); - } - } } + } /* close the sockets we're listening on */ close_listen_socks(); freeaddrinfo(listen_addrs); - listen_addrs=NULL; + listen_addrs = NULL; return; +} + +void setup_wait_conn(void) +{ + struct addrinfo *ai; + + add_listen_addr(&listen_addrs, address_family, + (strcmp(server_address, "") == 0) ? NULL : server_address, server_port); + + for (ai = listen_addrs; ai; ai = ai->ai_next) + create_listener(ai); + + if (!num_listen_socks) { + syslog(LOG_ERR, "Cannot bind to any address."); + exit(1); + } + + /* log warning about command arguments */ +#ifdef ENABLE_COMMAND_ARGUMENTS + if (allow_arguments == TRUE) + syslog(LOG_NOTICE, + "Warning: Daemon is configured to accept command arguments from clients!"); +# ifdef ENABLE_BASH_COMMAND_SUBSTITUTION + if (TRUE == allow_bash_cmd_subst) { + if (TRUE == allow_arguments) + syslog(LOG_NOTICE, + "Warning: Daemon is configured to accept command arguments with bash command substitutions!"); + else + syslog(LOG_NOTICE, + "Warning: Daemon is configured to accept command arguments with bash command substitutions, but is not configured to accept command argements from clients. Enable command arguments if you wish to allow command arguments with bash command substitutions."); + } +# endif +#endif + + syslog(LOG_INFO, "Listening for connections on port %d", server_port); + + if (allowed_hosts) + syslog(LOG_INFO, "Allowing connections from: %s\n", allowed_hosts); +} + +int wait_conn_fork(int sock) +{ +#ifdef HAVE_SIGACTION + struct sigaction sig_action; +#endif + pid_t pid; + + /* child process should handle the connection */ + pid = fork(); + + if (pid > 0) { + close(sock); /* parent doesn't need the new connection */ + waitpid(pid, NULL, 0); /* parent waits for first child to exit */ + return TRUE; /* tell caller this is the parent process */ + } + + if (pid < 0) { + syslog(LOG_ERR, "fork() failed with error %d, bailing out...", errno); + exit(STATE_CRITICAL); + } + + /* fork again so we don't create zombies */ + pid = fork(); + + if (pid < 0) { + syslog(LOG_ERR, "fork() failed with error %d, bailing out...", errno); + exit(STATE_CRITICAL); + } + + if (pid > 0) { + /* first child returns immediately, grandchild is inherited by + INIT process -> no zombies... */ + exit(STATE_OK); + } + + /* hey, there was an error... */ + if (sock < 0) { + /* log error to syslog facility */ + syslog(LOG_ERR, "Network server accept failure (%d: %s)", + errno, strerror(errno)); + exit(STATE_OK); + } + + /* all good - handle signals */ +#ifdef HAVE_SIGACTION + sig_action.sa_sigaction = NULL; + sig_action.sa_handler = child_sighandler; + sigfillset(&sig_action.sa_mask); + sig_action.sa_flags = SA_NODEFER | SA_RESTART; + sigaction(SIGQUIT, &sig_action, NULL); + sigaction(SIGTERM, &sig_action, NULL); + sigaction(SIGHUP, &sig_action, NULL); +#else /* HAVE_SIGACTION */ + signal(SIGQUIT, child_sighandler); + signal(SIGTERM, child_sighandler); + signal(SIGHUP, child_sighandler); +#endif /* HAVE_SIGACTION */ + + close_listen_socks(); /* grandchild does not need to listen */ + + return FALSE; /* tell caller this isn't the parent process */ +} + +void conn_check_peer(int sock) +{ +#ifdef HAVE_LIBWRAP + struct request_info req; +#endif +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + struct sockaddr_storage addr; +#else + struct sockaddr addr; +#endif + struct sockaddr_in *nptr; + struct sockaddr_in6 *nptr6; + + char ipstr[INET6_ADDRSTRLEN]; + socklen_t addrlen; + int rc; + + /* find out who just connected... */ + addrlen = sizeof(addr); + rc = getpeername(sock, (struct sockaddr *)&addr, &addrlen); + + if (rc < 0) { + /* log error to syslog facility */ + syslog(LOG_ERR, "Error: Network server getpeername() failure (%d: %s)", + errno, strerror(errno)); + + /* close socket prior to exiting */ + close(sock); + return; + } + +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + switch (addr.ss_family) { +#else + switch (addr.sa_family) { +#endif + + case AF_INET: + nptr = (struct sockaddr_in *)&addr; + strncpy(remote_host, inet_ntoa(nptr->sin_addr), sizeof(remote_host) - 1); + remote_host[MAX_HOST_ADDRESS_LENGTH - 1] = '\0'; + break; + + case AF_INET6: + nptr6 = (struct sockaddr_in6 *)&addr; + if (inet_ntop(AF_INET6, (const void *)&(nptr6->sin6_addr), + ipstr, sizeof(ipstr)) == NULL) { + strncpy(ipstr, "Unknown", sizeof(ipstr)); + } + strncpy(remote_host, ipstr, sizeof(remote_host) - 1); + remote_host[MAX_HOST_ADDRESS_LENGTH - 1] = '\0'; + break; } -/* handles a client connection */ -void handle_connection(int sock){ - u_int32_t calculated_crc32; - command *temp_command; - packet receive_packet; - packet send_packet; - int bytes_to_send; - int bytes_to_recv; - char buffer[MAX_INPUT_BUFFER]; - char raw_command[MAX_INPUT_BUFFER]; - char processed_command[MAX_INPUT_BUFFER]; - int result=STATE_OK; - int early_timeout=FALSE; - int rc; - int x; -#ifdef DEBUG - FILE *errfp; -#endif -#ifdef HAVE_SSL - SSL *ssl=NULL; + /* is this is a blessed machine? */ + if (allowed_hosts) { +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + switch (addr.ss_family) { +#else + switch (addr.sa_family) { #endif + case AF_INET: + /* log info to syslog facility */ + if (debug == TRUE || (sslprm.log_opts & SSL_LogIpAddr)) + syslog(LOG_DEBUG, "Connection from %s port %d", remote_host, nptr->sin_port); - /* log info to syslog facility */ - if(debug==TRUE) - syslog(LOG_DEBUG,"Handling the connection..."); + if (!is_an_allowed_host(AF_INET, (void *)&(nptr->sin_addr))) { + /* log error to syslog facility */ + syslog(LOG_ERR, "Host %s is not allowed to talk to us!", remote_host); -#ifdef OLDSTUFF - /* socket should be non-blocking */ - fcntl(sock,F_SETFL,O_NONBLOCK); -#endif + /* log info to syslog facility */ + if (debug == TRUE) + syslog(LOG_DEBUG, "Connection from %s closed.", remote_host); - /* set connection handler */ - signal(SIGALRM,my_connection_sighandler); - alarm(connection_timeout); + /* close socket prior to exiting */ + close(sock); + exit(STATE_OK); -#ifdef HAVE_SSL - /* do SSL handshake */ - if(result==STATE_OK && use_ssl==TRUE){ - if((ssl=SSL_new(ctx))!=NULL){ - SSL_set_fd(ssl,sock); + } else { - /* keep attempting the request if needed */ - while(((rc=SSL_accept(ssl))!=1) && (SSL_get_error(ssl,rc)==SSL_ERROR_WANT_READ)); + /* log info to syslog facility */ + if (debug == TRUE) { + syslog(LOG_DEBUG, "Host address is in allowed_hosts"); + } - if(rc!=1){ - syslog(LOG_ERR,"Error: Could not complete SSL handshake. %d\n",SSL_get_error(ssl,rc)); -#ifdef DEBUG - errfp=fopen("/tmp/err.log","w"); - ERR_print_errors_fp(errfp); - fclose(errfp); -#endif - return; - } - } - else{ - syslog(LOG_ERR,"Error: Could not create SSL connection structure.\n"); -#ifdef DEBUG - errfp=fopen("/tmp/err.log","w"); - ERR_print_errors_fp(errfp); - fclose(errfp); -#endif - return; - } - } -#endif + } + break; - bytes_to_recv=sizeof(receive_packet); - if(use_ssl==FALSE) - rc=recvall(sock,(char *)&receive_packet,&bytes_to_recv,socket_timeout); -#ifdef HAVE_SSL - else{ - while(((rc=SSL_read(ssl,&receive_packet,bytes_to_recv))<=0) && (SSL_get_error(ssl,rc)==SSL_ERROR_WANT_READ)); + case AF_INET6: + /* log info to syslog facility */ + strcpy(remote_host, ipstr); + if (debug == TRUE || (sslprm.log_opts & SSL_LogIpAddr)) { + syslog(LOG_DEBUG, "Connection from %s port %d", ipstr, nptr6->sin6_port); + } + + if (!is_an_allowed_host(AF_INET6, (void *)&(nptr6->sin6_addr))) { + /* log error to syslog facility */ + syslog(LOG_ERR, "Host %s is not allowed to talk to us!", ipstr); + + /* log info to syslog facility */ + if (debug == TRUE) + syslog(LOG_DEBUG, "Connection from %s closed.", ipstr); + + /* close socket prior to exiting */ + close(sock); + exit(STATE_OK); + + } else { + /* log info to syslog facility */ + if (debug == TRUE) + syslog(LOG_DEBUG, "Host address is in allowed_hosts"); + } + break; } + } + +#ifdef HAVE_LIBWRAP + /* Check whether or not connections are allowed from this host */ + request_init(&req, RQ_DAEMON, "nrpe", RQ_FILE, sock, 0); + fromhost(&req); + + if (!hosts_access(&req)) { + syslog(LOG_DEBUG, "Connection refused by TCP wrapper"); + refuse(&req); /* refuse the connection */ + /* should not be reached */ + syslog(LOG_ERR, "libwrap refuse() returns!"); + close(sock); + exit(STATE_CRITICAL); + } #endif +} - /* recv() error or client disconnect */ - if(rc<=0){ - - /* log error to syslog facility */ - syslog(LOG_ERR,"Could not read request from client, bailing out..."); - -#ifdef HAVE_SSL - if(ssl){ - complete_SSL_shutdown( ssl); - SSL_free(ssl); - syslog(LOG_INFO,"INFO: SSL Socket Shutdown.\n"); - } -#endif - - return; - } - - /* we couldn't read the correct amount of data, so bail out */ - else if(bytes_to_recv!=sizeof(receive_packet)){ - - /* log error to syslog facility */ - syslog(LOG_ERR,"Data packet from client was too short, bailing out..."); - -#ifdef HAVE_SSL - if(ssl){ - complete_SSL_shutdown( ssl); - SSL_free(ssl); - } -#endif - - return; - } - +/* handles a client connection */ +void handle_connection(int sock) +{ + u_int32_t calculated_crc32; + command *temp_command; + v2_packet receive_packet, send_packet; + v3_packet *v3_receive_packet = NULL, *v3_send_packet = NULL; + int bytes_to_send; + char buffer[MAX_INPUT_BUFFER], *send_buff = NULL, *send_pkt; + char raw_command[MAX_INPUT_BUFFER]; + char processed_command[MAX_INPUT_BUFFER]; + int result = STATE_OK; + int early_timeout = FALSE; + int rc; + int x; + int32_t pkt_size; #ifdef DEBUG - fp=fopen("/tmp/packet","w"); - if(fp){ - fwrite(&receive_packet,1,sizeof(receive_packet),fp); - fclose(fp); - } + FILE *errfp; +#endif +#ifdef HAVE_SSL + SSL *ssl = NULL; #endif - /* make sure the request is valid */ - if(validate_request(&receive_packet)==ERROR){ + /* do SSL handshake */ +#ifdef HAVE_SSL + if (use_ssl == TRUE) { + if ((ssl = SSL_new(ctx)) == NULL) { + syslog(LOG_ERR, "Error: Could not create SSL connection structure."); +# ifdef DEBUG + errfp = fopen("/tmp/err.log", "a"); + ERR_print_errors_fp(errfp); + fclose(errfp); +# endif + return; + } - /* log an error */ - syslog(LOG_ERR,"Client request was invalid, bailing out..."); - - /* free memory */ - free(command_name); - command_name=NULL; - for(x=0;xcommand_line,sizeof(raw_command)-1); - else - snprintf(raw_command,sizeof(raw_command)-1,"%s %s",command_prefix,temp_command->command_line); - raw_command[sizeof(raw_command)-1]='\x0'; - process_macros(raw_command,processed_command,sizeof(processed_command)); - - /* log info to syslog facility */ - if(debug==TRUE) - syslog(LOG_DEBUG,"Running command: %s",processed_command); - - /* run the command */ - strcpy(buffer,""); - result=my_system(processed_command,command_timeout,&early_timeout,buffer,sizeof(buffer)); - - /* log debug info */ - if(debug==TRUE) - syslog(LOG_DEBUG,"Command completed with return code %d and output: %s",result,buffer); - - /* see if the command timed out */ - if(early_timeout==TRUE) - snprintf(buffer,sizeof(buffer)-1,"NRPE: Command timed out after %d seconds\n",command_timeout); - else if(!strcmp(buffer,"")) - snprintf(buffer,sizeof(buffer)-1,"NRPE: Unable to read output\n"); - - buffer[sizeof(buffer)-1]='\x0'; - - /* check return code bounds */ - if((result<0) || (result>3)){ - - /* log error to syslog facility */ - syslog(LOG_ERR,"Bad return code for [%s]: %d", buffer,result); - - result=STATE_UNKNOWN; - } - } - } - - /* free memory */ - free(command_name); - command_name=NULL; - for(x=0;xcommand_line, sizeof(raw_command) - 1); + else + snprintf(raw_command, sizeof(raw_command) - 1, "%s %s", command_prefix, + temp_command->command_line); + raw_command[sizeof(raw_command) - 1] = '\x0'; + process_macros(raw_command, processed_command, sizeof(processed_command)); + + if (debug == TRUE) /* log info to syslog facility */ + syslog(LOG_DEBUG, "Running command: %s", processed_command); + + /* run the command */ + strcpy(buffer, ""); + result = my_system(processed_command, command_timeout, &early_timeout, &send_buff); + + if (debug == TRUE) /* log debug info */ + syslog(LOG_DEBUG, "Command completed with return code %d and output: %s", + result, send_buff); + + /* see if the command timed out */ + if (early_timeout == TRUE) { + sprintf(send_buff, "NRPE: Command timed out after %d seconds\n", + command_timeout); + result = STATE_UNKNOWN; + } else if (!strcmp(send_buff, "")) { + sprintf(send_buff, "NRPE: Unable to read output\n"); + result = STATE_UNKNOWN; + } + + /* check return code bounds */ + if ((result < 0) || (result > 3)) { + /* log error to syslog facility */ + syslog(LOG_ERR, "Bad return code for [%s]: %d", send_buff, result); + result = STATE_UNKNOWN; + } + } + } + + /* free memory */ + free(command_name); + command_name = NULL; + for (x = 0; x < MAX_COMMAND_ARGUMENTS; x++) { + free(macro_argv[x]); + macro_argv[x] = NULL; + } + if (v3_receive_packet) + free(v3_receive_packet); + pkt_size = strlen(send_buff); + /* strip newline character from end of output buffer */ + if (send_buff[strlen(send_buff) - 1] == '\n') + send_buff[strlen(send_buff) - 1] = '\x0'; + + if (packet_ver == NRPE_PACKET_VERSION_2) { + pkt_size = sizeof(v2_packet); + send_pkt = (char *)&send_packet; + + /* clear the response packet buffer */ + memset(&send_packet, 0, sizeof(send_packet)); + /* fill the packet with semi-random data */ + randomize_buffer((char *)&send_packet, sizeof(send_packet)); + + /* initialize response packet data */ + send_packet.packet_version = htons(packet_ver); + send_packet.packet_type = htons(RESPONSE_PACKET); + send_packet.result_code = htons(result); + strncpy(&send_packet.buffer[0], send_buff, MAX_PACKETBUFFER_LENGTH); + send_packet.buffer[MAX_PACKETBUFFER_LENGTH - 1] = '\x0'; + + /* calculate the crc 32 value of the packet */ + send_packet.crc32_value = 0; + calculated_crc32 = calculate_crc32((char *)&send_packet, sizeof(send_packet)); + send_packet.crc32_value = htonl(calculated_crc32); + + } else { + + pkt_size = (sizeof(v3_packet) - 1) + strlen(send_buff); + v3_send_packet = calloc(1, pkt_size); + send_pkt = (char *)v3_send_packet; + /* initialize response packet data */ + v3_send_packet->packet_version = htons(packet_ver); + v3_send_packet->packet_type = htons(RESPONSE_PACKET); + v3_send_packet->result_code = htons(result); + v3_send_packet->alignment = 0; + v3_send_packet->buffer_length = htonl(strlen(send_buff)); + strcpy(&v3_send_packet->buffer[0], send_buff); + + /* calculate the crc 32 value of the packet */ + v3_send_packet->crc32_value = 0; + calculated_crc32 = calculate_crc32((char *)v3_send_packet, pkt_size); + v3_send_packet->crc32_value = htonl(calculated_crc32); + } + + /* send the response back to the client */ + bytes_to_send = pkt_size; + if (use_ssl == FALSE) + sendall(sock, send_pkt, &bytes_to_send); +#ifdef HAVE_SSL + else + SSL_write(ssl, send_pkt, bytes_to_send); +#endif + +#ifdef HAVE_SSL + if (ssl) { + complete_SSL_shutdown(ssl); + SSL_free(ssl); + } +#endif + + if (v3_send_packet) + free(v3_send_packet); + + /* log info to syslog facility */ + if (debug == TRUE) + syslog(LOG_DEBUG, "Return Code: %d, Output: %s", result, send_buff); + + free(send_buff); return; - } +} +void init_handle_conn(void) +{ +#ifdef HAVE_SIGACTION + struct sigaction sig_action; +#endif + /* log info to syslog facility */ + if (debug == TRUE) + syslog(LOG_DEBUG, "Handling the connection..."); + + /* set connection handler */ +#ifdef HAVE_SIGACTION + sig_action.sa_sigaction = NULL; + sig_action.sa_handler = my_connection_sighandler; + sigfillset(&sig_action.sa_mask); + sig_action.sa_flags = SA_NODEFER | SA_RESTART; + sigaction(SIGALRM, &sig_action, NULL); +#else + signal(SIGALRM, my_connection_sighandler); +#endif /* HAVE_SIGACTION */ + alarm(connection_timeout); +} + +int handle_conn_ssl(int sock, void *ssl_ptr) +{ +#ifdef HAVE_SSL +# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux) + SSL_CIPHER *c; +#else + const SSL_CIPHER *c; +#endif + char buffer[MAX_INPUT_BUFFER]; + SSL *ssl = (SSL*)ssl_ptr; + X509 *peer; + int rc, x; + + SSL_set_fd(ssl, sock); + + /* keep attempting the request if needed */ + while (((rc = SSL_accept(ssl)) != 1) + && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) ; + + if (rc != 1) { + /* oops, got an unrecoverable error -- get out */ + if (sslprm.log_opts & (SSL_LogCertDetails | SSL_LogIfClientCert)) { + int nerrs = 0; + rc = 0; + while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) { + syslog(LOG_ERR, "Error: Could not complete SSL handshake with %s: %s", + remote_host, ERR_reason_error_string(x)); + ++nerrs; + } + if (nerrs == 0) + syslog(LOG_ERR, "Error: Could not complete SSL handshake with %s: %d", + remote_host, SSL_get_error(ssl, rc)); + + } else + syslog(LOG_ERR, "Error: Could not complete SSL handshake with %s: %d", + remote_host, SSL_get_error(ssl, rc)); +# ifdef DEBUG + errfp = fopen("/tmp/err.log", "a"); + ERR_print_errors_fp(errfp); + fclose(errfp); +# endif + return ERROR; + } + + /* successful handshake */ + if (sslprm.log_opts & SSL_LogVersion) + syslog(LOG_NOTICE, "Remote %s - SSL Version: %s", + remote_host, SSL_get_version(ssl)); + if (sslprm.log_opts & SSL_LogCipher) { + c = SSL_get_current_cipher(ssl); + syslog(LOG_NOTICE, "Remote %s - %s, Cipher is %s", remote_host, + SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c)); + } + + if ((sslprm.log_opts & SSL_LogIfClientCert) + || (sslprm.log_opts & SSL_LogCertDetails)) + { + peer = SSL_get_peer_certificate(ssl); + + if (peer) { + if (sslprm.log_opts & SSL_LogIfClientCert) + syslog(LOG_NOTICE, "SSL Client %s has %svalid certificate", + remote_host, peer->valid ? "a " : "an in"); + if (sslprm.log_opts & SSL_LogCertDetails) { + syslog(LOG_NOTICE, "SSL Client %s Cert Name: %s", + remote_host, peer->name); + X509_NAME_oneline(X509_get_issuer_name(peer), buffer, sizeof(buffer)); + syslog(LOG_NOTICE, "SSL Client %s Cert Issuer: %s", + remote_host, buffer); + } + + } else if (sslprm.client_certs == 0) + syslog(LOG_NOTICE, "SSL Not asking for client certification"); + + else + syslog(LOG_NOTICE, "SSL Client %s did not present a certificate", + remote_host); + } +#endif + + return OK; +} + +int read_packet(int sock, void *ssl_ptr, v2_packet * v2_pkt, v3_packet ** v3_pkt) +{ + int32_t common_size, tot_bytes, bytes_to_recv, buffer_size; + int rc; + char *buff_ptr; + + /* Read only the part that's common between versions 2 & 3 */ + common_size = tot_bytes = bytes_to_recv = (char *)&v2_pkt->buffer - (char *)v2_pkt; + + if (use_ssl == FALSE) { + rc = recvall(sock, (char *)v2_pkt, &tot_bytes, socket_timeout); + + if (rc <= 0 || rc != bytes_to_recv) + return -1; + + packet_ver = ntohs(v2_pkt->packet_version); + if (packet_ver != NRPE_PACKET_VERSION_2 && packet_ver != NRPE_PACKET_VERSION_3) { + syslog(LOG_ERR, "Error: Request packet version was invalid!"); + return -1; + } + + if (packet_ver == NRPE_PACKET_VERSION_2) { + buffer_size = sizeof(v2_packet) - common_size; + buff_ptr = (char *)v2_pkt + common_size; + + } else { + int32_t pkt_size = sizeof(v3_packet) - 1; + + /* Read the alignment filler */ + bytes_to_recv = sizeof(int16_t); + rc = recvall(sock, (char *)&buffer_size, &bytes_to_recv, socket_timeout); + if (rc <= 0 || bytes_to_recv != sizeof(int16_t)) + return -1; + tot_bytes += rc; + + /* Read the buffer size */ + bytes_to_recv = sizeof(buffer_size); + rc = recvall(sock, (char *)&buffer_size, &bytes_to_recv, socket_timeout); + if (rc <= 0 || bytes_to_recv != sizeof(buffer_size)) + return -1; + tot_bytes += rc; + + buffer_size = ntohl(buffer_size); + pkt_size += buffer_size; + if ((*v3_pkt = calloc(1, pkt_size)) == NULL) { + syslog(LOG_ERR, "Error: Could not allocate memory for packet"); + return -1; + } + + memcpy(*v3_pkt, v2_pkt, common_size); + (*v3_pkt)->buffer_length = htonl(buffer_size); + buff_ptr = (*v3_pkt)->buffer; + } + + bytes_to_recv = buffer_size; + rc = recvall(sock, buff_ptr, &bytes_to_recv, socket_timeout); + + if (rc <= 0 || rc != buffer_size) { + if (packet_ver == NRPE_PACKET_VERSION_3) { + free(*v3_pkt); + *v3_pkt = NULL; + } + return -1; + } else + tot_bytes += rc; + } +#ifdef HAVE_SSL + else { + SSL *ssl = (SSL *) ssl_ptr; + + while (((rc = SSL_read(ssl, v2_pkt, bytes_to_recv)) <= 0) + && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) { + } + + if (rc <= 0 || rc != bytes_to_recv) + return -1; + + packet_ver = ntohs(v2_pkt->packet_version); + if (packet_ver != NRPE_PACKET_VERSION_2 && packet_ver != NRPE_PACKET_VERSION_3) { + syslog(LOG_ERR, "Error: Request packet version was invalid!"); + return -1; + } + + if (packet_ver == NRPE_PACKET_VERSION_2) { + buffer_size = sizeof(v2_packet) - common_size; + buff_ptr = (char *)v2_pkt + common_size; + } else { + int32_t pkt_size = sizeof(v3_packet) - 1; + + /* Read the alignment filler */ + bytes_to_recv = sizeof(int16_t); + while (((rc = SSL_read(ssl, &buffer_size, bytes_to_recv)) <= 0) + && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) { + } + + if (rc <= 0 || bytes_to_recv != sizeof(int16_t)) + return -1; + tot_bytes += rc; + + /* Read the buffer size */ + bytes_to_recv = sizeof(buffer_size); + while (((rc = SSL_read(ssl, &buffer_size, bytes_to_recv)) <= 0) + && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) { + } + + if (rc <= 0 || bytes_to_recv != sizeof(buffer_size)) + return -1; + tot_bytes += rc; + + buffer_size = ntohl(buffer_size); + pkt_size += buffer_size; + if ((*v3_pkt = calloc(1, pkt_size)) == NULL) { + syslog(LOG_ERR, "Error: Could not allocate memory for packet"); + return -1; + } + + memcpy(*v3_pkt, v2_pkt, common_size); + (*v3_pkt)->buffer_length = htonl(buffer_size); + buff_ptr = (*v3_pkt)->buffer; + } + + bytes_to_recv = buffer_size; + while (((rc = SSL_read(ssl, buff_ptr, bytes_to_recv)) <= 0) + && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) { + } + + if (rc <= 0 || rc != buffer_size) { + if (packet_ver == NRPE_PACKET_VERSION_3) { + free(*v3_pkt); + *v3_pkt = NULL; + } + return -1; + } else + tot_bytes += rc; + } +#endif + + return tot_bytes; +} /* free all allocated memory */ -void free_memory(void){ - command *this_command; - command *next_command; - +void free_memory(void) +{ + command *this_command; + command *next_command; + /* free memory for the command list */ - this_command=command_list; - while(this_command!=NULL){ - next_command=this_command->next; - if(this_command->command_name) + this_command = command_list; + while (this_command != NULL) { + next_command = this_command->next; + if (this_command->command_name) free(this_command->command_name); - if(this_command->command_line) + if (this_command->command_line) free(this_command->command_line); free(this_command); - this_command=next_command; - } - - command_list=NULL; + this_command = next_command; + } + command_list = NULL; return; - } - - +} /* executes a system command via popen(), but protects against timeouts */ -int my_system(char *command,int timeout,int *early_timeout,char *output,int output_length){ - pid_t pid; - int status; - int result; - extern int errno; - char buffer[MAX_INPUT_BUFFER]; - int fd[2]; - FILE *fp; - int bytes_read=0; - time_t start_time,end_time; +int my_system(char *command, int timeout, int *early_timeout, char **output) +{ + FILE *fp; + pid_t pid; + time_t start_time, end_time; + int status; + int result; + char buffer[MAX_INPUT_BUFFER]; + int fd[2]; + int bytes_read = 0, tot_bytes = 0; + int output_size; +#ifdef HAVE_SIGACTION + struct sigaction sig_action; +#endif - /* initialize return variables */ - if(output!=NULL) - strcpy(output,""); - *early_timeout=FALSE; + *early_timeout = FALSE; /* initialize return variables */ - /* if no command was passed, return with no error */ - if(command==NULL) - return STATE_OK; + if (command == NULL) /* if no command was passed, return with no error */ + return STATE_OK; - /* create a pipe */ - pipe(fd); + pipe(fd); /* create a pipe */ /* make the pipe non-blocking */ - fcntl(fd[0],F_SETFL,O_NONBLOCK); - fcntl(fd[1],F_SETFL,O_NONBLOCK); + fcntl(fd[0], F_SETFL, O_NONBLOCK); + fcntl(fd[1], F_SETFL, O_NONBLOCK); - /* get the command start time */ - time(&start_time); + time(&start_time); /* get the command start time */ - /* fork */ - pid=fork(); + pid = fork(); /* fork */ /* return an error if we couldn't fork */ - if(pid==-1){ + if (pid == -1) { + snprintf(buffer, sizeof(buffer) - 1, "NRPE: Call to fork() failed\n"); + buffer[sizeof(buffer) - 1] = '\x0'; - snprintf(buffer,sizeof(buffer)-1,"NRPE: Call to fork() failed\n"); - buffer[sizeof(buffer)-1]='\x0'; - - if(output!=NULL){ - strncpy(output,buffer,output_length-1); - output[output_length-1]='\x0'; - } + if (packet_ver == NRPE_PACKET_VERSION_2) { + int output_size = sizeof(v2_packet); + *output = calloc(1, output_size); + strncpy(*output, buffer, output_size - 1); + *output[output_size - 1] = '\0'; + } else + *output = strdup(buffer); /* close both ends of the pipe */ close(fd[0]); close(fd[1]); - - return STATE_UNKNOWN; - } + + return STATE_UNKNOWN; + } /* execute the command in the child process */ - if(pid==0){ - - /* close pipe for reading */ - close(fd[0]); - - /* become process group leader */ - setpgid(0,0); + if (pid == 0) { + SETEUID(0); /* get root back so the next call works correctly */ + drop_privileges(nrpe_user, nrpe_group, 1); /* drop privileges */ + close(fd[0]); /* close pipe for reading */ + setpgid(0, 0); /* become process group leader */ /* trap commands that timeout */ - signal(SIGALRM,my_system_sighandler); +#ifdef HAVE_SIGACTION + sig_action.sa_sigaction = NULL; + sig_action.sa_handler = my_system_sighandler; + sigfillset(&sig_action.sa_mask); + sig_action.sa_flags = SA_NODEFER | SA_RESTART; + sigaction(SIGALRM, &sig_action, NULL); +#else + signal(SIGALRM, my_system_sighandler); +#endif /* HAVE_SIGACTION */ alarm(timeout); - /* run the command */ - fp=popen(command,"r"); - + fp = popen(command, "r"); /* run the command */ + /* report an error if we couldn't run the command */ - if(fp==NULL){ - - strncpy(buffer,"NRPE: Call to popen() failed\n",sizeof(buffer)-1); - buffer[sizeof(buffer)-1]='\x0'; - + if (fp == NULL) { + strncpy(buffer, "NRPE: Call to popen() failed\n", sizeof(buffer) - 1); + buffer[sizeof(buffer) - 1] = '\x0'; /* write the error back to the parent process */ - write(fd[1],buffer,strlen(buffer)+1); + write(fd[1], buffer, strlen(buffer) + 1); + result = STATE_CRITICAL; - result=STATE_CRITICAL; - } - else{ + } else { /* read all lines of output - supports Nagios 3.x multiline output */ - while((bytes_read=fread(buffer,1,sizeof(buffer)-1,fp))>0){ - + while ((bytes_read = fread(buffer, 1, sizeof(buffer) - 1, fp)) > 0) { /* write the output back to the parent process */ - write(fd[1],buffer,bytes_read); - } - - /* close the command and get termination status */ - status=pclose(fp); - - /* report an error if we couldn't close the command */ - if(status==-1) - result=STATE_CRITICAL; - /* report an error if child died due to signal (Klas Lindfors) */ - else if(!WIFEXITED(status)) - result=STATE_CRITICAL; - else - result=WEXITSTATUS(status); - } - - /* close pipe for writing */ - close(fd[1]); - - /* reset the alarm */ - alarm(0); - - /* return plugin exit code to parent process */ - exit(result); - } - - /* parent waits for child to finish executing command */ - else{ - - /* close pipe for writing */ - close(fd[1]); - - /* wait for child to exit */ - waitpid(pid,&status,0); - - /* get the end time for running the command */ - time(&end_time); - - /* get the exit code returned from the program */ - result=WEXITSTATUS(status); - - /* because of my idiotic idea of having UNKNOWN states be equivalent to -1, I must hack things a bit... */ - if(result==255) - result=STATE_UNKNOWN; - - /* check bounds on the return value */ - if(result<0 || result>3) - result=STATE_UNKNOWN; - - /* try and read the results from the command output (retry if we encountered a signal) */ - if(output!=NULL){ - do{ - bytes_read=read(fd[0], output, output_length-1); - }while (bytes_read==-1 && errno==EINTR); - - if(bytes_read==-1) - *output='\0'; - else - output[bytes_read]='\0'; + write(fd[1], buffer, bytes_read); } - /* if there was a critical return code and no output AND the command time exceeded the timeout thresholds, assume a timeout */ - if(result==STATE_CRITICAL && bytes_read==-1 && (end_time-start_time)>=timeout){ - *early_timeout=TRUE; + write(fd[1], "\0", 1); + status = pclose(fp); /* close the command and get termination status */ + + /* report an error if we couldn't close the command */ + if (status == -1) + result = STATE_CRITICAL; + else if (!WIFEXITED(status)) + /* report an error if child died due to signal (Klas Lindfors) */ + result = STATE_CRITICAL; + else + result = WEXITSTATUS(status); + } + + close(fd[1]); /* close pipe for writing */ + alarm(0); /* reset the alarm */ + exit(result); /* return plugin exit code to parent process */ + + } else { + /* parent waits for child to finish executing command */ + + close(fd[1]); /* close pipe for writing */ + waitpid(pid, &status, 0); /* wait for child to exit */ + time(&end_time); /* get the end time for running the command */ + result = WEXITSTATUS(status); /* get the exit code returned from the program */ + + /* because of my idiotic idea of having UNKNOWN states be equivalent to -1, I must hack things a bit... */ + if (result == 255) + result = STATE_UNKNOWN; + + /* check bounds on the return value */ + if (result < 0 || result > 3) + result = STATE_UNKNOWN; + + if (packet_ver == NRPE_PACKET_VERSION_2) { + output_size = sizeof(v2_packet); + *output = calloc(1, output_size); + } else { + output_size = 1024 * 64; /* Maximum buffer is 64K */ + *output = calloc(1, output_size); + } + + /* try and read the results from the command output (retry if we encountered a signal) */ + for (;;) { + bytes_read = read(fd[0], buffer, sizeof(buffer) - 1); + if (bytes_read == 0) + break; + if (bytes_read == -1) { + if (errno == EINTR) + continue; + else + break; + } + if (tot_bytes < output_size) /* If buffer is full, discard the rest */ + strncat(*output, buffer, output_size - tot_bytes); + tot_bytes += bytes_read; + } + + (*output)[output_size - 1] = '\0'; + + /* if there was a critical return code and no output AND the + * command time exceeded the timeout thresholds, assume a timeout */ + if (result == STATE_CRITICAL && bytes_read == -1 && (end_time - start_time) >= timeout) { + *early_timeout = TRUE; /* send termination signal to child process group */ - kill((pid_t)(-pid),SIGTERM); - kill((pid_t)(-pid),SIGKILL); - } + kill((pid_t) (-pid), SIGTERM); + kill((pid_t) (-pid), SIGKILL); + } - /* close the pipe for reading */ - close(fd[0]); - } + close(fd[0]); /* close the pipe for reading */ + } #ifdef DEBUG printf("my_system() end\n"); #endif return result; - } - - +} /* handle timeouts when executing commands via my_system() */ -void my_system_sighandler(int sig){ - - /* force the child process to exit... */ - exit(STATE_CRITICAL); - } - +void my_system_sighandler(int sig) +{ + exit(STATE_CRITICAL); /* force the child process to exit... */ +} /* handle errors where connection takes too long */ -void my_connection_sighandler(int sig) { - - syslog(LOG_ERR,"Connection has taken too long to establish. Exiting..."); - +void my_connection_sighandler(int sig) +{ + syslog(LOG_ERR, "Connection has taken too long to establish. Exiting..."); exit(STATE_CRITICAL); - } - +} /* drops privileges */ -int drop_privileges(char *user, char *group){ - uid_t uid=-1; - gid_t gid=-1; +int drop_privileges(char *user, char *group, int full_drop) +{ + uid_t uid = -1; + gid_t gid = -1; struct group *grp; struct passwd *pw; /* set effective group ID */ - if(group!=NULL){ - - /* see if this is a group name */ - if(strspn(group,"0123456789")gr_gid); - else - syslog(LOG_ERR,"Warning: Could not get group entry for '%s'",group); - endgrent(); - } + if (group != NULL) { - /* else we were passed the GID */ - else - gid=(gid_t)atoi(group); + /* see if this is a group name */ + if (strspn(group, "0123456789") < strlen(group)) { + grp = (struct group *)getgrnam(group); + if (grp != NULL) + gid = (gid_t) (grp->gr_gid); + else + syslog(LOG_ERR, "Warning: Could not get group entry for '%s'", group); + endgrent(); + + } else + /* else we were passed the GID */ + gid = (gid_t) atoi(group); /* set effective group ID if other than current EGID */ - if(gid!=getegid()){ - - if(setgid(gid)==-1) - syslog(LOG_ERR,"Warning: Could not set effective GID=%d",(int)gid); - } - } + if (gid != getegid()) { + if (setgid(gid) == -1) + syslog(LOG_ERR, "Warning: Could not set effective GID=%d", (int)gid); + } + } /* set effective user ID */ - if(user!=NULL){ - + if (user != NULL) { + /* see if this is a user name */ - if(strspn(user,"0123456789")pw_uid); + if (strspn(user, "0123456789") < strlen(user)) { + pw = (struct passwd *)getpwnam(user); + if (pw != NULL) + uid = (uid_t) (pw->pw_uid); else - syslog(LOG_ERR,"Warning: Could not get passwd entry for '%s'",user); + syslog(LOG_ERR, "Warning: Could not get passwd entry for '%s'", user); endpwent(); - } - /* else we were passed the UID */ - else - uid=(uid_t)atoi(user); - + } else + /* else we were passed the UID */ + uid = (uid_t) atoi(user); + + if (uid != geteuid()) { /* set effective user ID if other than current EUID */ - if(uid!=geteuid()){ - #ifdef HAVE_INITGROUPS /* initialize supplementary groups */ - if(initgroups(user,gid)==-1){ - if(errno==EPERM) - syslog(LOG_ERR,"Warning: Unable to change supplementary groups using initgroups()"); - else{ - syslog(LOG_ERR,"Warning: Possibly root user failed dropping privileges with initgroups()"); + if (initgroups(user, gid) == -1) { + if (errno == EPERM) + syslog(LOG_ERR, + "Warning: Unable to change supplementary groups using initgroups()"); + else { + syslog(LOG_ERR, + "Warning: Possibly root user failed dropping privileges with initgroups()"); return ERROR; - } - } + } + } #endif - if(setuid(uid)==-1) - syslog(LOG_ERR,"Warning: Could not set effective UID=%d",(int)uid); - } - } + if (full_drop) { + if (setuid(uid) == -1) + syslog(LOG_ERR, "Warning: Could not set UID=%d", (int)uid); + } else if (SETEUID(uid) == -1) + syslog(LOG_ERR, "Warning: Could not set effective UID=%d", (int)uid); + } + } return OK; - } - +} /* write an optional pid file */ -int write_pid_file(void){ - int fd; - int result=0; - pid_t pid=0; - char pbuf[16]; +int write_pid_file(void) +{ + int fd; + int result = 0; + pid_t pid = 0; + char pbuf[16]; /* no pid file was specified */ - if(pid_file==NULL) + if (pid_file == NULL) return OK; /* read existing pid file */ - if((fd=open(pid_file,O_RDONLY))>=0){ - - result=read(fd,pbuf,(sizeof pbuf)-1); + if ((fd = open(pid_file, O_RDONLY)) >= 0) { + result = read(fd, pbuf, (sizeof pbuf) - 1); close(fd); - if(result>0){ - - pbuf[result]='\x0'; - pid=(pid_t)atoi(pbuf); + if (result > 0) { + pbuf[result] = '\x0'; + pid = (pid_t) atoi(pbuf); /* if previous process is no longer running running, remove the old pid file */ - if(pid && (pid==getpid() || kill(pid,0)<0)) + if (pid && (pid == getpid() || kill(pid, 0) < 0)) unlink(pid_file); - /* previous process is still running */ - else{ - syslog(LOG_ERR,"There's already an NRPE server running (PID %lu). Bailing out...",(unsigned long)pid); + else { + /* previous process is still running */ + syslog(LOG_ERR, + "There's already an NRPE server running (PID %lu). Bailing out...", + (unsigned long)pid); return ERROR; - } - } - } + } + } + } /* write new pid file */ - if((fd=open(pid_file,O_WRONLY | O_CREAT,0644))>=0){ - sprintf(pbuf,"%d\n",(int)getpid()); - write(fd,pbuf,strlen(pbuf)); + if ((fd = open(pid_file, O_WRONLY | O_CREAT, 0644)) >= 0) { + sprintf(pbuf, "%d\n", (int)getpid()); + write(fd, pbuf, strlen(pbuf)); close(fd); - wrote_pid_file=TRUE; - } - else{ - syslog(LOG_ERR,"Cannot write to pidfile '%s' - check your privileges.",pid_file); - } - - return OK; - } - - - -/* remove pid file */ -int remove_pid_file(void){ - - /* no pid file was specified */ - if(pid_file==NULL) - return OK; - - /* pid file was not written */ - if(wrote_pid_file==FALSE) - return OK; - - /* remove existing pid file */ - if(unlink(pid_file)==-1){ - syslog(LOG_ERR,"Cannot remove pidfile '%s' - check your privileges.",pid_file); + wrote_pid_file = TRUE; + } else { + syslog(LOG_ERR, "Cannot write to pidfile '%s' - check your privileges.", pid_file); return ERROR; - } + } return OK; - } - -void complete_SSL_shutdown( SSL *ssl) { - - /* - Thanks to Jari Takkala (jtakkala@gmail.com) for the following information. - - We need to call SSL_shutdown() at least twice, otherwise we'll - be left with data in the socket receive buffer, and the - subsequent process termination will cause TCP RST's to be sent - to the client. - - See http://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/32219/diff - for more information. - */ - - int x; - - for( x = 0; x < 4; x++) { - if( SSL_shutdown( ssl)) break; - } } -/* bail if daemon is running as root */ -int check_privileges(void){ - uid_t uid=-1; - gid_t gid=-1; +/* remove pid file */ +int remove_pid_file(void) +{ + if (pid_file == NULL) + return OK; /* no pid file was specified */ + if (wrote_pid_file == FALSE) + return OK; /* pid file was not written */ - uid=geteuid(); - gid=getegid(); - - if(uid==0 || gid==0){ - syslog(LOG_ERR,"Error: NRPE daemon cannot be run as user/group root!"); - exit(STATE_CRITICAL); - } + SETEUID(0); /* get root back so we can delete the pid file */ + if (unlink(pid_file) == -1) { + syslog(LOG_ERR, "Cannot remove pidfile '%s' - check your privileges.", pid_file); + return ERROR; + } return OK; - } +} +#ifdef HAVE_SSL +void my_disconnect_sighandler(int sig) +{ + syslog(LOG_ERR, "SSL_shutdown() has taken too long to complete. Exiting now.."); + exit(STATE_CRITICAL); +} + +void complete_SSL_shutdown(SSL * ssl) +{ + /* Thanks to Jari Takkala (jtakkala@gmail.com) for the following information. + + We need to call SSL_shutdown() at least twice, otherwise we'll + be left with data in the socket receive buffer, and the + subsequent process termination will cause TCP RST's to be sent + to the client. + + See http://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/32219/diff + for more information. + */ + + int x; + + /* set disconnection handler */ + signal(SIGALRM, my_disconnect_sighandler); + alarm(ssl_shutdown_timeout); + + for (x = 0; x < 4; x++) { + if (SSL_shutdown(ssl)) + break; + } + + alarm(0); +} +#endif /*HAVE_SSL */ + +/* bail if daemon is running as root */ +int check_privileges(void) +{ + uid_t uid = geteuid(); + gid_t gid = getegid(); + + if (uid == 0 || gid == 0) { + syslog(LOG_ERR, "Error: NRPE daemon cannot be run as user/group root!"); + exit(STATE_CRITICAL); + } + + return OK; +} /* handle signals (parent process) */ -void sighandler(int sig){ - static char *sigs[]={"EXIT","HUP","INT","QUIT","ILL","TRAP","ABRT","BUS","FPE","KILL","USR1","SEGV","USR2","PIPE","ALRM","TERM","STKFLT","CHLD","CONT","STOP","TSTP","TTIN","TTOU","URG","XCPU","XFSZ","VTALRM","PROF","WINCH","IO","PWR","UNUSED","ZERR","DEBUG",(char *)NULL}; - int i; +void sighandler(int sig) +{ + static char *sigs[] = { + "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "BUS", "FPE", + "KILL", "USR1", "SEGV", "USR2", "PIPE", "ALRM", "TERM", "STKFLT", + "CHLD", "CONT", "STOP", "TSTP", "TTIN", "TTOU", "URG", "XCPU", + "XFSZ", "VTALRM", "PROF", "WINCH", "IO", "PWR", "UNUSED", "ZERR", + "DEBUG", (char *)NULL + }; + int i; - if(sig<0) - sig=-sig; + if (sig < 0) + sig = -sig; - for(i=0;sigs[i]!=(char *)NULL;i++); - - sig%=i; + for (i = 0; sigs[i] != (char *)NULL; i++) ; + sig %= i; /* we received a SIGHUP, so restart... */ - if(sig==SIGHUP){ - - sigrestart=TRUE; - - syslog(LOG_NOTICE,"Caught SIGHUP - restarting...\n"); - } + if (sig == SIGHUP) { + sigrestart = TRUE; + syslog(LOG_NOTICE, "Caught SIGHUP - restarting...\n"); + } /* else begin shutting down... */ - if(sig==SIGTERM){ - + if (sig == SIGTERM) { /* if shutdown is already true, we're in a signal trap loop! */ - if(sigshutdown==TRUE) + if (sigshutdown == TRUE) exit(STATE_CRITICAL); - - sigshutdown=TRUE; - - syslog(LOG_NOTICE,"Caught SIG%s - shutting down...\n",sigs[sig]); - } + sigshutdown = TRUE; + syslog(LOG_NOTICE, "Caught SIG%s - shutting down...\n", sigs[sig]); + } return; - } - - +} /* handle signals (child processes) */ -void child_sighandler(int sig){ - - /* free all memory we allocated */ - free_memory(); - - /* terminate */ - exit(0); - - /* so the compiler doesn't complain... */ - return; - } - - +void child_sighandler(int sig) +{ + exit(0); /* terminate */ + return; /* so the compiler doesn't complain... */ +} /* tests whether or not a client request is valid */ -int validate_request(packet *pkt){ - u_int32_t packet_crc32; - u_int32_t calculated_crc32; - char *ptr; +int validate_request(v2_packet * v2pkt, v3_packet * v3pkt) +{ + u_int32_t packet_crc32; + u_int32_t calculated_crc32; + char *buff, *ptr; + int rc; #ifdef ENABLE_COMMAND_ARGUMENTS - int x; + int x; #endif + /* check the crc 32 value */ + if (packet_ver == NRPE_PACKET_VERSION_3) { + int32_t pkt_size = (sizeof(v3_packet) - 1) + ntohl(v3pkt->buffer_length); + packet_crc32 = ntohl(v3pkt->crc32_value); + v3pkt->crc32_value = 0L; + v3pkt->alignment = 0; + calculated_crc32 = calculate_crc32((char *)v3pkt, pkt_size); + } else { + packet_crc32 = ntohl(v2pkt->crc32_value); + v2pkt->crc32_value = 0L; + calculated_crc32 = calculate_crc32((char *)v2pkt, sizeof(v2_packet)); + } - /***** DECRYPT REQUEST ******/ - - - /* check the crc 32 value */ - packet_crc32=ntohl(pkt->crc32_value); - pkt->crc32_value=0L; - calculated_crc32=calculate_crc32((char *)pkt,sizeof(packet)); - if(packet_crc32!=calculated_crc32){ - syslog(LOG_ERR,"Error: Request packet had invalid CRC32."); - return ERROR; - } + if (packet_crc32 != calculated_crc32) { + syslog(LOG_ERR, "Error: Request packet had invalid CRC32."); + return ERROR; + } /* make sure this is the right type of packet */ - if(ntohs(pkt->packet_type)!=QUERY_PACKET || ntohs(pkt->packet_version)!=NRPE_PACKET_VERSION_2){ - syslog(LOG_ERR,"Error: Request packet type/version was invalid!"); + if (ntohs(v2pkt->packet_type) != QUERY_PACKET) { + syslog(LOG_ERR, "Error: Request packet type was invalid!"); return ERROR; - } + } /* make sure buffer is terminated */ - pkt->buffer[MAX_PACKETBUFFER_LENGTH-1]='\x0'; + if (packet_ver == NRPE_PACKET_VERSION_3) { + int32_t l = ntohs(v3pkt->buffer_length); + v3pkt->buffer[l - 1] = '\x0'; + buff = v3pkt->buffer; + } else { + v2pkt->buffer[MAX_PACKETBUFFER_LENGTH - 1] = '\x0'; + buff = v2pkt->buffer; + } /* client must send some kind of request */ - if(!strcmp(pkt->buffer,"")){ - syslog(LOG_ERR,"Error: Request contained no query!"); + if (buff[0] == '\0') { + syslog(LOG_ERR, "Error: Request contained no query!"); return ERROR; - } + } /* make sure request doesn't contain nasties */ - if(contains_nasty_metachars(pkt->buffer)==TRUE){ - syslog(LOG_ERR,"Error: Request contained illegal metachars!"); + if (packet_ver == NRPE_PACKET_VERSION_3) + rc = contains_nasty_metachars(v3pkt->buffer); + else + rc = contains_nasty_metachars(v2pkt->buffer); + if (rc == TRUE) { + syslog(LOG_ERR, "Error: Request contained illegal metachars!"); return ERROR; - } + } /* make sure the request doesn't contain arguments */ - if(strchr(pkt->buffer,'!')){ + if (strchr(v2pkt->buffer, '!')) { #ifdef ENABLE_COMMAND_ARGUMENTS - if(allow_arguments==FALSE){ - syslog(LOG_ERR,"Error: Request contained command arguments, but argument option is not enabled!"); + if (allow_arguments == FALSE) { + syslog(LOG_ERR, + "Error: Request contained command arguments, but argument option is not enabled!"); return ERROR; - } + } #else - syslog(LOG_ERR,"Error: Request contained command arguments!"); + syslog(LOG_ERR, "Error: Request contained command arguments!"); return ERROR; #endif - } + } /* get command name */ #ifdef ENABLE_COMMAND_ARGUMENTS - ptr=strtok(pkt->buffer,"!"); + ptr = strtok(buff, "!"); #else - ptr=pkt->buffer; -#endif - command_name=strdup(ptr); - if(command_name==NULL){ - syslog(LOG_ERR,"Error: Memory allocation failed"); + ptr = buff; +#endif + command_name = strdup(ptr); + if (command_name == NULL) { + syslog(LOG_ERR, "Error: Memory allocation failed"); return ERROR; - } - + } #ifdef ENABLE_COMMAND_ARGUMENTS /* get command arguments */ - if(allow_arguments==TRUE){ + if (allow_arguments == TRUE) { - for(x=0;x=1 && arg_index<=MAX_COMMAND_ARGUMENTS) - selected_macro=macro_argv[arg_index-1]; - } + if (strstr(temp_buffer, "ARG") == temp_buffer) { + arg_index = atoi(temp_buffer + 3); + if (arg_index >= 1 && arg_index <= MAX_COMMAND_ARGUMENTS) + selected_macro = macro_argv[arg_index - 1]; - /* an escaped $ is done by specifying two $$ next to each other */ - else if(!strcmp(temp_buffer,"")){ - strncat(output_buffer,"$",buffer_length-strlen(output_buffer)-1); - } - - /* a non-macro, just some user-defined string between two $s */ - else{ - strncat(output_buffer,"$",buffer_length-strlen(output_buffer)-1); - output_buffer[buffer_length-1]='\x0'; - strncat(output_buffer,temp_buffer,buffer_length-strlen(output_buffer)-1); - output_buffer[buffer_length-1]='\x0'; - strncat(output_buffer,"$",buffer_length-strlen(output_buffer)-1); - } + } else if (!strcmp(temp_buffer, "")) { + /* an escaped $ is done by specifying two $$ next to each other */ + strncat(output_buffer, "$", buffer_length - strlen(output_buffer) - 1); - - /* insert macro */ - if(selected_macro!=NULL) - strncat(output_buffer,(selected_macro==NULL)?"":selected_macro,buffer_length-strlen(output_buffer)-1); - - output_buffer[buffer_length-1]='\x0'; + } else { + /* a non-macro, just some user-defined string between two $s */ + strncat(output_buffer, "$", buffer_length - strlen(output_buffer) - 1); + output_buffer[buffer_length - 1] = '\x0'; + strncat(output_buffer, temp_buffer, + buffer_length - strlen(output_buffer) - 1); + output_buffer[buffer_length - 1] = '\x0'; + strncat(output_buffer, "$", buffer_length - strlen(output_buffer) - 1); } - in_macro=FALSE; - } - } - return OK; + /* insert macro */ + if (selected_macro != NULL) + strncat(output_buffer, (selected_macro == NULL) ? "" : selected_macro, + buffer_length - strlen(output_buffer) - 1); + + output_buffer[buffer_length - 1] = '\x0'; + } + + in_macro = FALSE; + } } - + return OK; +} /* process command line arguments */ -int process_arguments(int argc, char **argv){ - char optchars[MAX_INPUT_BUFFER]; - int c=1; - int have_mode=FALSE; - +int process_arguments(int argc, char **argv) +{ + char optchars[MAX_INPUT_BUFFER]; + int c = 1; + int have_mode = FALSE; #ifdef HAVE_GETOPT_LONG - int option_index=0; - static struct option long_options[]={ + int option_index = 0; + static struct option long_options[] = { {"config", required_argument, 0, 'c'}, {"inetd", no_argument, 0, 'i'}, /* To compatibility between short and long options but not used on AIX */ {"src", no_argument, 0, 's'}, + {"no-forking", no_argument, 0, 'f'}, {"4", no_argument, 0, '4'}, {"6", no_argument, 0, '4'}, {"daemon", no_argument, 0, 'd'}, @@ -2092,71 +2606,87 @@ int process_arguments(int argc, char **argv){ {"help", no_argument, 0, 'h'}, {"license", no_argument, 0, 'l'}, {0, 0, 0, 0} - }; + }; #endif /* no options were supplied */ - if(argc<2) + if (argc < 2) return ERROR; - snprintf(optchars,MAX_INPUT_BUFFER,"c:hVldi46n"); + snprintf(optchars, MAX_INPUT_BUFFER, "c:hVldi46nsf"); - while(1){ + while (1) { #ifdef HAVE_GETOPT_LONG - c=getopt_long(argc,argv,optchars,long_options,&option_index); + c = getopt_long(argc, argv, optchars, long_options, &option_index); #else - c=getopt(argc,argv,optchars); + c = getopt(argc, argv, optchars); #endif - if(c==-1 || c==EOF) + if (c == -1 || c == EOF) break; /* process all arguments */ - switch(c){ + switch (c) { case '?': case 'h': - show_help=TRUE; + show_help = TRUE; break; + case 'V': - show_version=TRUE; + show_version = TRUE; break; + case 'l': - show_license=TRUE; + show_license = TRUE; break; + case 'c': - strncpy(config_file,optarg,sizeof(config_file)); - config_file[sizeof(config_file)-1]='\x0'; + strncpy(config_file, optarg, sizeof(config_file)); + config_file[sizeof(config_file) - 1] = '\x0'; break; + case 'd': - use_inetd=FALSE; - have_mode=TRUE; + use_inetd = FALSE; + have_mode = TRUE; break; + case 'i': - use_inetd=TRUE; - have_mode=TRUE; + use_inetd = TRUE; + have_mode = TRUE; break; + case '4': - address_family=AF_INET; + address_family = AF_INET; break; + case '6': - address_family=AF_INET6; + address_family = AF_INET6; break; + case 'n': - use_ssl=FALSE; + use_ssl = FALSE; break; - case 's': /* Argument s to indicate SRC option*/ - use_src=TRUE; + + case 's': /* Argument s to indicate SRC option */ + use_src = TRUE; + have_mode = TRUE; break; + + case 'f': + use_inetd = FALSE; + no_forking = TRUE; + have_mode = TRUE; + break; + default: return ERROR; break; - } - } + } + } /* bail if we didn't get required args */ - if(have_mode==FALSE) + if (have_mode == FALSE) return ERROR; return OK; - } - +} diff --git a/src/snprintf.c b/src/snprintf.c index ef77305..ea33e85 100644 --- a/src/snprintf.c +++ b/src/snprintf.c @@ -270,7 +270,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args struct pr_chunk *cnk = NULL; struct pr_chunk_x *clist = NULL; int max_pos; - size_t ret = -1; + size_t ret = (size_t)-1; VA_COPY(args, args_in); diff --git a/src/utils.c b/src/utils.c index fee42ec..ff2029b 100644 --- a/src/utils.c +++ b/src/utils.c @@ -32,58 +32,64 @@ #include "../include/common.h" #include "../include/utils.h" +#ifndef HAVE_ASPRINTF +extern int asprintf(char **ptr, const char *format, ...); +#endif + #ifndef NI_MAXSERV -#define NI_MAXSERV 32 +# define NI_MAXSERV 32 #endif #ifndef NI_MAXHOST -#define NI_MAXHOST 1025 +# define NI_MAXHOST 1025 #endif +extern char **environ; + static unsigned long crc32_table[256]; +static int my_create_socket(struct addrinfo *ai, const char *bind_address); /* build the crc table - must be called before calculating the crc value */ -void generate_crc32_table(void){ +void generate_crc32_table(void) +{ unsigned long crc, poly; int i, j; - poly=0xEDB88320L; - for(i=0;i<256;i++){ - crc=i; - for(j=8;j>0;j--){ - if(crc & 1) - crc=(crc>>1)^poly; + poly = 0xEDB88320L; + for (i = 0; i < 256; i++) { + crc = i; + for (j = 8; j > 0; j--) { + if (crc & 1) + crc = (crc >> 1) ^ poly; else - crc>>=1; - } - crc32_table[i]=crc; - } + crc >>= 1; + } + crc32_table[i] = crc; + } return; - } - +} /* calculates the CRC 32 value for a buffer */ -unsigned long calculate_crc32(char *buffer, int buffer_size){ - register unsigned long crc; +unsigned long calculate_crc32(char *buffer, int buffer_size) +{ + register unsigned long crc = 0xFFFFFFFF; int this_char; int current_index; - crc=0xFFFFFFFF; - - for(current_index=0;current_index>8) & 0x00FFFFFF) ^ crc32_table[(crc ^ this_char) & 0xFF]; - } + for (current_index = 0; current_index < buffer_size; current_index++) { + this_char = (int)buffer[current_index]; + crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32_table[(crc ^ this_char) & 0xFF]; + } return (crc ^ 0xFFFFFFFF); - } - +} /* fill a buffer with semi-random data */ -void randomize_buffer(char *buffer,int buffer_size){ +void randomize_buffer(char *buffer, int buffer_size) +{ FILE *fp; int x; int seed; @@ -91,103 +97,106 @@ void randomize_buffer(char *buffer,int buffer_size){ /**** FILL BUFFER WITH RANDOM ALPHA-NUMERIC CHARACTERS ****/ /*************************************************************** - Only use alpha-numeric characters becase plugins usually + Only use alpha-numeric characters because plugins usually only generate numbers and letters in their output. We want the buffer to contain the same set of characters as plugins, so its harder to distinguish where the real output ends and the rest of the buffer (padded randomly) starts. - ***************************************************************/ + ***************************************************************/ /* try to get seed value from /dev/urandom, as its a better source of entropy */ - fp=fopen("/dev/urandom","r"); - if(fp!=NULL){ - seed=fgetc(fp); + fp = fopen("/dev/urandom", "r"); + if (fp != NULL) { + seed = fgetc(fp); fclose(fp); - } - + } /* else fallback to using the current time as the seed */ else - seed=(int)time(NULL); + seed = (int)time(NULL); srand(seed); - for(x=0;xai_next) { - if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) continue; - if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), - strport, sizeof(strport), NI_NUMERICHOST|NI_NUMERICSERV) != 0) { + if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) + continue; + if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), + strport, sizeof(strport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) { fprintf(stderr, "my_connect: getnameinfo failed\n"); continue; } /* Create a socket for connecting. */ sock = my_create_socket(ai, bind_address); - if (sock < 0) { - /* Any error is already output */ - continue; - } + if (sock < 0) + continue; /* Any error is already output */ if (connect(sock, ai->ai_addr, ai->ai_addrlen) >= 0) { /* Successful connection. */ memcpy(hostaddr, ai->ai_addr, ai->ai_addrlen); break; - } - else { - fprintf(stderr,"connect to address %s port %s: %s\n", ntop, strport, + } else { + fprintf(stderr, "connect to address %s port %s: %s\n", ntop, strport, strerror(errno)); close(sock); sock = -1; - } } + } freeaddrinfo(aitop); /* Return failure if we didn't get a successful connection. */ if (sock == -1) { - fprintf(stderr, "connect to host %s port %s: %s", host, strport, - strerror(errno)); + fprintf(stderr, "connect to host %s port %s: %s\n", host, strport, strerror(errno)); return -1; - } - return sock; } + return sock; +} /* Creates a socket for the connection. */ -int my_create_socket(struct addrinfo *ai, const char *bind_address) { +int my_create_socket(struct addrinfo *ai, const char *bind_address) +{ int sock, gaierr; struct addrinfo hints, *res; sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); - if (sock < 0) fprintf(stderr,"socket: %.100s\n", strerror(errno)); + if (sock < 0) + fprintf(stderr, "socket: %.100s\n", strerror(errno)); /* Bind the socket to an alternative local IP address */ - if (bind_address == NULL) return sock; + if (bind_address == NULL) + return sock; memset(&hints, 0, sizeof(hints)); hints.ai_family = ai->ai_family; @@ -195,24 +204,23 @@ int my_create_socket(struct addrinfo *ai, const char *bind_address) { hints.ai_protocol = ai->ai_protocol; hints.ai_flags = AI_PASSIVE; gaierr = getaddrinfo(bind_address, NULL, &hints, &res); - if(gaierr) { - fprintf(stderr, "getaddrinfo: %s: %s\n", bind_address, - gai_strerror(gaierr)); + if (gaierr) { + fprintf(stderr, "getaddrinfo: %s: %s\n", bind_address, gai_strerror(gaierr)); close(sock); return -1; - } - if(bind(sock, res->ai_addr, res->ai_addrlen) < 0) { + } + if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) { fprintf(stderr, "bind: %s: %s\n", bind_address, strerror(errno)); close(sock); freeaddrinfo(res); return -1; - } + } freeaddrinfo(res); return sock; } -void add_listen_addr(struct addrinfo **listen_addrs, int address_family, - char *addr, int port) { +void add_listen_addr(struct addrinfo **listen_addrs, int address_family, char *addr, int port) +{ struct addrinfo hints, *ai, *aitop; char strport[NI_MAXSERV]; int gaierr; @@ -222,109 +230,191 @@ void add_listen_addr(struct addrinfo **listen_addrs, int address_family, hints.ai_socktype = SOCK_STREAM; hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; snprintf(strport, sizeof strport, "%d", port); - if((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0) { - syslog(LOG_ERR,"bad addr or host: %s (%s)\n", addr ? addr : "", - gai_strerror(gaierr)); + if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0) { + syslog(LOG_ERR, "bad addr or host: %s (%s)\n", addr ? addr : "", + gai_strerror(gaierr)); exit(1); - } - for(ai = aitop; ai->ai_next; ai = ai->ai_next); + } + for (ai = aitop; ai->ai_next; ai = ai->ai_next) ; ai->ai_next = *listen_addrs; *listen_addrs = aitop; +} + +int clean_environ(const char *keep_env_vars, const char *nrpe_user) +{ +#ifdef HAVE_PATHS_H + static char *path = _PATH_STDPATH; +#else + static char *path = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; +#endif + struct passwd *pw; + size_t len, var_sz = 0; + char **kept = NULL, *value, *var, *keep = NULL; + int i, j, keepcnt = 0; + + if (keep_env_vars && *keep_env_vars) + asprintf(&keep, "%s,NRPE_MULTILINESUPPORT,NRPE_PROGRAMVERSION", keep_env_vars); + else + asprintf(&keep, "NRPE_MULTILINESUPPORT,NRPE_PROGRAMVERSION"); + if (keep == NULL) { + syslog(LOG_ERR, "Could not sanitize the environment. Aborting!"); + return ERROR; } - -void strip(char *buffer){ + + ++keepcnt; + i = strlen(keep); + while (i--) { + if (keep[i] == ',') + ++keepcnt; + } + + if ((kept = calloc(keepcnt + 1, sizeof(char *))) == NULL) { + syslog(LOG_ERR, "Could not sanitize the environment. Aborting!"); + return ERROR; + } + for (i = 0, var = my_strsep(&keep, ","); var != NULL; var = my_strsep(&keep, ",")) + kept[i++] = strip(var); + + var = NULL; + i = 0; + while (environ[i]) { + value = environ[i]; + if ((len = strcspn(value, "=")) == 0) { + free(keep); + free(kept); + free(var); + syslog(LOG_ERR, "Could not sanitize the environment. Aborting!"); + return ERROR; + } + if (len >= var_sz) { + var_sz = len + 1; + var = realloc(var, var_sz); + } + strncpy(var, environ[i], var_sz); + var[len] = 0; + + for (j = 0; kept[j]; ++j) { + if (!strncmp(var, kept[j], strlen(kept[j]))) + break; + } + if (kept[j]) { + ++i; + continue; + } + + unsetenv(var); + } + + free(var); + free(keep); + free(kept); + + pw = (struct passwd *)getpwnam(nrpe_user); + if (pw == NULL) + return OK; + + setenv("PATH", path, 1); + setenv("IFS", " \t\n", 1); + setenv("HOME", pw->pw_dir, 0); + setenv("SHELL", pw->pw_shell, 0); + setenv("LOGNAME", nrpe_user, 0); + setenv("USER", nrpe_user, 0); + + return OK; +} + +char *strip(char *buffer) +{ int x; int index; + char *buf = buffer; - for(x=strlen(buffer);x>=1;x--){ - index=x-1; - if(buffer[index]==' ' || buffer[index]=='\r' || buffer[index]=='\n' || buffer[index]=='\t') - buffer[index]='\x0'; + for (x = strlen(buffer); x >= 1; x--) { + index = x - 1; + if (buffer[index] == ' ' || buffer[index] == '\r' || buffer[index] == '\n' + || buffer[index] == '\t') + buffer[index] = '\x0'; else break; - } + } - return; - } + while (*buf == ' ' || *buf == '\r' || *buf == '\n' || *buf == '\t') { + ++buf; + --x; + } + if (buf != buffer) { + memmove(buffer, buf, x); + buffer[x] = '\x0'; + } + return buffer; +} /* sends all data - thanks to Beej's Guide to Network Programming */ -int sendall(int s, char *buf, int *len){ - int total=0; - int bytesleft=*len; - int n=0; +int sendall(int s, char *buf, int *len) +{ + int total = 0; + int bytesleft = *len; + int n = 0; /* send all the data */ - while(total<*len){ - - /* send some data */ - n=send(s,buf+total,bytesleft,0); - - /* break on error */ - if(n==-1) + while (total < *len) { + n = send(s, buf + total, bytesleft, 0); /* send some data */ + if (n == -1) /* break on error */ break; - /* apply bytes we sent */ - total+=n; - bytesleft-=n; - } - - /* return number of bytes actually send here */ - *len=total; - - /* return -1 on failure, 0 on success */ - return n==-1?-1:0; - } + total += n; + bytesleft -= n; + } + *len = total; /* return number of bytes actually sent here */ + return n == -1 ? -1 : 0; /* return -1 on failure, 0 on success */ +} /* receives all data - modelled after sendall() */ -int recvall(int s, char *buf, int *len, int timeout){ - int total=0; - int bytesleft=*len; - int n=0; +int recvall(int s, char *buf, int *len, int timeout) +{ time_t start_time; time_t current_time; - - /* clear the receive buffer */ - bzero(buf,*len); + int total = 0; + int bytesleft = *len; + int n = 0; + bzero(buf, *len); /* clear the receive buffer */ time(&start_time); /* receive all data */ - while(total<*len){ + while (total < *len) { + n = recv(s, buf + total, bytesleft, 0); /* receive some data */ - /* receive some data */ - n=recv(s,buf+total,bytesleft,0); - - /* no data has arrived yet (non-blocking socket) */ - if(n==-1 && errno==EAGAIN){ + if (n == -1 && errno == EAGAIN) { + /* no data has arrived yet (non-blocking socket) */ time(¤t_time); - if(current_time-start_time>timeout) + if (current_time - start_time > timeout) break; sleep(1); continue; - } - - /* receive error or client disconnect */ - else if(n<=0) - break; + } else if (n <= 0) + break; /* receive error or client disconnect */ /* apply bytes we received */ - total+=n; - bytesleft-=n; - } + total += n; + bytesleft -= n; + } /* return number of bytes actually received here */ - *len=total; + *len = total; /* return <=0 on failure, bytes received on success */ - return (n<=0)?n:total; - } + return (n <= 0) ? n : total; +} /* fixes compiler problems under Solaris, since strsep() isn't included */ + /* this code is taken from the glibc source */ -char *my_strsep (char **stringp, const char *delim){ +char *my_strsep(char **stringp, const char *delim) +{ char *begin, *end; begin = *stringp; @@ -334,40 +424,84 @@ char *my_strsep (char **stringp, const char *delim){ /* A frequent case is when the delimiter string contains only one character. Here we don't need to call the expensive `strpbrk' function and instead work using `strchr'. */ - if(delim[0]=='\0' || delim[1]=='\0'){ + if (delim[0] == '\0' || delim[1] == '\0') { char ch = delim[0]; - if(ch=='\0') - end=NULL; - else{ - if(*begin==ch) - end=begin; + if (ch == '\0') + end = NULL; + else { + if (*begin == ch) + end = begin; else - end=strchr(begin+1,ch); - } + end = strchr(begin + 1, ch); } - else - /* Find the end of the token. */ - end = strpbrk (begin, delim); - - if(end){ + } else + end = strpbrk(begin, delim); /* Find the end of the token. */ + if (end) { /* Terminate the token and set *STRINGP past NUL character. */ - *end++='\0'; - *stringp=end; - } - else + *end++ = '\0'; + *stringp = end; + } else /* No more delimiters; this is the last token. */ - *stringp=NULL; + *stringp = NULL; return begin; - } +} +int b64_decode(unsigned char *encoded) +{ + static const char *b64 = { + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" + }; + int i, j, l, padding = 0; + unsigned char c[4], *outp = encoded; + + union { + unsigned c3; + struct { + unsigned f1:6; + unsigned f2:6; + unsigned f3:6; + unsigned f4:6; + } fields; + } enc; + + enc.c3 = 0; + l = strlen((char *)encoded); + for (i = 0; i < l; i += 4) { + for (j = 0; j < 4; ++j) { + if (encoded[i + j] == '=') { + c[j] = 0; + ++padding; + } else if (encoded[i + j] >= 'A' && encoded[i + j] <= 'Z') + c[j] = encoded[i + j] - 'A'; + else if (encoded[i + j] >= 'a' && encoded[i + j] <= 'z') + c[j] = encoded[i + j] - 'a' + 26; + else if (encoded[i + j] >= '0' && encoded[i + j] <= '9') + c[j] = encoded[i + j] - '0' + 52; + else if (encoded[i + j] == '+') + c[j] = encoded[i + j] - '+' + 62; + else + c[j] = encoded[i + j] - '/' + 63; + } + enc.fields.f1 = c[3]; + enc.fields.f2 = c[2]; + enc.fields.f3 = c[1]; + enc.fields.f4 = c[0]; + *outp++ = (enc.c3 >> 16) & 0xff; + *outp++ = (enc.c3 >> 8) & 0xff; + *outp++ = (enc.c3) & 0xff; + } + *outp = '\0'; + + return outp - encoded - padding; +} /* show license */ -void display_license(void){ - +void display_license(void) +{ printf("This program is released under the GPL (see below) with the additional\n"); printf("exemption that compiling, linking, and/or using OpenSSL is allowed.\n\n"); @@ -384,7 +518,4 @@ void display_license(void){ printf("Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n"); return; - } - - - +} diff --git a/startup/bsd-init.in b/startup/bsd-init.in new file mode 100644 index 0000000..96551ae --- /dev/null +++ b/startup/bsd-init.in @@ -0,0 +1,90 @@ +#!/bin/sh + +# Start/stop/restart/reload nrpe +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team + +NRPE_BIN=@sbindir@/nrpe +NRPE_CFG=@pkgsysconfdir@/nrpe.cfg +PID_DIR=@piddir@ +PID_FILE=@piddir@/nrpe.pid + +# Start nrpe +nrpe_start() { + echo -n "Starting nrpe daemon: $NRPE_BIN - " + if [ ! -d "$PID_DIR" ]; then + mkdir -p "$PID_DIR" + fi + $NRPE_BIN -c $NRPE_CFG -d + if [ $? = 0 ]; then + echo "started" + else + echo "failed" + fi +} + +# Stop nrpe +nrpe_stop() { + echo -n "Stopping nrpe daemon - " + if [ -r "$PID_FILE" ]; then + kill $(cat "$PID_FILE") + else + killall nrpe + fi + if [ $? = 0 ]; then + echo "stopped" + else + echo "failed" + fi +} + +# Restart nrpe +nrpe_restart() { + nrpe_stop + sleep 1 + nrpe_start +} + +# Reload nrpe +nrpe_reload() { + echo -n "Reloading nrpe daemon - " + if [ -r "$PID_FILE" ]; then + kill -HUP $(cat "$PID_FILE") + else + killall -HUP nrpe + fi + if [ $? = 0 ]; then + echo "reloaded" + else + echo "failed" + fi +} + +# nrpe status +nrpe_status() { + if ps -C nrpe >/dev/null; then + echo "nrpe is running." + else + echo "nrpe is stopped." + fi +} + +case "$1" in +'start') + nrpe_start + ;; +'stop') + nrpe_stop + ;; +'restart') + nrpe_restart + ;; +'reload') + nrpe_reload + ;; +'status') + nrpe_status + ;; +*) + echo "Usage $0 start|stop|restart|reload|status" + ;; +esac diff --git a/startup/debian-init.in b/startup/debian-init.in new file mode 100644 index 0000000..47341a5 --- /dev/null +++ b/startup/debian-init.in @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# Start/stop the nrpe daemon. + +NRPE_BIN=@sbindir@/nrpe +NRPE_CFG=@pkgsysconfdir@/nrpe.cfg +PID_FILE=@piddir@/nrpe.pid + +test -x $NRPE_BIN || exit 0 + +case "$1" in + +start) + echo -n "Starting nagios remote plugin daemon: nrpe" + start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NRPE_BIN -- -c $NRPE_CFG -d + echo "." + ;; + +stop) + echo -n "Stopping nagios remote plugin daemon: nrpe" + start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NRPE_BIN + echo "." + ;; + +restart|force-reload) + echo -n "Restarting nagios remote plugin daemon: nrpe" + start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NRPE_BIN + start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NRPE_BIN -- -c $NRPE_CFG -d + echo "." + ;; + +reload) + echo -n "Reloading configuration files for nagios remote plugin daemon: nrpe" + test -f $PID_FILE || exit 0 + test -x /bin/kill && /bin/kill -HUP `cat $PID_FILE` + echo "." + ;; + +*) + echo "Usage: $0 start|stop|restart|reload|force-reload" + exit 1 + ;; +esac + +exit 0 diff --git a/startup/default-inetd.in b/startup/default-inetd.in new file mode 100644 index 0000000..04837c9 --- /dev/null +++ b/startup/default-inetd.in @@ -0,0 +1,5 @@ +# +# Enable the following entry to enable the nrpe daemon +#nrpe stream tcp nowait @nrpe_user@ @sbindir@/nrpe nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd +# Enable the following entry if the nrpe daemon didn't link with libwrap +#nrpe stream tcp nowait @nrpe_user@ /usr/sbin/tcpd @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd diff --git a/startup/default-init.in b/startup/default-init.in new file mode 100644 index 0000000..b0f02a2 --- /dev/null +++ b/startup/default-init.in @@ -0,0 +1,157 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# chkconfig: - 80 30 +# description: Starts and stops the Nagios Remote Plugin Executor \ +# so a remote nagios server can run plugins on this host +# +### BEGIN INIT INFO +# Provides: nrpe +# Required-Start: $local_fs $remote_fs $time +# Required-Stop: $local_fs $remote_fs +# Should-Start: $syslog $network +# Should-Stop: $syslog $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Starts and stops the Nagios Remote Plugin Executor +# Description: Starts and stops the Nagios Remote Plugin Executor +# so a remote nagios server can run plugins on this host +### END INIT INFO + + +NRPE_BIN=@sbindir@/nrpe +NRPE_CFG=@pkgsysconfdir@/nrpe.cfg +LOCK_DIR=@subsyslockdir@ +LOCK_FILE=@subsyslockfile@ +PID_FILE=@piddir@/nrpe.pid + +test -x $NRPE_BIN || exit 5 + +RETVAL=0 +_set_rc (){ return; } + +# Default these commands/functions to RedHat/CentOS etc. values +MSG_CMD="echo -n" +START_CMD="daemon --pidfile $PID_FILE" +TERM_CMD="killproc -p $PID_FILE $NRPE_BIN -TERM" +HUP_CMD="killproc -p $PID_FILE $NRPE_BIN -HUP" +PRT_STAT="echo" +STAT_MSG="echo -n Checking for nrpe daemon... " +STAT_CMD="status nrpe" +EXIT_CMD="exit" + + +# Source the function library +if [ -f /etc/rc.status ]; then + + . /etc/rc.status + + _set_rc (){ return $RETVAL; } + + # Set these commands/functions to SuSE etc. values + START_CMD="startproc -p $PID_FILE" + TERM_CMD="killproc -p $PID_FILE -TERM $NRPE_BIN" + HUP_CMD="killproc -p $PID_FILE -HUP $NRPE_BIN" + PRT_STAT="rc_status -v -r" + STAT_CMD="checkproc -p $PID_FILE $NRPE_BIN" + EXIT_CMD="rc_exit" + rc_reset + +elif [ -f /etc/rc.d/init.d/functions ]; then + + . /etc/rc.d/init.d/functions + +elif [ -f /etc/init.d/functions ]; then + + . /etc/init.d/functions + +elif [ -f /lib/lsb/init-functions ]; then + + . /lib/lsb/init-functions + + MSG_CMD="log_daemon_msg" + START_CMD="start_daemon -p $PID_FILE" + PRT_STAT="log_end_msg" + STAT_MSG= + STAT_CMD="status_of_proc -p $PID_FILE $NRPE_BIN nrpe" + +elif [ -f /etc/rc.d/functions ]; then + + . /etc/rc.d/functions + +fi + + +# See how we were called. +case "$1" in + +start) + # Start daemons. + $MSG_CMD "Starting nrpe " + $START_CMD $NRPE_BIN -c $NRPE_CFG -d + RETVAL=$? + if test "$PRT_STAT" = log_end_msg; then + $PRT_STAT $RETVAL + else + _set_rc; $PRT_STAT + fi + if [ $RETVAL = 0 ]; then + [ -d $LOCK_DIR ] && touch $LOCK_FILE || true + fi + ;; + +stop) + # Stop daemons. + $MSG_CMD "Shutting down nrpe " + $TERM_CMD + RETVAL=$? + if test "$PRT_STAT" = log_end_msg; then + $PRT_STAT $RETVAL + else + _set_rc; $PRT_STAT + fi + if [ $RETVAL = 0 ]; then + [ -d $LOCK_DIR ] && rm -f $LOCK_FILE + fi + ;; + +restart|force-reload) + $0 stop + $0 start + RETVAL=$? + ;; + +reload) + $MSG_CMD "Reloading nrpe " + $HUP_CMD + RETVAL=$? + if test "$PRT_STAT" = log_end_msg; then + $PRT_STAT $RETVAL + else + _set_rc; $PRT_STAT + fi + ;; + +try-restart|condrestart) + $STAT_CMD || exit 0 + $0 stop + $0 start + RETVAL=$? + ;; + +status) + $STAT_MSG + $STAT_CMD + RETVAL=$? + if test "$PRT_STAT" != log_end_msg; then + _set_rc; $PRT_STAT + fi + ;; + +*) + echo "Usage: nrpe {start|stop|restart|reload|try-restart|condrestart|status}" + exit 1 +esac + +$EXIT_CMD $RETVAL diff --git a/startup/default-service.in b/startup/default-service.in new file mode 100644 index 0000000..4f3a66e --- /dev/null +++ b/startup/default-service.in @@ -0,0 +1,23 @@ +[Unit] +Description=Nagios Remote Program Executor +Documentation=http://www.nagios.org/documentation +After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target +Before=getty@tty1.service plymouth-quit.service xdm.service +Conflicts=nrpe.socket + +[Install] +WantedBy=multi-user.target + +[Service] +Type=simple +Restart=on-abort +PIDFile=@piddir@/nrpe.pid +RuntimeDirectory=nrpe +RuntimeDirectoryMode=0755 +ExecStart=@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f +ExecStopPost=/bin/rm -f @piddir@/nrpe.pid +TimeoutStopSec=60 +User=@nrpe_user@ +Group=@nrpe_group@ +PrivateTmp=true +OOMScoreAdjust=-500 diff --git a/startup/default-socket-svc.in b/startup/default-socket-svc.in new file mode 100644 index 0000000..3a749c5 --- /dev/null +++ b/startup/default-socket-svc.in @@ -0,0 +1,16 @@ +[Unit] +Description=Nagios Remote Program Executor +Documentation=http://www.nagios.org/documentation +After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target + +[Service] +Restart=on-failure +ExecStart=@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd +KillMode=process +User=@nrpe_user@ +Group=@nrpe_group@ +PrivateTmp=true +OOMScoreAdjust=-500 + +[Install] +WantedBy=multi-user.target diff --git a/startup/default-socket.in b/startup/default-socket.in new file mode 100644 index 0000000..1dd5815 --- /dev/null +++ b/startup/default-socket.in @@ -0,0 +1,12 @@ +[Unit] +Description=Nagios Remote Program Executor +Documentation=http://www.nagios.org/documentation +Before=nrpe.service +Conflicts=nrpe.service + +[Socket] +ListenStream=@nrpe_port@ +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/startup/default-xinetd.in b/startup/default-xinetd.in new file mode 100644 index 0000000..eb8248c --- /dev/null +++ b/startup/default-xinetd.in @@ -0,0 +1,15 @@ +# default: off +# description: NRPE (Nagios Remote Plugin Executor) +service nrpe +{ + disable = yes + socket_type = stream + port = @nrpe_port@ + wait = no + user = @nrpe_user@ + group = @nrpe_group@ + server = @sbindir@/nrpe + server_args = -c @pkgsysconfdir@/nrpe.cfg --inetd + only_from = 127.0.0.1 + log_on_failure += USERID +} diff --git a/startup/mac-inetd.plist.in b/startup/mac-inetd.plist.in new file mode 100644 index 0000000..45197ea --- /dev/null +++ b/startup/mac-inetd.plist.in @@ -0,0 +1,40 @@ + + + + + Label + org.nagios.nrpe + UserName + @nrpe_user@ + GroupName + @nrpe_group@ + Program + @sbindir@/nrpe + ProgramArguments + + nrpe + -c + @pkgsysconfdir@/nrpe.cfg + -i + + Sockets + + Listeners + + SockServiceName + 5666 + SockType + stream + SockFamily + IPv4 + + + inetdCompatibility + + Wait + + + ProcessType + Background + + diff --git a/startup/mac-init.plist.in b/startup/mac-init.plist.in new file mode 100644 index 0000000..f51c498 --- /dev/null +++ b/startup/mac-init.plist.in @@ -0,0 +1,32 @@ + + + + + Label + org.nagios.nrpe + UserName + @nrpe_user@ + GroupName + @nrpe_group@ + Program + @sbindir@/nrpe + ProgramArguments + + nrpe + -c + @pkgsysconfdir@/nrpe.cfg + -f + + KeepAlive + + SuccessfulExit + + NetworkState + + + RunAtLoad + + ProcessType + Background + + diff --git a/startup/newbsd-init.in b/startup/newbsd-init.in new file mode 100644 index 0000000..aa4ed45 --- /dev/null +++ b/startup/newbsd-init.in @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# PROVIDE: nrpe +# REQUIRE: DAEMON +# KEYWORD: shutdown + +. /etc/rc.subr + +: ${nrpe@bsd_enable@:="NO"} +: ${nrpe_configfile:="@pkgsysconfdir@/nrpe.cfg"} + +name=nrpe +command="@sbindir@/nrpe" +command_args="-c $nrpe_configfile -d" +pidfile="@piddir@/nrpe.pid" +extra_commands=reload +sig_reload=HUP +rcvar=nrpe@bsd_enable@ +load_rc_config "$name" +required_files="$nrpe_configfile" +sig_reload=HUP + +start_precmd=nrpe_prestart + +nrpe_prestart() +{ + [ -n "$nrpe_pidfile" ] && + warn "No longer necessary to set nrpe_pidfile in rc.conf[.local]" + + install -d -o @nrpe_user@ ${pidfile%/*} +} + +run_rc_command "$1" diff --git a/startup/openbsd-init.in b/startup/openbsd-init.in new file mode 100644 index 0000000..1713646 --- /dev/null +++ b/startup/openbsd-init.in @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# + +daemon="@sbindir@/nrpe" + +. /etc/rc.d/rc.subr + +rc_pre() { + install -d -o @nrpe_user@ ${pidfile%/*} +} + +rc_reload() { + pkill -HUP -xf "${pexp}" +} + +rc_cmd "$1" diff --git a/startup/openrc-conf.in b/startup/openrc-conf.in new file mode 100644 index 0000000..426042a --- /dev/null +++ b/startup/openrc-conf.in @@ -0,0 +1,7 @@ +# /etc/conf.d/nrpe : config file for /etc/init.d/nrpe + +# Configuration file - default is @sysconfdir@/nrpe.cfg +NRPE_CFG="@pgksysconfdir@/nrpe.cfg" + +# Any additional nrpe options (-n -4 -6) +NRPE_OPTS="" diff --git a/startup/openrc-init.in b/startup/openrc-init.in new file mode 100644 index 0000000..de93a0c --- /dev/null +++ b/startup/openrc-init.in @@ -0,0 +1,49 @@ +#!/sbin/runscript +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# Start/stop the nrpe daemon. +# +# Goes in /etc/init.d - Config is in /etc/conf.d/nrpe + +opts="reload" +# extra_started_commands="reload" use this if OpenRC >= 0.9.4 + +NRPE_BIN="@sbindir@/nrpe" +NRPE_PID="@piddir@/nrpe.pid" + +depend() { + use logger dns net localmount netmount nfsmount +} + +checkconfig() { + # Make sure the config file exists + if [ ! -f $NRPE_CFG ]; then + eerror "You need to setup $NRPE_CFG. + return 1 + fi + return 0 +} + +start() { + checkconfig || return 1 + ebegin "Starting nrpe" + # Make sure we have a sane current directory + cd / + start-stop-daemon --start --exec $NRPE_BIN --pidfile $PID_FILE \ + -- -c $NRPE_CFG -f $NRPE_OPTS + eend $? +} + +stop() { + ebegin "Stopping nrpe" + start-stop-daemon --stop --exec $NRPE_BIN --pidfile $PID_FILE + eend $? +} + +reload() { + ebegin "Reloading nrpe" + start-stop-daemon --stop --oknodo --exec $NRPE_BIN \ + --pidfile $PID_FILE --signal HUP + eend $? +} diff --git a/startup/rh-upstart-init.in b/startup/rh-upstart-init.in new file mode 100644 index 0000000..58bf3b5 --- /dev/null +++ b/startup/rh-upstart-init.in @@ -0,0 +1,17 @@ +# nrpe - the Nagios Remote Plugin Executor +# +# nrpe is a program that runs plugins on this host +# and reports the results back to a nagios server +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team + +description "the Nagios Remote Plugin Executor" + +oom -10 + +start on started network +stop on runlevel [!2345] + +respawn + +exec @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f diff --git a/startup/solaris-inetd.xml.in b/startup/solaris-inetd.xml.in new file mode 100644 index 0000000..85a0a5b --- /dev/null +++ b/startup/solaris-inetd.xml.in @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/startup/solaris-init.xml.in b/startup/solaris-init.xml.in new file mode 100644 index 0000000..e4ff84c --- /dev/null +++ b/startup/solaris-init.xml.in @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/startup/tmpfile.conf.in b/startup/tmpfile.conf.in new file mode 100644 index 0000000..9db7ca6 --- /dev/null +++ b/startup/tmpfile.conf.in @@ -0,0 +1,2 @@ +#Type Path Mode UID GID Age Argument +d @piddir@ 0755 @nrpe_user@ @nrpe_group@ - - diff --git a/startup/upstart-init.in b/startup/upstart-init.in new file mode 100644 index 0000000..ec16d7d --- /dev/null +++ b/startup/upstart-init.in @@ -0,0 +1,19 @@ +# nrpe - the Nagios Remote Plugin Executor +# +# nrpe is a program that runs plugins on this host +# and reports the results back to a nagios server +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team + +description "the Nagios Remote Plugin Executor" + +oom score -800 +setgid @nrpe_group@ +setuid @nrpe_user@ + +start on (local-filesystems and net-device-up IFACE!=lo) +stop on runlevel [!2345] + +respawn + +exec @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f diff --git a/subst.in b/subst.in deleted file mode 100755 index ad7417a..0000000 --- a/subst.in +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/perl -w - -# This script finishes the job started by config.status by replacing the variables -# of the form ${...} which were inserted into the file(s) by config.status. - -# Read all files with a single read statement -$/ = undef; - -# List of variables to replace -my %configvars = ( - "prefix" => { "value" => '@prefix@'}, - "exec_prefix" => { "value" => '@exec_prefix@'}, -); - -sub replace_var { - my $filep = shift; - my $cvp = shift; - my $varname = shift; - - return if( $cvp->{ $varname}->{ "replaced"}); - if( defined( $cvp->{ $varname}->{ "dependency"})) { - if( !$cvp->{ $cvp->{ $varname}->{ "dependency"}}->{ "replaced"}) { - # If a dependency exists and it is not already replaced, replace it - replace_var( $filep, $cvp, $cvp->{ $varname}->{ "dependency"}); - } - } - my $replacement = $cvp->{ $varname}->{ "value"}; - $$filep =~ s/\${$varname}/$replacement/g; - $cvp->{ $varname}->{ "replaced"} = 1; -} - -# Figure out the dependencies. -foreach my $cv ( keys %configvars ) { - if( $configvars{ $cv}->{ "value"} =~ /\${([^}]+)}/) { - my $dependency = $1; - if( exists( $configvars{ $dependency})) { - $configvars{ $dependency}->{ "dependency"} = $cv; - } - $configvars{ $cv}->{ "replaced"} = 0; - } -} - -# Process each file -while ($f = shift @ARGV) { - - # Read in the file - open( FILE, $f) || die "Unable to open $f for reading"; - my $file = ; - close( FILE) || die "Unable to close $f after reading"; - - # Replace each of the variables we know about - foreach $cv ( keys %configvars ) { - replace_var( \$file, \%configvars, $cv); - } - - # Write out the replacements - open( FILE, ">$f") || die "Unable to open $f for writing"; - print FILE $file; - close( FILE) || die "Unable to close $f after writing"; - -} diff --git a/uninstall.in b/uninstall.in new file mode 100755 index 0000000..0087c11 --- /dev/null +++ b/uninstall.in @@ -0,0 +1,417 @@ +#!/bin/sh + +# Initialize variables +myname="$0" +quiet=0 +prompt=0 +verb=0 +progs=0 +config=0 +start=0 +delusr=0 +delgrp=0 +delscpt=0 +force="-f" +redir=1 + +# Set file and path names +NAME=@PKG_NAME@ +OPSYS=@opsys@ +DIST=@dist_type@ +SBINDIR=@sbindir@ +LIBEXECDIR=@libexecdir@ +PLUGINSDIR=@pluginsdir@ +PIDDIR=@piddir@ +CFGDIR=@pkgsysconfdir@ +INIT_TYPE=@init_type@ +INIT_DIR=@initdir@ +INIT_FILE=@initname@ +INETD_TYPE=@inetd_type@ +INETD_DIR=@inetddir@ +INETD_FILE=@inetdname@ +SRC_INETD=@src_inetd@ +SRC_INIT=@src_init@ +NRPE_USER=@nrpe_user@ +NRPE_GROUP=@nrpe_group@ +NAGIOS_USER=@nagios_user@ +NAGIOS_GROUP=@nagios_group@ + + +# Display usage message +usage() { + echo "Usage: $0 [-q] [-p] [-v] progs|config|startup|user|group|script|all" + echo " Optional args:" + echo " -q Do not print what is happening" + echo " -p Prompt for each action" + echo " -v Be a little more verbose about what is happening" + echo " One or more of the following are required:" + echo " progs Delete the program files" + echo " config Delete configuration file(s)" + echo " startup Delete startup files (inetd, init, etc.)" + echo " user Delete the users" + echo " group Delete the groups" + echo " script Delete this uninstall script" + echo " all Do all of the above" + exit 1 +} + +get_opts() { + while test $# -gt 0 ; do + arg=$1 + shift + case "$arg" in + -q) quiet=1 ;; + -p) prompt=1 ;; + progs) progs=1 ;; + config) config=1 ;; + startup) start=1 ;; + user) delusr=1; ;; + group) delgrp=1; ;; + script) delscpt=1; ;; + -v) verb=1; force=""; redir=0 ;; + all) progs=1; config=1; start=1; delusr=1; delgrp=1; delscpt=1 ;; + *) echo "Invalid argument: $arg"; usage ;; + esac + done + + if test $prompt -eq 1 -a $quiet -eq 1 ; then + echo "The -p and -q flags are mutually exclusive" + echo Please specify one or the other + exit 1 + fi + if test $verb -eq 1 -a $quiet -eq 1 ; then + echo "The -v and -q flags are mutually exclusive" + echo Please specify one or the other + exit 1 + fi + if test $progs -eq 0 -a $config -eq 0 -a $start -eq 0 ; then + usage + fi +} + +prt_msg() { + if test $quiet -eq 1 ; then + return 0 + fi + + case $1 in + 0) indent="" ;; + 1) indent=" " ;; + 2) indent=" " ;; + *) indent="" ;; + esac + shift + + if test $1 -eq 1 -a $verb -eq 0 -a $prompt -eq 0 ; then + return 0 + fi + shift + + if test $1 -eq 1 -a $prompt -eq 1 ; then + shift + echo -n "${indent}$*" + echo -n "? [Y|n] " + read yn + if test "x$yn" = x -o x$yn = xy -o x$yn = xY ; then + return 0 + else + return 1 + fi + fi + + shift + echo "${indent}$*" + return 0 +} + +rm_progs() { + num=0 + prt_msg 1 0 0 "*** Uninstalling Progs" + + if test -f "$PLUGINSDIR/check_nrpe" ; then + num=1 + prt_msg 2 0 1 "Delete $PLUGINSDIR/check_nrpe" && { + rm $force "$PLUGINSDIR/check_nrpe" + prt_msg 2 1 0 "Remove directory $PLUGINSDIR" + if test $redir -eq 1; then + rmdir "$PLUGINSDIR" 2>/dev/null + else + rmdir "$PLUGINSDIR" + fi + prt_msg 2 1 0 "Remove directory $LIBEXECDIR" + if test $redir -eq 1; then + rmdir "$LIBEXECDIR" 2>/dev/null + else + rmdir "$LIBEXECDIR" + fi + } + fi + + if test -f "$SBINDIR/$NAME" ; then + num=1 + prt_msg 2 0 1 "Delete $SBINDIR/$NAME" && { + rm $force "$SBINDIR/$NAME" + } + fi + + if test -d "$PIDDIR" ; then + num=1 + prt_msg 2 0 1 "Remove directory $PIDDIR" && { + if test $redir -eq 1; then + rmdir "$PIDDIR" 2>/dev/null + else + rmdir "$PIDDIR" + fi + } + fi + + if test $num -eq 0; then + prt_msg 2 0 0 "There was nothing to uninstall" + fi +} + +rm_startup() { + num=0 + prt_msg 1 0 0 "*** Uninstalling Startup" + + if test "$SRC_INETD" != unknown; then + if test "$INETD_TYPE" = inetd; then + rc=`grep -E -q "^\W*$NAME\s+" "$INETD_DIR/$INETD_FILE"` + if test $rc -eq 0; then + num=1 + prt_msg 2 0 1 "($INETD_TYPE) Remove entries from $INETD_DIR/$INETD_FILE" && { + prt_msg 2 1 0 "($INETD_TYPE) Creating temp file: $INETD_DIR/$INETD_FILE.$NAME.unin" + grep -v -q "\W*$NAME\s+" "$INETD_DIR/$INETD_FILE" > "$INETD_DIR/$INETD_FILE.$NAME.unin" + prt_msg 2 1 0 "($INETD_TYPE) Renaming original to: $INETD_DIR/$INETD_FILE.$NAME_save" + mv "$INETD_DIR/$INETD_FILE" "$INETD_DIR/$INETD_FILE.$NAME_save" + prt_msg 2 1 0 "($INETD_TYPE) Renaming $INETD_DIR/$INETD_FILE.unin to $INETD_DIR/$INETD_FILE" + mv "$INETD_DIR/$INETD_FILE.unin" "$INETD_DIR/$INETD_FILE" + prt_msg 2 0 0 "($INETD_TYPE) Old $INETD_DIR/$INETD_FILE saved as $INETD_DIR/$INETD_FILE.$NAME_save" + } + fi + elif test -f "$INETD_DIR/$INETD_FILE"; then + num=1 + if test "$INETD_TYPE" != xinetd; then + prt_msg 2 0 1 "($INETD_TYPE) Stop and disable $NAME)" && { + case "$INETD_TYPE" in + systemd) + systemctl stop $NAME; systemctl disable $NAME + ;; + upstart) + if test $verb -eq 1; then + stop $NAME + else + stop $NAME >/dev/null 2>&1 + fi + ;; + launchd) + launchctl unload $INETD_FILE; launchctl remove $INETD_FILE; + ;; + smf*) + svcadm disable -s $NAME + ;; + esac + } + fi + prt_msg 2 0 1 "($INETD_TYPE) Delete $INETD_DIR/$INETD_FILE" && { + rm $force "$INETD_DIR/$INETD_FILE" + if test "$INETD_TYPE" = systemd; then + INETD_FILE=`echo "$INETD_FILE" | sed -e 's/socket$/service/'` + prt_msg 2 0 1 "($INETD_TYPE) Delete $INETD_DIR/$INETD_FILE" && { + rm $force "$INETD_DIR/$INETD_FILE" + } + elif test "$INETD_TYPE" = smf10 -o "$INETD_TYPE" = smf11; then + prt_msg 2 0 1 "($INIT_TYPE) svcadm restart svc:/system/manifest-import" && { + svcadm restart svc:/system/manifest-import + } + fi + } + fi + fi + + if test "$SRC_INIT" != unknown; then + if test -f "$INIT_DIR/$INIT_FILE"; then + num=1 + prt_msg 2 0 1 "($INIT_TYPE) Stop and disable $NAME" && { + case "$INIT_TYPE" in + systemd) + systemctl stop $NAME; systemctl disable $NAME + ;; + upstart) + if test $verb -eq 1; then + stop $NAME + else + stop $NAME >/dev/null 2>&1 + fi + ;; + launchd) + launchctl unload $INIT_FILE; launchctl remove $INIT_FILE; + ;; + *bsd) + if test -x $INIT_DIR/$INIT_FILE ; then + $INIT_DIR/$INIT_FILE stop + fi + chmod 0644 $INIT_DIR/$INIT_FILE + ;; + openrc|gentoo) + /sbin/start-stop-daemon --stop $NAME + /sbin/rc-update del $NAME + ;; + smf*) + svcadm disable -s $NAME + ;; + sysv) + service stop $NAME; chkconfig --del $NAME + ;; + esac + } + prt_msg 2 0 1 "($INIT_TYPE) Delete $INIT_DIR/$INIT_FILE" && { + rm $force "$INIT_DIR/$INIT_FILE" + if test ${OPSYS} = bsd; then + prt_msg 2 0 1 "($INITD_TYPE) Remove entries from $INETD_DIR/rc.conf" && { + prt_msg 2 1 0 "($INIT_TYPE) Creating temp file: $INETD_DIR/rc.conf.$NAME.unin" + grep -v -q "^$NAME" "$INETD_DIR/rc.conf" > "$INETD_DIR/rc.conf.$NAME.unin" + prt_msg 2 1 0 "($INIT_TYPE) Renaming original to: $INETD_DIR/rc.conf.$NAME_save" + mv "$INETD_DIR/rc.conf" "$INETD_DIR/rc.conf.$NAME_save" + prt_msg 2 1 0 "($INIT_TYPE) Renaming $INETD_DIR/rc.conf.unin to $INETD_DIR/rc.conf" + mv "$INETD_DIR/rc.conf.unin" "$INETD_DIR/rc.conf" + prt_msg 2 0 0 "($INIT_TYPE) Old $INETD_DIR/rc.conf saved as $INETD_DIR/rc.conf.$NAME_save" + } + fi + if test $INIT_TYPE = upstart; then + prt_msg 2 0 1 "($INIT_TYPE) initctl reload-configuration" && { + initctl reload-configuration + } + elif test "$INIT_TYPE" = smf10 -o "$INIT_TYPE" = smf11; then + prt_msg 2 0 1 "($INIT_TYPE) svcadm restart svc:/system/manifest-import" && { + svcadm restart svc:/system/manifest-import + } + fi + } + fi + fi + + if test $num -eq 0; then + prt_msg 2 0 0 "There was nothing to uninstall" + fi +} + +rm_config() { + num=0 + prt_msg 1 0 0 "*** Uninstalling Config" + + if test -f "$CFGDIR/$NAME.cfg"; then + num=1 + prt_msg 2 0 1 "Delete $CFGDIR/$NAME.cfg" || return + rm $force "$CFGDIR/$NAME.cfg" + prt_msg 2 1 0 "Removing directory $CFGDIR" + if test $redir -eq 1; then + rmdir "$CFGDIR" 2>/dev/null + else + rmdir "$CFGDIR" + fi + fi + + if test $num -eq 0; then + prt_msg 2 0 0 "There was nothing to uninstall" + fi +} + +rm_user() { + prt_msg 1 0 0 "*** Removing users" + prt_msg 2 0 1 "Delete nrpe user:${NRPE_USER} and nagios user:${NAGIOS_USER}" || return + + if test ${OPSYS} = aix; then + if test $redir -eq 1; then + rmuser -p ${NRPE_USER} 2>/dev/null + rmuser -p ${NAGIOS_USER} 2>/dev/null + else + rmuser -p ${NRPE_USER} + rmuser -p ${NAGIOS_USER} + fi + elif test ${OPSYS} = osx; then + dscl . -delete /Groups/${NRPE_GROUP} GroupMembership ${NRPE_USER} + dscl . -delete /Users name ${NRPE_USER} + dscl . -delete /Groups/${NAGIOS_GROUP} GroupMembership ${NAGIOS_USER} + dscl . -delete /Users name ${NAGIOS_USER} + elif test ${DIST} = "freebsd"; then + if test $redir -eq 1; then + pw del user ${NRPE_USER} 2>/dev/null + pw del user ${NAGIOS_USER} 2>/dev/null + else + pw del user ${NRPE_USER} + pw del user ${NAGIOS_USER} + fi + else + if test $redir -eq 1; then + userdel -r ${NRPE_USER} 2>/dev/null + userdel -r ${NAGIOS_USER} 2>/dev/null + else + userdel -r ${NRPE_USER} + userdel -r ${NAGIOS_USER} + fi + fi +} + +rm_group() { + prt_msg 1 0 0 "*** Removing groups" + prt_msg 2 0 1 "Delete nrpe group:${NRPE_GROUP} and nagios group:${NAGIOS_GROUP}" || return + + if test ${OPSYS} = aix; then + if test $redir -eq 1; then + rmgroup -p ${NRPE_GROUP} 2>/dev/null + rmgroup -p ${NAGIOS_GROUP} 2>/dev/null + else + rmgroup -p ${NRPE_GROUP} + rmgroup -p ${NAGIOS_GROUP} + fi + elif test ${OPSYS} = osx; then + if test $redir -eq 1; then + dscl . -delete /Groups/${NRPE_GROUP} 2>/dev/null + dscl . -delete /Groups/${NAGIOS_GROUP} 2>/dev/null + else + dscl . -delete /Groups/${NRPE_GROUP} + dscl . -delete /Groups/${NAGIOS_GROUP} + fi + elif test ${DIST} = "freebsd"; then + if test $redir -eq 1; then + pw del group ${NRPE_GROUP} 2>/dev/null + pw del group ${NAGIOS_GROUP} 2>/dev/null + else + pw del group ${NRPE_GROUP} + pw del group ${NAGIOS_GROUP} + fi + else + if test $redir -eq 1; then + groupdel ${NRPE_GROUP} 2>/dev/null + groupdel ${NAGIOS_GROUP} 2>/dev/null + else + groupdel ${NRPE_GROUP} + groupdel ${NAGIOS_GROUP} + fi + fi +} + +rm_script() { + prt_msg 1 0 0 "*** Removing ${myname}" + prt_msg 2 0 1 "Delete ${myname}" || return + + if test $redir -eq 1; then + rm "${myname}" 2>/dev/null + else + rm "${myname}" + fi +} + +get_opts $@ + +prt_msg 0 0 0 "* * * Uninstall Starting * * *" + +if test $progs -eq 1 ; then rm_progs; fi +if test $start -eq 1 ; then rm_startup; fi +if test $config -eq 1 ; then rm_config; fi +if test $delusr -eq 1; then rm_user; fi +if test $delgrp -eq 1; then rm_group; fi +if test $delscpt -eq 1; then rm_script; fi + +prt_msg 0 0 0 "* * * Uninstall Complete * * *" diff --git a/update-cfg.pl b/update-cfg.pl new file mode 100755 index 0000000..dadc0e8 --- /dev/null +++ b/update-cfg.pl @@ -0,0 +1,144 @@ +#! /usr/bin/perl -w + +use strict; + +my ($fname_in, $fname_out); + +if ($#ARGV != 0) { + &usage; +} + +$fname_in = $ARGV[0]; +$fname_out = $fname_in . ".new"; + +if (&check_ssl) { + print "\n'$fname_in' already has some or all of the\n"; + print "new SSL parameters. No processing will be done.\n\n"; + exit 0; +} + +open IN, $fname_in or die "Could not open '$fname_in' for reading: $!\n"; +open OUT, ">$fname_out" or die "Could not open '$fname_out' for writing: $!\n"; + +while () { + print OUT; + &add_ssl if $_ =~ /allow_weak_random_seed/; +} + +print "\nConfig file '$fname_in' was read.\n"; +print "The new SSL comments and parameters were added and the output written to\n"; +print "'$fname_out'\n"; +print "Please check this file for accuracy and rename it when you are satisfied.\n\n"; + +close IN; +close OUT; + +# ========================================================================== + +sub usage +{ + print "\nUsage: update-cfg.pl \n\n"; + print "This perl script will read the nrpe configuration file\n"; + print "specified on the command line, and write out a new file\n"; + print "with the new SSL comments and parameters added.\n\n"; + exit 1; +} + +# -------------------------------------------------------------------------- +# check_ssl checks if the config file already has the ssl parameters +# -------------------------------------------------------------------------- +sub check_ssl +{ + my $has_ssl = 0; + + open IN, $fname_in or die "Could not open '$fname_in' for reading: $!\n"; + + while () { + if ($_ =~ /ssl_version=/ or + $_ =~ /ssl_use_adh=/ or + $_ =~ /ssl_cipher_list=/ or + $_ =~ /ssl_cacert_file=/ or + $_ =~ /ssl_cert_file=/ or + $_ =~ /ssl_privatekey_file=/ or + $_ =~ /ssl_client_certs=/ or + $_ =~ /ssl_logging=/) + { + $has_ssl = 1; + last; + } + } + + close IN; + + return $has_ssl; +} + +# -------------------------------------------------------------------------- +# add_ssl inserts the new SSL comments and parameters into the config file +# -------------------------------------------------------------------------- +sub add_ssl +{ +my $txt = <<"END_SSL"; + + + +# SSL/TLS OPTIONS +# These directives allow you to specify how to use SSL/TLS. + +# SSL VERSION +# This can be any of: SSLv2 (only use SSLv2), SSLv2+ (use any version), +# SSLv3 (only use SSLv3), SSLv3+ (use SSLv3 or above), TLSv1 (only use +# TLSv1), TLSv1+ (use TLSv1 or above), TLSv1.1 (only use TLSv1.1), +# TLSv1.1+ (use TLSv1.1 or above), TLSv1.2 (only use TLSv1.2), +# TLSv1.2+ (use TLSv1.2 or above) +# If an "or above" version is used, the best will be negotiated. So if both +# ends are able to do TLSv1.2 and use specify SSLv2, you will get TLSv1.2. + +#ssl_version=SSLv2+ + +# SSL USE ADH +# This is for backward compatibility and is DEPRECATED. Set to 1 to enable +# ADH or 2 to require ADH. 1 is currently the default but will be changed +# in a later version. + +#ssl_use_adh=1 + +# SSL CIPHER LIST +# This lists which ciphers can be used. For backward compatibility, this +# defaults to 'ssl_cipher_list=ALL:!MD5:\@STRENGTH' in this version but +# will be changed to something like the example below in a later version of NRPE. + +#ssl_cipher_list=ALL:!MD5:\@STRENGTH +#ssl_cipher_list=ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!RC4:!MD5:\@STRENGTH + +# SSL Certificate and Private Key Files + +#ssl_cacert_file=/etc/ssl/servercerts/ca-cert.pem +#ssl_cert_file=/etc/ssl/servercerts/nagios-cert.pem +#ssl_privatekey_file=/etc/ssl/servercerts/nagios-key.pem + +# SSL USE CLIENT CERTS +# This options determines client certificate usage. +# Values: 0 = Don't ask for or require client certificates (default) +# 1 = Ask for client certificates +# 2 = Require client certificates + +#ssl_client_certs=0 + +# SSL LOGGING +# This option determines which SSL messages are send to syslog. OR values +# together to specify multiple options. + +# Values: 0x00 (0) = No additional logging (default) +# 0x01 (1) = Log startup SSL/TLS parameters +# 0x02 (2) = Log remote IP address +# 0x04 (4) = Log SSL/TLS version of connections +# 0x08 (8) = Log which cipher is being used for the connection +# 0x10 (26) = Log if client has a certificate +# 0x20 (32) = Log details of client's certificate if it has one +# -1 or 0xff or 0x2f = All of the above + +#ssl_logging=0x00 +END_SSL + print OUT $txt; +} diff --git a/update-version b/update-version index 0f6e2c1..aa93696 100755 --- a/update-version +++ b/update-version @@ -28,10 +28,10 @@ else fi # Current version number -CURRENTVERSION=2.15 +CURRENTVERSION=3.0.1 # Last date -LASTDATE=09-06-2013 +LASTDATE=09-08-2016 if [ "x$1" = "x" ] then @@ -55,18 +55,18 @@ then fi # Update version number and release date in common code -perl -i -p -e "s/VERSION \".*\"/VERSION \"$1\"/;" include/common.h -perl -i -p -e "s/MODIFICATION_DATE \".*\"/MODIFICATION_DATE \"$SHORTDATE\"/;" include/common.h -perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" include/common.h +perl -i -p -e "s/VERSION \".*\"/VERSION \"$1\"/;" include/common.h.in +perl -i -p -e "s/MODIFICATION_DATE \".*\"/MODIFICATION_DATE \"$SHORTDATE\"/;" include/common.h.in +perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" include/common.h.in # Update version number and release date in main code perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/nrpe.c perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/check_nrpe.c # Update version number and release date in configure.in -perl -i -p -e "if( /^AC_INIT/) { s/$CURRENTVERSION/$1/; }" configure.in -perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$1\"/;" configure.in -perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure.in +perl -i -p -e "if( /^AC_INIT/) { s/$CURRENTVERSION/$1/; }" configure.ac +perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$1\"/;" configure.ac +perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure.ac # Run autoconf to update configure (this is easier than updating every instance # of the version number in configure)