From f5ee755dfb02caeb2980c4912517ed2eb6213e6b Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 9 Sep 2015 10:12:49 -0500 Subject: [PATCH 01/73] Probable fix for ndo2db not responding & growing queue issue --- .gitignore | 10 +++++++++ Changelog | 1 + src/ndo2db.c | 59 ++++++++++++++++++++++++---------------------------- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index c0eea8e..e62c240 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,13 @@ include/dh.h src/Makefile subst CVS/ +src/*.o +src/file2sock +src/log2ndo +src/ndo2db-2x +src/ndo2db-3x +src/ndo2db-4x +src/sockdebug +config/*.cfg +config/*.cfg-sample +nbproject/ diff --git a/Changelog b/Changelog index f88af14..b635921 100644 --- a/Changelog +++ b/Changelog @@ -5,6 +5,7 @@ NDO Utils Changelog ------------------ * Replaced ndomod.cfg data_processing_options variable with single options for easier customization (See README) (Mike Guthrie) * Added missing maintenance options for table trimming (Mike Guthrie) +* Probable fix for ndo2db not responding & growing queue issue (John Frickson) 1.5.2 - 06/08/2012 ------------------ diff --git a/src/ndo2db.c b/src/ndo2db.c index c023d26..20e566f 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -1213,6 +1213,10 @@ int ndo2db_check_for_client_input(ndo2db_idi *idi,ndo_dbuf *dbuf){ /* asynchronous handle clients events */ void ndo2db_async_client_handle() { ndo2db_idi idi; + size_t len = 0, curlen, insz, maxbuf = 1024 * 64, bufsz = 1024 * 66; + int i; + char *buf = (char*)calloc(bufsz, sizeof(char)); + char *temp_buf; /* initialize input data information */ ndo2db_idi_init(&idi); @@ -1223,55 +1227,46 @@ void ndo2db_async_client_handle() { get_queue_id(getppid()); - char *old_buf = NULL; - for (;;) { char * qbuf = pop_from_queue(); - char *buf; - char * temp_buf; - int i, start=0; - - if (old_buf != NULL) { - buf = (char*)calloc(strlen(qbuf)+strlen(old_buf)+2, sizeof(char)); - strcat(buf, old_buf); - strcat(buf, qbuf); + ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Queue Message: %s\n", qbuf); - free(old_buf); old_buf = NULL; - free(qbuf); - } else { - buf = qbuf; - } + insz = strlen(qbuf); + curlen = len + insz; + strcat(buf, qbuf); + free(qbuf); - for (i=0; i<=strlen(buf); i++) { + i = 0; + for ( ; i < curlen; i++) { if (buf[i] == '\n') { - int size = i-start; - temp_buf = (char*)calloc(size+1, sizeof(char)); - strncpy(temp_buf, &buf[start], size); - temp_buf[size] = '\x0'; + temp_buf = (char*)malloc((curlen + 4) * sizeof(char)); + strncpy(temp_buf, buf, i); + temp_buf[i] = '\x0'; ndo2db_handle_client_input(&idi,temp_buf); + memmove(buf, &buf[i+1], bufsz - i); + len = 0; + curlen = strlen(buf); free(temp_buf); - start=i+1; - idi.lines_processed++; - idi.bytes_processed+=size+1; + idi.bytes_processed += i+1; + i = -1; } } - if (start <= strlen(buf)) { - old_buf = (char*)calloc(strlen(&buf[start])+1, sizeof(char)); - strcpy(old_buf, &buf[start]); - } - - free(buf); + len = curlen; + if (len > maxbuf) { + buf[maxbuf+1] = 0; + len = curlen = maxbuf; + ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Truncating text at position %d - %s\n", maxbuf+1, &buf[maxbuf+2]); + } else if (len == 0) + memset(buf, 0, bufsz * sizeof(char)); } - if (old_buf != NULL) { - free(old_buf); - } + free(buf); /* disconnect from database */ ndo2db_db_disconnect(&idi); From d9feeee128f0e9eef89242d8c7abbd4c29837f5c Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 7 Oct 2015 16:36:14 -0500 Subject: [PATCH 02/73] Reserved identifier violation Standardization of header fenced per http://tracker.nagios.org/view.php?id=326 --- include/common.h | 4 ++-- include/db.h | 4 ++-- include/dbhandlers.h | 4 ++-- include/io.h | 4 ++-- include/nagios-4x/broker.h | 4 ++-- include/nagios-4x/cgiauth.h | 4 ++-- include/nagios-4x/cgiutils.h | 4 ++-- include/nagios-4x/comments.h | 4 ++-- include/nagios-4x/common.h | 6 +++--- include/nagios-4x/defaults.h | 6 +++--- include/nagios-4x/downtime.h | 4 ++-- include/nagios-4x/lib/dkhash.h | 6 +++--- include/nagios-4x/lib/fanout.h | 4 ++-- include/nagios-4x/lib/iobroker.h | 4 ++-- include/nagios-4x/lib/iocache.h | 4 ++-- include/nagios-4x/lib/kvvec.h | 4 ++-- include/nagios-4x/lib/libnagios.h | 4 ++-- include/nagios-4x/lib/lnag-utils.h | 4 ++-- include/nagios-4x/lib/nsock.h | 6 +++--- include/nagios-4x/lib/nspath.h | 4 ++-- include/nagios-4x/lib/nsutils.h | 6 +++--- include/nagios-4x/lib/pqueue.h | 4 ++-- include/nagios-4x/lib/runcmd.h | 4 ++-- include/nagios-4x/lib/skiplist.h | 4 ++-- include/nagios-4x/lib/squeue.h | 4 ++-- include/nagios-4x/lib/t-utils.h | 4 ++-- include/nagios-4x/lib/worker.h | 4 ++-- include/nagios-4x/logging.h | 4 ++-- include/nagios-4x/macros.h | 4 ++-- include/nagios-4x/nagios.h | 4 ++-- include/nagios-4x/nebcallbacks.h | 4 ++-- include/nagios-4x/neberrors.h | 4 ++-- include/nagios-4x/nebmods.h | 4 ++-- include/nagios-4x/nebmodules.h | 4 ++-- include/nagios-4x/nebstructs.h | 4 ++-- include/nagios-4x/netutils.h | 4 ++-- include/nagios-4x/objects.h | 4 ++-- include/nagios-4x/perfdata.h | 4 ++-- include/nagios-4x/shared.h | 4 ++-- include/nagios-4x/statusdata.h | 4 ++-- include/nagios-4x/workers.h | 4 ++-- include/ndo2db.h | 4 ++-- include/ndomod.h | 4 ++-- include/protoapi.h | 4 ++-- include/queue.h | 6 +++--- include/utils.h | 4 ++-- src/ndo2db.c | 4 ++++ 47 files changed, 102 insertions(+), 98 deletions(-) diff --git a/include/common.h b/include/common.h index 4fe19f5..b306edd 100644 --- a/include/common.h +++ b/include/common.h @@ -6,8 +6,8 @@ * ************************************************************************/ -#ifndef _NDO_COMMON_H -#define _NDO_COMMON_H +#ifndef NDO_COMMON_H_INCLUDED +#define NDO_COMMON_H_INCLUDED diff --git a/include/db.h b/include/db.h index d05ff8f..daddc64 100644 --- a/include/db.h +++ b/include/db.h @@ -6,8 +6,8 @@ * ************************************************************************/ -#ifndef _NDO2DB_DB_H -#define _NDO2DB_DB_H +#ifndef NDO2DB_DB_H_INCLUDED +#define NDO2DB_DB_H_INCLUDED #include "config.h" #include "ndo2db.h" diff --git a/include/dbhandlers.h b/include/dbhandlers.h index 3605bb4..e41c5f6 100644 --- a/include/dbhandlers.h +++ b/include/dbhandlers.h @@ -6,8 +6,8 @@ * ************************************************************************/ -#ifndef _NDO2DB_DBHANDLERS_H -#define _NDO2DB_DBHANDLERS_H +#ifndef NDO2DB_DBHANDLERS_H_INCLUDED +#define NDO2DB_DBHANDLERS_H_INCLUDED #include "ndo2db.h" #define NAGIOS_SIZEOF_ARRAY(var) (sizeof(var)/sizeof(var[0])) diff --git a/include/io.h b/include/io.h index 0103007..e35cdec 100644 --- a/include/io.h +++ b/include/io.h @@ -6,8 +6,8 @@ * ************************************************************************/ -#ifndef _NDO_IO_H -#define _NDO_IO_H +#ifndef NDO_IO_H_INCLUDED +#define NDO_IO_H_INCLUDED #include "config.h" diff --git a/include/nagios-4x/broker.h b/include/nagios-4x/broker.h index 3c339be..a868d56 100644 --- a/include/nagios-4x/broker.h +++ b/include/nagios-4x/broker.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef _BROKER_H -#define _BROKER_H +#ifndef NAGIOS_BROKER_H_INCLUDED +#define NAGIOS_BROKER_H_INCLUDED #include "nagios.h" diff --git a/include/nagios-4x/cgiauth.h b/include/nagios-4x/cgiauth.h index cb96656..3216e44 100644 --- a/include/nagios-4x/cgiauth.h +++ b/include/nagios-4x/cgiauth.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef _AUTH_H -#define _AUTH_H +#ifndef NAGIOS_CGIAUTH_H_INCLUDED +#define NAGIOS_CGIAUTH_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/include/nagios-4x/cgiutils.h b/include/nagios-4x/cgiutils.h index 6bfbe9b..768edff 100644 --- a/include/nagios-4x/cgiutils.h +++ b/include/nagios-4x/cgiutils.h @@ -18,8 +18,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************************************************************/ -#ifndef _CGIUTILS_H -#define _CGIUTILS_H +#ifndef NAGIOS_CGIUTILS_H_INCLUDED +#define NAGIOS_CGIUTILS_H_INCLUDED #include "lib/libnagios.h" #include "logging.h" #include "objects.h" diff --git a/include/nagios-4x/comments.h b/include/nagios-4x/comments.h index cc4f658..ce077c7 100644 --- a/include/nagios-4x/comments.h +++ b/include/nagios-4x/comments.h @@ -21,8 +21,8 @@ *****************************************************************************/ -#ifndef _COMMENTS_H -#define _COMMENTS_H +#ifndef NAGIOS_COMMENTS_H_INCLUDED +#define NAGIOS_COMMENTS_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/include/nagios-4x/common.h b/include/nagios-4x/common.h index 5d3cc5a..5230bab 100644 --- a/include/nagios-4x/common.h +++ b/include/nagios-4x/common.h @@ -19,8 +19,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************************************************************/ -#ifndef INCLUDE_COMMON_H -#define INCLUDE_COMMON_H +#ifndef NAGIOS_COMMON_H_INCLUDED +#define NAGIOS_COMMON_H_INCLUDED #include "shared.h" @@ -527,4 +527,4 @@ extern const char *cmd_error_strerror(int error_code); #define MODATTR_CHECK_TIMEPERIOD 16384 #define MODATTR_CUSTOM_VARIABLE 32768 #define MODATTR_NOTIFICATION_TIMEPERIOD 65536 -#endif /* INCLUDE_COMMON_H */ +#endif /* NAGIOS_COMMON_H_INCLUDED */ diff --git a/include/nagios-4x/defaults.h b/include/nagios-4x/defaults.h index b043775..a9aa606 100644 --- a/include/nagios-4x/defaults.h +++ b/include/nagios-4x/defaults.h @@ -1,5 +1,5 @@ -#ifndef INCLUDE_defaults_h__ -#define INCLUDE_defaults_h__ +#ifndef NDO_DEFAULTS_H_INCLUDED +#define NDO_DEFAULTS_H_INCLUDED /******************* DEFAULT VALUES *******************/ @@ -91,4 +91,4 @@ #define DEFAULT_HOST_PERFDATA_PROCESS_EMPTY_RESULTS 1 #define DEFAULT_SERVICE_PERFDATA_PROCESS_EMPTY_RESULTS 1 -#endif /* INCLUDE_defaults_h__ */ +#endif /* NDO_DEFAULTS_H_INCLUDED */ diff --git a/include/nagios-4x/downtime.h b/include/nagios-4x/downtime.h index fafcaf8..b8e476d 100644 --- a/include/nagios-4x/downtime.h +++ b/include/nagios-4x/downtime.h @@ -21,8 +21,8 @@ *****************************************************************************/ -#ifndef _DOWNTIME_H -#define _DOWNTIME_H +#ifndef NDO_DOWNTIME_H_INCLUDED +#define NDO_DOWNTIME_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/include/nagios-4x/lib/dkhash.h b/include/nagios-4x/lib/dkhash.h index e7ae798..b2e1ff3 100644 --- a/include/nagios-4x/lib/dkhash.h +++ b/include/nagios-4x/lib/dkhash.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_dkhash_h__ -#define LIBNAGIOS_dkhash_h__ +#ifndef LIBNAGIOS_DKHASH_H_INCLUDED +#define LIBNAGIOS_DKHASH_H_INCLUDED #include /** @@ -131,4 +131,4 @@ extern unsigned int dkhash_num_entries_removed(dkhash_table *t); */ extern unsigned int dkhash_table_size(dkhash_table *t); /** @} */ -#endif /* LIBNAGIOS_dkhash_h__ */ +#endif /* LIBNAGIOS_DKHASH_H_INCLUDED */ diff --git a/include/nagios-4x/lib/fanout.h b/include/nagios-4x/lib/fanout.h index 4a072e5..6f12634 100644 --- a/include/nagios-4x/lib/fanout.h +++ b/include/nagios-4x/lib/fanout.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_fanout_h__ -#define LIBNAGIOS_fanout_h__ +#ifndef LIBNAGIOS_FANOUT_H_INCLUDED +#define LIBNAGIOS_FANOUT_H_INCLUDED #include "lnag-utils.h" /** diff --git a/include/nagios-4x/lib/iobroker.h b/include/nagios-4x/lib/iobroker.h index c1eb850..6a68a45 100644 --- a/include/nagios-4x/lib/iobroker.h +++ b/include/nagios-4x/lib/iobroker.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_iobroker_h__ -#define LIBNAGIOS_iobroker_h__ +#ifndef LIBNAGIOS_IOBROKER_H_INCLUDED +#define LIBNAGIOS_IOBROKER_H_INCLUDED /** * @file iobroker.h diff --git a/include/nagios-4x/lib/iocache.h b/include/nagios-4x/lib/iocache.h index 3b040c1..821acca 100644 --- a/include/nagios-4x/lib/iocache.h +++ b/include/nagios-4x/lib/iocache.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_iocache_h__ -#define LIBNAGIOS_iocache_h__ +#ifndef LIBNAGIOS_IOCACHE_H_INCLUDED +#define LIBNAGIOS_IOCACHE_H_INCLUDED #include #include #include diff --git a/include/nagios-4x/lib/kvvec.h b/include/nagios-4x/lib/kvvec.h index 5b693cf..49be959 100644 --- a/include/nagios-4x/lib/kvvec.h +++ b/include/nagios-4x/lib/kvvec.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_kvvec_h__ -#define LIBNAGIOS_kvvec_h__ +#ifndef LIBNAGIOS_KVVEC_H_INCLUDED +#define LIBNAGIOS_KVVEC_H_INCLUDED /** * @file kvvec.h diff --git a/include/nagios-4x/lib/libnagios.h b/include/nagios-4x/lib/libnagios.h index fc7eb47..a00dfe3 100644 --- a/include/nagios-4x/lib/libnagios.h +++ b/include/nagios-4x/lib/libnagios.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_libnagios_h__ -#define LIBNAGIOS_libnagios_h__ +#ifndef LIBNAGIOS_LIBNAGIOS_H_INCLUDED +#define LIBNAGIOS_LIBNAGIOS_H_INCLUDED /** * @file libnagios.h * diff --git a/include/nagios-4x/lib/lnag-utils.h b/include/nagios-4x/lib/lnag-utils.h index 7158044..443025e 100644 --- a/include/nagios-4x/lib/lnag-utils.h +++ b/include/nagios-4x/lib/lnag-utils.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_lnag_utils_h__ -#define LIBNAGIOS_lnag_utils_h__ +#ifndef LIBNAGIOS_LNAG_UTILS_H_INCLUDED +#define LIBNAGIOS_LNAG_UTILS_H_INCLUDED #include /* for sysconf() */ #include /* for rand() */ diff --git a/include/nagios-4x/lib/nsock.h b/include/nagios-4x/lib/nsock.h index 115ae56..4902971 100644 --- a/include/nagios-4x/lib/nsock.h +++ b/include/nagios-4x/lib/nsock.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_nsock_h__ -#define LIBNAGIOS_nsock_h__ +#ifndef LIBNAGIOS_NSOCK_H_INCLUDED +#define LIBNAGIOS_NSOCK_H_INCLUDED #include /** @@ -73,4 +73,4 @@ extern int nsock_printf(int sd, const char *fmt, ...) __attribute__((__format__(__printf__, 2, 3))); /** @} */ -#endif /* LIBNAGIOS_nsock_h__ */ +#endif /* LIBNAGIOS_NSOCK_H_INCLUDED */ diff --git a/include/nagios-4x/lib/nspath.h b/include/nagios-4x/lib/nspath.h index 7c5fd54..ba0be1b 100644 --- a/include/nagios-4x/lib/nspath.h +++ b/include/nagios-4x/lib/nspath.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_nspath_h__ -#define LIBNAGIOS_nspath_h__ +#ifndef LIBNAGIOS_NSPATH_H_INCLUDED +#define LIBNAGIOS_NSPATH_H_INCLUDED #ifndef _GNU_SOURCE # ifndef NODOXY # define _GNU_SOURCE 1 diff --git a/include/nagios-4x/lib/nsutils.h b/include/nagios-4x/lib/nsutils.h index 553a4e3..e5e5d17 100644 --- a/include/nagios-4x/lib/nsutils.h +++ b/include/nagios-4x/lib/nsutils.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_nsutils_h__ -#define LIBNAGIOS_nsutils_h__ +#ifndef LIBNAGIOS_NSUTILS_H_INCLUDED +#define LIBNAGIOS_NSUTILS_H_INCLUDED #include /** @@ -101,4 +101,4 @@ extern int tv_delta_msec(const struct timeval *start, const struct timeval *stop extern float tv_delta_f(const struct timeval *start, const struct timeval *stop); /** @} */ -#endif /* LIBNAGIOS_nsutils_h__ */ +#endif /* LIBNAGIOS_NSUTILS_H_INCLUDED */ diff --git a/include/nagios-4x/lib/pqueue.h b/include/nagios-4x/lib/pqueue.h index a944cf3..c017762 100644 --- a/include/nagios-4x/lib/pqueue.h +++ b/include/nagios-4x/lib/pqueue.h @@ -14,8 +14,8 @@ * License for the specific language governing permissions and limitations under * the License. */ -#ifndef LIBNAGIOS_pqueue_h__ -#define LIBNAGIOS_pqueue_h__ +#ifndef LIBNAGIOS_PQUEUE_H_INCLUDED +#define LIBNAGIOS_PQUEUE_H_INCLUDED #include /** diff --git a/include/nagios-4x/lib/runcmd.h b/include/nagios-4x/lib/runcmd.h index 5bda3d1..aaf2f7d 100644 --- a/include/nagios-4x/lib/runcmd.h +++ b/include/nagios-4x/lib/runcmd.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_runcmd_h__ -#define LIBNAGIOS_runcmd_h__ +#ifndef NDO_LIBNAGIOS_RUNCMD_H_INCLUDED +#define NDO_LIBNAGIOS_RUNCMD_H_INCLUDED #include /** diff --git a/include/nagios-4x/lib/skiplist.h b/include/nagios-4x/lib/skiplist.h index 72ea4a7..17d49e7 100644 --- a/include/nagios-4x/lib/skiplist.h +++ b/include/nagios-4x/lib/skiplist.h @@ -19,8 +19,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************************************************************/ -#ifndef LIBNAGIOS_skiplist_h__ -#define LIBNAGIOS_skiplist_h__ +#ifndef LIBNAGIOS_SKIPLIST_H_INCLUDED +#define LIBNAGIOS_SKIPLIST_H_INCLUDED #include "lnag-utils.h" /** diff --git a/include/nagios-4x/lib/squeue.h b/include/nagios-4x/lib/squeue.h index 47695b4..0b83a47 100644 --- a/include/nagios-4x/lib/squeue.h +++ b/include/nagios-4x/lib/squeue.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_squeue_h__ -#define LIBNAGIOS_squeue_h__ +#ifndef LIBNAGIOS_SQUEUE_H_INCLUDED +#define LIBNAGIOS_SQUEUE_H_INCLUDED #include #include #include "pqueue.h" diff --git a/include/nagios-4x/lib/t-utils.h b/include/nagios-4x/lib/t-utils.h index 8f5b50a..eee2a1e 100644 --- a/include/nagios-4x/lib/t-utils.h +++ b/include/nagios-4x/lib/t-utils.h @@ -1,5 +1,5 @@ -#ifndef INCLUDE_test_utils_h__ -#define INCLUDE_test_utils_h__ +#ifndef NDO_T_UTILS_H_INCLUDED +#define NDO_T_UTILS_H_INCLUDED #include #include #include diff --git a/include/nagios-4x/lib/worker.h b/include/nagios-4x/lib/worker.h index dd69b41..b6a8062 100644 --- a/include/nagios-4x/lib/worker.h +++ b/include/nagios-4x/lib/worker.h @@ -1,5 +1,5 @@ -#ifndef LIBNAGIOS_worker_h__ -#define LIBNAGIOS_worker_h__ +#ifndef LIBNAGIOS_WORKER_H_INCLUDED +#define LIBNAGIOS_WORKER_H_INCLUDED #include #include #include diff --git a/include/nagios-4x/logging.h b/include/nagios-4x/logging.h index 49b97dc..a900cbc 100644 --- a/include/nagios-4x/logging.h +++ b/include/nagios-4x/logging.h @@ -1,5 +1,5 @@ -#ifndef INCLUDE_logging_h__ -#define INCLUDE_logging_h__ +#ifndef NDO_LOGGING_H_INCLUDED +#define NDO_LOGGING_H_INCLUDED #include "objects.h" diff --git a/include/nagios-4x/macros.h b/include/nagios-4x/macros.h index 3f5c0aa..6879820 100644 --- a/include/nagios-4x/macros.h +++ b/include/nagios-4x/macros.h @@ -19,8 +19,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************************************************************/ -#ifndef _MACROS_H -#define _MACROS_H +#ifndef NDO_MACROS_H_INCLUDED +#define NDO_MACROS_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/include/nagios-4x/nagios.h b/include/nagios-4x/nagios.h index 62b33cb..6b8e6e8 100644 --- a/include/nagios-4x/nagios.h +++ b/include/nagios-4x/nagios.h @@ -17,8 +17,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************************************************************/ -#ifndef _NAGIOS_H -#define _NAGIOS_H +#ifndef NDO_NAGIOS_H_INCLUDED +#define NDO_NAGIOS_H_INCLUDED #ifndef NSCORE # define NSCORE diff --git a/include/nagios-4x/nebcallbacks.h b/include/nagios-4x/nebcallbacks.h index 9360fb6..45aabf1 100644 --- a/include/nagios-4x/nebcallbacks.h +++ b/include/nagios-4x/nebcallbacks.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef _NEBCALLBACKS_H -#define _NEBCALLBACKS_H +#ifndef NDO_NEBCALLBACKS_H_INCLUDED +#define NDO_NEBCALLBACKS_H_INCLUDED #include "nebmodules.h" diff --git a/include/nagios-4x/neberrors.h b/include/nagios-4x/neberrors.h index bd876a6..e27fadd 100644 --- a/include/nagios-4x/neberrors.h +++ b/include/nagios-4x/neberrors.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef _NEBERRORS_H -#define _NEBERRORS_H +#ifndef NDO_NEBERRORS_H_INCLUDED +#define NDO_NEBERRORS_H_INCLUDED /***** GENERIC DEFINES *****/ diff --git a/include/nagios-4x/nebmods.h b/include/nagios-4x/nebmods.h index 3f69167..74e6267 100644 --- a/include/nagios-4x/nebmods.h +++ b/include/nagios-4x/nebmods.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef _NEBMODS_H -#define _NEBMODS_H +#ifndef NDO_NEBMODS_H_INCLUDED +#define NDO_NEBMODS_H_INCLUDED #include "nebcallbacks.h" #include "nebmodules.h" diff --git a/include/nagios-4x/nebmodules.h b/include/nagios-4x/nebmodules.h index 259ed5c..54ad948 100644 --- a/include/nagios-4x/nebmodules.h +++ b/include/nagios-4x/nebmodules.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef _NEBMODULES_H -#define _NEBMODULES_H +#ifndef NDO_NEBMODULES_H_INCLUDED +#define NDO_NEBMODULES_H_INCLUDED #include "common.h" NAGIOS_BEGIN_DECL diff --git a/include/nagios-4x/nebstructs.h b/include/nagios-4x/nebstructs.h index e598bc7..c14d46e 100644 --- a/include/nagios-4x/nebstructs.h +++ b/include/nagios-4x/nebstructs.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef _NEBSTRUCTS_H -#define _NEBSTRUCTS_H +#ifndef NDO_NEBSTRUCTS_H_INCLUDED +#define NDO_NEBSTRUCTS_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/include/nagios-4x/netutils.h b/include/nagios-4x/netutils.h index 1c723ae..f9b1768 100644 --- a/include/nagios-4x/netutils.h +++ b/include/nagios-4x/netutils.h @@ -1,5 +1,5 @@ -#ifndef _NETUTILS_H -#define _NETUTILS_H +#ifndef NDO_NETUGILS_H_INCLUDED +#define NDO_NETUGILS_H_INCLUDED #include "common.h" NAGIOS_BEGIN_DECL int my_tcp_connect(const char *host_name, int port, int *sd, int timeout); diff --git a/include/nagios-4x/objects.h b/include/nagios-4x/objects.h index 0ea7634..cf315f2 100644 --- a/include/nagios-4x/objects.h +++ b/include/nagios-4x/objects.h @@ -21,8 +21,8 @@ *****************************************************************************/ -#ifndef _OBJECTS_H -#define _OBJECTS_H +#ifndef NDO_OBJECTS_H_INCLUDED +#define NDO_OBJECTS_H_INCLUDED #include "common.h" diff --git a/include/nagios-4x/perfdata.h b/include/nagios-4x/perfdata.h index 484849f..ee9db7c 100644 --- a/include/nagios-4x/perfdata.h +++ b/include/nagios-4x/perfdata.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef _PERFDATA_H -#define _PERFDATA_H +#ifndef NDO_PERFDATA_H_INCLUDED +#define NDO_PERFDATA_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/include/nagios-4x/shared.h b/include/nagios-4x/shared.h index 2c0bc28..a05afb0 100644 --- a/include/nagios-4x/shared.h +++ b/include/nagios-4x/shared.h @@ -1,5 +1,5 @@ -#ifndef INCLUDE__shared_h__ -#define INCLUDE__shared_h__ +#ifndef NDO_SHARED_H_INCLUDED +#define NDO_SHARED_H_INCLUDED #include #include "lib/libnagios.h" diff --git a/include/nagios-4x/statusdata.h b/include/nagios-4x/statusdata.h index bc2ea08..ede17ec 100644 --- a/include/nagios-4x/statusdata.h +++ b/include/nagios-4x/statusdata.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef _STATUSDATA_H -#define _STATUSDATA_H +#ifndef NDO_STATUSDATA_H_INCLUDED +#define NDO_STATUSDATA_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/include/nagios-4x/workers.h b/include/nagios-4x/workers.h index b11229b..58ce344 100644 --- a/include/nagios-4x/workers.h +++ b/include/nagios-4x/workers.h @@ -1,5 +1,5 @@ -#ifndef INCLUDE_workers_h__ -#define INCLUDE_workers_h__ +#ifndef INCLUDE_WORKERS_H_INCLUDED +#define INCLUDE_WORKERS_H_INCLUDED #include "lib/libnagios.h" #include "lib/worker.h" #include "nagios.h" /* for check_result definition */ diff --git a/include/ndo2db.h b/include/ndo2db.h index 1c9bdd5..79e3691 100644 --- a/include/ndo2db.h +++ b/include/ndo2db.h @@ -6,8 +6,8 @@ * ************************************************************************/ -#ifndef _NDO2DB_NDO2DB_H -#define _NDO2DB_NDO2DB_H +#ifndef NDO2DB_NDO2DB_H_INCLUDED +#define NDO2DB_NDO2DB_H_INCLUDED #include "config.h" #include "utils.h" diff --git a/include/ndomod.h b/include/ndomod.h index c3a4fd2..7f18b94 100644 --- a/include/ndomod.h +++ b/include/ndomod.h @@ -6,8 +6,8 @@ * ************************************************************************/ -#ifndef _NDBXT_NDOMOD_H -#define _NDBXT_NDOMOD_H +#ifndef NDO_NDOMOD_H_INCLUDED +#define NDO_NDOMOD_H_INCLUDED /* this is needed for access to daemon's internal data */ diff --git a/include/protoapi.h b/include/protoapi.h index 147a6b4..4a53bdf 100644 --- a/include/protoapi.h +++ b/include/protoapi.h @@ -6,8 +6,8 @@ * ************************************************************************/ -#ifndef _NDO_PROTOAPI_H -#define _NDO_PROTOAPI_H +#ifndef NDO_PROTOAPI_H_INCLUDED +#define NDO_PROTOAPI_H_INCLUDED /****************** PROTOCOL VERSION ***************/ diff --git a/include/queue.h b/include/queue.h index 675d5d9..6179b78 100644 --- a/include/queue.h +++ b/include/queue.h @@ -1,5 +1,5 @@ -#ifndef _QUEUE_ -#define _QUEUE_ +#ifndef NDO_QUEUE_H_INCLUDED +#define NDO_QUEUE_H_INCLUDED #define NDO_QUEUE_PATH "." #define NDO_QUEUE_ID 9504 @@ -24,4 +24,4 @@ void push_into_queue(char*); /* get and delete from queue */ char* pop_from_queue(); -#endif /* _QUEUE_ */ +#endif /* NDO_QUEUE_H_INCLUDED */ diff --git a/include/utils.h b/include/utils.h index 20276ab..f149ba8 100644 --- a/include/utils.h +++ b/include/utils.h @@ -9,8 +9,8 @@ * ************************************************************************/ -#ifndef _NDO_UTILS_H -#define _NDO_UTILS_H +#ifndef NDO_UTILS_H_INCLUDED +#define NDO_UTILS_H_INCLUDED /* my_free has been freed from bondage as a function */ #ifdef BUILD_NAGIOS_2X diff --git a/src/ndo2db.c b/src/ndo2db.c index 20e566f..dbf1e21 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -1101,6 +1101,7 @@ int ndo2db_handle_client_connection(int sd){ /* append data we just read to dynamic buffer */ buf[result]='\x0'; + ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Socket Read: %s\n", buf); ndo_dbuf_strcat(&dbuf,buf); /* check for completed lines of input */ @@ -1199,6 +1200,7 @@ int ndo2db_check_for_client_input(ndo2db_idi *idi,ndo_dbuf *dbuf){ if(dbuf->buf==NULL) return NDO_OK; + ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Queueing: %s\n", dbuf->buf); #ifdef DEBUG_NDO2DB2 printf("RAWBUF: %s\n",dbuf->buf); printf(" USED1: %lu, BYTES: %lu, LINES: %lu\n",dbuf->used_size,idi->bytes_processed,idi->lines_processed); @@ -1244,7 +1246,9 @@ void ndo2db_async_client_handle() { strncpy(temp_buf, buf, i); temp_buf[i] = '\x0'; + ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Handling: %s\n", temp_buf); ndo2db_handle_client_input(&idi,temp_buf); + ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Full Buffer: %s\n", buf); memmove(buf, &buf[i+1], bufsz - i); len = 0; From 2c7da3ebf39a925e1edcf6d5711f08e49ccde521 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Thu, 19 Nov 2015 12:30:03 -0600 Subject: [PATCH 03/73] Got rid of uninitialized variable used for sleep() and increased the listen backlog. --- src/ndo2db.c | 20 ++++++++++++++------ src/queue.c | 13 ++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/ndo2db.c b/src/ndo2db.c index dbf1e21..dd419c6 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -840,6 +840,7 @@ int ndo2db_wait_for_connections(void){ struct sockaddr_un client_address_u; struct sockaddr_in client_address_i; socklen_t client_address_length; + static int listen_backlog = INT_MAX; /* TCP socket */ @@ -897,12 +898,19 @@ int ndo2db_wait_for_connections(void){ client_address_length=(socklen_t)sizeof(client_address_u); } - /* listen for connections */ - if((listen(ndo2db_sd,1))){ - perror("Cannot listen on socket"); - ndo2db_cleanup_socket(); - return NDO_ERROR; - } + /* Default the backlog number on listen() to INT_MAX. If INT_MAX fails, + * try using SOMAXCONN (usually 127) and if that fails, return an error */ + for (;;) { + if (listen(ndo2db_sd, listen_backlog)) { + if (listen_backlog == SOMAXCONN) { + perror("Cannot listen on socket"); + ndo2db_cleanup_socket(); + return NDO_ERROR; + } else + listen_backlog = SOMAXCONN; + } + break; + } /* daemonize */ diff --git a/src/queue.c b/src/queue.c index c454d9e..2be999c 100644 --- a/src/queue.c +++ b/src/queue.c @@ -113,7 +113,6 @@ void push_into_queue (char* buf) { msg.type = NDO_MSG_TYPE; zero_string(msg.text, NDO_MAX_MSG_SIZE); struct timespec delay; - int sleep_time; unsigned retrynum = 0; strncpy(msg.text, buf, NDO_MAX_MSG_SIZE-1); @@ -126,22 +125,18 @@ void push_into_queue (char* buf) { if(msgsnd(queue_id, &msg, queue_buff_size, IPC_NOWAIT)==0) break; #ifdef USE_NANOSLEEP - delay.tv_sec=(time_t)sleep_time; - delay.tv_nsec=(long)((sleep_time-(double)delay.tv_sec)*1000000000); + delay.tv_sec = 0; + delay.tv_nsec = 250000000; nanosleep(&delay,NULL); #else - delay.tv_sec=(time_t)sleep_time; - if(delay.tv_sec==0L) - delay.tv_sec=1; - delay.tv_nsec=0L; - sleep((unsigned int)delay.tv_sec); + sleep(1); #endif } if (retrynum < MAX_RETRIES) { syslog(LOG_ERR,"Message sent to queue.\n"); } else { - syslog(LOG_ERR,"Error: max retries exceeded sending message to queue. Kernel queue parameters may neeed to be tuned. See README.\n"); + syslog(LOG_ERR,"Error: max retries exceeded sending message to queue. Kernel queue parameters may need to be tuned. See README.\n"); } } else { From ea55fd4ef019c5dae812903aa342716a7b87e55b Mon Sep 17 00:00:00 2001 From: John Frickson Date: Mon, 30 Nov 2015 14:21:57 -0600 Subject: [PATCH 04/73] ndoutils clears all entries from SQL table Partial fix for https://github.com/NagiosEnterprises/ndoutils/issues/11 --- include/ndo2db.h | 1 + include/ndomod.h | 1 + include/protoapi.h | 4 +- src/dbhandlers.c | 123 ++++++++++++++- src/ndo2db.c | 47 ++++-- src/ndomod.c | 361 +++++++++++++++++++++++++++++++++++---------- 6 files changed, 444 insertions(+), 93 deletions(-) diff --git a/include/ndo2db.h b/include/ndo2db.h index 79e3691..426ecdb 100644 --- a/include/ndo2db.h +++ b/include/ndo2db.h @@ -191,6 +191,7 @@ typedef struct ndo2db_input_data_info_struct{ #define NDO2DB_INPUT_DATA_CONTACTGROUPDEFINITION 72 #define NDO2DB_INPUT_DATA_HOSTEXTINFODEFINITION 73 #define NDO2DB_INPUT_DATA_SERVICEEXTINFODEFINITION 74 +#define NDO2DB_INPUT_DATA_ACTIVEOBJECTSLIST 75 /************* types of config data *************/ diff --git a/include/ndomod.h b/include/ndomod.h index 7f18b94..91aef84 100644 --- a/include/ndomod.h +++ b/include/ndomod.h @@ -102,6 +102,7 @@ int ndomod_deregister_callbacks(void); int ndomod_broker_data(int,void *); int ndomod_write_config(int); +void ndomod_write_active_objects(); int ndomod_write_object_config(int); int ndomod_write_config_files(void); diff --git a/include/protoapi.h b/include/protoapi.h index 4a53bdf..36e0e9f 100644 --- a/include/protoapi.h +++ b/include/protoapi.h @@ -103,11 +103,12 @@ #define NDO_API_CONTACTGROUPDEFINITION 411 #define NDO_API_HOSTEXTINFODEFINITION 412 /* no longer used */ #define NDO_API_SERVICEEXTINFODEFINITION 413 /* no longer used */ +#define NDO_API_ACTIVEOBJECTSLIST 414 /************** COMMON DATA ATTRIBUTES **************/ -#define NDO_MAX_DATA_TYPES 269 +#define NDO_MAX_DATA_TYPES 270 #define NDO_DATA_NONE 0 @@ -390,5 +391,6 @@ #define NDO_DATA_IMPORTANCE 266 #define NDO_DATA_MINIMUMIMPORTANCE 267 #define NDO_DATA_PARENTSERVICE 268 +#define NDO_DATA_ACTIVEOBJECTSTYPE 269 #endif diff --git a/src/dbhandlers.c b/src/dbhandlers.c index 8d43f09..4dcd665 100644 --- a/src/dbhandlers.c +++ b/src/dbhandlers.c @@ -5014,6 +5014,128 @@ int ndo2db_handle_contactgroupdefinition(ndo2db_idi *idi){ return NDO_OK; } +/* + * In this function, we get a list of up to 100 objects, with the object type + * stored in idi->buffered_input[NDO_DATA_ACTIVEOBJECTSTYPE]. The list of + * object names are in the idi->buffered_input with indexes from 1 to 100. + * We generate an UPDATE query to set them all active at one time. + */ +int ndo2db_handle_activeobjectlist(ndo2db_idi *idi) +{ + ndo_dbuf dbuf; + char *buf = NULL, *name1, *name2 = NULL; + int rc, i, object_type, num_objs = 0, sz, first = 1; + + if(idi==NULL) + return NDO_ERROR; + + /* What type of object are we dealing with? */ + ndo2db_convert_string_to_int(idi->buffered_input[NDO_DATA_ACTIVEOBJECTSTYPE], &object_type); + + /* Find out how many objects we're daling with */ + while (idi->buffered_input[num_objs]) + ++num_objs; + + /* Estimate the number of bytes we'll need for the SQL statement */ + sz = ((num_objs * 25) & !0x3ff) | 0x800; + + /* Convert object type into correct value for the table */ + switch (object_type) { + case NDO_API_HOSTDEFINITION: + object_type = NDO2DB_OBJECTTYPE_HOST; + break; + case NDO_API_HOSTGROUPDEFINITION: + object_type = NDO2DB_OBJECTTYPE_HOSTGROUP; + break; + case NDO_API_SERVICEDEFINITION: + object_type = NDO2DB_OBJECTTYPE_SERVICE; + break; + case NDO_API_SERVICEGROUPDEFINITION: + object_type = NDO2DB_OBJECTTYPE_SERVICEGROUP; + break; + case NDO_API_COMMANDDEFINITION: + object_type = NDO2DB_OBJECTTYPE_COMMAND; + break; + case NDO_API_TIMEPERIODDEFINITION: + object_type = NDO2DB_OBJECTTYPE_TIMEPERIOD; + break; + case NDO_API_CONTACTDEFINITION: + object_type = NDO2DB_OBJECTTYPE_CONTACT; + break; + case NDO_API_CONTACTGROUPDEFINITION: + object_type = NDO2DB_OBJECTTYPE_CONTACTGROUP; + break; + default: + return; + } + + ndo_dbuf_init(&dbuf, sz); + + /* Build the first part of the query */ + rc = asprintf( + &buf, "UPDATE %s SET is_active='1' WHERE instance_id='%lu' " + "AND objecttype_id='%d' AND (" + ,ndo2db_db_tablenames[NDO2DB_DBTABLE_OBJECTS], + idi->dbinfo.instance_id, object_type); + if (rc == -1) { + ndo_dbuf_free(&dbuf); + syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); + return; + } + if (ndo_dbuf_strcat(&dbuf, buf) == NDO_ERROR) { + ndo_dbuf_free(&dbuf); + free(buf); + syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); + return; + } + free(buf); + + while (num_objs) { + if (first) + first = 0; + else + ndo_dbuf_strcat(&dbuf, "OR "); + + if (object_type == NDO2DB_OBJECTTYPE_SERVICE) { + name2 = ndo2db_db_escape_string(idi, idi->buffered_input[num_objs--]); + name1 = ndo2db_db_escape_string(idi, idi->buffered_input[num_objs--]); + rc = asprintf(&buf, "(name1='%s' AND name2='%s')", name1, name2); + + } else { + name1 = ndo2db_db_escape_string(idi, idi->buffered_input[num_objs--]); + rc = asprintf(&buf, "name1='%s'", name1); + } + + free(name1); + free(name2); + + if (rc == -1) { + ndo_dbuf_free(&dbuf); + free(buf); + syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); + return; + } + if (ndo_dbuf_strcat(&dbuf, buf) == NDO_ERROR) { + ndo_dbuf_free(&dbuf); + free(buf); + syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); + return; + } + + free(buf); + } + + if (ndo_dbuf_strcat(&dbuf, ")") == NDO_ERROR) { + ndo_dbuf_free(&dbuf); + syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); + return; + } + + rc = ndo2db_db_query(idi, dbuf.buf); + ndo_dbuf_free(&dbuf); + return rc; +} + int ndo2db_save_custom_variables(ndo2db_idi *idi,int table_idx, unsigned long o_id, char *ts ){ char *buf=NULL; char *buf1=NULL; @@ -5084,4 +5206,3 @@ int ndo2db_save_custom_variables(ndo2db_idi *idi,int table_idx, unsigned long o_ } return result; } - diff --git a/src/ndo2db.c b/src/ndo2db.c index dd419c6..f421be4 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -1109,7 +1109,6 @@ int ndo2db_handle_client_connection(int sd){ /* append data we just read to dynamic buffer */ buf[result]='\x0'; - ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Socket Read: %s\n", buf); ndo_dbuf_strcat(&dbuf,buf); /* check for completed lines of input */ @@ -1208,7 +1207,6 @@ int ndo2db_check_for_client_input(ndo2db_idi *idi,ndo_dbuf *dbuf){ if(dbuf->buf==NULL) return NDO_OK; - ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Queueing: %s\n", dbuf->buf); #ifdef DEBUG_NDO2DB2 printf("RAWBUF: %s\n",dbuf->buf); printf(" USED1: %lu, BYTES: %lu, LINES: %lu\n",dbuf->used_size,idi->bytes_processed,idi->lines_processed); @@ -1256,7 +1254,7 @@ void ndo2db_async_client_handle() { ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Handling: %s\n", temp_buf); ndo2db_handle_client_input(&idi,temp_buf); - ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Full Buffer: %s\n", buf); +/* ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2,"Full Buffer: %s\n", buf); */ memmove(buf, &buf[i+1], bufsz - i); len = 0; @@ -1556,6 +1554,11 @@ int ndo2db_handle_client_input(ndo2db_idi *idi, char *buf){ /* deprecated - merged with host definitions */ case NDO_API_SERVICEEXTINFODEFINITION: /* deprecated - merged with service definitions */ + + case NDO_API_ACTIVEOBJECTSLIST: + idi->current_input_data=NDO2DB_INPUT_DATA_ACTIVEOBJECTSLIST; + break; + default: break; } @@ -1592,28 +1595,28 @@ int ndo2db_handle_client_input(ndo2db_idi *idi, char *buf){ else{ /* the data type is out of range - throw it out */ - if(data_type>NDO_MAX_DATA_TYPES){ + if (data_type > NDO_MAX_DATA_TYPES) { #ifdef DEBUG_NDO2DB2 - printf("## DISCARD! LINE: %lu, TYPE: %d, VAL: %s\n",idi->lines_processed,data_type,val); + printf("## DISCARD! LINE: %lu, TYPE: %d, VAL: %s\n",idi->lines_processed,data_type,val); #endif - break; - } + break; + } #ifdef DEBUG_NDO2DB2 printf("LINE: %lu, TYPE: %d, VAL:%s\n",idi->lines_processed,data_type,val); #endif ndo2db_add_input_data_item(idi,data_type,val); - } - } + } + } break; default: break; - } + } return NDO_OK; - } +} int ndo2db_start_input_data(ndo2db_idi *idi){ @@ -1644,6 +1647,23 @@ int ndo2db_add_input_data_item(ndo2db_idi *idi, int type, char *buf){ if(idi==NULL) return NDO_ERROR; + if (idi->current_input_data == NDO2DB_INPUT_DATA_ACTIVEOBJECTSLIST) { + if(buf==NULL) + newbuf=strdup(""); + else + newbuf=strdup(buf); + if (type != NDO_DATA_ACTIVEOBJECTSTYPE) + ndo_unescape_buffer(newbuf); + if(idi->buffered_input[type]!=NULL){ + free(idi->buffered_input[type]); + idi->buffered_input[type]=NULL; + } + /* save buffered item */ + idi->buffered_input[type]=newbuf; + + return NDO_OK; + } + /* escape data if necessary */ switch(type){ @@ -1732,7 +1752,7 @@ int ndo2db_add_input_data_item(ndo2db_idi *idi, int type, char *buf){ else newbuf=strdup(buf); break; - } + } /* check for errors */ if(newbuf==NULL){ @@ -2023,6 +2043,9 @@ int ndo2db_end_input_data(ndo2db_idi *idi){ case NDO2DB_INPUT_DATA_SERVICEEXTINFODEFINITION: /* deprecated - merged with service definitions */ break; + case NDO2DB_INPUT_DATA_ACTIVEOBJECTSLIST: + result = ndo2db_handle_activeobjectlist(idi); + break; default: break; diff --git a/src/ndomod.c b/src/ndomod.c index 872e748..f682d30 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -139,6 +139,14 @@ extern int __nagios_object_structure_version; extern int use_ssl; +#define NDOMOD_FREE_ESC_BUFFERS(ary, num) { \ + int i = num; \ + if (i < 0) \ + i = 0; \ + while (i--) { \ + free(ary[i]); \ + ary[i] = NULL; \ + } } #define DEBUG_NDO 1 @@ -3510,6 +3518,8 @@ int ndomod_write_config(int config_type){ temp_buffer[sizeof(temp_buffer)-1]='\x0'; ndomod_write_to_sink(temp_buffer,NDO_TRUE,NDO_TRUE); + ndomod_write_active_objects(); + /* dump object config info */ result=ndomod_write_object_config(config_type); if(result!=NDO_OK) @@ -3531,8 +3541,258 @@ int ndomod_write_config(int config_type){ } +/************************************************************* + * Get a list of all active objects, so the "is_active" flag * + * can be set on them in batches, instead of one at a time. * + *************************************************************/ +void ndomod_write_active_objects() +{ + command *temp_command; + timeperiod *temp_timeperiod; + contact *temp_contact; + contactgroup *temp_contactgroup; + host *temp_host; + hostgroup *temp_hostgroup; + service *temp_service; + servicegroup *temp_servicegroup; + ndo_dbuf dbuf; + struct ndo_broker_data active_objects[100]; + struct timeval now; + int i, obj_count; + char *name1, *name2; + + gettimeofday(&now,NULL); /* get current time */ + ndo_dbuf_init(&dbuf, 2048); /* initialize dynamic buffer (2KB chunk size) */ + + + active_objects[0].key = NDO_DATA_ACTIVEOBJECTSTYPE; + active_objects[0].datatype = BD_INT; + + active_objects[0].value.integer = NDO_API_COMMANDDEFINITION; + obj_count = 1; + for (temp_command = command_list; temp_command != NULL; temp_command = temp_command->next) { + name1 = ndo_escape_buffer(temp_command->name); + active_objects[obj_count].key = obj_count; + active_objects[obj_count].datatype = BD_STRING; + active_objects[obj_count].value.string = (name1 == NULL) ? "" : name1; + if (++obj_count > 250) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + obj_count = 1; + } + } + if (obj_count > 1) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + } + + + active_objects[0].value.integer = NDO_API_TIMEPERIODDEFINITION; + obj_count = 1; + for (temp_timeperiod = timeperiod_list; temp_timeperiod != NULL; temp_timeperiod = temp_timeperiod->next) { + name1 = ndo_escape_buffer(temp_timeperiod->name); + active_objects[obj_count].key = obj_count; + active_objects[obj_count].datatype = BD_STRING; + active_objects[obj_count].value.string = (name1 == NULL) ? "" : name1; + if (++obj_count > 250) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + obj_count = 1; + } + } + if (obj_count > 1) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + } + + + active_objects[0].value.integer = NDO_API_CONTACTDEFINITION; + obj_count = 1; + for (temp_contact = contact_list; temp_contact != NULL; temp_contact = temp_contact->next) { + name1 = ndo_escape_buffer(temp_contact->name); + active_objects[obj_count].key = obj_count; + active_objects[obj_count].datatype = BD_STRING; + active_objects[obj_count].value.string = (name1 == NULL) ? "" : name1; + if (++obj_count > 250) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + obj_count = 1; + } + } + if (obj_count > 1) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + } + + + active_objects[0].value.integer = NDO_API_CONTACTGROUPDEFINITION; + obj_count = 1; + for (temp_contactgroup = contactgroup_list; temp_contactgroup != NULL; temp_contactgroup = temp_contactgroup->next) { + name1 = ndo_escape_buffer(temp_contactgroup->group_name); + active_objects[obj_count].key = obj_count; + active_objects[obj_count].datatype = BD_STRING; + active_objects[obj_count].value.string = (name1 == NULL) ? "" : name1; + if (++obj_count > 250) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + obj_count = 1; + } + } + if (obj_count > 1) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + } + + + active_objects[0].value.integer = NDO_API_HOSTDEFINITION; + obj_count = 1; + for (temp_host = host_list; temp_host != NULL; temp_host = temp_host->next) { + name1 = ndo_escape_buffer(temp_host->name); + active_objects[obj_count].key = obj_count; + active_objects[obj_count].datatype = BD_STRING; + active_objects[obj_count].value.string = (name1 == NULL) ? "" : name1; + if (++obj_count > 250) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + obj_count = 1; + } + } + if (obj_count > 1) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + } + + + active_objects[0].value.integer = NDO_API_HOSTGROUPDEFINITION; + obj_count = 1; + for (temp_hostgroup = hostgroup_list; temp_hostgroup != NULL; temp_hostgroup = temp_hostgroup->next) { + name1 = ndo_escape_buffer(temp_hostgroup->group_name); + active_objects[obj_count].key = obj_count; + active_objects[obj_count].datatype = BD_STRING; + active_objects[obj_count].value.string = (name1 == NULL) ? "" : name1; + if (++obj_count > 250) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + obj_count = 1; + } + } + if (obj_count > 1) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + } + + + active_objects[0].value.integer = NDO_API_SERVICEDEFINITION; + obj_count = 1; + for (temp_service = service_list; temp_service != NULL; temp_service = temp_service->next) { + name1 = ndo_escape_buffer(temp_service->host_name); + name2 = ndo_escape_buffer(temp_service->description); + active_objects[obj_count].key = obj_count; + active_objects[obj_count].datatype = BD_STRING; + active_objects[obj_count].value.string = (name1 == NULL) ? "" : name1; + ++obj_count; + active_objects[obj_count].key = obj_count; + active_objects[obj_count].datatype = BD_STRING; + active_objects[obj_count].value.string = (name2 == NULL) ? "" : name2; + if (++obj_count > 97) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + obj_count = 1; + } + } + if (obj_count > 1) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + } + + + active_objects[0].value.integer = NDO_API_SERVICEGROUPDEFINITION; + obj_count = 1; + for (temp_servicegroup = servicegroup_list; temp_servicegroup !=NULL ; temp_servicegroup = temp_servicegroup->next) { + name1 = ndo_escape_buffer(temp_servicegroup->group_name); + active_objects[obj_count].key = obj_count; + active_objects[obj_count].datatype = BD_STRING; + active_objects[obj_count].value.string = (name1 == NULL) ? "" : name1; + if (++obj_count > 250) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + obj_count = 1; + } + } + if (obj_count > 1) { + ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, + active_objects, obj_count, TRUE); + ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); + ndo_dbuf_free(&dbuf); + while (--obj_count) + free(active_objects[obj_count].value.string); + } +} + + #define OBJECTCONFIG_ES_ITEMS 16 + /* dumps object configuration data to sink */ int ndomod_write_object_config(int config_type){ char temp_buffer[NDOMOD_MAX_BUFLEN]; @@ -3629,17 +3889,14 @@ int ndomod_write_object_config(int config_type){ TRUE); } + /* free buffers */ + NDOMOD_FREE_ESC_BUFFERS(es, 2); + /* write data to sink */ ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); ndo_dbuf_free(&dbuf); } - /* free buffers */ - for(x=0;xnext){ @@ -3661,6 +3918,8 @@ int ndomod_write_object_config(int config_type){ sizeof(timeperiod_definition[ 0]), FALSE); } + NDOMOD_FREE_ESC_BUFFERS(es, 2); + /* dump timeranges for each day */ for(x=0;x<7;x++){ for(temp_timerange=temp_timeperiod->days[x];temp_timerange!=NULL;temp_timerange=temp_timerange->next){ @@ -3836,8 +4095,7 @@ int ndomod_write_object_config(int config_type){ sizeof(contact_definition[ 0]), FALSE); } - free(es[0]); - es[0]=NULL; + NDOMOD_FREE_ESC_BUFFERS(es, 6); /* dump addresses for each contact */ for(x=0;xnext){ @@ -3905,8 +4159,7 @@ int ndomod_write_object_config(int config_type){ sizeof(contactgroup_definition[ 0]), FALSE); } - free(es[0]); - es[0]=NULL; + NDOMOD_FREE_ESC_BUFFERS(es, 2); /* dump members for each contactgroup */ ndomod_contacts_serialize(temp_contactgroup->members, &dbuf, @@ -3921,10 +4174,7 @@ int ndomod_write_object_config(int config_type){ /* free buffers */ - for(x=0;xnext){ @@ -4203,8 +4453,7 @@ int ndomod_write_object_config(int config_type){ sizeof(host_definition[ 0]), FALSE); } - free(es[0]); - es[0]=NULL; + NDOMOD_FREE_ESC_BUFFERS(es, OBJECTCONFIG_ES_ITEMS); /* dump parent hosts */ ndomod_hosts_serialize(temp_host->parent_hosts, &dbuf, @@ -4232,10 +4481,7 @@ int ndomod_write_object_config(int config_type){ /* free buffers */ - for(x=0;xnext){ @@ -4258,8 +4504,7 @@ int ndomod_write_object_config(int config_type){ sizeof(hostgroup_definition[ 0]), FALSE); } - free(es[0]); - es[0]=NULL; + NDOMOD_FREE_ESC_BUFFERS(es, 2); /* dump members for each hostgroup */ #ifdef BUILD_NAGIOS_2X @@ -4277,13 +4522,6 @@ int ndomod_write_object_config(int config_type){ ndo_dbuf_free(&dbuf); } - - /* free buffers */ - for(x=0;xnext){ @@ -4545,8 +4783,7 @@ int ndomod_write_object_config(int config_type){ sizeof(service_definition[ 0]), FALSE); } - free(es[0]); - es[0]=NULL; + NDOMOD_FREE_ESC_BUFFERS(es, OBJECTCONFIG_ES_ITEMS); #ifdef BUILD_NAGIOS_4X /* dump parent services */ @@ -4576,12 +4813,6 @@ int ndomod_write_object_config(int config_type){ } - /* free buffers */ - for(x=0;xnext){ @@ -4603,10 +4834,7 @@ int ndomod_write_object_config(int config_type){ sizeof(servicegroup_definition[ 0]), FALSE); } - free(es[0]); - free(es[1]); - es[0]=NULL; - es[1]=NULL; + NDOMOD_FREE_ESC_BUFFERS(es, 2); /* dump members for each servicegroup */ ndomod_services_serialize(temp_servicegroup->members, &dbuf, @@ -4620,12 +4848,6 @@ int ndomod_write_object_config(int config_type){ } - /* free buffers */ - for(x=0;xcontact_groups, @@ -4708,12 +4929,6 @@ int ndomod_write_object_config(int config_type){ } - /* free buffers */ - for(x=0;x Date: Mon, 30 Nov 2015 14:47:17 -0600 Subject: [PATCH 05/73] Clean up bad returns --- include/dbhandlers.h | 1 + src/dbhandlers.c | 110 +-- src/ndomod.c | 1504 +++++++++++++++++++++--------------------- src/queue.c | 9 +- 4 files changed, 813 insertions(+), 811 deletions(-) diff --git a/include/dbhandlers.h b/include/dbhandlers.h index e41c5f6..10de523 100644 --- a/include/dbhandlers.h +++ b/include/dbhandlers.h @@ -70,5 +70,6 @@ int ndo2db_handle_commanddefinition(ndo2db_idi *); int ndo2db_handle_timeperiodefinition(ndo2db_idi *); int ndo2db_handle_contactdefinition(ndo2db_idi *); int ndo2db_handle_contactgroupdefinition(ndo2db_idi *); +int ndo2db_handle_activeobjectlist(ndo2db_idi *); int ndo2db_save_custom_variables(ndo2db_idi *,int, unsigned long, char *); #endif diff --git a/src/dbhandlers.c b/src/dbhandlers.c index 4dcd665..7fe0f5a 100644 --- a/src/dbhandlers.c +++ b/src/dbhandlers.c @@ -88,7 +88,7 @@ int ndo2db_get_object_id(ndo2db_idi *idi, int object_type, char *n1, char *n2, u es[0]=ndo2db_db_escape_string(idi,name1); /* HINT: HB 10/27/2009 * BINARY operator is just a MySQL special to provide case sensitive queries - * Think about it in the future if not only MySQL is supported + * Think about it in the future if not only MySQL is supported */ if(asprintf(&buf1,"BINARY name1='%s'",es[0])==-1) buf1=NULL; @@ -103,12 +103,12 @@ int ndo2db_get_object_id(ndo2db_idi *idi, int object_type, char *n1, char *n2, u es[1]=ndo2db_db_escape_string(idi,name2); /* HINT: HB 10/27/2009 * BINARY operator is just a MySQL special to provide case sensitive queries - * Think about it in the future if not only MySQL is supported + * Think about it in the future if not only MySQL is supported */ if(asprintf(&buf2,"BINARY name2='%s'",es[1])==-1) buf2=NULL; } - + if(asprintf(&buf,"SELECT * FROM %s WHERE instance_id='%lu' AND objecttype_id='%d' AND %s AND %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_OBJECTS] ,idi->dbinfo.instance_id @@ -192,7 +192,7 @@ int ndo2db_get_object_id_with_insert(ndo2db_idi *idi, int object_type, char *n1, } else es[1]=NULL; - + if(asprintf(&buf,"INSERT INTO %s SET instance_id='%lu', objecttype_id='%d' %s %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_OBJECTS] ,idi->dbinfo.instance_id @@ -355,7 +355,7 @@ int ndo2db_add_cached_object_id(ndo2db_idi *idi, int object_type, char *n1, char idi->dbinfo.object_hashlist=(ndo2db_dbobject **)malloc(sizeof(ndo2db_dbobject *)*NDO2DB_OBJECT_HASHSLOTS); if(idi->dbinfo.object_hashlist==NULL) return NDO_ERROR; - + for(x=0;xdbinfo.object_hashlist[x]=NULL; } @@ -492,7 +492,7 @@ int ndo2db_set_all_objects_as_inactive(ndo2db_idi *idi){ int ndo2db_set_object_as_active(ndo2db_idi *idi, int object_type, unsigned long object_id){ int result=NDO_OK; char *buf=NULL; - + /* mark the object as being active */ if(asprintf(&buf,"UPDATE %s SET is_active='1' WHERE instance_id='%lu' AND objecttype_id='%d' AND object_id='%lu'" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_OBJECTS] @@ -732,7 +732,7 @@ int ndo2db_handle_processdata(ndo2db_idi *idi){ buf=NULL; result=ndo2db_db_query(idi,buf); free(buf); -#endif +#endif } /* if process is shutting down or restarting, update process status data */ @@ -1393,7 +1393,7 @@ int ndo2db_handle_contactnotificationmethoddata(ndo2db_idi *idi){ ts[0]=ndo2db_db_timet_to_sql(idi,start_time.tv_sec); ts[1]=ndo2db_db_timet_to_sql(idi,end_time.tv_sec); - + /* get the command id */ result=ndo2db_get_object_id_with_insert(idi,NDO2DB_OBJECTTYPE_COMMAND,idi->buffered_input[NDO_DATA_COMMANDNAME],NULL,&command_id); @@ -2893,14 +2893,14 @@ int ndo2db_handle_acknowledgementdata(ndo2db_idi *idi){ ,notify_contacts )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_ACKNOWLEDGEMENTS] ,buf ,buf )==-1) buf1=NULL; - + result=ndo2db_db_query(idi,buf1); free(buf); free(buf1); @@ -3040,7 +3040,7 @@ int ndo2db_handle_configfilevariables(ndo2db_idi *idi, int configfile_type){ ,es[0] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONFIGFILES] ,buf @@ -3085,7 +3085,7 @@ int ndo2db_handle_configfilevariables(ndo2db_idi *idi, int configfile_type){ ,es[2] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONFIGFILEVARIABLES] ,buf @@ -3164,7 +3164,7 @@ int ndo2db_handle_runtimevariables(ndo2db_idi *idi){ ,es[1] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_RUNTIMEVARIABLES] ,buf @@ -3332,13 +3332,13 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){ argptr=strtok(NULL,"\x0"); result=ndo2db_get_object_id_with_insert(idi,NDO2DB_OBJECTTYPE_COMMAND,cmdptr,NULL,&check_command_id); es[2]=ndo2db_db_escape_string(idi,argptr); - + /* get the event handler command */ cmdptr=strtok(idi->buffered_input[NDO_DATA_HOSTEVENTHANDLER],"!"); argptr=strtok(NULL,"\x0"); result=ndo2db_get_object_id_with_insert(idi,NDO2DB_OBJECTTYPE_COMMAND,cmdptr,NULL,&eventhandler_command_id); es[3]=ndo2db_db_escape_string(idi,argptr); - + es[4]=ndo2db_db_escape_string(idi,idi->buffered_input[NDO_DATA_NOTES]); es[5]=ndo2db_db_escape_string(idi,idi->buffered_input[NDO_DATA_NOTESURL]); es[6]=ndo2db_db_escape_string(idi,idi->buffered_input[NDO_DATA_ACTIONURL]); @@ -3426,7 +3426,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){ #endif )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTS] ,buf @@ -3467,7 +3467,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTPARENTHOSTS] ,buf @@ -3496,7 +3496,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTCONTACTGROUPS] ,buf @@ -3525,7 +3525,7 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTCONTACTS] ,buf @@ -3584,7 +3584,7 @@ int ndo2db_handle_hostgroupdefinition(ndo2db_idi *idi){ ,es[0] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTGROUPS] ,buf @@ -3624,7 +3624,7 @@ int ndo2db_handle_hostgroupdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTGROUPMEMBERS] ,buf @@ -3756,13 +3756,13 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){ argptr=strtok(NULL,"\x0"); result=ndo2db_get_object_id_with_insert(idi,NDO2DB_OBJECTTYPE_COMMAND,cmdptr,NULL,&check_command_id); es[1]=ndo2db_db_escape_string(idi,argptr); - + /* get the event handler command */ cmdptr=strtok(idi->buffered_input[NDO_DATA_SERVICEEVENTHANDLER],"!"); argptr=strtok(NULL,"\x0"); result=ndo2db_get_object_id_with_insert(idi,NDO2DB_OBJECTTYPE_COMMAND,cmdptr,NULL,&eventhandler_command_id); es[2]=ndo2db_db_escape_string(idi,argptr); - + es[3]=ndo2db_db_escape_string(idi,idi->buffered_input[NDO_DATA_NOTES]); es[4]=ndo2db_db_escape_string(idi,idi->buffered_input[NDO_DATA_NOTESURL]); es[5]=ndo2db_db_escape_string(idi,idi->buffered_input[NDO_DATA_ACTIONURL]); @@ -3842,7 +3842,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){ #endif )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICES] ,buf @@ -3879,7 +3879,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){ sptr=strtok(NULL,"\x0"); /* get the object id of the member */ - result = ndo2db_get_object_id_with_insert(idi, + result = ndo2db_get_object_id_with_insert(idi, NDO2DB_OBJECTTYPE_SERVICE, hptr, sptr, &member_id); if(asprintf(&buf, @@ -3887,7 +3887,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){ idi->dbinfo.instance_id, service_id, member_id) == -1) { buf = NULL; } - + if(asprintf(&buf1, "INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s", ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICEPARENTSERVICES], buf, buf) == -1) { @@ -3916,7 +3916,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICECONTACTGROUPS] ,buf @@ -3945,7 +3945,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICECONTACTS] ,buf @@ -3957,7 +3957,7 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){ free(buf); free(buf1); } - + /* save custom variables to db */ result=ndo2db_save_custom_variables(idi,NDO2DB_DBTABLE_CUSTOMVARIABLES,object_id,NULL); @@ -4006,7 +4006,7 @@ int ndo2db_handle_servicegroupdefinition(ndo2db_idi *idi){ ,es[0] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICEGROUPS] ,buf @@ -4050,7 +4050,7 @@ int ndo2db_handle_servicegroupdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICEGROUPMEMBERS] ,buf @@ -4118,7 +4118,7 @@ int ndo2db_handle_hostdependencydefinition(ndo2db_idi *idi){ ,fail_on_unreachable )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTDEPENDENCIES] ,buf @@ -4188,7 +4188,7 @@ int ndo2db_handle_servicedependencydefinition(ndo2db_idi *idi){ ,fail_on_critical )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICEDEPENDENCIES] ,buf @@ -4261,7 +4261,7 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){ ,escalate_unreachable )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTESCALATIONS] ,buf @@ -4299,7 +4299,7 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTESCALATIONCONTACTGROUPS] ,buf @@ -4328,7 +4328,7 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTESCALATIONCONTACTS] ,buf @@ -4405,7 +4405,7 @@ int ndo2db_handle_serviceescalationdefinition(ndo2db_idi *idi){ ,escalate_critical )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICEESCALATIONS] ,buf @@ -4443,7 +4443,7 @@ int ndo2db_handle_serviceescalationdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICEESCALATIONCONTACTGROUPS] ,buf @@ -4472,7 +4472,7 @@ int ndo2db_handle_serviceescalationdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICEESCALATIONCONTACTS] ,buf @@ -4525,7 +4525,7 @@ int ndo2db_handle_commanddefinition(ndo2db_idi *idi){ ,es[0] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_COMMANDS] ,buf @@ -4588,7 +4588,7 @@ int ndo2db_handle_timeperiodefinition(ndo2db_idi *idi){ ,es[0] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_TIMEPERIODS] ,buf @@ -4639,7 +4639,7 @@ int ndo2db_handle_timeperiodefinition(ndo2db_idi *idi){ ,end_sec )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_TIMEPERIODTIMERANGES] ,buf @@ -4767,7 +4767,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){ #endif )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTS] ,buf @@ -4815,7 +4815,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){ ,es[0] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTADDRESSES] ,buf @@ -4856,7 +4856,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){ ,(es[0]==NULL)?"":es[0] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTNOTIFICATIONCOMMANDS] ,buf @@ -4897,7 +4897,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){ ,(es[0]==NULL)?"":es[0] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTNOTIFICATIONCOMMANDS] ,buf @@ -4911,7 +4911,7 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){ free(es[0]); } - + /* save custom variables to db */ result=ndo2db_save_custom_variables(idi,NDO2DB_DBTABLE_CUSTOMVARIABLES,contact_id,NULL); @@ -4958,7 +4958,7 @@ int ndo2db_handle_contactgroupdefinition(ndo2db_idi *idi){ ,es[0] )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTGROUPS] ,buf @@ -4998,7 +4998,7 @@ int ndo2db_handle_contactgroupdefinition(ndo2db_idi *idi){ ,member_id )==-1) buf=NULL; - + if(asprintf(&buf1,"INSERT INTO %s SET %s ON DUPLICATE KEY UPDATE %s" ,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTGROUPMEMBERS] ,buf @@ -5066,7 +5066,7 @@ int ndo2db_handle_activeobjectlist(ndo2db_idi *idi) object_type = NDO2DB_OBJECTTYPE_CONTACTGROUP; break; default: - return; + return NDO_ERROR; } ndo_dbuf_init(&dbuf, sz); @@ -5080,13 +5080,13 @@ int ndo2db_handle_activeobjectlist(ndo2db_idi *idi) if (rc == -1) { ndo_dbuf_free(&dbuf); syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); - return; + return NDO_ERROR; } if (ndo_dbuf_strcat(&dbuf, buf) == NDO_ERROR) { ndo_dbuf_free(&dbuf); free(buf); syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); - return; + return NDO_ERROR; } free(buf); @@ -5113,13 +5113,13 @@ int ndo2db_handle_activeobjectlist(ndo2db_idi *idi) ndo_dbuf_free(&dbuf); free(buf); syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); - return; + return NDO_ERROR; } if (ndo_dbuf_strcat(&dbuf, buf) == NDO_ERROR) { ndo_dbuf_free(&dbuf); free(buf); syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); - return; + return NDO_ERROR; } free(buf); @@ -5128,7 +5128,7 @@ int ndo2db_handle_activeobjectlist(ndo2db_idi *idi) if (ndo_dbuf_strcat(&dbuf, ")") == NDO_ERROR) { ndo_dbuf_free(&dbuf); syslog(LOG_ERR, "Error: memory allocation error in ndo2db_handle_activeobjectlist()"); - return; + return NDO_ERROR; } rc = ndo2db_db_query(idi, dbuf.buf); diff --git a/src/ndomod.c b/src/ndomod.c index f682d30..a0d4fcf 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -8,8 +8,8 @@ * First Written: 05-19-2005 * Last Modified: 09-27-2012 * - * TO DO: Add service parents, hourly value (hosts / services), - * minimum value (contacts) + * TO DO: Add service parents, hourly value (hosts / services), + * minimum value (contacts) *****************************************************************************/ /* include our project's header files */ @@ -402,7 +402,7 @@ int ndomod_process_config_file(char *filename){ /* close the file */ ndo_mmap_fclose(thefile); - + return result; } @@ -465,7 +465,7 @@ int ndomod_process_config_var(char *arg){ else if(!strcmp(var,"file_rotation_timeout")) ndomod_sink_rotation_timeout=atoi(val); - /* add bitwise processing opts */ + /* add bitwise processing opts */ else if(!strcmp(var,"process_data") && atoi(val)==1) ndomod_process_options=ndomod_process_options + NDOMOD_PROCESS_PROCESS_DATA; else if(!strcmp(var,"timed_event_data") && atoi(val)==1) @@ -518,8 +518,8 @@ int ndomod_process_config_var(char *arg){ ndomod_process_options+=NDOMOD_PROCESS_CONTACT_STATUS_DATA; else if(!strcmp(var,"adaptive_contact_data") && atoi(val)==1) ndomod_process_options+=NDOMOD_PROCESS_ADAPTIVE_CONTACT_DATA ; - - /* data_processing_options will override individual values if set */ + + /* data_processing_options will override individual values if set */ else if(!strcmp(var,"data_processing_options")){ if(!strcmp(val,"-1")) ndomod_process_options=NDOMOD_PROCESS_EVERYTHING; @@ -540,14 +540,14 @@ int ndomod_process_config_var(char *arg){ else use_ssl = 0; } - } + } - /* new processing options will be skipped if they're set to 0 + /* new processing options will be skipped if they're set to 0 else { - printf("Invalid ndomod config option: %s\n",var); + printf("Invalid ndomod config option: %s\n",var); return NDO_ERROR; - } */ - + } */ + return NDO_OK; } @@ -1143,39 +1143,39 @@ int ndomod_sink_buffer_set_overflow(ndomod_sink_buffer *sbuf, unsigned long num) int ndomod_register_callbacks(void){ int priority=0; int result=NDO_OK; - char *msg=NULL; + char *msg=NULL; - //only register for events that we're going to process + //only register for events that we're going to process if(result==NDO_OK && (ndomod_process_options & NDOMOD_PROCESS_PROCESS_DATA)) { result=neb_register_callback(NEBCALLBACK_PROCESS_DATA,ndomod_module_handle,priority,ndomod_broker_data); asprintf(&msg,"ndomod registered for process data\n"); ndomod_write_to_logs(msg,NSLOG_INFO_MESSAGE); - } + } if(result==NDO_OK && (ndomod_process_options & NDOMOD_PROCESS_TIMED_EVENT_DATA)) { result=neb_register_callback(NEBCALLBACK_TIMED_EVENT_DATA,ndomod_module_handle,priority,ndomod_broker_data); asprintf(&msg,"ndomod registered for timed event data\n"); ndomod_write_to_logs(msg,NSLOG_INFO_MESSAGE); - } + } if(result==NDO_OK && (ndomod_process_options & NDOMOD_PROCESS_LOG_DATA)){ result=neb_register_callback(NEBCALLBACK_LOG_DATA,ndomod_module_handle,priority,ndomod_broker_data); asprintf(&msg,"ndomod registered for log data\'"); ndomod_write_to_logs(msg,NSLOG_INFO_MESSAGE); - } + } if(result==NDO_OK && (ndomod_process_options & NDOMOD_PROCESS_SYSTEM_COMMAND_DATA)) { result=neb_register_callback(NEBCALLBACK_SYSTEM_COMMAND_DATA,ndomod_module_handle,priority,ndomod_broker_data); asprintf(&msg,"ndomod registered for system command data\'"); ndomod_write_to_logs(msg,NSLOG_INFO_MESSAGE); - } + } if(result==NDO_OK && (ndomod_process_options & NDOMOD_PROCESS_EVENT_HANDLER_DATA)) { result=neb_register_callback(NEBCALLBACK_EVENT_HANDLER_DATA,ndomod_module_handle,priority,ndomod_broker_data); asprintf(&msg,"ndomod registered for event handler data\'"); ndomod_write_to_logs(msg,NSLOG_INFO_MESSAGE); - } + } if(result==NDO_OK && (ndomod_process_options & NDOMOD_PROCESS_NOTIFICATION_DATA)) { result=neb_register_callback(NEBCALLBACK_NOTIFICATION_DATA,ndomod_module_handle,priority,ndomod_broker_data); asprintf(&msg,"ndomod registered for notification data\'"); ndomod_write_to_logs(msg,NSLOG_INFO_MESSAGE); - } + } if(result==NDO_OK && (ndomod_process_options & NDOMOD_PROCESS_SERVICE_CHECK_DATA)){ result=neb_register_callback(NEBCALLBACK_SERVICE_CHECK_DATA,ndomod_module_handle,priority,ndomod_broker_data); asprintf(&msg,"ndomod registered for service check data\'"); @@ -1279,7 +1279,7 @@ int ndomod_register_callbacks(void){ } #endif - free(msg); + free(msg); return result; } @@ -1346,13 +1346,13 @@ static void ndomod_broker_data_serialize(ndo_dbuf *dbufp, int datatype, for(x = 0, bdp = bd; x < bdsize; x++, bdp++) { switch(bdp->datatype) { case BD_INT: - snprintf(temp, sizeof(temp)-1, "\n%d=%d", bdp->key, + snprintf(temp, sizeof(temp)-1, "\n%d=%d", bdp->key, bdp->value.integer); temp[sizeof(temp)-1]='\x0'; ndo_dbuf_strcat(dbufp, temp); break; case BD_TIMEVAL: - snprintf(temp, sizeof(temp)-1, "\n%d=%ld.%ld", bdp->key, + snprintf(temp, sizeof(temp)-1, "\n%d=%ld.%ld", bdp->key, bdp->value.timestamp.tv_sec, bdp->value.timestamp.tv_usec); temp[sizeof(temp)-1]='\x0'; ndo_dbuf_strcat(dbufp, temp); @@ -1364,13 +1364,13 @@ static void ndomod_broker_data_serialize(ndo_dbuf *dbufp, int datatype, ndo_dbuf_strcat(dbufp, bdp->value.string); break; case BD_UNSIGNED_LONG: - snprintf(temp, sizeof(temp)-1, "\n%d=%lu", bdp->key, + snprintf(temp, sizeof(temp)-1, "\n%d=%lu", bdp->key, bdp->value.unsigned_long); temp[sizeof(temp)-1]='\x0'; ndo_dbuf_strcat(dbufp, temp); break; case BD_FLOAT: - snprintf(temp, sizeof(temp)-1, "\n%d=%.5lf", bdp->key, + snprintf(temp, sizeof(temp)-1, "\n%d=%.5lf", bdp->key, bdp->value.floating_point); temp[sizeof(temp)-1]='\x0'; ndo_dbuf_strcat(dbufp, temp); @@ -1402,7 +1402,7 @@ static void ndomod_customvars_serialize(customvariablesmember *customvars, snprintf(temp_buffer, sizeof(temp_buffer)-1, "\n%d=%s:%d:%s", NDO_DATA_CUSTOMVARIABLE, (NULL == cvname) ? "" : cvname, - temp_customvar->has_been_modified, + temp_customvar->has_been_modified, (NULL == cvvalue ) ? "" : cvvalue); temp_buffer[sizeof(temp_buffer)-1] = '\x0'; @@ -1416,18 +1416,18 @@ static void ndomod_customvars_serialize(customvariablesmember *customvars, static void ndomod_contactgroups_serialize(contactgroupsmember *contactgroups, ndo_dbuf *dbufp) { - + contactgroupsmember *temp_contactgroupsmember = NULL; char *groupname; char temp_buffer[NDOMOD_MAX_BUFLEN]; - for(temp_contactgroupsmember = contactgroups; + for(temp_contactgroupsmember = contactgroups; temp_contactgroupsmember != NULL; temp_contactgroupsmember = temp_contactgroupsmember->next) { groupname = ndo_escape_buffer(temp_contactgroupsmember->group_name); - snprintf(temp_buffer, sizeof(temp_buffer)-1,"\n%d=%s", + snprintf(temp_buffer, sizeof(temp_buffer)-1,"\n%d=%s", NDO_DATA_CONTACTGROUP ,(NULL == groupname) ? "" : groupname); temp_buffer[sizeof(temp_buffer)-1] = '\x0'; ndo_dbuf_strcat(dbufp, temp_buffer); @@ -1449,7 +1449,7 @@ static void ndomod_contacts_serialize(contactgroupmember *contacts, contact_name = ndo_escape_buffer(temp_contactgroupmember->contact_name); - snprintf(temp_buffer, sizeof(temp_buffer)-1, "\n%d=%s", varnum, + snprintf(temp_buffer, sizeof(temp_buffer)-1, "\n%d=%s", varnum, (NULL == contact_name) ? "" : contact_name); temp_buffer[sizeof(temp_buffer)-1] = '\x0'; ndo_dbuf_strcat(dbufp, temp_buffer); @@ -1471,7 +1471,7 @@ static void ndomod_contacts_serialize(contactsmember *contacts, contact_name = ndo_escape_buffer(temp_contactsmember->contact_name); - snprintf(temp_buffer, sizeof(temp_buffer)-1, "\n%d=%s", varnum, + snprintf(temp_buffer, sizeof(temp_buffer)-1, "\n%d=%s", varnum, (NULL == contact_name) ? "" : contact_name); temp_buffer[sizeof(temp_buffer)-1] = '\x0'; ndo_dbuf_strcat(dbufp, temp_buffer); @@ -1482,7 +1482,7 @@ static void ndomod_contacts_serialize(contactsmember *contacts, #endif #ifdef BUILD_NAGIOS_2X -static void ndomod_hosts_serialize_2x(hostgroupmember *hosts, ndo_dbuf *dbufp, +static void ndomod_hosts_serialize_2x(hostgroupmember *hosts, ndo_dbuf *dbufp, int varnum) { hostgroupmember *temp_hostgroupmember=NULL; @@ -1504,7 +1504,7 @@ static void ndomod_hosts_serialize_2x(hostgroupmember *hosts, ndo_dbuf *dbufp, } #endif -static void ndomod_hosts_serialize(hostsmember *hosts, ndo_dbuf *dbufp, +static void ndomod_hosts_serialize(hostsmember *hosts, ndo_dbuf *dbufp, int varnum) { hostsmember *temp_hostsmember = NULL; @@ -1526,7 +1526,7 @@ static void ndomod_hosts_serialize(hostsmember *hosts, ndo_dbuf *dbufp, } #ifdef BUILD_NAGIOS_2X -static void ndomod_services_serialize(servicegroupmember *services, +static void ndomod_services_serialize(servicegroupmember *services, ndo_dbuf *dbufp, int varnum) { servicegroupmember *temp_servicegroupmember = NULL; @@ -1650,7 +1650,7 @@ int ndomod_broker_data(int event_type, void *data){ if(data==NULL) return 0; - + /* should we handle this type of data? */ switch(event_type){ @@ -1786,19 +1786,19 @@ int ndomod_broker_data(int event_type, void *data){ { NDO_DATA_TYPE, BD_INT, { .integer = procdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = procdata->flags }}, { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = procdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = procdata->timestamp }}, { NDO_DATA_PROGRAMNAME, BD_STRING, { .string = "Nagios" }}, - { NDO_DATA_PROGRAMVERSION, BD_STRING, + { NDO_DATA_PROGRAMVERSION, BD_STRING, { .string = get_program_version() }}, - { NDO_DATA_PROGRAMDATE, BD_STRING, + { NDO_DATA_PROGRAMDATE, BD_STRING, { .string = get_program_modification_date() }}, - { NDO_DATA_PROCESSID, BD_UNSIGNED_LONG, + { NDO_DATA_PROCESSID, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)getpid() }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_PROCESSDATA, - process_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_PROCESSDATA, + process_data, sizeof(process_data) / sizeof(process_data[ 0]), TRUE); } @@ -1820,24 +1820,24 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data timed_event_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = eventdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = eventdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = eventdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = eventdata->timestamp }}, - { NDO_DATA_EVENTTYPE, BD_INT, + { NDO_DATA_EVENTTYPE, BD_INT, { .integer = eventdata->event_type }}, - { NDO_DATA_RECURRING, BD_INT, + { NDO_DATA_RECURRING, BD_INT, { .integer = eventdata->recurring }}, - { NDO_DATA_RUNTIME, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_RUNTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)eventdata->run_time }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEDEVENTDATA, - timed_event_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEDEVENTDATA, + timed_event_data, sizeof(timed_event_data) / sizeof(timed_event_data[ 0]), TRUE); } @@ -1853,22 +1853,22 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data timed_event_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = eventdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = eventdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = eventdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = eventdata->timestamp }}, - { NDO_DATA_EVENTTYPE, BD_INT, + { NDO_DATA_EVENTTYPE, BD_INT, { .integer = eventdata->event_type }}, - { NDO_DATA_RECURRING, BD_INT, + { NDO_DATA_RECURRING, BD_INT, { .integer = eventdata->recurring }}, - { NDO_DATA_RUNTIME, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_RUNTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)eventdata->run_time }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEDEVENTDATA, - timed_event_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEDEVENTDATA, + timed_event_data, sizeof(timed_event_data) / sizeof(timed_event_data[ 0]), TRUE); } @@ -1887,24 +1887,24 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data timed_event_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = eventdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = eventdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = eventdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = eventdata->timestamp }}, - { NDO_DATA_EVENTTYPE, BD_INT, + { NDO_DATA_EVENTTYPE, BD_INT, { .integer = eventdata->event_type }}, - { NDO_DATA_RECURRING, BD_INT, + { NDO_DATA_RECURRING, BD_INT, { .integer = eventdata->recurring }}, - { NDO_DATA_RUNTIME, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_RUNTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)eventdata->run_time }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEDEVENTDATA, - timed_event_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEDEVENTDATA, + timed_event_data, sizeof(timed_event_data) / sizeof(timed_event_data[ 0]), TRUE); } @@ -1917,20 +1917,20 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data timed_event_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = eventdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = eventdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = eventdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = eventdata->timestamp }}, - { NDO_DATA_EVENTTYPE, BD_INT, + { NDO_DATA_EVENTTYPE, BD_INT, { .integer = eventdata->event_type }}, - { NDO_DATA_RECURRING, BD_INT, + { NDO_DATA_RECURRING, BD_INT, { .integer = eventdata->recurring }}, - { NDO_DATA_RUNTIME, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_RUNTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)eventdata->run_time }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEDEVENTDATA, - timed_event_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEDEVENTDATA, + timed_event_data, sizeof(timed_event_data) / sizeof(timed_event_data[ 0]), TRUE); } @@ -1948,18 +1948,18 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data log_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = logdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = logdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = logdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = logdata->timestamp }}, - { NDO_DATA_LOGENTRYTIME, BD_UNSIGNED_LONG, + { NDO_DATA_LOGENTRYTIME, BD_UNSIGNED_LONG, { .unsigned_long = logdata->entry_time }}, - { NDO_DATA_LOGENTRYTYPE, BD_INT, + { NDO_DATA_LOGENTRYTYPE, BD_INT, { .integer = logdata->data_type }}, { NDO_DATA_LOGENTRY, BD_STRING, { .string = logdata->data }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_LOGDATA, log_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_LOGDATA, log_data, sizeof(log_data) / sizeof(log_data[ 0]), TRUE); } @@ -1977,31 +1977,31 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data system_command_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = cmddata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = cmddata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = cmddata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = cmddata->timestamp }}, - { NDO_DATA_STARTTIME, BD_TIMEVAL, + { NDO_DATA_STARTTIME, BD_TIMEVAL, { .timestamp = cmddata->start_time }}, - { NDO_DATA_ENDTIME, BD_TIMEVAL, + { NDO_DATA_ENDTIME, BD_TIMEVAL, { .timestamp = cmddata->end_time }}, { NDO_DATA_TIMEOUT, BD_INT, { .integer = cmddata->timeout }}, - { NDO_DATA_COMMANDLINE, BD_STRING, + { NDO_DATA_COMMANDLINE, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_EARLYTIMEOUT, BD_INT, + { NDO_DATA_EARLYTIMEOUT, BD_INT, { .integer = cmddata->early_timeout }}, - { NDO_DATA_EXECUTIONTIME, BD_FLOAT, + { NDO_DATA_EXECUTIONTIME, BD_FLOAT, { .floating_point = cmddata->execution_time }}, - { NDO_DATA_RETURNCODE, BD_INT, + { NDO_DATA_RETURNCODE, BD_INT, { .integer = cmddata->return_code }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_LONGOUTPUT, BD_STRING, + { NDO_DATA_LONGOUTPUT, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_SYSTEMCOMMANDDATA, - system_command_data, sizeof(system_command_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_SYSTEMCOMMANDDATA, + system_command_data, sizeof(system_command_data) / sizeof(system_command_data[ 0]), TRUE); } @@ -2024,42 +2024,42 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data event_handler_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = ehanddata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = ehanddata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = ehanddata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = ehanddata->timestamp }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_STATETYPE, BD_INT, + { NDO_DATA_STATETYPE, BD_INT, { .integer = ehanddata->state_type }}, { NDO_DATA_STATE, BD_INT, { .integer = ehanddata->state }}, - { NDO_DATA_STARTTIME, BD_TIMEVAL, + { NDO_DATA_STARTTIME, BD_TIMEVAL, { .timestamp = ehanddata->start_time }}, - { NDO_DATA_ENDTIME, BD_TIMEVAL, + { NDO_DATA_ENDTIME, BD_TIMEVAL, { .timestamp = ehanddata->end_time }}, { NDO_DATA_TIMEOUT, BD_INT, { .integer = ehanddata->timeout }}, - { NDO_DATA_COMMANDNAME, BD_STRING, + { NDO_DATA_COMMANDNAME, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_COMMANDARGS, BD_STRING, + { NDO_DATA_COMMANDARGS, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_COMMANDLINE, BD_STRING, + { NDO_DATA_COMMANDLINE, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_EARLYTIMEOUT, BD_INT, + { NDO_DATA_EARLYTIMEOUT, BD_INT, { .integer = ehanddata->early_timeout }}, - { NDO_DATA_EXECUTIONTIME, BD_FLOAT, + { NDO_DATA_EXECUTIONTIME, BD_FLOAT, { .floating_point = ehanddata->execution_time }}, - { NDO_DATA_RETURNCODE, BD_INT, + { NDO_DATA_RETURNCODE, BD_INT, { .integer = ehanddata->return_code }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_LONGOUTPUT, BD_STRING, + { NDO_DATA_LONGOUTPUT, BD_STRING, { .string = (es[6]==NULL) ? "" : es[6] }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_EVENTHANDLERDATA, - event_handler_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_EVENTHANDLERDATA, + event_handler_data, sizeof(event_handler_data) / sizeof(event_handler_data[ 0]), TRUE); } @@ -2082,39 +2082,39 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data notification_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = notdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = notdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = notdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = notdata->timestamp }}, - { NDO_DATA_NOTIFICATIONTYPE, BD_INT, + { NDO_DATA_NOTIFICATIONTYPE, BD_INT, { .integer = notdata->notification_type }}, - { NDO_DATA_STARTTIME, BD_TIMEVAL, + { NDO_DATA_STARTTIME, BD_TIMEVAL, { .timestamp = notdata->start_time }}, - { NDO_DATA_ENDTIME, BD_TIMEVAL, + { NDO_DATA_ENDTIME, BD_TIMEVAL, { .timestamp = notdata->end_time }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_NOTIFICATIONREASON, BD_INT, + { NDO_DATA_NOTIFICATIONREASON, BD_INT, { .integer = notdata->reason_type }}, { NDO_DATA_STATE, BD_INT, { .integer = notdata->state }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_LONGOUTPUT, BD_STRING, + { NDO_DATA_LONGOUTPUT, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_ACKAUTHOR, BD_STRING, + { NDO_DATA_ACKAUTHOR, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_ACKDATA, BD_STRING, + { NDO_DATA_ACKDATA, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_ESCALATED, BD_INT, + { NDO_DATA_ESCALATED, BD_INT, { .integer = notdata->escalated }}, - { NDO_DATA_CONTACTSNOTIFIED, BD_INT, + { NDO_DATA_CONTACTSNOTIFIED, BD_INT, { .integer = notdata->contacts_notified }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_NOTIFICATIONDATA, - notification_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_NOTIFICATIONDATA, + notification_data, sizeof(notification_data) / sizeof(notification_data[ 0]), TRUE); } @@ -2122,7 +2122,7 @@ int ndomod_broker_data(int event_type, void *data){ break; case NEBCALLBACK_SERVICE_CHECK_DATA: - + scdata=(nebstruct_service_check_data *)data; /* Nagios XI MOD */ @@ -2145,52 +2145,52 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data service_check_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = scdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = scdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = scdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = scdata->timestamp }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_CHECKTYPE, BD_INT, + { NDO_DATA_CHECKTYPE, BD_INT, { .integer = scdata->check_type }}, - { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, + { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, { .integer = scdata->current_attempt }}, - { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, + { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, { .integer = scdata->max_attempts }}, - { NDO_DATA_STATETYPE, BD_INT, + { NDO_DATA_STATETYPE, BD_INT, { .integer = scdata->state_type }}, { NDO_DATA_STATE, BD_INT, { .integer = scdata->state }}, { NDO_DATA_TIMEOUT, BD_INT, { .integer = scdata->timeout }}, - { NDO_DATA_COMMANDNAME, BD_STRING, + { NDO_DATA_COMMANDNAME, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_COMMANDARGS, BD_STRING, + { NDO_DATA_COMMANDARGS, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_COMMANDLINE, BD_STRING, + { NDO_DATA_COMMANDLINE, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_STARTTIME, BD_TIMEVAL, + { NDO_DATA_STARTTIME, BD_TIMEVAL, { .timestamp = scdata->start_time }}, - { NDO_DATA_ENDTIME, BD_TIMEVAL, + { NDO_DATA_ENDTIME, BD_TIMEVAL, { .timestamp = scdata->end_time }}, - { NDO_DATA_EARLYTIMEOUT, BD_INT, + { NDO_DATA_EARLYTIMEOUT, BD_INT, { .integer = scdata->early_timeout }}, - { NDO_DATA_EXECUTIONTIME, BD_FLOAT, + { NDO_DATA_EXECUTIONTIME, BD_FLOAT, { .floating_point = scdata->execution_time }}, - { NDO_DATA_LATENCY, BD_FLOAT, + { NDO_DATA_LATENCY, BD_FLOAT, { .floating_point = scdata->latency }}, - { NDO_DATA_RETURNCODE, BD_INT, + { NDO_DATA_RETURNCODE, BD_INT, { .integer = scdata->return_code }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_LONGOUTPUT, BD_STRING, + { NDO_DATA_LONGOUTPUT, BD_STRING, { .string = (es[6]==NULL) ? "" : es[6] }}, - { NDO_DATA_PERFDATA, BD_STRING, + { NDO_DATA_PERFDATA, BD_STRING, { .string = (es[7]==NULL) ? "" : es[7] }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_SERVICECHECKDATA, - service_check_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_SERVICECHECKDATA, + service_check_data, sizeof(service_check_data) / sizeof(service_check_data[ 0]), TRUE); } @@ -2220,50 +2220,50 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data host_check_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = hcdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = hcdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = hcdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = hcdata->timestamp }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_CHECKTYPE, BD_INT, + { NDO_DATA_CHECKTYPE, BD_INT, { .integer = hcdata->check_type }}, - { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, + { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, { .integer = hcdata->current_attempt }}, - { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, + { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, { .integer = hcdata->max_attempts }}, - { NDO_DATA_STATETYPE, BD_INT, + { NDO_DATA_STATETYPE, BD_INT, { .integer = hcdata->state_type }}, { NDO_DATA_STATE, BD_INT, { .integer = hcdata->state }}, { NDO_DATA_TIMEOUT, BD_INT, { .integer = hcdata->timeout }}, - { NDO_DATA_COMMANDNAME, BD_STRING, + { NDO_DATA_COMMANDNAME, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_COMMANDARGS, BD_STRING, + { NDO_DATA_COMMANDARGS, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_COMMANDLINE, BD_STRING, + { NDO_DATA_COMMANDLINE, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_STARTTIME, BD_TIMEVAL, + { NDO_DATA_STARTTIME, BD_TIMEVAL, { .timestamp = hcdata->start_time }}, - { NDO_DATA_ENDTIME, BD_TIMEVAL, + { NDO_DATA_ENDTIME, BD_TIMEVAL, { .timestamp = hcdata->end_time }}, - { NDO_DATA_EARLYTIMEOUT, BD_INT, + { NDO_DATA_EARLYTIMEOUT, BD_INT, { .integer = hcdata->early_timeout }}, - { NDO_DATA_EXECUTIONTIME, BD_FLOAT, + { NDO_DATA_EXECUTIONTIME, BD_FLOAT, { .floating_point = hcdata->execution_time }}, - { NDO_DATA_LATENCY, BD_FLOAT, + { NDO_DATA_LATENCY, BD_FLOAT, { .floating_point = hcdata->latency }}, - { NDO_DATA_RETURNCODE, BD_INT, + { NDO_DATA_RETURNCODE, BD_INT, { .integer = hcdata->return_code }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_LONGOUTPUT, BD_STRING, + { NDO_DATA_LONGOUTPUT, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_PERFDATA, BD_STRING, + { NDO_DATA_PERFDATA, BD_STRING, { .string = (es[6]==NULL) ? "" : es[6] }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_HOSTCHECKDATA, - host_check_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_HOSTCHECKDATA, + host_check_data, sizeof(host_check_data) / sizeof(host_check_data[ 0]), TRUE); } @@ -2283,38 +2283,38 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data comment_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = comdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = comdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = comdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = comdata->timestamp }}, - { NDO_DATA_COMMENTTYPE, BD_INT, + { NDO_DATA_COMMENTTYPE, BD_INT, { .integer = comdata->comment_type }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_ENTRYTIME, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_ENTRYTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)comdata->entry_time }}, - { NDO_DATA_AUTHORNAME, BD_STRING, + { NDO_DATA_AUTHORNAME, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_COMMENT, BD_STRING, + { NDO_DATA_COMMENT, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_PERSISTENT, BD_INT, + { NDO_DATA_PERSISTENT, BD_INT, { .integer = comdata->persistent }}, - { NDO_DATA_SOURCE, BD_INT, + { NDO_DATA_SOURCE, BD_INT, { .integer = comdata->source }}, - { NDO_DATA_ENTRYTYPE, BD_INT, + { NDO_DATA_ENTRYTYPE, BD_INT, { .integer = comdata->entry_type }}, - { NDO_DATA_EXPIRES, BD_INT, + { NDO_DATA_EXPIRES, BD_INT, { .integer = comdata->expires }}, - { NDO_DATA_EXPIRATIONTIME, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_EXPIRATIONTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)comdata->expire_time }}, - { NDO_DATA_COMMENTID, BD_UNSIGNED_LONG, + { NDO_DATA_COMMENTID, BD_UNSIGNED_LONG, { .unsigned_long = comdata->comment_id }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_COMMENTDATA, - comment_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_COMMENTDATA, + comment_data, sizeof(comment_data) / sizeof(comment_data[ 0]), TRUE); } @@ -2333,37 +2333,37 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data downtime_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = downdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = downdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = downdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = downdata->timestamp }}, - { NDO_DATA_DOWNTIMETYPE, BD_INT, + { NDO_DATA_DOWNTIMETYPE, BD_INT, { .integer = downdata->downtime_type }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_ENTRYTIME, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_ENTRYTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)downdata->entry_time }}, - { NDO_DATA_AUTHORNAME, BD_STRING, + { NDO_DATA_AUTHORNAME, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_COMMENT, BD_STRING, + { NDO_DATA_COMMENT, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_STARTTIME, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_STARTTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)downdata->start_time }}, - { NDO_DATA_ENDTIME, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_ENDTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)downdata->end_time }}, { NDO_DATA_FIXED, BD_INT, { .integer = downdata->fixed }}, - { NDO_DATA_DURATION, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_DURATION, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)downdata->duration }}, - { NDO_DATA_TRIGGEREDBY, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_TRIGGEREDBY, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)downdata->triggered_by }}, - { NDO_DATA_DOWNTIMEID, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_DOWNTIMEID, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)downdata->downtime_id }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_DOWNTIMEDATA, - downtime_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_DOWNTIMEDATA, + downtime_data, sizeof(downtime_data) / sizeof(downtime_data[ 0]), TRUE); } @@ -2385,31 +2385,31 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data flapping_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = flapdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = flapdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = flapdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = flapdata->timestamp }}, - { NDO_DATA_FLAPPINGTYPE, BD_INT, + { NDO_DATA_FLAPPINGTYPE, BD_INT, { .integer = flapdata->flapping_type }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_PERCENTSTATECHANGE, BD_FLOAT, + { NDO_DATA_PERCENTSTATECHANGE, BD_FLOAT, { .floating_point = flapdata->percent_change }}, - { NDO_DATA_HIGHTHRESHOLD, BD_FLOAT, + { NDO_DATA_HIGHTHRESHOLD, BD_FLOAT, { .floating_point = flapdata->high_threshold }}, - { NDO_DATA_LOWTHRESHOLD, BD_FLOAT, + { NDO_DATA_LOWTHRESHOLD, BD_FLOAT, { .floating_point = flapdata->low_threshold }}, - { NDO_DATA_COMMENTTIME, BD_UNSIGNED_LONG, { .unsigned_long = - (temp_comment==NULL) ? 0L : + { NDO_DATA_COMMENTTIME, BD_UNSIGNED_LONG, { .unsigned_long = + (temp_comment==NULL) ? 0L : (unsigned long)temp_comment->entry_time }}, - { NDO_DATA_COMMENTID, BD_UNSIGNED_LONG, + { NDO_DATA_COMMENTID, BD_UNSIGNED_LONG, { .unsigned_long = flapdata->comment_id }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_FLAPPINGDATA, - flapping_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_FLAPPINGDATA, + flapping_data, sizeof(flapping_data) / sizeof(flapping_data[ 0]), TRUE); } @@ -2426,68 +2426,68 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data program_status_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = psdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = psdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = psdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = psdata->timestamp }}, - { NDO_DATA_PROGRAMSTARTTIME, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_PROGRAMSTARTTIME, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)psdata->program_start }}, - { NDO_DATA_PROCESSID, BD_INT, + { NDO_DATA_PROCESSID, BD_INT, { .integer = psdata->pid }}, - { NDO_DATA_DAEMONMODE, BD_INT, + { NDO_DATA_DAEMONMODE, BD_INT, { .integer = psdata->daemon_mode }}, - { NDO_DATA_LASTCOMMANDCHECK, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTCOMMANDCHECK, BD_UNSIGNED_LONG, + { .unsigned_long = #ifdef BUILD_NAGIOS_4X 0L #else (unsigned long)psdata->last_command_check #endif }}, - { NDO_DATA_LASTLOGROTATION, BD_UNSIGNED_LONG, + { NDO_DATA_LASTLOGROTATION, BD_UNSIGNED_LONG, { .unsigned_long = psdata->last_log_rotation }}, - { NDO_DATA_NOTIFICATIONSENABLED, BD_INT, + { NDO_DATA_NOTIFICATIONSENABLED, BD_INT, { .integer = psdata->notifications_enabled }}, - { NDO_DATA_ACTIVESERVICECHECKSENABLED, BD_INT, + { NDO_DATA_ACTIVESERVICECHECKSENABLED, BD_INT, { .integer = psdata->active_service_checks_enabled }}, - { NDO_DATA_PASSIVESERVICECHECKSENABLED, BD_INT, + { NDO_DATA_PASSIVESERVICECHECKSENABLED, BD_INT, { .integer = psdata->passive_service_checks_enabled }}, - { NDO_DATA_ACTIVEHOSTCHECKSENABLED, BD_INT, + { NDO_DATA_ACTIVEHOSTCHECKSENABLED, BD_INT, { .integer = psdata->active_host_checks_enabled }}, - { NDO_DATA_PASSIVEHOSTCHECKSENABLED, BD_INT, + { NDO_DATA_PASSIVEHOSTCHECKSENABLED, BD_INT, { .integer = psdata->passive_host_checks_enabled }}, - { NDO_DATA_EVENTHANDLERSENABLED, BD_INT, + { NDO_DATA_EVENTHANDLERSENABLED, BD_INT, { .integer = psdata->event_handlers_enabled }}, - { NDO_DATA_FLAPDETECTIONENABLED, BD_INT, + { NDO_DATA_FLAPDETECTIONENABLED, BD_INT, { .integer = psdata->flap_detection_enabled }}, - { NDO_DATA_FAILUREPREDICTIONENABLED, BD_INT, { .integer = + { NDO_DATA_FAILUREPREDICTIONENABLED, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X 0L #else psdata->failure_prediction_enabled #endif }}, - { NDO_DATA_PROCESSPERFORMANCEDATA, BD_INT, + { NDO_DATA_PROCESSPERFORMANCEDATA, BD_INT, { .integer = psdata->process_performance_data }}, - { NDO_DATA_OBSESSOVERHOSTS, BD_INT, + { NDO_DATA_OBSESSOVERHOSTS, BD_INT, { .integer = psdata->obsess_over_hosts }}, - { NDO_DATA_OBSESSOVERSERVICES, BD_INT, + { NDO_DATA_OBSESSOVERSERVICES, BD_INT, { .integer = psdata->obsess_over_services }}, - { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, { .unsigned_long = psdata->modified_host_attributes }}, - { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, + { .unsigned_long = psdata->modified_service_attributes }}, - { NDO_DATA_GLOBALHOSTEVENTHANDLER, BD_STRING, + { NDO_DATA_GLOBALHOSTEVENTHANDLER, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_GLOBALSERVICEEVENTHANDLER, BD_STRING, + { NDO_DATA_GLOBALSERVICEEVENTHANDLER, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_PROGRAMSTATUSDATA, - program_status_data, - sizeof(program_status_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_PROGRAMSTATUSDATA, + program_status_data, + sizeof(program_status_data) / sizeof(program_status_data[ 0]), TRUE); } @@ -2527,54 +2527,54 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data host_status_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = hsdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = hsdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = hsdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = hsdata->timestamp }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_LONGOUTPUT, BD_STRING, + { NDO_DATA_LONGOUTPUT, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_PERFDATA, BD_STRING, + { NDO_DATA_PERFDATA, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_CURRENTSTATE, BD_INT, + { NDO_DATA_CURRENTSTATE, BD_INT, { .integer = temp_host->current_state }}, - { NDO_DATA_HASBEENCHECKED, BD_INT, + { NDO_DATA_HASBEENCHECKED, BD_INT, { .integer = temp_host->has_been_checked }}, - { NDO_DATA_SHOULDBESCHEDULED, BD_INT, + { NDO_DATA_SHOULDBESCHEDULED, BD_INT, { .integer = temp_host->should_be_scheduled }}, - { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, + { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, { .integer = temp_host->current_attempt }}, - { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, + { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, { .integer = temp_host->max_attempts }}, - { NDO_DATA_LASTHOSTCHECK, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_LASTHOSTCHECK, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)temp_host->last_check }}, - { NDO_DATA_NEXTHOSTCHECK, BD_UNSIGNED_LONG, { .unsigned_long = + { NDO_DATA_NEXTHOSTCHECK, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)temp_host->next_check }}, - { NDO_DATA_CHECKTYPE, BD_INT, + { NDO_DATA_CHECKTYPE, BD_INT, { .integer = temp_host->check_type }}, - { NDO_DATA_LASTSTATECHANGE, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTSTATECHANGE, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_host->last_state_change }}, - { NDO_DATA_LASTHARDSTATECHANGE, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTHARDSTATECHANGE, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_host->last_hard_state_change }}, - { NDO_DATA_LASTHARDSTATE, BD_INT, + { NDO_DATA_LASTHARDSTATE, BD_INT, { .integer = temp_host->last_hard_state }}, - { NDO_DATA_LASTTIMEUP, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTTIMEUP, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_host->last_time_up }}, - { NDO_DATA_LASTTIMEDOWN, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTTIMEDOWN, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_host->last_time_down }}, - { NDO_DATA_LASTTIMEUNREACHABLE, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTTIMEUNREACHABLE, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_host->last_time_unreachable }}, - { NDO_DATA_STATETYPE, BD_INT, + { NDO_DATA_STATETYPE, BD_INT, { .integer = temp_host->state_type }}, - { NDO_DATA_LASTHOSTNOTIFICATION, BD_UNSIGNED_LONG, + { NDO_DATA_LASTHOSTNOTIFICATION, BD_UNSIGNED_LONG, { .unsigned_long = #ifdef BUILD_NAGIOS_4X (unsigned long)temp_host->last_notification @@ -2582,7 +2582,7 @@ int ndomod_broker_data(int event_type, void *data){ (unsigned long)temp_host->last_host_notification #endif }}, - { NDO_DATA_NEXTHOSTNOTIFICATION, BD_UNSIGNED_LONG, + { NDO_DATA_NEXTHOSTNOTIFICATION, BD_UNSIGNED_LONG, { .unsigned_long = #ifdef BUILD_NAGIOS_4X (unsigned long)temp_host->next_notification @@ -2590,18 +2590,18 @@ int ndomod_broker_data(int event_type, void *data){ (unsigned long)temp_host->next_host_notification #endif }}, - { NDO_DATA_NOMORENOTIFICATIONS, BD_INT, + { NDO_DATA_NOMORENOTIFICATIONS, BD_INT, { .integer = temp_host->no_more_notifications }}, - { NDO_DATA_NOTIFICATIONSENABLED, BD_INT, + { NDO_DATA_NOTIFICATIONSENABLED, BD_INT, { .integer = temp_host->notifications_enabled }}, - { NDO_DATA_PROBLEMHASBEENACKNOWLEDGED, BD_INT, - { .integer = + { NDO_DATA_PROBLEMHASBEENACKNOWLEDGED, BD_INT, + { .integer = temp_host->problem_has_been_acknowledged }}, - { NDO_DATA_ACKNOWLEDGEMENTTYPE, BD_INT, + { NDO_DATA_ACKNOWLEDGEMENTTYPE, BD_INT, { .integer = temp_host->acknowledgement_type }}, - { NDO_DATA_CURRENTNOTIFICATIONNUMBER, BD_INT, + { NDO_DATA_CURRENTNOTIFICATIONNUMBER, BD_INT, { .integer = temp_host->current_notification_number }}, - { NDO_DATA_PASSIVEHOSTCHECKSENABLED, BD_INT, + { NDO_DATA_PASSIVEHOSTCHECKSENABLED, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X temp_host->accept_passive_checks @@ -2609,57 +2609,57 @@ int ndomod_broker_data(int event_type, void *data){ temp_host->accept_passive_host_checks #endif }}, - { NDO_DATA_EVENTHANDLERENABLED, BD_INT, + { NDO_DATA_EVENTHANDLERENABLED, BD_INT, { .integer = temp_host->event_handler_enabled }}, - { NDO_DATA_ACTIVEHOSTCHECKSENABLED, BD_INT, + { NDO_DATA_ACTIVEHOSTCHECKSENABLED, BD_INT, { .integer = temp_host->checks_enabled }}, - { NDO_DATA_FLAPDETECTIONENABLED, BD_INT, + { NDO_DATA_FLAPDETECTIONENABLED, BD_INT, { .integer = temp_host->flap_detection_enabled }}, - { NDO_DATA_ISFLAPPING, BD_INT, + { NDO_DATA_ISFLAPPING, BD_INT, { .integer = temp_host->is_flapping }}, - { NDO_DATA_PERCENTSTATECHANGE, BD_FLOAT, + { NDO_DATA_PERCENTSTATECHANGE, BD_FLOAT, { .floating_point = temp_host->percent_state_change }}, - { NDO_DATA_LATENCY, BD_FLOAT, + { NDO_DATA_LATENCY, BD_FLOAT, { .floating_point = temp_host->latency }}, - { NDO_DATA_EXECUTIONTIME, BD_FLOAT, + { NDO_DATA_EXECUTIONTIME, BD_FLOAT, { .floating_point = temp_host->execution_time }}, - { NDO_DATA_SCHEDULEDDOWNTIMEDEPTH, BD_INT, + { NDO_DATA_SCHEDULEDDOWNTIMEDEPTH, BD_INT, { .integer = temp_host->scheduled_downtime_depth }}, - { NDO_DATA_FAILUREPREDICTIONENABLED, BD_INT, - { .integer = + { NDO_DATA_FAILUREPREDICTIONENABLED, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X 0 #else temp_host->failure_prediction_enabled #endif }}, - { NDO_DATA_PROCESSPERFORMANCEDATA, BD_INT, + { NDO_DATA_PROCESSPERFORMANCEDATA, BD_INT, { .integer = temp_host->process_performance_data }}, - { NDO_DATA_OBSESSOVERHOST, BD_INT, - { .integer = + { NDO_DATA_OBSESSOVERHOST, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X temp_host->obsess #else temp_host->obsess_over_host #endif }}, - { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, { .unsigned_long = temp_host->modified_attributes }}, - { NDO_DATA_EVENTHANDLER, BD_STRING, + { NDO_DATA_EVENTHANDLER, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_CHECKCOMMAND, BD_STRING, + { NDO_DATA_CHECKCOMMAND, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_NORMALCHECKINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_NORMALCHECKINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_host->check_interval }}, - { NDO_DATA_RETRYCHECKINTERVAL, BD_FLOAT, + { NDO_DATA_RETRYCHECKINTERVAL, BD_FLOAT, { .floating_point = (double)retry_interval }}, - { NDO_DATA_HOSTCHECKPERIOD, BD_STRING, + { NDO_DATA_HOSTCHECKPERIOD, BD_STRING, { .string = (es[6]==NULL) ? "" : es[6] }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_HOSTSTATUSDATA, - host_status_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_HOSTSTATUSDATA, + host_status_data, sizeof(host_status_data) / sizeof(host_status_data[ 0]), FALSE); } @@ -2700,79 +2700,79 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data service_status_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = ssdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = ssdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = ssdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = ssdata->timestamp }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_LONGOUTPUT, BD_STRING, + { NDO_DATA_LONGOUTPUT, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_PERFDATA, BD_STRING, + { NDO_DATA_PERFDATA, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_CURRENTSTATE, BD_INT, + { NDO_DATA_CURRENTSTATE, BD_INT, { .integer = temp_service->current_state }}, - { NDO_DATA_HASBEENCHECKED, BD_INT, + { NDO_DATA_HASBEENCHECKED, BD_INT, { .integer = temp_service->has_been_checked }}, - { NDO_DATA_SHOULDBESCHEDULED, BD_INT, + { NDO_DATA_SHOULDBESCHEDULED, BD_INT, { .integer = temp_service->should_be_scheduled }}, - { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, + { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, { .integer = temp_service->current_attempt }}, - { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, + { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, { .integer = temp_service->max_attempts }}, - { NDO_DATA_LASTSERVICECHECK, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTSERVICECHECK, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_service->last_check }}, - { NDO_DATA_NEXTSERVICECHECK, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_NEXTSERVICECHECK, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_service->next_check }}, - { NDO_DATA_CHECKTYPE, BD_INT, + { NDO_DATA_CHECKTYPE, BD_INT, { .integer = temp_service->check_type }}, - { NDO_DATA_LASTSTATECHANGE, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTSTATECHANGE, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_service->last_state_change }}, - { NDO_DATA_LASTHARDSTATECHANGE, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTHARDSTATECHANGE, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_service->last_hard_state_change }}, - { NDO_DATA_LASTHARDSTATE, BD_INT, + { NDO_DATA_LASTHARDSTATE, BD_INT, { .integer = temp_service->last_hard_state }}, - { NDO_DATA_LASTTIMEOK, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTTIMEOK, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_service->last_time_ok }}, - { NDO_DATA_LASTTIMEWARNING, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTTIMEWARNING, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_service->last_time_warning }}, - { NDO_DATA_LASTTIMEUNKNOWN, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTTIMEUNKNOWN, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_service->last_time_unknown }}, - { NDO_DATA_LASTTIMECRITICAL, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_LASTTIMECRITICAL, BD_UNSIGNED_LONG, + { .unsigned_long = (unsigned long)temp_service->last_time_critical }}, - { NDO_DATA_STATETYPE, BD_INT, + { NDO_DATA_STATETYPE, BD_INT, { .integer = temp_service->state_type }}, - { NDO_DATA_LASTSERVICENOTIFICATION, BD_UNSIGNED_LONG, + { NDO_DATA_LASTSERVICENOTIFICATION, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)temp_service->last_notification }}, - { NDO_DATA_NEXTSERVICENOTIFICATION, BD_UNSIGNED_LONG, + { NDO_DATA_NEXTSERVICENOTIFICATION, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)temp_service->next_notification }}, - { NDO_DATA_NOMORENOTIFICATIONS, BD_INT, + { NDO_DATA_NOMORENOTIFICATIONS, BD_INT, { .integer = temp_service->no_more_notifications }}, - { NDO_DATA_NOTIFICATIONSENABLED, BD_INT, + { NDO_DATA_NOTIFICATIONSENABLED, BD_INT, { .integer = temp_service->notifications_enabled }}, - { NDO_DATA_PROBLEMHASBEENACKNOWLEDGED, BD_INT, - { .integer = + { NDO_DATA_PROBLEMHASBEENACKNOWLEDGED, BD_INT, + { .integer = temp_service->problem_has_been_acknowledged }}, - { NDO_DATA_ACKNOWLEDGEMENTTYPE, BD_INT, + { NDO_DATA_ACKNOWLEDGEMENTTYPE, BD_INT, { .integer = temp_service->acknowledgement_type }}, - { NDO_DATA_CURRENTNOTIFICATIONNUMBER, BD_INT, - { .integer = + { NDO_DATA_CURRENTNOTIFICATIONNUMBER, BD_INT, + { .integer = temp_service->current_notification_number }}, - { NDO_DATA_PASSIVESERVICECHECKSENABLED, BD_INT, + { NDO_DATA_PASSIVESERVICECHECKSENABLED, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X temp_service->accept_passive_checks @@ -2780,59 +2780,59 @@ int ndomod_broker_data(int event_type, void *data){ temp_service->accept_passive_service_checks #endif }}, - { NDO_DATA_EVENTHANDLERENABLED, BD_INT, + { NDO_DATA_EVENTHANDLERENABLED, BD_INT, { .integer = temp_service->event_handler_enabled }}, - { NDO_DATA_ACTIVESERVICECHECKSENABLED, BD_INT, + { NDO_DATA_ACTIVESERVICECHECKSENABLED, BD_INT, { .integer = temp_service->checks_enabled }}, - { NDO_DATA_FLAPDETECTIONENABLED, BD_INT, + { NDO_DATA_FLAPDETECTIONENABLED, BD_INT, { .integer = temp_service->flap_detection_enabled }}, - { NDO_DATA_ISFLAPPING, BD_INT, + { NDO_DATA_ISFLAPPING, BD_INT, { .integer = temp_service->is_flapping }}, - { NDO_DATA_PERCENTSTATECHANGE, BD_FLOAT, - { .floating_point = + { NDO_DATA_PERCENTSTATECHANGE, BD_FLOAT, + { .floating_point = temp_service->percent_state_change }}, - { NDO_DATA_LATENCY, BD_FLOAT, + { NDO_DATA_LATENCY, BD_FLOAT, { .floating_point = temp_service->latency }}, - { NDO_DATA_EXECUTIONTIME, BD_FLOAT, + { NDO_DATA_EXECUTIONTIME, BD_FLOAT, { .floating_point = temp_service->execution_time }}, - { NDO_DATA_SCHEDULEDDOWNTIMEDEPTH, BD_INT, + { NDO_DATA_SCHEDULEDDOWNTIMEDEPTH, BD_INT, { .integer = temp_service->scheduled_downtime_depth }}, - { NDO_DATA_FAILUREPREDICTIONENABLED, BD_INT, - { .integer = + { NDO_DATA_FAILUREPREDICTIONENABLED, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X 0 #else temp_service->failure_prediction_enabled #endif }}, - { NDO_DATA_PROCESSPERFORMANCEDATA, BD_INT, + { NDO_DATA_PROCESSPERFORMANCEDATA, BD_INT, { .integer = temp_service->process_performance_data }}, - { NDO_DATA_OBSESSOVERSERVICE, BD_INT, - { .integer = + { NDO_DATA_OBSESSOVERSERVICE, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X temp_service->obsess #else temp_service->obsess_over_service #endif }}, - { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, { .unsigned_long = temp_service->modified_attributes }}, - { NDO_DATA_EVENTHANDLER, BD_STRING, + { NDO_DATA_EVENTHANDLER, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_CHECKCOMMAND, BD_STRING, + { NDO_DATA_CHECKCOMMAND, BD_STRING, { .string = (es[6]==NULL) ? "" : es[6] }}, - { NDO_DATA_NORMALCHECKINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_NORMALCHECKINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_service->check_interval }}, - { NDO_DATA_RETRYCHECKINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_RETRYCHECKINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_service->retry_interval }}, - { NDO_DATA_SERVICECHECKPERIOD, BD_STRING, + { NDO_DATA_SERVICECHECKPERIOD, BD_STRING, { .string = (es[7]==NULL) ? "" : es[7] }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_SERVICESTATUSDATA, - service_status_data, sizeof(service_status_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_SERVICESTATUSDATA, + service_status_data, sizeof(service_status_data) / sizeof(service_status_data[ 0]), FALSE); } @@ -2860,36 +2860,36 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data contact_status_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = csdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = csdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = csdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = csdata->timestamp }}, - { NDO_DATA_CONTACTNAME, BD_STRING, + { NDO_DATA_CONTACTNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_HOSTNOTIFICATIONSENABLED, BD_INT, - { .integer = + { NDO_DATA_HOSTNOTIFICATIONSENABLED, BD_INT, + { .integer = temp_contact->host_notifications_enabled }}, - { NDO_DATA_SERVICENOTIFICATIONSENABLED, BD_INT, - { .integer = + { NDO_DATA_SERVICENOTIFICATIONSENABLED, BD_INT, + { .integer = temp_contact->service_notifications_enabled }}, - { NDO_DATA_LASTHOSTNOTIFICATION, BD_UNSIGNED_LONG, + { NDO_DATA_LASTHOSTNOTIFICATION, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)temp_contact->last_host_notification }}, - { NDO_DATA_LASTSERVICENOTIFICATION, BD_UNSIGNED_LONG, + { NDO_DATA_LASTSERVICENOTIFICATION, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)temp_contact->last_service_notification }}, - { NDO_DATA_MODIFIEDCONTACTATTRIBUTES, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDCONTACTATTRIBUTES, BD_UNSIGNED_LONG, { .unsigned_long = temp_contact->modified_attributes }}, - { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, + { .unsigned_long = temp_contact->modified_host_attributes }}, - { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, + { .unsigned_long = temp_contact->modified_service_attributes }} }; - ndomod_broker_data_serialize(&dbuf, NDO_API_CONTACTSTATUSDATA, - contact_status_data, sizeof(contact_status_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_CONTACTSTATUSDATA, + contact_status_data, sizeof(contact_status_data) / sizeof(contact_status_data[ 0]), FALSE); } @@ -2912,30 +2912,30 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data adaptive_program_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = apdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = apdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = apdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = apdata->timestamp }}, - { NDO_DATA_COMMANDTYPE, BD_INT, + { NDO_DATA_COMMANDTYPE, BD_INT, { .integer = apdata->command_type }}, - { NDO_DATA_MODIFIEDHOSTATTRIBUTE, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDHOSTATTRIBUTE, BD_UNSIGNED_LONG, { .unsigned_long = apdata->modified_host_attribute }}, - { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, { .unsigned_long = apdata->modified_host_attributes }}, - { NDO_DATA_MODIFIEDSERVICEATTRIBUTE, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_MODIFIEDSERVICEATTRIBUTE, BD_UNSIGNED_LONG, + { .unsigned_long = apdata->modified_service_attribute }}, - { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, + { .unsigned_long = apdata->modified_service_attributes }}, - { NDO_DATA_GLOBALHOSTEVENTHANDLER, BD_STRING, + { NDO_DATA_GLOBALHOSTEVENTHANDLER, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_GLOBALSERVICEEVENTHANDLER, BD_STRING, + { NDO_DATA_GLOBALSERVICEEVENTHANDLER, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_ADAPTIVEPROGRAMDATA, - adaptive_program_data, sizeof(adaptive_program_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_ADAPTIVEPROGRAMDATA, + adaptive_program_data, sizeof(adaptive_program_data) / sizeof(adaptive_program_data[ 0]), TRUE); } @@ -2969,32 +2969,32 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data adaptive_host_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = ahdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = ahdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = ahdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = ahdata->timestamp }}, - { NDO_DATA_COMMANDTYPE, BD_INT, + { NDO_DATA_COMMANDTYPE, BD_INT, { .integer = ahdata->command_type }}, - { NDO_DATA_MODIFIEDHOSTATTRIBUTE, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDHOSTATTRIBUTE, BD_UNSIGNED_LONG, { .unsigned_long = ahdata->modified_attribute }}, - { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, { .unsigned_long = ahdata->modified_attributes }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_EVENTHANDLER, BD_STRING, + { NDO_DATA_EVENTHANDLER, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_CHECKCOMMAND, BD_STRING, + { NDO_DATA_CHECKCOMMAND, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_NORMALCHECKINTERVAL, BD_FLOAT, + { NDO_DATA_NORMALCHECKINTERVAL, BD_FLOAT, { .floating_point = temp_host->check_interval }}, - { NDO_DATA_RETRYCHECKINTERVAL, BD_FLOAT, + { NDO_DATA_RETRYCHECKINTERVAL, BD_FLOAT, { .floating_point = retry_interval }}, - { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, + { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, { .integer = temp_host->max_attempts }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_ADAPTIVEHOSTDATA, - adaptive_host_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_ADAPTIVEHOSTDATA, + adaptive_host_data, sizeof(adaptive_host_data) / sizeof(adaptive_host_data[ 0]), TRUE); } @@ -3023,36 +3023,36 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data adaptive_service_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = asdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = asdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = asdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = asdata->timestamp }}, - { NDO_DATA_COMMANDTYPE, BD_INT, + { NDO_DATA_COMMANDTYPE, BD_INT, { .integer = asdata->command_type }}, - { NDO_DATA_MODIFIEDSERVICEATTRIBUTE, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDSERVICEATTRIBUTE, BD_UNSIGNED_LONG, { .unsigned_long = asdata->modified_attribute }}, - { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, { .unsigned_long = asdata->modified_attributes }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_EVENTHANDLER, BD_STRING, + { NDO_DATA_EVENTHANDLER, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_CHECKCOMMAND, BD_STRING, + { NDO_DATA_CHECKCOMMAND, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_NORMALCHECKINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_NORMALCHECKINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_service->check_interval }}, - { NDO_DATA_RETRYCHECKINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_RETRYCHECKINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_service->retry_interval }}, - { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, + { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, { .integer = temp_service->max_attempts }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_ADAPTIVESERVICEDATA, - adaptive_service_data, sizeof(adaptive_service_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_ADAPTIVESERVICEDATA, + adaptive_service_data, sizeof(adaptive_service_data) / sizeof(adaptive_service_data[ 0]), TRUE); } @@ -3074,38 +3074,38 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data adaptive_contact_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = acdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = acdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = acdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = acdata->timestamp }}, - { NDO_DATA_COMMANDTYPE, BD_INT, + { NDO_DATA_COMMANDTYPE, BD_INT, { .integer = acdata->command_type }}, - { NDO_DATA_MODIFIEDCONTACTATTRIBUTE, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDCONTACTATTRIBUTE, BD_UNSIGNED_LONG, { .unsigned_long = acdata->modified_attribute }}, - { NDO_DATA_MODIFIEDCONTACTATTRIBUTES, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDCONTACTATTRIBUTES, BD_UNSIGNED_LONG, { .unsigned_long = acdata->modified_attributes }}, - { NDO_DATA_MODIFIEDHOSTATTRIBUTE, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDHOSTATTRIBUTE, BD_UNSIGNED_LONG, { .unsigned_long = acdata->modified_host_attribute }}, - { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, + { NDO_DATA_MODIFIEDHOSTATTRIBUTES, BD_UNSIGNED_LONG, { .unsigned_long = acdata->modified_host_attributes }}, - { NDO_DATA_MODIFIEDSERVICEATTRIBUTE, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_MODIFIEDSERVICEATTRIBUTE, BD_UNSIGNED_LONG, + { .unsigned_long = acdata->modified_service_attribute }}, - { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, - { .unsigned_long = + { NDO_DATA_MODIFIEDSERVICEATTRIBUTES, BD_UNSIGNED_LONG, + { .unsigned_long = acdata->modified_service_attributes }}, - { NDO_DATA_CONTACTNAME, BD_STRING, + { NDO_DATA_CONTACTNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_HOSTNOTIFICATIONSENABLED, BD_INT, - { .integer = + { NDO_DATA_HOSTNOTIFICATIONSENABLED, BD_INT, + { .integer = temp_contact->host_notifications_enabled }}, - { NDO_DATA_SERVICENOTIFICATIONSENABLED, BD_INT, - { .integer = + { NDO_DATA_SERVICENOTIFICATIONSENABLED, BD_INT, + { .integer = temp_contact->service_notifications_enabled }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_ADAPTIVECONTACTDATA, - adaptive_contact_data, sizeof(adaptive_contact_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_ADAPTIVECONTACTDATA, + adaptive_contact_data, sizeof(adaptive_contact_data) / sizeof(adaptive_contact_data[ 0]), TRUE); } @@ -3123,22 +3123,22 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data external_command_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = ecdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = ecdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = ecdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = ecdata->timestamp }}, - { NDO_DATA_COMMANDTYPE, BD_INT, + { NDO_DATA_COMMANDTYPE, BD_INT, { .integer = ecdata->command_type }}, - { NDO_DATA_ENTRYTIME, BD_UNSIGNED_LONG, + { NDO_DATA_ENTRYTIME, BD_UNSIGNED_LONG, { .unsigned_long = (unsigned long)ecdata->entry_time }}, - { NDO_DATA_COMMANDSTRING, BD_STRING, + { NDO_DATA_COMMANDSTRING, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_COMMANDARGS, BD_STRING, + { NDO_DATA_COMMANDARGS, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_EXTERNALCOMMANDDATA, - external_command_data, sizeof(external_command_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_EXTERNALCOMMANDDATA, + external_command_data, sizeof(external_command_data) / sizeof(external_command_data[ 0]), TRUE); } @@ -3152,14 +3152,14 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data aggregated_status_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = agsdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = agsdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = agsdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = agsdata->timestamp }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_AGGREGATEDSTATUSDATA, - aggregated_status_data, sizeof(aggregated_status_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_AGGREGATEDSTATUSDATA, + aggregated_status_data, sizeof(aggregated_status_data) / sizeof(aggregated_status_data[ 0]), TRUE); } @@ -3173,14 +3173,14 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data retention_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = rdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = rdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = rdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = rdata->timestamp }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_RETENTIONDATA, - retention_data, + ndomod_broker_data_serialize(&dbuf, NDO_API_RETENTIONDATA, + retention_data, sizeof(retention_data) / sizeof(retention_data[ 0]), TRUE); } @@ -3205,40 +3205,40 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data contact_notification_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = cnotdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = cnotdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = cnotdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = cnotdata->timestamp }}, - { NDO_DATA_NOTIFICATIONTYPE, BD_INT, + { NDO_DATA_NOTIFICATIONTYPE, BD_INT, { .integer = cnotdata->notification_type }}, - { NDO_DATA_STARTTIME, BD_TIMEVAL, + { NDO_DATA_STARTTIME, BD_TIMEVAL, { .timestamp = cnotdata->start_time }}, - { NDO_DATA_ENDTIME, BD_TIMEVAL, + { NDO_DATA_ENDTIME, BD_TIMEVAL, { .timestamp = cnotdata->end_time }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_CONTACTNAME, BD_STRING, + { NDO_DATA_CONTACTNAME, BD_STRING, { .string = (es[7]==NULL) ? "" : es[7] }}, - { NDO_DATA_NOTIFICATIONREASON, BD_INT, + { NDO_DATA_NOTIFICATIONREASON, BD_INT, { .integer = cnotdata->reason_type }}, { NDO_DATA_STATE, BD_INT, { .integer = cnotdata->state }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_LONGOUTPUT, BD_STRING, + { NDO_DATA_LONGOUTPUT, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_ACKAUTHOR, BD_STRING, + { NDO_DATA_ACKAUTHOR, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_ACKDATA, BD_STRING, + { NDO_DATA_ACKDATA, BD_STRING, { .string = (es[6]==NULL) ? "" : es[6] }}, }; ndomod_broker_data_serialize(&dbuf, - NDO_API_CONTACTNOTIFICATIONDATA, contact_notification_data, - sizeof(contact_notification_data) / + NDO_API_CONTACTNOTIFICATIONDATA, contact_notification_data, + sizeof(contact_notification_data) / sizeof(contact_notification_data[ 0]), TRUE); } @@ -3261,41 +3261,41 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data contact_notification_method_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = cnotmdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = cnotmdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = cnotmdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = cnotmdata->timestamp }}, - { NDO_DATA_NOTIFICATIONTYPE, BD_INT, + { NDO_DATA_NOTIFICATIONTYPE, BD_INT, { .integer = cnotmdata->notification_type }}, - { NDO_DATA_STARTTIME, BD_TIMEVAL, + { NDO_DATA_STARTTIME, BD_TIMEVAL, { .timestamp = cnotmdata->start_time }}, - { NDO_DATA_ENDTIME, BD_TIMEVAL, + { NDO_DATA_ENDTIME, BD_TIMEVAL, { .timestamp = cnotmdata->end_time }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_CONTACTNAME, BD_STRING, + { NDO_DATA_CONTACTNAME, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_COMMANDNAME, BD_STRING, + { NDO_DATA_COMMANDNAME, BD_STRING, { .string = (es[6]==NULL) ? "" : es[6] }}, - { NDO_DATA_COMMANDARGS, BD_STRING, + { NDO_DATA_COMMANDARGS, BD_STRING, { .string = (es[7]==NULL) ? "" : es[7] }}, - { NDO_DATA_NOTIFICATIONREASON, BD_INT, + { NDO_DATA_NOTIFICATIONREASON, BD_INT, { .integer = cnotmdata->reason_type }}, { NDO_DATA_STATE, BD_INT, { .integer = cnotmdata->state }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_ACKAUTHOR, BD_STRING, + { NDO_DATA_ACKAUTHOR, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_ACKDATA, BD_STRING, + { NDO_DATA_ACKDATA, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, }; ndomod_broker_data_serialize(&dbuf, - NDO_API_CONTACTNOTIFICATIONMETHODDATA, - contact_notification_method_data, - sizeof(contact_notification_method_data) / + NDO_API_CONTACTNOTIFICATIONMETHODDATA, + contact_notification_method_data, + sizeof(contact_notification_method_data) / sizeof(contact_notification_method_data[ 0]), TRUE); } @@ -3314,30 +3314,30 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data acknowledgement_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = ackdata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = ackdata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = ackdata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = ackdata->timestamp }}, - { NDO_DATA_ACKNOWLEDGEMENTTYPE, BD_INT, + { NDO_DATA_ACKNOWLEDGEMENTTYPE, BD_INT, { .integer = ackdata->acknowledgement_type }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_AUTHORNAME, BD_STRING, + { NDO_DATA_AUTHORNAME, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_COMMENT, BD_STRING, + { NDO_DATA_COMMENT, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, { NDO_DATA_STATE, BD_INT, { .integer = ackdata->state }}, { NDO_DATA_STICKY, BD_INT, { .integer = ackdata->is_sticky }}, - { NDO_DATA_PERSISTENT, BD_INT, + { NDO_DATA_PERSISTENT, BD_INT, { .integer = ackdata->persistent_comment }}, - { NDO_DATA_NOTIFYCONTACTS, BD_INT, + { NDO_DATA_NOTIFYCONTACTS, BD_INT, { .integer = ackdata->notify_contacts }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_ACKNOWLEDGEMENTDATA, - acknowledgement_data, sizeof(acknowledgement_data) / + ndomod_broker_data_serialize(&dbuf, NDO_API_ACKNOWLEDGEMENTDATA, + acknowledgement_data, sizeof(acknowledgement_data) / sizeof(acknowledgement_data[ 0]), TRUE); } @@ -3393,36 +3393,36 @@ int ndomod_broker_data(int event_type, void *data){ struct ndo_broker_data state_change_data[] = { { NDO_DATA_TYPE, BD_INT, { .integer = schangedata->type }}, { NDO_DATA_FLAGS, BD_INT, { .integer = schangedata->flags }}, - { NDO_DATA_ATTRIBUTES, BD_INT, + { NDO_DATA_ATTRIBUTES, BD_INT, { .integer = schangedata->attr }}, - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = schangedata->timestamp }}, - { NDO_DATA_STATECHANGETYPE, BD_INT, + { NDO_DATA_STATECHANGETYPE, BD_INT, { .integer = schangedata->statechange_type }}, - { NDO_DATA_HOST, BD_STRING, + { NDO_DATA_HOST, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICE, BD_STRING, + { NDO_DATA_SERVICE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, { NDO_DATA_STATECHANGE, BD_INT, { .integer = TRUE }}, { NDO_DATA_STATE, BD_INT, { .integer = schangedata->state }}, - { NDO_DATA_STATETYPE, BD_INT, + { NDO_DATA_STATETYPE, BD_INT, { .integer = schangedata->state_type }}, - { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, + { NDO_DATA_CURRENTCHECKATTEMPT, BD_INT, { .integer = schangedata->current_attempt }}, - { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, + { NDO_DATA_MAXCHECKATTEMPTS, BD_INT, { .integer = schangedata->max_attempts }}, { NDO_DATA_LASTSTATE, BD_INT, { .integer = last_state }}, - { NDO_DATA_LASTHARDSTATE, BD_INT, + { NDO_DATA_LASTHARDSTATE, BD_INT, { .integer = last_hard_state }}, - { NDO_DATA_OUTPUT, BD_STRING, + { NDO_DATA_OUTPUT, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_LONGOUTPUT, BD_STRING, + { NDO_DATA_LONGOUTPUT, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_STATECHANGEDATA, - state_change_data, - sizeof(state_change_data) / sizeof(state_change_data[ 0]), + ndomod_broker_data_serialize(&dbuf, NDO_API_STATECHANGEDATA, + state_change_data, + sizeof(state_change_data) / sizeof(state_change_data[ 0]), TRUE); } @@ -3448,7 +3448,7 @@ int ndomod_broker_data(int event_type, void *data){ ndo_dbuf_free(&dbuf); - + /* POST PROCESSING... */ switch(event_type){ @@ -3621,7 +3621,7 @@ void ndomod_write_active_objects() free(active_objects[obj_count].value.string); } - + active_objects[0].value.integer = NDO_API_CONTACTDEFINITION; obj_count = 1; for (temp_contact = contact_list; temp_contact != NULL; temp_contact = temp_contact->next) { @@ -3761,7 +3761,7 @@ void ndomod_write_active_objects() free(active_objects[obj_count].value.string); } - + active_objects[0].value.integer = NDO_API_SERVICEGROUPDEFINITION; obj_count = 1; for (temp_servicegroup = servicegroup_list; temp_servicegroup !=NULL ; temp_servicegroup = temp_servicegroup->next) { @@ -3875,16 +3875,16 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data command_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_COMMANDNAME, BD_STRING, + { NDO_DATA_COMMANDNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_COMMANDLINE, BD_STRING, + { NDO_DATA_COMMANDLINE, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_COMMANDDEFINITION, - command_definition, + ndomod_broker_data_serialize(&dbuf, NDO_API_COMMANDDEFINITION, + command_definition, sizeof(command_definition) / sizeof(command_definition[ 0]), TRUE); } @@ -3905,16 +3905,16 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data timeperiod_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_TIMEPERIODNAME, BD_STRING, + { NDO_DATA_TIMEPERIODNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_TIMEPERIODALIAS, BD_STRING, + { NDO_DATA_TIMEPERIODALIAS, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEPERIODDEFINITION, - timeperiod_definition, sizeof(timeperiod_definition) / + ndomod_broker_data_serialize(&dbuf, NDO_API_TIMEPERIODDEFINITION, + timeperiod_definition, sizeof(timeperiod_definition) / sizeof(timeperiod_definition[ 0]), FALSE); } @@ -3984,70 +3984,70 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data contact_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_CONTACTNAME, BD_STRING, + { NDO_DATA_CONTACTNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_CONTACTALIAS, BD_STRING, + { NDO_DATA_CONTACTALIAS, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_EMAILADDRESS, BD_STRING, + { NDO_DATA_EMAILADDRESS, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_PAGERADDRESS, BD_STRING, + { NDO_DATA_PAGERADDRESS, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_HOSTNOTIFICATIONPERIOD, BD_STRING, + { NDO_DATA_HOSTNOTIFICATIONPERIOD, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_SERVICENOTIFICATIONPERIOD, BD_STRING, + { NDO_DATA_SERVICENOTIFICATIONPERIOD, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_SERVICENOTIFICATIONSENABLED, BD_INT, + { NDO_DATA_SERVICENOTIFICATIONSENABLED, BD_INT, { .integer = service_notifications_enabled }}, - { NDO_DATA_HOSTNOTIFICATIONSENABLED, BD_INT, + { NDO_DATA_HOSTNOTIFICATIONSENABLED, BD_INT, { .integer = host_notifications_enabled }}, - { NDO_DATA_CANSUBMITCOMMANDS, BD_INT, + { NDO_DATA_CANSUBMITCOMMANDS, BD_INT, { .integer = can_submit_commands }}, - { NDO_DATA_NOTIFYSERVICEUNKNOWN, BD_INT, - { .integer = + { NDO_DATA_NOTIFYSERVICEUNKNOWN, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_contact->service_notification_options,OPT_UNKNOWN) #else temp_contact->notify_on_service_unknown #endif }}, - { NDO_DATA_NOTIFYSERVICEWARNING, BD_INT, - { .integer = + { NDO_DATA_NOTIFYSERVICEWARNING, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_contact->service_notification_options,OPT_WARNING) #else temp_contact->notify_on_service_warning #endif }}, - { NDO_DATA_NOTIFYSERVICECRITICAL, BD_INT, - { .integer = + { NDO_DATA_NOTIFYSERVICECRITICAL, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_contact->service_notification_options,OPT_CRITICAL) #else temp_contact->notify_on_service_critical #endif }}, - { NDO_DATA_NOTIFYSERVICERECOVERY, BD_INT, - { .integer = + { NDO_DATA_NOTIFYSERVICERECOVERY, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_contact->service_notification_options,OPT_RECOVERY) #else temp_contact->notify_on_service_recovery #endif }}, - { NDO_DATA_NOTIFYSERVICEFLAPPING, BD_INT, - { .integer = + { NDO_DATA_NOTIFYSERVICEFLAPPING, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_contact->service_notification_options,OPT_FLAPPING) #else temp_contact->notify_on_service_flapping #endif }}, - { NDO_DATA_NOTIFYSERVICEDOWNTIME, BD_INT, + { NDO_DATA_NOTIFYSERVICEDOWNTIME, BD_INT, { .integer = notify_on_service_downtime }}, - { NDO_DATA_NOTIFYHOSTDOWN, BD_INT, - { .integer = + { NDO_DATA_NOTIFYHOSTDOWN, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_contact->host_notification_options, OPT_DOWN) @@ -4055,8 +4055,8 @@ int ndomod_write_object_config(int config_type){ temp_contact->notify_on_host_down #endif }}, - { NDO_DATA_NOTIFYHOSTUNREACHABLE, BD_INT, - { .integer = + { NDO_DATA_NOTIFYHOSTUNREACHABLE, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_contact->host_notification_options, OPT_UNREACHABLE) @@ -4064,8 +4064,8 @@ int ndomod_write_object_config(int config_type){ temp_contact->notify_on_host_unreachable #endif }}, - { NDO_DATA_NOTIFYHOSTRECOVERY, BD_INT, - { .integer = + { NDO_DATA_NOTIFYHOSTRECOVERY, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_contact->host_notification_options, OPT_RECOVERY) @@ -4073,8 +4073,8 @@ int ndomod_write_object_config(int config_type){ temp_contact->notify_on_host_recovery #endif }}, - { NDO_DATA_NOTIFYHOSTFLAPPING, BD_INT, - { .integer = + { NDO_DATA_NOTIFYHOSTFLAPPING, BD_INT, + { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_contact->host_notification_options, OPT_FLAPPING) @@ -4082,16 +4082,16 @@ int ndomod_write_object_config(int config_type){ temp_contact->notify_on_host_flapping #endif }}, - { NDO_DATA_NOTIFYHOSTDOWNTIME, BD_INT, + { NDO_DATA_NOTIFYHOSTDOWNTIME, BD_INT, { .integer = notify_on_host_downtime }}, #ifdef BUILD_NAGIOS_4X - { NDO_DATA_MINIMUMIMPORTANCE, BD_INT, + { NDO_DATA_MINIMUMIMPORTANCE, BD_INT, { .integer = temp_contact->minimum_value }}, #endif }; - ndomod_broker_data_serialize(&dbuf, NDO_API_CONTACTDEFINITION, - contact_definition, sizeof(contact_definition) / + ndomod_broker_data_serialize(&dbuf, NDO_API_CONTACTDEFINITION, + contact_definition, sizeof(contact_definition) / sizeof(contact_definition[ 0]), FALSE); } @@ -4115,11 +4115,11 @@ int ndomod_write_object_config(int config_type){ } /* dump host notification commands for each contact */ - ndomod_commands_serialize(temp_contact->host_notification_commands, + ndomod_commands_serialize(temp_contact->host_notification_commands, &dbuf, NDO_DATA_HOSTNOTIFICATIONCOMMAND); /* dump service notification commands for each contact */ - ndomod_commands_serialize(temp_contact->service_notification_commands, + ndomod_commands_serialize(temp_contact->service_notification_commands, &dbuf, NDO_DATA_SERVICENOTIFICATIONCOMMAND); #if ( defined( BUILD_NAGIOS_3X) || defined( BUILD_NAGIOS_4X)) @@ -4146,23 +4146,23 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data contactgroup_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_CONTACTGROUPNAME, BD_STRING, + { NDO_DATA_CONTACTGROUPNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_CONTACTGROUPALIAS, BD_STRING, + { NDO_DATA_CONTACTGROUPALIAS, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_CONTACTGROUPDEFINITION, - contactgroup_definition, sizeof(contactgroup_definition) / + ndomod_broker_data_serialize(&dbuf, NDO_API_CONTACTGROUPDEFINITION, + contactgroup_definition, sizeof(contactgroup_definition) / sizeof(contactgroup_definition[ 0]), FALSE); } NDOMOD_FREE_ESC_BUFFERS(es, 2); /* dump members for each contactgroup */ - ndomod_contacts_serialize(temp_contactgroup->members, &dbuf, + ndomod_contacts_serialize(temp_contactgroup->members, &dbuf, NDO_DATA_CONTACTGROUPMEMBER); ndomod_enddata_serialize(&dbuf); @@ -4272,39 +4272,39 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data host_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_HOSTNAME, BD_STRING, + { NDO_DATA_HOSTNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_DISPLAYNAME, BD_STRING, + { NDO_DATA_DISPLAYNAME, BD_STRING, { .string = (es[15]==NULL) ? "" : es[15] }}, - { NDO_DATA_HOSTALIAS, BD_STRING, + { NDO_DATA_HOSTALIAS, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_HOSTADDRESS, BD_STRING, + { NDO_DATA_HOSTADDRESS, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_HOSTCHECKCOMMAND, BD_STRING, + { NDO_DATA_HOSTCHECKCOMMAND, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_HOSTEVENTHANDLER, BD_STRING, + { NDO_DATA_HOSTEVENTHANDLER, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_HOSTNOTIFICATIONPERIOD, BD_STRING, + { NDO_DATA_HOSTNOTIFICATIONPERIOD, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_HOSTCHECKPERIOD, BD_STRING, + { NDO_DATA_HOSTCHECKPERIOD, BD_STRING, { .string = (es[6]==NULL) ? "" : es[6] }}, - { NDO_DATA_HOSTFAILUREPREDICTIONOPTIONS, BD_STRING, + { NDO_DATA_HOSTFAILUREPREDICTIONOPTIONS, BD_STRING, { .string = (es[7]==NULL) ? "" : es[7] }}, - { NDO_DATA_HOSTCHECKINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_HOSTCHECKINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_host->check_interval }}, - { NDO_DATA_HOSTRETRYINTERVAL, BD_FLOAT, + { NDO_DATA_HOSTRETRYINTERVAL, BD_FLOAT, { .floating_point = (double)retry_interval }}, - { NDO_DATA_HOSTMAXCHECKATTEMPTS, BD_INT, + { NDO_DATA_HOSTMAXCHECKATTEMPTS, BD_INT, { .integer = temp_host->max_attempts }}, - { NDO_DATA_FIRSTNOTIFICATIONDELAY, BD_FLOAT, + { NDO_DATA_FIRSTNOTIFICATIONDELAY, BD_FLOAT, { .floating_point = first_notification_delay }}, - { NDO_DATA_HOSTNOTIFICATIONINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_HOSTNOTIFICATIONINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_host->notification_interval }}, - { NDO_DATA_NOTIFYHOSTDOWN, BD_INT, + { NDO_DATA_NOTIFYHOSTDOWN, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_host->notification_options, @@ -4313,7 +4313,7 @@ int ndomod_write_object_config(int config_type){ temp_host->notify_on_down #endif }}, - { NDO_DATA_NOTIFYHOSTUNREACHABLE, BD_INT, + { NDO_DATA_NOTIFYHOSTUNREACHABLE, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_host->notification_options, @@ -4322,7 +4322,7 @@ int ndomod_write_object_config(int config_type){ temp_host->notify_on_unreachable #endif }}, - { NDO_DATA_NOTIFYHOSTRECOVERY, BD_INT, + { NDO_DATA_NOTIFYHOSTRECOVERY, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_host->notification_options, @@ -4331,7 +4331,7 @@ int ndomod_write_object_config(int config_type){ temp_host->notify_on_recovery #endif }}, - { NDO_DATA_NOTIFYHOSTFLAPPING, BD_INT, + { NDO_DATA_NOTIFYHOSTFLAPPING, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_host->notification_options, @@ -4340,21 +4340,21 @@ int ndomod_write_object_config(int config_type){ temp_host->notify_on_flapping #endif }}, - { NDO_DATA_NOTIFYHOSTDOWNTIME, BD_INT, + { NDO_DATA_NOTIFYHOSTDOWNTIME, BD_INT, { .integer = notify_on_host_downtime }}, - { NDO_DATA_HOSTFLAPDETECTIONENABLED, BD_INT, + { NDO_DATA_HOSTFLAPDETECTIONENABLED, BD_INT, { .integer = temp_host->flap_detection_enabled }}, - { NDO_DATA_FLAPDETECTIONONUP, BD_INT, + { NDO_DATA_FLAPDETECTIONONUP, BD_INT, { .integer = flap_detection_on_up }}, - { NDO_DATA_FLAPDETECTIONONDOWN, BD_INT, + { NDO_DATA_FLAPDETECTIONONDOWN, BD_INT, { .integer = flap_detection_on_down }}, - { NDO_DATA_FLAPDETECTIONONUNREACHABLE, BD_INT, + { NDO_DATA_FLAPDETECTIONONUNREACHABLE, BD_INT, { .integer = flap_detection_on_unreachable }}, - { NDO_DATA_LOWHOSTFLAPTHRESHOLD, BD_FLOAT, + { NDO_DATA_LOWHOSTFLAPTHRESHOLD, BD_FLOAT, { .floating_point = temp_host->low_flap_threshold }}, - { NDO_DATA_HIGHHOSTFLAPTHRESHOLD, BD_FLOAT, + { NDO_DATA_HIGHHOSTFLAPTHRESHOLD, BD_FLOAT, { .floating_point = temp_host->high_flap_threshold }}, - { NDO_DATA_STALKHOSTONUP, BD_INT, + { NDO_DATA_STALKHOSTONUP, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_host->stalking_options, @@ -4363,7 +4363,7 @@ int ndomod_write_object_config(int config_type){ temp_host->stalk_on_up #endif }}, - { NDO_DATA_STALKHOSTONDOWN, BD_INT, + { NDO_DATA_STALKHOSTONDOWN, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_host->stalking_options, @@ -4372,7 +4372,7 @@ int ndomod_write_object_config(int config_type){ temp_host->stalk_on_down #endif }}, - { NDO_DATA_STALKHOSTONUNREACHABLE, BD_INT, + { NDO_DATA_STALKHOSTONUNREACHABLE, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_host->stalking_options, @@ -4381,15 +4381,15 @@ int ndomod_write_object_config(int config_type){ temp_host->stalk_on_unreachable #endif }}, - { NDO_DATA_HOSTFRESHNESSCHECKSENABLED, BD_INT, + { NDO_DATA_HOSTFRESHNESSCHECKSENABLED, BD_INT, { .integer = temp_host->check_freshness }}, - { NDO_DATA_HOSTFRESHNESSTHRESHOLD, BD_INT, + { NDO_DATA_HOSTFRESHNESSTHRESHOLD, BD_INT, { .integer = temp_host->freshness_threshold }}, - { NDO_DATA_PROCESSHOSTPERFORMANCEDATA, BD_INT, + { NDO_DATA_PROCESSHOSTPERFORMANCEDATA, BD_INT, { .integer = temp_host->process_performance_data }}, - { NDO_DATA_ACTIVEHOSTCHECKSENABLED, BD_INT, + { NDO_DATA_ACTIVEHOSTCHECKSENABLED, BD_INT, { .integer = temp_host->checks_enabled }}, - { NDO_DATA_PASSIVEHOSTCHECKSENABLED, BD_INT, + { NDO_DATA_PASSIVEHOSTCHECKSENABLED, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X temp_host->accept_passive_checks @@ -4397,15 +4397,15 @@ int ndomod_write_object_config(int config_type){ temp_host->accept_passive_host_checks #endif }}, - { NDO_DATA_HOSTEVENTHANDLERENABLED, BD_INT, + { NDO_DATA_HOSTEVENTHANDLERENABLED, BD_INT, { .integer = temp_host->event_handler_enabled }}, - { NDO_DATA_RETAINHOSTSTATUSINFORMATION, BD_INT, + { NDO_DATA_RETAINHOSTSTATUSINFORMATION, BD_INT, { .integer = temp_host->retain_status_information }}, - { NDO_DATA_RETAINHOSTNONSTATUSINFORMATION, BD_INT, + { NDO_DATA_RETAINHOSTNONSTATUSINFORMATION, BD_INT, { .integer = temp_host->retain_nonstatus_information }}, - { NDO_DATA_HOSTNOTIFICATIONSENABLED, BD_INT, + { NDO_DATA_HOSTNOTIFICATIONSENABLED, BD_INT, { .integer = temp_host->notifications_enabled }}, - { NDO_DATA_HOSTFAILUREPREDICTIONENABLED, BD_INT, + { NDO_DATA_HOSTFAILUREPREDICTIONENABLED, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X 0 @@ -4413,7 +4413,7 @@ int ndomod_write_object_config(int config_type){ temp_host->failure_prediction_enabled #endif }}, - { NDO_DATA_OBSESSOVERHOST, BD_INT, + { NDO_DATA_OBSESSOVERHOST, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X temp_host->obsess @@ -4421,19 +4421,19 @@ int ndomod_write_object_config(int config_type){ temp_host->obsess_over_host #endif }}, - { NDO_DATA_NOTES, BD_STRING, + { NDO_DATA_NOTES, BD_STRING, { .string = (es[8]==NULL) ? "" : es[8] }}, - { NDO_DATA_NOTESURL, BD_STRING, + { NDO_DATA_NOTESURL, BD_STRING, { .string = (es[9]==NULL) ? "" : es[9] }}, - { NDO_DATA_ACTIONURL, BD_STRING, + { NDO_DATA_ACTIONURL, BD_STRING, { .string = (es[10]==NULL) ? "" : es[10] }}, - { NDO_DATA_ICONIMAGE, BD_STRING, + { NDO_DATA_ICONIMAGE, BD_STRING, { .string = (es[11]==NULL) ? "" : es[11] }}, - { NDO_DATA_ICONIMAGEALT, BD_STRING, + { NDO_DATA_ICONIMAGEALT, BD_STRING, { .string = (es[12]==NULL) ? "" : es[12] }}, - { NDO_DATA_VRMLIMAGE, BD_STRING, + { NDO_DATA_VRMLIMAGE, BD_STRING, { .string = (es[13]==NULL) ? "" : es[13] }}, - { NDO_DATA_STATUSMAPIMAGE, BD_STRING, + { NDO_DATA_STATUSMAPIMAGE, BD_STRING, { .string = (es[14]==NULL) ? "" : es[14] }}, { NDO_DATA_HAVE2DCOORDS, BD_INT, { .integer = have_2d_coords }}, { NDO_DATA_X2D, BD_INT, { .integer = x_2d }}, @@ -4443,20 +4443,20 @@ int ndomod_write_object_config(int config_type){ { NDO_DATA_Y3D, BD_FLOAT, { .floating_point = y_3d }}, { NDO_DATA_Z3D, BD_FLOAT, { .floating_point = z_3d }}, #ifdef BUILD_NAGIOS_4X - { NDO_DATA_IMPORTANCE, BD_INT, + { NDO_DATA_IMPORTANCE, BD_INT, { .integer = temp_host->hourly_value }}, #endif }; - ndomod_broker_data_serialize(&dbuf, NDO_API_HOSTDEFINITION, - host_definition, sizeof(host_definition) / + ndomod_broker_data_serialize(&dbuf, NDO_API_HOSTDEFINITION, + host_definition, sizeof(host_definition) / sizeof(host_definition[ 0]), FALSE); } NDOMOD_FREE_ESC_BUFFERS(es, OBJECTCONFIG_ES_ITEMS); /* dump parent hosts */ - ndomod_hosts_serialize(temp_host->parent_hosts, &dbuf, + ndomod_hosts_serialize(temp_host->parent_hosts, &dbuf, NDO_DATA_PARENTHOST); /* dump contactgroups */ @@ -4491,16 +4491,16 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data hostgroup_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_HOSTGROUPNAME, BD_STRING, + { NDO_DATA_HOSTGROUPNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_HOSTGROUPALIAS, BD_STRING, + { NDO_DATA_HOSTGROUPALIAS, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_HOSTGROUPDEFINITION, - hostgroup_definition, sizeof(hostgroup_definition) / + ndomod_broker_data_serialize(&dbuf, NDO_API_HOSTGROUPDEFINITION, + hostgroup_definition, sizeof(hostgroup_definition) / sizeof(hostgroup_definition[ 0]), FALSE); } @@ -4508,10 +4508,10 @@ int ndomod_write_object_config(int config_type){ /* dump members for each hostgroup */ #ifdef BUILD_NAGIOS_2X - ndomod_hosts_serialize_2x(temp_hostgroup->members, &dbuf, + ndomod_hosts_serialize_2x(temp_hostgroup->members, &dbuf, NDO_DATA_HOSTGROUPMEMBER); #else - ndomod_hosts_serialize(temp_hostgroup->members, &dbuf, + ndomod_hosts_serialize(temp_hostgroup->members, &dbuf, NDO_DATA_HOSTGROUPMEMBER); #endif @@ -4590,38 +4590,38 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data service_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_HOSTNAME, BD_STRING, + { NDO_DATA_HOSTNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_DISPLAYNAME, BD_STRING, + { NDO_DATA_DISPLAYNAME, BD_STRING, { .string = (es[12]==NULL) ? "" : es[12] }}, - { NDO_DATA_SERVICEDESCRIPTION, BD_STRING, + { NDO_DATA_SERVICEDESCRIPTION, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_SERVICECHECKCOMMAND, BD_STRING, + { NDO_DATA_SERVICECHECKCOMMAND, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_SERVICEEVENTHANDLER, BD_STRING, + { NDO_DATA_SERVICEEVENTHANDLER, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_SERVICENOTIFICATIONPERIOD, BD_STRING, + { NDO_DATA_SERVICENOTIFICATIONPERIOD, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_SERVICECHECKPERIOD, BD_STRING, + { NDO_DATA_SERVICECHECKPERIOD, BD_STRING, { .string = (es[5]==NULL) ? "" : es[5] }}, - { NDO_DATA_SERVICEFAILUREPREDICTIONOPTIONS, BD_STRING, + { NDO_DATA_SERVICEFAILUREPREDICTIONOPTIONS, BD_STRING, { .string = (es[6]==NULL) ? "" : es[6] }}, - { NDO_DATA_SERVICECHECKINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_SERVICECHECKINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_service->check_interval }}, - { NDO_DATA_SERVICERETRYINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_SERVICERETRYINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_service->retry_interval }}, - { NDO_DATA_MAXSERVICECHECKATTEMPTS, BD_INT, + { NDO_DATA_MAXSERVICECHECKATTEMPTS, BD_INT, { .integer = temp_service->max_attempts }}, - { NDO_DATA_FIRSTNOTIFICATIONDELAY, BD_FLOAT, + { NDO_DATA_FIRSTNOTIFICATIONDELAY, BD_FLOAT, { .floating_point = first_notification_delay }}, - { NDO_DATA_SERVICENOTIFICATIONINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_SERVICENOTIFICATIONINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_service->notification_interval }}, - { NDO_DATA_NOTIFYSERVICEUNKNOWN, BD_INT, + { NDO_DATA_NOTIFYSERVICEUNKNOWN, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_service->notification_options, @@ -4630,7 +4630,7 @@ int ndomod_write_object_config(int config_type){ temp_service->notify_on_unknown #endif }}, - { NDO_DATA_NOTIFYSERVICEWARNING, BD_INT, + { NDO_DATA_NOTIFYSERVICEWARNING, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_service->notification_options, @@ -4639,7 +4639,7 @@ int ndomod_write_object_config(int config_type){ temp_service->notify_on_warning #endif }}, - { NDO_DATA_NOTIFYSERVICECRITICAL, BD_INT, + { NDO_DATA_NOTIFYSERVICECRITICAL, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_service->notification_options, @@ -4648,7 +4648,7 @@ int ndomod_write_object_config(int config_type){ temp_service->notify_on_critical #endif }}, - { NDO_DATA_NOTIFYSERVICERECOVERY, BD_INT, + { NDO_DATA_NOTIFYSERVICERECOVERY, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_service->notification_options, @@ -4657,7 +4657,7 @@ int ndomod_write_object_config(int config_type){ temp_service->notify_on_recovery #endif }}, - { NDO_DATA_NOTIFYSERVICEFLAPPING, BD_INT, + { NDO_DATA_NOTIFYSERVICEFLAPPING, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_service->notification_options, @@ -4666,9 +4666,9 @@ int ndomod_write_object_config(int config_type){ temp_service->notify_on_flapping #endif }}, - { NDO_DATA_NOTIFYSERVICEDOWNTIME, BD_INT, + { NDO_DATA_NOTIFYSERVICEDOWNTIME, BD_INT, { .integer = notify_on_service_downtime }}, - { NDO_DATA_STALKSERVICEONOK, BD_INT, + { NDO_DATA_STALKSERVICEONOK, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_service->stalking_options, @@ -4677,7 +4677,7 @@ int ndomod_write_object_config(int config_type){ temp_service->stalk_on_ok #endif }}, - { NDO_DATA_STALKSERVICEONWARNING, BD_INT, + { NDO_DATA_STALKSERVICEONWARNING, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_service->stalking_options, @@ -4686,7 +4686,7 @@ int ndomod_write_object_config(int config_type){ temp_service->stalk_on_warning #endif }}, - { NDO_DATA_STALKSERVICEONUNKNOWN, BD_INT, + { NDO_DATA_STALKSERVICEONUNKNOWN, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_service->stalking_options, @@ -4695,7 +4695,7 @@ int ndomod_write_object_config(int config_type){ temp_service->stalk_on_unknown #endif }}, - { NDO_DATA_STALKSERVICEONCRITICAL, BD_INT, + { NDO_DATA_STALKSERVICEONCRITICAL, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_service->stalking_options, @@ -4704,30 +4704,30 @@ int ndomod_write_object_config(int config_type){ temp_service->stalk_on_critical #endif }}, - { NDO_DATA_SERVICEISVOLATILE, BD_INT, + { NDO_DATA_SERVICEISVOLATILE, BD_INT, { .integer = temp_service->is_volatile }}, - { NDO_DATA_SERVICEFLAPDETECTIONENABLED, BD_INT, + { NDO_DATA_SERVICEFLAPDETECTIONENABLED, BD_INT, { .integer = temp_service->flap_detection_enabled }}, - { NDO_DATA_FLAPDETECTIONONOK, BD_INT, + { NDO_DATA_FLAPDETECTIONONOK, BD_INT, { .integer = flap_detection_on_ok }}, - { NDO_DATA_FLAPDETECTIONONWARNING, BD_INT, + { NDO_DATA_FLAPDETECTIONONWARNING, BD_INT, { .integer = flap_detection_on_warning }}, - { NDO_DATA_FLAPDETECTIONONUNKNOWN, BD_INT, + { NDO_DATA_FLAPDETECTIONONUNKNOWN, BD_INT, { .integer = flap_detection_on_unknown }}, - { NDO_DATA_FLAPDETECTIONONCRITICAL, BD_INT, + { NDO_DATA_FLAPDETECTIONONCRITICAL, BD_INT, { .integer = flap_detection_on_critical }}, - { NDO_DATA_LOWSERVICEFLAPTHRESHOLD, BD_FLOAT, + { NDO_DATA_LOWSERVICEFLAPTHRESHOLD, BD_FLOAT, { .floating_point = temp_service->low_flap_threshold }}, - { NDO_DATA_HIGHSERVICEFLAPTHRESHOLD, BD_FLOAT, - { .floating_point = + { NDO_DATA_HIGHSERVICEFLAPTHRESHOLD, BD_FLOAT, + { .floating_point = temp_service->high_flap_threshold }}, - { NDO_DATA_PROCESSSERVICEPERFORMANCEDATA, BD_INT, + { NDO_DATA_PROCESSSERVICEPERFORMANCEDATA, BD_INT, { .integer = temp_service->process_performance_data }}, - { NDO_DATA_SERVICEFRESHNESSCHECKSENABLED, BD_INT, + { NDO_DATA_SERVICEFRESHNESSCHECKSENABLED, BD_INT, { .integer = temp_service->check_freshness }}, - { NDO_DATA_SERVICEFRESHNESSTHRESHOLD, BD_INT, + { NDO_DATA_SERVICEFRESHNESSTHRESHOLD, BD_INT, { .integer = temp_service->freshness_threshold }}, - { NDO_DATA_PASSIVESERVICECHECKSENABLED, BD_INT, + { NDO_DATA_PASSIVESERVICECHECKSENABLED, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X temp_service->accept_passive_checks @@ -4735,18 +4735,18 @@ int ndomod_write_object_config(int config_type){ temp_service->accept_passive_service_checks #endif }}, - { NDO_DATA_SERVICEEVENTHANDLERENABLED, BD_INT, + { NDO_DATA_SERVICEEVENTHANDLERENABLED, BD_INT, { .integer = temp_service->event_handler_enabled }}, - { NDO_DATA_ACTIVESERVICECHECKSENABLED, BD_INT, + { NDO_DATA_ACTIVESERVICECHECKSENABLED, BD_INT, { .integer = temp_service->checks_enabled }}, - { NDO_DATA_RETAINSERVICESTATUSINFORMATION, BD_INT, + { NDO_DATA_RETAINSERVICESTATUSINFORMATION, BD_INT, { .integer = temp_service->retain_status_information }}, - { NDO_DATA_RETAINSERVICENONSTATUSINFORMATION, BD_INT, - { .integer = + { NDO_DATA_RETAINSERVICENONSTATUSINFORMATION, BD_INT, + { .integer = temp_service->retain_nonstatus_information }}, - { NDO_DATA_SERVICENOTIFICATIONSENABLED, BD_INT, + { NDO_DATA_SERVICENOTIFICATIONSENABLED, BD_INT, { .integer = temp_service->notifications_enabled }}, - { NDO_DATA_OBSESSOVERSERVICE, BD_INT, + { NDO_DATA_OBSESSOVERSERVICE, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X temp_service->obsess @@ -4754,7 +4754,7 @@ int ndomod_write_object_config(int config_type){ temp_service->obsess_over_service #endif }}, - { NDO_DATA_FAILUREPREDICTIONENABLED, BD_INT, + { NDO_DATA_FAILUREPREDICTIONENABLED, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X 0 @@ -4762,24 +4762,24 @@ int ndomod_write_object_config(int config_type){ temp_service->failure_prediction_enabled #endif }}, - { NDO_DATA_NOTES, BD_STRING, + { NDO_DATA_NOTES, BD_STRING, { .string = (es[7]==NULL) ? "" : es[7] }}, - { NDO_DATA_NOTESURL, BD_STRING, + { NDO_DATA_NOTESURL, BD_STRING, { .string = (es[8]==NULL) ? "" : es[8] }}, - { NDO_DATA_ACTIONURL, BD_STRING, + { NDO_DATA_ACTIONURL, BD_STRING, { .string = (es[9]==NULL) ? "" : es[9] }}, - { NDO_DATA_ICONIMAGE, BD_STRING, + { NDO_DATA_ICONIMAGE, BD_STRING, { .string = (es[10]==NULL) ? "" : es[10] }}, - { NDO_DATA_ICONIMAGEALT, BD_STRING, + { NDO_DATA_ICONIMAGEALT, BD_STRING, { .string = (es[11]==NULL) ? "" : es[11] }}, #ifdef BUILD_NAGIOS_4X - { NDO_DATA_IMPORTANCE, BD_INT, + { NDO_DATA_IMPORTANCE, BD_INT, { .integer = temp_service->hourly_value }}, #endif }; - ndomod_broker_data_serialize(&dbuf, NDO_API_SERVICEDEFINITION, - service_definition, sizeof(service_definition) / + ndomod_broker_data_serialize(&dbuf, NDO_API_SERVICEDEFINITION, + service_definition, sizeof(service_definition) / sizeof(service_definition[ 0]), FALSE); } @@ -4787,7 +4787,7 @@ int ndomod_write_object_config(int config_type){ #ifdef BUILD_NAGIOS_4X /* dump parent services */ - ndomod_services_serialize(temp_service->parents, &dbuf, + ndomod_services_serialize(temp_service->parents, &dbuf, NDO_DATA_PARENTSERVICE); #endif @@ -4796,7 +4796,7 @@ int ndomod_write_object_config(int config_type){ /* dump individual contacts (not supported in Nagios 2.x) */ #ifndef BUILD_NAGIOS_2X - ndomod_contacts_serialize(temp_service->contacts, &dbuf, + ndomod_contacts_serialize(temp_service->contacts, &dbuf, NDO_DATA_CONTACT); #endif @@ -4821,23 +4821,23 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data servicegroup_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_SERVICEGROUPNAME, BD_STRING, + { NDO_DATA_SERVICEGROUPNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICEGROUPALIAS, BD_STRING, + { NDO_DATA_SERVICEGROUPALIAS, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, }; - ndomod_broker_data_serialize(&dbuf, NDO_API_SERVICEGROUPDEFINITION, - servicegroup_definition, sizeof(servicegroup_definition) / + ndomod_broker_data_serialize(&dbuf, NDO_API_SERVICEGROUPDEFINITION, + servicegroup_definition, sizeof(servicegroup_definition) / sizeof(servicegroup_definition[ 0]), FALSE); } NDOMOD_FREE_ESC_BUFFERS(es, 2); /* dump members for each servicegroup */ - ndomod_services_serialize(temp_servicegroup->members, &dbuf, + ndomod_services_serialize(temp_servicegroup->members, &dbuf, NDO_DATA_SERVICEGROUPMEMBER); ndomod_enddata_serialize(&dbuf); @@ -4860,20 +4860,20 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data hostescalation_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_HOSTNAME, BD_STRING, + { NDO_DATA_HOSTNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_ESCALATIONPERIOD, BD_STRING, + { NDO_DATA_ESCALATIONPERIOD, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_FIRSTNOTIFICATION, BD_INT, + { NDO_DATA_FIRSTNOTIFICATION, BD_INT, { .integer = temp_hostescalation->first_notification }}, - { NDO_DATA_LASTNOTIFICATION, BD_INT, + { NDO_DATA_LASTNOTIFICATION, BD_INT, { .integer = temp_hostescalation->last_notification }}, - { NDO_DATA_NOTIFICATIONINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_NOTIFICATIONINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_hostescalation->notification_interval }}, - { NDO_DATA_ESCALATEONRECOVERY, BD_INT, + { NDO_DATA_ESCALATEONRECOVERY, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_hostescalation->escalation_options, @@ -4882,7 +4882,7 @@ int ndomod_write_object_config(int config_type){ temp_hostescalation->escalate_on_recovery #endif }}, - { NDO_DATA_ESCALATEONDOWN, BD_INT, + { NDO_DATA_ESCALATEONDOWN, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_hostescalation->escalation_options, @@ -4891,7 +4891,7 @@ int ndomod_write_object_config(int config_type){ temp_hostescalation->escalate_on_down #endif }}, - { NDO_DATA_ESCALATEONUNREACHABLE, BD_INT, + { NDO_DATA_ESCALATEONUNREACHABLE, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_hostescalation->escalation_options, @@ -4902,22 +4902,22 @@ int ndomod_write_object_config(int config_type){ }}, }; - ndomod_broker_data_serialize(&dbuf, - NDO_API_HOSTESCALATIONDEFINITION, - hostescalation_definition, - sizeof(hostescalation_definition) / + ndomod_broker_data_serialize(&dbuf, + NDO_API_HOSTESCALATIONDEFINITION, + hostescalation_definition, + sizeof(hostescalation_definition) / sizeof(hostescalation_definition[ 0]), FALSE); } NDOMOD_FREE_ESC_BUFFERS(es, 2); /* dump contactgroups */ - ndomod_contactgroups_serialize(temp_hostescalation->contact_groups, + ndomod_contactgroups_serialize(temp_hostescalation->contact_groups, &dbuf); /* dump individual contacts (not supported in Nagios 2.x) */ #ifndef BUILD_NAGIOS_2X - ndomod_contacts_serialize(temp_hostescalation->contacts, &dbuf, + ndomod_contacts_serialize(temp_hostescalation->contacts, &dbuf, NDO_DATA_CONTACT); #endif @@ -4943,24 +4943,24 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data serviceescalation_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_HOSTNAME, BD_STRING, + { NDO_DATA_HOSTNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICEDESCRIPTION, BD_STRING, + { NDO_DATA_SERVICEDESCRIPTION, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_ESCALATIONPERIOD, BD_STRING, + { NDO_DATA_ESCALATIONPERIOD, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_FIRSTNOTIFICATION, BD_INT, - { .integer = + { NDO_DATA_FIRSTNOTIFICATION, BD_INT, + { .integer = temp_serviceescalation->first_notification }}, - { NDO_DATA_LASTNOTIFICATION, BD_INT, - { .integer = + { NDO_DATA_LASTNOTIFICATION, BD_INT, + { .integer = temp_serviceescalation->last_notification }}, - { NDO_DATA_NOTIFICATIONINTERVAL, BD_FLOAT, - { .floating_point = + { NDO_DATA_NOTIFICATIONINTERVAL, BD_FLOAT, + { .floating_point = (double)temp_serviceescalation->notification_interval }}, - { NDO_DATA_ESCALATEONRECOVERY, BD_INT, + { NDO_DATA_ESCALATEONRECOVERY, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_serviceescalation->escalation_options, @@ -4969,7 +4969,7 @@ int ndomod_write_object_config(int config_type){ temp_serviceescalation->escalate_on_recovery #endif }}, - { NDO_DATA_ESCALATEONWARNING, BD_INT, + { NDO_DATA_ESCALATEONWARNING, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_serviceescalation->escalation_options, @@ -4979,7 +4979,7 @@ int ndomod_write_object_config(int config_type){ #endif }}, - { NDO_DATA_ESCALATEONUNKNOWN, BD_INT, + { NDO_DATA_ESCALATEONUNKNOWN, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_serviceescalation->escalation_options, @@ -4988,7 +4988,7 @@ int ndomod_write_object_config(int config_type){ temp_serviceescalation->escalate_on_unknown #endif }}, - { NDO_DATA_ESCALATEONCRITICAL, BD_INT, + { NDO_DATA_ESCALATEONCRITICAL, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_serviceescalation->escalation_options, @@ -5001,10 +5001,10 @@ int ndomod_write_object_config(int config_type){ NDOMOD_FREE_ESC_BUFFERS(es, 3); - ndomod_broker_data_serialize(&dbuf, - NDO_API_SERVICEESCALATIONDEFINITION, - serviceescalation_definition, - sizeof(serviceescalation_definition) / + ndomod_broker_data_serialize(&dbuf, + NDO_API_SERVICEESCALATIONDEFINITION, + serviceescalation_definition, + sizeof(serviceescalation_definition) / sizeof(serviceescalation_definition[ 0]), FALSE); } @@ -5012,12 +5012,12 @@ int ndomod_write_object_config(int config_type){ es[0]=NULL; /* dump contactgroups */ - ndomod_contactgroups_serialize(temp_serviceescalation->contact_groups, + ndomod_contactgroups_serialize(temp_serviceescalation->contact_groups, &dbuf); /* dump individual contacts (not supported in Nagios 2.x) */ #ifndef BUILD_NAGIOS_2X - ndomod_contacts_serialize(temp_serviceescalation->contacts, &dbuf, + ndomod_contacts_serialize(temp_serviceescalation->contacts, &dbuf, NDO_DATA_CONTACT); #endif @@ -5049,19 +5049,19 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data hostdependency_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_HOSTNAME, BD_STRING, + { NDO_DATA_HOSTNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_DEPENDENTHOSTNAME, BD_STRING, + { NDO_DATA_DEPENDENTHOSTNAME, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_DEPENDENCYTYPE, BD_INT, + { NDO_DATA_DEPENDENCYTYPE, BD_INT, { .integer = temp_hostdependency->dependency_type }}, - { NDO_DATA_INHERITSPARENT, BD_INT, + { NDO_DATA_INHERITSPARENT, BD_INT, { .integer = temp_hostdependency->inherits_parent }}, - { NDO_DATA_DEPENDENCYPERIOD, BD_STRING, + { NDO_DATA_DEPENDENCYPERIOD, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_FAILONUP, BD_INT, + { NDO_DATA_FAILONUP, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_hostdependency->failure_options, @@ -5070,7 +5070,7 @@ int ndomod_write_object_config(int config_type){ temp_hostdependency->fail_on_up #endif }}, - { NDO_DATA_FAILONDOWN, BD_INT, + { NDO_DATA_FAILONDOWN, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_hostdependency->failure_options, @@ -5079,7 +5079,7 @@ int ndomod_write_object_config(int config_type){ temp_hostdependency->fail_on_down #endif }}, - { NDO_DATA_FAILONUNREACHABLE, BD_INT, + { NDO_DATA_FAILONUNREACHABLE, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_hostdependency->failure_options, @@ -5092,10 +5092,10 @@ int ndomod_write_object_config(int config_type){ NDOMOD_FREE_ESC_BUFFERS(es, 3); - ndomod_broker_data_serialize(&dbuf, - NDO_API_HOSTDEPENDENCYDEFINITION, - hostdependency_definition, - sizeof(hostdependency_definition) / + ndomod_broker_data_serialize(&dbuf, + NDO_API_HOSTDEPENDENCYDEFINITION, + hostdependency_definition, + sizeof(hostdependency_definition) / sizeof(hostdependency_definition[ 0]), TRUE); } @@ -5127,23 +5127,23 @@ int ndomod_write_object_config(int config_type){ { struct ndo_broker_data servicedependency_definition[] = { - { NDO_DATA_TIMESTAMP, BD_TIMEVAL, + { NDO_DATA_TIMESTAMP, BD_TIMEVAL, { .timestamp = now }}, - { NDO_DATA_HOSTNAME, BD_STRING, + { NDO_DATA_HOSTNAME, BD_STRING, { .string = (es[0]==NULL) ? "" : es[0] }}, - { NDO_DATA_SERVICEDESCRIPTION, BD_STRING, + { NDO_DATA_SERVICEDESCRIPTION, BD_STRING, { .string = (es[1]==NULL) ? "" : es[1] }}, - { NDO_DATA_DEPENDENTHOSTNAME, BD_STRING, + { NDO_DATA_DEPENDENTHOSTNAME, BD_STRING, { .string = (es[2]==NULL) ? "" : es[2] }}, - { NDO_DATA_DEPENDENTSERVICEDESCRIPTION, BD_STRING, + { NDO_DATA_DEPENDENTSERVICEDESCRIPTION, BD_STRING, { .string = (es[3]==NULL) ? "" : es[3] }}, - { NDO_DATA_DEPENDENCYTYPE, BD_INT, + { NDO_DATA_DEPENDENCYTYPE, BD_INT, { .integer = temp_servicedependency->dependency_type }}, - { NDO_DATA_INHERITSPARENT, BD_INT, + { NDO_DATA_INHERITSPARENT, BD_INT, { .integer = temp_servicedependency->inherits_parent }}, - { NDO_DATA_DEPENDENCYPERIOD, BD_STRING, + { NDO_DATA_DEPENDENCYPERIOD, BD_STRING, { .string = (es[4]==NULL) ? "" : es[4] }}, - { NDO_DATA_FAILONOK, BD_INT, + { NDO_DATA_FAILONOK, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_servicedependency->failure_options, @@ -5152,7 +5152,7 @@ int ndomod_write_object_config(int config_type){ temp_servicedependency->fail_on_ok #endif }}, - { NDO_DATA_FAILONWARNING, BD_INT, + { NDO_DATA_FAILONWARNING, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_servicedependency->failure_options, @@ -5161,7 +5161,7 @@ int ndomod_write_object_config(int config_type){ temp_servicedependency->fail_on_warning #endif }}, - { NDO_DATA_FAILONUNKNOWN, BD_INT, + { NDO_DATA_FAILONUNKNOWN, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_servicedependency->failure_options, @@ -5170,7 +5170,7 @@ int ndomod_write_object_config(int config_type){ temp_servicedependency->fail_on_unknown #endif }}, - { NDO_DATA_FAILONCRITICAL, BD_INT, + { NDO_DATA_FAILONCRITICAL, BD_INT, { .integer = #ifdef BUILD_NAGIOS_4X flag_isset(temp_servicedependency->failure_options, @@ -5183,10 +5183,10 @@ int ndomod_write_object_config(int config_type){ NDOMOD_FREE_ESC_BUFFERS(es, 5); - ndomod_broker_data_serialize(&dbuf, - NDO_API_SERVICEDEPENDENCYDEFINITION, - servicedependency_definition, - sizeof(servicedependency_definition) / + ndomod_broker_data_serialize(&dbuf, + NDO_API_SERVICEDEPENDENCYDEFINITION, + servicedependency_definition, + sizeof(servicedependency_definition) / sizeof(servicedependency_definition[ 0]), TRUE); } diff --git a/src/queue.c b/src/queue.c index 2be999c..d2764f3 100644 --- a/src/queue.c +++ b/src/queue.c @@ -5,6 +5,7 @@ #include #include #include +#include "../include/config.h" #include "../include/queue.h" #include #include @@ -68,7 +69,7 @@ void log_retry( void) { #if defined( __linux__) const char * statsfmt = "You are currently using %lu of %lu messages and %lu of %lu bytes in the queue."; #endif - + time( &now); /* if we've never logged a retry message or we've exceeded the retry log interval */ @@ -89,8 +90,8 @@ void log_retry( void) { syslog(LOG_ERR, logmsg); } else { - sprintf(curstats, statsfmt, queue_stats.msg_qnum, - (unsigned long)msgmni, queue_stats.__msg_cbytes, + sprintf(curstats, statsfmt, queue_stats.msg_qnum, + (unsigned long)msgmni, queue_stats.__msg_cbytes, queue_stats.msg_qbytes); sprintf(logmsg, logfmt, curstats); syslog(LOG_ERR, logmsg); @@ -130,7 +131,7 @@ void push_into_queue (char* buf) { nanosleep(&delay,NULL); #else sleep(1); - #endif + #endif } if (retrynum < MAX_RETRIES) { syslog(LOG_ERR,"Message sent to queue.\n"); From 2ad78ff8d9877ad2ed36c2a8c68e13a5e6ee3ad3 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 2 Dec 2015 09:58:36 -0600 Subject: [PATCH 06/73] Active objects are gathered earlier in the process. Plus a few minor changes. --- src/dbhandlers.c | 7 ++++--- src/ndomod.c | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dbhandlers.c b/src/dbhandlers.c index 7fe0f5a..5319d2c 100644 --- a/src/dbhandlers.c +++ b/src/dbhandlers.c @@ -5015,9 +5015,9 @@ int ndo2db_handle_contactgroupdefinition(ndo2db_idi *idi){ } /* - * In this function, we get a list of up to 100 objects, with the object type + * In this function, we get a list of up to 250 objects, with the object type * stored in idi->buffered_input[NDO_DATA_ACTIVEOBJECTSTYPE]. The list of - * object names are in the idi->buffered_input with indexes from 1 to 100. + * object names are in the idi->buffered_input with indexes from 1 to 250. * We generate an UPDATE query to set them all active at one time. */ int ndo2db_handle_activeobjectlist(ndo2db_idi *idi) @@ -5131,7 +5131,8 @@ int ndo2db_handle_activeobjectlist(ndo2db_idi *idi) return NDO_ERROR; } - rc = ndo2db_db_query(idi, dbuf.buf); + if (!first) + rc = ndo2db_db_query(idi, dbuf.buf); ndo_dbuf_free(&dbuf); return rc; } diff --git a/src/ndomod.c b/src/ndomod.c index a0d4fcf..93e3554 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -1779,6 +1779,8 @@ int ndomod_broker_data(int event_type, void *data){ case NEBCALLBACK_PROCESS_DATA: + ndomod_write_active_objects(); + procdata=(nebstruct_process_data *)data; { @@ -3518,7 +3520,7 @@ int ndomod_write_config(int config_type){ temp_buffer[sizeof(temp_buffer)-1]='\x0'; ndomod_write_to_sink(temp_buffer,NDO_TRUE,NDO_TRUE); - ndomod_write_active_objects(); +/* ndomod_write_active_objects(); */ /* dump object config info */ result=ndomod_write_object_config(config_type); @@ -3742,7 +3744,7 @@ void ndomod_write_active_objects() active_objects[obj_count].key = obj_count; active_objects[obj_count].datatype = BD_STRING; active_objects[obj_count].value.string = (name2 == NULL) ? "" : name2; - if (++obj_count > 97) { + if (++obj_count > 250) { ndomod_broker_data_serialize(&dbuf, NDO_API_ACTIVEOBJECTSLIST, active_objects, obj_count, TRUE); ndomod_write_to_sink(dbuf.buf,NDO_TRUE,NDO_TRUE); From 0896780fdd4845113dac1057cf3fc272bab481db Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 2 Dec 2015 12:29:28 -0600 Subject: [PATCH 07/73] Update nagios headers to (mostly) match the ones actually in core --- include/nagios-4x/cgiutils.h | 17 ++++++++++++++++ include/nagios-4x/comments.h | 22 ++++++++++----------- include/nagios-4x/common.h | 5 +++-- include/nagios-4x/config.h | 15 ++++++++++++--- include/nagios-4x/defaults.h | 6 +++--- include/nagios-4x/downtime.h | 7 ++++--- include/nagios-4x/lib/fanout.h | 2 +- include/nagios-4x/lib/nsutils.h | 10 +++++++++- include/nagios-4x/lib/runcmd.h | 30 ++++++++++++++++++++++------- include/nagios-4x/lib/squeue.h | 19 ++++++++++++++++++ include/nagios-4x/lib/t-utils.h | 4 ++-- include/nagios-4x/lib/worker.h | 1 + include/nagios-4x/logging.h | 4 ++-- include/nagios-4x/macros.h | 5 +++-- include/nagios-4x/nagios.h | 28 +++++++++++++++++++++------ include/nagios-4x/nebcallbacks.h | 4 ++-- include/nagios-4x/neberrors.h | 4 ++-- include/nagios-4x/nebmods.h | 4 ++-- include/nagios-4x/nebmodules.h | 4 ++-- include/nagios-4x/nebstructs.h | 4 ++-- include/nagios-4x/netutils.h | 4 ++-- include/nagios-4x/objects.h | 33 ++++++++++++++++++++++++++------ include/nagios-4x/perfdata.h | 4 ++-- include/nagios-4x/shared.h | 5 +++-- include/nagios-4x/statusdata.h | 4 ++-- src/ndomod.c | 4 ++++ 26 files changed, 182 insertions(+), 67 deletions(-) diff --git a/include/nagios-4x/cgiutils.h b/include/nagios-4x/cgiutils.h index 768edff..fe4354d 100644 --- a/include/nagios-4x/cgiutils.h +++ b/include/nagios-4x/cgiutils.h @@ -35,7 +35,12 @@ NAGIOS_BEGIN_DECL /******************************* CGI NAMES **********************************/ #define STATUS_CGI "status.cgi" +#ifdef LEGACY_GRAPHICAL_CGIS #define STATUSMAP_CGI "statusmap.cgi" +#else +#define STATUSMAP_CGI "../map.html" +#define LEGACY_STATUSMAP_CGI "statusmap.cgi" +#endif #define STATUSWORLD_CGI "statuswrl.cgi" #define COMMAND_CGI "cmd.cgi" #define EXTINFO_CGI "extinfo.cgi" @@ -44,12 +49,22 @@ NAGIOS_BEGIN_DECL #define HISTORY_CGI "history.cgi" #define CONFIG_CGI "config.cgi" #define OUTAGES_CGI "outages.cgi" +#ifdef LEGACY_GRAPHICAL_CGIS #define TRENDS_CGI "trends.cgi" +#else +#define TRENDS_CGI "../trends.html" +#define LEGACY_TRENDS_CGI "trends.cgi" +#endif #define AVAIL_CGI "avail.cgi" #define TAC_CGI "tac.cgi" #define STATUSWML_CGI "statuswml.cgi" #define TRACEROUTE_CGI "traceroute.cgi" +#ifdef LEGACY_GRAPHICAL_CGIS #define HISTOGRAM_CGI "histogram.cgi" +#else +#define HISTOGRAM_CGI "../histogram.html" +#define LEGACY_HISTOGRAM_CGI "histogram.cgi" +#endif #define CHECKSANITY_CGI "checksanity.cgi" #define MINISTATUS_CGI "ministatus.cgi" #define SUMMARY_CGI "summary.cgi" @@ -222,6 +237,8 @@ NAGIOS_BEGIN_DECL #define NOTIFICATION_HOST_FLAP 4096 #define NOTIFICATION_SERVICE_CUSTOM 8192 #define NOTIFICATION_HOST_CUSTOM 16384 +#define NOTIFICATION_SERVICE_DOWNTIME 32768 +#define NOTIFICATION_HOST_DOWNTIME 65536 /********************** HOST AND SERVICE ALERT TYPES **********************/ diff --git a/include/nagios-4x/comments.h b/include/nagios-4x/comments.h index ce077c7..91f337c 100644 --- a/include/nagios-4x/comments.h +++ b/include/nagios-4x/comments.h @@ -58,7 +58,7 @@ NAGIOS_BEGIN_DECL /* COMMENT structure */ -typedef struct comment { +typedef struct nagios_comment { int comment_type; int entry_type; unsigned long comment_id; @@ -71,11 +71,11 @@ typedef struct comment { char *service_description; char *author; char *comment_data; - struct comment *next; - struct comment *nexthash; - } comment; + struct nagios_comment *next; + struct nagios_comment *nexthash; + } nagios_comment; -extern struct comment *comment_list; +extern struct nagios_comment *comment_list; #ifndef NSCGI int initialize_comment_data(void); /* initializes comment data */ @@ -94,12 +94,12 @@ int delete_service_acknowledgement_comments(struct service *); /* de int check_for_expired_comment(unsigned long); /* expires a comment */ #endif -struct comment *find_comment(unsigned long, int); /* finds a specific comment */ -struct comment *find_service_comment(unsigned long); /* finds a specific service comment */ -struct comment *find_host_comment(unsigned long); /* finds a specific host comment */ +struct nagios_comment *find_comment(unsigned long, int); /* finds a specific comment */ +struct nagios_comment *find_service_comment(unsigned long); /* finds a specific service comment */ +struct nagios_comment *find_host_comment(unsigned long); /* finds a specific host comment */ -struct comment *get_first_comment_by_host(char *); -struct comment *get_next_comment_by_host(char *, struct comment *); +struct nagios_comment *get_first_comment_by_host(char *); +struct nagios_comment *get_next_comment_by_host(char *, struct nagios_comment *); int number_of_host_comments(char *); /* returns the number of comments associated with a particular host */ int number_of_service_comments(char *, char *); /* returns the number of comments associated with a particular service */ @@ -109,7 +109,7 @@ int sort_comments(void); int add_host_comment(int, char *, time_t, char *, char *, unsigned long, int, int, time_t, int); /* adds a host comment */ int add_service_comment(int, char *, char *, time_t, char *, char *, unsigned long, int, int, time_t, int); /* adds a service comment */ -int add_comment_to_hashlist(struct comment *); +int add_comment_to_hashlist(struct nagios_comment *); void free_comment_data(void); /* frees memory allocated to the comment list */ diff --git a/include/nagios-4x/common.h b/include/nagios-4x/common.h index 5230bab..bc9d6d9 100644 --- a/include/nagios-4x/common.h +++ b/include/nagios-4x/common.h @@ -24,8 +24,8 @@ #include "shared.h" -#define PROGRAM_VERSION "4.0.0beta4" -#define PROGRAM_MODIFICATION_DATE "09-01-2013" +#define PROGRAM_VERSION "4.1.2-Pre1" +#define PROGRAM_MODIFICATION_DATE "11-16-2015" NAGIOS_BEGIN_DECL @@ -41,6 +41,7 @@ extern int log_rotation_method; extern int check_external_commands; /* set this if you're going to add a ton of comments at once */ extern int defer_comment_sorting; +extern unsigned long next_downtime_id; extern char *object_cache_file; extern char *status_file; diff --git a/include/nagios-4x/config.h b/include/nagios-4x/config.h index b21dc1b..38f3aaa 100644 --- a/include/nagios-4x/config.h +++ b/include/nagios-4x/config.h @@ -31,7 +31,7 @@ #define USE_EVENT_BROKER /**/ /* commands used by CGIs */ -#define TRACEROUTE_COMMAND "/bin/traceroute" +#define TRACEROUTE_COMMAND "" /* #undef PING_COMMAND */ /* #undef PING_PACKETS_FIRST */ @@ -143,7 +143,7 @@ #ifdef HAVE_PWD_H #include #endif - + #define HAVE_GRP_H 1 #ifdef HAVE_GRP_H #include @@ -194,6 +194,15 @@ #include #endif +/* Another Solarisism: getloadavg() lives in , not , + * so include the former if it exists. This may be true on other systems, or + * this function may be missing altogether (see: + * https://www.gnu.org/software/gnulib/manual/html_node/getloadavg.html). */ +/* #undef HAVE_SYS_LOADAVG_H */ +#ifdef HAVE_SYS_LOADAVG_H +#include +#endif + #define HAVE_SYS_TYPES_H 1 #ifdef HAVE_SYS_TYPES_H #include @@ -313,7 +322,7 @@ #ifdef USE_LTDL #include #else -#define HAVE_DLFCN_H /**/ +/* #undef HAVE_DLFCN_H */ #ifdef HAVE_DLFCN_H #include #endif diff --git a/include/nagios-4x/defaults.h b/include/nagios-4x/defaults.h index a9aa606..a2e05b3 100644 --- a/include/nagios-4x/defaults.h +++ b/include/nagios-4x/defaults.h @@ -1,5 +1,5 @@ -#ifndef NDO_DEFAULTS_H_INCLUDED -#define NDO_DEFAULTS_H_INCLUDED +#ifndef NAGIOS_DEFAULTS_H_INCLUDED +#define NAGIOS_DEFAULTS_H_INCLUDED /******************* DEFAULT VALUES *******************/ @@ -91,4 +91,4 @@ #define DEFAULT_HOST_PERFDATA_PROCESS_EMPTY_RESULTS 1 #define DEFAULT_SERVICE_PERFDATA_PROCESS_EMPTY_RESULTS 1 -#endif /* NDO_DEFAULTS_H_INCLUDED */ +#endif /* NAGIOS_DEFAULTS_H_INCLUDED */ diff --git a/include/nagios-4x/downtime.h b/include/nagios-4x/downtime.h index b8e476d..38244b8 100644 --- a/include/nagios-4x/downtime.h +++ b/include/nagios-4x/downtime.h @@ -21,8 +21,8 @@ *****************************************************************************/ -#ifndef NDO_DOWNTIME_H_INCLUDED -#define NDO_DOWNTIME_H_INCLUDED +#ifndef NAGIOS_DOWNTIME_H_INCLUDED +#define NAGIOS_DOWNTIME_H_INCLUDED #include "common.h" #include "objects.h" @@ -58,15 +58,16 @@ typedef struct scheduled_downtime { #ifndef NSCGI struct timed_event *start_event, *stop_event; #endif + struct scheduled_downtime *prev; } scheduled_downtime; extern struct scheduled_downtime *scheduled_downtime_list; -#ifndef NSCGI int initialize_downtime_data(void); /* initializes scheduled downtime data */ int cleanup_downtime_data(void); /* cleans up scheduled downtime data */ +#ifndef NSCGI int add_new_downtime(int, char *, char *, time_t, char *, char *, time_t, time_t, int, unsigned long, unsigned long, unsigned long *, int, int); int add_new_host_downtime(char *, time_t, char *, char *, time_t, time_t, int, unsigned long, unsigned long, unsigned long *, int, int); int add_new_service_downtime(char *, char *, time_t, char *, char *, time_t, time_t, int, unsigned long, unsigned long, unsigned long *, int, int); diff --git a/include/nagios-4x/lib/fanout.h b/include/nagios-4x/lib/fanout.h index 6f12634..003537e 100644 --- a/include/nagios-4x/lib/fanout.h +++ b/include/nagios-4x/lib/fanout.h @@ -64,7 +64,7 @@ extern int fanout_add(fanout_table *t, unsigned long key, void *data); * Remove an entry from the fanout table and return its data. * * @param[in] t fanout table to look in - * @param[key] The key whose data we should locate + * @param[in] key The key whose data we should locate * @return Pointer to the data stored on success; NULL on errors */ extern void *fanout_remove(fanout_table *t, unsigned long key); diff --git a/include/nagios-4x/lib/nsutils.h b/include/nagios-4x/lib/nsutils.h index e5e5d17..a003535 100644 --- a/include/nagios-4x/lib/nsutils.h +++ b/include/nagios-4x/lib/nsutils.h @@ -1,6 +1,7 @@ #ifndef LIBNAGIOS_NSUTILS_H_INCLUDED #define LIBNAGIOS_NSUTILS_H_INCLUDED #include +#include /** * @file nsutils.h @@ -67,7 +68,14 @@ static inline unsigned int ranged_urand(unsigned int low, unsigned int high) /** * Get number of online cpus - * @return Number of kernel-handled cpu cores + * @return Active cpu cores detected on success. 0 on failure. + */ +extern int real_online_cpus(void); + +/** + * Wrapper for real_online_cpus(), returning 1 in case we can't + * detect any active cpus. + * @return Number of active cpu cores on success. 1 on failure. */ extern int online_cpus(void); diff --git a/include/nagios-4x/lib/runcmd.h b/include/nagios-4x/lib/runcmd.h index aaf2f7d..a206a2c 100644 --- a/include/nagios-4x/lib/runcmd.h +++ b/include/nagios-4x/lib/runcmd.h @@ -6,9 +6,20 @@ * @file runcmd.h * @brief runcmd library function declarations * + * A simple interface to executing programs from other programs, using an + * optimized and safer popen()-like implementation. It is considered safer in + * that no shell needs to be spawned for simple commands, and the environment + * passed to the execve()'d program is essentially empty. + * + * This code is based on popen.c, which in turn was taken from + * "Advanced Programming in the UNIX Environment" by W. Richard Stevens. + * + * Care has been taken to make sure the functions are async-safe. The exception + * is runcmd_init() which multithreaded applications or plugins must call in a + * non-reentrant manner before calling any other runcmd function. + * * @note This is inherited from the nagiosplugins project, although - * I (AE) wrote the original code, and it might need refactoring - * for performance later. + * it might need refactoring for performance later. * @{ */ @@ -35,7 +46,8 @@ * * Only multi-threaded programs that might launch the first external * program from multiple threads simultaneously need to bother with - * this. + * this, and they must ensure this is called at least once in a non-reentrant + * manner before calling any other runcmd function. */ extern void runcmd_init(void); @@ -55,13 +67,16 @@ extern const char *runcmd_strerror(int code); /** * Start a command from a command string - * @param[in] cmdstring The command to launch + * @param[in] cmd The command to launch * @param[out] pfd Child's stdout filedescriptor * @param[out] pfderr Child's stderr filedescriptor * @param[in] env Currently ignored for portability + * @param[in] iobreg The callback function to register the iobrokers for the read ends of the pipe + * @param[in] iobregarg The "arg" value to pass to iobroker_register() */ -extern int runcmd_open(const char *cmdstring, int *pfd, int *pfderr, char **env) - __attribute__((__nonnull__(1, 2, 3))); +extern int runcmd_open(const char *cmd, int *pfd, int *pfderr, char **env, + void (*iobreg)(int, int, void *), void *iobregarg) + __attribute__((__nonnull__(1, 2, 3, 5, 6))); /** * Close a command and return its exit status @@ -89,5 +104,6 @@ extern int runcmd_close(int fd); */ extern int runcmd_cmd2strv(const char *str, int *out_argc, char **out_argv); -#endif /* INCLUDE_runcmd_h__ */ /** @} */ +/* INCLUDE_runcmd_h__ */ +#endif diff --git a/include/nagios-4x/lib/squeue.h b/include/nagios-4x/lib/squeue.h index 0b83a47..9819c03 100644 --- a/include/nagios-4x/lib/squeue.h +++ b/include/nagios-4x/lib/squeue.h @@ -113,6 +113,15 @@ extern squeue_event *squeue_add_usec(squeue_t *q, time_t when, time_t usec, void */ extern squeue_event *squeue_add_msec(squeue_t *q, time_t when, time_t msec, void *data); +/** + * Change an event's priority to a new time. + * + * @param q The scheduling queue holding the event. + * @param evt The event to reschedule. + * @param tv When the event should be rescheduled to. + */ +extern void squeue_change_priority_tv(squeue_t *q, squeue_event *evt, struct timeval *tv); + /** * Returns the data of the next scheduled event from the scheduling * queue without removing it from the queue. @@ -147,5 +156,15 @@ extern int squeue_remove(squeue_t *q, squeue_event *evt); * @return number of events in the inspected queue */ extern unsigned int squeue_size(squeue_t *q); + + +/** + * Returns true if passed timeval is after the time for the event + * + * @param[in] evt The queue event to inspect + * @param[in] reftime The reference time to compare to the queue event time + * @return 1 if reftime > event time, 0 otherwise + */ +extern int squeue_evt_when_is_after(squeue_event *evt, struct timeval *reftime); #endif /** @} */ diff --git a/include/nagios-4x/lib/t-utils.h b/include/nagios-4x/lib/t-utils.h index eee2a1e..1fa25de 100644 --- a/include/nagios-4x/lib/t-utils.h +++ b/include/nagios-4x/lib/t-utils.h @@ -1,5 +1,5 @@ -#ifndef NDO_T_UTILS_H_INCLUDED -#define NDO_T_UTILS_H_INCLUDED +#ifndef NAGIOS_T_UTILS_H_INCLUDED +#define NAGIOS_T_UTILS_H_INCLUDED #include #include #include diff --git a/include/nagios-4x/lib/worker.h b/include/nagios-4x/lib/worker.h index b6a8062..6a2ffbc 100644 --- a/include/nagios-4x/lib/worker.h +++ b/include/nagios-4x/lib/worker.h @@ -33,6 +33,7 @@ typedef struct execution_information execution_information; typedef struct child_process { unsigned int id, timeout; char *cmd; + struct kvvec *env; int ret; struct kvvec *request; iobuf outstd; diff --git a/include/nagios-4x/logging.h b/include/nagios-4x/logging.h index a900cbc..4a86fb2 100644 --- a/include/nagios-4x/logging.h +++ b/include/nagios-4x/logging.h @@ -1,5 +1,5 @@ -#ifndef NDO_LOGGING_H_INCLUDED -#define NDO_LOGGING_H_INCLUDED +#ifndef NAGIOS_LOGGING_H_INCLUDED +#define NAGIOS_LOGGING_H_INCLUDED #include "objects.h" diff --git a/include/nagios-4x/macros.h b/include/nagios-4x/macros.h index 6879820..91a624d 100644 --- a/include/nagios-4x/macros.h +++ b/include/nagios-4x/macros.h @@ -19,8 +19,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************************************************************/ -#ifndef NDO_MACROS_H_INCLUDED -#define NDO_MACROS_H_INCLUDED +#ifndef NAGIOS_MACROS_H_INCLUDED +#define NAGIOS_MACROS_H_INCLUDED #include "common.h" #include "objects.h" @@ -316,6 +316,7 @@ int clear_servicegroup_macros_r(nagios_macros *mac); int clear_contact_macros_r(nagios_macros *mac); int clear_contactgroup_macros_r(nagios_macros *mac); int clear_summary_macros_r(nagios_macros *mac); +int clear_datetime_macros_r(nagios_macros *mac); #ifndef NSCGI diff --git a/include/nagios-4x/nagios.h b/include/nagios-4x/nagios.h index 6b8e6e8..daf3ef4 100644 --- a/include/nagios-4x/nagios.h +++ b/include/nagios-4x/nagios.h @@ -17,8 +17,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************************************************************/ -#ifndef NDO_NAGIOS_H_INCLUDED -#define NDO_NAGIOS_H_INCLUDED +#ifndef NAGIOS_NAGIOS_H_INCLUDED +#define NAGIOS_NAGIOS_H_INCLUDED #ifndef NSCORE # define NSCORE @@ -187,6 +187,8 @@ extern unsigned long max_debug_file_size; extern int allow_empty_hostgroup_assignment; +extern int host_down_disable_service_checks; + extern time_t last_program_stop; extern time_t event_start; @@ -197,7 +199,6 @@ extern int currently_running_host_checks; extern unsigned long next_event_id; extern unsigned long next_problem_id; extern unsigned long next_comment_id; -extern unsigned long next_downtime_id; extern unsigned long next_notification_id; extern unsigned long modified_process_attributes; @@ -423,7 +424,7 @@ NAGIOS_BEGIN_DECL #define normal_check_window(o) ((time_t)(o->check_interval * interval_length)) #define retry_check_window(o) ((time_t)(o->retry_interval * interval_length)) #define check_window(o) \ - ((!o->current_state && o->state_type == SOFT_STATE) ? \ + ((o->current_state && o->state_type == SOFT_STATE) ? \ retry_check_window(o) : \ normal_check_window(o)) @@ -484,6 +485,7 @@ extern void handle_sigxfsz(int); /* handle SIGXFSZ */ int daemon_init(void); /* switches to daemon mode */ int drop_privileges(char *, char *); /* drops privileges before startup */ void display_scheduling_info(void); /* displays service check scheduling information */ +void init_main_cfg_vars(int); /* Initialize the non-shared main configuration variables */ /**** Event Queue Functions ****/ @@ -528,9 +530,9 @@ int my_system_r(nagios_macros *mac, char *, int, int *, double *, char **, int); void check_for_service_flapping(service *, int, int); /* determines whether or not a service is "flapping" between states */ void check_for_host_flapping(host *, int, int, int); /* determines whether or not a host is "flapping" between states */ void set_service_flap(service *, double, double, double, int); /* handles a service that is flapping */ -void clear_service_flap(service *, double, double, double); /* handles a service that has stopped flapping */ +void clear_service_flap(service *, double, double, double, int); /* handles a service that has stopped flapping */ void set_host_flap(host *, double, double, double, int); /* handles a host that is flapping */ -void clear_host_flap(host *, double, double, double); /* handles a host that has stopped flapping */ +void clear_host_flap(host *, double, double, double, int); /* handles a host that has stopped flapping */ void enable_flap_detection_routines(void); /* enables flap detection on a program-wide basis */ void disable_flap_detection_routines(void); /* disables flap detection on a program-wide basis */ void enable_host_flap_detection(host *); /* enables flap detection for a particular host */ @@ -620,6 +622,20 @@ void my_system_sighandler(int); /* handles timeouts when executing commands v char *get_next_string_from_buf(char *buf, int *start_index, int bufsize); int compare_strings(char *, char *); /* compares two strings for equality */ char *escape_newlines(char *); +/** + * Unescapes newlines and backslashes in a check result output string read from + * a source that uses newlines as a delimiter (e.g., files in the checkresults + * spool dir, or the command pipe). + * @note: There is an unescape_newlines() in cgi/cgiutils.c that unescapes more + * than '\\' and '\n' in place. Since this function is specifically intended + * for processing escaped plugin output, we'll use a more specific name to + * avoid confusion and conflicts. + * @param rawbuf Input string tp unescape. + * @return An unescaped copy of rawbuf in a newly allocated string, or NULL if + * rawbuf is NULL or no memory could be allocated for the new string. + */ +char *unescape_check_result_output(const char *rawbuf); + int contains_illegal_object_chars(char *); /* tests whether or not an object name (host, service, etc.) contains illegal characters */ int my_rename(char *, char *); /* renames a file - works across filesystems */ int my_fcopy(char *, char *); /* copies a file - works across filesystems */ diff --git a/include/nagios-4x/nebcallbacks.h b/include/nagios-4x/nebcallbacks.h index 45aabf1..f67477a 100644 --- a/include/nagios-4x/nebcallbacks.h +++ b/include/nagios-4x/nebcallbacks.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef NDO_NEBCALLBACKS_H_INCLUDED -#define NDO_NEBCALLBACKS_H_INCLUDED +#ifndef NAGIOS_NEBCALLBACKS_H_INCLUDED +#define NAGIOS_NEBCALLBACKS_H_INCLUDED #include "nebmodules.h" diff --git a/include/nagios-4x/neberrors.h b/include/nagios-4x/neberrors.h index e27fadd..d4cba36 100644 --- a/include/nagios-4x/neberrors.h +++ b/include/nagios-4x/neberrors.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef NDO_NEBERRORS_H_INCLUDED -#define NDO_NEBERRORS_H_INCLUDED +#ifndef NAGIOS_NEBERRORS_H_INCLUDED +#define NAGIOS_NEBERRORS_H_INCLUDED /***** GENERIC DEFINES *****/ diff --git a/include/nagios-4x/nebmods.h b/include/nagios-4x/nebmods.h index 74e6267..760ff0b 100644 --- a/include/nagios-4x/nebmods.h +++ b/include/nagios-4x/nebmods.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef NDO_NEBMODS_H_INCLUDED -#define NDO_NEBMODS_H_INCLUDED +#ifndef NAGIOS_NEBMODS_H_INCLUDED +#define NAGIOS_NEBMODS_H_INCLUDED #include "nebcallbacks.h" #include "nebmodules.h" diff --git a/include/nagios-4x/nebmodules.h b/include/nagios-4x/nebmodules.h index 54ad948..4fc2b2f 100644 --- a/include/nagios-4x/nebmodules.h +++ b/include/nagios-4x/nebmodules.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef NDO_NEBMODULES_H_INCLUDED -#define NDO_NEBMODULES_H_INCLUDED +#ifndef NAGIOS_NEBMODULES_H_INCLUDED +#define NAGIOS_NEBMODULES_H_INCLUDED #include "common.h" NAGIOS_BEGIN_DECL diff --git a/include/nagios-4x/nebstructs.h b/include/nagios-4x/nebstructs.h index c14d46e..904ece4 100644 --- a/include/nagios-4x/nebstructs.h +++ b/include/nagios-4x/nebstructs.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef NDO_NEBSTRUCTS_H_INCLUDED -#define NDO_NEBSTRUCTS_H_INCLUDED +#ifndef NAGIOS_NEBSTRUCTS_H_INCLUDED +#define NAGIOS_NEBSTRUCTS_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/include/nagios-4x/netutils.h b/include/nagios-4x/netutils.h index f9b1768..1407e3f 100644 --- a/include/nagios-4x/netutils.h +++ b/include/nagios-4x/netutils.h @@ -1,5 +1,5 @@ -#ifndef NDO_NETUGILS_H_INCLUDED -#define NDO_NETUGILS_H_INCLUDED +#ifndef NAGIOS_NETUGILS_H_INCLUDED +#define NAGIOS_NETUGILS_H_INCLUDED #include "common.h" NAGIOS_BEGIN_DECL int my_tcp_connect(const char *host_name, int port, int *sd, int timeout); diff --git a/include/nagios-4x/objects.h b/include/nagios-4x/objects.h index cf315f2..b24671e 100644 --- a/include/nagios-4x/objects.h +++ b/include/nagios-4x/objects.h @@ -21,8 +21,8 @@ *****************************************************************************/ -#ifndef NDO_OBJECTS_H_INCLUDED -#define NDO_OBJECTS_H_INCLUDED +#ifndef NAGIOS_OBJECTS_H_INCLUDED +#define NAGIOS_OBJECTS_H_INCLUDED #include "common.h" @@ -103,6 +103,10 @@ NAGIOS_BEGIN_DECL #define add_notified_on(o, f) (o->notified_on |= (1 << f)) +/* Event-related macros */ +#define NUDGE_MIN 5 +#define NUDGE_MAX 17 + /****************** DATA STRUCTURES *******************/ /* @todo Remove typedef's of non-opaque types in Nagios 5 */ @@ -144,7 +148,7 @@ typedef struct notify_list { */ struct check_engine { char *name; /* "Nagios Core", "Merlin", "Mod Gearman" fe */ - const char *(*source_name)(void *); + const char *(*source_name)( const void *); void (*clean_result)(void *); }; @@ -166,9 +170,9 @@ typedef struct check_result { int exited_ok; /* did the plugin check return okay? */ int return_code; /* plugin return code */ char *output; /* plugin output */ - struct rusage rusage; /* resource usage by this check */ - struct check_engine *engine; /* where did we get this check from? */ - void *source; /* engine handles this */ + struct rusage rusage; /* resource usage by this check */ + struct check_engine *engine; /* where did we get this check from? */ + const void *source; /* engine handles this */ } check_result; @@ -746,6 +750,7 @@ struct host *add_host(char *name, char *display_name, char *alias, char *address struct hostsmember *add_parent_host_to_host(host *, char *); /* adds a parent host to a host definition */ struct servicesmember *add_parent_service_to_service(service *, char *host_name, char *description); struct hostsmember *add_child_link_to_host(host *, host *); /* adds a child host to a host definition */ +struct servicesmember *add_child_link_to_service(service *, service *); /* adds a child host to a host definition */ struct contactgroupsmember *add_contactgroup_to_host(host *, char *); /* adds a contactgroup to a host definition */ struct contactsmember *add_contact_to_host(host *, char *); /* adds a contact to a host definition */ struct customvariablesmember *add_custom_variable_to_host(host *, char *, char *); /* adds a custom variable to a host definition */ @@ -816,9 +821,25 @@ int is_host_member_of_servicegroup(struct servicegroup *, struct host *); int is_service_member_of_servicegroup(struct servicegroup *, struct service *); /* tests whether or not a service is a member of a specific servicegroup */ int is_contact_member_of_contactgroup(struct contactgroup *, struct contact *); /* tests whether or not a contact is a member of a specific contact group */ int is_contact_for_host(struct host *, struct contact *); /* tests whether or not a contact is a contact member for a specific host */ +int is_contactgroup_for_host(struct host *, struct contactgroup *); + /* tests whether a contact group is a contract group for a specific host */ int is_escalated_contact_for_host(struct host *, struct contact *); /* checks whether or not a contact is an escalated contact for a specific host */ +int is_contact_for_host_escalation(hostescalation *, contact *); + /* tests whether a contact is an contact for a particular host escalation */ +int is_contactgroup_for_host_escalation(hostescalation *, contactgroup *); + /* tests whether a contactgroup is a contactgroup for a particular + host escalation */ int is_contact_for_service(struct service *, struct contact *); /* tests whether or not a contact is a contact member for a specific service */ +int is_contactgroup_for_service(struct service *, struct contactgroup *); + /* tests whether a contact group is a contract group for a specific service */ +int is_escalated_contact_for_host(struct host *, struct contact *); /* checks whether or not a contact is an escalated contact for a specific host */ int is_escalated_contact_for_service(struct service *, struct contact *); /* checks whether or not a contact is an escalated contact for a specific service */ +int is_contact_for_service_escalation(serviceescalation *, contact *); + /* tests whether a contact is an contact for a particular service + escalation */ +int is_contactgroup_for_service_escalation(serviceescalation *, contactgroup *); +/* tests whether a contactgroup is a contactgroup for a particular + service escalation */ int number_of_immediate_child_hosts(struct host *); /* counts the number of immediate child hosts for a particular host */ int number_of_total_child_hosts(struct host *); /* counts the number of total child hosts for a particular host */ diff --git a/include/nagios-4x/perfdata.h b/include/nagios-4x/perfdata.h index ee9db7c..97e44bd 100644 --- a/include/nagios-4x/perfdata.h +++ b/include/nagios-4x/perfdata.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef NDO_PERFDATA_H_INCLUDED -#define NDO_PERFDATA_H_INCLUDED +#ifndef NAGIOS_PERFDATA_H_INCLUDED +#define NAGIOS_PERFDATA_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/include/nagios-4x/shared.h b/include/nagios-4x/shared.h index a05afb0..6caa090 100644 --- a/include/nagios-4x/shared.h +++ b/include/nagios-4x/shared.h @@ -1,5 +1,5 @@ -#ifndef NDO_SHARED_H_INCLUDED -#define NDO_SHARED_H_INCLUDED +#ifndef NAGIOS_SHARED_H_INCLUDED +#define NAGIOS_SHARED_H_INCLUDED #include #include "lib/libnagios.h" @@ -35,6 +35,7 @@ struct object_count { extern struct object_count num_objects; +extern void init_shared_cfg_vars(int); extern void timing_point(const char *fmt, ...); /* print a message and the time since the first message */ extern char *my_strtok(char *buffer, const char *tokens); extern char *my_strsep(char **stringp, const char *delim); diff --git a/include/nagios-4x/statusdata.h b/include/nagios-4x/statusdata.h index ede17ec..3910c3e 100644 --- a/include/nagios-4x/statusdata.h +++ b/include/nagios-4x/statusdata.h @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef NDO_STATUSDATA_H_INCLUDED -#define NDO_STATUSDATA_H_INCLUDED +#ifndef NAGIOS_STATUSDATA_H_INCLUDED +#define NAGIOS_STATUSDATA_H_INCLUDED #include "common.h" #include "objects.h" diff --git a/src/ndomod.c b/src/ndomod.c index 93e3554..890110b 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -1612,7 +1612,11 @@ int ndomod_broker_data(int event_type, void *data){ char *es[9]; int x=0; scheduled_downtime *temp_downtime=NULL; +#if ( defined( BUILD_NAGIOS_2X) || defined( BUILD_NAGIOS_3X)) comment *temp_comment=NULL; +#else + nagios_comment *temp_comment=NULL; +#endif nebstruct_process_data *procdata=NULL; nebstruct_timed_event_data *eventdata=NULL; nebstruct_log_data *logdata=NULL; From 766ba542bc9dbdf36b4e65491d35f39335316883 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 2 Dec 2015 13:12:35 -0600 Subject: [PATCH 08/73] cannot open /xxxx/ndo2db.lock for reading: No such file or directory Fix for issue https://github.com/NagiosEnterprises/ndoutils/issues/9 --- daemon-init.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon-init.in b/daemon-init.in index 020fef6..1996b89 100755 --- a/daemon-init.in +++ b/daemon-init.in @@ -157,14 +157,14 @@ case "$1" in # to (sooner or later) run - John Sellens #echo -n 'Waiting for ndo2db to exit .' for i in 1 2 3 4 5 6 7 8 9 10 ; do - if status_ndo2db > /dev/null; then + if status_ndo2db > /dev/null 2>&1; then echo -n '.' sleep 1 else break fi done - if status_ndo2db > /dev/null; then + if status_ndo2db > /dev/null 2>&1; then echo '' echo 'Warning - $servicename did not exit in a timely manner' else From db0afb80e2ada2283d8997417b388f5f538d2f9b Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 2 Dec 2015 14:16:10 -0600 Subject: [PATCH 09/73] Forgot to increase the array size... --- src/ndomod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ndomod.c b/src/ndomod.c index 890110b..ccd3a08 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -3562,7 +3562,7 @@ void ndomod_write_active_objects() service *temp_service; servicegroup *temp_servicegroup; ndo_dbuf dbuf; - struct ndo_broker_data active_objects[100]; + struct ndo_broker_data active_objects[256]; struct timeval now; int i, obj_count; char *name1, *name2; From 476e99ea4339481f5823e7cbf18e791394f7b630 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 2 Dec 2015 14:48:12 -0600 Subject: [PATCH 10/73] Added option to specify alternative mysql TCP port on installdb script Implementation of jrdalrymple's PR: https://github.com/NagiosEnterprises/ndoutils/pull/7 --- db/installdb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/db/installdb b/db/installdb index 329a307..18ae03c 100755 --- a/db/installdb +++ b/db/installdb @@ -1,7 +1,7 @@ #!/usr/bin/perl # # SYNTAX: -my $usage = "installdb -u user -p password -h hostname -d database"; +my $usage = "installdb -u user -p password -h hostname -d database [-P port]"; # # DESCRIPTION: # Runs installation script in this directory @@ -29,16 +29,17 @@ sub usage { } my $opts = {}; -getopts("u:p:h:d:", $opts) or usage "Bad options"; +getopts("u:p:h:d:P:", $opts) or usage "Bad options"; my $database = $opts->{d} || usage "Must specify a database"; my $hostname = $opts->{h} || "localhost"; my $username = $opts->{u} || usage "Must specify a username"; my $password = $opts->{p}; +my $port = $opts->{P}; usage "Must specify a password" unless defined $password; # Could be blank # Connect to database -my $dbh = DBI->connect("DBI:mysql:database=$database;host=$hostname", +my $dbh = DBI->connect("DBI:mysql:$database;$hostname:$port", $username, $password, { RaiseError => 1 }, ) From 5e488140fa38655427cd93338aaaf4f7762147de Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 2 Dec 2015 15:37:38 -0600 Subject: [PATCH 11/73] State History does not use actual plugin long_output Fix for issue https://github.com/NagiosEnterprises/ndoutils/issues/8 Also, the ndomod.cfg-sample had the literal 'statechange_data' but the program was checking for 'state_change_data'. Fixed and cleaned up the checks & flags a bit. --- config/ndomod.cfg-sample.in | 2 +- include/nagios-4x/nebstructs.h | 2 +- include/nagios-4x/objects.h | 2 +- src/ndomod.c | 70 ++++++++++++++++++++-------------- 4 files changed, 45 insertions(+), 31 deletions(-) diff --git a/config/ndomod.cfg-sample.in b/config/ndomod.cfg-sample.in index 1af7a55..7d4051e 100644 --- a/config/ndomod.cfg-sample.in +++ b/config/ndomod.cfg-sample.in @@ -163,7 +163,7 @@ program_status_data=1 retention_data=1 service_check_data=1 service_status_data=1 -statechange_data=1 +state_change_data=1 system_command_data=1 timed_event_data=1 diff --git a/include/nagios-4x/nebstructs.h b/include/nagios-4x/nebstructs.h index 904ece4..7267b11 100644 --- a/include/nagios-4x/nebstructs.h +++ b/include/nagios-4x/nebstructs.h @@ -517,7 +517,7 @@ typedef struct nebstruct_statechange_struct { int current_attempt; int max_attempts; char *output; - + char *longoutput; void *object_ptr; } nebstruct_statechange_data; diff --git a/include/nagios-4x/objects.h b/include/nagios-4x/objects.h index b24671e..9a8a556 100644 --- a/include/nagios-4x/objects.h +++ b/include/nagios-4x/objects.h @@ -31,7 +31,7 @@ NAGIOS_BEGIN_DECL /*************** CURRENT OBJECT REVISION **************/ -#define CURRENT_OBJECT_STRUCTURE_VERSION 402 /* increment when changes are made to data structures... */ +#define CURRENT_OBJECT_STRUCTURE_VERSION 403 /* increment when changes are made to data structures... */ /* Nagios 3 starts at 300, Nagios 4 at 400, etc. */ diff --git a/src/ndomod.c b/src/ndomod.c index ccd3a08..ffe3a85 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -109,6 +109,7 @@ unsigned long ndomod_process_options=0; int ndomod_config_output_options=NDOMOD_CONFIG_DUMP_ALL; unsigned long ndomod_sink_buffer_slots=5000; ndomod_sink_buffer sinkbuf; +int has_ver403_long_output = (CURRENT_OBJECT_STRUCTURE_VERSION >= 403); extern int errno; @@ -210,7 +211,12 @@ int ndomod_check_nagios_object_version(void){ char temp_buffer[NDOMOD_MAX_BUFLEN]; if(__nagios_object_structure_version!=CURRENT_OBJECT_STRUCTURE_VERSION){ - + /* Temporary special case so newer ndomod can be used with slightly + * older nagios in order to get longoutput on state changes */ + if (CURRENT_OBJECT_STRUCTURE_VERSION == 403 && __nagios_object_structure_version == 402) { + has_ver403_long_output = 0; + return NDO_OK; + } snprintf(temp_buffer,sizeof(temp_buffer)-1,"ndomod: I've been compiled with support for revision %d of the internal Nagios object structures, but the Nagios daemon is currently using revision %d. I'm going to unload so I don't cause any problems...\n",CURRENT_OBJECT_STRUCTURE_VERSION,__nagios_object_structure_version); temp_buffer[sizeof(temp_buffer)-1]='\x0'; ndomod_write_to_logs(temp_buffer,NSLOG_INFO_MESSAGE); @@ -467,57 +473,59 @@ int ndomod_process_config_var(char *arg){ /* add bitwise processing opts */ else if(!strcmp(var,"process_data") && atoi(val)==1) - ndomod_process_options=ndomod_process_options + NDOMOD_PROCESS_PROCESS_DATA; + ndomod_process_options |= NDOMOD_PROCESS_PROCESS_DATA; else if(!strcmp(var,"timed_event_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_TIMED_EVENT_DATA; + ndomod_process_options |= NDOMOD_PROCESS_TIMED_EVENT_DATA; else if(!strcmp(var,"log_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_LOG_DATA; + ndomod_process_options |= NDOMOD_PROCESS_LOG_DATA; else if(!strcmp(var,"system_command_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_SYSTEM_COMMAND_DATA; + ndomod_process_options |= NDOMOD_PROCESS_SYSTEM_COMMAND_DATA; else if(!strcmp(var,"event_handler_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_EVENT_HANDLER_DATA; + ndomod_process_options |= NDOMOD_PROCESS_EVENT_HANDLER_DATA; else if(!strcmp(var,"notification_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_NOTIFICATION_DATA; + ndomod_process_options |= NDOMOD_PROCESS_NOTIFICATION_DATA; else if(!strcmp(var,"service_check_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_SERVICE_CHECK_DATA ; + ndomod_process_options |= NDOMOD_PROCESS_SERVICE_CHECK_DATA ; else if(!strcmp(var,"host_check_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_HOST_CHECK_DATA; + ndomod_process_options |= NDOMOD_PROCESS_HOST_CHECK_DATA; else if(!strcmp(var,"comment_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_COMMENT_DATA; + ndomod_process_options |= NDOMOD_PROCESS_COMMENT_DATA; else if(!strcmp(var,"downtime_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_DOWNTIME_DATA; + ndomod_process_options |= NDOMOD_PROCESS_DOWNTIME_DATA; else if(!strcmp(var,"flapping_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_FLAPPING_DATA; + ndomod_process_options |= NDOMOD_PROCESS_FLAPPING_DATA; else if(!strcmp(var,"program_status_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_PROGRAM_STATUS_DATA; + ndomod_process_options |= NDOMOD_PROCESS_PROGRAM_STATUS_DATA; else if(!strcmp(var,"host_status_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_HOST_STATUS_DATA; + ndomod_process_options |= NDOMOD_PROCESS_HOST_STATUS_DATA; else if(!strcmp(var,"service_status_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_SERVICE_STATUS_DATA; + ndomod_process_options |= NDOMOD_PROCESS_SERVICE_STATUS_DATA; else if(!strcmp(var,"adaptive_program_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_ADAPTIVE_PROGRAM_DATA; + ndomod_process_options |= NDOMOD_PROCESS_ADAPTIVE_PROGRAM_DATA; else if(!strcmp(var,"adaptive_host_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_ADAPTIVE_HOST_DATA; + ndomod_process_options |= NDOMOD_PROCESS_ADAPTIVE_HOST_DATA; else if(!strcmp(var,"adaptive_service_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_ADAPTIVE_SERVICE_DATA; + ndomod_process_options |= NDOMOD_PROCESS_ADAPTIVE_SERVICE_DATA; else if(!strcmp(var,"external_command_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_EXTERNAL_COMMAND_DATA; + ndomod_process_options |= NDOMOD_PROCESS_EXTERNAL_COMMAND_DATA; else if(!strcmp(var,"object_config_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_OBJECT_CONFIG_DATA; + ndomod_process_options |= NDOMOD_PROCESS_OBJECT_CONFIG_DATA; else if(!strcmp(var,"main_config_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_MAIN_CONFIG_DATA; + ndomod_process_options |= NDOMOD_PROCESS_MAIN_CONFIG_DATA; else if(!strcmp(var,"aggregated_status_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_AGGREGATED_STATUS_DATA; + ndomod_process_options |= NDOMOD_PROCESS_AGGREGATED_STATUS_DATA; else if(!strcmp(var,"retention_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_RETENTION_DATA; + ndomod_process_options |= NDOMOD_PROCESS_RETENTION_DATA; else if(!strcmp(var,"acknowledgement_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_ACKNOWLEDGEMENT_DATA; + ndomod_process_options |= NDOMOD_PROCESS_ACKNOWLEDGEMENT_DATA; + else if(!strcmp(var,"statechange_data") && atoi(val)==1) + ndomod_process_options |= NDOMOD_PROCESS_STATECHANGE_DATA ; else if(!strcmp(var,"state_change_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_STATECHANGE_DATA ; + ndomod_process_options |= NDOMOD_PROCESS_STATECHANGE_DATA ; else if(!strcmp(var,"contact_status_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_CONTACT_STATUS_DATA; + ndomod_process_options |= NDOMOD_PROCESS_CONTACT_STATUS_DATA; else if(!strcmp(var,"adaptive_contact_data") && atoi(val)==1) - ndomod_process_options+=NDOMOD_PROCESS_ADAPTIVE_CONTACT_DATA ; + ndomod_process_options |= NDOMOD_PROCESS_ADAPTIVE_CONTACT_DATA ; /* data_processing_options will override individual values if set */ else if(!strcmp(var,"data_processing_options")){ @@ -3392,8 +3400,14 @@ int ndomod_broker_data(int event_type, void *data){ es[0]=ndo_escape_buffer(schangedata->host_name); es[1]=ndo_escape_buffer(schangedata->service_description); es[2]=ndo_escape_buffer(schangedata->output); - /* Preparing for long_output in the future */ +#ifdef BUILD_NAGIOS_4X + if (CURRENT_OBJECT_STRUCTURE_VERSION > 403 || (CURRENT_OBJECT_STRUCTURE_VERSION == 403 && has_ver403_long_output)) + es[3]=ndo_escape_buffer(schangedata->longoutput); + else + es[3]=ndo_escape_buffer(schangedata->output); +#else es[3]=ndo_escape_buffer(schangedata->output); +#endif { struct ndo_broker_data state_change_data[] = { From 087827031bfdf01ab58f7b3364a2749e99220f0a Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 2 Dec 2015 16:17:30 -0600 Subject: [PATCH 12/73] From PR https://github.com/NagiosEnterprises/ndoutils/pull/3 (David Michael) Descriptions from his original commits below ndo2db: Have the parent process wait until the lock file is written. When a service has type "forking", systemd tries to read its PID file after the parent process exits. This change avoids a race condition where the parent process can sometimes exit before the PID is written to the lock file by the grandchild process. ndo2db: Accept a socket fd passed from systemd. This defines a configure test that adds the systemd library to LIBS if it could be found. It also adds an option to explicitly enable or disable the configure test, so e.g. it can return an error if systemd was requested and not found. --- configure.in | 20 ++++++++++++++++++++ include/config.h.in | 2 ++ src/ndo2db.c | 40 +++++++++++++++++++++++++++++++++------- 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/configure.in b/configure.in index 622db87..3d8e13f 100644 --- a/configure.in +++ b/configure.in @@ -267,6 +267,26 @@ INSTALL_OPTS="-o $ndo2db_user -g $ndo2db_group" AC_SUBST(INSTALL_OPTS) +dnl Does the user want to check for systemd? +AC_ARG_ENABLE([systemd-sockets], + AC_HELP_STRING([--enable-systemd-sockets],[enables systemd socket activation]), + [],[enable_systemd_sockets=auto]) + +dnl Try to compile and link a program that checks for systemd sockets. +if test x$enable_systemd_sockets != xno; then + have_systemd=no + + AC_SEARCH_LIBS([sd_listen_fds],[systemd systemd-daemon], + AC_TRY_LINK([#include ],[sd_listen_fds(0);],[have_systemd=yes])) + + if test x$have_systemd = xyes; then + AC_DEFINE([HAVE_SYSTEMD]) + elif test x$enable_systemd_sockets = xyes; then + AC_MSG_ERROR([systemd was requested, but could not be found]) + fi +fi + + dnl Does user want to check for SSL? AC_ARG_ENABLE(ssl,AC_HELP_STRING([--enable-ssl],[enables native SSL support]),[ if test x$enableval = xyes; then diff --git a/include/config.h.in b/include/config.h.in index b7d927f..1e81bda 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -268,6 +268,8 @@ typedef int int32_t; #include #endif +#undef HAVE_SYSTEMD + #undef HAVE_SSL #ifdef HAVE_SSL #include diff --git a/src/ndo2db.c b/src/ndo2db.c index f421be4..f31f63e 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -26,6 +26,10 @@ #include "../include/dbhandlers.h" #include "../include/queue.h" +#ifdef HAVE_SYSTEMD +#include +#endif + #ifdef HAVE_SSL #include "../include/dh.h" #endif @@ -714,6 +718,7 @@ int ndo2db_daemonize(void){ /* parent process goes away... */ else if((int)pid!=0){ ndo2db_free_program_memory(); + waitpid(pid, NULL, 0); /* Wait for the updated lock file. */ exit(0); } @@ -729,8 +734,23 @@ int ndo2db_daemonize(void){ /* first child process goes away.. */ else if((int)pid!=0){ ndo2db_free_program_memory(); - exit(0); + /* Write the grandchild PID to the lock file... */ + if (lock_file) { + int n; + lseek(lockfile, 0, SEEK_SET); + if (ftruncate(lockfile, 0)) { + syslog(LOG_ERR, "Warning: Unable to truncate lockfile (errno %d): %s", + errno, strerror(errno)); + } + sprintf(buf, "%d\n", (int)pid); + n = (int)strlen(buf); + if (write(lockfile, buf, n) < n) { + syslog(LOG_ERR, "Warning: Unable to write pid to lockfile (errno %d): %s", + errno, strerror(errno)); + } } + exit(0); + } /* grandchild continues... */ @@ -739,12 +759,6 @@ int ndo2db_daemonize(void){ } if(lock_file){ - /* write PID to lockfile... */ - lseek(lockfile,0,SEEK_SET); - ftruncate(lockfile,0); - sprintf(buf,"%d\n",(int)getpid()); - write(lockfile,buf,strlen(buf)); - /* make sure lock file stays open while program is executing... */ val=fcntl(lockfile,F_GETFD,0); val|=FD_CLOEXEC; @@ -843,6 +857,18 @@ int ndo2db_wait_for_connections(void){ static int listen_backlog = INT_MAX; +#ifdef HAVE_SYSTEMD + /* Socket inherited from systemd */ + if (sd_listen_fds(0) == 1) { + ndo2db_sd = SD_LISTEN_FDS_START + 0; + if (sd_is_socket_inet(ndo2db_sd, 0, 0, -1, 0)) + client_address_length = (socklen_t)sizeof(client_address_i); + else + client_address_length = (socklen_t)sizeof(client_address_u); + } + else +#endif + /* TCP socket */ if(ndo2db_socket_type==NDO_SINK_TCPSOCKET){ From c3369b36242441bc42ba31de383a2f76e0e223fc Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 2 Dec 2015 16:50:15 -0600 Subject: [PATCH 13/73] Various minor changes: Updates to Changelog and THANKS files Renamed configure.in to configure.ac and fix update-version for that Generated a new configure script --- Changelog | 25 +- THANKS | 10 + configure | 8691 +++++++++++++--------------------- configure.in => configure.ac | 0 update-version | 6 +- 5 files changed, 3373 insertions(+), 5359 deletions(-) rename configure.in => configure.ac (100%) diff --git a/Changelog b/Changelog index b635921..c555f00 100644 --- a/Changelog +++ b/Changelog @@ -1,11 +1,27 @@ =================== NDO Utils Changelog =================== -2.0.0 - ??? + +2.1.0 - ??/??/???? +------------------ +* Probable fix for ndo2db not responding & growing queue issue (John Frickson) +* Got rid of uninitialized variable used for sleep() and increased the listen backlog (John Frickson) +* ndoutils clears all entries from SQL table causing slow startup (John Frickson) +* Update nagios headers to (mostly) match the ones actually in core (John Frickson) +* cannot open /xxxx/ndo2db.lock for reading: No such file or directory (box293) +* Added option to specify alternative mysql TCP port on installdb script (JR Dalrymple) +* State History does not use actual plugin long_output +* Have the parent process wait until the lock file is written (David Michael) +* Accept a socket fd passed from systemd (David Michael) + + + +2.0.0 - 02/28/2014 ------------------ * Replaced ndomod.cfg data_processing_options variable with single options for easier customization (See README) (Mike Guthrie) * Added missing maintenance options for table trimming (Mike Guthrie) -* Probable fix for ndo2db not responding & growing queue issue (John Frickson) + + 1.5.2 - 06/08/2012 ------------------ @@ -13,10 +29,14 @@ NDO Utils Changelog * Added code to limit retries when system resources are too low (Eric Stanley) * Added code to retry sending messages queue is full (Mike Guthrie) + + 1.5.1 - 05/15/2012 ------------------ * Fixed off-by-one error packing data in ndomod. + + 1.5 - 02/03/2012 ---------------- * Added various performance improvements originally added for Nagios XI (Ethan Galstad) @@ -25,6 +45,7 @@ NDO Utils Changelog * Fixed wrong type of object_id in ndo2db_save_custom_variables() (Michael Friedrich) + 1.4b9 - 10/27/2009 ------------------ NOTE: ** Requires Nagios 2.7 or higher, or Nagios 3.0b6 or higher diff --git a/THANKS b/THANKS index 5b8409d..a16ef85 100644 --- a/THANKS +++ b/THANKS @@ -7,11 +7,21 @@ support it and provide bug reports, patches, and great ideas. Here are a few of the many individuals that have contributed in various ways. --- +Altinity +andree Bernhard Reutner-Fischer +Bruno Quintais +Christian Masopust +Dominic Settele Duncan Ferguson +Eric Stanley +Hendrik Frenzel +Herbert Straub Jean Gabes Lars Michelsen Matthieu Kermagoret +Michael Friedrich +Mike Guthrie Sascha Runschke Sébastien Aperghis-Tramoni Stéphane Urbanovski diff --git a/configure b/configure index 0bd96ae..b7edfdb 100755 --- a/configure +++ b/configure @@ -1,18 +1,20 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63. +# Generated by GNU Autoconf 2.69. +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +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 @@ -20,23 +22,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# 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 - as_nl=' ' export as_nl @@ -44,7 +38,13 @@ export as_nl 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 -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +# 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 @@ -55,7 +55,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in + case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -78,13 +78,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -94,15 +87,16 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +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 + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -114,12 +108,16 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# 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='> ' @@ -131,7 +129,293 @@ export LC_ALL LANGUAGE=C export LANGUAGE -# Required to use basename. +# 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 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 @@ -145,8 +429,12 @@ 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_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ @@ -166,415 +454,111 @@ $as_echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH +# 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 -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi + 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 + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + 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 test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 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 sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit } -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi +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 as_func_ret_success; then - : +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +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 - exitcode=1 - echo positional parameters were not saved. + as_ln_s='cp -pR' fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - 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=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -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 +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - + test -d ./-p && rmdir ./-p + as_mkdir_p=false fi +as_test_x='test -x' +as_executable_p=as_fn_executable_p -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -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 +# 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'" -fi +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell bug-autoconf@gnu.org about your system, - echo including any error possibly output before this message. - echo This can help us improve future autoconf versions. - echo Configuration will now proceed without shell functions. -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # 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 after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, 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 - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_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 sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -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 -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -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=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# 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 7<&0 &1 +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` @@ -589,7 +573,6 @@ cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= @@ -597,6 +580,7 @@ PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= +PACKAGE_URL= ac_unique_file="src/ndo2db.c" ac_default_prefix=/usr/local/nagios @@ -706,6 +690,7 @@ bindir program_transform_name prefix exec_prefix +PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION @@ -721,6 +706,7 @@ enable_mysql with_mysql with_ndo2db_user with_ndo2db_group +enable_systemd_sockets enable_ssl with_ssl with_ssl_inc @@ -799,8 +785,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -845,8 +832,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + 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 @@ -872,8 +858,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + 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 @@ -1077,8 +1062,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + 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 @@ -1094,8 +1078,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + 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 @@ -1125,17 +1108,17 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { $as_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 && - { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } + 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 ;; @@ -1144,7 +1127,7 @@ Try \`$0 --help' for more information." >&2 $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1152,15 +1135,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { $as_echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 - { (exit 1); exit 1; }; } ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1183,8 +1164,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } + 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' @@ -1198,8 +1178,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_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 @@ -1214,11 +1192,9 @@ 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_echo "$as_me: error: working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1257,13 +1233,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } + 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 @@ -1303,7 +1277,7 @@ 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 @@ -1361,6 +1335,8 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-mysql enables MySQL database support + --enable-systemd-sockets + enables systemd socket activation --enable-ssl enables native SSL support --enable-nanosleep enables use of nanosleep (instead of sleep) in event timing @@ -1387,13 +1363,14 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + 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 the package provider. _ACEOF ac_status=$? fi @@ -1457,4631 +1434,2882 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.63 +generated by GNU Autoconf 2.69 -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 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 fi -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 $as_me, which was -generated by GNU Autoconf 2.63. Invocation command line was - - $ $0 $@ +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## -_ACEOF -exec 5>>config.log +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () { -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` + 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 -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -/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` -/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` +} # ac_fn_c_try_compile -_ASUNAME +# 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 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" -done -IFS=$as_save_IFS + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -} >&5 +} # ac_fn_c_try_cpp -cat >&5 <<_ACEOF +# 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 -## ----------- ## -## Core tests. ## -## ----------- ## +} # 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; } - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$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; } - -# 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: 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 -## ---------------- ## -## 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:$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= ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - 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" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - 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 -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - 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 -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -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 - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE -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 "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then - { $as_echo "$as_me:$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" - fi -done - - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -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 - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:$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) - { $as_echo "$as_me:$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 - # 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:$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:$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:$LINENO: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:$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=`$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'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - -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 - - -ac_config_headers="$ac_config_headers include/config.h" - - - - -cat >>confdefs.h <<\_ACEOF -#define DEFAULT_NAGIOS_USER nagios -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define DEFAULT_NAGIOS_GROUP nagios -_ACEOF - - -PKG_NAME=ndoutils -PKG_VERSION="1.5.2" -PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="06-08-2012" - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; 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 - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - 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 - { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -fi - -# 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. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# 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. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:$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 - $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/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - 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 -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. 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 value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:$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. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - - -# Extract the first word of "perl", so it can be a program name with args. -set dummy perl; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_PERL+set}" = set; then - $as_echo_n "(cached) " >&6 -else - case $PERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_PERL="$PERL" # Let the user override the test with a path. - ;; - *) - 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - ;; -esac -fi -PERL=$ac_cv_path_PERL -if test -n "$PERL"; then - { $as_echo "$as_me:$LINENO: result: $PERL" >&5 -$as_echo "$PERL" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ $as_echo "$as_me:$LINENO: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -$as_echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:$LINENO: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -$as_echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - -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 -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 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$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 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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. -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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$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. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - 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 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -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. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$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.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 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$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.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 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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. -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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$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" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } - -# Provide some information about the compiler. -$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -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. -{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; 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 | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - 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 - ac_file='' -fi - -{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&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' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_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 - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_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 -$as_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 -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -{ $as_echo "$as_me:$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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; 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 -# `rm'. -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 | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -fi - -rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; 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. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; 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 | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:$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 test "${ac_cv_c_compiler_gnu+set}" = set; 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. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:$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 -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -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 - -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:$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 - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - $as_echo_n "(cached) " >&6 -else - 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 -/* end confdefs.h. */ -#include -#include -#include -#include -/* 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); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* 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 -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 -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);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -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 { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -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 - -{ $as_echo "$as_me:$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 { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# 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 \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - - - -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 -{ $as_echo "$as_me:$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 - $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" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&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 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # 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 -/* end confdefs.h. */ -#include -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&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 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - $as_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 - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&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 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # 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 +# 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 +#include <$2> _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&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 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - $as_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 - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -fi - -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 - - -{ $as_echo "$as_me:$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 test "${ac_cv_path_GREP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - 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" - { test -f "$ac_path_GREP" && $as_test_x "$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 - ac_count=`expr $ac_count + 1` - 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 - # 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_GREP_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes else - ac_cv_path_GREP=$GREP -fi - + ac_header_preproc=no fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - +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; } -{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; 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" - { test -f "$ac_path_EGREP" && $as_test_x "$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 - ac_count=`expr $ac_count + 1` - 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;; +# 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;} + ;; esac - - $ac_path_EGREP_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi + { $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 - ac_cv_path_EGREP=$EGREP + 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 - fi +} # 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 -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" +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 -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then +# 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 - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#include - +$4 int main () { - +if (sizeof (($2))) + return 0; ; return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=no +else + eval "$3=yes" fi - 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 -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no fi -rm -f conftest* - +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 -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. */ +} # 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 -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_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. */ -#include +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break else - ac_cv_header_stdc=no -fi -rm -f conftest* - + 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 - -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 - : +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done 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)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) + ; + 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 () { - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; return 0; } _ACEOF -rm -f conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break 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 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + 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 -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then +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]; -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 + ; + return 0; +} _ACEOF - -fi - -{ $as_echo "$as_me:$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 test "${ac_cv_header_time+set}" = set; then - $as_echo_n "(cached) " >&6 +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + 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. */ -#include -#include -#include - +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include int main () { -if ((struct tm *) 0) -return 0; + + 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 -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_time=yes +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 &5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_time=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_retval=1 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f conftest.val -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF + fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -fi +} # ac_fn_c_compute_int -{ $as_echo "$as_me:$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 test "${ac_cv_header_sys_wait_h+set}" = set; then +# 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 >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 int) (stat_val) >> 8) +/* 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 -#ifndef WIFEXITED -# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) + +#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 () { - int s; - wait (&s); - s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +return $2 (); ; return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_sys_wait_h=yes +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_sys_wait_h=no + eval "$3=no" fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$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 +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 -fi +} # 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. -# On IRIX 5.3, sys/types and inttypes.h are conflicting. +It was created by $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + $ $0 $@ +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 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` +/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` +_ASUNAME +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS +} >&5 -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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; 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 +cat >&5 <<_ACEOF -#include <$ac_header> -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_Header=no" -fi +## ----------- ## +## Core tests. ## +## ----------- ## -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -fi +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + 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 + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done done +{ 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: 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 + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + 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 $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" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + 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 + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + 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 + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + 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 -f -r conftest* confdefs.h +$as_echo "/* confdefs.h */" > confdefs.h +# Predefined preprocessor variables. +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 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 "$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" \ + || { { $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 +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +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 + case $ac_old_set,$ac_new_set in + set,) + { $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) + { $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 + # 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=`$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. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $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' +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 +ac_config_headers="$ac_config_headers include/config.h" +$as_echo "#define DEFAULT_NAGIOS_USER nagios" >>confdefs.h +$as_echo "#define DEFAULT_NAGIOS_GROUP nagios" >>confdefs.h +PKG_NAME=ndoutils +PKG_VERSION="1.5.2" +PKG_HOME_URL="http://www.nagios.org/" +PKG_REL_DATE="06-08-2012" +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; 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 + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + 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 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi +# 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. - - - - - - - - - - -for ac_header in arpa/inet.h ctype.h dirent.h dlfcn.h errno.h fcntl.h float.h getopt.h grp.h inttypes.h limits.h ltdl.h math.h netdb.h netinet/in.h pthread.h pwd.h regex.h signal.h socket.h stdarg.h stdint.h string.h strings.h sys/ipc.h sys/mman.h sys/msg.h sys/poll.h sys/resource.h sys/sendfile.h sys/socket.h sys/stat.h sys/time.h sys/timeb.h sys/types.h sys/un.h sys/wait.h syslog.h tcpd.h unistd.h values.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# 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. +# 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 ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&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 { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; + 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]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + 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. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + 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 -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + 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. 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 value is a relative name. + INSTALL=$ac_install_sh + fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&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 { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&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 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - ac_header_preproc=no -fi +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; 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_PERL+:} false; then : $as_echo_n "(cached) " >&6 else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + 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_path_PERL="$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 + ;; +esac fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - +PERL=$ac_cv_path_PERL +if test -n "$PERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +$as_echo "$PERL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -done -{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} 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_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - 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}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this 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; - } - { /* 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 { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_const=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_const=no + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -cat >>confdefs.h <<\_ACEOF -#define const /**/ -_ACEOF -fi -{ $as_echo "$as_me:$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 test "${ac_cv_struct_tm+set}" = set; then +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 +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 +{ $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 - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -struct tm tm; - int *p = &tm.tm_sec; - return !p; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_struct_tm=time.h + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +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_CC="${ac_tool_prefix}gcc" + $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 - ac_cv_struct_tm=sys/time.h fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 -$as_echo "$ac_cv_struct_tm" >&6; } -if test $ac_cv_struct_tm = sys/time.h; then +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -cat >>confdefs.h <<\_ACEOF -#define TM_IN_SYS_TIME 1 -_ACEOF fi - -{ $as_echo "$as_me:$LINENO: checking for mode_t" >&5 -$as_echo_n "checking for mode_t... " >&6; } -if test "${ac_cv_type_mode_t+set}" = set; then +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 +{ $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 - ac_cv_type_mode_t=no -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 (sizeof (mode_t)) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - 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 (sizeof ((mode_t))) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +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_CC="gcc" + $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 - ac_cv_type_mode_t=yes +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + 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 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + 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. +set dummy ${ac_tool_prefix}cc; 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_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. +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_CC="${ac_tool_prefix}cc" + $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 - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 -$as_echo "$ac_cv_type_mode_t" >&6; } -if test "x$ac_cv_type_mode_t" = x""yes; then - : +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -cat >>confdefs.h <<_ACEOF -#define mode_t int -_ACEOF + fi fi - -{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5 -$as_echo_n "checking for pid_t... " >&6; } -if test "${ac_cv_type_pid_t+set}" = set; then +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 +{ $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 - ac_cv_type_pid_t=no -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 (sizeof (pid_t)) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - 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 (sizeof ((pid_t))) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_prog_rejected=no +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 + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $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 - ac_cv_type_pid_t=yes +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -$as_echo "$ac_cv_type_pid_t" >&6; } -if test "x$ac_cv_type_pid_t" = x""yes; then - : +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF fi - -{ $as_echo "$as_me:$LINENO: checking for size_t" >&5 -$as_echo_n "checking for size_t... " >&6; } -if test "${ac_cv_type_size_t+set}" = set; then +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + 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 +{ $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 - ac_cv_type_size_t=no -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 (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - 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 (sizeof ((size_t))) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_size_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +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_CC="$ac_tool_prefix$ac_prog" + $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 - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -$as_echo "$ac_cv_type_size_t" >&6; } -if test "x$ac_cv_type_size_t" = x""yes; then - : +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF + test -n "$CC" && break + done fi - -{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } -if test "${ac_cv_type_signal+set}" = set; then +if test -z "$CC"; then + ac_ct_CC=$CC + 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 +{ $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 - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -return *(signal (0, 0)) (0) == 1; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_signal=int + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +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_CC="$ac_prog" + $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 - ac_cv_type_signal=void fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$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 +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -{ $as_echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 -$as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if test "${ac_cv_type_uid_t+set}" = set; 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. */ -#include + test -n "$ac_ct_CC" && break +done -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then - ac_cv_type_uid_t=yes -else - ac_cv_type_uid_t=no + 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 -rm -f conftest* fi -{ $as_echo "$as_me:$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 -cat >>confdefs.h <<\_ACEOF -#define gid_t int -_ACEOF +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; } -fi +# Provide some information about the compiler. +$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=$? + 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 -{ $as_echo "$as_me:$LINENO: checking type of array argument to getgroups" >&5 -$as_echo_n "checking type of array argument to getgroups... " >&6; } -if test "${ac_cv_type_getgroups+set}" = set; then - $as_echo_n "(cached) " >&6 -else - 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. */ -$ac_includes_default -#define NGID 256 -#undef MAX -#define MAX(x, y) ((x) > (y) ? (x) : (y)) int main () { - gid_t gidset[NGID]; - int i, n; - union { gid_t gval; long int lval; } val; - val.lval = -1; - for (i = 0; i < NGID; i++) - gidset[i] = val.gval; - 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 int but getgroups modifies an array - of ints. */ - return n > 0 && gidset[n] != val.gval; + ; + return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +ac_clean_files_save=$ac_clean_files +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. +{ $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[^ ]*//'` + +# 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 +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:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_getgroups=gid_t + $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 | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + 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 - $as_echo "$as_me: program exited with status $ac_status" >&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 -( exit $ac_status ) -ac_cv_type_getgroups=int -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* 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 -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then - ac_cv_type_getgroups=gid_t +{ { $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 - ac_cv_type_getgroups=int + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi -rm -f conftest* +{ $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 +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $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=$? + $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 +# `rm'. +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 | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +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 compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi -fi -{ $as_echo "$as_me:$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 -_ACEOF - - +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; } -# 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:$LINENO: checking size of int" >&5 -$as_echo_n "checking size of int... " >&6; } -if test "${ac_cv_sizeof_int+set}" = set; then - $as_echo_n "(cached) " >&6 -else - 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 +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default +#include int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)]; -test_array [0] = 0 +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 +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=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; 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 int) (sizeof (int))) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in + $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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 +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=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break -else - $as_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}: \$? = $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 core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - $as_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 +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. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)]; -test_array [0] = 0 ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.o conftest.obj +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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 +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=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; 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 + $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 | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $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 +{ $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 +{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)]; -test_array [0] = 0 +#ifndef __GNUC__ + choke me +#endif ; return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes else - $as_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` + ac_compiler_gnu=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_c_compiler_gnu=$ac_compiler_gnu - ac_lo= ac_hi= fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $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 +{ $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 + 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. */ -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 - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +int +main () +{ + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default + int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; -test_array [0] = 0 ; return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid +if ac_fn_c_try_compile "$LINENO"; then : + else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ac_lo=`expr '(' $ac_mid ')' + 1` -fi +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_int=$ac_lo;; -'') if test "$ac_cv_type_int" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (int) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } - else - ac_cv_sizeof_int=0 - fi ;; -esac +fi +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 + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $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_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -static long int longval () { return (long int) (sizeof (int)); } -static unsigned long int ulongval () { return (long int) (sizeof (int)); } +#include #include -#include -int -main () +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); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) { + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (((long int) (sizeof (int))) < 0) - { - long int i = longval (); - if (i != ((long int) (sizeof (int)))) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (int)))) - 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; +/* 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 -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 -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);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# 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; } ;; + *) + 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 -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +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 + +{ $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 '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# 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 -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_int=`cat conftest.val` -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 - -( exit $ac_status ) -if test "$ac_cv_type_int" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (int) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } - else - ac_cv_sizeof_int=0 - fi -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f conftest.make fi -rm -f conftest.val +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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 -$as_echo "$ac_cv_sizeof_int" >&6; } - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT $ac_cv_sizeof_int -_ACEOF -# 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:$LINENO: checking size of short" >&5 -$as_echo_n "checking size of short... " >&6; } -if test "${ac_cv_sizeof_short+set}" = set; then +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 +{ $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 ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else - 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 + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error _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 int) (sizeof (short))) <= $ac_mid)]; -test_array [0] = 0 +if ac_fn_c_try_cpp "$LINENO"; then : - ; - return 0; -} +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue else - $as_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.i conftest.$ac_ext - 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` +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + done + ac_cv_prog_CPP=$CPP - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $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 + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (short))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error _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 int) (sizeof (short))) >= $ac_mid)]; -test_array [0] = 0 +if ac_fn_c_try_cpp "$LINENO"; then : - ; - return 0; -} +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue else - $as_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.i conftest.$ac_ext - 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` +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +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 $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi -rm -f core 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 + + +{ $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 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 + # 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_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 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo= ac_hi= + ac_cv_path_GREP=$GREP fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 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" -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 - 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 int) (sizeof (short))) <= $ac_mid)]; -test_array [0] = 0 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; +{ $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 -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid + + $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 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_path_EGREP=$EGREP +fi - ac_lo=`expr '(' $ac_mid ')' + 1` + 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" -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_short=$ac_lo;; -'') if test "$ac_cv_type_short" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (short) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } - else - ac_cv_sizeof_short=0 - fi ;; -esac + +{ $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 >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. */ -$ac_includes_default -static long int longval () { return (long int) (sizeof (short)); } -static unsigned long int ulongval () { return (long int) (sizeof (short)); } -#include #include +#include +#include +#include + int main () { - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (((long int) (sizeof (short))) < 0) - { - long int i = longval (); - if (i != ((long int) (sizeof (short)))) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (short)))) - 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 -rm -f conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_short=`cat conftest.val` +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes 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 - -( exit $ac_status ) -if test "$ac_cv_type_short" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (short) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } - else - ac_cv_sizeof_short=0 - fi -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.val + ac_cv_header_stdc=no fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 -$as_echo "$ac_cv_sizeof_short" >&6; } - +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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include -cat >>confdefs.h <<_ACEOF -#define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : - -# 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:$LINENO: checking size of long" >&5 -$as_echo_n "checking size of long... " >&6; } -if test "${ac_cv_sizeof_long+set}" = set; then - $as_echo_n "(cached) " >&6 else - 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 int) (sizeof (long))) >= 0)]; -test_array [0] = 0 + ac_cv_header_stdc=no +fi +rm -f conftest* - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; 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 +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; -test_array [0] = 0 +#include - ; - return 0; -} _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest* - 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` fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done +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 : + : else - $as_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 int) (sizeof (long))) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)]; -test_array [0] = 0 - - ; + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break -else - $as_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 +if ac_fn_c_try_run "$LINENO"; then : -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - ac_lo= ac_hi= fi +fi +{ $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 + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h -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 - 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 +{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default +#include +#include +#include + int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; -test_array [0] = 0 - +if ((struct tm *) 0) +return 0; ; return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_header_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $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 + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - ac_lo=`expr '(' $ac_mid ')' + 1` fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) ac_cv_sizeof_long=$ac_lo;; -'') if test "$ac_cv_type_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } - else - ac_cv_sizeof_long=0 - fi ;; -esac +{ $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. */ -$ac_includes_default -static long int longval () { return (long int) (sizeof (long)); } -static unsigned long int ulongval () { return (long int) (sizeof (long)); } -#include -#include +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + int main () { - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (((long int) (sizeof (long))) < 0) - { - long int i = longval (); - if (i != ((long int) (sizeof (long)))) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (long)))) - 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; - + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF -rm -f conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_long=`cat conftest.val` +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_sys_wait_h=yes 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 - -( exit $ac_status ) -if test "$ac_cv_type_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } - else - ac_cv_sizeof_long=0 - fi + ac_cv_header_sys_wait_h=no fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.val +{ $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 + +$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h + fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 -$as_echo "$ac_cv_sizeof_long" >&6; } +# 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=`$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 `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF +fi -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long +done + + +for ac_header in arpa/inet.h ctype.h dirent.h dlfcn.h errno.h fcntl.h float.h getopt.h grp.h inttypes.h limits.h ltdl.h math.h netdb.h netinet/in.h pthread.h pwd.h regex.h signal.h socket.h stdarg.h stdint.h string.h strings.h sys/ipc.h sys/mman.h sys/msg.h sys/poll.h sys/resource.h sys/sendfile.h sys/socket.h sys/stat.h sys/time.h sys/timeb.h sys/types.h sys/un.h sys/wait.h syslog.h tcpd.h unistd.h values.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 -{ $as_echo "$as_me:$LINENO: checking for uint32_t" >&5 -$as_echo_n "checking for uint32_t... " >&6; } -if test "${ac_cv_type_uint32_t+set}" = set; then +{ $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 - ac_cv_type_uint32_t=no -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. */ -$ac_includes_default + int main () { -if (sizeof (uint32_t)) - return 0; + +#ifndef __cplusplus + /* Ultrix mips cc rejects this sort of thing. */ + typedef int charset[2]; + const charset cs = { 0, 0 }; + /* SunOS 4.1.1 cc rejects this. */ + 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}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++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}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* 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]; } 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 { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $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 + +$as_echo "#define const /**/" >>confdefs.h + +fi + +{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default +#include +#include + int main () { -if (sizeof ((uint32_t))) - return 0; +struct tm tm; + int *p = &tm.tm_sec; + return !p; ; return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_struct_tm=time.h else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_struct_tm=sys/time.h +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $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 + +$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h - ac_cv_type_uint32_t=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +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 : + else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +cat >>confdefs.h <<_ACEOF +#define mode_t int +_ACEOF fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +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 : + +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint32_t" >&5 -$as_echo "$ac_cv_type_uint32_t" >&6; } -if test "x$ac_cv_type_uint32_t" = x""yes; then - : + +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 : + else cat >>confdefs.h <<_ACEOF -#define uint32_t unsigned int +#define size_t unsigned int _ACEOF fi -{ $as_echo "$as_me:$LINENO: checking for u_int32_t" >&5 -$as_echo_n "checking for u_int32_t... " >&6; } -if test "${ac_cv_type_u_int32_t+set}" = set; then +{ $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 - ac_cv_type_u_int32_t=no -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. */ -$ac_includes_default +#include +#include + int main () { -if (sizeof (u_int32_t)) - return 0; +return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_signal=int +else + ac_cv_type_signal=void +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $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 + + +{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1; then : + ac_cv_type_uid_t=yes +else + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi +{ $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 + +$as_echo "#define uid_t int" >>confdefs.h + + +$as_echo "#define gid_t int" >>confdefs.h + +fi + +{ $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 : + ac_cv_type_getgroups=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Thanks to Mike Rendell for this test. */ $ac_includes_default +#define NGID 256 +#undef MAX +#define MAX(x, y) ((x) > (y) ? (x) : (y)) + int main () { -if (sizeof ((u_int32_t))) - return 0; - ; - return 0; + gid_t gidset[NGID]; + int i, n; + union { gid_t gval; long int lval; } val; + + val.lval = -1; + for (i = 0; i < NGID; i++) + gidset[i] = val.gval; + 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 int but getgroups modifies an array + of ints. */ + return n > 0 && gidset[n] != val.gval; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_type_getgroups=gid_t else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_u_int32_t=yes + 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 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if test $ac_cv_type_getgroups = cross; then + 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 : + ac_cv_type_getgroups=gid_t else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_getgroups=int +fi +rm -f conftest* + +fi +fi +{ $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 +_ACEOF + +# 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 + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $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 core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 -$as_echo "$ac_cv_type_u_int32_t" >&6; } -if test "x$ac_cv_type_u_int32_t" = x""yes; then - : -else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + cat >>confdefs.h <<_ACEOF -#define u_int32_t unsigned int +#define SIZEOF_INT $ac_cv_sizeof_int _ACEOF + +# 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 + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_short" = yes; then + { { $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 -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 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +$as_echo "$ac_cv_sizeof_short" >&6; } - else - if test "$ac_cv_sizeof_int" = 4 ; then - cat >>confdefs.h <<\_ACEOF -#define U_INT32_T_IS_UINT 1 -_ACEOF - else - if test "$ac_cv_sizeof_long" = 4 ; then - cat >>confdefs.h <<\_ACEOF -#define U_INT32_T_IS_ULONG 1 -_ACEOF - else - if test "$ac_cv_sizeof_short" = 4 ; then - cat >>confdefs.h <<\_ACEOF -#define U_INT32_T_IS_USHORT 1 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF - fi - fi - fi - fi -fi -{ $as_echo "$as_me:$LINENO: checking for int32_t" >&5 -$as_echo_n "checking for int32_t... " >&6; } -if test "${ac_cv_type_int32_t+set}" = set; then +# 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 - ac_cv_type_int32_t=no -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 (sizeof (int32_t)) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - 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 (sizeof ((int32_t))) - return 0; - ; - return 0; -} + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : + + + +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 : + else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_int32_t=yes +cat >>confdefs.h <<_ACEOF +#define uint32_t unsigned int +_ACEOF + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +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 : + else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +cat >>confdefs.h <<_ACEOF +#define u_int32_t unsigned int +_ACEOF fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if test "$ac_cv_type_u_int32_t" = no ; then + if test "$ac_cv_type_u_int32_t" = yes ; then + $as_echo "#define U_INT32_T_IS_UINT32_T 1" >>confdefs.h + + else + if test "$ac_cv_sizeof_int" = 4 ; then + $as_echo "#define U_INT32_T_IS_UINT 1" >>confdefs.h + + else + if test "$ac_cv_sizeof_long" = 4 ; then + $as_echo "#define U_INT32_T_IS_ULONG 1" >>confdefs.h + + else + if test "$ac_cv_sizeof_short" = 4 ; then + $as_echo "#define U_INT32_T_IS_USHORT 1" >>confdefs.h + + fi + fi + fi + fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 -$as_echo "$ac_cv_type_int32_t" >&6; } -if test "x$ac_cv_type_int32_t" = x""yes; then - : + +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 : + else cat >>confdefs.h <<_ACEOF @@ -6092,21 +4320,15 @@ 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 @@ -6114,117 +4336,69 @@ _ACEOF fi - for ac_func in getopt_long -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +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 HAVE_GETOPT_LONG 1 _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 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 $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 -#endif +else + { $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" -int -main () +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () { -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $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 || - $as_test_x conftest$ac_exeext - }; then - eval "$as_ac_var=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 - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext + ac_retval=1 fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF + # 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 -else - { $as_echo "$as_me:$LINENO: checking for getopt_long in -liberty" >&5 -$as_echo_n "checking for getopt_long in -liberty... " >&6; } -if test "${ac_cv_lib_iberty_getopt_long+set}" = set; 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 +} # ac_fn_c_try_link +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -6242,43 +4416,18 @@ return getopt_long (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_iberty_getopt_long=yes else - $as_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 -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - 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 -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_iberty_getopt_long" >&5 +{ $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" = x""yes; then +if test "x$ac_cv_lib_iberty_getopt_long" = xyes; then : OTHERLIBS="$OTHERLIBS -liberty" fi @@ -6287,18 +4436,14 @@ done -{ $as_echo "$as_me:$LINENO: checking for main in -lnsl" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5 $as_echo_n "checking for main in -lnsl... " >&6; } -if test "${ac_cv_lib_nsl_main+set}" = set; then +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. */ @@ -6310,58 +4455,29 @@ return main (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_main=yes else - $as_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 -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - 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 -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5 +{ $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" = x""yes; then +if test "x$ac_cv_lib_nsl_main" = xyes; then : SOCKETLIBS="$SOCKETLIBS -lnsl" fi -{ $as_echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_socket+set}" = set; then +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 GCC internal prototype to avoid an error. @@ -6379,59 +4495,30 @@ return socket (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else - $as_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 -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - 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 -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 +{ $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" = x""yes; then +if test "x$ac_cv_lib_socket_socket" = xyes; then : SOCKETLIBS="$SOCKETLIBS -lsocket" fi -{ $as_echo "$as_me:$LINENO: checking for main in -lwrap" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lwrap" >&5 $as_echo_n "checking for main in -lwrap... " >&6; } -if test "${ac_cv_lib_wrap_main+set}" = set; then +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. */ @@ -6443,151 +4530,31 @@ return main (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_wrap_main=yes else - $as_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 -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - 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 -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_wrap_main" >&5 +{ $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" = x""yes; then +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 strtof -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; 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. */ -/* 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 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 $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 -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -6596,13 +4563,9 @@ fi done -{ $as_echo "$as_me:$LINENO: checking for type of socket size" >&5 +{ $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 >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 @@ -6616,48 +4579,19 @@ int a = send(1, (const void *)0, (size_t *) 0, (int *) 0); return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - cat >>confdefs.h <<\_ACEOF -#define SOCKET_SIZE_TYPE size_t -_ACEOF - { $as_echo "$as_me:$LINENO: result: size_t" >&5 +if ac_fn_c_try_compile "$LINENO"; then : + $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 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - cat >>confdefs.h <<\_ACEOF -#define SOCKET_SIZE_TYPE int -_ACEOF - { $as_echo "$as_me:$LINENO: result: int" >&5 + $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 core 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 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6670,41 +4604,12 @@ struct sockaddr_un su; int i = SUN_LEN(&su); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_SUN_LEN 1 -_ACEOF - -else - $as_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_SUN_LEN 1" >>confdefs.h fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext init_dir=/etc/rc.d/init.d if test -d /etc/rc.d/init.d; then @@ -6721,13 +4626,13 @@ fi # Check whether --with-init_dir was given. -if test "${with_init_dir+set}" = set; then +if test "${with_init_dir+set}" = set; then : withval=$with_init_dir; init_dir=$withval fi -{ $as_echo "$as_me:$LINENO: checking for linker flags for loadable modules" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker flags for loadable modules" >&5 $as_echo_n "checking for linker flags for loadable modules... " >&6; } case $host_os in solaris2*|sysv4*) @@ -6757,7 +4662,7 @@ case $host_os in MOD_LDFLAGS="-shared" ;; esac -{ $as_echo "$as_me:$LINENO: result: $MOD_LDFLAGS" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MOD_LDFLAGS" >&5 $as_echo "$MOD_LDFLAGS" >&6; } @@ -6765,21 +4670,20 @@ $as_echo "$MOD_LDFLAGS" >&6; } USE_MYSQL=yes # Check whether --enable-mysql was given. -if test "${enable_mysql+set}" = set; then +if test "${enable_mysql+set}" = set; then : enableval=$enable_mysql; fi -if test x$enable_mysql = xno; then +if test x$enable_mysql = xno; then : USE_MYSQL=no fi - if test $USE_MYSQL = yes; then # Check whether --with-mysql was given. -if test "${with_mysql+set}" = set; then +if test "${with_mysql+set}" = set; then : withval=$with_mysql; with_mysql=$withval else with_mysql=yes @@ -6790,9 +4694,9 @@ fi if test "x$with_mysql" = "xyes" ; then # Extract the first word of "mysql_config", so it can be a program name with args. set dummy mysql_config; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_np_mysql_config+set}" = set; then +if ${ac_cv_path_np_mysql_config+:} false; then : $as_echo_n "(cached) " >&6 else case $np_mysql_config in @@ -6805,14 +4709,14 @@ 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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_np_mysql_config="$as_dir/$ac_word$ac_exec_ext" - $as_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 ;; @@ -6820,10 +4724,10 @@ esac fi np_mysql_config=$ac_cv_path_np_mysql_config if test -n "$np_mysql_config"; then - { $as_echo "$as_me:$LINENO: result: $np_mysql_config" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $np_mysql_config" >&5 $as_echo "$np_mysql_config" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -6847,18 +4751,14 @@ fi _savedcppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $np_mysql_include" - { $as_echo "$as_me:$LINENO: checking for mysql_init in -lmysqlclient" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql_init in -lmysqlclient" >&5 $as_echo_n "checking for mysql_init in -lmysqlclient... " >&6; } -if test "${ac_cv_lib_mysqlclient_mysql_init+set}" = set; then +if ${ac_cv_lib_mysqlclient_mysql_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmysqlclient $np_mysql_libs $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 GCC internal prototype to avoid an error. @@ -6868,57 +4768,30 @@ cat >>conftest.$ac_ext <<_ACEOF extern "C" #endif char mysql_init (); -int -main () -{ -return mysql_init (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then +int +main () +{ +return mysql_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_mysqlclient_mysql_init=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mysqlclient_mysql_init=no + ac_cv_lib_mysqlclient_mysql_init=no fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - 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 -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_init" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mysqlclient_mysql_init" >&5 $as_echo "$ac_cv_lib_mysqlclient_mysql_init" >&6; } -if test "x$ac_cv_lib_mysqlclient_mysql_init" = x""yes; then +if test "x$ac_cv_lib_mysqlclient_mysql_init" = xyes; then : with_mysql=$np_mysql_config -cat >>confdefs.h <<\_ACEOF -#define HAVE_MYSQLCLIENT 1 -_ACEOF +$as_echo "#define HAVE_MYSQLCLIENT 1" >>confdefs.h else @@ -6988,7 +4861,7 @@ CFLAGS="$save_CFLAGS" # Check whether --with-ndo2db_user was given. -if test "${with_ndo2db_user+set}" = set; then +if test "${with_ndo2db_user+set}" = set; then : withval=$with_ndo2db_user; ndo2db_user=$withval else ndo2db_user=nagios @@ -6996,7 +4869,7 @@ fi # Check whether --with-ndo2db_group was given. -if test "${with_ndo2db_group+set}" = set; then +if test "${with_ndo2db_group+set}" = set; then : withval=$with_ndo2db_group; ndo2db_group=$withval else ndo2db_group=nagios @@ -7008,8 +4881,100 @@ INSTALL_OPTS="-o $ndo2db_user -g $ndo2db_group" +# Check whether --enable-systemd-sockets was given. +if test "${enable_systemd_sockets+set}" = set; then : + enableval=$enable_systemd_sockets; +else + enable_systemd_sockets=auto +fi + + +if test x$enable_systemd_sockets != xno; then + have_systemd=no + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sd_listen_fds" >&5 +$as_echo_n "checking for library containing sd_listen_fds... " >&6; } +if ${ac_cv_search_sd_listen_fds+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* 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 sd_listen_fds (); +int +main () +{ +return sd_listen_fds (); + ; + return 0; +} +_ACEOF +for ac_lib in '' systemd systemd-daemon; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_sd_listen_fds=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_sd_listen_fds+:} false; then : + break +fi +done +if ${ac_cv_search_sd_listen_fds+:} false; then : + +else + ac_cv_search_sd_listen_fds=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sd_listen_fds" >&5 +$as_echo "$ac_cv_search_sd_listen_fds" >&6; } +ac_res=$ac_cv_search_sd_listen_fds +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +sd_listen_fds(0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + have_systemd=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + if test x$have_systemd = xyes; then + $as_echo "#define HAVE_SYSTEMD 1" >>confdefs.h + + elif test x$enable_systemd_sockets = xyes; then + as_fn_error $? "systemd was requested, but could not be found" "$LINENO" 5 + fi +fi + + # Check whether --enable-ssl was given. -if test "${enable_ssl+set}" = set; then +if test "${enable_ssl+set}" = set; then : enableval=$enable_ssl; if test x$enableval = xyes; then check_for_ssl=yes @@ -7027,7 +4992,7 @@ ssl_inc_dir= ssl_lib_dir= # Check whether --with-ssl was given. -if test "${with_ssl+set}" = set; then +if test "${with_ssl+set}" = set; then : withval=$with_ssl; ssl_dir=$withval @@ -7035,7 +5000,7 @@ fi # Check whether --with-ssl-inc was given. -if test "${with_ssl_inc+set}" = set; then +if test "${with_ssl_inc+set}" = set; then : withval=$with_ssl_inc; ssl_inc_dir=$withval @@ -7043,7 +5008,7 @@ fi # Check whether --with-ssl-lib was given. -if test "${with_ssl_lib+set}" = set; then +if test "${with_ssl_lib+set}" = set; then : withval=$with_ssl_lib; ssl_lib_dir=$withval @@ -7051,7 +5016,7 @@ fi # Check whether --with-kerberos-inc was given. -if test "${with_kerberos_inc+set}" = set; then +if test "${with_kerberos_inc+set}" = set; then : withval=$with_kerberos_inc; kerberos_inc_dir=$withval @@ -7059,7 +5024,7 @@ fi if test x$check_for_ssl = xyes; then - { $as_echo "$as_me:$LINENO: checking for SSL headers" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL headers" >&5 $as_echo_n "checking for SSL headers... " >&6; } 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; do @@ -7093,14 +5058,12 @@ $as_echo_n "checking for SSL headers... " >&6; } done if test x_$found_ssl != x_yes; then - { { $as_echo "$as_me:$LINENO: error: Cannot find ssl headers" >&5 -$as_echo "$as_me: error: Cannot find ssl headers" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "Cannot find ssl headers" "$LINENO" 5 else printf "SSL headers found in $ssldir\n"; - { $as_echo "$as_me:$LINENO: checking for SSL libraries" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL libraries" >&5 $as_echo_n "checking for SSL libraries... " >&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; do @@ -7112,9 +5075,7 @@ $as_echo_n "checking for SSL libraries... " >&6; } done if test x_$found_ssl != x_yes; then - { { $as_echo "$as_me:$LINENO: error: Cannot find ssl libraries" >&5 -$as_echo "$as_me: error: Cannot find ssl libraries" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "Cannot find ssl libraries" "$LINENO" 5 else printf "SSL libraries found in $ssllibdir\n"; @@ -7139,7 +5100,7 @@ _ACEOF fi fi - { $as_echo "$as_me:$LINENO: checking for Kerberos include files" >&5 + { $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 @@ -7166,16 +5127,15 @@ fi USE_NANOSLEEP=yes # Check whether --enable-nanosleep was given. -if test "${enable_nanosleep+set}" = set; then +if test "${enable_nanosleep+set}" = set; then : enableval=$enable_nanosleep; fi -if test x$enable_nanosleep = xno; then +if test x$enable_nanosleep = xno; then : USE_NANOSLEEP=no else USE_NANOSLEEP=yes fi - if test x$USE_NANOSLEEP = xyes ; then cat >>confdefs.h <<_ACEOF #define USE_NANOSLEEP 1 @@ -7195,14 +5155,15 @@ 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_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. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' + 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 @@ -7210,13 +5171,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" -{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +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. @@ -7226,17 +5188,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +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 +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 @@ -7244,23 +5207,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# 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 - as_nl=' ' export as_nl @@ -7268,7 +5223,13 @@ export as_nl 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 -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +# 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 @@ -7279,7 +5240,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in + case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -7302,13 +5263,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -7318,15 +5272,16 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +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 + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -7338,12 +5293,16 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# 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='> ' @@ -7355,7 +5314,89 @@ export LC_ALL LANGUAGE=C export LANGUAGE -# Required to use basename. +# 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 @@ -7369,8 +5410,12 @@ 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_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ @@ -7390,76 +5435,25 @@ $as_echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # 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 after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, 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 - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_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 sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# 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 +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + 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 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then @@ -7474,49 +5468,85 @@ if (echo >conf$$.file) 2>/dev/null; then # ... 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 -p'. + # 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 -p' + as_ln_s='cp -pR' 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 else - as_ln_s='cp -p' + 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=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# 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'" @@ -7526,13 +5556,19 @@ 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 -# Save the log message, 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. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.63. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7563,13 +5599,15 @@ _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 [OPTION]... [FILE]... +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 @@ -7585,16 +5623,17 @@ $config_files Configuration headers: $config_headers -Report bugs to ." +Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.63, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" -Copyright (C) 2008 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." @@ -7610,11 +5649,16 @@ 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 @@ -7628,27 +5672,29 @@ do 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 - CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - { $as_echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; };; + 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 \ @@ -7656,11 +5702,10 @@ Try \`$0 --help' for more information." >&2 ac_cs_silent=: ;; # This is an error. - -*) { $as_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 @@ -7677,7 +5722,7 @@ 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 + 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' @@ -7712,9 +5757,7 @@ do "docs/docbook/en-en/Makefile") CONFIG_FILES="$CONFIG_FILES docs/docbook/en-en/Makefile" ;; "subst") CONFIG_FILES="$CONFIG_FILES subst" ;; - *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -7736,26 +5779,24 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + 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 -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || -{ - $as_echo "$as_me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} +} || 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. @@ -7763,7 +5804,13 @@ $debug || if test -n "$CONFIG_FILES"; then -ac_cr=' ' +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' @@ -7771,7 +5818,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -7780,24 +5827,18 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -7805,7 +5846,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -7819,7 +5860,7 @@ s/'"$ac_delim"'$// t delim :nl h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -7833,7 +5874,7 @@ s/.\{148\}// t nl :delim h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p @@ -7853,7 +5894,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -7885,23 +5926,29 @@ 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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 -$as_echo "$as_me: error: could not setup config files machinery" >&2;} - { (exit 1); exit 1; }; } +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 $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# 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[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + 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 @@ -7913,7 +5960,7 @@ fi # test -n "$CONFIG_FILES" # 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 >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -7925,13 +5972,11 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -8016,9 +6061,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 -$as_echo "$as_me: error: could not setup config headers machinery" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -8031,9 +6074,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 -$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} - { (exit 1); exit 1; }; };; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -8052,7 +6093,7 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) 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 `:'. @@ -8061,12 +6102,10 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; + 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 - ac_file_inputs="$ac_file_inputs '$ac_f'" + as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't @@ -8077,7 +6116,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 + { $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. @@ -8089,10 +6128,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -8120,47 +6157,7 @@ $as_echo X"$ac_file" | q } s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in @@ -8212,7 +6209,6 @@ 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 @@ -8222,12 +6218,11 @@ ac_sed_dataroot=' /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/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:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 + { $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 @@ -8237,7 +6232,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF @@ -8264,27 +6259,24 @@ 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 "$tmp/subs.awk" >$tmp/out \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } +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' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 + { 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;} +which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -8293,27 +6285,21 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 + && 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 rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 -$as_echo "$as_me: error: could not create -" >&2;} - { (exit 1); exit 1; }; } + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; @@ -8323,15 +6309,12 @@ $as_echo "$as_me: error: could not create -" >&2;} done # for ac_tag -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -8352,10 +6335,10 @@ 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:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 + { $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 @@ -8368,16 +6351,16 @@ $PERL subst config/misccommands.cfg echo "" echo "" -{ $as_echo "$as_me:$LINENO: result: *** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:" >&5 +{ $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 " -------------------------" -{ $as_echo "$as_me:$LINENO: result: NDO2DB user: $ndo2db_user" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NDO2DB user: $ndo2db_user" >&5 $as_echo " NDO2DB user: $ndo2db_user" >&6; } -{ $as_echo "$as_me:$LINENO: result: NDO2DB group: $ndo2db_group" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NDO2DB group: $ndo2db_group" >&5 $as_echo " NDO2DB group: $ndo2db_group" >&6; } diff --git a/configure.in b/configure.ac similarity index 100% rename from configure.in rename to configure.ac diff --git a/update-version b/update-version index 5b98d60..a129a65 100755 --- a/update-version +++ b/update-version @@ -57,11 +57,11 @@ perl -i -p -e "s/SOCKDEBUG_VERSION \"[0-9].*\"/SOCKDEBUG_VERSION \"$newversion\" perl -i -p -e "s/SOCKDEBUG_DATE \"[0-9].*\"/SOCKDEBUG_DATE \"$SHORTDATE\"/;" src/sockdebug.c perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/sockdebug.c -# Update version number and release date in configure script and configure.in +# Update version number and release date in configure script and configure.ac perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$newversion\"/;" configure perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure -perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$newversion\"/;" configure.in -perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure.in +perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$newversion\"/;" configure.ac +perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure.ac # Update this file with version number and last date perl -i -p -e "s/^CURRENTVERSION=.*/CURRENTVERSION=$newversion/;" update-version From 1b6b1a09f93e22a585cd6104dfaddd7b9b1f67d1 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 2 Dec 2015 16:52:53 -0600 Subject: [PATCH 14/73] Prep for version 2.1.0b2 --- configure | 4 ++-- configure.ac | 4 ++-- src/file2sock.c | 6 +++--- src/log2ndo.c | 6 +++--- src/ndo2db.c | 6 +++--- src/ndomod.c | 6 +++--- src/sockdebug.c | 6 +++--- update-version | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/configure b/configure index b7edfdb..f713dce 100755 --- a/configure +++ b/configure @@ -2333,9 +2333,9 @@ $as_echo "#define DEFAULT_NAGIOS_GROUP nagios" >>confdefs.h PKG_NAME=ndoutils -PKG_VERSION="1.5.2" +PKG_VERSION="2.1.0b2" PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="06-08-2012" +PKG_REL_DATE="12-02-2015" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do diff --git a/configure.ac b/configure.ac index 3d8e13f..7af3388 100644 --- a/configure.ac +++ b/configure.ac @@ -12,9 +12,9 @@ AC_DEFINE([DEFAULT_NAGIOS_USER], [nagios], [Default Nagios User]) AC_DEFINE([DEFAULT_NAGIOS_GROUP], [nagios], [Default Nagios Group]) PKG_NAME=ndoutils -PKG_VERSION="1.5.2" +PKG_VERSION="2.1.0b2" PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="06-08-2012" +PKG_REL_DATE="12-02-2015" dnl Figure out how to invoke "install" and what install options to use. AC_PROG_INSTALL diff --git a/src/file2sock.c b/src/file2sock.c index 17beba2..c3f9102 100644 --- a/src/file2sock.c +++ b/src/file2sock.c @@ -6,7 +6,7 @@ * License: GPL v2 * * First Written: 05-13-2005 - * Last Modified: 06-08-2012 + * Last Modified: 12-02-2015 * **************************************************************/ @@ -14,9 +14,9 @@ #include "../include/common.h" #include "../include/io.h" -#define FILE2SOCK_VERSION "1.5.2" +#define FILE2SOCK_VERSION "2.1.0b2" #define FILE2SOCK_NAME "FILE2SOCK" -#define FILE2SOCK_DATE "06-08-2012" +#define FILE2SOCK_DATE "12-02-2015" int process_arguments(int,char **); diff --git a/src/log2ndo.c b/src/log2ndo.c index b221ecc..a8f5d65 100644 --- a/src/log2ndo.c +++ b/src/log2ndo.c @@ -4,7 +4,7 @@ * Copyright (c) 2009 Nagios Core Development Team and Community Contributors * Copyright (c) 2005-2009 Ethan Galstad * - * Last Modified: 06-08-2012 + * Last Modified: 12-02-2015 * **************************************************************/ @@ -13,9 +13,9 @@ #include "../include/io.h" #include "../include/protoapi.h" -#define LOG2NDO_VERSION "1.5.2" +#define LOG2NDO_VERSION "2.1.0b2" #define LOG2NDO_NAME "LOG2NDO" -#define LOG2NDO_DATE "06-08-2012" +#define LOG2NDO_DATE "12-02-2015" diff --git a/src/ndo2db.c b/src/ndo2db.c index f31f63e..a84cc88 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -5,7 +5,7 @@ * Copyright (c) 2005-2009 Ethan Galstad * * First Written: 05-19-2005 - * Last Modified: 06-08-2012 + * Last Modified: 12-02-2015 * **************************************************************/ @@ -34,9 +34,9 @@ #include "../include/dh.h" #endif -#define NDO2DB_VERSION "2.0.0" +#define NDO2DB_VERSION "2.1.0b2" #define NDO2DB_NAME "NDO2DB" -#define NDO2DB_DATE "10-30-2012" +#define NDO2DB_DATE "12-02-2015" #ifdef HAVE_SSL SSL_METHOD *meth; diff --git a/src/ndomod.c b/src/ndomod.c index ffe3a85..773c827 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -6,7 +6,7 @@ * Copyright (c) 2005-2009 Ethan Galstad * * First Written: 05-19-2005 - * Last Modified: 09-27-2012 + * Last Modified: 12-02-2015 * * TO DO: Add service parents, hourly value (hosts / services), * minimum value (contacts) @@ -65,9 +65,9 @@ NEB_API_VERSION(CURRENT_NEB_API_VERSION) -#define NDOMOD_VERSION "2.0.0" +#define NDOMOD_VERSION "2.1.0b2" #define NDOMOD_NAME "NDOMOD" -#define NDOMOD_DATE "10-30-2012" +#define NDOMOD_DATE "12-02-2015" #define BD_INT 0 #define BD_TIMEVAL 1 diff --git a/src/sockdebug.c b/src/sockdebug.c index c92cd65..1ab857a 100644 --- a/src/sockdebug.c +++ b/src/sockdebug.c @@ -5,15 +5,15 @@ * Copyright (c) 2005-2009 Ethan Galstad * * First Written: 05-13-2005 - * Last Modified: 06-08-2012 + * Last Modified: 12-02-2015 * **************************************************************/ #include "../include/config.h" -#define SOCKDEBUG_VERSION "1.5.2" +#define SOCKDEBUG_VERSION "2.1.0b2" #define SOCKDEBUG_NAME "SOCKDEBUG" -#define SOCKDEBUG_DATE "06-08-2012" +#define SOCKDEBUG_DATE "12-02-2015" int cleanup_socket(int,char *); diff --git a/update-version b/update-version index a129a65..16b95e9 100755 --- a/update-version +++ b/update-version @@ -10,10 +10,10 @@ else fi # Current version number -CURRENTVERSION=1.5.2 +CURRENTVERSION=2.1.0b2 # Last date -LASTDATE=06-08-2012 +LASTDATE=12-02-2015 if [ "x$1" = "x" ] then From 94995161f5b01bc910c5b7f6cb83f0475a6dfd30 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Tue, 19 Jan 2016 11:35:46 -0600 Subject: [PATCH 15/73] Fix a segfault if core < 4.1.2 and ndo >= 2.1 I added the `char *longoutput` to the nebstruct_statechange_struct after `char *output` and before `char *object_ptr`, so when ndomod tries to get object_ptr, it points past the end of the structure. --- include/nagios-4x/nebstructs.h | 2 +- src/ndomod.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/nagios-4x/nebstructs.h b/include/nagios-4x/nebstructs.h index 7267b11..9862ea9 100644 --- a/include/nagios-4x/nebstructs.h +++ b/include/nagios-4x/nebstructs.h @@ -517,8 +517,8 @@ typedef struct nebstruct_statechange_struct { int current_attempt; int max_attempts; char *output; - char *longoutput; void *object_ptr; + char *longoutput; } nebstruct_statechange_data; NAGIOS_END_DECL diff --git a/src/ndomod.c b/src/ndomod.c index 773c827..dde359a 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -213,7 +213,7 @@ int ndomod_check_nagios_object_version(void){ if(__nagios_object_structure_version!=CURRENT_OBJECT_STRUCTURE_VERSION){ /* Temporary special case so newer ndomod can be used with slightly * older nagios in order to get longoutput on state changes */ - if (CURRENT_OBJECT_STRUCTURE_VERSION == 403 && __nagios_object_structure_version == 402) { + if (CURRENT_OBJECT_STRUCTURE_VERSION >= 403 && __nagios_object_structure_version == 402) { has_ver403_long_output = 0; return NDO_OK; } @@ -3401,7 +3401,7 @@ int ndomod_broker_data(int event_type, void *data){ es[1]=ndo_escape_buffer(schangedata->service_description); es[2]=ndo_escape_buffer(schangedata->output); #ifdef BUILD_NAGIOS_4X - if (CURRENT_OBJECT_STRUCTURE_VERSION > 403 || (CURRENT_OBJECT_STRUCTURE_VERSION == 403 && has_ver403_long_output)) + if (CURRENT_OBJECT_STRUCTURE_VERSION >= 403 && has_ver403_long_output) es[3]=ndo_escape_buffer(schangedata->longoutput); else es[3]=ndo_escape_buffer(schangedata->output); From 8fa5c17a6b4953fa12f3cd2418eb14b2f55f6723 Mon Sep 17 00:00:00 2001 From: Scott Wilkerson Date: Mon, 27 Jun 2016 15:37:42 -0500 Subject: [PATCH 16/73] Initial commit --- LICENSE | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 340 insertions(+) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..23cb790 --- /dev/null +++ b/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/README.md b/README.md new file mode 100644 index 0000000..f03769a --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# autoconf-macros \ No newline at end of file From a26a7c64ed03f347249e0a6d7f22a83d055e2ded Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Tue, 28 Jun 2016 11:52:54 -0500 Subject: [PATCH 17/73] Initial import of macro files, .gitignore, and README.md --- .gitignore | 1 + README.md | 184 ++++++++++- ax_nagios_get_distrib | 158 +++++++++ ax_nagios_get_files | 131 ++++++++ ax_nagios_get_inetd | 145 +++++++++ ax_nagios_get_init | 195 ++++++++++++ ax_nagios_get_os | 101 ++++++ ax_nagios_get_paths | 725 ++++++++++++++++++++++++++++++++++++++++++ ax_nagios_get_ssl | 281 ++++++++++++++++ 9 files changed, 1920 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 ax_nagios_get_distrib create mode 100644 ax_nagios_get_files create mode 100644 ax_nagios_get_inetd create mode 100644 ax_nagios_get_init create mode 100644 ax_nagios_get_os create mode 100644 ax_nagios_get_paths create mode 100644 ax_nagios_get_ssl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80f408e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +nbproject/ diff --git a/README.md b/README.md index f03769a..2ceecbf 100644 --- a/README.md +++ b/README.md @@ -1 +1,183 @@ -# autoconf-macros \ No newline at end of file +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 --prefix=macros autoconf-macros master + +* If you already have an autoconf directory, such as `build_aux`, you can +replace `--prefix=macros` with `--prefix=build_aux` in any of the +commands above, or references below. + + +## 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/ax_nagios_get_distrib b/ax_nagios_get_distrib new file mode 100644 index 0000000..2ea11f4 --- /dev/null +++ b/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/ax_nagios_get_files b/ax_nagios_get_files new file mode 100644 index 0000000..fd56735 --- /dev/null +++ b/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/ax_nagios_get_inetd b/ax_nagios_get_inetd new file mode 100644 index 0000000..94ce32b --- /dev/null +++ b/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/ax_nagios_get_init b/ax_nagios_get_init new file mode 100644 index 0000000..c43ef01 --- /dev/null +++ b/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/ax_nagios_get_os b/ax_nagios_get_os new file mode 100644 index 0000000..5683158 --- /dev/null +++ b/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/ax_nagios_get_paths b/ax_nagios_get_paths new file mode 100644 index 0000000..8a4ae37 --- /dev/null +++ b/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/ax_nagios_get_ssl b/ax_nagios_get_ssl new file mode 100644 index 0000000..7d580fb --- /dev/null +++ b/ax_nagios_get_ssl @@ -0,0 +1,281 @@ +# =========================================================================== +# 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 +ssl_dir= +ssl_inc_dir= +ssl_lib_dir= +SSL_INC_DIR= +SSL_LIB_DIR= + +AC_SUBST(HAVE_SSL) +AC_SUBST(SSL_INC_DIR) +AC_SUBST(SSL_LIB_DIR) + + +# gnutls/openssl.h +# nss_compat_ossl/nss_compat_ossl.h + +# Which type - openssl, gnutls-openssl, nss +AC_ARG_WITH([ssl-type], +dnl AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls or nss to use one of these instead of openssl]), + AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls to use that instead of openssl]), + [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]) + +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_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_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_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 ; then +# cflags=`$PKG_CONFIG $SSL_TYPE --cflags-only-I 2>/dev/null` +# if test $? = 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 + ssldir="$dir" + if test -f "$dir/include/openssl/$ssl_hdr"; then + found_ssl=yes + CFLAGS="$CFLAGS -I$dir/include/openssl -I$ssldir/include" + SSL_INC_DIR="$dir/include/openssl" + break + fi + if test -f "$dir/include/$ssl_hdr"; then + found_ssl=yes + CFLAGS="$CFLAGS -I$dir/include" + SSL_INC_DIR="$dir/include" + break + fi + if test -f "$dir/$ssl_hdr"; then + found_ssl=yes + CFLAGS="$CFLAGS -I$dir" + SSL_INC_DIR="$dir" + ssldir="$dir/.." + break + fi + if test -f "$dir/openssl/$ssl_hdr"; then + found_ssl=yes + CFLAGS="$CFLAGS -I$dir/openssl" + SSL_INC_DIR="$dir/openssl" + 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 + # 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_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 +]) From aae492aecf15dfa0ce379a4bf1907af89acaad0b Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Tue, 28 Jun 2016 12:06:52 -0500 Subject: [PATCH 18/73] Styles not supported by github. Removed. --- README.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/README.md b/README.md index 2ceecbf..131e902 100644 --- a/README.md +++ b/README.md @@ -168,16 +168,3 @@ where you want to check for 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`. - - - - - - - - From 9555d3d5ddd8fa1cd56efd3931254b86d78297f3 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Tue, 28 Jun 2016 12:20:12 -0500 Subject: [PATCH 19/73] Removed item about using an already existing directory. This would have (in some cases) make things easier, but I tried it, and it doesn't work. --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 131e902..e51ece4 100644 --- a/README.md +++ b/README.md @@ -131,9 +131,6 @@ master. git subtgree pull --prefix=macros autoconf-macros master -* If you already have an autoconf directory, such as `build_aux`, you can -replace `--prefix=macros` with `--prefix=build_aux` in any of the -commands above, or references below. ## References From 55fce62af6604ce7af9cb530ff1abf69aecc8005 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Tue, 28 Jun 2016 12:39:14 -0500 Subject: [PATCH 20/73] Added the `--squash` parameter to the `pug subtree pull` command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e51ece4..078eb3c 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ master. * To get the latest version of `autoconf-macros` into your parent project: - git subtgree pull --prefix=macros autoconf-macros master + git subtgree pull --squash --prefix=macros autoconf-macros master From d570c9b262d9c50b3091fdebf7bfa818251379ed Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Thu, 30 Jun 2016 10:56:38 -0500 Subject: [PATCH 21/73] Added the script to create groups and users --- add_group_user | 140 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100755 add_group_user diff --git a/add_group_user b/add_group_user new file mode 100755 index 0000000..5d1c212 --- /dev/null +++ b/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 From 03f9fde56623956ca00e15c038f0e1899af91fc8 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Mon, 11 Jul 2016 14:23:57 -0500 Subject: [PATCH 22/73] Changes for SSL portability. Also uses pgk-config if available. --- ax_nagios_get_ssl | 72 +++++++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/ax_nagios_get_ssl b/ax_nagios_get_ssl index 7d580fb..3bfb712 100644 --- a/ax_nagios_get_ssl +++ b/ax_nagios_get_ssl @@ -49,14 +49,19 @@ AC_DEFUN([AX_NAGIOS_GET_SSL], # ------------------------------- SSL_TYPE=openssl +try_pkg_config=0 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) @@ -80,6 +85,10 @@ 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]), @@ -90,8 +99,8 @@ if test x$SSL_TYPE = xyes; then fi -dflt_hdrs="$ssl_inc_dir $ssl_dir $ssl_dir/include $ssl_dir/include \ - /usr/local/opt/{BBB} /usr/include/{BBB} /usr/local/include{BBB} \ +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}" @@ -109,17 +118,19 @@ AS_CASE([$SSL_TYPE], [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_hdr=ssl.h + 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_hdr=compat.h + SSL_INC_PREFIX=gnutls + 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_HDR=nss_compat_ossl.h ssl_lib=libnss_compat], [*], echo >&6; AC_MSG_ERROR(['--with-ssl-type=$SSL_TYPE' is invalid]) ) @@ -154,48 +165,51 @@ if test x$SSL_TYPE != xNONE; then fi # First, try using pkg_config -# AC_CHECK_TOOL([PKG_CONFIG], [pkg-config]) -# if test x"$PKG_CONFIG" != x ; then -# cflags=`$PKG_CONFIG $SSL_TYPE --cflags-only-I 2>/dev/null` -# if test $? = 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 + 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 $? = 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/openssl/$ssl_hdr"; then + if test -f "$dir/include/$SSL_INC_PREFIX/$SSL_HDR"; then found_ssl=yes - CFLAGS="$CFLAGS -I$dir/include/openssl -I$ssldir/include" - SSL_INC_DIR="$dir/include/openssl" + 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 + if test -f "$dir/include/$SSL_HDR"; then found_ssl=yes + SSL_INC_PREFIX="" CFLAGS="$CFLAGS -I$dir/include" SSL_INC_DIR="$dir/include" break fi - if test -f "$dir/$ssl_hdr"; then + if test -f "$dir/$SSL_HDR"; then found_ssl=yes + SSL_INC_PREFIX="" CFLAGS="$CFLAGS -I$dir" SSL_INC_DIR="$dir" - ssldir="$dir/.." break fi - if test -f "$dir/openssl/$ssl_hdr"; then + if test -f "$dir/$SSL_INC_PREFIX/$SSL_HDR"; then found_ssl=yes - CFLAGS="$CFLAGS -I$dir/openssl" - SSL_INC_DIR="$dir/openssl" + CFLAGS="$CFLAGS -I$dir/$SSL_INC_PREFIX" + SSL_INC_DIR="$dir/$SSL_INC_PREFIX" ssldir="$dir/.." break fi @@ -247,11 +261,15 @@ if test x$SSL_TYPE != xNONE; then 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_new(NULL)])], + [AC_LANG_PROGRAM([#include <${SSL_INC_PREFIX}${SSL_HDR}>], [SSL_new(NULL)])], [ AC_MSG_RESULT([yes]) $1 From ca39514242cbdfb91ded771598368b22fc195ed9 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Mon, 11 Jul 2016 15:04:15 -0500 Subject: [PATCH 23/73] Having trouble getting gnutls/compat to work. Backing off for now. --- ax_nagios_get_ssl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ax_nagios_get_ssl b/ax_nagios_get_ssl index 3bfb712..c18793f 100644 --- a/ax_nagios_get_ssl +++ b/ax_nagios_get_ssl @@ -68,11 +68,11 @@ AC_SUBST(SSL_LIB_DIR) # gnutls/openssl.h # nss_compat_ossl/nss_compat_ossl.h -# Which type - openssl, gnutls-openssl, nss -AC_ARG_WITH([ssl-type], -dnl AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls or nss to use one of these instead of openssl]), - AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls to use that instead of openssl]), - [SSL_TYPE=$withval]) +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]), @@ -125,6 +125,7 @@ AS_CASE([$SSL_TYPE], [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], @@ -168,7 +169,7 @@ if test x$SSL_TYPE != xNONE; then 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 $? = 0; then + 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`" @@ -194,7 +195,9 @@ if test x$SSL_TYPE != xNONE; then fi if test -f "$dir/include/$SSL_HDR"; then found_ssl=yes - SSL_INC_PREFIX="" + if test "$SSL_HDR" != compat.h ; then + SSL_INC_PREFIX="" + fi CFLAGS="$CFLAGS -I$dir/include" SSL_INC_DIR="$dir/include" break From 405b9b6cddaeebd7926f05fd8bb9deaa9eb4f30d Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Mon, 11 Jul 2016 15:15:34 -0500 Subject: [PATCH 24/73] Forgot to reset a switch --- ax_nagios_get_ssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ax_nagios_get_ssl b/ax_nagios_get_ssl index c18793f..eda150e 100644 --- a/ax_nagios_get_ssl +++ b/ax_nagios_get_ssl @@ -49,7 +49,7 @@ AC_DEFUN([AX_NAGIOS_GET_SSL], # ------------------------------- SSL_TYPE=openssl -try_pkg_config=0 +try_pkg_config=1 ssl_dir= ssl_inc_dir= ssl_lib_dir= From 0856aab738d4744553629a4bf5622f5ed64b1de3 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 22 Jul 2016 11:02:26 -0500 Subject: [PATCH 25/73] Adding platform/os/distro specific startup files --- startup/bsd-init.in | 72 +++++++++++++++++ startup/debian-init.in | 47 +++++++++++ startup/default-inetd.in | 5 ++ startup/default-init.in | 146 ++++++++++++++++++++++++++++++++++ startup/default-service.in | 23 ++++++ startup/default-socket-svc.in | 16 ++++ startup/default-socket.in | 12 +++ startup/default-xinetd.in | 15 ++++ startup/mac-inetd.plist.in | 40 ++++++++++ startup/mac-init.plist.in | 32 ++++++++ startup/newbsd-init.in | 35 ++++++++ startup/openbsd-init.in | 18 +++++ startup/openrc-conf.in | 7 ++ startup/openrc-init.in | 39 +++++++++ startup/rh-upstart-init.in | 17 ++++ startup/solaris-inetd.xml.in | 90 +++++++++++++++++++++ startup/solaris-init.xml.in | 137 +++++++++++++++++++++++++++++++ startup/tmpfile.conf.in | 2 + startup/upstart-init.in | 19 +++++ 19 files changed, 772 insertions(+) create mode 100644 startup/bsd-init.in create mode 100644 startup/debian-init.in create mode 100644 startup/default-inetd.in create mode 100644 startup/default-init.in create mode 100644 startup/default-service.in create mode 100644 startup/default-socket-svc.in create mode 100644 startup/default-socket.in create mode 100644 startup/default-xinetd.in create mode 100644 startup/mac-inetd.plist.in create mode 100644 startup/mac-init.plist.in create mode 100644 startup/newbsd-init.in create mode 100644 startup/openbsd-init.in create mode 100644 startup/openrc-conf.in create mode 100644 startup/openrc-init.in create mode 100644 startup/rh-upstart-init.in create mode 100644 startup/solaris-inetd.xml.in create mode 100644 startup/solaris-init.xml.in create mode 100644 startup/tmpfile.conf.in create mode 100644 startup/upstart-init.in diff --git a/startup/bsd-init.in b/startup/bsd-init.in new file mode 100644 index 0000000..538674a --- /dev/null +++ b/startup/bsd-init.in @@ -0,0 +1,72 @@ +#!/bin/sh + +# Start/stop/restart/reload ndo2db +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team + +NDO2DB_BIN=@sbindir@/ndo2db +NDO2DB_CFG=@pkgsysconfdir@/ndo2db.cfg +PID_DIR=@piddir@ +PID_FILE=@piddir@/ndo2db.pid + +# Start ndo2db +ndo2db_start() { + echo -n "Starting ndo2db daemon: $NDO2DB_BIN - " + if [ ! -d "$PID_DIR" ]; then + mkdir -p "$PID_DIR" + fi + $NDO2DB_BIN -c $NDO2DB_CFG -d + if [ $? = 0 ]; then + echo "started" + else + echo "failed" + fi +} + +# Stop ndo2db +ndo2db_stop() { + echo -n "Stopping ndo2db daemon - " + if [ -r "$PID_FILE" ]; then + kill $(cat "$PID_FILE") + else + killall ndo2db + fi + if [ $? = 0 ]; then + echo "stopped" + else + echo "failed" + fi +} + +# Restart ndo2db +ndo2db_restart() { + ndo2db_stop + sleep 1 + ndo2db_start +} + +# ndo2db status +ndo2db_status() { + if ps -C ndo2db >/dev/null; then + echo "ndo2db is running." + else + echo "ndo2db is stopped." + fi +} + +case "$1" in +'start') + ndo2db_start + ;; +'stop') + ndo2db_stop + ;; +'restart') + ndo2db_restart + ;; +'status') + ndo2db_status + ;; +*) + echo "Usage $0 start|stop|restart|status" + ;; +esac diff --git a/startup/debian-init.in b/startup/debian-init.in new file mode 100644 index 0000000..783985f --- /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 ndo2db daemon. + +NDO2DB_BIN=@sbindir@/ndo2db +NDO2DB_CFG=@pkgsysconfdir@/ndo2db.cfg +PID_FILE=@piddir@/ndo2db.pid + +test -x $NDO2DB_BIN || exit 0 + +case "$1" in + +start) + echo -n "Starting nagios remote plugin daemon: ndo2db" + start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NDO2DB_BIN -- -c $NDO2DB_CFG -d + echo "." + ;; + +stop) + echo -n "Stopping nagios remote plugin daemon: ndo2db" + start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NDO2DB_BIN + echo "." + ;; + +restart|force-reload) + echo -n "Restarting nagios remote plugin daemon: ndo2db" + start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NDO2DB_BIN + start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NDO2DB_BIN -- -c $NDO2DB_CFG -d + echo "." + ;; + +reload) + echo -n "Reloading configuration files for nagios remote plugin daemon: ndo2db" + 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..8084db9 --- /dev/null +++ b/startup/default-inetd.in @@ -0,0 +1,5 @@ +# +# Enable the following entry to enable the ndo2db daemon +#ndo2db stream tcp nowait @ndo2db_user@ @sbindir@/ndo2db ndo2db -c @pkgsysconfdir@/ndo2db.cfg --inetd +# Enable the following entry if the ndo2db daemon didn't link with libwrap +#ndo2db stream tcp nowait @ndo2db_user@ /usr/sbin/tcpd @sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg --inetd diff --git a/startup/default-init.in b/startup/default-init.in new file mode 100644 index 0000000..9ad062e --- /dev/null +++ b/startup/default-init.in @@ -0,0 +1,146 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# chkconfig: - 80 30 +# description: Starts and stops the Nagios Data Out Daemon \ +# to store data in a database + +# +### BEGIN INIT INFO +# Provides: ndo2db +# 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 Data Out Daemon +# Description: Starts and stops the Nagios Data Out Daemon +# to store data in a database +### END INIT INFO + + +NDO2DB_BIN=@sbindir@/ndo2db +NDO2DB_CFG=@pkgsysconfdir@/ndo2db.cfg +LOCK_DIR=@subsyslockdir@ +LOCK_FILE=@subsyslockfile@ +PID_FILE=@piddir@/ndo2db.pid + +test -x $NDO2DB_BIN || exit 5 + +RETVAL=0 + +# 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 $NDO2DB_BIN -TERM" +HUP_CMD="killproc -p $PID_FILE $NDO2DB_BIN -HUP" +PRT_STAT="echo" +STAT_MSG="echo -n Checking for ndo2db daemon... " +STAT_CMD="status ndo2db" +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 $NDO2DB_BIN" + HUP_CMD="killproc -p $PID_FILE -HUP $NDO2DB_BIN" + PRT_STAT="rc_status -v -r" + STAT_CMD="checkproc -p $PID_FILE $NDO2DB_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 $NDO2DB_BIN ndo2db" + +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 ndo2db " + $START_CMD $NDO2DB_BIN -c $NDO2DB_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 ndo2db " + $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=$? + ;; + +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: ndo2db {start|stop|restart|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..8b6610a --- /dev/null +++ b/startup/default-service.in @@ -0,0 +1,23 @@ +[Unit] +Description=Nagios Data Out Daemon +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=ndo2db.socket + +[Install] +WantedBy=multi-user.target + +[Service] +Type=simple +Restart=on-abort +PIDFile=@piddir@/ndo2db.pid +RuntimeDirectory=ndo2db +RuntimeDirectoryMode=0755 +ExecStart=@sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -f +ExecStopPost=/bin/rm -f @piddir@/ndo2db.pid +TimeoutStopSec=60 +User=@ndo2db_user@ +Group=@ndo2db_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..d8abd34 --- /dev/null +++ b/startup/default-socket-svc.in @@ -0,0 +1,16 @@ +[Unit] +Description=Nagios Data Out Daemon +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@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg --inetd +KillMode=process +User=@ndo2db_user@ +Group=@ndo2db_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..218dec4 --- /dev/null +++ b/startup/default-socket.in @@ -0,0 +1,12 @@ +[Unit] +Description=Nagios Data Out Daemon +Documentation=http://www.nagios.org/documentation +Before=ndo2db.service +Conflicts=ndo2db.service + +[Socket] +ListenStream=@ndo2db_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..92facc4 --- /dev/null +++ b/startup/default-xinetd.in @@ -0,0 +1,15 @@ +# default: off +# description: NDO2DB (Nagios Data Out Daemon) +service ndo2db +{ + disable = yes + socket_type = stream + port = @ndo2db_port@ + wait = no + user = @ndo2db_user@ + group = @ndo2db_group@ + server = @sbindir@/ndo2db + server_args = -c @pkgsysconfdir@/ndo2db.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..22ecbd8 --- /dev/null +++ b/startup/mac-inetd.plist.in @@ -0,0 +1,40 @@ + + + + + Label + org.nagios.ndo2db + UserName + @ndo2db_user@ + GroupName + @ndo2db_group@ + Program + @sbindir@/ndo2db + ProgramArguments + + ndo2db + -c + @pkgsysconfdir@/ndo2db.cfg + -i + + Sockets + + Listeners + + SockServiceName + @ndo2db_port@ + 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..3904b3d --- /dev/null +++ b/startup/mac-init.plist.in @@ -0,0 +1,32 @@ + + + + + Label + org.nagios.ndo2db + UserName + @ndo2db_user@ + GroupName + @ndo2db_group@ + Program + @sbindir@/ndo2db + ProgramArguments + + ndo2db + -c + @pkgsysconfdir@/ndo2db.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..af2e2c1 --- /dev/null +++ b/startup/newbsd-init.in @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# PROVIDE: ndo2db +# REQUIRE: DAEMON +# KEYWORD: shutdown + +. /etc/rc.subr + +: ${ndo2db@bsd_enable@:="NO"} +: ${ndo2db_configfile:="@pkgsysconfdir@/ndo2db.cfg"} + +name=ndo2db +command="@sbindir@/ndo2db" +command_args="-c $ndo2db_configfile -d" +pidfile="@piddir@/ndo2db.pid" +extra_commands=reload +sig_reload=HUP +rcvar=ndo2db@bsd_enable@ +load_rc_config "$name" +required_files="$ndo2db_configfile" +sig_reload=HUP + +start_precmd=ndo2db_prestart + +ndo2db_prestart() +{ + [ -n "$ndo2db_pidfile" ] && + warn "No longer necessary to set ndo2db_pidfile in rc.conf[.local]" + + install -d -o @ndo2db_user@ ${pidfile%/*} +} + +run_rc_command "$1" diff --git a/startup/openbsd-init.in b/startup/openbsd-init.in new file mode 100644 index 0000000..bd67b9f --- /dev/null +++ b/startup/openbsd-init.in @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# + +daemon="@sbindir@/ndo2db" + +. /etc/rc.d/rc.subr + +rc_pre() { + install -d -o @ndo2db_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..8253fbb --- /dev/null +++ b/startup/openrc-conf.in @@ -0,0 +1,7 @@ +# /etc/conf.d/ndo2db : config file for /etc/init.d/ndo2db + +# Configuration file - default is @sysconfdir@/ndo2db.cfg +NDO2DB_CFG="@pgksysconfdir@/ndo2db.cfg" + +# Any additional ndo2db options (-n -4 -6) +NDO2DB_OPTS="" diff --git a/startup/openrc-init.in b/startup/openrc-init.in new file mode 100644 index 0000000..6ddf399 --- /dev/null +++ b/startup/openrc-init.in @@ -0,0 +1,39 @@ +#!/sbin/runscript +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team +# +# Start/stop the Nagios Data Out Daemon. +# +# Goes in /etc/init.d - Config is in /etc/conf.d/ndo2db + +NDO2DB_BIN="@sbindir@/ndo2db" +NDO2DB_PID="@piddir@/ndo2db.pid" + +depend() { + use logger dns net localmount netmount nfsmount +} + +checkconfig() { + # Make sure the config file exists + if [ ! -f $NDO2DB_CFG ]; then + eerror "You need to setup $NDO2DB_CFG. + return 1 + fi + return 0 +} + +start() { + checkconfig || return 1 + ebegin "Starting ndo2db" + # Make sure we have a sane current directory + cd / + start-stop-daemon --start --exec $NDO2DB_BIN --pidfile $PID_FILE \ + -- -c $NDO2DB_CFG -f $NDO2DB_OPTS + eend $? +} + +stop() { + ebegin "Stopping ndo2db" + start-stop-daemon --stop --exec $NDO2DB_BIN --pidfile $PID_FILE + eend $? +} diff --git a/startup/rh-upstart-init.in b/startup/rh-upstart-init.in new file mode 100644 index 0000000..d33ef6d --- /dev/null +++ b/startup/rh-upstart-init.in @@ -0,0 +1,17 @@ +# ndo2db - the Nagios Data Out Daemon +# +# ndo2db is a program that adds nagios related +# records to a database +# +# Copyright (c) 2016 Nagios(R) Core(TM) Development Team + +description "the Nagios Data Out Daemon" + +oom -10 + +start on started network +stop on runlevel [!2345] + +respawn + +exec @sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -f diff --git a/startup/solaris-inetd.xml.in b/startup/solaris-inetd.xml.in new file mode 100644 index 0000000..84f2086 --- /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..5192a9b --- /dev/null +++ b/startup/solaris-init.xml.in @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/startup/tmpfile.conf.in b/startup/tmpfile.conf.in new file mode 100644 index 0000000..396d252 --- /dev/null +++ b/startup/tmpfile.conf.in @@ -0,0 +1,2 @@ +#Type Path Mode UID GID Age Argument +D @piddir@ 0755 @ndo2db_user@ @ndo2db_group@ - - diff --git a/startup/upstart-init.in b/startup/upstart-init.in new file mode 100644 index 0000000..98a14c8 --- /dev/null +++ b/startup/upstart-init.in @@ -0,0 +1,19 @@ +# ndo2db - the Nagios Remote Plugin Executor +# +# ndo2db 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 @ndo2db_group@ +setuid @ndo2db_user@ + +start on (local-filesystems and net-device-up IFACE!=lo) +stop on runlevel [!2345] + +respawn + +exec @sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -f From c8680434218b2230628a277e7a67d05baf03b1ed Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 22 Jul 2016 11:04:13 -0500 Subject: [PATCH 26/73] Adding platform/os/distro specific install information --- Makefile.in | 55 ++++++++++++++++++++++++++++++++++--- aclocal.m4 | 6 ++++ config/ndo2db.cfg-sample.in | 4 +-- configure.ac | 8 ++++++ 4 files changed, 67 insertions(+), 6 deletions(-) diff --git a/Makefile.in b/Makefile.in index b9fd088..8c46e2e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -18,8 +18,15 @@ BINDIR=@bindir@ LIBEXECDIR=@libexecdir@ INSTALL=@INSTALL@ INSTALL_OPTS=@INSTALL_OPTS@ -INIT_DIR=@init_dir@ +INIT_TYPE=@init_type@ +INIT_DIR=@initdir@ INIT_OPTS=-o root -g root +INETD_TYPE=@inetd_type@ +INETD_DIR=@inetddir@ +INETD_FILE=@inetdname@ +SRC_INETD=@src_inetd@ +INIT_FILE=@initname@ +SRC_INIT=@src_init@ all: cd $(SRC_BASE) && $(MAKE) @@ -45,9 +52,49 @@ install-config: @echo "Please read the documentation to know what they are doing." @echo "" -install-init: - $(INSTALL) -m 755 $(INIT_OPTS) -d $(DESTDIR)$(INIT_DIR) - $(INSTALL) -m 755 $(INIT_OPTS) daemon-init $(DESTDIR)$(INIT_DIR)/ndo2db +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 ndo2db' 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 "# ndo2db@bsd_enable@=NO" >> /etc/rc.conf;\ + echo "ndo2db@bsd_enable@=\"-d -c $(CFGDIR)/ndo2db.cfg\"" >> /etc/rc.conf;\ + echo "Make sure to enable the ndo2db daemon";\ + else\ + echo "ndo2db@bsd_enable@=YES" >> /etc/rc.conf;\ + echo "ndo2db_configfile=$(CFGDIR)/ndo2db.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 ndo2db on;\ + else\ + echo "Make sure to enable the ndo2db daemon";\ + fi;\ + fi;\ + fi fullinstall: install install-init install-config diff --git a/aclocal.m4 b/aclocal.m4 index 2dfe8fc..1395cf0 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -12,3 +12,9 @@ # PARTICULAR PURPOSE. m4_include([m4/np_mysqlclient.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]) diff --git a/config/ndo2db.cfg-sample.in b/config/ndo2db.cfg-sample.in index a88e34a..e025c7b 100644 --- a/config/ndo2db.cfg-sample.in +++ b/config/ndo2db.cfg-sample.in @@ -10,7 +10,7 @@ # This is the lockfile that NDO2DB will use to store its PID number # in when it is running in daemon mode. -lock_file=@localstatedir@/ndo2db.lock +lock_file=@localstatedir@/ndo2db.pid @@ -50,7 +50,7 @@ socket_name=@localstatedir@/ndo.sock # connections on. This option is only vlaid if the socket type # specified above is "tcp". -tcp_port=5668 +tcp_port=@ndo2db_port@ diff --git a/configure.ac b/configure.ac index 7af3388..70ebe5f 100644 --- a/configure.ac +++ b/configure.ac @@ -30,6 +30,14 @@ dnl Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET +dnl Nagios O/S, Distribution, Startup, Paths, Files macros +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 + dnl Checks for header files. AC_HEADER_STDC AC_HEADER_TIME From 02d18247fd8f316cbb554d42815c91f3913b2fb7 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 22 Jul 2016 11:04:54 -0500 Subject: [PATCH 27/73] Squashed 'macros/' changes from 405b9b6..3ae63db 3ae63db Change to say ndo2db needs to know the NEB directory git-subtree-dir: macros git-subtree-split: 3ae63db8f33717e7d01159dbf510e9aa7e9615b4 --- ax_nagios_get_paths | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ax_nagios_get_paths b/ax_nagios_get_paths index 8a4ae37..bd6c47a 100644 --- a/ax_nagios_get_paths +++ b/ax_nagios_get_paths @@ -119,16 +119,17 @@ 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 + # Does this package need to know: +need_cgi=no # where the cgi-bin directory is +need_web=no # where the website directory is +need_brk=no # where the event broker modules directory is +need_plg=no # where the plugins directory is +need_pipe=no # where the pipe directory is +need_spl=no # where the spool directory is +need_loc=no # where the locale directory is +need_log_subdir=no # where the loc sub-directory is +need_etc_subdir=no # where the etc sub-directory is +need_pls_dir=no # where the package locate state directory is AS_CASE([$PKG_NAME], [nagios], @@ -143,6 +144,7 @@ AS_CASE([$PKG_NAME], need_web=yes, [ndoutils], + need_brk=yes need_spl=yes, [nrpe], From bc44170358f96e3924ecb4962337f5a50532a41b Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 22 Jul 2016 11:45:37 -0500 Subject: [PATCH 28/73] Updating platform/os/distro specific install information --- aclocal.m4 | 1 + configure.ac | 163 +++++++++----------------------- daemon-init.in | 193 -------------------------------------- include/{io.h => io.h.in} | 2 +- subst.in | 49 ---------- 5 files changed, 44 insertions(+), 364 deletions(-) delete mode 100755 daemon-init.in rename include/{io.h => io.h.in} (94%) delete mode 100755 subst.in diff --git a/aclocal.m4 b/aclocal.m4 index 1395cf0..8ed936c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -18,3 +18,4 @@ 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/configure.ac b/configure.ac index 70ebe5f..b2565d4 100644 --- a/configure.ac +++ b/configure.ac @@ -153,9 +153,13 @@ elif test -d /sbin/init.d; then init_dir="/sbin/init.d" fi -dnl User can override init script location -AC_ARG_WITH(init_dir,AC_HELP_STRING([--with-init-dir=],[sets directory to place init script into]),init_dir=$withval) -AC_SUBST(init_dir) +AC_ARG_WITH([ndo2db_port], + AS_HELP_STRING([--with-ndo2db-port=], + [sets port number for NDO2DB to listen on]), + [ndo2db_port=$withval], + [ndo2db_port=5668]) +AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,$ndo2db_port,[Default port for NDO2DB daemon]) +AC_SUBST(ndo2db_port) dnl - Modified version from www.erlang.org dnl - Some 12/15/05 mods made after reading http://xaxxon.slackworks.com/phuku/dl.html @@ -305,121 +309,13 @@ AC_ARG_ENABLE(ssl,AC_HELP_STRING([--enable-ssl],[enables native SSL support]),[ ],check_for_ssl=no) dnl Optional SSL library and include paths -ssl_dir= -ssl_inc_dir= -ssl_lib_dir= -AC_ARG_WITH(ssl,AC_HELP_STRING([--with-ssl=DIR],[sets location of the SSL installation]),[ - ssl_dir=$withval - ]) -AC_ARG_WITH(ssl-inc,AC_HELP_STRING([--with-ssl-inc=DIR],[sets location of the SSL include files]),[ - ssl_inc_dir=$withval - ]) -AC_ARG_WITH(ssl-lib,AC_HELP_STRING([--with-ssl-lib=DIR], [sets location of the SSL libraries]),[ - ssl_lib_dir=$withval - ]) -AC_ARG_WITH(kerberos-inc,AC_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; 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; do - ssllibdir="$dir" - if test -f "$dir/libssl.so"; 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) - 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) - 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 - - + # need_dh should only be set for NRPE and NDOUTILS + need_dh=yes + AC_NAGIOS_GET_SSL fi + USE_NANOSLEEP=yes AC_ARG_ENABLE(nanosleep,AC_HELP_STRING([--enable-nanosleep],[enables use of nanosleep (instead of sleep) in event timing])) AS_IF([test x$enable_nanosleep = xno],[USE_NANOSLEEP=no],[USE_NANOSLEEP=yes]) @@ -427,13 +323,38 @@ if test x$USE_NANOSLEEP = xyes ; then AC_DEFINE_UNQUOTED(USE_NANOSLEEP) fi -AC_OUTPUT(Makefile src/Makefile docs/docbook/en-en/Makefile subst) +AC_CONFIG_FILES([Makefile + src/Makefile + uninstall + config/ndo2db.cfg-sample + config/ndomod.cfg-sample + config/nagios.cfg + config/misccommands.cfg + docs/docbook/en-en/Makefile + include/io.h + 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 +]) + +AC_OUTPUT() -$PERL subst daemon-init -$PERL subst config/ndo2db.cfg-sample -$PERL subst config/ndomod.cfg-sample -$PERL subst config/nagios.cfg -$PERL subst config/misccommands.cfg dnl Review options echo "" diff --git a/daemon-init.in b/daemon-init.in deleted file mode 100755 index 1996b89..0000000 --- a/daemon-init.in +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: ndo2db -# Required-Start: -# Required-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Nagios NDO2DB Initscript -# Description: Nagios Data Out Daemon -### END INIT INFO - -# chkconfig: 345 99 01 -# -# File : ndo2db -# -# Author : Jorge Sanchez Aymar (jsanchez@lanchile.cl) -# -# Changelog : -# -# 1999-07-09 Karl DeBisschop -# - setup for autoconf -# - add reload function -# 1999-08-06 Ethan Galstad -# - Added configuration info for use with RedHat's chkconfig tool -# per Fran Boon's suggestion -# 1999-08-13 Jim Popovitch -# - added variable for nagios/var directory -# - cd into nagios/var directory before creating tmp files on startup -# 1999-08-16 Ethan Galstad -# - Added test for rc.d directory as suggested by Karl DeBisschop -# 2000-07-23 Karl DeBisschop -# - Clean out redhat macros and other dependencies -# 2003-01-11 Ethan Galstad -# - Updated su syntax (Gary Miller) -# 2009-07-11 Hendrik Bäcker -# - Rewrite ndo2db init script, inspired by Sascha Runschke -# -# - -status_ndo2db () -{ - - pid_ndo2db - - if ps -p $Ndo2dbPID > /dev/null 2>&1; then - return 0 - else - if test -f $Ndo2dbLockDir/$Ndo2dbLockFile; then - return 2 - else - return 1 - fi - fi - - return 1 -} - -printstatus_ndo2db() -{ - if status_ndo2db $1 $2; then - echo "$servicename (pid $Ndo2dbPID) is running..." - elif test $? == 2; then - echo "$servicename is not running but subsystem locked" - else - echo "$servicename is not running" - fi -} - - -killproc_ndo2db () -{ - - kill $2 $Ndo2dbPID - -} - - -pid_ndo2db () -{ - - if test ! -f $Ndo2dbRunFile; then - return 1 - fi - - Ndo2dbPID=`head -n 1 $Ndo2dbRunFile` - return 0 -} - - -# Source function library -# Solaris doesn't have an rc.d directory, so do a test first -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 -fi - -servicename=ndo2db -prefix=@prefix@ -exec_prefix=${prefix} -Ndo2dbBin=@bindir@/ndo2db -Ndo2dbCfgFile=@sysconfdir@/ndo2db.cfg -Ndo2dbVarDir=@localstatedir@ -Ndo2dbRunFile=$Ndo2dbVarDir/ndo2db.lock -Ndo2dbLockDir=/var/lock/subsys -Ndo2dbLockFile=ndo2db -Ndo2dbUser=nagios -Ndo2dbGroup=nagios - - -# Check that ndo2db exists. -if [ ! -f $Ndo2dbBin ]; then - echo "Executable file $Ndo2dbBin not found. Exiting." - exit 1 -fi - -# Check that ndo2db.cfg exists. -if [ ! -f $Ndo2dbCfgFile ]; then - echo "Configuration file $Ndo2dbCfgFile not found. Exiting." - exit 1 -fi - -# See how we were called. -case "$1" in - - start) - status_ndo2db - if [ $? -eq 0 ]; then - echo "$servicename already started..." - exit 1 - fi - echo -n "Starting $servicename:" - touch $Ndo2dbRunFile - chown $Ndo2dbUser:$Ndo2dbGroup $Ndo2dbRunFile - $Ndo2dbBin -c $Ndo2dbCfgFile - if [ -d $Ndo2dbLockDir ]; then touch $Ndo2dbLockDir/$Ndo2dbLockFile; fi - echo " done." - exit 0 - ;; - - stop) - status_ndo2db - if ! [ $? -eq 0 ]; then - echo "$servicename was not running... could not stop" - exit 1 - fi - echo -n "Stopping $servicename: " - - pid_ndo2db - killproc_ndo2db ndo2db - - # now we have to wait for ndo2db to exit and remove its - # own Ndo2dbRunFile, otherwise a following "start" could - # happen, and then the exiting ndo2db will remove the - # new Ndo2dbRunFile, allowing multiple ndo2db daemons - # to (sooner or later) run - John Sellens - #echo -n 'Waiting for ndo2db to exit .' - for i in 1 2 3 4 5 6 7 8 9 10 ; do - if status_ndo2db > /dev/null 2>&1; then - echo -n '.' - sleep 1 - else - break - fi - done - if status_ndo2db > /dev/null 2>&1; then - echo '' - echo 'Warning - $servicename did not exit in a timely manner' - else - echo 'done.' - fi - - rm -f $Ndo2dbStatusFile $Ndo2dbRunFile $Ndo2dbLockDir/$Ndo2dbLockFile $Ndo2dbCommandFile - ;; - - status) - printstatus_ndo2db - ;; - - restart) - $0 stop - $0 start - ;; - - *) - echo "Usage: $servicename {start|stop|restart|status}" - exit 1 - ;; - -esac - -# End of this script diff --git a/include/io.h b/include/io.h.in similarity index 94% rename from include/io.h rename to include/io.h.in index e35cdec..888fd5b 100644 --- a/include/io.h +++ b/include/io.h.in @@ -17,7 +17,7 @@ #define NDO_SINK_UNIXSOCKET 2 #define NDO_SINK_TCPSOCKET 3 -#define NDO_DEFAULT_TCP_PORT 5668 +#define NDO_DEFAULT_TCP_PORT @ndo2db_port@ /* default port to use */ /* MMAPFILE structure - used for reading files via mmap() */ diff --git a/subst.in b/subst.in deleted file mode 100755 index fef0ddd..0000000 --- a/subst.in +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/perl -w - -my ${exec_prefix}; -my ${prefix}; -my ${datarootdir}; - -${prefix}="@prefix@"; -${exec_prefix}="@exec_prefix@"; -${datarootdir}="@datarootdir@"; -while ($f = shift @ARGV) { - - if (-x "/bin/mktemp") { - $TEMP = `/bin/mktemp $f.$$.XXXXXX`; - die 'Cannot make temporary file $TEMP' if($?); - chomp $TEMP; - } else { - $XXXXXX = rand; - $TEMP = "$f.$$.$XXXXXX"; - } - - open(IN,"<$f.in"); - open(OUT,">$TEMP") || die 'Cannot make temporary file $TEMP'; - - while () { - s|\@ndo2db_user\@|@ndo2db_user@|g; - s|\@ndo2db_group\@|@ndo2db_group@|g; - s|\@libexecdir\@|@libexecdir@|g; # put all --with-vars before directories - s|\@localstatedir\@|@localstatedir@|g; - s|\@sysconfdir\@|@sysconfdir@|g; - s|\@datarootdir\@|@datarootdir@|g; - s|\@datadir\@|@datadir@|g; - s|\@sbindir\@|@sbindir@|g; - s|\@bindir\@|@bindir@|g; - s|\$\{exec_prefix\}|@exec_prefix@|g; # must be next to last - s|\$\{prefix\}|@prefix@|g; # must be last - s|\@prefix\@|@prefix@|g; - print OUT $_; - } - - close IN; - close OUT; - - if ((! -e $f) || (`diff $f $TEMP`)) { - `mv $TEMP $f`; - } else { - unlink $TEMP; - } - -} From 4810f6da752e57ff282b65d4d629caf8cabe77b9 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 22 Jul 2016 13:04:04 -0500 Subject: [PATCH 29/73] Update .gitignore --- .gitignore | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index e62c240..93d3131 100644 --- a/.gitignore +++ b/.gitignore @@ -2,12 +2,19 @@ autom4te.cache Makefile config.log config.status -daemon-init +uninstall + include/config.h include/dh.h -src/Makefile -subst +include/io.h + +config/*.cfg +config/*.cfg-sample + +nbproject/ CVS/ + +src/Makefile src/*.o src/file2sock src/log2ndo @@ -15,6 +22,23 @@ src/ndo2db-2x src/ndo2db-3x src/ndo2db-4x src/sockdebug -config/*.cfg -config/*.cfg-sample -nbproject/ + +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-inetd.plist +startup/mac-init.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 From 2e988ea1677b6d1b3133538ee6ec246b87e4e5c3 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 22 Jul 2016 13:05:26 -0500 Subject: [PATCH 30/73] Added --no-forking (-f) arg to prevent forking under certain init systems, such as systemd --- src/ndo2db.c | 94 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 40 deletions(-) diff --git a/src/ndo2db.c b/src/ndo2db.c index a84cc88..013ea60 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -56,6 +56,7 @@ int ndo2db_socket_type=NDO_SINK_UNIXSOCKET; char *ndo2db_socket_name=NULL; int ndo2db_tcp_port=NDO_DEFAULT_TCP_PORT; int ndo2db_use_inetd=NDO_FALSE; +int ndo2db_no_fork=NDO_FALSE; int ndo2db_show_version=NDO_FALSE; int ndo2db_show_license=NDO_FALSE; int ndo2db_show_help=NDO_FALSE; @@ -120,9 +121,10 @@ int main(int argc, char **argv){ printf("and processing. Clients that are capable of sending data to the NDO2DB daemon\n"); printf("include the LOG2NDO utility and NDOMOD event broker module.\n"); printf("\n"); - printf("Usage: %s -c [-i]\n",argv[0]); + printf("Usage: %s -c [-i] [-f]\n",argv[0]); printf("\n"); printf("-i = Run under INETD/XINETD.\n"); + printf("-f = Do not fork daemon.\n"); printf("\n"); exit(1); } @@ -271,6 +273,7 @@ int ndo2db_process_arguments(int argc, char **argv){ static struct option long_options[]={ {"configfile", required_argument, 0, 'c'}, {"inetd", no_argument, 0, 'i'}, + {"no-forking", no_argument, 0, 'f'}, {"help", no_argument, 0, 'h'}, {"license", no_argument, 0, 'l'}, {"version", no_argument, 0, 'V'}, @@ -314,6 +317,10 @@ int ndo2db_process_arguments(int argc, char **argv){ case 'i': ndo2db_use_inetd=NDO_TRUE; break; + case 'f': + ndo2db_use_inetd=NDO_FALSE; + ndo2db_no_fork=NDO_TRUE; + break; default: return NDO_ERROR; break; @@ -708,62 +715,69 @@ int ndo2db_daemonize(void){ } } - /* fork */ - if((pid=fork())<0){ - perror("Fork error"); - ndo2db_cleanup_socket(); - return NDO_ERROR; - } - - /* parent process goes away... */ - else if((int)pid!=0){ - ndo2db_free_program_memory(); - waitpid(pid, NULL, 0); /* Wait for the updated lock file. */ - exit(0); - } - - /* child forks again... */ - else{ + /* fork (maybe) */ + if(ndo2db_no_fork == NDO_TRUE) { if((pid=fork())<0){ perror("Fork error"); ndo2db_cleanup_socket(); return NDO_ERROR; - } + } - /* first child process goes away.. */ + /* parent process goes away... */ else if((int)pid!=0){ ndo2db_free_program_memory(); - /* Write the grandchild PID to the lock file... */ - if (lock_file) { - int n; - lseek(lockfile, 0, SEEK_SET); - if (ftruncate(lockfile, 0)) { - syslog(LOG_ERR, "Warning: Unable to truncate lockfile (errno %d): %s", - errno, strerror(errno)); - } - sprintf(buf, "%d\n", (int)pid); - n = (int)strlen(buf); - if (write(lockfile, buf, n) < n) { - syslog(LOG_ERR, "Warning: Unable to write pid to lockfile (errno %d): %s", - errno, strerror(errno)); - } - } + waitpid(pid, NULL, 0); /* Wait for the updated lock file. */ exit(0); + } + + /* child forks again... */ + else{ + + if((pid=fork())<0){ + perror("Fork error"); + ndo2db_cleanup_socket(); + return NDO_ERROR; + } + + /* first child process goes away.. */ + else if((int)pid!=0){ + ndo2db_free_program_memory(); + exit(0); + } } - /* grandchild continues... */ - /* grandchild becomes session leader... */ - setsid(); - } - if(lock_file){ + + } + + /* Write the PID to the lock file... */ + + if (lock_file) { + int n; + lseek(lockfile, 0, SEEK_SET); + if (ftruncate(lockfile, 0)) { + syslog(LOG_ERR, "Warning: Unable to truncate lockfile (errno %d): %s", + errno, strerror(errno)); + } + sprintf(buf, "%d\n", (int)pid); + n = (int)strlen(buf); + if (write(lockfile, buf, n) < n) { + syslog(LOG_ERR, "Warning: Unable to write pid to lockfile (errno %d): %s", + errno, strerror(errno)); + } + } + + /* become session leader... */ + setsid(); + + if(lock_file) { /* make sure lock file stays open while program is executing... */ val=fcntl(lockfile,F_GETFD,0); val|=FD_CLOEXEC; fcntl(lockfile,F_SETFD,val); - } + } /* close existing stdin, stdout, stderr */ close(0); From fce17afc3ad990a0f2f9ea1333103f8c29617299 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 22 Jul 2016 13:06:30 -0500 Subject: [PATCH 31/73] Changes to startup scripts --- startup/bsd-init.in | 2 +- startup/default-inetd.in | 4 ++-- startup/default-init.in | 2 +- startup/default-socket-svc.in | 2 +- startup/default-xinetd.in | 2 +- startup/newbsd-init.in | 2 +- startup/openrc-conf.in | 5 +---- startup/openrc-init.in | 2 +- startup/solaris-init.xml.in | 2 +- 9 files changed, 10 insertions(+), 13 deletions(-) diff --git a/startup/bsd-init.in b/startup/bsd-init.in index 538674a..1045133 100644 --- a/startup/bsd-init.in +++ b/startup/bsd-init.in @@ -14,7 +14,7 @@ ndo2db_start() { if [ ! -d "$PID_DIR" ]; then mkdir -p "$PID_DIR" fi - $NDO2DB_BIN -c $NDO2DB_CFG -d + $NDO2DB_BIN -c $NDO2DB_CFG if [ $? = 0 ]; then echo "started" else diff --git a/startup/default-inetd.in b/startup/default-inetd.in index 8084db9..8ad5cea 100644 --- a/startup/default-inetd.in +++ b/startup/default-inetd.in @@ -1,5 +1,5 @@ # # Enable the following entry to enable the ndo2db daemon -#ndo2db stream tcp nowait @ndo2db_user@ @sbindir@/ndo2db ndo2db -c @pkgsysconfdir@/ndo2db.cfg --inetd +#ndo2db stream tcp nowait @ndo2db_user@ @sbindir@/ndo2db ndo2db -c @pkgsysconfdir@/ndo2db.cfg -i # Enable the following entry if the ndo2db daemon didn't link with libwrap -#ndo2db stream tcp nowait @ndo2db_user@ /usr/sbin/tcpd @sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg --inetd +#ndo2db stream tcp nowait @ndo2db_user@ /usr/sbin/tcpd @sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -i diff --git a/startup/default-init.in b/startup/default-init.in index 9ad062e..5521381 100644 --- a/startup/default-init.in +++ b/startup/default-init.in @@ -89,7 +89,7 @@ case "$1" in start) # Start daemons. $MSG_CMD "Starting ndo2db " - $START_CMD $NDO2DB_BIN -c $NDO2DB_CFG -d + $START_CMD $NDO2DB_BIN -c $NDO2DB_CFG RETVAL=$? if test "$PRT_STAT" = log_end_msg; then $PRT_STAT $RETVAL diff --git a/startup/default-socket-svc.in b/startup/default-socket-svc.in index d8abd34..cd1a507 100644 --- a/startup/default-socket-svc.in +++ b/startup/default-socket-svc.in @@ -5,7 +5,7 @@ After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.t [Service] Restart=on-failure -ExecStart=@sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg --inetd +ExecStart=@sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -i KillMode=process User=@ndo2db_user@ Group=@ndo2db_group@ diff --git a/startup/default-xinetd.in b/startup/default-xinetd.in index 92facc4..c395ee1 100644 --- a/startup/default-xinetd.in +++ b/startup/default-xinetd.in @@ -9,7 +9,7 @@ service ndo2db user = @ndo2db_user@ group = @ndo2db_group@ server = @sbindir@/ndo2db - server_args = -c @pkgsysconfdir@/ndo2db.cfg --inetd + server_args = -c @pkgsysconfdir@/ndo2db.cfg -i only_from = 127.0.0.1 log_on_failure += USERID } diff --git a/startup/newbsd-init.in b/startup/newbsd-init.in index af2e2c1..d5095ba 100644 --- a/startup/newbsd-init.in +++ b/startup/newbsd-init.in @@ -13,7 +13,7 @@ name=ndo2db command="@sbindir@/ndo2db" -command_args="-c $ndo2db_configfile -d" +command_args="-c $ndo2db_configfile" pidfile="@piddir@/ndo2db.pid" extra_commands=reload sig_reload=HUP diff --git a/startup/openrc-conf.in b/startup/openrc-conf.in index 8253fbb..d7b5474 100644 --- a/startup/openrc-conf.in +++ b/startup/openrc-conf.in @@ -1,7 +1,4 @@ # /etc/conf.d/ndo2db : config file for /etc/init.d/ndo2db # Configuration file - default is @sysconfdir@/ndo2db.cfg -NDO2DB_CFG="@pgksysconfdir@/ndo2db.cfg" - -# Any additional ndo2db options (-n -4 -6) -NDO2DB_OPTS="" +NDO2DB_CFG="@pkgsysconfdir@/ndo2db.cfg" diff --git a/startup/openrc-init.in b/startup/openrc-init.in index 6ddf399..119e074 100644 --- a/startup/openrc-init.in +++ b/startup/openrc-init.in @@ -28,7 +28,7 @@ start() { # Make sure we have a sane current directory cd / start-stop-daemon --start --exec $NDO2DB_BIN --pidfile $PID_FILE \ - -- -c $NDO2DB_CFG -f $NDO2DB_OPTS + -- -c $NDO2DB_CFG -f eend $? } diff --git a/startup/solaris-init.xml.in b/startup/solaris-init.xml.in index 5192a9b..80c4c01 100644 --- a/startup/solaris-init.xml.in +++ b/startup/solaris-init.xml.in @@ -89,7 +89,7 @@ From 9b3abc00f42d8177ad2322376d57080dd1ca449d Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 22 Jul 2016 13:07:27 -0500 Subject: [PATCH 32/73] A few minor changes --- configure | 2467 +++++++++++++++++++++++++++++++++++++++-------- configure.ac | 11 +- src/Makefile.in | 2 - 3 files changed, 2048 insertions(+), 432 deletions(-) diff --git a/configure b/configure index f713dce..fefa93d 100755 --- a/configure +++ b/configure @@ -622,6 +622,12 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS +sslbin +PKG_CONFIG +SSL_LIB_DIR +SSL_INC_PREFIX +SSL_HDR +SSL_INC_DIR HAVE_SSL INSTALL_OPTS ndo2db_group @@ -632,13 +638,41 @@ DBCFLAGS np_mysql_config MOD_LDFLAGS MOD_CFLAGS -init_dir +ndo2db_port LIBWRAPLIBS SOCKETLIBS -OTHERLIBS EGREP GREP CPP +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 SET_MAKE OBJEXT EXEEXT @@ -701,7 +735,23 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking -with_init_dir +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 +with_ndo2db_port enable_mysql with_mysql with_ndo2db_user @@ -1334,6 +1384,18 @@ 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-mysql enables MySQL database support --enable-systemd-sockets enables systemd socket activation @@ -1344,7 +1406,28 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-init-dir= sets directory to place init script into + --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-ndo2db-port= + sets port number for NDO2DB to listen on --with-mysql=DIR Locates mysql libraries. Expects DIR/bin/mysql_config. Default to search for mysql_config in PATH @@ -1919,6 +2002,52 @@ rm -f conftest.val } # ac_fn_c_compute_int +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + 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>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 @@ -3396,216 +3525,1468 @@ fi -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 -{ $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 ${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" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - done - ac_cv_prog_CPP=$CPP +# +# 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 -fi - CPP=$ac_cv_prog_CPP else - ac_cv_prog_CPP=$CPP -fi -{ $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 - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext + # + # Run this if --with was not specified + # + opsys_wanted=yes - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break fi -rm -f conftest.err conftest.i conftest.$ac_ext -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : -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 $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi + 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 -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 + # + # 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}: 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 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 - # 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 + { $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 - $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 - ac_cv_path_GREP=$GREP -fi + + # + # Run this if --with was not specified + # + dist_type_wanted=yes 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 + 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 + + + # Does this package need to know: +need_cgi=no # where the cgi-bin directory is +need_web=no # where the website directory is +need_brk=no # where the event broker modules directory is +need_plg=no # where the plugins directory is +need_pipe=no # where the pipe directory is +need_spl=no # where the spool directory is +need_loc=no # where the locale directory is +need_log_subdir=no # where the loc sub-directory is +need_etc_subdir=no # where the etc sub-directory is +need_pls_dir=no # where the package locate state directory is + +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_brk=yes + 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; } + + + + +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 +{ $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 ${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" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $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 + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +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 $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +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 + + +{ $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 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 + # 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_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 + 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 @@ -4296,145 +5677,48 @@ if test "$ac_cv_type_u_int32_t" = no ; then else if test "$ac_cv_sizeof_long" = 4 ; then $as_echo "#define U_INT32_T_IS_ULONG 1" >>confdefs.h - - else - if test "$ac_cv_sizeof_short" = 4 ; then - $as_echo "#define U_INT32_T_IS_USHORT 1" >>confdefs.h - - fi - fi - fi - fi -fi - -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 : - -else - -cat >>confdefs.h <<_ACEOF -#define int32_t int -_ACEOF - -fi - -if test "$ac_cv_type_int32_t" = no ; then - if test "$ac_cv_sizeof_int" = 4 ; then - $as_echo "#define INT32_T_IS_UINT 1" >>confdefs.h - - else - if test "$ac_cv_sizeof_long" = 4 ; then - $as_echo "#define INT32_T_IS_ULONG 1" >>confdefs.h - - else - if test "$ac_cv_sizeof_short" = 4 ; then - $as_echo "#define INT32_T_IS_USHORT 1" >>confdefs.h - - fi - fi - fi -fi - - -for ac_func in getopt_long -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 HAVE_GETOPT_LONG 1 -_ACEOF - -else - { $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" - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - 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>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 -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* 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 getopt_long (); -int -main () -{ -return getopt_long (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_iberty_getopt_long=yes -else - ac_cv_lib_iberty_getopt_long=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + + else + if test "$ac_cv_sizeof_short" = 4 ; then + $as_echo "#define U_INT32_T_IS_USHORT 1" >>confdefs.h + + fi + fi + fi + fi fi -{ $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" + +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 : + +else + +cat >>confdefs.h <<_ACEOF +#define int32_t int +_ACEOF + fi +if test "$ac_cv_type_int32_t" = no ; then + if test "$ac_cv_sizeof_int" = 4 ; then + $as_echo "#define INT32_T_IS_UINT 1" >>confdefs.h + + else + if test "$ac_cv_sizeof_long" = 4 ; then + $as_echo "#define INT32_T_IS_ULONG 1" >>confdefs.h + + else + if test "$ac_cv_sizeof_short" = 4 ; then + $as_echo "#define INT32_T_IS_USHORT 1" >>confdefs.h + + fi + fi + fi fi -done +# AC_CHECK_FUNCS([getopt_long],,AC_CHECK_LIB([iberty],[getopt_long],OTHERLIBS="$OTHERLIBS -liberty")) +# AC_SUBST(OTHERLIBS) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5 $as_echo_n "checking for main in -lnsl... " >&6; } @@ -4550,7 +5834,7 @@ if test "x$ac_cv_lib_wrap_main" = xyes; then : fi -for ac_func in strdup strstr strtoul initgroups strtof +for ac_func in getopt_long strdup strstr strtoul initgroups strtof 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" @@ -4625,12 +5909,19 @@ elif test -d /sbin/init.d; then fi -# Check whether --with-init_dir was given. -if test "${with_init_dir+set}" = set; then : - withval=$with_init_dir; init_dir=$withval +# Check whether --with-ndo2db_port was given. +if test "${with_ndo2db_port+set}" = set; then : + withval=$with_ndo2db_port; ndo2db_port=$withval +else + ndo2db_port=5668 fi +cat >>confdefs.h <<_ACEOF +#define DEFAULT_SERVER_PORT $ndo2db_port +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker flags for loadable modules" >&5 $as_echo_n "checking for linker flags for loadable modules... " >&6; } @@ -4987,144 +6278,448 @@ else fi +if test x$check_for_ssl = xyes; then + # need_dh should only be set for NRPE and NDOUTILS + 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= + + + + + + + + +# 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 - + 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 - + 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 + 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 + 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 -fi +# Check for SSL support + +if test x$SSL_TYPE != xNONE; then -if test x$check_for_ssl = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL headers" >&5 -$as_echo_n "checking for SSL headers... " >&6; } 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; 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 + + # 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 /usr/include/krb5 \ + /usr/include; do + kerbdir="$dir" + if test -f "$dir/krb5.h"; then + found_kerberos=yes + CFLAGS="$CFLAGS -I$kerbdir" + +cat >>confdefs.h <<_ACEOF +#define HAVE_KRB5_H 1 +_ACEOF + + break fi done - if test x_$found_ssl != x_yes; then - as_fn_error $? "Cannot find ssl headers" "$LINENO" 5 + if test x_$found_kerberos != x_yes; then + { $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 + { $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 - printf "SSL headers found in $ssldir\n"; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL libraries" >&5 -$as_echo_n "checking for SSL libraries... " >&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; do - ssllibdir="$dir" - if test -f "$dir/libssl.so"; then +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 - break + 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 libraries" "$LINENO" 5 + as_fn_error $? "Cannot find ssl headers" "$LINENO" 5 else - printf "SSL libraries found in $ssllibdir\n"; - - LDFLAGS="$LDFLAGS -L$ssllibdir"; - LIBS="$LIBS -lssl -lcrypto"; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 +$as_echo "found in $ssldir" >&6; } - cat >>confdefs.h <<_ACEOF -#define HAVE_SSL 1 -_ACEOF + # 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 - echo "" - echo "*** Generating DH Parameters for SSL/TLS ***" - if test -f "$ssldir/sbin/openssl"; then - sslbin=$ssldir/sbin/openssl + if test x_$found_ssl != x_yes; then + as_fn_error $? "Cannot find ssl libraries" "$LINENO" 5 else - sslbin=$ssldir/bin/openssl + { $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 - # awk to strip off meta data at bottom of dhparam output - $sslbin dhparam -C 512 | awk '/^-----/ {exit} {print}' > include/dh.h fi fi - { $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 - kerbdir="$dir" - if test -f "$dir/krb5.h"; then - found_kerberos=yes - CFLAGS="$CFLAGS -I$kerbdir" - cat >>confdefs.h <<_ACEOF -#define HAVE_KRB5_H 1 + 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 : - break - fi - done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } - if test x_$found_kerberos != x_yes; then - printf "could not find include files\n"; - else - printf "found Kerberos include files in $kerbdir\n"; + +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" -a ! -f include/dh.h; 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 + + USE_NANOSLEEP=yes # Check whether --enable-nanosleep was given. if test "${enable_nanosleep+set}" = set; then : @@ -5143,7 +6738,8 @@ _ACEOF fi -ac_config_files="$ac_config_files Makefile src/Makefile docs/docbook/en-en/Makefile subst" +ac_config_files="$ac_config_files Makefile src/Makefile uninstall config/ndo2db.cfg-sample config/ndomod.cfg-sample config/nagios.cfg config/misccommands.cfg docs/docbook/en-en/Makefile include/io.h 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" + @@ -5754,8 +7350,32 @@ do "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "uninstall") CONFIG_FILES="$CONFIG_FILES uninstall" ;; + "config/ndo2db.cfg-sample") CONFIG_FILES="$CONFIG_FILES config/ndo2db.cfg-sample" ;; + "config/ndomod.cfg-sample") CONFIG_FILES="$CONFIG_FILES config/ndomod.cfg-sample" ;; + "config/nagios.cfg") CONFIG_FILES="$CONFIG_FILES config/nagios.cfg" ;; + "config/misccommands.cfg") CONFIG_FILES="$CONFIG_FILES config/misccommands.cfg" ;; "docs/docbook/en-en/Makefile") CONFIG_FILES="$CONFIG_FILES docs/docbook/en-en/Makefile" ;; - "subst") CONFIG_FILES="$CONFIG_FILES subst" ;; + "include/io.h") CONFIG_FILES="$CONFIG_FILES include/io.h" ;; + "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" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -6343,11 +7963,6 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi -$PERL subst daemon-init -$PERL subst config/ndo2db.cfg-sample -$PERL subst config/ndomod.cfg-sample -$PERL subst config/nagios.cfg -$PERL subst config/misccommands.cfg echo "" echo "" @@ -6358,10 +7973,12 @@ echo "" echo " General Options:" echo " -------------------------" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NDO2DB user: $ndo2db_user" >&5 -$as_echo " NDO2DB user: $ndo2db_user" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NDO2DB group: $ndo2db_group" >&5 -$as_echo " NDO2DB group: $ndo2db_group" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NDO2DB user: $ndo2db_user" >&5 +$as_echo " NDO2DB user: $ndo2db_user" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NDO2DB group: $ndo2db_group" >&5 +$as_echo " NDO2DB group: $ndo2db_group" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NDO2DB tcp port: $ndo2db_port" >&5 +$as_echo " NDO2DB tcp port: $ndo2db_port" >&6; } echo "" diff --git a/configure.ac b/configure.ac index b2565d4..634eadf 100644 --- a/configure.ac +++ b/configure.ac @@ -97,8 +97,8 @@ fi dnl Check for getopt_long (Solaris) -AC_CHECK_FUNCS([getopt_long],,AC_CHECK_LIB([iberty],[getopt_long],OTHERLIBS="$OTHERLIBS -liberty")) -AC_SUBST(OTHERLIBS) +# 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") @@ -109,7 +109,7 @@ AC_CHECK_LIB(wrap,main,[ AC_DEFINE(HAVE_LIBWRAP) ]) AC_SUBST(LIBWRAPLIBS) -AC_CHECK_FUNCS(strdup strstr strtoul initgroups strtof) +AC_CHECK_FUNCS(getopt_long strdup strstr strtoul initgroups strtof) AC_MSG_CHECKING(for type of socket size) AC_TRY_COMPILE([#include @@ -365,8 +365,9 @@ echo "" echo " General Options:" echo " -------------------------" -AC_MSG_RESULT([ NDO2DB user: $ndo2db_user]) -AC_MSG_RESULT([ NDO2DB group: $ndo2db_group]) +AC_MSG_RESULT([ NDO2DB user: $ndo2db_user]) +AC_MSG_RESULT([ NDO2DB group: $ndo2db_group]) +AC_MSG_RESULT([ NDO2DB tcp port: $ndo2db_port]) echo "" diff --git a/src/Makefile.in b/src/Makefile.in index e0a251e..f7a917a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -48,8 +48,6 @@ NDO_INC=$(SRC_INCLUDE)/ndo2db.h $(SRC_INCLUDE)/db.h $(SRC_INCLUDE)/queue.h NDO_SRC=db.c NDO_OBJS=db.o -CP=@CP@ - all: file2sock log2ndo ndo2db ndomod sockdebug From 2442fa470a92c24d65a693a5ac4ef5eae73aa563 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Mon, 25 Jul 2016 09:07:03 -0500 Subject: [PATCH 33/73] Cross-platform and SSL changes --- configure.ac | 1 + include/{common.h => common.h.in} | 4 +++- include/config.h.in | 9 --------- include/nagios-4x/lib/libnagios.h | 2 +- include/nagios-4x/lib/squeue.h | 3 ++- src/io.c | 4 ++++ src/ndo2db.c | 6 +++++- 7 files changed, 16 insertions(+), 13 deletions(-) rename include/{common.h => common.h.in} (87%) diff --git a/configure.ac b/configure.ac index 634eadf..78a552f 100644 --- a/configure.ac +++ b/configure.ac @@ -332,6 +332,7 @@ AC_CONFIG_FILES([Makefile config/misccommands.cfg docs/docbook/en-en/Makefile include/io.h + include/common.h startup/bsd-init startup/debian-init startup/default-init diff --git a/include/common.h b/include/common.h.in similarity index 87% rename from include/common.h rename to include/common.h.in index b306edd..c644573 100644 --- a/include/common.h +++ b/include/common.h.in @@ -9,7 +9,9 @@ #ifndef NDO_COMMON_H_INCLUDED #define NDO_COMMON_H_INCLUDED - +#ifdef HAVE_SSL +#include <@SSL_INC_PREFIX@@SSL_HDR@> +#endif #define NDO_TRUE 1 #define NDO_FALSE 0 diff --git a/include/config.h.in b/include/config.h.in index 1e81bda..a55ff62 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -271,15 +271,6 @@ typedef int int32_t; #undef HAVE_SYSTEMD #undef HAVE_SSL -#ifdef HAVE_SSL -#include -#include -#include -#include -#include -#include -#include -#endif #undef USE_NANOSLEEP diff --git a/include/nagios-4x/lib/libnagios.h b/include/nagios-4x/lib/libnagios.h index a00dfe3..87ada08 100644 --- a/include/nagios-4x/lib/libnagios.h +++ b/include/nagios-4x/lib/libnagios.h @@ -9,7 +9,7 @@ #include "lnag-utils.h" #include "fanout.h" #include "nsutils.h" -#include "pqueue.h" +/* #include "pqueue.h" */ #include "squeue.h" #include "kvvec.h" #include "iobroker.h" diff --git a/include/nagios-4x/lib/squeue.h b/include/nagios-4x/lib/squeue.h index 9819c03..585b30a 100644 --- a/include/nagios-4x/lib/squeue.h +++ b/include/nagios-4x/lib/squeue.h @@ -2,7 +2,7 @@ #define LIBNAGIOS_SQUEUE_H_INCLUDED #include #include -#include "pqueue.h" +/* #include "pqueue.h" */ /** * @file squeue.h * @brief Scheduling queue function declarations @@ -21,6 +21,7 @@ * The pqueue library can be useful on its own though, so we * don't block that from user view. */ +typedef pqueue pqueue_t; typedef pqueue_t squeue_t; struct squeue_event; typedef struct squeue_event squeue_event; diff --git a/src/io.c b/src/io.c index 28388af..44d4b1c 100644 --- a/src/io.c +++ b/src/io.c @@ -13,7 +13,11 @@ #include "../include/io.h" #ifdef HAVE_SSL +# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux) SSL_METHOD *meth; +# else +const SSL_METHOD *meth; +# endif SSL_CTX *ctx; SSL *ssl; #endif diff --git a/src/ndo2db.c b/src/ndo2db.c index 013ea60..39fa6e9 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -39,7 +39,11 @@ #define NDO2DB_DATE "12-02-2015" #ifdef HAVE_SSL +# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux) SSL_METHOD *meth; +# else +const SSL_METHOD *meth; +# endif SSL_CTX *ctx; int allow_weak_random_seed = NDO_FALSE; #endif @@ -175,7 +179,7 @@ int main(int argc, char **argv){ /* use anonymous DH ciphers */ SSL_CTX_set_cipher_list(ctx,"ADH"); - dh=get_dh512(); + dh=get_dh2048(); SSL_CTX_set_tmp_dh(ctx,dh); DH_free(dh); syslog(LOG_INFO,"INFO: SSL/TLS initialized. All network traffic will be encrypted."); From c7a74c9c63b8b42930e9cc9f266a112b7a0c97f4 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Mon, 25 Jul 2016 09:35:25 -0500 Subject: [PATCH 34/73] Cross-platform changes --- .gitignore | 1 + configure | 6 +++--- configure.ac | 1 - include/nagios-4x/lib/squeue.h | 3 +-- src/Makefile.in | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 93d3131..ca8e986 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ config.log config.status uninstall +include/common.h include/config.h include/dh.h include/io.h diff --git a/configure b/configure index fefa93d..a03a7a4 100755 --- a/configure +++ b/configure @@ -6707,7 +6707,7 @@ fi $as_echo "#define USE_SSL_DH 1" >>confdefs.h # Generate DH parameters - if test -f "$sslbin" -a ! -f include/dh.h; then + if test -f "$sslbin"; then echo "" echo "*** Generating DH Parameters for SSL/TLS ***" # awk to strip off meta data at bottom of dhparam output @@ -6738,7 +6738,7 @@ _ACEOF fi -ac_config_files="$ac_config_files Makefile src/Makefile uninstall config/ndo2db.cfg-sample config/ndomod.cfg-sample config/nagios.cfg config/misccommands.cfg docs/docbook/en-en/Makefile include/io.h 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" +ac_config_files="$ac_config_files Makefile src/Makefile config/ndo2db.cfg-sample config/ndomod.cfg-sample config/nagios.cfg config/misccommands.cfg docs/docbook/en-en/Makefile include/io.h include/common.h 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" @@ -7350,13 +7350,13 @@ do "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "uninstall") CONFIG_FILES="$CONFIG_FILES uninstall" ;; "config/ndo2db.cfg-sample") CONFIG_FILES="$CONFIG_FILES config/ndo2db.cfg-sample" ;; "config/ndomod.cfg-sample") CONFIG_FILES="$CONFIG_FILES config/ndomod.cfg-sample" ;; "config/nagios.cfg") CONFIG_FILES="$CONFIG_FILES config/nagios.cfg" ;; "config/misccommands.cfg") CONFIG_FILES="$CONFIG_FILES config/misccommands.cfg" ;; "docs/docbook/en-en/Makefile") CONFIG_FILES="$CONFIG_FILES docs/docbook/en-en/Makefile" ;; "include/io.h") CONFIG_FILES="$CONFIG_FILES include/io.h" ;; + "include/common.h") CONFIG_FILES="$CONFIG_FILES include/common.h" ;; "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" ;; diff --git a/configure.ac b/configure.ac index 78a552f..b40b6be 100644 --- a/configure.ac +++ b/configure.ac @@ -325,7 +325,6 @@ fi AC_CONFIG_FILES([Makefile src/Makefile - uninstall config/ndo2db.cfg-sample config/ndomod.cfg-sample config/nagios.cfg diff --git a/include/nagios-4x/lib/squeue.h b/include/nagios-4x/lib/squeue.h index 585b30a..9819c03 100644 --- a/include/nagios-4x/lib/squeue.h +++ b/include/nagios-4x/lib/squeue.h @@ -2,7 +2,7 @@ #define LIBNAGIOS_SQUEUE_H_INCLUDED #include #include -/* #include "pqueue.h" */ +#include "pqueue.h" /** * @file squeue.h * @brief Scheduling queue function declarations @@ -21,7 +21,6 @@ * The pqueue library can be useful on its own though, so we * don't block that from user view. */ -typedef pqueue pqueue_t; typedef pqueue_t squeue_t; struct squeue_event; typedef struct squeue_event squeue_event; diff --git a/src/Makefile.in b/src/Makefile.in index f7a917a..4973d60 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -38,7 +38,7 @@ DBCFLAGS=@DBCFLAGS@ DBLDFLAGS=@DBLDFLAGS@ DBLIBS=@DBLIBS@ MATHLIBS=-lm -OTHERLIBS=@OTHERLIBS@ +# OTHERLIBS=@OTHERLIBS@ COMMON_INC=$(SRC_INCLUDE)/config.h $(SRC_INCLUDE)/common.h $(SRC_INCLUDE)/io.h $(SRC_INCLUDE)/protoapi.h $(SRC_INCLUDE)/utils.h COMMON_SRC=io.c utils.c From f0af12d7ec03b2103edc06dfff885e91f8a06986 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Mon, 25 Jul 2016 10:14:48 -0500 Subject: [PATCH 35/73] Fixes for AIX compatibility --- configure | 83 +++ configure.ac | 22 + include/config.h.in | 4 +- src/snprintf.c | 1452 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1559 insertions(+), 2 deletions(-) create mode 100644 src/snprintf.c diff --git a/configure b/configure index a03a7a4..924af08 100755 --- a/configure +++ b/configure @@ -5847,6 +5847,89 @@ fi done +{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +va_list ap1,ap2; +int +main () +{ +va_copy(ap1,ap2); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_HAVE_VA_COPY=yes +else + ac_cv_HAVE_VA_COPY=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $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 + +$as_echo "#define HAVE_VA_COPY 1" >>confdefs.h + +else + { $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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + va_list ap1,ap2; +int +main () +{ +__va_copy(ap1,ap2); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_HAVE___VA_COPY=yes +else + ac_cv_HAVE___VA_COPY=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $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 + +$as_echo "#define HAVE___VA_COPY 1" >>confdefs.h + + fi +fi + +ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" +if test "x$ac_cv_func_snprintf" = xyes; then : + +else + SNPRINTF_O=./snprintf.o +fi + +ac_fn_c_check_func "$LINENO" "asprintf" "ac_cv_func_asprintf" +if test "x$ac_cv_func_asprintf" = xyes; then : + +else + SNPRINTF_O=./snprintf.o +fi + + { $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 diff --git a/configure.ac b/configure.ac index b40b6be..4ea26bd 100644 --- a/configure.ac +++ b/configure.ac @@ -111,6 +111,28 @@ AC_CHECK_LIB(wrap,main,[ AC_SUBST(LIBWRAPLIBS) AC_CHECK_FUNCS(getopt_long strdup strstr strtoul initgroups strtof) +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(snprintf,,SNPRINTF_O=./snprintf.o) +AC_CHECK_FUNC(asprintf,,SNPRINTF_O=./snprintf.o) + AC_MSG_CHECKING(for type of socket size) AC_TRY_COMPILE([#include #include diff --git a/include/config.h.in b/include/config.h.in index a55ff62..a46db49 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -257,8 +257,8 @@ typedef int int32_t; #undef HAVE_MYSQL #ifdef USE_MYSQL #define HAVE_MYSQL 1 -#include -#include +#include +#include #endif #undef USE_PGSQL diff --git a/src/snprintf.c b/src/snprintf.c new file mode 100644 index 0000000..ea33e85 --- /dev/null +++ b/src/snprintf.c @@ -0,0 +1,1452 @@ +/* + * NOTE: If you change this file, please merge it into rsync, samba, etc. + */ + +/* + * Copyright Patrick Powell 1995 + * This code is based on code written by Patrick Powell (papowell@astart.com) + * It may be used for any purpose as long as this notice remains intact + * on all source code distributions + */ + +/************************************************************** + * Original: + * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 + * A bombproof version of doprnt (dopr) included. + * Sigh. This sort of thing is always nasty do deal with. Note that + * the version here does not include floating point... + * + * snprintf() is used instead of sprintf() as it does limit checks + * for string length. This covers a nasty loophole. + * + * The other functions are there to prevent NULL pointers from + * causing nast effects. + * + * More Recently: + * Brandon Long 9/15/96 for mutt 0.43 + * This was ugly. It is still ugly. I opted out of floating point + * numbers, but the formatter understands just about everything + * from the normal C string format, at least as far as I can tell from + * the Solaris 2.5 printf(3S) man page. + * + * Brandon Long 10/22/97 for mutt 0.87.1 + * Ok, added some minimal floating point support, which means this + * probably requires libm on most operating systems. Don't yet + * support the exponent (e,E) and sigfig (g,G). Also, fmtint() + * was pretty badly broken, it just wasn't being exercised in ways + * which showed it, so that's been fixed. Also, formated the code + * to mutt conventions, and removed dead code left over from the + * original. Also, there is now a builtin-test, just compile with: + * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm + * and run snprintf for results. + * + * Thomas Roessler 01/27/98 for mutt 0.89i + * The PGP code was using unsigned hexadecimal formats. + * Unfortunately, unsigned formats simply didn't work. + * + * Michael Elkins 03/05/98 for mutt 0.90.8 + * The original code assumed that both snprintf() and vsnprintf() were + * missing. Some systems only have snprintf() but not vsnprintf(), so + * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF. + * + * Andrew Tridgell (tridge@samba.org) Oct 1998 + * fixed handling of %.0f + * added test for HAVE_LONG_DOUBLE + * + * tridge@samba.org, idra@samba.org, April 2001 + * got rid of fcvt code (twas buggy and made testing harder) + * added C99 semantics + * + * date: 2002/12/19 19:56:31; author: herb; state: Exp; lines: +2 -0 + * actually print args for %g and %e + * + * date: 2002/06/03 13:37:52; author: jmcd; state: Exp; lines: +8 -0 + * Since includes.h isn't included here, VA_COPY has to be defined here. I don't + * see any include file that is guaranteed to be here, so I'm defining it + * locally. Fixes AIX and Solaris builds. + * + * date: 2002/06/03 03:07:24; author: tridge; state: Exp; lines: +5 -13 + * put the ifdef for HAVE_VA_COPY in one place rather than in lots of + * functions + * + * date: 2002/05/17 14:51:22; author: jmcd; state: Exp; lines: +21 -4 + * Fix usage of va_list passed as an arg. Use __va_copy before using it + * when it exists. + * + * date: 2002/04/16 22:38:04; author: idra; state: Exp; lines: +20 -14 + * Fix incorrect zpadlen handling in fmtfp. + * Thanks to Ollie Oldham for spotting it. + * few mods to make it easier to compile the tests. + * addedd the "Ollie" test to the floating point ones. + * + * Martin Pool (mbp@samba.org) April 2003 + * Remove NO_CONFIG_H so that the test case can be built within a source + * tree with less trouble. + * Remove unnecessary SAFE_FREE() definition. + * + * Martin Pool (mbp@samba.org) May 2003 + * Put in a prototype for dummy_snprintf() to quiet compiler warnings. + * + * Move #endif to make sure VA_COPY, LDOUBLE, etc are defined even + * if the C library has some snprintf functions already. + * + * Darren Tucker (dtucker@zip.com.au) 2005 + * Fix bug allowing read overruns of the source string with "%.*s" + * Usually harmless unless the read runs outside the process' allocation + * (eg if your malloc does guard pages) in which case it will segfault. + * From OpenSSH. Also added test for same. + * + * Simo Sorce (idra@samba.org) Jan 2006 + * + * Add support for position independent parameters + * fix fmtstr now it conforms to sprintf wrt min.max + * + **************************************************************/ + +#ifndef NO_CONFIG_H +/* 08/13/2007 EG changed path to config.h to match NRPE distro */ +#include "../include/config.h" +#else +#define NULL 0 +#endif + +#ifdef TEST_SNPRINTF /* need math library headers for testing */ + +/* In test mode, we pretend that this system doesn't have any snprintf + * functions, regardless of what config.h says. */ +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# undef HAVE_C99_VSNPRINTF +# undef HAVE_ASPRINTF +# undef HAVE_VASPRINTF +# include +#endif /* TEST_SNPRINTF */ + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif +#ifdef HAVE_CTYPE_H +#include +#endif +#include +#include +#ifdef HAVE_STDLIB_H +#include +#endif + +#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) && defined(HAVE_C99_VSNPRINTF) +/* only include stdio.h if we are not re-defining snprintf or vsnprintf */ +#include + /* make the compiler happy with an empty file */ + void dummy_snprintf(void); + void dummy_snprintf(void) {} +#endif /* HAVE_SNPRINTF, etc */ + +#ifdef HAVE_LONG_DOUBLE +#define LDOUBLE long double +#else +#define LDOUBLE double +#endif + +#ifdef HAVE_LONG_LONG +#define LLONG long long +#else +#define LLONG long +#endif + +#ifndef VA_COPY +#ifdef HAVE_VA_COPY +#define VA_COPY(dest, src) va_copy(dest, src) +#else +#ifdef HAVE___VA_COPY +#define VA_COPY(dest, src) __va_copy(dest, src) +#else +#define VA_COPY(dest, src) (dest) = (src) +#endif +#endif + +/* + * dopr(): poor man's version of doprintf + */ + +/* format read states */ +#define DP_S_DEFAULT 0 +#define DP_S_FLAGS 1 +#define DP_S_MIN 2 +#define DP_S_DOT 3 +#define DP_S_MAX 4 +#define DP_S_MOD 5 +#define DP_S_CONV 6 +#define DP_S_DONE 7 + +/* format flags - Bits */ +#define DP_F_MINUS (1 << 0) +#define DP_F_PLUS (1 << 1) +#define DP_F_SPACE (1 << 2) +#define DP_F_NUM (1 << 3) +#define DP_F_ZERO (1 << 4) +#define DP_F_UP (1 << 5) +#define DP_F_UNSIGNED (1 << 6) + +/* Conversion Flags */ +#define DP_C_CHAR 1 +#define DP_C_SHORT 2 +#define DP_C_LONG 3 +#define DP_C_LDOUBLE 4 +#define DP_C_LLONG 5 + +/* Chunk types */ +#define CNK_FMT_STR 0 +#define CNK_INT 1 +#define CNK_OCTAL 2 +#define CNK_UINT 3 +#define CNK_HEX 4 +#define CNK_FLOAT 5 +#define CNK_CHAR 6 +#define CNK_STRING 7 +#define CNK_PTR 8 +#define CNK_NUM 9 +#define CNK_PRCNT 10 + +#define char_to_int(p) ((p)- '0') +#ifndef MAX +#define MAX(p,q) (((p) >= (q)) ? (p) : (q)) +#endif + +/* yes this really must be a ||. Don't muck with this (tridge) */ +#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF) + +struct pr_chunk { + int type; /* chunk type */ + int num; /* parameter number */ + int min; + int max; + int flags; + int cflags; + int start; + int len; + LLONG value; + LDOUBLE fvalue; + char *strvalue; + void *pnum; + struct pr_chunk *min_star; + struct pr_chunk *max_star; + struct pr_chunk *next; +}; + +struct pr_chunk_x { + struct pr_chunk **chunks; + int num; +}; + +static size_t dopr(char *buffer, size_t maxlen, const char *format, + va_list args_in); +static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, + char *value, int flags, int min, int max); +static void fmtint(char *buffer, size_t *currlen, size_t maxlen, + long value, int base, int min, int max, int flags); +static void fmtfp(char *buffer, size_t *currlen, size_t maxlen, + LDOUBLE fvalue, int min, int max, int flags); +static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c); +static struct pr_chunk *new_chunk(void); +static int add_cnk_list_entry(struct pr_chunk_x **list, + int max_num, struct pr_chunk *chunk); + +static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) +{ + char ch; + int state; + int pflag; + int pnum; + int pfirst; + size_t currlen; + va_list args; + const char *base; + struct pr_chunk *chunks = NULL; + struct pr_chunk *cnk = NULL; + struct pr_chunk_x *clist = NULL; + int max_pos; + size_t ret = (size_t)-1; + + VA_COPY(args, args_in); + + state = DP_S_DEFAULT; + pfirst = 1; + pflag = 0; + pnum = 0; + + max_pos = 0; + base = format; + ch = *format++; + + /* retrieve the string structure as chunks */ + while (state != DP_S_DONE) { + if (ch == '\0') + state = DP_S_DONE; + + switch(state) { + case DP_S_DEFAULT: + + if (cnk) { + cnk->next = new_chunk(); + cnk = cnk->next; + } else { + cnk = new_chunk(); + } + if (!cnk) goto done; + if (!chunks) chunks = cnk; + + if (ch == '%') { + state = DP_S_FLAGS; + ch = *format++; + } else { + cnk->type = CNK_FMT_STR; + cnk->start = format - base -1; + while ((ch != '\0') && (ch != '%')) ch = *format++; + cnk->len = format - base - cnk->start -1; + } + break; + case DP_S_FLAGS: + switch (ch) { + case '-': + cnk->flags |= DP_F_MINUS; + ch = *format++; + break; + case '+': + cnk->flags |= DP_F_PLUS; + ch = *format++; + break; + case ' ': + cnk->flags |= DP_F_SPACE; + ch = *format++; + break; + case '#': + cnk->flags |= DP_F_NUM; + ch = *format++; + break; + case '0': + cnk->flags |= DP_F_ZERO; + ch = *format++; + break; + case 'I': + /* internationalization not supported yet */ + ch = *format++; + break; + default: + state = DP_S_MIN; + break; + } + break; + case DP_S_MIN: + if (isdigit((unsigned char)ch)) { + cnk->min = 10 * cnk->min + char_to_int (ch); + ch = *format++; + } else if (ch == '$') { + if (!pfirst && !pflag) { + /* parameters must be all positioned or none */ + goto done; + } + if (pfirst) { + pfirst = 0; + pflag = 1; + } + if (cnk->min == 0) /* what ?? */ + goto done; + cnk->num = cnk->min; + cnk->min = 0; + ch = *format++; + } else if (ch == '*') { + if (pfirst) pfirst = 0; + cnk->min_star = new_chunk(); + if (!cnk->min_star) /* out of memory :-( */ + goto done; + cnk->min_star->type = CNK_INT; + if (pflag) { + int num; + ch = *format++; + if (!isdigit((unsigned char)ch)) { + /* parameters must be all positioned or none */ + goto done; + } + for (num = 0; isdigit((unsigned char)ch); ch = *format++) { + num = 10 * num + char_to_int(ch); + } + cnk->min_star->num = num; + if (ch != '$') /* what ?? */ + goto done; + } else { + cnk->min_star->num = ++pnum; + } + max_pos = add_cnk_list_entry(&clist, max_pos, cnk->min_star); + if (max_pos == 0) /* out of memory :-( */ + goto done; + ch = *format++; + state = DP_S_DOT; + } else { + if (pfirst) pfirst = 0; + state = DP_S_DOT; + } + break; + case DP_S_DOT: + if (ch == '.') { + state = DP_S_MAX; + ch = *format++; + } else { + state = DP_S_MOD; + } + break; + case DP_S_MAX: + if (isdigit((unsigned char)ch)) { + if (cnk->max < 0) + cnk->max = 0; + cnk->max = 10 * cnk->max + char_to_int (ch); + ch = *format++; + } else if (ch == '$') { + if (!pfirst && !pflag) { + /* parameters must be all positioned or none */ + goto done; + } + if (cnk->max <= 0) /* what ?? */ + goto done; + cnk->num = cnk->max; + cnk->max = -1; + ch = *format++; + } else if (ch == '*') { + cnk->max_star = new_chunk(); + if (!cnk->max_star) /* out of memory :-( */ + goto done; + cnk->max_star->type = CNK_INT; + if (pflag) { + int num; + ch = *format++; + if (!isdigit((unsigned char)ch)) { + /* parameters must be all positioned or none */ + goto done; + } + for (num = 0; isdigit((unsigned char)ch); ch = *format++) { + num = 10 * num + char_to_int(ch); + } + cnk->max_star->num = num; + if (ch != '$') /* what ?? */ + goto done; + } else { + cnk->max_star->num = ++pnum; + } + max_pos = add_cnk_list_entry(&clist, max_pos, cnk->max_star); + if (max_pos == 0) /* out of memory :-( */ + goto done; + + ch = *format++; + state = DP_S_MOD; + } else { + state = DP_S_MOD; + } + break; + case DP_S_MOD: + switch (ch) { + case 'h': + cnk->cflags = DP_C_SHORT; + ch = *format++; + if (ch == 'h') { + cnk->cflags = DP_C_CHAR; + ch = *format++; + } + break; + case 'l': + cnk->cflags = DP_C_LONG; + ch = *format++; + if (ch == 'l') { /* It's a long long */ + cnk->cflags = DP_C_LLONG; + ch = *format++; + } + break; + case 'L': + cnk->cflags = DP_C_LDOUBLE; + ch = *format++; + break; + default: + break; + } + state = DP_S_CONV; + break; + case DP_S_CONV: + if (cnk->num == 0) cnk->num = ++pnum; + max_pos = add_cnk_list_entry(&clist, max_pos, cnk); + if (max_pos == 0) /* out of memory :-( */ + goto done; + + switch (ch) { + case 'd': + case 'i': + cnk->type = CNK_INT; + break; + case 'o': + cnk->type = CNK_OCTAL; + cnk->flags |= DP_F_UNSIGNED; + break; + case 'u': + cnk->type = CNK_UINT; + cnk->flags |= DP_F_UNSIGNED; + break; + case 'X': + cnk->flags |= DP_F_UP; + case 'x': + cnk->type = CNK_HEX; + cnk->flags |= DP_F_UNSIGNED; + break; + case 'A': + /* hex float not supported yet */ + case 'E': + case 'G': + case 'F': + cnk->flags |= DP_F_UP; + case 'a': + /* hex float not supported yet */ + case 'e': + case 'f': + case 'g': + cnk->type = CNK_FLOAT; + break; + case 'c': + cnk->type = CNK_CHAR; + break; + case 's': + cnk->type = CNK_STRING; + break; + case 'p': + cnk->type = CNK_PTR; + break; + case 'n': + cnk->type = CNK_NUM; + break; + case '%': + cnk->type = CNK_PRCNT; + break; + default: + /* Unknown, bail out*/ + goto done; + } + ch = *format++; + state = DP_S_DEFAULT; + break; + case DP_S_DONE: + break; + default: + /* hmm? */ + break; /* some picky compilers need this */ + } + } + + /* retieve the format arguments */ + for (pnum = 0; pnum < max_pos; pnum++) { + int i; + + if (clist[pnum].num == 0) { + /* ignoring a parameter should not be permitted + * all parameters must be matched at least once + * BUT seem some system ignore this rule ... + * at least my glibc based system does --SSS + */ +#ifdef DEBUG_SNPRINTF + printf("parameter at position %d not used\n", pnum+1); +#endif + /* eat the parameter */ + va_arg (args, int); + continue; + } + for (i = 1; i < clist[pnum].num; i++) { + if (clist[pnum].chunks[0]->type != clist[pnum].chunks[i]->type) { + /* nooo noo no! + * all the references to a parameter + * must be of the same type + */ + goto done; + } + } + cnk = clist[pnum].chunks[0]; + switch (cnk->type) { + case CNK_INT: + if (cnk->cflags == DP_C_SHORT) + cnk->value = va_arg (args, int); + else if (cnk->cflags == DP_C_LONG) + cnk->value = va_arg (args, long int); + else if (cnk->cflags == DP_C_LLONG) + cnk->value = va_arg (args, LLONG); + else + cnk->value = va_arg (args, int); + + for (i = 1; i < clist[pnum].num; i++) { + clist[pnum].chunks[i]->value = cnk->value; + } + break; + + case CNK_OCTAL: + case CNK_UINT: + case CNK_HEX: + if (cnk->cflags == DP_C_SHORT) + cnk->value = va_arg (args, unsigned int); + else if (cnk->cflags == DP_C_LONG) + cnk->value = (long)va_arg (args, unsigned long int); + else if (cnk->cflags == DP_C_LLONG) + cnk->value = (LLONG)va_arg (args, unsigned LLONG); + else + cnk->value = (long)va_arg (args, unsigned int); + + for (i = 1; i < clist[pnum].num; i++) { + clist[pnum].chunks[i]->value = cnk->value; + } + break; + + case CNK_FLOAT: + if (cnk->cflags == DP_C_LDOUBLE) + cnk->fvalue = va_arg (args, LDOUBLE); + else + cnk->fvalue = va_arg (args, double); + + for (i = 1; i < clist[pnum].num; i++) { + clist[pnum].chunks[i]->fvalue = cnk->fvalue; + } + break; + + case CNK_CHAR: + cnk->value = va_arg (args, int); + + for (i = 1; i < clist[pnum].num; i++) { + clist[pnum].chunks[i]->value = cnk->value; + } + break; + + case CNK_STRING: + cnk->strvalue = va_arg (args, char *); + if (!cnk->strvalue) cnk->strvalue = "(NULL)"; + + for (i = 1; i < clist[pnum].num; i++) { + clist[pnum].chunks[i]->strvalue = cnk->strvalue; + } + break; + + case CNK_PTR: + cnk->strvalue = va_arg (args, void *); + for (i = 1; i < clist[pnum].num; i++) { + clist[pnum].chunks[i]->strvalue = cnk->strvalue; + } + break; + + case CNK_NUM: + if (cnk->cflags == DP_C_CHAR) + cnk->pnum = va_arg (args, char *); + else if (cnk->cflags == DP_C_SHORT) + cnk->pnum = va_arg (args, short int *); + else if (cnk->cflags == DP_C_LONG) + cnk->pnum = va_arg (args, long int *); + else if (cnk->cflags == DP_C_LLONG) + cnk->pnum = va_arg (args, LLONG *); + else + cnk->pnum = va_arg (args, int *); + + for (i = 1; i < clist[pnum].num; i++) { + clist[pnum].chunks[i]->pnum = cnk->pnum; + } + break; + + case CNK_PRCNT: + break; + + default: + /* what ?? */ + goto done; + } + } + /* print out the actual string from chunks */ + currlen = 0; + cnk = chunks; + while (cnk) { + int len, min, max; + + if (cnk->min_star) min = cnk->min_star->value; + else min = cnk->min; + if (cnk->max_star) max = cnk->max_star->value; + else max = cnk->max; + + switch (cnk->type) { + + case CNK_FMT_STR: + if (maxlen != 0 && maxlen > currlen) { + if (maxlen > (currlen + cnk->len)) len = cnk->len; + else len = maxlen - currlen; + + memcpy(&(buffer[currlen]), &(base[cnk->start]), len); + } + currlen += cnk->len; + + break; + + case CNK_INT: + case CNK_UINT: + fmtint (buffer, &currlen, maxlen, cnk->value, 10, min, max, cnk->flags); + break; + + case CNK_OCTAL: + fmtint (buffer, &currlen, maxlen, cnk->value, 8, min, max, cnk->flags); + break; + + case CNK_HEX: + fmtint (buffer, &currlen, maxlen, cnk->value, 16, min, max, cnk->flags); + break; + + case CNK_FLOAT: + fmtfp (buffer, &currlen, maxlen, cnk->fvalue, min, max, cnk->flags); + break; + + case CNK_CHAR: + dopr_outch (buffer, &currlen, maxlen, cnk->value); + break; + + case CNK_STRING: + if (max == -1) { + max = strlen(cnk->strvalue); + } + fmtstr (buffer, &currlen, maxlen, cnk->strvalue, cnk->flags, min, max); + break; + + case CNK_PTR: + fmtint (buffer, &currlen, maxlen, (long)(cnk->strvalue), 16, min, max, cnk->flags); + break; + + case CNK_NUM: + if (cnk->cflags == DP_C_CHAR) + *((char *)(cnk->pnum)) = (char)currlen; + else if (cnk->cflags == DP_C_SHORT) + *((short int *)(cnk->pnum)) = (short int)currlen; + else if (cnk->cflags == DP_C_LONG) + *((long int *)(cnk->pnum)) = (long int)currlen; + else if (cnk->cflags == DP_C_LLONG) + *((LLONG *)(cnk->pnum)) = (LLONG)currlen; + else + *((int *)(cnk->pnum)) = (int)currlen; + break; + + case CNK_PRCNT: + dopr_outch (buffer, &currlen, maxlen, '%'); + break; + + default: + /* what ?? */ + goto done; + } + cnk = cnk->next; + } + if (maxlen != 0) { + if (currlen < maxlen - 1) + buffer[currlen] = '\0'; + else if (maxlen > 0) + buffer[maxlen - 1] = '\0'; + } + ret = currlen; + +done: + while (chunks) { + cnk = chunks->next; + free(chunks); + chunks = cnk; + } + if (clist) { + for (pnum = 0; pnum < max_pos; pnum++) { + if (clist[pnum].chunks) free(clist[pnum].chunks); + } + free(clist); + } + return ret; +} + +static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, + char *value, int flags, int min, int max) +{ + int padlen, strln; /* amount to pad */ + int cnt = 0; + +#ifdef DEBUG_SNPRINTF + printf("fmtstr min=%d max=%d s=[%s]\n", min, max, value); +#endif + if (value == 0) { + value = ""; + } + + for (strln = 0; strln < max && value[strln]; ++strln); /* strlen */ + padlen = min - strln; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justify */ + + while (padlen > 0) { + dopr_outch (buffer, currlen, maxlen, ' '); + --padlen; + } + while (*value && (cnt < max)) { + dopr_outch (buffer, currlen, maxlen, *value++); + ++cnt; + } + while (padlen < 0) { + dopr_outch (buffer, currlen, maxlen, ' '); + ++padlen; + } +} + +/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ + +static void fmtint(char *buffer, size_t *currlen, size_t maxlen, + long value, int base, int min, int max, int flags) +{ + int signvalue = 0; + unsigned long uvalue; + char convert[20]; + int place = 0; + int spadlen = 0; /* amount to space pad */ + int zpadlen = 0; /* amount to zero pad */ + int caps = 0; + + if (max < 0) + max = 0; + + uvalue = value; + + if(!(flags & DP_F_UNSIGNED)) { + if( value < 0 ) { + signvalue = '-'; + uvalue = -value; + } else { + if (flags & DP_F_PLUS) /* Do a sign (+/i) */ + signvalue = '+'; + else if (flags & DP_F_SPACE) + signvalue = ' '; + } + } + + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ + + do { + convert[place++] = + (caps? "0123456789ABCDEF":"0123456789abcdef") + [uvalue % (unsigned)base ]; + uvalue = (uvalue / (unsigned)base ); + } while(uvalue && (place < 20)); + if (place == 20) place--; + convert[place] = 0; + + zpadlen = max - place; + spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); + if (zpadlen < 0) zpadlen = 0; + if (spadlen < 0) spadlen = 0; + if (flags & DP_F_ZERO) { + zpadlen = MAX(zpadlen, spadlen); + spadlen = 0; + } + if (flags & DP_F_MINUS) + spadlen = -spadlen; /* Left Justifty */ + +#ifdef DEBUG_SNPRINTF + printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", + zpadlen, spadlen, min, max, place); +#endif + + /* Spaces */ + while (spadlen > 0) { + dopr_outch (buffer, currlen, maxlen, ' '); + --spadlen; + } + + /* Sign */ + if (signvalue) + dopr_outch (buffer, currlen, maxlen, signvalue); + + /* Zeros */ + if (zpadlen > 0) { + while (zpadlen > 0) { + dopr_outch (buffer, currlen, maxlen, '0'); + --zpadlen; + } + } + + /* Digits */ + while (place > 0) + dopr_outch (buffer, currlen, maxlen, convert[--place]); + + /* Left Justified spaces */ + while (spadlen < 0) { + dopr_outch (buffer, currlen, maxlen, ' '); + ++spadlen; + } +} + +static LDOUBLE abs_val(LDOUBLE value) +{ + LDOUBLE result = value; + + if (value < 0) + result = -value; + + return result; +} + +static LDOUBLE POW10(int exp) +{ + LDOUBLE result = 1; + + while (exp) { + result *= 10; + exp--; + } + + return result; +} + +static LLONG ROUND(LDOUBLE value) +{ + LLONG intpart; + + intpart = (LLONG)value; + value = value - intpart; + if (value >= 0.5) intpart++; + + return intpart; +} + +/* a replacement for modf that doesn't need the math library. Should + be portable, but slow */ +static double my_modf(double x0, double *iptr) +{ + int i; + long l; + double x = x0; + double f = 1.0; + + for (i=0;i<100;i++) { + l = (long)x; + if (l <= (x+1) && l >= (x-1)) break; + x *= 0.1; + f *= 10.0; + } + + if (i == 100) { + /* yikes! the number is beyond what we can handle. What do we do? */ + (*iptr) = 0; + return 0; + } + + if (i != 0) { + double i2; + double ret; + + ret = my_modf(x0-l*f, &i2); + (*iptr) = l*f + i2; + return ret; + } + + (*iptr) = l; + return x - (*iptr); +} + + +static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, + LDOUBLE fvalue, int min, int max, int flags) +{ + int signvalue = 0; + double ufvalue; + char iconvert[311]; + char fconvert[311]; + int iplace = 0; + int fplace = 0; + int padlen = 0; /* amount to pad */ + int zpadlen = 0; + int caps = 0; + int idx; + double intpart; + double fracpart; + double temp; + + /* + * AIX manpage says the default is 0, but Solaris says the default + * is 6, and sprintf on AIX defaults to 6 + */ + if (max < 0) + max = 6; + + ufvalue = abs_val (fvalue); + + if (fvalue < 0) { + signvalue = '-'; + } else { + if (flags & DP_F_PLUS) { /* Do a sign (+/i) */ + signvalue = '+'; + } else { + if (flags & DP_F_SPACE) + signvalue = ' '; + } + } + +#if 0 + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ +#endif + +#if 0 + if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */ +#endif + + /* + * Sorry, we only support 9 digits past the decimal because of our + * conversion method + */ + if (max > 9) + max = 9; + + /* We "cheat" by converting the fractional part to integer by + * multiplying by a factor of 10 + */ + + temp = ufvalue; + my_modf(temp, &intpart); + + fracpart = ROUND((POW10(max)) * (ufvalue - intpart)); + + if (fracpart >= POW10(max)) { + intpart++; + fracpart -= POW10(max); + } + + + /* Convert integer part */ + do { + temp = intpart*0.1; + my_modf(temp, &intpart); + idx = (int) ((temp -intpart +0.05)* 10.0); + /* idx = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */ + /* printf ("%llf, %f, %x\n", temp, intpart, idx); */ + iconvert[iplace++] = + (caps? "0123456789ABCDEF":"0123456789abcdef")[idx]; + } while (intpart && (iplace < 311)); + if (iplace == 311) iplace--; + iconvert[iplace] = 0; + + /* Convert fractional part */ + if (fracpart) + { + do { + temp = fracpart*0.1; + my_modf(temp, &fracpart); + idx = (int) ((temp -fracpart +0.05)* 10.0); + /* idx = (int) ((((temp/10) -fracpart) +0.05) *10); */ + /* printf ("%lf, %lf, %ld\n", temp, fracpart, idx ); */ + fconvert[fplace++] = + (caps? "0123456789ABCDEF":"0123456789abcdef")[idx]; + } while(fracpart && (fplace < 311)); + if (fplace == 311) fplace--; + } + fconvert[fplace] = 0; + + /* -1 for decimal point, another -1 if we are printing a sign */ + padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); + zpadlen = max - fplace; + if (zpadlen < 0) zpadlen = 0; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justifty */ + + if ((flags & DP_F_ZERO) && (padlen > 0)) { + if (signvalue) { + dopr_outch (buffer, currlen, maxlen, signvalue); + --padlen; + signvalue = 0; + } + while (padlen > 0) { + dopr_outch (buffer, currlen, maxlen, '0'); + --padlen; + } + } + while (padlen > 0) { + dopr_outch (buffer, currlen, maxlen, ' '); + --padlen; + } + if (signvalue) + dopr_outch (buffer, currlen, maxlen, signvalue); + + while (iplace > 0) + dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); + +#ifdef DEBUG_SNPRINTF + printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen); +#endif + + /* + * Decimal point. This should probably use locale to find the correct + * char to print out. + */ + if (max > 0) { + dopr_outch (buffer, currlen, maxlen, '.'); + + while (zpadlen > 0) { + dopr_outch (buffer, currlen, maxlen, '0'); + --zpadlen; + } + + while (fplace > 0) + dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); + } + + while (padlen < 0) { + dopr_outch (buffer, currlen, maxlen, ' '); + ++padlen; + } +} + +static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) +{ + if (*currlen < maxlen) { + buffer[(*currlen)] = c; + } + (*currlen)++; +} + +static struct pr_chunk *new_chunk(void) { + struct pr_chunk *new_c = (struct pr_chunk *)malloc(sizeof(struct pr_chunk)); + + if ( !new_c ) + return NULL; + + new_c->type = 0; + new_c->num = 0; + new_c->min = 0; + new_c->min_star = NULL; + new_c->max = -1; + new_c->max_star = NULL; + new_c->flags = 0; + new_c->cflags = 0; + new_c->start = 0; + new_c->len = 0; + new_c->value = 0; + new_c->fvalue = 0; + new_c->strvalue = NULL; + new_c->pnum = NULL; + new_c->next = NULL; + + return new_c; +} + +static int add_cnk_list_entry(struct pr_chunk_x **list, + int max_num, struct pr_chunk *chunk) { + struct pr_chunk_x *l; + struct pr_chunk **c; + int max; + int cnum; + int i, pos; + + if (chunk->num > max_num) { + max = chunk->num; + + if (*list == NULL) { + l = (struct pr_chunk_x *)malloc(sizeof(struct pr_chunk_x) * max); + pos = 0; + } else { + l = (struct pr_chunk_x *)realloc(*list, sizeof(struct pr_chunk_x) * max); + pos = max_num; + } + if (l == NULL) { + for (i = 0; i < max; i++) { + if ((*list)[i].chunks) free((*list)[i].chunks); + } + return 0; + } + for (i = pos; i < max; i++) { + l[i].chunks = NULL; + l[i].num = 0; + } + } else { + l = *list; + max = max_num; + } + + i = chunk->num - 1; + cnum = l[i].num + 1; + if (l[i].chunks == NULL) { + c = (struct pr_chunk **)malloc(sizeof(struct pr_chunk *) * cnum); + } else { + c = (struct pr_chunk **)realloc(l[i].chunks, sizeof(struct pr_chunk *) * cnum); + } + if (c == NULL) { + for (i = 0; i < max; i++) { + if (l[i].chunks) free(l[i].chunks); + } + return 0; + } + c[l[i].num] = chunk; + l[i].chunks = c; + l[i].num = cnum; + + *list = l; + return max; +} + + int smb_vsnprintf (char *str, size_t count, const char *fmt, va_list args) +{ + return dopr(str, count, fmt, args); +} +#define vsnprintf smb_vsnprintf +#endif + +/* yes this really must be a ||. Don't muck with this (tridge) + * + * The logic for these two is that we need our own definition if the + * OS *either* has no definition of *sprintf, or if it does have one + * that doesn't work properly according to the autoconf test. + */ +#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF) +int smb_snprintf(char *str,size_t count,const char *fmt,...) +{ + size_t ret; + va_list ap; + + va_start(ap, fmt); + ret = vsnprintf(str, count, fmt, ap); + va_end(ap); + return ret; +} +#define snprintf smb_snprintf +#endif + +#endif + +#ifndef HAVE_VASPRINTF + int vasprintf(char **ptr, const char *format, va_list ap) +{ + int ret; + va_list ap2; + + VA_COPY(ap2, ap); + + ret = vsnprintf(NULL, 0, format, ap2); + if (ret <= 0) return ret; + + (*ptr) = (char *)malloc(ret+1); + if (!*ptr) return -1; + + VA_COPY(ap2, ap); + + ret = vsnprintf(*ptr, ret+1, format, ap2); + + return ret; +} +#endif + + +#ifndef HAVE_ASPRINTF + int asprintf(char **ptr, const char *format, ...) +{ + va_list ap; + int ret; + + *ptr = NULL; + va_start(ap, format); + ret = vasprintf(ptr, format, ap); + va_end(ap); + + return ret; +} +#endif + +#ifdef TEST_SNPRINTF + + int sprintf(char *str,const char *fmt,...); + + int main (void) +{ + char buf1[1024]; + char buf2[1024]; + char *buf3; + char *fp_fmt[] = { + "%1.1f", + "%-1.5f", + "%1.5f", + "%123.9f", + "%10.5f", + "% 10.5f", + "%+22.9f", + "%+4.9f", + "%01.3f", + "%4f", + "%3.1f", + "%3.2f", + "%.0f", + "%f", + "%-8.8f", + "%-9.9f", + NULL + }; + double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 203.9, 0.96, 0.996, + 0.9996, 1.996, 4.136, 5.030201, 0.00205, + /* END LIST */ 0}; + char *int_fmt[] = { + "%-1.5d", + "%1.5d", + "%123.9d", + "%5.5d", + "%10.5d", + "% 10.5d", + "%+22.33d", + "%01.3d", + "%4d", + "%d", + NULL + }; + long int_nums[] = { -1, 134, 91340, 341, 0203, 0, 1234567890}; + char *str_fmt[] = { + "%10.5s", + "%-10.5s", + "%5.10s", + "%-5.10s", + "%10.1s", + "%0.10s", + "%10.0s", + "%1.10s", + "%s", + "%.1s", + "%.10s", + "%10s", + NULL + }; + char *str_vals[] = {"hello", "a", "", "a longer string", NULL}; + int x, y; + int fail = 0; + int num = 0; + int l1, l2; + + printf ("Testing snprintf format codes against system sprintf...\n"); + + for (x = 0; fp_fmt[x] ; x++) { + for (y = 0; fp_nums[y] != 0 ; y++) { + buf1[0] = buf2[0] = '\0'; + l1 = snprintf(NULL, 0, fp_fmt[x], fp_nums[y]); + l2 = snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]); + sprintf (buf2, fp_fmt[x], fp_nums[y]); + buf1[1023] = buf1[1023] = '\0'; + if (strcmp (buf1, buf2) || (l1 != l2)) { + printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n", + fp_fmt[x], l1, buf1, l2, buf2); + fail++; + } + num++; + } + } + + for (x = 0; int_fmt[x] ; x++) { + for (y = 0; int_nums[y] != 0 ; y++) { + buf1[0] = buf2[0] = '\0'; + l1 = snprintf(NULL, 0, int_fmt[x], int_nums[y]); + l2 = snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]); + sprintf (buf2, int_fmt[x], int_nums[y]); + buf1[1023] = buf1[1023] = '\0'; + if (strcmp (buf1, buf2) || (l1 != l2)) { + printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n", + int_fmt[x], l1, buf1, l2, buf2); + fail++; + } + num++; + } + } + + for (x = 0; str_fmt[x] ; x++) { + for (y = 0; str_vals[y] != 0 ; y++) { + buf1[0] = buf2[0] = '\0'; + l1 = snprintf(NULL, 0, str_fmt[x], str_vals[y]); + l2 = snprintf(buf1, sizeof(buf1), str_fmt[x], str_vals[y]); + sprintf (buf2, str_fmt[x], str_vals[y]); + buf1[1023] = buf1[1023] = '\0'; + if (strcmp (buf1, buf2) || (l1 != l2)) { + printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n", + str_fmt[x], l1, buf1, l2, buf2); + fail++; + } + num++; + } + } + +#define BUFSZ 2048 + + buf1[0] = buf2[0] = '\0'; + if ((buf3 = malloc(BUFSZ)) == NULL) { + fail++; + } else { + num++; + memset(buf3, 'a', BUFSZ); + snprintf(buf1, sizeof(buf1), "%.*s", 1, buf3); + buf1[1023] = '\0'; + if (strcmp(buf1, "a") != 0) { + printf("length limit buf1 '%s' expected 'a'\n", buf1); + fail++; + } + } + + buf1[0] = buf2[0] = '\0'; + l1 = snprintf(buf1, sizeof(buf1), "%4$*1$d %2$s %3$*1$.*1$f", 3, "pos test", 12.3456, 9); + l2 = sprintf(buf2, "%4$*1$d %2$s %3$*1$.*1$f", 3, "pos test", 12.3456, 9); + buf1[1023] = buf1[1023] = '\0'; + if (strcmp(buf1, buf2) || (l1 != l2)) { + printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n", + "%4$*1$d %2$s %3$*1$.*1$f", l1, buf1, l2, buf2); + fail++; + } + + buf1[0] = buf2[0] = '\0'; + l1 = snprintf(buf1, sizeof(buf1), "%4$*4$d %2$s %3$*4$.*4$f", 3, "pos test", 12.3456, 9); + l2 = sprintf(buf2, "%4$*4$d %2$s %3$*4$.*4$f", 3, "pos test", 12.3456, 9); + buf1[1023] = buf1[1023] = '\0'; + if (strcmp(buf1, buf2)) { + printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n", + "%4$*1$d %2$s %3$*1$.*1$f", l1, buf1, l2, buf2); + fail++; + } +#if 0 + buf1[0] = buf2[0] = '\0'; + l1 = snprintf(buf1, sizeof(buf1), "%lld", (LLONG)1234567890); + l2 = sprintf(buf2, "%lld", (LLONG)1234567890); + buf1[1023] = buf1[1023] = '\0'; + if (strcmp(buf1, buf2)) { + printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n", + "%lld", l1, buf1, l2, buf2); + fail++; + } + + buf1[0] = buf2[0] = '\0'; + l1 = snprintf(buf1, sizeof(buf1), "%Lf", (LDOUBLE)890.1234567890123); + l2 = sprintf(buf2, "%Lf", (LDOUBLE)890.1234567890123); + buf1[1023] = buf1[1023] = '\0'; + if (strcmp(buf1, buf2)) { + printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n", + "%Lf", l1, buf1, l2, buf2); + fail++; + } +#endif + printf ("%d tests failed out of %d.\n", fail, num); + + printf("seeing how many digits we support\n"); + { + double v0 = 0.12345678901234567890123456789012345678901; + for (x=0; x<100; x++) { + double p = pow(10, x); + double r = v0*p; + snprintf(buf1, sizeof(buf1), "%1.1f", r); + sprintf(buf2, "%1.1f", r); + if (strcmp(buf1, buf2)) { + printf("we seem to support %d digits\n", x-1); + break; + } + } + } + + return 0; +} +#endif /* TEST_SNPRINTF */ From b573db22da4660389d0b4dad5e7af8170d70a086 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Mon, 25 Jul 2016 11:24:54 -0500 Subject: [PATCH 36/73] Another cross-platform change --- src/Makefile.in | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index 4973d60..fd42a4b 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -39,6 +39,7 @@ DBLDFLAGS=@DBLDFLAGS@ DBLIBS=@DBLIBS@ MATHLIBS=-lm # OTHERLIBS=@OTHERLIBS@ +SNPRINTF_O=@SNPRINTF_O@ COMMON_INC=$(SRC_INCLUDE)/config.h $(SRC_INCLUDE)/common.h $(SRC_INCLUDE)/io.h $(SRC_INCLUDE)/protoapi.h $(SRC_INCLUDE)/utils.h COMMON_SRC=io.c utils.c @@ -62,28 +63,28 @@ ndo2db: $(MAKE) ndo2db-3x $(MAKE) ndo2db-4x -ndo2db-2x: queue.c ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC) $(COMMON_OBJS) dbhandlers-2x.o - $(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_2X -o ndo2db-2x queue.c ndo2db.c dbhandlers-2x.o $(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS) $(DBLDFLAGS) $(LIBS) $(SOCKETLIBS) $(DBLIBS) $(MATHLIBS) $(OTHERLIBS) +ndo2db-2x: queue.c ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC) $(COMMON_OBJS) dbhandlers-2x.o $(SNPRINTF_O) + $(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_2X -o ndo2db-2x queue.c ndo2db.c dbhandlers-2x.o $(SNPRINTF_O) $(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS) $(DBLDFLAGS) $(LIBS) $(SOCKETLIBS) $(DBLIBS) $(MATHLIBS) $(OTHERLIBS) -ndo2db-3x: queue.c ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC) $(COMMON_OBJS) dbhandlers-3x.o - $(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_3X -o ndo2db-3x queue.c ndo2db.c dbhandlers-3x.o $(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS) $(DBLDFLAGS) $(LIBS) $(SOCKETLIBS) $(DBLIBS) $(MATHLIBS) $(OTHERLIBS) +ndo2db-3x: queue.c ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC) $(COMMON_OBJS) dbhandlers-3x.o $(SNPRINTF_O) + $(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_3X -o ndo2db-3x queue.c ndo2db.c dbhandlers-3x.o $(SNPRINTF_O) $(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS) $(DBLDFLAGS) $(LIBS) $(SOCKETLIBS) $(DBLIBS) $(MATHLIBS) $(OTHERLIBS) -ndo2db-4x: queue.c ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC) $(COMMON_OBJS) dbhandlers-4x.o - $(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_4X -o ndo2db-4x queue.c ndo2db.c dbhandlers-4x.o $(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS) $(DBLDFLAGS) $(LIBS) $(SOCKETLIBS) $(DBLIBS) $(MATHLIBS) $(OTHERLIBS) +ndo2db-4x: queue.c ndo2db.c $(NDO_INC) $(NDO_OBJS) $(COMMON_INC) $(COMMON_OBJS) dbhandlers-4x.o $(SNPRINTF_O) + $(CC) $(CFLAGS) $(DBCFLAGS) -D BUILD_NAGIOS_4X -o ndo2db-4x queue.c ndo2db.c dbhandlers-4x.o $(SNPRINTF_O) $(COMMON_OBJS) $(NDO_OBJS) $(LDFLAGS) $(DBLDFLAGS) $(LIBS) $(SOCKETLIBS) $(DBLIBS) $(MATHLIBS) $(OTHERLIBS) ndomod: $(MAKE) ndomod-2x.o $(MAKE) ndomod-3x.o $(MAKE) ndomod-4x.o -ndomod-2x.o: ndomod.c $(COMMON_INC) $(COMMON_OBJS) - $(CC) $(MOD_CFLAGS) $(CFLAGS) -D BUILD_NAGIOS_2X -o ndomod-2x.o ndomod.c $(COMMON_OBJS) $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS) $(SOCKETLIBS) $(OTHERLIBS) +ndomod-2x.o: ndomod.c $(COMMON_INC) $(COMMON_OBJS) $(SNPRINTF_O) + $(CC) $(MOD_CFLAGS) $(CFLAGS) -D BUILD_NAGIOS_2X -o ndomod-2x.o ndomod.c $(SNPRINTF_O) $(COMMON_OBJS) $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS) $(SOCKETLIBS) $(OTHERLIBS) -ndomod-3x.o: ndomod.c $(COMMON_INC) $(COMMON_OBJS) - $(CC) $(MOD_CFLAGS) $(CFLAGS) -D BUILD_NAGIOS_3X -o ndomod-3x.o ndomod.c $(COMMON_OBJS) $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS) $(SOCKETLIBS) $(OTHERLIBS) +ndomod-3x.o: ndomod.c $(COMMON_INC) $(COMMON_OBJS) $(SNPRINTF_O) + $(CC) $(MOD_CFLAGS) $(CFLAGS) -D BUILD_NAGIOS_3X -o ndomod-3x.o ndomod.c $(SNPRINTF_O) $(COMMON_OBJS) $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS) $(SOCKETLIBS) $(OTHERLIBS) -ndomod-4x.o: ndomod.c $(COMMON_INC) $(COMMON_OBJS) - $(CC) $(MOD_CFLAGS) $(CFLAGS) $(CFLAGS_4X) -D BUILD_NAGIOS_4X -o ndomod-4x.o ndomod.c $(COMMON_OBJS) $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS) $(SOCKETLIBS) $(OTHERLIBS) +ndomod-4x.o: ndomod.c $(COMMON_INC) $(COMMON_OBJS) $(SNPRINTF_O) + $(CC) $(MOD_CFLAGS) $(CFLAGS) $(CFLAGS_4X) -D BUILD_NAGIOS_4X -o ndomod-4x.o ndomod.c $(SNPRINTF_O) $(COMMON_OBJS) $(MOD_LDFLAGS) $(LDFLAGS) $(LIBS) $(SOCKETLIBS) $(OTHERLIBS) sockdebug: sockdebug.c $(COMMON_INC) $(COMMON_OBJS) $(CC) $(CFLAGS) -o $@ sockdebug.c $(COMMON_OBJS) $(LDFLAGS) $(LIBS) $(MATHLIBS) $(SOCKETLIBS) $(OTHERLIBS) From ab4d6806e066fb92a2e619faa3533799fdc4e3c8 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Mon, 25 Jul 2016 12:41:53 -0500 Subject: [PATCH 37/73] Cross-platform fix found while testing HP-UX --- configure | 2 ++ configure.ac | 1 + src/Makefile.in | 2 +- src/dbhandlers.c | 2 ++ src/ndo2db.c | 4 +++- src/ndomod.c | 2 ++ 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 924af08..0cc53b3 100755 --- a/configure +++ b/configure @@ -639,6 +639,7 @@ np_mysql_config MOD_LDFLAGS MOD_CFLAGS ndo2db_port +SNPRINTF_O LIBWRAPLIBS SOCKETLIBS EGREP @@ -5915,6 +5916,7 @@ $as_echo "#define HAVE___VA_COPY 1" >>confdefs.h fi fi + ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" if test "x$ac_cv_func_snprintf" = xyes; then : diff --git a/configure.ac b/configure.ac index 4ea26bd..622c81b 100644 --- a/configure.ac +++ b/configure.ac @@ -129,6 +129,7 @@ else AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available]) fi fi +AC_SUBST(SNPRINTF_O) AC_CHECK_FUNC(snprintf,,SNPRINTF_O=./snprintf.o) AC_CHECK_FUNC(asprintf,,SNPRINTF_O=./snprintf.o) diff --git a/src/Makefile.in b/src/Makefile.in index fd42a4b..7ff5507 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -20,7 +20,7 @@ INSTALL_OPTS=@INSTALL_OPTS@ CC=@CC@ -CFLAGS=@CFLAGS@ @DEFS@ +CFLAGS=-FPIC @CFLAGS@ @DEFS@ CFLAGS_4X=-I $(SRC_INCLUDE)/nagios-4x # We don't like ANSI because ANSI doesn't like us! phhht! diff --git a/src/dbhandlers.c b/src/dbhandlers.c index 5319d2c..88d991e 100644 --- a/src/dbhandlers.c +++ b/src/dbhandlers.c @@ -18,6 +18,8 @@ #include "../include/db.h" #include "../include/dbhandlers.h" +#include + /* Nagios header files */ #ifdef BUILD_NAGIOS_2X diff --git a/src/ndo2db.c b/src/ndo2db.c index 39fa6e9..887b76d 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -34,6 +34,8 @@ #include "../include/dh.h" #endif +#include + #define NDO2DB_VERSION "2.1.0b2" #define NDO2DB_NAME "NDO2DB" #define NDO2DB_DATE "12-02-2015" @@ -2299,7 +2301,7 @@ int ndo2db_convert_string_to_timeval(char *buf, struct timeval *tv){ return NDO_ERROR; tv->tv_sec=(time_t)0L; - tv->tv_usec=(suseconds_t)0L; + tv->tv_usec=0; if((newbuf=strdup(buf))==NULL) return NDO_ERROR; diff --git a/src/ndomod.c b/src/ndomod.c index dde359a..de4c1f1 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -19,6 +19,8 @@ #include "../include/protoapi.h" #include "../include/ndomod.h" +#include + /* include (minimum required) event broker header files */ #ifdef BUILD_NAGIOS_2X #include "../include/nagios-2x/nebstructs.h" From f43ae19e3ab90a834cf595cff50bfe71f7932026 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Mon, 25 Jul 2016 13:36:12 -0500 Subject: [PATCH 38/73] Missed a comma --- macros/ax_nagios_get_files | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/ax_nagios_get_files b/macros/ax_nagios_get_files index fd56735..f8c5a9b 100644 --- a/macros/ax_nagios_get_files +++ b/macros/ax_nagios_get_files @@ -97,7 +97,7 @@ AS_CASE([$init_type], fi, [launchd], - src_init="mac-init.plist" + src_init="mac-init.plist", [*], src_init="unknown" From 44dbc9ba1dea14c08a25bcdf7d4d4a9c8ae17629 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 10:54:49 -0500 Subject: [PATCH 39/73] Cross-platform changes (see below) and misc cleanup Makefile.in: - Added top-level make targets for each program,module - Added default: target with target descriptions - Added install-groups-users target - Added install-inetd target - Added files to delete in distclean target configure.ac: - Added test for AIX and add '-Wl,-berok' to MOD_LDFLAGS and update final message src/Makefile.in: - Added -fPIC to CFLAGS and other misc cleanup --- Makefile.in | 97 +++++++++++++++++++++++++++++++++++++++++++++---- configure | 21 +++++++---- configure.ac | 13 +++++-- src/Makefile.in | 35 ++++++++---------- 4 files changed, 127 insertions(+), 39 deletions(-) diff --git a/Makefile.in b/Makefile.in index 8c46e2e..22f79d4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -16,21 +16,65 @@ LOGDIR=@localstatedir@ CFGDIR=@sysconfdir@ BINDIR=@bindir@ LIBEXECDIR=@libexecdir@ + +NDO2DB_USER=@ndo2db_user@ +NDO2DB_GROUP=@ndo2db_group@ + INSTALL=@INSTALL@ +GREP=@GREP@ +EGREP=@EGREP@ + INSTALL_OPTS=@INSTALL_OPTS@ +OPSYS=@opsys@ +DIST=@dist_type@ + INIT_TYPE=@init_type@ INIT_DIR=@initdir@ INIT_OPTS=-o root -g root +INIT_FILE=@initname@ INETD_TYPE=@inetd_type@ INETD_DIR=@inetddir@ INETD_FILE=@inetdname@ SRC_INETD=@src_inetd@ -INIT_FILE=@initname@ SRC_INIT=@src_init@ +default: + @echo;\ + echo Please enter 'make [option]' where [option] is one of:;\ + echo;\ + echo " all builds the NDO Utilities";\ + echo " ndo2db builds the ndo2db daemon";\ + echo " ndomod builds the ndomod nagios module";\ + echo " file2sock builds the file2sock utility";\ + echo " log2ndo builds the log2ndo utility";\ + echo " sockdebug builds the sockdebug utility";\ + echo " install-groups-users add the user and group if they do not exist";\ + echo " install installs the module and programs";\ + echo " install-config installs the sample configuration files";\ + echo " install-inetd install the startup files for inetd, launchd, etc.";\ + echo " install-init install the startup files for init, systemd, etc.";\ + echo " fullinstall runs install-groups-users, install,";\ + echo " install-config and install-init";\ + echo + all: cd $(SRC_BASE) && $(MAKE) +ndo2db: + cd $(SRC_BASE); $(MAKE) $@ + +ndomod: + cd $(SRC_BASE); $(MAKE) $@ + +file2sock: + cd $(SRC_BASE); $(MAKE) $@ + +log2ndo: + cd $(SRC_BASE); $(MAKE) $@ + +sockdebug: + cd $(SRC_BASE); $(MAKE) $@ + ctags: ctags -R @@ -41,9 +85,9 @@ install: @echo "" install-config: - $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR) - $(INSTALL) -b -m 664 $(INSTALL_OPTS) config/ndo2db.cfg-sample $(DESTDIR)$(CFGDIR) - $(INSTALL) -b -m 664 $(INSTALL_OPTS) config/ndomod.cfg-sample $(DESTDIR)$(CFGDIR) + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(CFGDIR) + $(INSTALL) -b -m 644 $(INSTALL_OPTS) config/ndo2db.cfg-sample $(CFGDIR) + $(INSTALL) -b -m 644 $(INSTALL_OPTS) config/ndomod.cfg-sample $(CFGDIR) @echo "" @echo "*** Config files installed ***" @echo "" @@ -52,6 +96,9 @@ install-config: @echo "Please read the documentation to know what they are doing." @echo "" +install-groups-users: + @macros/add_group_user $(DIST) $(NDO2DB_USER) $(NDO2DB_GROUP) + install-init: @if test $(SRC_INIT) = unknown; then \ echo No init file to install; \ @@ -96,7 +143,38 @@ install-init: fi;\ fi -fullinstall: install install-init install-config +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 ]+@ndo2db_port@/tcp" /etc/services || \ + echo "***** MAKE SURE 'ndo2db @ndo2db_port@/tcp' IS IN YOUR /etc/services FILE" + +fullinstall: install-groups-users install install-config install-init clean: cd $(SRC_BASE) && $(MAKE) $@ @@ -104,13 +182,18 @@ clean: rm -f *~ */*~ include/nagios-*/*~ distclean: clean - cd $(SRC_BASE) && $(MAKE) $@ + cd $(SRC_BASE) && $(MAKE) $@; cd .. cd docs/docbook/en-en/ && $(MAKE) $@ rm -f config.log config.status config.cache rm -f $(SRC_INCLUDE)/dh.h $(SRC_INCLUDE)/config.h rm -f $(SRC_CONFIG)/ndo2db.cfg-sample $(SRC_CONFIG)/ndomod.cfg-sample $(SRC_CONFIG)/nagios.cfg $(SRC_CONFIG)/misccommands.cfg + 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 Makefile - rm -f subst daemon-init rm -f tags devclean: distclean diff --git a/configure b/configure index 0cc53b3..cedfe62 100755 --- a/configure +++ b/configure @@ -4740,12 +4740,12 @@ case $init_type in #( src_init=upstart-init fi ;; #( launchd) : - src_init="mac-init.plist" - - * ;; #( + 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; } @@ -4777,6 +4777,10 @@ $as_echo "$src_inetd" >&6; } +if test "$opsys" = aix; then + MOD_LDFLAGS="$MOD_LDFLAGS -Wl,-berok" +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -8066,8 +8070,9 @@ $as_echo " NDO2DB group: $ndo2db_group" >&6; } $as_echo " NDO2DB tcp port: $ndo2db_port" >&6; } -echo "" -echo "" -echo "Review the options above for accuracy. If they look okay," -echo "type 'make' to compile the NDO utilities." +echo "";\ +echo "";\ +echo "Review the options above for accuracy. If they look";\ +echo "okay, type 'make all' to compile the NDO utilities,";\ +echo "or type 'make' to get a list of make options.";\ echo "" diff --git a/configure.ac b/configure.ac index 622c81b..8f15c7d 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,10 @@ AC_NAGIOS_GET_INETD AC_NAGIOS_GET_PATHS AC_NAGIOS_GET_FILES +if test "$opsys" = aix; then + MOD_LDFLAGS="$MOD_LDFLAGS -Wl,-berok" +fi + dnl Checks for header files. AC_HEADER_STDC AC_HEADER_TIME @@ -393,8 +397,9 @@ AC_MSG_RESULT([ NDO2DB group: $ndo2db_group]) AC_MSG_RESULT([ NDO2DB tcp port: $ndo2db_port]) -echo "" -echo "" -echo "Review the options above for accuracy. If they look okay," -echo "type 'make' to compile the NDO utilities." +echo "";\ +echo "";\ +echo "Review the options above for accuracy. If they look";\ +echo "okay, type 'make all' to compile the NDO utilities,";\ +echo "or type 'make' to get a list of make options.";\ echo "" diff --git a/src/Makefile.in b/src/Makefile.in index 7ff5507..861c1c0 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -10,24 +10,20 @@ SRC_INCLUDE=../include prefix=@prefix@ exec_prefix=@exec_prefix@ -LOGDIR=@localstatedir@ -CFGDIR=@sysconfdir@ BINDIR=@bindir@ -LIBEXECDIR=@libexecdir@ -CGIDIR=@sbindir@ INSTALL=@INSTALL@ INSTALL_OPTS=@INSTALL_OPTS@ CC=@CC@ -CFLAGS=-FPIC @CFLAGS@ @DEFS@ +CFLAGS=-fPIC @CFLAGS@ @DEFS@ CFLAGS_4X=-I $(SRC_INCLUDE)/nagios-4x # We don't like ANSI because ANSI doesn't like us! phhht! -#CFLAGS=-g -Wall -ansi -pedantic -DHAVE_CONFIG_H +#CFLAGS=-fPIC -g -Wall -ansi -pedantic -DHAVE_CONFIG_H # Compiler flags for use with Valgrind -#CFLAGS=-O0 -g -DHAVE_CONFIG_H +#CFLAGS=-fPIC -O0 -g -DHAVE_CONFIG_H MOD_CFLAGS=@MOD_CFLAGS@ LDFLAGS=@LDFLAGS@ @@ -38,7 +34,6 @@ DBCFLAGS=@DBCFLAGS@ DBLDFLAGS=@DBLDFLAGS@ DBLIBS=@DBLIBS@ MATHLIBS=-lm -# OTHERLIBS=@OTHERLIBS@ SNPRINTF_O=@SNPRINTF_O@ COMMON_INC=$(SRC_INCLUDE)/config.h $(SRC_INCLUDE)/common.h $(SRC_INCLUDE)/io.h $(SRC_INCLUDE)/protoapi.h $(SRC_INCLUDE)/utils.h @@ -117,9 +112,9 @@ distclean: clean devclean: distclean install: install-4x - $(INSTALL) -m 774 $(INSTALL_OPTS) file2sock $(DESTDIR)$(BINDIR) - $(INSTALL) -m 774 $(INSTALL_OPTS) log2ndo $(DESTDIR)$(BINDIR) - $(INSTALL) -m 774 $(INSTALL_OPTS) sockdebug $(DESTDIR)$(BINDIR) + $(INSTALL) -m 774 $(INSTALL_OPTS) file2sock $(BINDIR) + $(INSTALL) -m 774 $(INSTALL_OPTS) log2ndo $(BINDIR) + $(INSTALL) -m 774 $(INSTALL_OPTS) sockdebug $(BINDIR) @echo "" @echo " Hint: NDOUtils Installation against Nagios v4.x" @echo " completed." @@ -138,17 +133,17 @@ install: install-4x @echo "" install-2x: - $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR) - $(INSTALL) -m 755 $(INSTALL_OPTS) ndo2db-2x $(DESTDIR)$(BINDIR)/ndo2db - $(INSTALL) -m 755 $(INSTALL_OPTS) ndomod-2x.o $(DESTDIR)$(BINDIR)/ndomod.o + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(BINDIR) + $(INSTALL) -m 755 $(INSTALL_OPTS) ndo2db-2x $(BINDIR)/ndo2db + $(INSTALL) -m 755 $(INSTALL_OPTS) ndomod-2x.o $(BINDIR)/ndomod.o install-3x: - $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR) - $(INSTALL) -m 755 $(INSTALL_OPTS) ndo2db-3x $(DESTDIR)$(BINDIR)/ndo2db - $(INSTALL) -m 755 $(INSTALL_OPTS) ndomod-3x.o $(DESTDIR)$(BINDIR)/ndomod.o + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(BINDIR) + $(INSTALL) -m 755 $(INSTALL_OPTS) ndo2db-3x $(BINDIR)/ndo2db + $(INSTALL) -m 755 $(INSTALL_OPTS) ndomod-3x.o $(BINDIR)/ndomod.o install-4x: - $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR) - $(INSTALL) -m 755 $(INSTALL_OPTS) ndo2db-4x $(DESTDIR)$(BINDIR)/ndo2db - $(INSTALL) -m 755 $(INSTALL_OPTS) ndomod-4x.o $(DESTDIR)$(BINDIR)/ndomod.o + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(BINDIR) + $(INSTALL) -m 755 $(INSTALL_OPTS) ndo2db-4x $(BINDIR)/ndo2db + $(INSTALL) -m 755 $(INSTALL_OPTS) ndomod-4x.o $(BINDIR)/ndomod.o From 42ffb0061f2000fd89904d735c5ec1cb045d58da Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 11:57:48 -0500 Subject: [PATCH 40/73] Replaces hard-coded port with variable from ./configure --- config/ndomod.cfg-sample.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ndomod.cfg-sample.in b/config/ndomod.cfg-sample.in index 7d4051e..60298fc 100644 --- a/config/ndomod.cfg-sample.in +++ b/config/ndomod.cfg-sample.in @@ -46,7 +46,7 @@ output=@localstatedir@/ndo.sock # order to send output. This option is only valid if the output type # option specified above is "tcpsocket". -tcp_port=5668 +tcp_port=@ndo2db_port@ From d831b8ec65c38668c03a0370a7993f75887e6fbb Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 11:58:24 -0500 Subject: [PATCH 41/73] localstatedir was not being eval'd --- macros/ax_nagios_get_paths | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/ax_nagios_get_paths b/macros/ax_nagios_get_paths index bd6c47a..1fe6454 100644 --- a/macros/ax_nagios_get_paths +++ b/macros/ax_nagios_get_paths @@ -606,6 +606,7 @@ eval libexecdir=$libexecdir eval brokersdir=$brokersdir eval pluginsdir=$pluginsdir eval cgibindir=$cgibindir +eval localstatedir=$localstatedir eval pkglocalstatedir=$pkglocalstatedir eval webdir=$webdir eval localedir=$localedir From 26d89c8ec82ff4ef702b8f713f9d36ddfe139509 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 11:59:23 -0500 Subject: [PATCH 42/73] Forgot to autoconf --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index cedfe62..5f10132 100755 --- a/configure +++ b/configure @@ -4581,6 +4581,7 @@ eval libexecdir=$libexecdir eval brokersdir=$brokersdir eval pluginsdir=$pluginsdir eval cgibindir=$cgibindir +eval localstatedir=$localstatedir eval pkglocalstatedir=$pkglocalstatedir eval webdir=$webdir eval localedir=$localedir From 5ebcfe15fcf8bd3260a1a9048145a28121b6500c Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 12:01:56 -0500 Subject: [PATCH 43/73] Some systems don't understand '-b' argument to 'install' --- Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 22f79d4..97774ed 100644 --- a/Makefile.in +++ b/Makefile.in @@ -86,8 +86,8 @@ install: install-config: $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(CFGDIR) - $(INSTALL) -b -m 644 $(INSTALL_OPTS) config/ndo2db.cfg-sample $(CFGDIR) - $(INSTALL) -b -m 644 $(INSTALL_OPTS) config/ndomod.cfg-sample $(CFGDIR) + $(INSTALL) -m 644 $(INSTALL_OPTS) config/ndo2db.cfg-sample $(CFGDIR) + $(INSTALL) -m 644 $(INSTALL_OPTS) config/ndomod.cfg-sample $(CFGDIR) @echo "" @echo "*** Config files installed ***" @echo "" From d79c5bcd9510bb205dfdf31ac5a0fc0bfd7dd760 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 13:33:45 -0500 Subject: [PATCH 44/73] Package name and the program name are not always the same For example: PKG_NAME=ndoutils but the daemon is ndo2db. Things like the startup file names, pid file, etc., need to have the daemon name. So an INIT_PROG variable was added, that should be set in configure.ac. If set, it will be used for those objects. --- macros/ax_nagios_get_paths | 76 ++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/macros/ax_nagios_get_paths b/macros/ax_nagios_get_paths index 1fe6454..f48e31a 100644 --- a/macros/ax_nagios_get_paths +++ b/macros/ax_nagios_get_paths @@ -131,6 +131,10 @@ need_log_subdir=no # where the loc sub-directory is need_etc_subdir=no # where the etc sub-directory is need_pls_dir=no # where the package locate state directory is +if test x"$INIT_PROG" = x; then + INIT_PROG="$PKG_NAME" +fi + AS_CASE([$PKG_NAME], [nagios], need_log_subdir=yes @@ -286,14 +290,14 @@ tmpfilesd=${tmpfilesd="/usr/lib/tmpfiles.d"} if test ! -d "$tmpfilesd"; then tmpfilesd="N/A" else - tmpfilesd="$tmpfilesd/$PKG_NAME.conf" + tmpfilesd="$tmpfilesd/$INIT_PROG.conf" fi subsyslockdir=${subsyslockdir="/var/lock/subsys"} if test ! -d "$subsyslockdir"; then subsyslockdir="N/A" subsyslockfile="N/A" else - subsyslockfile="$subsyslockdir/$PKG_NAME" + subsyslockfile="$subsyslockdir/$INIT_PROG" fi if test "$need_loc" = no; then localedir="N/A" @@ -374,23 +378,23 @@ elif test $opsys = "linux"; then fi privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"} if test $need_log_subdir = yes; then - logdir=${logdir="$localstatedir/log/$PKG_NAME"} + logdir=${logdir="$localstatedir/log/$INIT_PROG"} else logdir=${logdir="$localstatedir/log"} fi - piddir=${piddir="$localstatedir/run/${PKG_NAME}"} + piddir=${piddir="$localstatedir/run/${INIT_PROG}"} if test "$need_pipe" = yes; then - pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"} else pipedir="N/A" fi if test "$need_pls_dir" = yes; then - pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"} + pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"} else pkglocalstatedir="N/A" fi if test "$need_spl" = yes; then - spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"} + spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"} else spooldir="N/A" fi @@ -439,7 +443,7 @@ elif test $opsys = "unix"; then fi privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"} if test "$need_pls_dir" = yes; then - pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"} + pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"} else pkglocalstatedir="N/A" fi @@ -447,7 +451,7 @@ elif test $opsys = "unix"; 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"} + spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"} else spooldir="N/A" fi @@ -473,14 +477,14 @@ elif test $opsys = "unix"; then logdir=${logdir="$pkglocalstatedir/log"}, [*], - piddir=${piddir="$localstatedir/run/${PKG_NAME}"} + piddir=${piddir="$localstatedir/run/${INIT_PROG}"} if test "$need_pipe" = yes; then - pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"} else pipedir="N/A" fi if test $need_log_subdir = yes; then - logdir=${logdir="$localstatedir/log/$PKG_NAME"} + logdir=${logdir="$localstatedir/log/$INIT_PROG"} else logdir=${logdir="$localstatedir/log"} fi @@ -530,7 +534,7 @@ elif test $opsys = "bsd"; then fi privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"} if test "$need_pls_dir" = yes; then - pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"} + pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"} else pkglocalstatedir="N/A" fi @@ -538,7 +542,7 @@ elif test $opsys = "bsd"; 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"} + spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"} else spooldir="N/A" fi @@ -563,14 +567,14 @@ elif test $opsys = "bsd"; then else cgibindir="N/A" fi - piddir=${piddir="$localstatedir/run/${PKG_NAME}"} + piddir=${piddir="$localstatedir/run/${INIT_PROG}"} if test "$need_pipe" = yes; then - pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"} else pipedir="N/A" fi if test $need_log_subdir = yes; then - logdir=${logdir="$localstatedir/log/$PKG_NAME"} + logdir=${logdir="$localstatedir/log/$INIT_PROG"} else logdir=${logdir="$localstatedir/log"} fi @@ -625,9 +629,9 @@ AS_CASE([$init_type], else initdir=${initdir="/etc/init.d"} fi - initname=${initname="$PKG_NAME"} + initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/conf.d"} - initconf=${initconf="$initconfdir/$PKG_NAME"}, + initconf=${initconf="$initconfdir/$INIT_PROG"}, [systemd], if test $dist_type = "debian"; then @@ -635,27 +639,27 @@ AS_CASE([$init_type], else initdir=${initdir="/usr/lib/systemd/system"} fi - initname=${initname="$PKG_NAME.service"}, + initname=${initname="$INIT_PROG.service"}, [bsd], initdir=${initdir="/etc/rc.d"} - initname=${initname="rc.$PKG_NAME"}, + initname=${initname="rc.$INIT_PROG"}, [newbsd], initdir=${initdir="/etc/rc.d"} - initname=${initname="$PKG_NAME"}, + initname=${initname="$INIT_PROG"}, [gentoo], initdir=${initdir="/etc/init.d"} - initname=${initname="$PKG_NAME"} + initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/init.d"} - initconf=${initconf="$initconfdir/$PKG_NAME"}, + initconf=${initconf="$initconfdir/$INIT_PROG"}, [openrc], initdir=${initdir="/etc/init.d"} - initname=${initname="$PKG_NAME"} + initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/conf.d"} - initconf=${initconf="$initconfdir/$PKG_NAME"}, + initconf=${initconf="$initconfdir/$INIT_PROG"}, [smf*], if test $init_type = smf10; then @@ -663,21 +667,21 @@ AS_CASE([$init_type], else initdir=${initdir="/lib/svc/manifest/network/nagios"} fi - initname=${initname="$PKG_NAME.xml"} + initname=${initname="$INIT_PROG.xml"} initconfdir=unknown initconf=unknown, [upstart], initdir=${initdir="/etc/init"} - initname=${initname="$PKG_NAME.conf"} + initname=${initname="$INIT_PROG.conf"} initconfdir=${initconfdir="/etc/default"} - initconf=${initconf="$initconfdir/$PKG_NAME"}, + initconf=${initconf="$initconfdir/$INIT_PROG"}, [launchd], initdir=${initdir="/Library/LaunchDaemons"} - initname=${initname="org.nagios.$PKG_NAME.plist"}, + initname=${initname="org.nagios.$INIT_PROG.plist"}, # initconfdir=${initconfdir="/private/etc"} -# initconf=${initconf="$initconfdir/$PKG_NAME"}, +# initconf=${initconf="$initconfdir/$INIT_PROG"}, [*], @@ -694,7 +698,7 @@ AS_CASE([$inetd_type], [xinetd], inetddir=${inetddir="/etc/xinetd.d"} - inetdname=${inetdname="$PKG_NAME"}, + inetdname=${inetdname="$INIT_PROG"}, [systemd], if test $dist_type = "debian"; then @@ -702,7 +706,7 @@ AS_CASE([$inetd_type], else inetddir=${inetddir="/usr/lib/systemd/system"} fi - netdname=${inetdname="$PKG_NAME.socket"}, + netdname=${inetdname="$INIT_PROG.socket"}, [smf*], if test $init_type = smf10; then @@ -710,15 +714,15 @@ AS_CASE([$inetd_type], else inetddir=${inetddir="/lib/svc/manifest/network/nagios"} fi - inetdname=${inetdname="$PKG_NAME.xml"}, + inetdname=${inetdname="$INIT_PROG.xml"}, # [upstart], # inetddir=${inetddir="/etc/init.d"} -# inetdname=${inetdname="$PKG_NAME"}, +# inetdname=${inetdname="$INIT_PROG"}, [launchd], inetddir=${inetddir="/Library/LaunchDaemons"} - inetdname=${inetdname="org.nagios.$PKG_NAME.plist"}, + inetdname=${inetdname="org.nagios.$INIT_PROG.plist"}, [*], inetddir=${inetddir="unknown"} From 4820cbab08a62954dd540a9c4211875fbfaf83cd Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 13:37:39 -0500 Subject: [PATCH 45/73] Set INIT_PROG variable, and create PID directory --- Makefile.in | 3 +- configure | 77 ++++++++++++++++++++++++++----------------------- configure.ac | 1 + src/Makefile.in | 4 +++ 4 files changed, 48 insertions(+), 37 deletions(-) diff --git a/Makefile.in b/Makefile.in index 97774ed..a9676cb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -12,7 +12,7 @@ SRC_CONFIG=./config prefix=@prefix@ exec_prefix=@exec_prefix@ -LOGDIR=@localstatedir@ +PIPEDIR=@localstatedir@ CFGDIR=@sysconfdir@ BINDIR=@bindir@ LIBEXECDIR=@libexecdir@ @@ -86,6 +86,7 @@ install: install-config: $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(CFGDIR) + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(PIPEDIR) $(INSTALL) -m 644 $(INSTALL_OPTS) config/ndo2db.cfg-sample $(CFGDIR) $(INSTALL) -m 644 $(INSTALL_OPTS) config/ndomod.cfg-sample $(CFGDIR) @echo "" diff --git a/configure b/configure index 5f10132..d8a2ce4 100755 --- a/configure +++ b/configure @@ -2463,6 +2463,7 @@ $as_echo "#define DEFAULT_NAGIOS_GROUP nagios" >>confdefs.h PKG_NAME=ndoutils +INIT_PROG=ndo2db PKG_VERSION="2.1.0b2" PKG_HOME_URL="http://www.nagios.org/" PKG_REL_DATE="12-02-2015" @@ -4075,6 +4076,10 @@ need_log_subdir=no # where the loc sub-directory is need_etc_subdir=no # where the etc sub-directory is need_pls_dir=no # where the package locate state directory is +if test x"$INIT_PROG" = x; then + INIT_PROG="$PKG_NAME" +fi + case $PKG_NAME in #( nagios) : need_log_subdir=yes @@ -4259,14 +4264,14 @@ tmpfilesd=${tmpfilesd="/usr/lib/tmpfiles.d"} if test ! -d "$tmpfilesd"; then tmpfilesd="N/A" else - tmpfilesd="$tmpfilesd/$PKG_NAME.conf" + tmpfilesd="$tmpfilesd/$INIT_PROG.conf" fi subsyslockdir=${subsyslockdir="/var/lock/subsys"} if test ! -d "$subsyslockdir"; then subsyslockdir="N/A" subsyslockfile="N/A" else - subsyslockfile="$subsyslockdir/$PKG_NAME" + subsyslockfile="$subsyslockdir/$INIT_PROG" fi if test "$need_loc" = no; then localedir="N/A" @@ -4347,23 +4352,23 @@ elif test $opsys = "linux"; then fi privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"} if test $need_log_subdir = yes; then - logdir=${logdir="$localstatedir/log/$PKG_NAME"} + logdir=${logdir="$localstatedir/log/$INIT_PROG"} else logdir=${logdir="$localstatedir/log"} fi - piddir=${piddir="$localstatedir/run/${PKG_NAME}"} + piddir=${piddir="$localstatedir/run/${INIT_PROG}"} if test "$need_pipe" = yes; then - pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"} else pipedir="N/A" fi if test "$need_pls_dir" = yes; then - pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"} + pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"} else pkglocalstatedir="N/A" fi if test "$need_spl" = yes; then - spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"} + spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"} else spooldir="N/A" fi @@ -4412,7 +4417,7 @@ elif test $opsys = "unix"; then fi privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"} if test "$need_pls_dir" = yes; then - pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"} + pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"} else pkglocalstatedir="N/A" fi @@ -4420,7 +4425,7 @@ elif test $opsys = "unix"; 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"} + spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"} else spooldir="N/A" fi @@ -4445,14 +4450,14 @@ elif test $opsys = "unix"; then pipedir=${pipedir="$pkglocalstatedir"} logdir=${logdir="$pkglocalstatedir/log"} ;; #( *) : - piddir=${piddir="$localstatedir/run/${PKG_NAME}"} + piddir=${piddir="$localstatedir/run/${INIT_PROG}"} if test "$need_pipe" = yes; then - pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"} else pipedir="N/A" fi if test $need_log_subdir = yes; then - logdir=${logdir="$localstatedir/log/$PKG_NAME"} + logdir=${logdir="$localstatedir/log/$INIT_PROG"} else logdir=${logdir="$localstatedir/log"} fi @@ -4505,7 +4510,7 @@ elif test $opsys = "bsd"; then fi privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"} if test "$need_pls_dir" = yes; then - pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"} + pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"} else pkglocalstatedir="N/A" fi @@ -4513,7 +4518,7 @@ elif test $opsys = "bsd"; 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"} + spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"} else spooldir="N/A" fi @@ -4538,14 +4543,14 @@ elif test $opsys = "bsd"; then else cgibindir="N/A" fi - piddir=${piddir="$localstatedir/run/${PKG_NAME}"} + piddir=${piddir="$localstatedir/run/${INIT_PROG}"} if test "$need_pipe" = yes; then - pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"} + pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"} else pipedir="N/A" fi if test $need_log_subdir = yes; then - logdir=${logdir="$localstatedir/log/$PKG_NAME"} + logdir=${logdir="$localstatedir/log/$INIT_PROG"} else logdir=${logdir="$localstatedir/log"} fi @@ -4599,51 +4604,51 @@ case $init_type in #( else initdir=${initdir="/etc/init.d"} fi - initname=${initname="$PKG_NAME"} + initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/conf.d"} - initconf=${initconf="$initconfdir/$PKG_NAME"} ;; #( + initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( systemd) : if test $dist_type = "debian"; then initdir=${initdir="/lib/systemd/system"} else initdir=${initdir="/usr/lib/systemd/system"} fi - initname=${initname="$PKG_NAME.service"} ;; #( + initname=${initname="$INIT_PROG.service"} ;; #( bsd) : initdir=${initdir="/etc/rc.d"} - initname=${initname="rc.$PKG_NAME"} ;; #( + initname=${initname="rc.$INIT_PROG"} ;; #( newbsd) : initdir=${initdir="/etc/rc.d"} - initname=${initname="$PKG_NAME"} ;; #( + initname=${initname="$INIT_PROG"} ;; #( gentoo) : initdir=${initdir="/etc/init.d"} - initname=${initname="$PKG_NAME"} + initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/init.d"} - initconf=${initconf="$initconfdir/$PKG_NAME"} ;; #( + initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( openrc) : initdir=${initdir="/etc/init.d"} - initname=${initname="$PKG_NAME"} + initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/conf.d"} - initconf=${initconf="$initconfdir/$PKG_NAME"} ;; #( + initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( smf*) : if test $init_type = smf10; then initdir=${initdir="/var/svc/manifest/network/nagios"} else initdir=${initdir="/lib/svc/manifest/network/nagios"} fi - initname=${initname="$PKG_NAME.xml"} + initname=${initname="$INIT_PROG.xml"} initconfdir=unknown initconf=unknown ;; #( upstart) : initdir=${initdir="/etc/init"} - initname=${initname="$PKG_NAME.conf"} + initname=${initname="$INIT_PROG.conf"} initconfdir=${initconfdir="/etc/default"} - initconf=${initconf="$initconfdir/$PKG_NAME"} ;; #( + initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( launchd) : initdir=${initdir="/Library/LaunchDaemons"} - initname=${initname="org.nagios.$PKG_NAME.plist"} ;; #( + initname=${initname="org.nagios.$INIT_PROG.plist"} ;; #( # initconfdir=${initconfdir="/private/etc"} -# initconf=${initconf="$initconfdir/$PKG_NAME"}, +# initconf=${initconf="$initconfdir/$INIT_PROG"}, *) : @@ -4662,28 +4667,28 @@ case $inetd_type in #( inetdname=${inetdname="inetd.conf"} ;; #( xinetd) : inetddir=${inetddir="/etc/xinetd.d"} - inetdname=${inetdname="$PKG_NAME"} ;; #( + inetdname=${inetdname="$INIT_PROG"} ;; #( systemd) : if test $dist_type = "debian"; then inetddir=${inetddir="/lib/systemd/system"} else inetddir=${inetddir="/usr/lib/systemd/system"} fi - netdname=${inetdname="$PKG_NAME.socket"} ;; #( + netdname=${inetdname="$INIT_PROG.socket"} ;; #( smf*) : if test $init_type = smf10; then inetddir=${inetddir="/var/svc/manifest/network/nagios"} else inetddir=${inetddir="/lib/svc/manifest/network/nagios"} fi - inetdname=${inetdname="$PKG_NAME.xml"} ;; #( + inetdname=${inetdname="$INIT_PROG.xml"} ;; #( # [upstart], # inetddir=${inetddir="/etc/init.d"} -# inetdname=${inetdname="$PKG_NAME"}, +# inetdname=${inetdname="$INIT_PROG"}, launchd) : inetddir=${inetddir="/Library/LaunchDaemons"} - inetdname=${inetdname="org.nagios.$PKG_NAME.plist"} ;; #( + inetdname=${inetdname="org.nagios.$INIT_PROG.plist"} ;; #( *) : inetddir=${inetddir="unknown"} inetdname=${inetdname="unknown"} ;; #( diff --git a/configure.ac b/configure.ac index 8f15c7d..5ac5b34 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,7 @@ AC_DEFINE([DEFAULT_NAGIOS_USER], [nagios], [Default Nagios User]) AC_DEFINE([DEFAULT_NAGIOS_GROUP], [nagios], [Default Nagios Group]) PKG_NAME=ndoutils +INIT_PROG=ndo2db PKG_VERSION="2.1.0b2" PKG_HOME_URL="http://www.nagios.org/" PKG_REL_DATE="12-02-2015" diff --git a/src/Makefile.in b/src/Makefile.in index 861c1c0..1f14f85 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -10,6 +10,7 @@ SRC_INCLUDE=../include prefix=@prefix@ exec_prefix=@exec_prefix@ +PIPEDIR=@localstatedir@ BINDIR=@bindir@ INSTALL=@INSTALL@ INSTALL_OPTS=@INSTALL_OPTS@ @@ -133,16 +134,19 @@ install: install-4x @echo "" install-2x: + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(PIPEDIR) $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(BINDIR) $(INSTALL) -m 755 $(INSTALL_OPTS) ndo2db-2x $(BINDIR)/ndo2db $(INSTALL) -m 755 $(INSTALL_OPTS) ndomod-2x.o $(BINDIR)/ndomod.o install-3x: + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(PIPEDIR) $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(BINDIR) $(INSTALL) -m 755 $(INSTALL_OPTS) ndo2db-3x $(BINDIR)/ndo2db $(INSTALL) -m 755 $(INSTALL_OPTS) ndomod-3x.o $(BINDIR)/ndomod.o install-4x: + $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(PIPEDIR) $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(BINDIR) $(INSTALL) -m 755 $(INSTALL_OPTS) ndo2db-4x $(BINDIR)/ndo2db $(INSTALL) -m 755 $(INSTALL_OPTS) ndomod-4x.o $(BINDIR)/ndomod.o From 289234c5c8d37fe43e2d5c826aa53cb1c09927bb Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 13:59:55 -0500 Subject: [PATCH 46/73] Wasn't allowing the new -f parameter --- src/ndo2db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ndo2db.c b/src/ndo2db.c index 887b76d..7136556 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -293,7 +293,7 @@ int ndo2db_process_arguments(int argc, char **argv){ return NDO_OK; } - snprintf(optchars,sizeof(optchars),"c:ihlV"); + snprintf(optchars,sizeof(optchars),"c:ifhlV"); while(1){ #ifdef HAVE_GETOPT_H From ef1896591f89615093a2fb98971b3f34bb6ecd37 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 14:42:51 -0500 Subject: [PATCH 47/73] Forgot to add the '-f' to the Solaris startup command line --- startup/solaris-init.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/startup/solaris-init.xml.in b/startup/solaris-init.xml.in index 80c4c01..5d4cc37 100644 --- a/startup/solaris-init.xml.in +++ b/startup/solaris-init.xml.in @@ -89,7 +89,7 @@ From de6def8ee1e56b57ed017b0f0df00b6e1ff0ed7b Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 16:13:52 -0500 Subject: [PATCH 48/73] Changes to init stuff for AIX --- macros/ax_nagios_get_init | 4 +++- macros/ax_nagios_get_paths | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/macros/ax_nagios_get_init b/macros/ax_nagios_get_init index c43ef01..6aabdc5 100644 --- a/macros/ax_nagios_get_init +++ b/macros/ax_nagios_get_init @@ -119,12 +119,14 @@ AC_SUBST(init_type) elif test "$dist_type" = "slackware"; then init_type="bsd" init_type_wanted=no + elif test "$dist_type" = "aix"; then + init_type="bsd" + init_type_wanted=no 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") diff --git a/macros/ax_nagios_get_paths b/macros/ax_nagios_get_paths index f48e31a..1a0fa6f 100644 --- a/macros/ax_nagios_get_paths +++ b/macros/ax_nagios_get_paths @@ -642,8 +642,13 @@ AS_CASE([$init_type], initname=${initname="$INIT_PROG.service"}, [bsd], - initdir=${initdir="/etc/rc.d"} - initname=${initname="rc.$INIT_PROG"}, + if test $dist_type = "aix"; then + initdir=${initdir="/sbin/rc.d/init.d"} + initname=${initname="$INIT_PROG"}, + else + initdir=${initdir="/etc/rc.d"} + initname=${initname="rc.$INIT_PROG"}, + fi [newbsd], initdir=${initdir="/etc/rc.d"} From a5845a52f21883d4cb9af6abc8047d82cbdd9386 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 16:14:37 -0500 Subject: [PATCH 49/73] Changes to configure.ac for AIX --- configure | 68 ++++++++++++++++++++++++++++------------------------ configure.ac | 8 +++---- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/configure b/configure index d8a2ce4..78ce288 100755 --- a/configure +++ b/configure @@ -3798,13 +3798,14 @@ fi elif test "$dist_type" = "slackware"; then init_type="bsd" init_type_wanted=no + elif test "$dist_type" = "aix"; then + init_type="bsd" + init_type_wanted=no 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) : @@ -4615,47 +4616,52 @@ case $init_type in #( fi initname=${initname="$INIT_PROG.service"} ;; #( bsd) : - initdir=${initdir="/etc/rc.d"} - initname=${initname="rc.$INIT_PROG"} ;; #( - newbsd) : - initdir=${initdir="/etc/rc.d"} - initname=${initname="$INIT_PROG"} ;; #( - gentoo) : - initdir=${initdir="/etc/init.d"} + if test $dist_type = "aix"; then + initdir=${initdir="/sbin/rc.d/init.d"} + initname=${initname="$INIT_PROG"} ;; #( + else + initdir=${initdir="/etc/rc.d"} + initname=${initname="rc.$INIT_PROG"}) : + fi + + newbsd ;; #( + initdir=${initdir="/etc/rc.d"} + initname=${initname="$INIT_PROG"}) : + gentoo ;; #( + initdir=${initdir="/etc/init.d"} initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/init.d"} - initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( - openrc) : - initdir=${initdir="/etc/init.d"} + initconf=${initconf="$initconfdir/$INIT_PROG"}) : + openrc ;; #( + initdir=${initdir="/etc/init.d"} initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/conf.d"} - initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( - smf*) : - if test $init_type = smf10; then + initconf=${initconf="$initconfdir/$INIT_PROG"}) : + smf* ;; #( + if test $init_type = smf10; then initdir=${initdir="/var/svc/manifest/network/nagios"} else initdir=${initdir="/lib/svc/manifest/network/nagios"} fi initname=${initname="$INIT_PROG.xml"} initconfdir=unknown - initconf=unknown ;; #( - upstart) : - initdir=${initdir="/etc/init"} + initconf=unknown) : + upstart ;; #( + initdir=${initdir="/etc/init"} initname=${initname="$INIT_PROG.conf"} initconfdir=${initconfdir="/etc/default"} - initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( - launchd) : - initdir=${initdir="/Library/LaunchDaemons"} - initname=${initname="org.nagios.$INIT_PROG.plist"} ;; #( - # initconfdir=${initconfdir="/private/etc"} + initconf=${initconf="$initconfdir/$INIT_PROG"}) : + launchd ;; #( + initdir=${initdir="/Library/LaunchDaemons"} + initname=${initname="org.nagios.$INIT_PROG.plist"}) : + # initconfdir=${initconfdir="/private/etc"} # initconf=${initconf="$initconfdir/$INIT_PROG"}, - *) : - initdir=unknown - initname=unknown ;; #( + * ;; #( *) : - ;; + initdir=unknown + initname=unknown ;; esac # @@ -4783,10 +4789,6 @@ $as_echo "$src_inetd" >&6; } -if test "$opsys" = aix; then - MOD_LDFLAGS="$MOD_LDFLAGS -Wl,-berok" -fi - ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -6053,6 +6055,10 @@ $as_echo "$MOD_LDFLAGS" >&6; } +if test "$opsys" = aix; then + MOD_LDFLAGS="$MOD_LDFLAGS -Wl,-berok" +fi + USE_MYSQL=yes # Check whether --enable-mysql was given. diff --git a/configure.ac b/configure.ac index 5ac5b34..80f0d0c 100644 --- a/configure.ac +++ b/configure.ac @@ -39,10 +39,6 @@ AC_NAGIOS_GET_INETD AC_NAGIOS_GET_PATHS AC_NAGIOS_GET_FILES -if test "$opsys" = aix; then - MOD_LDFLAGS="$MOD_LDFLAGS -Wl,-berok" -fi - dnl Checks for header files. AC_HEADER_STDC AC_HEADER_TIME @@ -224,6 +220,10 @@ AC_MSG_RESULT([$MOD_LDFLAGS]) AC_SUBST(MOD_CFLAGS) AC_SUBST(MOD_LDFLAGS) +if test "$opsys" = aix; then + MOD_LDFLAGS="$MOD_LDFLAGS -Wl,-berok" +fi + dnl DB support options USE_MYSQL=yes From d612cf33a9f487f148c967db14b93716a5faf2d5 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 16:17:05 -0500 Subject: [PATCH 50/73] Typo in ax_nagios_get_paths --- macros/ax_nagios_get_paths | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/ax_nagios_get_paths b/macros/ax_nagios_get_paths index 1a0fa6f..eea97d2 100644 --- a/macros/ax_nagios_get_paths +++ b/macros/ax_nagios_get_paths @@ -644,11 +644,11 @@ AS_CASE([$init_type], [bsd], if test $dist_type = "aix"; then initdir=${initdir="/sbin/rc.d/init.d"} - initname=${initname="$INIT_PROG"}, + initname=${initname="$INIT_PROG"} else initdir=${initdir="/etc/rc.d"} - initname=${initname="rc.$INIT_PROG"}, - fi + initname=${initname="rc.$INIT_PROG"} + fi, [newbsd], initdir=${initdir="/etc/rc.d"} From 889b5ea9c8e7b630d95074d6288136ac1d6ec899 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 16:19:58 -0500 Subject: [PATCH 51/73] Forgot to run 'autoconf' again... --- configure | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/configure b/configure index 78ce288..d71081f 100755 --- a/configure +++ b/configure @@ -4618,50 +4618,50 @@ case $init_type in #( bsd) : if test $dist_type = "aix"; then initdir=${initdir="/sbin/rc.d/init.d"} - initname=${initname="$INIT_PROG"} ;; #( - else + initname=${initname="$INIT_PROG"} + else initdir=${initdir="/etc/rc.d"} - initname=${initname="rc.$INIT_PROG"}) : - fi - - newbsd ;; #( - initdir=${initdir="/etc/rc.d"} - initname=${initname="$INIT_PROG"}) : - gentoo ;; #( - initdir=${initdir="/etc/init.d"} + initname=${initname="rc.$INIT_PROG"} + fi ;; #( + newbsd) : + initdir=${initdir="/etc/rc.d"} + initname=${initname="$INIT_PROG"} ;; #( + gentoo) : + initdir=${initdir="/etc/init.d"} initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/init.d"} - initconf=${initconf="$initconfdir/$INIT_PROG"}) : - openrc ;; #( - initdir=${initdir="/etc/init.d"} + initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( + openrc) : + initdir=${initdir="/etc/init.d"} initname=${initname="$INIT_PROG"} initconfdir=${initconfdir="/etc/conf.d"} - initconf=${initconf="$initconfdir/$INIT_PROG"}) : - smf* ;; #( - if test $init_type = smf10; then + initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( + smf*) : + if test $init_type = smf10; then initdir=${initdir="/var/svc/manifest/network/nagios"} else initdir=${initdir="/lib/svc/manifest/network/nagios"} fi initname=${initname="$INIT_PROG.xml"} initconfdir=unknown - initconf=unknown) : - upstart ;; #( - initdir=${initdir="/etc/init"} + initconf=unknown ;; #( + upstart) : + initdir=${initdir="/etc/init"} initname=${initname="$INIT_PROG.conf"} initconfdir=${initconfdir="/etc/default"} - initconf=${initconf="$initconfdir/$INIT_PROG"}) : - launchd ;; #( - initdir=${initdir="/Library/LaunchDaemons"} - initname=${initname="org.nagios.$INIT_PROG.plist"}) : - # initconfdir=${initconfdir="/private/etc"} + initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #( + launchd) : + initdir=${initdir="/Library/LaunchDaemons"} + initname=${initname="org.nagios.$INIT_PROG.plist"} ;; #( + # initconfdir=${initconfdir="/private/etc"} # initconf=${initconf="$initconfdir/$INIT_PROG"}, - * ;; #( - *) : + *) : initdir=unknown - initname=unknown ;; + initname=unknown ;; #( + *) : + ;; esac # From 05f1f4e4793b93fb452aaaef4a2caf89e5d01e3b Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Wed, 27 Jul 2016 16:42:12 -0500 Subject: [PATCH 52/73] Another AIX change --- startup/bsd-init.in | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/startup/bsd-init.in b/startup/bsd-init.in index 1045133..6d36493 100644 --- a/startup/bsd-init.in +++ b/startup/bsd-init.in @@ -3,6 +3,8 @@ # Start/stop/restart/reload ndo2db # Copyright (c) 2016 Nagios(R) Core(TM) Development Team +BSDTYPE=@dist_type@ + NDO2DB_BIN=@sbindir@/ndo2db NDO2DB_CFG=@pkgsysconfdir@/ndo2db.cfg PID_DIR=@piddir@ @@ -46,10 +48,12 @@ ndo2db_restart() { # ndo2db status ndo2db_status() { - if ps -C ndo2db >/dev/null; then - echo "ndo2db is running." - else - echo "ndo2db is stopped." + if test $BSDTYPE != aix; then + if ps -C ndo2db >/dev/null; then + echo "ndo2db is running." + else + echo "ndo2db is stopped." + fi fi } @@ -67,6 +71,11 @@ case "$1" in ndo2db_status ;; *) + +if test $BSDTYPE = aix; then + echo "Usage $0 start|stop|restart" +else echo "Usage $0 start|stop|restart|status" +fi ;; esac From 30774bc3b45370cef5b08d30a560ec62469745c9 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Thu, 28 Jul 2016 09:06:19 -0500 Subject: [PATCH 53/73] AIX Init script changes --- startup/bsd-init.in | 49 ++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/startup/bsd-init.in b/startup/bsd-init.in index 6d36493..9935eff 100644 --- a/startup/bsd-init.in +++ b/startup/bsd-init.in @@ -10,9 +10,19 @@ NDO2DB_CFG=@pkgsysconfdir@/ndo2db.cfg PID_DIR=@piddir@ PID_FILE=@piddir@/ndo2db.pid +# Get PID of running process +ndo2db_get_pid() { + if [ -r "$PID_FILE" ]; then + pid=$(cat "$PID_FILE") + else + pid=$(ps -A -o pid,command|grep ndo2db|tr -s ' '|sed -e 's/^ //'|cut -d' ' -f1) + fi + echo $pid +} + # Start ndo2db ndo2db_start() { - echo -n "Starting ndo2db daemon: $NDO2DB_BIN - " + printf "Starting ndo2db daemon: $NDO2DB_BIN - " if [ ! -d "$PID_DIR" ]; then mkdir -p "$PID_DIR" fi @@ -26,16 +36,17 @@ ndo2db_start() { # Stop ndo2db ndo2db_stop() { - echo -n "Stopping ndo2db daemon - " - if [ -r "$PID_FILE" ]; then + printf "Stopping ndo2db daemon - " + pid=`ndo2db_get_pid()` + if [ -n $pid ]; then kill $(cat "$PID_FILE") + if [ $? = 0 ]; then + echo "stopped" + else + echo "failed" + fi else - killall ndo2db - fi - if [ $? = 0 ]; then - echo "stopped" - else - echo "failed" + echo "Does not appear to be running" fi } @@ -48,12 +59,19 @@ ndo2db_restart() { # ndo2db status ndo2db_status() { - if test $BSDTYPE != aix; then - if ps -C ndo2db >/dev/null; then - echo "ndo2db is running." + pid=`ndo2db_get_pid()` + if [ -n $pid ]; then + if test $BSDTYPE = aix; then + if ps g -o pid else - echo "ndo2db is stopped." + if ps -C ndo2db >/dev/null; then + echo "ndo2db is running." + else + echo "ndo2db is stopped." + fi fi + else + echo "ndo2db is stopped." fi } @@ -71,11 +89,6 @@ case "$1" in ndo2db_status ;; *) - -if test $BSDTYPE = aix; then - echo "Usage $0 start|stop|restart" -else echo "Usage $0 start|stop|restart|status" -fi ;; esac From 57b18965f4f057dda13f1b2ebcf314def975bfdc Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Thu, 28 Jul 2016 09:33:03 -0500 Subject: [PATCH 54/73] More AIX fixes --- configure | 9 +++++---- configure.ac | 9 +++++---- startup/bsd-init.in | 20 +++++++++----------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/configure b/configure index d71081f..2841191 100755 --- a/configure +++ b/configure @@ -6050,15 +6050,16 @@ case $host_os in MOD_LDFLAGS="-shared" ;; esac + +if test "$dist_type" = aix; then + MOD_LDFLAGS="$MOD_LDFLAGS -Wl,-berok" +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MOD_LDFLAGS" >&5 $as_echo "$MOD_LDFLAGS" >&6; } -if test "$opsys" = aix; then - MOD_LDFLAGS="$MOD_LDFLAGS -Wl,-berok" -fi - USE_MYSQL=yes # Check whether --enable-mysql was given. diff --git a/configure.ac b/configure.ac index 80f0d0c..664716c 100644 --- a/configure.ac +++ b/configure.ac @@ -216,14 +216,15 @@ case $host_os in MOD_LDFLAGS="-shared" ;; esac -AC_MSG_RESULT([$MOD_LDFLAGS]) -AC_SUBST(MOD_CFLAGS) -AC_SUBST(MOD_LDFLAGS) -if test "$opsys" = aix; then +if test "$dist_type" = aix; then MOD_LDFLAGS="$MOD_LDFLAGS -Wl,-berok" fi +AC_MSG_RESULT([$MOD_LDFLAGS]) +AC_SUBST(MOD_CFLAGS) +AC_SUBST(MOD_LDFLAGS) + dnl DB support options USE_MYSQL=yes diff --git a/startup/bsd-init.in b/startup/bsd-init.in index 9935eff..a714a79 100644 --- a/startup/bsd-init.in +++ b/startup/bsd-init.in @@ -37,8 +37,8 @@ ndo2db_start() { # Stop ndo2db ndo2db_stop() { printf "Stopping ndo2db daemon - " - pid=`ndo2db_get_pid()` - if [ -n $pid ]; then + pid=`ndo2db_get_pid` + if [ -n "$pid" ]; then kill $(cat "$PID_FILE") if [ $? = 0 ]; then echo "stopped" @@ -59,16 +59,14 @@ ndo2db_restart() { # ndo2db status ndo2db_status() { - pid=`ndo2db_get_pid()` - if [ -n $pid ]; then - if test $BSDTYPE = aix; then - if ps g -o pid + pid=`ndo2db_get_pid` + if [ -n "$pid" ]; then + if [ $BSDTYPE = aix ]; then + echo "ndo2db is running ($pid)" + elif ps -C ndo2db >/dev/null; then + echo "ndo2db is running ($pid)" else - if ps -C ndo2db >/dev/null; then - echo "ndo2db is running." - else - echo "ndo2db is stopped." - fi + echo "ndo2db is stopped." fi else echo "ndo2db is stopped." From 4eddb2f443ccea8794d83394883c8c99fe8e7d61 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Thu, 28 Jul 2016 09:44:03 -0500 Subject: [PATCH 55/73] More AIX changes --- startup/bsd-init.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/startup/bsd-init.in b/startup/bsd-init.in index a714a79..c20a6d7 100644 --- a/startup/bsd-init.in +++ b/startup/bsd-init.in @@ -13,11 +13,17 @@ PID_FILE=@piddir@/ndo2db.pid # Get PID of running process ndo2db_get_pid() { if [ -r "$PID_FILE" ]; then - pid=$(cat "$PID_FILE") + pid1=$(cat "$PID_FILE") else - pid=$(ps -A -o pid,command|grep ndo2db|tr -s ' '|sed -e 's/^ //'|cut -d' ' -f1) + pid1="" + fi + pid2=$(ps -A -o pid,command | grep ndo2db | grep -v grep | tr -s ' ' | sed -e 's/^ //' | cut -d' ' -f1) + + if [ $pid1 = $pid2 ]; then + echo $pid1 + else + echo $pid1 $pid2 fi - echo $pid } # Start ndo2db From c1a2b4012eb7e2c02eb87b06f8d5ee8b508203fa Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Thu, 28 Jul 2016 11:05:39 -0500 Subject: [PATCH 56/73] HPUX - set init to "unknown". Let admin do it. --- macros/ax_nagios_get_init | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/macros/ax_nagios_get_init b/macros/ax_nagios_get_init index 6aabdc5..5ef27f4 100644 --- a/macros/ax_nagios_get_init +++ b/macros/ax_nagios_get_init @@ -122,13 +122,16 @@ AC_SUBST(init_type) elif test "$dist_type" = "aix"; then init_type="bsd" init_type_wanted=no + elif test "$dist_type" = "hp-ux"; then + init_type="unknown" + init_type_wanted=no fi fi PSCMD="ps -p1 -o args" - AS_CASE([$dist_type], - [solaris], PSCMD="env UNIX95=1; ps -p1 -o args", - [hp-ux], PSCMD="env UNIX95=1; ps -p1 -o args") + if test $dist_type = solaris; then + PSCMD="env UNIX95=1; ps -p1 -o args" + fi if test "$init_type_wanted" = yes; then pid1=`$PSCMD | grep -vi COMMAND | cut -d' ' -f1` @@ -175,7 +178,7 @@ AC_SUBST(init_type) 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 + if `$pid1 --version 2>/dev/null | grep "upstart" >/dev/null`; then init_type="upstart" init_type_wanted=no elif test -f "/etc/rc" -a ! -L "/etc/rc"; then From cebec501aab04f0f9ff3ba711bafd41ae0510dc8 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Thu, 28 Jul 2016 11:06:39 -0500 Subject: [PATCH 57/73] HP-UX change --- configure | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 2841191..52ae22f 100755 --- a/configure +++ b/configure @@ -3801,18 +3801,16 @@ fi elif test "$dist_type" = "aix"; then init_type="bsd" init_type_wanted=no + elif test "$dist_type" = "hp-ux"; then + init_type="unknown" + init_type_wanted=no fi fi PSCMD="ps -p1 -o args" - case $dist_type in #( - solaris) : - PSCMD="env UNIX95=1; ps -p1 -o args" ;; #( - hp-ux) : - PSCMD="env UNIX95=1; ps -p1 -o args" ;; #( - *) : - ;; -esac + if test $dist_type = solaris; then + PSCMD="env UNIX95=1; ps -p1 -o args" + fi if test "$init_type_wanted" = yes; then pid1=`$PSCMD | grep -vi COMMAND | cut -d' ' -f1` @@ -3859,7 +3857,7 @@ esac 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 + if `$pid1 --version 2>/dev/null | grep "upstart" >/dev/null`; then init_type="upstart" init_type_wanted=no elif test -f "/etc/rc" -a ! -L "/etc/rc"; then From 28dac99bba520908d5e8d9bf68b55d551c485c17 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Thu, 28 Jul 2016 11:32:59 -0500 Subject: [PATCH 58/73] At least Solaris 10 SPARC doesn't have nanosleep but USE_NANOSLEEP is being set. Added check for nanosleep and set USE_NANOSLEEP to no. --- configure | 16 ++++++++++------ configure.ac | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 52ae22f..122b497 100755 --- a/configure +++ b/configure @@ -5845,7 +5845,7 @@ if test "x$ac_cv_lib_wrap_main" = xyes; then : fi -for ac_func in getopt_long strdup strstr strtoul initgroups strtof +for ac_func in getopt_long strdup strstr strtoul initgroups strtof nanosleep 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" @@ -6820,22 +6820,26 @@ fi fi -USE_NANOSLEEP=yes -# Check whether --enable-nanosleep was given. +if test x$HAVE_NANOSLEEP = x; then + USE_NANOSLEEP=no +else + USE_NANOSLEEP=yes + # Check whether --enable-nanosleep was given. if test "${enable_nanosleep+set}" = set; then : enableval=$enable_nanosleep; fi -if test x$enable_nanosleep = xno; then : + if test x$enable_nanosleep = xno; then : USE_NANOSLEEP=no else USE_NANOSLEEP=yes fi -if test x$USE_NANOSLEEP = xyes ; then - cat >>confdefs.h <<_ACEOF + if test x$USE_NANOSLEEP = xyes ; then + cat >>confdefs.h <<_ACEOF #define USE_NANOSLEEP 1 _ACEOF + fi fi ac_config_files="$ac_config_files Makefile src/Makefile config/ndo2db.cfg-sample config/ndomod.cfg-sample config/nagios.cfg config/misccommands.cfg docs/docbook/en-en/Makefile include/io.h include/common.h 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" diff --git a/configure.ac b/configure.ac index 664716c..093253a 100644 --- a/configure.ac +++ b/configure.ac @@ -110,7 +110,7 @@ AC_CHECK_LIB(wrap,main,[ AC_DEFINE(HAVE_LIBWRAP) ]) AC_SUBST(LIBWRAPLIBS) -AC_CHECK_FUNCS(getopt_long strdup strstr strtoul initgroups strtof) +AC_CHECK_FUNCS(getopt_long strdup strstr strtoul initgroups strtof nanosleep) dnl Check for asprintf() and friends... AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[ @@ -345,11 +345,15 @@ if test x$check_for_ssl = xyes; then fi -USE_NANOSLEEP=yes -AC_ARG_ENABLE(nanosleep,AC_HELP_STRING([--enable-nanosleep],[enables use of nanosleep (instead of sleep) in event timing])) -AS_IF([test x$enable_nanosleep = xno],[USE_NANOSLEEP=no],[USE_NANOSLEEP=yes]) -if test x$USE_NANOSLEEP = xyes ; then - AC_DEFINE_UNQUOTED(USE_NANOSLEEP) +if test x$HAVE_NANOSLEEP = x; then + USE_NANOSLEEP=no +else + USE_NANOSLEEP=yes + AC_ARG_ENABLE(nanosleep,AC_HELP_STRING([--enable-nanosleep],[enables use of nanosleep (instead of sleep) in event timing])) + AS_IF([test x$enable_nanosleep = xno],[USE_NANOSLEEP=no],[USE_NANOSLEEP=yes]) + if test x$USE_NANOSLEEP = xyes ; then + AC_DEFINE_UNQUOTED(USE_NANOSLEEP) + fi fi AC_CONFIG_FILES([Makefile From 3fd4e135082b13af6349ebfff9654e869af0f985 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Thu, 28 Jul 2016 16:30:50 -0500 Subject: [PATCH 59/73] Prep for release 2.1 --- Changelog | 2 ++ configure | 4 ++-- configure.ac | 4 ++-- src/file2sock.c | 6 +++--- src/log2ndo.c | 6 +++--- src/ndo2db.c | 6 +++--- src/ndomod.c | 6 +++--- src/sockdebug.c | 6 +++--- update-version | 4 ++-- 9 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Changelog b/Changelog index c555f00..f46b2ff 100644 --- a/Changelog +++ b/Changelog @@ -7,12 +7,14 @@ NDO Utils Changelog * Probable fix for ndo2db not responding & growing queue issue (John Frickson) * Got rid of uninitialized variable used for sleep() and increased the listen backlog (John Frickson) * ndoutils clears all entries from SQL table causing slow startup (John Frickson) +* Clean up bad returns (John Frickson) * Update nagios headers to (mostly) match the ones actually in core (John Frickson) * cannot open /xxxx/ndo2db.lock for reading: No such file or directory (box293) * Added option to specify alternative mysql TCP port on installdb script (JR Dalrymple) * State History does not use actual plugin long_output * Have the parent process wait until the lock file is written (David Michael) * Accept a socket fd passed from systemd (David Michael) +* Cross-platform changes (John Frickson) diff --git a/configure b/configure index 122b497..ab43fe0 100755 --- a/configure +++ b/configure @@ -2464,9 +2464,9 @@ $as_echo "#define DEFAULT_NAGIOS_GROUP nagios" >>confdefs.h PKG_NAME=ndoutils INIT_PROG=ndo2db -PKG_VERSION="2.1.0b2" +PKG_VERSION="2.1" PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="12-02-2015" +PKG_REL_DATE="07-28-2016" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do diff --git a/configure.ac b/configure.ac index 093253a..3f7331c 100644 --- a/configure.ac +++ b/configure.ac @@ -13,9 +13,9 @@ AC_DEFINE([DEFAULT_NAGIOS_GROUP], [nagios], [Default Nagios Group]) PKG_NAME=ndoutils INIT_PROG=ndo2db -PKG_VERSION="2.1.0b2" +PKG_VERSION="2.1" PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="12-02-2015" +PKG_REL_DATE="07-28-2016" dnl Figure out how to invoke "install" and what install options to use. AC_PROG_INSTALL diff --git a/src/file2sock.c b/src/file2sock.c index c3f9102..e936fec 100644 --- a/src/file2sock.c +++ b/src/file2sock.c @@ -6,7 +6,7 @@ * License: GPL v2 * * First Written: 05-13-2005 - * Last Modified: 12-02-2015 + * Last Modified: 07-28-2016 * **************************************************************/ @@ -14,9 +14,9 @@ #include "../include/common.h" #include "../include/io.h" -#define FILE2SOCK_VERSION "2.1.0b2" +#define FILE2SOCK_VERSION "2.1" #define FILE2SOCK_NAME "FILE2SOCK" -#define FILE2SOCK_DATE "12-02-2015" +#define FILE2SOCK_DATE "07-28-2016" int process_arguments(int,char **); diff --git a/src/log2ndo.c b/src/log2ndo.c index a8f5d65..29905af 100644 --- a/src/log2ndo.c +++ b/src/log2ndo.c @@ -4,7 +4,7 @@ * Copyright (c) 2009 Nagios Core Development Team and Community Contributors * Copyright (c) 2005-2009 Ethan Galstad * - * Last Modified: 12-02-2015 + * Last Modified: 07-28-2016 * **************************************************************/ @@ -13,9 +13,9 @@ #include "../include/io.h" #include "../include/protoapi.h" -#define LOG2NDO_VERSION "2.1.0b2" +#define LOG2NDO_VERSION "2.1" #define LOG2NDO_NAME "LOG2NDO" -#define LOG2NDO_DATE "12-02-2015" +#define LOG2NDO_DATE "07-28-2016" diff --git a/src/ndo2db.c b/src/ndo2db.c index 7136556..45a851d 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -5,7 +5,7 @@ * Copyright (c) 2005-2009 Ethan Galstad * * First Written: 05-19-2005 - * Last Modified: 12-02-2015 + * Last Modified: 07-28-2016 * **************************************************************/ @@ -36,9 +36,9 @@ #include -#define NDO2DB_VERSION "2.1.0b2" +#define NDO2DB_VERSION "2.1" #define NDO2DB_NAME "NDO2DB" -#define NDO2DB_DATE "12-02-2015" +#define NDO2DB_DATE "07-28-2016" #ifdef HAVE_SSL # if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux) diff --git a/src/ndomod.c b/src/ndomod.c index de4c1f1..8c23c6d 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -6,7 +6,7 @@ * Copyright (c) 2005-2009 Ethan Galstad * * First Written: 05-19-2005 - * Last Modified: 12-02-2015 + * Last Modified: 07-28-2016 * * TO DO: Add service parents, hourly value (hosts / services), * minimum value (contacts) @@ -67,9 +67,9 @@ NEB_API_VERSION(CURRENT_NEB_API_VERSION) -#define NDOMOD_VERSION "2.1.0b2" +#define NDOMOD_VERSION "2.1" #define NDOMOD_NAME "NDOMOD" -#define NDOMOD_DATE "12-02-2015" +#define NDOMOD_DATE "07-28-2016" #define BD_INT 0 #define BD_TIMEVAL 1 diff --git a/src/sockdebug.c b/src/sockdebug.c index 1ab857a..8352f58 100644 --- a/src/sockdebug.c +++ b/src/sockdebug.c @@ -5,15 +5,15 @@ * Copyright (c) 2005-2009 Ethan Galstad * * First Written: 05-13-2005 - * Last Modified: 12-02-2015 + * Last Modified: 07-28-2016 * **************************************************************/ #include "../include/config.h" -#define SOCKDEBUG_VERSION "2.1.0b2" +#define SOCKDEBUG_VERSION "2.1" #define SOCKDEBUG_NAME "SOCKDEBUG" -#define SOCKDEBUG_DATE "12-02-2015" +#define SOCKDEBUG_DATE "07-28-2016" int cleanup_socket(int,char *); diff --git a/update-version b/update-version index 16b95e9..600b311 100755 --- a/update-version +++ b/update-version @@ -10,10 +10,10 @@ else fi # Current version number -CURRENTVERSION=2.1.0b2 +CURRENTVERSION=2.1 # Last date -LASTDATE=12-02-2015 +LASTDATE=07-28-2016 if [ "x$1" = "x" ] then From 6f4d274fe9441575ccaaf98ce0fad9df93016e90 Mon Sep 17 00:00:00 2001 From: "Eric J. Mislivec" Date: Mon, 15 Dec 2014 12:46:22 -0600 Subject: [PATCH 60/73] db/upgrade: Fix a schema version typo. The place in the DB version list for 1.4b9 was 1.4b2 instead. --- db/upgradedb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/upgradedb b/db/upgradedb index 5a87f77..c11fffa 100755 --- a/db/upgradedb +++ b/db/upgradedb @@ -60,7 +60,7 @@ if ($@) { # version is *not* necessarily the same as the software version. Also for # version prior to 2.0.1, the schema version was the same as the software # version and there may not be an upgrade file. -my @schemaversions = ( "1.4b2", "1.4b3", "1.4b4", "1.4b5", "1.4b6", "1.4b7", "1.4b8", "1.4b2", "1.5", "1.5.1", "1.5.2", "2.0.0", "2.0.1" ); +my @schemaversions = ( "1.4b2", "1.4b3", "1.4b4", "1.4b5", "1.4b6", "1.4b7", "1.4b8", "1.4b9", "1.5", "1.5.1", "1.5.2", "2.0.0", "2.0.1" ); # Get current database version my $version; my $legacyversion = $schemaversions[0]; From 06bacf9aab9e5c974bff66a5d6c0200f7baa9c16 Mon Sep 17 00:00:00 2001 From: "Eric J. Mislivec" Date: Mon, 24 Nov 2014 13:22:11 -0600 Subject: [PATCH 61/73] ndo2db: Remove PostgreSQL support stub code. ndo2db only supports MySQL. A Postgres implementation had been started, but never finished. Since our schema and many DB operations (e.g., auto increment, last_insert_id) assume MySQL, and there hasn't been much recent demand to support Postgres; remove the commented configure tests, DB server type conditionals, and documentation references. Removing the server type tests simplifies several chunks of the code, which will make maintaining and tuning the DB code a bit easier. Different storage backends _MAY_ _POSSIBLY_ be supported in the future. The changes in this commit show some (but by no means all) operations identified as DB specific, and may be helpful if implementing a new backend. Conflicts: include/config.h.in src/db.c src/ndo2db.c --- README | 9 +- config/ndo2db.cfg-sample.in | 9 +- configure | 1 - configure.ac | 14 +- db/README | 2 +- docs/docbook/en-en/components.xml | 6 +- docs/docbook/en-en/installation.xml | 2 +- include/config.h.in | 9 +- include/ndo2db.h | 5 - src/db.c | 290 ++++++---------------------- src/dbhandlers.c | 242 ++++++----------------- src/ndo2db.c | 12 +- 12 files changed, 135 insertions(+), 466 deletions(-) diff --git a/README b/README index 3ee357a..9121745 100644 --- a/README +++ b/README @@ -64,9 +64,9 @@ additional utilities: ./configure make -If the configure script is unable to locate your MySQL or PostgreSQL development -libraries, you may need to help it out by using the --with-mysql-lib or ---with-pgsql-lib options. Here's an example: +If the configure script is unable to locate your MySQL development libraries, +you may need to help it out by using the --with-mysql-lib or option. Here's an +example: ./configure --with-mysql-lib=/usr/lib/mysql @@ -79,8 +79,7 @@ INITIALIZING THE SQL DATABASE Before you start using the NDO utilities, you should create the database where you will be storing all Nagios-related information. -NOTE: As of 02/12/2006, only MySQL databases are supported. PostgreSQL support - will likely be added in the future. +NOTE: As of 02/12/2006, only MySQL databases are supported. 1. Create a database for storing the data (e.g. 'nagios') diff --git a/config/ndo2db.cfg-sample.in b/config/ndo2db.cfg-sample.in index e025c7b..eebe30b 100644 --- a/config/ndo2db.cfg-sample.in +++ b/config/ndo2db.cfg-sample.in @@ -69,11 +69,9 @@ use_ssl=0 # DATABASE SERVER TYPE -# This option determines what type of DB server the daemon should -# connect to. +# This option determines what type of DB server the daemon should connect to. # Values: -# mysql = MySQL -# pgsql = PostgreSQL +# mysql = MySQL db_servertype=mysql @@ -89,8 +87,7 @@ db_host=localhost # DATABASE PORT # This option specifies the port that the DB server is running on. # Values: -# 3306 = Default MySQL port -# 5432 = Default PostgreSQL port +# 3306 = Default MySQL port db_port=3306 diff --git a/configure b/configure index ab43fe0..82140d7 100755 --- a/configure +++ b/configure @@ -6232,7 +6232,6 @@ _ACEOF fi fi - save_LDFLAGS="$LDFLAGS" LDFLAGS="${LDFLAGS} ${DBLDFLAGS}" save_CPPFLAGS="$CPPFLAGS" diff --git a/configure.ac b/configure.ac index 3f7331c..e583b06 100644 --- a/configure.ac +++ b/configure.ac @@ -228,11 +228,8 @@ AC_SUBST(MOD_LDFLAGS) dnl DB support options USE_MYSQL=yes -dnl USE_PGSQL=yes AC_ARG_ENABLE(mysql,AC_HELP_STRING([--enable-mysql],[enables MySQL database support])) AS_IF([test x$enable_mysql = xno], [USE_MYSQL=no]) -dnl AC_ARG_ENABLE(pgsql,--enable-pgsql enables PostgreSQL database support) -dnl AS_IF([test x$enable_pgsql = xno], [USE_PGSQL=no]) dnl Are we using any MySQL routines? @@ -271,16 +268,7 @@ if test $USE_MYSQL = yes; then DBLIBS="$DBLIBS $np_mysql_libs" CFLAGS="$CFLAGS $np_mysql_include" fi -fi - -dnl Optional PostgreSQL library and include paths -dnl AC_ARG_WITH(pgsql-lib,AC_HELP_STRING([--with-pgsql-lib=DIR],[sets location of the PostgreSQL client library]),[ -dnl DBLDFLAGS="-L${withval}" -dnl LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}" -dnl ]) -dnl AC_ARG_WITH(pgsql-inc,AC_HELP_STRING([--with-pgsql-inc=DIR],[sets location of the PostgreSQL client include files]),[ -dnl DBCFLAGS="${DBCFLAGS} -I${withval}" -dnl ]) +fi save_LDFLAGS="$LDFLAGS" LDFLAGS="${LDFLAGS} ${DBLDFLAGS}" diff --git a/db/README b/db/README index d7fa2cf..155c6b7 100644 --- a/db/README +++ b/db/README @@ -2,7 +2,7 @@ DATABASE SCRIPTS ================ -Here you'll find scripts to create the necessary database tables for MySQL and PostgreSQL servers. +Here you'll find scripts to create the necessary database tables for MySQL servers. The queries/ subdirectory contains some example SQL queries for fetching data from the DB tables. diff --git a/docs/docbook/en-en/components.xml b/docs/docbook/en-en/components.xml index 3b28996..1b75d29 100644 --- a/docs/docbook/en-en/components.xml +++ b/docs/docbook/en-en/components.xml @@ -146,8 +146,7 @@ NDO2DB The NDO2DB utility is designed to take the data output from the - NDOMOD and LOG2NDO components and store it in a MySQL or PostgreSQL - database. + NDOMOD and LOG2NDO components and store it in a MySQL database. When it starts, the NDO2DB daemon creates either a TCP or Unix domain socket and waits for clients to connect. NDO2DB can run either as a @@ -179,8 +178,5 @@ - - The NDO2DB daemon currently supports only MySQL databases, but - future support for PostgreSQL databases is planned. diff --git a/docs/docbook/en-en/installation.xml b/docs/docbook/en-en/installation.xml index 93f1327..af0e6d4 100644 --- a/docs/docbook/en-en/installation.xml +++ b/docs/docbook/en-en/installation.xml @@ -129,7 +129,7 @@ Initializing the database Currently, the NDOUtils addon only supports MySQL as a database - backed. Support for PostgresQL will likely be added in the future. + backed. If you aren't already using it, I would suggest installing diff --git a/include/config.h.in b/include/config.h.in index a46db49..713ef93 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -261,17 +261,10 @@ typedef int int32_t; #include #endif -#undef USE_PGSQL -#undef HAVE_PGSQL -#ifdef USE_PGSQL -#define HAVE_PGSQL 1 -#include -#endif - #undef HAVE_SYSTEMD #undef HAVE_SSL #undef USE_NANOSLEEP -#endif +#endif \ No newline at end of file diff --git a/include/ndo2db.h b/include/ndo2db.h index 426ecdb..89d08c9 100644 --- a/include/ndo2db.h +++ b/include/ndo2db.h @@ -59,10 +59,6 @@ typedef struct ndo2db_dbconninfo_struct{ MYSQL mysql_conn; MYSQL_RES *mysql_result; MYSQL_ROW mysql_row; -#endif -#ifdef USE_PGSQL - PGconn *pgsql_conn; - PGresult *pgsql_result; #endif unsigned long instance_id; unsigned long conninfo_id; @@ -122,7 +118,6 @@ typedef struct ndo2db_input_data_info_struct{ /*************** DB server types ***************/ #define NDO2DB_DBSERVER_NONE 0 #define NDO2DB_DBSERVER_MYSQL 1 -#define NDO2DB_DBSERVER_PGSQL 2 /*************** misc definitions **************/ diff --git a/src/db.c b/src/db.c index 54d8c9e..4b9339e 100644 --- a/src/db.c +++ b/src/db.c @@ -154,24 +154,10 @@ int ndo2db_db_init(ndo2db_idi *idi){ idi->dbinfo.object_hashlist=NULL; /* initialize db structures, etc. */ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - if(!mysql_init(&idi->dbinfo.mysql_conn)){ - syslog(LOG_USER|LOG_INFO,"Error: mysql_init() failed\n"); - return NDO_ERROR; - } -#endif - break; - case NDO2DB_DBSERVER_PGSQL: -#ifdef USE_PGSQL - idi->dbinfo.pgsql_conn=NULL; - idi->dbinfo.pgsql_result=NULL; -#endif - break; - default: - break; - } + if(!mysql_init(&idi->dbinfo.mysql_conn)){ + syslog(LOG_USER|LOG_INFO,"Error: mysql_init() failed\n"); + return NDO_ERROR; + } return NDO_OK; } @@ -209,43 +195,24 @@ int ndo2db_db_connect(ndo2db_idi *idi){ if(idi->dbinfo.connected==NDO_TRUE) return NDO_OK; - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - if(!mysql_real_connect(&idi->dbinfo.mysql_conn,ndo2db_db_settings.host,ndo2db_db_settings.username,ndo2db_db_settings.password,ndo2db_db_settings.dbname,ndo2db_db_settings.port,NULL,0)){ - - mysql_close(&idi->dbinfo.mysql_conn); - syslog(LOG_USER|LOG_INFO,"Error: Could not connect to MySQL database: %s",mysql_error(&idi->dbinfo.mysql_conn)); - result=NDO_ERROR; - idi->disconnect_client=NDO_TRUE; - } - else{ - idi->dbinfo.connected=NDO_TRUE; - syslog(LOG_USER|LOG_DEBUG,"Successfully connected to MySQL database"); - } -#endif - break; - case NDO2DB_DBSERVER_PGSQL: -#ifdef USE_PGSQL - snprintf(connect_string,sizeof(connect_string)-1,"host='%s' port=%d dbname='%s' user='%s' password='%s'",ndo2db_db_settings.host,ndo2db_db_settings.port,ndo2db_db_settings.dbname,ndo2db_db_settings.username,ndo2db_db_settings.password); - connect_string[sizeof(connect_string)-1]='\x0'; - idi->dbinfo.pgsql_conn=PQconnectdb(connect_string); - - if(PQstatus(idi->dbinfo.pgsql_conn)==CONNECTION_BAD){ - PQfinish(idi->dbinfo.pgsql_conn); - syslog(LOG_USER|LOG_INFO,"Error: Could not connect to PostgreSQL database: %s",PQerrorMessage(idi->dbinfo.pgsql_conn)); - result=NDO_ERROR; - idi->disconnect_client=NDO_TRUE; - } - else{ - idi->dbinfo.connected=NDO_TRUE; - syslog(LOG_USER|LOG_DEBUG,"Successfully connected to PostgreSQL database"); - } -#endif - break; - default: - break; - } + if (!mysql_real_connect( + &idi->dbinfo.mysql_conn, + ndo2db_db_settings.host, + ndo2db_db_settings.username, + ndo2db_db_settings.password, + ndo2db_db_settings.dbname, + ndo2db_db_settings.port, + ndo2db_db_settings.socket, + CLIENT_REMEMBER_OPTIONS + )) { + mysql_close(&idi->dbinfo.mysql_conn); + syslog(LOG_USER|LOG_INFO,"Error: Could not connect to MySQL database: %s",mysql_error(&idi->dbinfo.mysql_conn)); + result=NDO_ERROR; + idi->disconnect_client=NDO_TRUE; + } else { + idi->dbinfo.connected=NDO_TRUE; + syslog(LOG_USER|LOG_DEBUG,"Successfully connected to MySQL database"); + } return result; } @@ -261,27 +228,10 @@ int ndo2db_db_disconnect(ndo2db_idi *idi){ if(idi->dbinfo.connected==NDO_FALSE) return NDO_OK; - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - /* close the connection to the database server */ - mysql_close(&idi->dbinfo.mysql_conn); - idi->dbinfo.connected=NDO_FALSE; - syslog(LOG_USER|LOG_DEBUG,"Successfully disconnected from MySQL database"); -#endif - break; - case NDO2DB_DBSERVER_PGSQL: -#ifdef USE_PGSQL - /* close database connection and cleanup */ - if(PQstatus(idi->dbinfo.pgsql_conn)!=CONNECTION_BAD) - PQfinish(idi->dbinfo.pgsql_conn); - idi->dbinfo.connected=NDO_FALSE; - syslog(LOG_USER|LOG_DEBUG,"Successfully disconnected from PostgreSQL database"); -#endif - break; - default: - break; - } + /* close the connection to the database server */ + mysql_close(&idi->dbinfo.mysql_conn); + idi->dbinfo.connected=NDO_FALSE; + syslog(LOG_USER|LOG_DEBUG,"Successfully disconnected from MySQL database"); return NDO_OK; } @@ -303,22 +253,14 @@ int ndo2db_db_hello(ndo2db_idi *idi){ if(asprintf(&buf,"SELECT instance_id FROM %s WHERE instance_name='%s'",ndo2db_db_tablenames[NDO2DB_DBTABLE_INSTANCES],idi->instance_name)==-1) buf=NULL; if((result=ndo2db_db_query(idi,buf))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); - if((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL){ - ndo2db_convert_string_to_unsignedlong(idi->dbinfo.mysql_row[0],&idi->dbinfo.instance_id); - have_instance=NDO_TRUE; - } - mysql_free_result(idi->dbinfo.mysql_result); - idi->dbinfo.mysql_result=NULL; -#endif - break; - default: - break; - } - } + idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); + if((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL){ + ndo2db_convert_string_to_unsignedlong(idi->dbinfo.mysql_row[0],&idi->dbinfo.instance_id); + have_instance=NDO_TRUE; + } + mysql_free_result(idi->dbinfo.mysql_result); + idi->dbinfo.mysql_result=NULL; + } free(buf); /* insert new instance if necessary */ @@ -326,16 +268,8 @@ int ndo2db_db_hello(ndo2db_idi *idi){ if(asprintf(&buf,"INSERT INTO %s SET instance_name='%s'",ndo2db_db_tablenames[NDO2DB_DBTABLE_INSTANCES],idi->instance_name)==-1) buf=NULL; if((result=ndo2db_db_query(idi,buf))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - idi->dbinfo.instance_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + idi->dbinfo.instance_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); } @@ -354,16 +288,8 @@ int ndo2db_db_hello(ndo2db_idi *idi){ )==-1) buf=NULL; if((result=ndo2db_db_query(idi,buf))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - idi->dbinfo.conninfo_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + idi->dbinfo.conninfo_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(ts); @@ -480,14 +406,8 @@ char *ndo2db_db_escape_string(ndo2db_idi *idi, char *buf){ /* escape characters */ for(x=0,y=0;xdbinfo.server_type==NDO2DB_DBSERVER_MYSQL){ - if(buf[x]=='\'' || buf[x]=='\"' || buf[x]=='*' || buf[x]=='\\' || buf[x]=='$' || buf[x]=='?' || buf[x]=='.' || buf[x]=='^' || buf[x]=='+' || buf[x]=='[' || buf[x]==']' || buf[x]=='(' || buf[x]==')') - newbuf[y++]='\\'; - } - else if(idi->dbinfo.server_type==NDO2DB_DBSERVER_PGSQL){ - if(! (isspace(buf[x]) || isalnum(buf[x]) || (buf[x]=='_')) ) - newbuf[y++]='\\'; - } + if(buf[x]=='\'' || buf[x]=='\"' || buf[x]=='*' || buf[x]=='\\' || buf[x]=='$' || buf[x]=='?' || buf[x]=='.' || buf[x]=='^' || buf[x]=='+' || buf[x]=='[' || buf[x]==']' || buf[x]=='(' || buf[x]==')') + newbuf[y++]='\\'; newbuf[y++]=buf[x]; } @@ -502,22 +422,10 @@ char *ndo2db_db_escape_string(ndo2db_idi *idi, char *buf){ /* SQL query conversion of time_t format to date/time format */ char *ndo2db_db_timet_to_sql(ndo2db_idi *idi, time_t t){ char *buf=NULL; + (void)idi; /* Unused, don't warn. */ + + asprintf(&buf,"FROM_UNIXTIME(%lu)",(unsigned long)t); - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - asprintf(&buf,"FROM_UNIXTIME(%lu)",(unsigned long)t); -#endif - break; - case NDO2DB_DBSERVER_PGSQL: -#ifdef USE_PGSQL - asprintf(&buf,"FROM_UNIXTIME(%lu)",(unsigned long)t); -#endif - break; - default: - break; - } - return buf; } @@ -525,22 +433,10 @@ char *ndo2db_db_timet_to_sql(ndo2db_idi *idi, time_t t){ /* SQL query conversion of date/time format to time_t format */ char *ndo2db_db_sql_to_timet(ndo2db_idi *idi, char *field){ char *buf=NULL; - - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - asprintf(&buf,"UNIX_TIMESTAMP(%s)",(field==NULL)?"":field); -#endif - break; - case NDO2DB_DBSERVER_PGSQL: -#ifdef USE_PGSQL - asprintf(&buf,"UNIX_TIMESTAMP(%s",(field==NULL)?"":field); -#endif - break; - default: - break; - } + (void)idi; /* Unused, don't warn. */ + asprintf(&buf,"UNIX_TIMESTAMP(%s)",(field==NULL)?"":field); + return buf; } @@ -566,29 +462,11 @@ int ndo2db_db_query(ndo2db_idi *idi, char *buf){ ndo2db_log_debug_info(NDO2DB_DEBUGL_SQL,0,"%s\n",buf); - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - if((query_result=mysql_query(&idi->dbinfo.mysql_conn,buf))){ - syslog(LOG_USER|LOG_INFO,"Error: mysql_query() failed for '%s'\n",buf); - syslog(LOG_USER|LOG_INFO,"mysql_error: '%s'\n", mysql_error(&idi->dbinfo.mysql_conn)); - result=NDO_ERROR; - } -#endif - break; - case NDO2DB_DBSERVER_PGSQL: -#ifdef USE_PGSQL - idi->dbinfo.pgsql_result==PQexec(idi->dbinfo.pgsql_conn,buf); - if((query_result=PQresultStatus(idi->dbinfo.pgsql_result))!=PGRES_COMMAND_OK){ - syslog(LOG_USER|LOG_INFO,"Error: PQexec() failed for '%s'\n",buf); - PQclear(idi->dbinfo.pgsql_result); - result=NDO_ERROR; - } -#endif - break; - default: - break; - } + if (mysql_query(&idi->dbinfo.mysql_conn,buf)) { + syslog(LOG_USER|LOG_INFO,"Error: mysql_query() failed for '%s'\n",buf); + syslog(LOG_USER|LOG_INFO,"mysql_error: '%s'\n", mysql_error(&idi->dbinfo.mysql_conn)); + result=NDO_ERROR; + } /* handle errors */ if(result==NDO_ERROR) @@ -604,20 +482,6 @@ int ndo2db_db_free_query(ndo2db_idi *idi){ if(idi==NULL) return NDO_ERROR; - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL -#endif - break; - case NDO2DB_DBSERVER_PGSQL: -#ifdef USE_PGSQL - PQclear(idi->dbinfo.pgsql_result); -#endif - break; - default: - break; - } - return NDO_OK; } @@ -633,30 +497,12 @@ int ndo2db_handle_db_error(ndo2db_idi *idi, int query_result){ if(idi->dbinfo.connected==NDO_FALSE) return NDO_OK; - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - result=mysql_errno(&idi->dbinfo.mysql_conn); - if(result==CR_SERVER_LOST || result==CR_SERVER_GONE_ERROR){ - syslog(LOG_USER|LOG_INFO,"Error: Connection to MySQL database has been lost!\n"); - ndo2db_db_disconnect(idi); - idi->disconnect_client=NDO_TRUE; - } -#endif - break; - case NDO2DB_DBSERVER_PGSQL: -#ifdef USE_PGSQL - result=PQstatus(idi->dbinfo.pgsql_conn); - if(result!=CONNECTION_OK){ - syslog(LOG_USER|LOG_INFO,"Error: Connection to PostgreSQL database has been lost!\n"); - ndo2db_db_disconnect(idi); - idi->disconnect_client=NDO_TRUE; - } -#endif - break; - default: - break; - } + result=mysql_errno(&idi->dbinfo.mysql_conn); + if(result==CR_SERVER_LOST || result==CR_SERVER_GONE_ERROR){ + syslog(LOG_USER|LOG_INFO,"Error: Connection to MySQL database has been lost!\n"); + ndo2db_db_disconnect(idi); + idi->disconnect_client=NDO_TRUE; + } return NDO_OK; } @@ -704,21 +550,13 @@ int ndo2db_db_get_latest_data_time(ndo2db_idi *idi, char *table_name, char *fiel buf=NULL; if((result=ndo2db_db_query(idi,buf))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); - if((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL){ - ndo2db_convert_string_to_unsignedlong(idi->dbinfo.mysql_row[0],t); - } - mysql_free_result(idi->dbinfo.mysql_result); - idi->dbinfo.mysql_result=NULL; -#endif - break; - default: - break; - } - } + idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); + if((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL){ + ndo2db_convert_string_to_unsignedlong(idi->dbinfo.mysql_row[0],t); + } + mysql_free_result(idi->dbinfo.mysql_result); + idi->dbinfo.mysql_result=NULL; + } free(buf); free(ts[0]); diff --git a/src/dbhandlers.c b/src/dbhandlers.c index 88d991e..4698858 100644 --- a/src/dbhandlers.c +++ b/src/dbhandlers.c @@ -120,22 +120,14 @@ int ndo2db_get_object_id(ndo2db_idi *idi, int object_type, char *n1, char *n2, u )==-1) buf=NULL; if((result=ndo2db_db_query(idi,buf))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); - if((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL){ - ndo2db_convert_string_to_unsignedlong(idi->dbinfo.mysql_row[0],object_id); - found_object=NDO_TRUE; - } - mysql_free_result(idi->dbinfo.mysql_result); - idi->dbinfo.mysql_result=NULL; -#endif - break; - default: - break; - } - } + idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); + if((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL){ + ndo2db_convert_string_to_unsignedlong(idi->dbinfo.mysql_row[0],object_id); + found_object=NDO_TRUE; + } + mysql_free_result(idi->dbinfo.mysql_result); + idi->dbinfo.mysql_result=NULL; + } free(buf); /* free memory */ @@ -204,16 +196,8 @@ int ndo2db_get_object_id_with_insert(ndo2db_idi *idi, int object_type, char *n1, )==-1) buf=NULL; if((result=ndo2db_db_query(idi,buf))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - *object_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + *object_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); /* cache object id for later lookups */ @@ -246,32 +230,24 @@ int ndo2db_get_cached_object_ids(ndo2db_idi *idi){ buf=NULL; if((result=ndo2db_db_query(idi,buf))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); - if(NULL != idi->dbinfo.mysql_result) { - while((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL){ - - ndo2db_convert_string_to_unsignedlong(idi->dbinfo.mysql_row[0],&object_id); - ndo2db_convert_string_to_int(idi->dbinfo.mysql_row[1],&objecttype_id); - - /* add object to cached list */ - ndo2db_add_cached_object_id(idi,objecttype_id,idi->dbinfo.mysql_row[2],idi->dbinfo.mysql_row[3],object_id); - } - mysql_free_result(idi->dbinfo.mysql_result); - } - else if(mysql_errno(&idi->dbinfo.mysql_conn) != 0) { - syslog(LOG_USER|LOG_INFO, - "Error: mysql_store_result() failed for '%s'\n", buf); + idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); + if(NULL != idi->dbinfo.mysql_result) { + while((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL){ + + ndo2db_convert_string_to_unsignedlong(idi->dbinfo.mysql_row[0],&object_id); + ndo2db_convert_string_to_int(idi->dbinfo.mysql_row[1],&objecttype_id); + + /* add object to cached list */ + ndo2db_add_cached_object_id(idi,objecttype_id,idi->dbinfo.mysql_row[2],idi->dbinfo.mysql_row[3],object_id); } - idi->dbinfo.mysql_result=NULL; -#endif - break; - default: - break; - } - } + mysql_free_result(idi->dbinfo.mysql_result); + } + else if(mysql_errno(&idi->dbinfo.mysql_conn) != 0) { + syslog(LOG_USER|LOG_INFO, + "Error: mysql_store_result() failed for '%s'\n", buf); + } + idi->dbinfo.mysql_result=NULL; + } free(buf); return result; @@ -562,20 +538,12 @@ int ndo2db_handle_logentry(ndo2db_idi *idi){ )==-1) buf=NULL; if((result=ndo2db_db_query(idi,buf))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); - if((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL) - duplicate_record=NDO_TRUE; - mysql_free_result(idi->dbinfo.mysql_result); - idi->dbinfo.mysql_result=NULL; -#endif - break; - default: - break; - } - } + idi->dbinfo.mysql_result=mysql_store_result(&idi->dbinfo.mysql_conn); + if((idi->dbinfo.mysql_row=mysql_fetch_row(idi->dbinfo.mysql_result))!=NULL) + duplicate_record=NDO_TRUE; + mysql_free_result(idi->dbinfo.mysql_result); + idi->dbinfo.mysql_result=NULL; + } free(buf); /*if(duplicate_record==NDO_TRUE && idi->last_logentry_time!=etime){*/ @@ -1268,16 +1236,8 @@ int ndo2db_handle_notificationdata(ndo2db_idi *idi){ if(type==NEBTYPE_NOTIFICATION_START) idi->dbinfo.last_notification_id=0L; if(result==NDO_OK && type==NEBTYPE_NOTIFICATION_START){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - idi->dbinfo.last_notification_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + idi->dbinfo.last_notification_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -1346,16 +1306,8 @@ int ndo2db_handle_contactnotificationdata(ndo2db_idi *idi){ if(type==NEBTYPE_CONTACTNOTIFICATION_START) idi->dbinfo.last_contact_notification_id=0L; if(result==NDO_OK && type==NEBTYPE_CONTACTNOTIFICATION_START){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - idi->dbinfo.last_contact_notification_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + idi->dbinfo.last_contact_notification_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -3051,16 +3003,8 @@ int ndo2db_handle_configfilevariables(ndo2db_idi *idi, int configfile_type){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - configfile_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + configfile_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -3437,16 +3381,8 @@ int ndo2db_handle_hostdefinition(ndo2db_idi *idi){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - host_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + host_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -3595,16 +3531,8 @@ int ndo2db_handle_hostgroupdefinition(ndo2db_idi *idi){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - group_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + group_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -3853,16 +3781,8 @@ int ndo2db_handle_servicedefinition(ndo2db_idi *idi){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - service_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + service_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -4017,16 +3937,8 @@ int ndo2db_handle_servicegroupdefinition(ndo2db_idi *idi){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - group_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + group_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -4272,16 +4184,8 @@ int ndo2db_handle_hostescalationdefinition(ndo2db_idi *idi){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - escalation_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + escalation_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -4416,16 +4320,8 @@ int ndo2db_handle_serviceescalationdefinition(ndo2db_idi *idi){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - escalation_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + escalation_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -4599,16 +4495,8 @@ int ndo2db_handle_timeperiodefinition(ndo2db_idi *idi){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - timeperiod_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + timeperiod_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -4778,16 +4666,8 @@ int ndo2db_handle_contactdefinition(ndo2db_idi *idi){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - contact_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + contact_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); @@ -4969,16 +4849,8 @@ int ndo2db_handle_contactgroupdefinition(ndo2db_idi *idi){ buf1=NULL; if((result=ndo2db_db_query(idi,buf1))==NDO_OK){ - switch(idi->dbinfo.server_type){ - case NDO2DB_DBSERVER_MYSQL: -#ifdef USE_MYSQL - group_id=mysql_insert_id(&idi->dbinfo.mysql_conn); -#endif - break; - default: - break; - } - } + group_id=mysql_insert_id(&idi->dbinfo.mysql_conn); + } free(buf); free(buf1); diff --git a/src/ndo2db.c b/src/ndo2db.c index 45a851d..3abb7ac 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -203,14 +203,8 @@ int main(int argc, char **argv){ if(ndo2db_db_settings.server_type==NDO2DB_DBSERVER_MYSQL) db_supported=NDO_TRUE; #endif -#ifdef USE_PGSQL - /* PostgreSQL support is not yet done... */ - /* - if(ndo2db_db_settings.server_type==NDO2DB_DBSERVER_PGSQL) - db_supported=NDO_TRUE; - */ -#endif - if(db_supported==NDO_FALSE){ + + if (!db_supported) { printf("Support for the specified database server is either not yet supported, or was not found on your system.\n"); #ifdef HAVE_SSL @@ -423,8 +417,6 @@ int ndo2db_process_config_var(char *arg){ else if(!strcmp(var,"db_servertype")){ if(!strcmp(val,"mysql")) ndo2db_db_settings.server_type=NDO2DB_DBSERVER_MYSQL; - else if(!strcmp(val,"pgsql")) - ndo2db_db_settings.server_type=NDO2DB_DBSERVER_PGSQL; else return NDO_ERROR; } From 92ad9b449eea169e16fdf183c79f1ab117432aca Mon Sep 17 00:00:00 2001 From: "Eric J. Mislivec" Date: Thu, 13 Nov 2014 13:29:12 -0600 Subject: [PATCH 62/73] ndomod: Pad usecs to six digits when printing timevals. Conflicts: src/ndomod.c --- src/ndomod.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ndomod.c b/src/ndomod.c index 8c23c6d..18f011a 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -1362,7 +1362,7 @@ static void ndomod_broker_data_serialize(ndo_dbuf *dbufp, int datatype, ndo_dbuf_strcat(dbufp, temp); break; case BD_TIMEVAL: - snprintf(temp, sizeof(temp)-1, "\n%d=%ld.%ld", bdp->key, + snprintf(temp, sizeof(temp)-1, "\n%d=%ld.%06ld", bdp->key, bdp->value.timestamp.tv_sec, bdp->value.timestamp.tv_usec); temp[sizeof(temp)-1]='\x0'; ndo_dbuf_strcat(dbufp, temp); @@ -3528,7 +3528,7 @@ int ndomod_write_config(int config_type){ /* record start of config dump */ snprintf(temp_buffer,sizeof(temp_buffer)-1 - ,"\n\n%d:\n%d=%s\n%d=%ld.%ld\n%d\n\n" + ,"\n\n%d:\n%d=%s\n%d=%ld.%06ld\n%d\n\n" ,NDO_API_STARTCONFIGDUMP ,NDO_DATA_CONFIGDUMPTYPE ,(config_type==NDOMOD_CONFIG_DUMP_ORIGINAL)?NDO_API_CONFIGDUMP_ORIGINAL:NDO_API_CONFIGDUMP_RETAINED @@ -3549,7 +3549,7 @@ int ndomod_write_config(int config_type){ /* record end of config dump */ snprintf(temp_buffer,sizeof(temp_buffer)-1 - ,"\n\n%d:\n%d=%ld.%ld\n%d\n\n" + ,"\n\n%d:\n%d=%ld.%06ld\n%d\n\n" ,NDO_API_ENDCONFIGDUMP ,NDO_DATA_TIMESTAMP ,now.tv_sec @@ -5251,7 +5251,7 @@ int ndomod_write_main_config_file(void){ gettimeofday(&now,NULL); asprintf(&temp_buffer - ,"\n%d:\n%d=%ld.%ld\n%d=%s\n" + ,"\n%d:\n%d=%ld.%06ld\n%d=%s\n" ,NDO_API_MAINCONFIGFILEVARIABLES ,NDO_DATA_TIMESTAMP ,now.tv_sec @@ -5342,7 +5342,7 @@ int ndomod_write_runtime_variables(void){ gettimeofday(&now,NULL); asprintf(&temp_buffer - ,"\n%d:\n%d=%ld.%ld\n" + ,"\n%d:\n%d=%ld.%06ld\n" ,NDO_API_RUNTIMEVARIABLES ,NDO_DATA_TIMESTAMP ,now.tv_sec From 443ac7c92a8c8b8906921fb6ec4293adb0bc75df Mon Sep 17 00:00:00 2001 From: "Eric J. Mislivec" Date: Tue, 11 Nov 2014 13:17:28 -0600 Subject: [PATCH 63/73] ndomod: Remove resource file dump stub functions. --- include/ndomod.h | 2 -- src/ndomod.c | 41 ++++------------------------------------- 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/include/ndomod.h b/include/ndomod.h index 91aef84..0998aed 100644 --- a/include/ndomod.h +++ b/include/ndomod.h @@ -107,8 +107,6 @@ int ndomod_write_object_config(int); int ndomod_write_config_files(void); int ndomod_write_main_config_file(void); -int ndomod_write_resource_config_files(void); -int ndomod_write_resource_config_file(char *); int ndomod_write_runtime_variables(void); diff --git a/src/ndomod.c b/src/ndomod.c index 18f011a..16d2146 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -5223,19 +5223,10 @@ int ndomod_write_object_config(int config_type){ -/* dumps config files to data sink */ -int ndomod_write_config_files(void){ - int result=NDO_OK; - - if((result=ndomod_write_main_config_file())==NDO_ERROR) - return NDO_ERROR; - - if((result=ndomod_write_resource_config_files())==NDO_ERROR) - return NDO_ERROR; - - return result; - } - +/* Dumps config files to the data sink. */ +int ndomod_write_config_files(void) { + return ndomod_write_main_config_file(); +} /* dumps main config file data to sink */ @@ -5309,30 +5300,6 @@ int ndomod_write_main_config_file(void){ -/* dumps all resource config files to sink */ -int ndomod_write_resource_config_files(void){ - - /* TODO */ - /* loop through main config file to find all resource config files, and then process them */ - /* this should probably NOT be done, as the resource file is supposed to remain private... */ - - return NDO_OK; - } - - - -/* dumps a single resource config file to sink */ -int ndomod_write_resource_config_file(char *filename){ - - /* TODO */ - /* loop through main config file to find all resource config files, and then process them */ - /* this should probably NOT be done, as the resource file is supposed to remain private... */ - - return NDO_OK; - } - - - /* dumps runtime variables to sink */ int ndomod_write_runtime_variables(void){ char *temp_buffer=NULL; From 40faaff95e98b3cb6ba0fc803cebac6f01a63344 Mon Sep 17 00:00:00 2001 From: "Eric J. Mislivec" Date: Thu, 30 Oct 2014 11:14:14 -0500 Subject: [PATCH 64/73] NDOUtils is GPLv2, let's make that explicit. Add a LICENSE and LEGAL statement; update copyright notices; and add copying permission statements to C, configure and make files. --- LEGAL | 27 ++++ LICENSE | 339 +++++++++++++++++++++++++++++++++++++++++++ Makefile.in | 21 ++- configure.ac | 17 +++ include/common.h.in | 24 ++- include/config.h.in | 24 ++- include/db.h | 24 ++- include/dbhandlers.h | 24 ++- include/io.h.in | 24 ++- include/ndo2db.h | 24 ++- include/ndomod.h | 24 ++- include/protoapi.h | 24 ++- include/queue.h | 21 +++ include/utils.h | 23 ++- src/Makefile.in | 21 ++- src/db.c | 24 ++- src/dbhandlers.c | 24 ++- src/file2sock.c | 23 ++- src/io.c | 24 ++- src/log2ndo.c | 26 +++- src/ndo2db.c | 26 +++- src/ndomod.c | 33 ++++- src/queue.c | 21 +++ src/sockdebug.c | 23 ++- src/utils.c | 24 ++- 25 files changed, 806 insertions(+), 103 deletions(-) create mode 100644 LEGAL create mode 100644 LICENSE diff --git a/LEGAL b/LEGAL new file mode 100644 index 0000000..65e2cf8 --- /dev/null +++ b/LEGAL @@ -0,0 +1,27 @@ +NDOUtils - Nagios Data Output Utilities + +Copyright 1999-2009: + Ethan Galstad +Copyright 2009 until further notice: + Nagios Core Development Team and Nagios Community Contributors + +For detailed authorship information, refer to the source control management +history and pay particular attention to commit messages and the THANKS file. + + +NDOUtils is free software: you can redistribute it and/or modify it under the +terms of the GNU General Public License version 2 as published by the Free +Software Foundation. + +NDOUtils 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 +NDOUtils. If not, see . + + +Nagios and the Nagios logo are trademarks, servicemarks, registered trademarks +or registered servicemarks owned by Nagios Enterprises, LLC. All other +trademarks, servicemarks, registered trademarks, and registered servicemarks +are the property of their respective owner(s). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/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. + + + Copyright (C) + + 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. + + , 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/Makefile.in b/Makefile.in index a9676cb..ca001c2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,21 @@ -############################### -# Makefile for NDO +# Makefile for NDOUtils # -# Last Modified: 09-27-2012 -############################### +# Copyright 2009-2014 Nagios Core Development Team and Community Contributors +# Copyright 2005-2009 Ethan Galstad +# +# This file is part of NDOUtils. +# +# NDOUtils is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# NDOUtils 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 NDOUtils. If not, see . # Source code directories diff --git a/configure.ac b/configure.ac index e583b06..d7f33e7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,21 @@ dnl Process this -*-m4-*- file with autoconf to produce a configure script. +dnl +dnl Copyright 2009-2014 Nagios Core Development Team and Community Contributors +dnl Copyright 2005-2009 Ethan Galstad +dnl +dnl This file is part of NDOUtils. +dnl +dnl NDOUtils is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License version 2 as +dnl published by the Free Software Foundation. +dnl +dnl NDOUtils is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with NDOUtils. If not, see . dnl Disable caching define([AC_CACHE_LOAD],) diff --git a/include/common.h.in b/include/common.h.in index c644573..c31c9a3 100644 --- a/include/common.h.in +++ b/include/common.h.in @@ -1,10 +1,24 @@ -/************************************************************************ +/** + * @file common.h NDO common declarations + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * COMMON.H - NDBXT Protocol Definition - * Copyright (c) 2005 Ethan Galstad - * Last Modified: 05-19-2005 + * This file is part of NDOUtils. * - ************************************************************************/ + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #ifndef NDO_COMMON_H_INCLUDED #define NDO_COMMON_H_INCLUDED diff --git a/include/config.h.in b/include/config.h.in index 713ef93..bcd4174 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1,10 +1,24 @@ -/************************************************************************ +/** + * @file config.h ./configure detected defines and includes + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * NDBXT Includes - * Copyright (c) 2005-2007 Ethan Galstad - * Last Modified: 10-19-2007 + * This file is part of NDOUtils. * - ************************************************************************/ + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #ifndef _CONFIG_H #define _CONFIG_H diff --git a/include/db.h b/include/db.h index daddc64..2855636 100644 --- a/include/db.h +++ b/include/db.h @@ -1,10 +1,24 @@ -/************************************************************************ +/** + * @file db.h Database declarations for ndo2db daemon + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * DB.H - NDO Database Include File - * Copyright (c) 2005-2006 Ethan Galstad - * Last Modified: 07-11-2009 + * This file is part of NDOUtils. * - ************************************************************************/ + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #ifndef NDO2DB_DB_H_INCLUDED #define NDO2DB_DB_H_INCLUDED diff --git a/include/dbhandlers.h b/include/dbhandlers.h index 10de523..24f0d45 100644 --- a/include/dbhandlers.h +++ b/include/dbhandlers.h @@ -1,10 +1,24 @@ -/************************************************************************ +/** + * @file dbhandlers.h Database handler declarations for ndo2db daemon + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * DBHANDLERS.H - NDO2DB DB Handler Include File - * Copyright (c) 2005-2006 Ethan Galstad - * Last Modified: 07-11-2009 + * This file is part of NDOUtils. * - ************************************************************************/ + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #ifndef NDO2DB_DBHANDLERS_H_INCLUDED #define NDO2DB_DBHANDLERS_H_INCLUDED diff --git a/include/io.h.in b/include/io.h.in index 888fd5b..704d101 100644 --- a/include/io.h.in +++ b/include/io.h.in @@ -1,10 +1,24 @@ -/************************************************************************ +/** + * @file io.h Common NDO I/O functions + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * IO.H - Common I/O Functions - * Copyright (c) 2005 Ethan Galstad - * Last Modified: 05-19-2005 + * This file is part of NDOUtils. * - ************************************************************************/ + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #ifndef NDO_IO_H_INCLUDED #define NDO_IO_H_INCLUDED diff --git a/include/ndo2db.h b/include/ndo2db.h index 89d08c9..fc64f5b 100644 --- a/include/ndo2db.h +++ b/include/ndo2db.h @@ -1,10 +1,24 @@ -/************************************************************************ +/** + * @file ndo2db.h Nagios Data Output to Database Daemon declarations + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * NDO2DB.H - NDO2DB Include File - * Copyright (c) 2005-2007 Ethan Galstad - * Last Modified: 07-11-2009 + * This file is part of NDOUtils. * - ************************************************************************/ + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #ifndef NDO2DB_NDO2DB_H_INCLUDED #define NDO2DB_NDO2DB_H_INCLUDED diff --git a/include/ndomod.h b/include/ndomod.h index 0998aed..ebb54f9 100644 --- a/include/ndomod.h +++ b/include/ndomod.h @@ -1,10 +1,24 @@ -/************************************************************************ +/** + * @file ndomod.h Nagios Data Output Event Broker Module declarations + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * NDOMOD.H - NDO NEB Module Include File - * Copyright (c) 2005-2006 Ethan Galstad - * Last Modified: 05-25-2006 + * This file is part of NDOUtils. * - ************************************************************************/ + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #ifndef NDO_NDOMOD_H_INCLUDED #define NDO_NDOMOD_H_INCLUDED diff --git a/include/protoapi.h b/include/protoapi.h index 36e0e9f..5f5602b 100644 --- a/include/protoapi.h +++ b/include/protoapi.h @@ -1,10 +1,24 @@ -/************************************************************************ +/** + * @file protoapi.h NDO protocol definition + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * PROTOAPI.H - NDO Protocol Definition - * Copyright (c) 2005-2006 Ethan Galstad - * Last Modified: 09-27-2006 + * This file is part of NDOUtils. * - ************************************************************************/ + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #ifndef NDO_PROTOAPI_H_INCLUDED #define NDO_PROTOAPI_H_INCLUDED diff --git a/include/queue.h b/include/queue.h index 6179b78..5f94e4d 100644 --- a/include/queue.h +++ b/include/queue.h @@ -1,3 +1,24 @@ +/** + * @file queue.h Simple message queue for ndo2db daemon + */ +/* + * Copyright 2012-2014 Nagios Core Development Team and Community Contributors + * + * This file is part of NDOUtils. + * + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ + #ifndef NDO_QUEUE_H_INCLUDED #define NDO_QUEUE_H_INCLUDED diff --git a/include/utils.h b/include/utils.h index f149ba8..0bbfcb3 100644 --- a/include/utils.h +++ b/include/utils.h @@ -1,13 +1,24 @@ -/************************************************************************ +/** + * @file utils.h Miscellaneous common utility functionns for NDO + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * UTILS.H - NDO utilities header file + * This file is part of NDOUtils. * - * Copyright (c) 2009-2012 Nagios Core Development Team and Community Contributors - * Copyright (c) 2005-2008 Ethan Galstad + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Last Modified: 09-27-2012 + * NDOUtils 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 NDOUtils. If not, see . + */ #ifndef NDO_UTILS_H_INCLUDED #define NDO_UTILS_H_INCLUDED diff --git a/src/Makefile.in b/src/Makefile.in index 1f14f85..3ad850d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,8 +1,21 @@ -############################### -# Makefile for NDO +# Makefile for NDOUtils source # -# Last Modified: 09-06-2009 -############################### +# Copyright 2009-2014 Nagios Core Development Team and Community Contributors +# Copyright 2005-2009 Ethan Galstad +# +# This file is part of NDOUtils. +# +# NDOUtils is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# NDOUtils 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 NDOUtils. If not, see . # Source code directories diff --git a/src/db.c b/src/db.c index 4b9339e..f64cd6a 100644 --- a/src/db.c +++ b/src/db.c @@ -1,12 +1,24 @@ -/*************************************************************** - * DB.C - Datatabase routines for NDO2DB daemon +/** + * @file db.c Database routines for ndo2db daemon + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad + * + * This file is part of NDOUtils. * - * Copyright (c) 2009 Nagios Core Development Team and Community Contributors - * Copyright (c) 2005-2009 Ethan Galstad + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - * Last Modified: 07-11-2009 + * NDOUtils 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 NDOUtils. If not, see . + */ /* include our project's header files */ #include "../include/config.h" diff --git a/src/dbhandlers.c b/src/dbhandlers.c index 4698858..a088536 100644 --- a/src/dbhandlers.c +++ b/src/dbhandlers.c @@ -1,12 +1,24 @@ -/*************************************************************** - * DBHANDLERS.C - Data handler routines for NDO2DB daemon +/** + * @file dbhandlers.c Database handler routines for ndo2db daemon + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * Copyright (c) 2009-2012 Nagios Core Development Team and Community Contributors - * Copyright (c) 2005-2009 Ethan Galstad + * This file is part of NDOUtils. * - * Last Modified: 09-27-2012 + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - **************************************************************/ + * NDOUtils 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 NDOUtils. If not, see . + */ /* include our project's header files */ #include "../include/config.h" diff --git a/src/file2sock.c b/src/file2sock.c index e936fec..702b175 100644 --- a/src/file2sock.c +++ b/src/file2sock.c @@ -1,5 +1,9 @@ -/*************************************************************** - * FILE2SOCK.c - File to Socket Dump Utility +/** + * @file file2sock.c File to socket dump utility + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * * Copyright (c) 2009 Nagios Core Development Team and Community Contributors * Copyright (c) 20052-2009 Ethan Galstad @@ -8,7 +12,20 @@ * First Written: 05-13-2005 * Last Modified: 07-28-2016 * - **************************************************************/ + * This file is part of NDOUtils. + * + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #include "../include/config.h" #include "../include/common.h" diff --git a/src/io.c b/src/io.c index 44d4b1c..c5ae5fa 100644 --- a/src/io.c +++ b/src/io.c @@ -1,12 +1,24 @@ -/*************************************************************** - * IO.C - NDO I/O Functions +/** + * @file io.c Common NDO I/O functions + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * Copyright (c) 2009 Nagios Core Development Team and Community Contributors - * Copyright (c) 2005-2006 Ethan Galstad + * This file is part of NDOUtils. * - * First Written: 05-20-2006 + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - **************************************************************/ + * NDOUtils 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 NDOUtils. If not, see . + */ #include "../include/config.h" #include "../include/common.h" diff --git a/src/log2ndo.c b/src/log2ndo.c index 29905af..2837ce8 100644 --- a/src/log2ndo.c +++ b/src/log2ndo.c @@ -1,12 +1,26 @@ -/*************************************************************** - * LOG2NDO.C - Sends archived logs files to NDO2DB daemon - * - * Copyright (c) 2009 Nagios Core Development Team and Community Contributors - * Copyright (c) 2005-2009 Ethan Galstad +/** + * @file log2ndo.c Sends archived logs files to ndo2db daemon + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * * Last Modified: 07-28-2016 * - **************************************************************/ + * This file is part of NDOUtils. + * + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #include "../include/config.h" #include "../include/common.h" diff --git a/src/ndo2db.c b/src/ndo2db.c index 3abb7ac..b78dad0 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -1,13 +1,27 @@ -/*************************************************************** - * NDO2DB.C - NDO To Database Daemon - * - * Copyright (c) 2009 Nagios Core Development Team and Community Contributors - * Copyright (c) 2005-2009 Ethan Galstad +/** + * @file ndo2db.c Nagios Data Output to Database Daemon + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * * First Written: 05-19-2005 * Last Modified: 07-28-2016 * - **************************************************************/ + * This file is part of NDOUtils. + * + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ /*#define DEBUG_MEMORY 1*/ diff --git a/src/ndomod.c b/src/ndomod.c index 16d2146..154176d 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -1,16 +1,35 @@ -/***************************************************************************** +/** + * @file ndomod.c Nagios Data Output Event Broker Module + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * NDOMOD.C - Nagios Data Output Event Broker Module + * Last Modified: 02-28-2014 * - * Copyright (c) 2009-2012 Nagios Core Development Team and Community Contributors - * Copyright (c) 2005-2009 Ethan Galstad + * This file is part of NDOUtils. * * First Written: 05-19-2005 * Last Modified: 07-28-2016 * - * TO DO: Add service parents, hourly value (hosts / services), - * minimum value (contacts) - *****************************************************************************/ + ***************************************************************************** + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ +/** + * @todo Add service parents + * @todo hourly value (hosts / services) + * @todo minimum value (contacts) + */ /* include our project's header files */ #include "../include/common.h" diff --git a/src/queue.c b/src/queue.c index d2764f3..8cb7445 100644 --- a/src/queue.c +++ b/src/queue.c @@ -1,3 +1,24 @@ +/** + * @file queue.c Simple message queue for ndo2db daemon + */ +/* + * Copyright 2012-2014 Nagios Core Development Team and Community Contributors + * + * This file is part of NDOUtils. + * + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ + #include #include #include diff --git a/src/sockdebug.c b/src/sockdebug.c index 8352f58..12e5434 100644 --- a/src/sockdebug.c +++ b/src/sockdebug.c @@ -1,5 +1,9 @@ -/*************************************************************** - * SOCKDEBUG.C - Socket Debugging Utility +/** + * @file sockdebug.c Socket debugging utility + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * * Copyright (c) 2009 Nagios Core Development Team and Community Contributors * Copyright (c) 2005-2009 Ethan Galstad @@ -7,7 +11,20 @@ * First Written: 05-13-2005 * Last Modified: 07-28-2016 * - **************************************************************/ + * This file is part of NDOUtils. + * + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * NDOUtils 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 NDOUtils. If not, see . + */ #include "../include/config.h" diff --git a/src/utils.c b/src/utils.c index 20d0b4c..1067b38 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,12 +1,24 @@ -/*************************************************************** - * UTILS.C - NDO Utils +/** + * @file utils.c Miscellaneous common utility functions for NDO + */ +/* + * Copyright 2009-2014 Nagios Core Development Team and Community Contributors + * Copyright 2005-2009 Ethan Galstad * - * Copyright (c) 2009 Nagios Core Development Team and Community Contributors - * Copyright (c) 2005-2008 Ethan Galstad + * This file is part of NDOUtils. * - * First Written: 01-25-2008 + * NDOUtils is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. * - **************************************************************/ + * NDOUtils 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 NDOUtils. If not, see . + */ #include "../include/config.h" #include "../include/common.h" From 9899d41708e5b878d4b79df3b6a3f1d7d25ab3e0 Mon Sep 17 00:00:00 2001 From: "Eric J. Mislivec" Date: Tue, 28 Oct 2014 16:38:23 -0500 Subject: [PATCH 65/73] Make the MySQL socket path a configurable option. This let's us connect to a local DB with a socket path other than the compiled-in default without having to read options from an options file with mysql_options(). --- config/ndo2db.cfg-sample.in | 15 +++++++++++++++ include/db.h | 1 + src/ndo2db.c | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/config/ndo2db.cfg-sample.in b/config/ndo2db.cfg-sample.in index eebe30b..9c2c98a 100644 --- a/config/ndo2db.cfg-sample.in +++ b/config/ndo2db.cfg-sample.in @@ -93,6 +93,21 @@ db_port=3306 +# DATABASE SOCKET +# This option specifies the path to the socket to use for local DB connections. +# +# MySQL's default location is /tmp/mysql.sock, but /var/lib/mysql/mysql.sock +# is common for RPM distributions, and /var/run/mysqld/mysqld.sock is seen on +# Ubuntu... +# +# You normally do not need to set this option unless you experience connection +# problems with messages in NDO2DB's log like: +# "Can't connect to local MySQL server through socket ..." + +#db_socket=/var/lib/mysql/mysql.sock + + + # DATABASE NAME # This option specifies the name of the database that should be used. diff --git a/include/db.h b/include/db.h index 2855636..48d5ea0 100644 --- a/include/db.h +++ b/include/db.h @@ -30,6 +30,7 @@ typedef struct ndo2db_dbconfig_struct{ int server_type; int port; char *host; + char *socket; char *username; char *password; char *dbname; diff --git a/src/ndo2db.c b/src/ndo2db.c index b78dad0..7a38ad4 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -441,6 +441,10 @@ int ndo2db_process_config_var(char *arg){ else if(!strcmp(var,"db_port")){ ndo2db_db_settings.port=atoi(val); } + else if (!strcmp(var, "db_socket")) { + if(!(ndo2db_db_settings.socket = strdup(val))) + return NDO_ERROR; + } else if(!strcmp(var,"db_user")){ if((ndo2db_db_settings.username=strdup(val))==NULL) return NDO_ERROR; @@ -514,6 +518,7 @@ int ndo2db_initialize_variables(void){ ndo2db_db_settings.server_type=NDO2DB_DBSERVER_NONE; ndo2db_db_settings.host=NULL; ndo2db_db_settings.port=0; + ndo2db_db_settings.socket = NULL; ndo2db_db_settings.username=NULL; ndo2db_db_settings.password=NULL; ndo2db_db_settings.dbname=NULL; @@ -562,6 +567,10 @@ int ndo2db_free_program_memory(void){ free(ndo2db_db_settings.host); ndo2db_db_settings.host=NULL; } + if(ndo2db_db_settings.socket){ + free(ndo2db_db_settings.socket); + ndo2db_db_settings.socket=NULL; + } if(ndo2db_db_settings.username){ free(ndo2db_db_settings.username); ndo2db_db_settings.username=NULL; From bc6088e0dc91f5fe01e023bf1f2e9732a6d438f9 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 29 Jul 2016 10:02:18 -0500 Subject: [PATCH 66/73] Patch situation where db table nagios_logentries has items where `instance_id`,`logentry_time`,`entry_time`,`entry_time_usec` isn't unique enough. --- db/mysql-upgrade-2.1.0.sql | 15 +++++++++++++++ db/mysql.sql | 2 +- db/upgradedb | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 db/mysql-upgrade-2.1.0.sql diff --git a/db/mysql-upgrade-2.1.0.sql b/db/mysql-upgrade-2.1.0.sql new file mode 100644 index 0000000..14a04bb --- /dev/null +++ b/db/mysql-upgrade-2.1.0.sql @@ -0,0 +1,15 @@ +-- BEGIN 2.0.1 MODS + +set @exist := (select count(*) from information_schema.statistics where table_name = 'nagios_logentries' and index_name = 'instance_id'); +set @sqlstmt := if( @exist > 0, 'ALTER TABLE `nagios_logentries` DROP KEY `instance_id`', 'select ''INFO: Index does not exists.'''); +PREPARE stmt FROM @sqlstmt; +EXECUTE stmt; + +ALTER TABLE `nagios_logentries` ADD UNIQUE KEY `instance_id` (`instance_id`,`logentry_time`,`entry_time`,`entry_time_usec`,`logentry_id`); + +-- -------------------------------------------------------- + +-- + +-- END 2.0.1 MODS + diff --git a/db/mysql.sql b/db/mysql.sql index b782df6..a885c36 100644 --- a/db/mysql.sql +++ b/db/mysql.sql @@ -38,7 +38,7 @@ CREATE TABLE IF NOT EXISTS `nagios_acknowledgements` ( `persistent_comment` smallint(6) NOT NULL default '0', `notify_contacts` smallint(6) NOT NULL default '0', PRIMARY KEY (`acknowledgement_id`), - UNIQUE KEY `instance_id` (`instance_id`, `entry_time`, `entry_time_usec`) + UNIQUE KEY `instance_id` (`instance_id`, `entry_time`, `entry_time_usec`, `logentry_id`) ) ENGINE=MyISAM COMMENT='Current and historical host and service acknowledgements'; -- -------------------------------------------------------- diff --git a/db/upgradedb b/db/upgradedb index c11fffa..b23569a 100755 --- a/db/upgradedb +++ b/db/upgradedb @@ -60,7 +60,7 @@ if ($@) { # version is *not* necessarily the same as the software version. Also for # version prior to 2.0.1, the schema version was the same as the software # version and there may not be an upgrade file. -my @schemaversions = ( "1.4b2", "1.4b3", "1.4b4", "1.4b5", "1.4b6", "1.4b7", "1.4b8", "1.4b9", "1.5", "1.5.1", "1.5.2", "2.0.0", "2.0.1" ); +my @schemaversions = ( "1.4b2", "1.4b3", "1.4b4", "1.4b5", "1.4b6", "1.4b7", "1.4b8", "1.4b9", "1.5", "1.5.1", "1.5.2", "2.0.0", "2.0.1", "2.1.0" ); # Get current database version my $version; my $legacyversion = $schemaversions[0]; From 5ae7871e0a84b8e605b7be91c32353475976263f Mon Sep 17 00:00:00 2001 From: "Eric J. Mislivec" Date: Wed, 22 Oct 2014 16:10:15 -0500 Subject: [PATCH 67/73] Truncate all tables we should. A copy-paste error led to logentries, notifications, contactnotifications, contactnotificationmethods and acknowledgements tables not being truncated as advertised, and the last max_*_age configuration value specified for those tables would be used for max_externalcommands_age instead. A typo in the ndo2db.cfg sample used the wrong variable names for max_contactnotifications_age and max_contactnotificationmethods_age, so these would never have been recognized by ndo2db. Finally, the trimming statements for notifications, contactnotifications and contactnotificationmethods used the wrong column. This commit fixes these bugs, and adds a syslog to record when tables are trimmed. --- config/ndo2db.cfg-sample.in | 4 +-- src/db.c | 62 ++++++++++++++++++++++++------------- src/ndo2db.c | 27 +++++++++++----- 3 files changed, 63 insertions(+), 30 deletions(-) diff --git a/config/ndo2db.cfg-sample.in b/config/ndo2db.cfg-sample.in index 9c2c98a..5de4d3f 100644 --- a/config/ndo2db.cfg-sample.in +++ b/config/ndo2db.cfg-sample.in @@ -164,10 +164,10 @@ max_externalcommands_age=44640 max_notifications_age=44640 # Keep contactnotifications for 31 days -max_contactnotifications=44640 +max_contactnotifications_age=44640 # Keep contactnotificationmethods for 31 days -max_contactnotificationmethods=44640 +max_contactnotificationmethods_age=44640 # Keep logentries for 90 days max_logentries_age=129600 diff --git a/src/db.c b/src/db.c index f64cd6a..414ef4d 100644 --- a/src/db.c +++ b/src/db.c @@ -611,33 +611,53 @@ int ndo2db_db_perform_maintenance(ndo2db_idi *idi){ time(¤t_time); /* trim tables */ - if(((unsigned long)current_time-60)>(unsigned long)idi->dbinfo.last_table_trim_time){ - if(idi->dbinfo.max_timedevents_age>0L) + if ((current_time-(time_t)60)>idi->dbinfo.last_table_trim_time) { + if (idi->dbinfo.max_timedevents_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming timedevents."); ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_TIMEDEVENTS],"scheduled_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_timedevents_age)); - if(idi->dbinfo.max_systemcommands_age>0L) + } + if (idi->dbinfo.max_systemcommands_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming systemcommands."); ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_SYSTEMCOMMANDS],"start_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_systemcommands_age)); - if(idi->dbinfo.max_servicechecks_age>0L) + } + if (idi->dbinfo.max_servicechecks_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming servicechecks."); ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_SERVICECHECKS],"start_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_servicechecks_age)); - if(idi->dbinfo.max_hostchecks_age>0L) + } + if (idi->dbinfo.max_hostchecks_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming hostchecks."); ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_HOSTCHECKS],"start_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_hostchecks_age)); - if(idi->dbinfo.max_eventhandlers_age>0L) + } + if (idi->dbinfo.max_eventhandlers_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming eventhandlers."); ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_EVENTHANDLERS],"start_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_eventhandlers_age)); - if(idi->dbinfo.max_externalcommands_age>0L) + } + if (idi->dbinfo.max_externalcommands_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming externalcommands."); ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_EXTERNALCOMMANDS],"entry_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_externalcommands_age)); - if(idi->dbinfo.max_notifications_age>0L) - ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_NOTIFICATIONS],"entry_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_notifications_age)); - - if(idi->dbinfo.max_contactnotifications_age>0L) - ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTNOTIFICATIONS],"entry_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_contactnotifications_age)); - if(idi->dbinfo.max_contactnotificationmethods_age>0L) - ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTNOTIFICATIONMETHODS],"entry_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_contactnotificationmethods_age)); - if(idi->dbinfo.max_logentries_age>0L) + } + if (idi->dbinfo.max_notifications_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming notifications."); + ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_NOTIFICATIONS],"start_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_notifications_age)); + } + if (idi->dbinfo.max_contactnotifications_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming contactnotifications."); + ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTNOTIFICATIONS],"start_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_contactnotifications_age)); + } + if (idi->dbinfo.max_contactnotificationmethods_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming contactnotificationmethods."); + ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONTACTNOTIFICATIONMETHODS],"start_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_contactnotificationmethods_age)); + } + if (idi->dbinfo.max_logentries_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming logentries."); ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_LOGENTRIES],"entry_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_logentries_age)); - if(idi->dbinfo.max_acknowledgements_age>0L) - ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_ACKNOWLEDGEMENTS],"entry_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_acknowledgements_age)); - - idi->dbinfo.last_table_trim_time=current_time; - } + } + if (idi->dbinfo.max_acknowledgements_age>0L) { + syslog(LOG_USER|LOG_INFO,"Trimming acknowledgements."); + ndo2db_db_trim_data_table(idi,ndo2db_db_tablenames[NDO2DB_DBTABLE_ACKNOWLEDGEMENTS],"entry_time",(time_t)((unsigned long)current_time-idi->dbinfo.max_acknowledgements_age)); + } + idi->dbinfo.last_table_trim_time=current_time; + } return NDO_OK; - } +} diff --git a/src/ndo2db.c b/src/ndo2db.c index 7a38ad4..657a0ad 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -461,28 +461,41 @@ int ndo2db_process_config_var(char *arg){ if((ndo2db_db_settings.dbprefix=strdup(val))==NULL) return NDO_ERROR; } + else if(!strcmp(var,"max_timedevents_age")) ndo2db_db_settings.max_timedevents_age=strtoul(val,NULL,0)*60; + else if(!strcmp(var,"max_systemcommands_age")) ndo2db_db_settings.max_systemcommands_age=strtoul(val,NULL,0)*60; + else if(!strcmp(var,"max_servicechecks_age")) ndo2db_db_settings.max_servicechecks_age=strtoul(val,NULL,0)*60; + else if(!strcmp(var,"max_hostchecks_age")) ndo2db_db_settings.max_hostchecks_age=strtoul(val,NULL,0)*60; + else if(!strcmp(var,"max_eventhandlers_age")) ndo2db_db_settings.max_eventhandlers_age=strtoul(val,NULL,0)*60; + else if(!strcmp(var,"max_externalcommands_age")) ndo2db_db_settings.max_externalcommands_age=strtoul(val,NULL,0)*60; + else if(!strcmp(var,"max_logentries_age")) - ndo2db_db_settings.max_externalcommands_age=strtoul(val,NULL,0)*60; + ndo2db_db_settings.max_logentries_age=strtoul(val,NULL,0)*60; + else if(!strcmp(var,"max_notifications_age")) - ndo2db_db_settings.max_externalcommands_age=strtoul(val,NULL,0)*60; - else if(!strcmp(var,"max_contactnotifications_age")) - ndo2db_db_settings.max_externalcommands_age=strtoul(val,NULL,0)*60; - else if(!strcmp(var,"max_contactnotificationmethods_age")) - ndo2db_db_settings.max_externalcommands_age=strtoul(val,NULL,0)*60; + ndo2db_db_settings.max_notifications_age=strtoul(val,NULL,0)*60; + + else if(!strcmp(var,"max_contactnotifications") || !strcmp(var,"max_contactnotifications_age")) + /* Accept max_contactnotifications too (a typo in old configs). */ + ndo2db_db_settings.max_contactnotifications_age=strtoul(val,NULL,0)*60; + + else if(!strcmp(var,"max_contactnotificationmethods") || !strcmp(var,"max_contactnotificationmethods_age")) + /* Accept max_contactnotificationmethods too (a typo in old configs). */ + ndo2db_db_settings.max_contactnotificationmethods_age=strtoul(val,NULL,0)*60; + else if(!strcmp(var,"max_acknowledgements_age")) - ndo2db_db_settings.max_externalcommands_age=strtoul(val,NULL,0)*60; + ndo2db_db_settings.max_acknowledgements_age=strtoul(val,NULL,0)*60; else if(!strcmp(var,"ndo2db_user")) ndo2db_user=strdup(val); From 0c2e7d7816a10ba81a45ab649b3d652c84c4f86f Mon Sep 17 00:00:00 2001 From: "Eric J. Mislivec" Date: Mon, 27 Oct 2014 15:12:06 -0500 Subject: [PATCH 68/73] .gitignore and 'make distclean' all build artifacts. --- .gitignore | 4 +++- Makefile.in | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ca8e986..6828447 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -autom4te.cache Makefile +autom4te.cache/ config.log config.status uninstall @@ -12,6 +12,8 @@ include/io.h config/*.cfg config/*.cfg-sample +docs/docbook/en-en/Makefile + nbproject/ CVS/ diff --git a/Makefile.in b/Makefile.in index ca001c2..d881144 100644 --- a/Makefile.in +++ b/Makefile.in @@ -209,6 +209,7 @@ distclean: clean rm -f startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init rm -f Makefile rm -f tags + rm -rf autom4te.cache/ devclean: distclean From 8ce650f99bd0321ded0b4da094cd56eb2cc13783 Mon Sep 17 00:00:00 2001 From: "Eric J. Mislivec" Date: Mon, 3 Nov 2014 10:17:48 -0600 Subject: [PATCH 69/73] ndomod: Free memory allocated for config options. Memory allocated for config string options wasn't being freed on module unload, leading to small leaks on Core reloads. Fix this and touch up the *_deinit() functions. --- include/ndomod.h | 1 + src/ndomod.c | 41 ++++++++++++++++++----------------------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/include/ndomod.h b/include/ndomod.h index ebb54f9..590e9af 100644 --- a/include/ndomod.h +++ b/include/ndomod.h @@ -90,6 +90,7 @@ int ndomod_write_to_logs(char *,int); int ndomod_process_module_args(char *); int ndomod_process_config_var(char *); int ndomod_process_config_file(char *); +static void ndomod_free_config_memory(void); int ndomod_open_sink(void); int ndomod_close_sink(void); diff --git a/src/ndomod.c b/src/ndomod.c index 154176d..54882f2 100644 --- a/src/ndomod.c +++ b/src/ndomod.c @@ -206,20 +206,13 @@ int nebmodule_init(int flags, char *args, void *handle){ } -/* this function gets called when the module is unloaded by the event broker */ -int nebmodule_deinit(int flags, int reason){ - char temp_buffer[NDOMOD_MAX_BUFLEN]; - - /* do some shutdown stuff... */ +/* Shutdown and release our resources when the module is unloaded. */ +int nebmodule_deinit(int flags, int reason) { + char msg[] = "ndomod: Shutdown complete."; /* A message for the core log. */ ndomod_deinit(); - - /* log a message to the Nagios log file */ - snprintf(temp_buffer,sizeof(temp_buffer)-1,"ndomod: Shutdown complete.\n"); - temp_buffer[sizeof(temp_buffer)-1]='\x0'; - ndomod_write_to_logs(temp_buffer,NSLOG_INFO_MESSAGE); - + ndomod_write_to_logs(msg, NSLOG_INFO_MESSAGE); return 0; - } +} @@ -303,24 +296,19 @@ int ndomod_init(void){ } -/* performs some shutdown stuff */ -int ndomod_deinit(void){ - - /* deregister callbacks */ +/* Shutdown and release our resources when the module is unloaded. */ +int ndomod_deinit(void) { ndomod_deregister_callbacks(); - /* save unprocessed data to buffer file */ ndomod_save_unprocessed_data(ndomod_buffer_file); - - /* clear sink buffer */ ndomod_sink_buffer_deinit(&sinkbuf); - - /* close data sink */ ndomod_goodbye_sink(); ndomod_close_sink(); + ndomod_free_config_memory(); + return NDO_OK; - } +} @@ -578,8 +566,15 @@ int ndomod_process_config_var(char *arg){ } */ return NDO_OK; - } +} +/* Frees any memory allocated for config options. */ +static void ndomod_free_config_memory(void) { + my_free(ndomod_instance_name); + my_free(ndomod_sink_name); + my_free(ndomod_sink_rotation_command); + my_free(ndomod_buffer_file); +} /****************************************************************************/ From 7785c73ab2a7adfa4bd57b8a403b62ec6a4fa5a3 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 29 Jul 2016 10:34:16 -0500 Subject: [PATCH 70/73] Update Changelog --- Changelog | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index f46b2ff..dacb038 100644 --- a/Changelog +++ b/Changelog @@ -2,7 +2,7 @@ NDO Utils Changelog =================== -2.1.0 - ??/??/???? +2.1.0 - 2016-08-?? ------------------ * Probable fix for ndo2db not responding & growing queue issue (John Frickson) * Got rid of uninitialized variable used for sleep() and increased the listen backlog (John Frickson) @@ -15,6 +15,13 @@ NDO Utils Changelog * Have the parent process wait until the lock file is written (David Michael) * Accept a socket fd passed from systemd (David Michael) * Cross-platform changes (John Frickson) +* Remove PostgreSQL support stub code (Eric Mislivec) +* db/upgrade: Fix a schema version typo (Eric Mislivec) +* Pad usecs to six digits when printing timevals (Eric Mislivec) +* Make the MySQL socket path a configurable option (Eric Mislivec) +* Patch situation where db table nagios_logentries has items where `instance_id`,`logentry_time`,`entry_time`,`entry_time_usec` isn't unique enough. - (Scott Wilkerson) +* Truncate all tables we should (Eric Mislivec) +* Free memory allocated for config options (Eric Mislivec) From faa70e404a3d75eb75b4ca933cc9982525e20c94 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 29 Jul 2016 11:52:35 -0500 Subject: [PATCH 71/73] Set ndo2db_group variable with the ./configure user id, not group id --- config/ndo2db.cfg-sample.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ndo2db.cfg-sample.in b/config/ndo2db.cfg-sample.in index 5de4d3f..0db35d4 100644 --- a/config/ndo2db.cfg-sample.in +++ b/config/ndo2db.cfg-sample.in @@ -19,7 +19,7 @@ lock_file=@localstatedir@/ndo2db.pid # You can specify a number (uid/gid) or a name for either option. ndo2db_user=@ndo2db_user@ -ndo2db_group=@ndo2db_user@ +ndo2db_group=@ndo2db_group@ From 69812fadaa745935e8a2e3bd32d358dad0c2cf2e Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 29 Jul 2016 11:54:26 -0500 Subject: [PATCH 72/73] Backward compare for no forking --- src/ndo2db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ndo2db.c b/src/ndo2db.c index 657a0ad..bca1739 100644 --- a/src/ndo2db.c +++ b/src/ndo2db.c @@ -750,7 +750,7 @@ int ndo2db_daemonize(void){ } /* fork (maybe) */ - if(ndo2db_no_fork == NDO_TRUE) { + if(ndo2db_no_fork != NDO_TRUE) { if((pid=fork())<0){ perror("Fork error"); From 660dc69836fb978abab2b41ffae43e61c4294f26 Mon Sep 17 00:00:00 2001 From: "John C. Frickson" Date: Fri, 29 Jul 2016 12:03:04 -0500 Subject: [PATCH 73/73] Updated Changelog --- Changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog b/Changelog index dacb038..d6b4165 100644 --- a/Changelog +++ b/Changelog @@ -2,7 +2,7 @@ NDO Utils Changelog =================== -2.1.0 - 2016-08-?? +2.1.0 - 2016-08-01 ------------------ * Probable fix for ndo2db not responding & growing queue issue (John Frickson) * Got rid of uninitialized variable used for sleep() and increased the listen backlog (John Frickson)