diff -Naur check_mk-1.2.3i6/livestatus.src/aclocal.m4 livestatus.working/aclocal.m4 --- check_mk-1.2.3i6/livestatus.src/aclocal.m4 2013-10-31 11:23:01.000000000 +0100 +++ livestatus.working/aclocal.m4 2013-11-21 15:51:29.000000000 +0100 @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, -[m4_warning([this file was generated for autoconf 2.67. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],, +[m4_warning([this file was generated for autoconf 2.63. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) diff -Naur check_mk-1.2.3i6/livestatus.src/AUTHORS livestatus.working/AUTHORS --- check_mk-1.2.3i6/livestatus.src/AUTHORS 1970-01-01 01:00:00.000000000 +0100 +++ livestatus.working/AUTHORS 2013-11-21 15:51:13.000000000 +0100 @@ -0,0 +1,11 @@ +This is a fork of MK Livestatus, part of Check_MK, that is being maintained +by op5. See http://op5.org to learn more about us. + +Check_MK was invented and implemented by Mathias Kettner +. + +Currently Check_MK is being developed by the Mathias Kettner GmbH +with some contributions by the community (mainly checks). + +Please have a look at http://mathias-kettner.de or +http://mathias-kettner.com, if you want to learn more about us. diff -Naur check_mk-1.2.3i6/livestatus.src/config.h.in livestatus.working/config.h.in --- check_mk-1.2.3i6/livestatus.src/config.h.in 2013-10-31 11:23:02.000000000 +0100 +++ livestatus.working/config.h.in 2013-11-21 15:51:30.000000000 +0100 @@ -145,9 +145,6 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME -/* Define to the home page for this package. */ -#undef PACKAGE_URL - /* Define to the version of this package. */ #undef PACKAGE_VERSION diff -Naur check_mk-1.2.3i6/livestatus.src/configure livestatus.working/configure --- check_mk-1.2.3i6/livestatus.src/configure 2013-10-31 11:23:03.000000000 +0100 +++ livestatus.working/configure 2013-11-21 15:51:39.000000000 +0100 @@ -1,24 +1,20 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for MK Livestatus 1.2.3i6. +# Generated by GNU Autoconf 2.63 for MK Livestatus 1.2.0p3. # # Report bugs to . # -# # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# +# 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 @@ -26,15 +22,23 @@ 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 @@ -42,13 +46,7 @@ as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -59,7 +57,7 @@ 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\\(.*\\)"`;; @@ -82,6 +80,13 @@ } 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 @@ -91,15 +96,15 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( +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 ;; @@ -111,16 +116,12 @@ 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 -# 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 || : +# 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 done PS1='$ ' PS2='> ' @@ -132,300 +133,330 @@ LANGUAGE=C export LANGUAGE +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + # CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +$as_unset CDPATH + 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 + if (eval ":") 2>/dev/null; then + as_have_required=yes else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac + as_have_required=no 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; } + + 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 +} 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" - 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 +if as_func_success; then + : else - as_have_required=no + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : +if as_func_ret_success; then + : else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false + 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; } +") 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=. - as_found=: - case $as_dir in #( + 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 + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" 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 : - # 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. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi + 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 +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: mk@mathias-kettner.de about your system, including any -$0: error possibly output before this message. Then install -$0: a modern shell, or manually run the script under such a -$0: shell if you do have one." - fi - exit 1 -fi fi + + +: +_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 + 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_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 -} # as_fn_mkdir_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 - }' +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append + exitcode=1 + echo as_func_ret_success failed. +fi -# 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=$(( $* )) - }' +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 - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith + exitcode=1 + echo positional parameters were not saved. +fi +test $exitcode = 0) || { (exit 1); exit 1; } -# 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_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; } -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr +_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 - as_expr=false + exitcode=1 + echo as_func_success failed. fi -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : else - as_basename=false + exitcode=1 + echo as_func_ret_success failed. fi -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname +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 - as_dirname=false + exitcode=1 + echo positional parameters were not saved. fi -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` +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. +} -# 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_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. :-) + 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/= @@ -442,7 +473,8 @@ 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; } + { $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 @@ -452,18 +484,29 @@ exit } -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=' ';; + +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 @@ -493,7 +536,7 @@ rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' + as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false @@ -512,10 +555,10 @@ if test -d "$1"; then test -d "$1/."; else - case $1 in #( + case $1 in -*)set "./$1";; esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' @@ -529,11 +572,11 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -test -n "$DJDIR" || exec 7<&0 &1 + +exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -548,14 +591,14 @@ subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='MK Livestatus' PACKAGE_TARNAME='mk-livestatus' -PACKAGE_VERSION='1.2.3i6' -PACKAGE_STRING='MK Livestatus 1.2.3i6' +PACKAGE_VERSION='1.2.0p3' +PACKAGE_STRING='MK Livestatus 1.2.0p3' PACKAGE_BUGREPORT='mk@mathias-kettner.de' -PACKAGE_URL='' ac_unique_file="config.h.in" # Factoring default headers for most tests. @@ -679,7 +722,6 @@ program_transform_name prefix exec_prefix -PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION @@ -766,9 +808,8 @@ fi case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -813,7 +854,8 @@ 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_fn_error $? "invalid feature name: $ac_useropt" + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -839,7 +881,8 @@ 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_fn_error $? "invalid feature name: $ac_useropt" + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1043,7 +1086,8 @@ 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_fn_error $? "invalid package name: $ac_useropt" + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1059,7 +1103,8 @@ 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_fn_error $? "invalid package name: $ac_useropt" + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1089,17 +1134,17 @@ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" + -*) { $as_echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1116,13 +1161,15 @@ if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" + { $as_echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1145,7 +1192,8 @@ [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" + { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' @@ -1159,8 +1207,8 @@ 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 + $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 @@ -1175,9 +1223,11 @@ ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" + { $as_echo "$as_me: error: working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } # Find the source files, if location was not specified. @@ -1216,11 +1266,13 @@ fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" + { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1246,7 +1298,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures MK Livestatus 1.2.3i6 to adapt to many kinds of systems. +\`configure' configures MK Livestatus 1.2.0p3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1260,7 +1312,7 @@ --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 @@ -1312,7 +1364,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of MK Livestatus 1.2.3i6:";; + short | recursive ) echo "Configuration of MK Livestatus 1.2.0p3:";; esac cat <<\_ACEOF @@ -1329,7 +1381,7 @@ 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 (Objective) C/C++ preprocessor flags, e.g. -I if + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CC C compiler command CFLAGS C compiler flags @@ -1401,708 +1453,136 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -MK Livestatus configure 1.2.3i6 -generated by GNU Autoconf 2.67 +MK Livestatus configure 1.2.0p3 +generated by GNU Autoconf 2.63 -Copyright (C) 2010 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. _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. -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval +It was created by MK Livestatus $as_me 1.2.0p3, which was +generated by GNU Autoconf 2.63. Invocation command line was -} # ac_fn_c_try_compile + $ $0 $@ -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () +_ACEOF +exec 5>>config.log { - 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 || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## - 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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval +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` -} # ac_fn_c_try_link +/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_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 +/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_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval +_ASUNAME -} # ac_fn_c_try_cpp +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_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 +} >&5 - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval +cat >&5 <<_ACEOF -} # 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 "test \"\${$3+set}\"" = set; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; 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; } +## ----------- ## +## Core tests. ## +## ----------- ## -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ------------------------------------ ## -## Report this to mk@mathias-kettner.de ## -## ------------------------------------ ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} -} # ac_fn_c_check_header_compile +# 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; } -# 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 "test \"\${$3+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +# 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 -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_type - -# ac_fn_c_find_intX_t LINENO BITS VAR -# ----------------------------------- -# Finds a signed integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_intX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -$as_echo_n "checking for int$2_t... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in int$2_t 'int' 'long int' \ - 'long long int' 'short int' 'signed char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main () -{ -static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) - < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - case $ac_type in #( - int$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -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 - if eval test \"x\$"$3"\" = x"no"; then : - -else - break -fi - done -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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_find_intX_t - -# ac_fn_c_find_uintX_t LINENO BITS VAR -# ------------------------------------ -# Finds an unsigned integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_uintX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - case $ac_type in #( - uint$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : - -else - break -fi - done -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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_find_uintX_t - -# 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 "test \"\${$3+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_func -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by MK Livestatus $as_me 1.2.3i6, which was -generated by GNU Autoconf 2.67. 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 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# 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 "## ---------------- ## + cat <<\_ASBOX +## ---------------- ## ## Cache variables. ## -## ---------------- ##" +## ---------------- ## +_ASBOX echo # The following way of writing the cache mishandles newlines in values, ( @@ -2111,13 +1591,13 @@ 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 + *_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= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; + *) $as_unset $ac_var ;; esac ;; esac done @@ -2136,9 +1616,11 @@ ) echo - $as_echo "## ----------------- ## + cat <<\_ASBOX +## ----------------- ## ## Output variables. ## -## ----------------- ##" +## ----------------- ## +_ASBOX echo for ac_var in $ac_subst_vars do @@ -2151,9 +1633,11 @@ echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + cat <<\_ASBOX +## ------------------- ## ## File substitutions. ## -## ------------------- ##" +## ------------------- ## +_ASBOX echo for ac_var in $ac_subst_files do @@ -2167,9 +1651,11 @@ fi if test -s confdefs.h; then - $as_echo "## ----------- ## + cat <<\_ASBOX +## ----------- ## ## confdefs.h. ## -## ----------- ##" +## ----------- ## +_ASBOX echo cat confdefs.h echo @@ -2183,39 +1669,37 @@ exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal + 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 -$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" +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF @@ -2224,12 +1708,7 @@ 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 + 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 @@ -2240,23 +1719,19 @@ 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 + 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" \ - || { { $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 ; } + . "$ac_site_file" fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; @@ -2264,7 +1739,7 @@ esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 + { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -2279,11 +1754,11 @@ 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:$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:$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=: ;; ,);; @@ -2293,17 +1768,17 @@ 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:$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:$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:$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:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac @@ -2315,20 +1790,43 @@ esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; + *) ac_configure_args="$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:$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:$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 + { { $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 -## -------------------- ## -## Main body of script. ## -## -------------------- ## + + + + + + + + + + + + + + + + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -2356,7 +1854,9 @@ 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 + { { $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, @@ -2382,10 +1882,10 @@ # 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 "$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 : +if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2393,11 +1893,11 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2434,7 +1934,7 @@ ;; esac - done +done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir @@ -2450,7 +1950,7 @@ INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -2461,7 +1961,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 @@ -2472,11 +1972,15 @@ ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; + { { $as_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5 +$as_echo "$as_me: error: unsafe absolute working directory name" >&2;} + { (exit 1); exit 1; }; };; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; + { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5 +$as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;} + { (exit 1); exit 1; }; };; esac # Do `set' in a subshell so we don't clobber the current shell's @@ -2498,8 +2002,11 @@ # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } fi test "$2" = conftest.file @@ -2508,10 +2015,13 @@ # Ok. : else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +$as_echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +{ $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" @@ -2539,7 +2049,7 @@ am_missing_run="$MISSING --run " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 + { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi @@ -2560,9 +2070,9 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if test "${ac_cv_prog_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -2573,24 +2083,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 + { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2600,9 +2110,9 @@ ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $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_STRIP+set}" = set; then : +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -2613,24 +2123,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2639,7 +2149,7 @@ 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:$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 @@ -2652,10 +2162,10 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then : + if test "${ac_cv_path_mkdir+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2663,7 +2173,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do + for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( @@ -2675,12 +2185,11 @@ esac done done - done +done IFS=$as_save_IFS fi - test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else @@ -2688,10 +2197,11 @@ # value for MKDIR_P 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. + test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" @@ -2704,9 +2214,9 @@ 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 "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : +if test "${ac_cv_prog_AWK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -2717,24 +2227,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 + { $as_echo "$as_me:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2742,11 +2252,11 @@ test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +{ $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 eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : +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 @@ -2754,7 +2264,7 @@ all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +# 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;; @@ -2764,11 +2274,11 @@ rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2788,7 +2298,9 @@ am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } fi fi @@ -2804,7 +2316,7 @@ # Define the identity of the package. PACKAGE='mk-livestatus' - VERSION='1.2.3i6' + VERSION='1.2.0p3' cat >>confdefs.h <<_ACEOF @@ -2863,9 +2375,9 @@ 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 "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if test "${ac_cv_prog_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -2876,24 +2388,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 + { $as_echo "$as_me:$LINENO: result: $CXX" >&5 $as_echo "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2907,9 +2419,9 @@ 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 "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -2920,24 +2432,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2950,7 +2462,7 @@ 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:$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 @@ -2961,31 +2473,48 @@ fi fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +$as_echo "$as_me:$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" +{ (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:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err +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=$? - 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: \$? = $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 confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3001,8 +2530,8 @@ # 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; } +{ $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: @@ -3018,17 +2547,17 @@ done rm -f $ac_rmfiles -if { { ac_try="$ac_link_default" +if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_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:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + $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, @@ -3045,7 +2574,7 @@ # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -3064,41 +2593,84 @@ else 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 + +{ $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:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C++ compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ { $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 -{ $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 +# 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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +# 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" +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_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:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + $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 @@ -3113,83 +2685,32 @@ esac done else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:$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 ; } +{ { $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 conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 + +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 -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C++ compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +{ $as_echo "$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 : +if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3201,17 +2722,17 @@ } _ACEOF rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" +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_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:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + $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 @@ -3224,23 +2745,31 @@ $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:$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 ; } +{ { $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:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +{ $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:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +{ $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_cxx_compiler_gnu+set}" = set; then : +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3254,16 +2783,37 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +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_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - ac_compiler_gnu=no + $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_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes @@ -3272,16 +2822,20 @@ fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then : +if test "${ac_cv_prog_cxx_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3292,11 +2846,35 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +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_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CXXFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3307,12 +2885,36 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - +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_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3323,17 +2925,42 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +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_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS @@ -3367,7 +2994,7 @@ .PHONY: am__doit END # If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= @@ -3395,12 +3022,12 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi @@ -3420,9 +3047,9 @@ depcc="$CXX" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -3530,7 +3157,7 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +{ $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type @@ -3553,9 +3180,9 @@ 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 "$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 : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3566,24 +3193,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3593,9 +3220,9 @@ 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 "$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 : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3606,24 +3233,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:$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 "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3632,7 +3259,7 @@ 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:$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 @@ -3646,9 +3273,9 @@ 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 "$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 : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3659,24 +3286,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3686,9 +3313,9 @@ 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 "$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 : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3700,18 +3327,18 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then @@ -3730,10 +3357,10 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3745,9 +3372,9 @@ 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 "$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 : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3758,24 +3385,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3789,9 +3416,9 @@ 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 "$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 : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3802,24 +3429,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:$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 "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3832,7 +3459,7 @@ 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:$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 @@ -3843,42 +3470,62 @@ fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +test -z "$CC" && { { $as_echo "$as_me:$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 ; } +{ { $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:${as_lineno-$LINENO}: checking for C compiler version" >&5 +$as_echo "$as_me:$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" +{ (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:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err +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=$? - 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: \$? = $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); } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +{ $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 : +if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3892,16 +3539,37 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 - ac_compiler_gnu=no + $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:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +{ $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 @@ -3910,16 +3578,20 @@ 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 "$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 : +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 confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3930,11 +3602,35 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + $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 @@ -3945,12 +3641,36 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - +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 - ac_c_werror_flag=$ac_save_c_werror_flag + $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 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3961,17 +3681,42 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +{ $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 @@ -3988,14 +3733,18 @@ CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +{ $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 : +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 confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -4052,11 +3801,34 @@ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + 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 -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break +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 @@ -4065,19 +3837,17 @@ # 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 "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 + { $as_echo "$as_me:$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 "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac -if test "x$ac_cv_prog_cc_c89" != xno; then : -fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4087,9 +3857,9 @@ depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -4197,7 +3967,7 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type @@ -4215,9 +3985,9 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if test "${ac_cv_prog_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -4228,24 +3998,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 + { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4255,9 +4025,9 @@ ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $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_RANLIB+set}" = set; then : +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -4268,24 +4038,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + 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_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4294,7 +4064,7 @@ 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:$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 @@ -4315,14 +4085,19 @@ # Checks for libraries. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 + +{ $as_echo "$as_me:$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 test "${ac_cv_lib_socket_socket+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -4340,18 +4115,43 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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 ac_cv_lib_socket_socket=yes else - ac_cv_lib_socket_socket=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_socket_socket=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 +{ $as_echo "$as_me:$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" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF @@ -4360,14 +4160,19 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 + +{ $as_echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 $as_echo_n "checking for connect in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_connect+set}" = set; then : +if test "${ac_cv_lib_socket_connect+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -4385,18 +4190,43 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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 ac_cv_lib_socket_connect=yes else - ac_cv_lib_socket_connect=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_socket_connect=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 $as_echo "$ac_cv_lib_socket_connect" >&6; } -if test "x$ac_cv_lib_socket_connect" = x""yes; then : +if test "x$ac_cv_lib_socket_connect" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF @@ -4405,14 +4235,19 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for shutdown in -lsocket" >&5 + +{ $as_echo "$as_me:$LINENO: checking for shutdown in -lsocket" >&5 $as_echo_n "checking for shutdown in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_shutdown+set}" = set; then : +if test "${ac_cv_lib_socket_shutdown+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -4430,18 +4265,43 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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 ac_cv_lib_socket_shutdown=yes else - ac_cv_lib_socket_shutdown=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_socket_shutdown=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_shutdown" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_shutdown" >&5 $as_echo "$ac_cv_lib_socket_shutdown" >&6; } -if test "x$ac_cv_lib_socket_shutdown" = x""yes; then : +if test "x$ac_cv_lib_socket_shutdown" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF @@ -4452,15 +4312,24 @@ # Checks for header files. + + + + + ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval "test \"\${$as_ac_Header+set}\"" = set; then : +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_hdr> @@ -4474,17 +4343,41 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 - eval "$as_ac_Header=no" + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval ac_res=\$$as_ac_Header - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +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; } -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +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_hdr" | $as_tr_cpp` 1 _ACEOF @@ -4495,13 +4388,17 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 + { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +if test "${ac_cv_search_opendir+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -4526,39 +4423,70 @@ ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + 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 ac_cv_search_opendir=$ac_res +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_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_opendir+set}" = set; then break fi done -if test "${ac_cv_search_opendir+set}" = set; then : - +if test "${ac_cv_search_opendir+set}" = set; then + : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : +if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 + { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +if test "${ac_cv_search_opendir+set}" = set; then $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -4583,27 +4511,54 @@ ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + 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 ac_cv_search_opendir=$ac_res +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_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_opendir+set}" = set; then break fi done -if test "${ac_cv_search_opendir+set}" = set; then : - +if test "${ac_cv_search_opendir+set}" = set; then + : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : +if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi @@ -4615,14 +4570,14 @@ 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 "$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 : + if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -4637,7 +4592,11 @@ # 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 + 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 @@ -4646,34 +4605,78 @@ #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +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.i conftest.$ac_ext + +rm -f conftest.err 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 + 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_fn_c_try_cpp "$LINENO"; then : +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.i conftest.$ac_ext + +rm -f conftest.err 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 : +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then break fi @@ -4685,7 +4688,7 @@ else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -4696,7 +4699,11 @@ # 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 + 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 @@ -4705,40 +4712,87 @@ #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +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.i conftest.$ac_ext + +rm -f conftest.err 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 + 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_fn_c_try_cpp "$LINENO"; then : +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.i conftest.$ac_ext + +rm -f conftest.err 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 : - +rm -f 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:$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 ; } +{ { $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 @@ -4748,9 +4802,9 @@ 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 "$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 : +if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4761,7 +4815,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + 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 @@ -4781,7 +4835,7 @@ $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 + 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" @@ -4796,24 +4850,26 @@ $ac_path_GREP_found && break 3 done 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 + { { $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 else ac_cv_path_GREP=$GREP fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +{ $as_echo "$as_me:$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 "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +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 @@ -4827,7 +4883,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + 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 @@ -4847,7 +4903,7 @@ $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 + 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" @@ -4862,10 +4918,12 @@ $ac_path_EGREP_found && break 3 done 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 + { { $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 else ac_cv_path_EGREP=$EGREP @@ -4873,17 +4931,21 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +{ $as_echo "$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 : +if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -4898,23 +4960,48 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 - ac_cv_header_stdc=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no 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 confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - + $EGREP "memchr" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -4924,14 +5011,18 @@ 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 + 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 "free" >/dev/null 2>&1; then : - + $EGREP "free" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -4941,10 +5032,14 @@ if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then : else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -4971,31 +5066,64 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - +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 + : else - ac_cv_header_stdc=no + $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 -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +{ $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 -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +{ $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 : +if test "${ac_cv_header_sys_wait_h+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -5016,63 +5144,297 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 else - ac_cv_header_sys_wait_h=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_sys_wait_h=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_sys_wait_h" >&5 +{ $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 -$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_WAIT_H 1 +_ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$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 -done -for ac_header in arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h stdlib.h string.h strings.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.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 -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 -$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } -if test "${ac_cv_header_stdbool_h+set}" = set; then : + +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 confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +$ac_includes_default -#include -#ifndef bool +#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 + +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 + +done + + + + + + + + + + + + + + + + +for ac_header in arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h stdlib.h string.h strings.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.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 + $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;; +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 +fi + +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; } + +# 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 + + ac_header_preproc=no +fi + +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;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to mk@mathias-kettner.de ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&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 + $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; } + +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 + +fi + +done + + +# Checks for typedefs, structures, and compiler characteristics. +{ $as_echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if test "${ac_cv_header_stdbool_h+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 +#ifndef bool "error: bool is not defined" #endif #ifndef false @@ -5148,17 +5510,131 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_stdbool_h=yes else - ac_cv_header_stdbool_h=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdbool_h=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_stdbool_h" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } -ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" -if test "x$ac_cv_type__Bool" = x""yes; then : +{ $as_echo "$as_me:$LINENO: checking for _Bool" >&5 +$as_echo_n "checking for _Bool... " >&6; } +if test "${ac_cv_type__Bool+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type__Bool=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 (_Bool)) + 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 ((_Bool))) + 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__Bool=yes +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__Bool" >&5 +$as_echo "$ac_cv_type__Bool" >&6; } +if test "x$ac_cv_type__Bool" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 @@ -5169,16 +5645,22 @@ if test $ac_cv_header_stdbool_h = yes; then -$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_STDBOOL_H 1 +_ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +{ $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 : +if test "${ac_cv_c_const+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -5238,29 +5720,56 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 else - ac_cv_c_const=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 "$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 "#define const /**/" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define const /**/ +_ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +{ $as_echo "$as_me:$LINENO: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then : +if test "${ac_cv_c_inline+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; @@ -5269,17 +5778,41 @@ #endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_inline=$ac_kw +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 test "$ac_cv_c_inline" != no && break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } + case $ac_cv_c_inline in inline | yes) ;; *) @@ -5295,42 +5828,438 @@ ;; esac -ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" -case $ac_cv_c_int32_t in #( - no|yes) ;; #( - *) -cat >>confdefs.h <<_ACEOF -#define int32_t $ac_cv_c_int32_t + { $as_echo "$as_me:$LINENO: checking for int32_t" >&5 +$as_echo_n "checking for int32_t... " >&6; } +if test "${ac_cv_c_int32_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_int32_t=no + for ac_type in 'int32_t' 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" -case $ac_cv_c_int64_t in #( - no|yes) ;; #( - *) +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 * !(0 < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 1))]; +test_array [0] = 0 -cat >>confdefs.h <<_ACEOF -#define int64_t $ac_cv_c_int64_t + ; + 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 - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = x""yes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int +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 - -fi - -ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = x""yes; then : - +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 * !(($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 1) + < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 2))]; +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 + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + case $ac_type in + int32_t) ac_cv_c_int32_t=yes ;; + *) ac_cv_c_int32_t=$ac_type ;; +esac + +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 + test "$ac_cv_c_int32_t" != no && break + done +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_int32_t" >&5 +$as_echo "$ac_cv_c_int32_t" >&6; } + case $ac_cv_c_int32_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int32_t $ac_cv_c_int32_t +_ACEOF +;; + esac + + + { $as_echo "$as_me:$LINENO: checking for int64_t" >&5 +$as_echo_n "checking for int64_t... " >&6; } +if test "${ac_cv_c_int64_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_int64_t=no + for ac_type in 'int64_t' 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; 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 * !(0 < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1))]; +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 + 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 * !(($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1) + < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 2))]; +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 + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + case $ac_type in + int64_t) ac_cv_c_int64_t=yes ;; + *) ac_cv_c_int64_t=$ac_type ;; +esac + +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 + test "$ac_cv_c_int64_t" != no && break + done +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_int64_t" >&5 +$as_echo "$ac_cv_c_int64_t" >&6; } + case $ac_cv_c_int64_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int64_t $ac_cv_c_int64_t +_ACEOF +;; + esac + +{ $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 + $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 +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_size_t" >&5 +$as_echo "$ac_cv_type_size_t" >&6; } +if test "x$ac_cv_type_size_t" = x""yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +{ $as_echo "$as_me:$LINENO: checking for ssize_t" >&5 +$as_echo_n "checking for ssize_t... " >&6; } +if test "${ac_cv_type_ssize_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_ssize_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 (ssize_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 ((ssize_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_ssize_t=yes +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_ssize_t" >&5 +$as_echo "$ac_cv_type_ssize_t" >&6; } +if test "x$ac_cv_type_ssize_t" = x""yes; then + : else cat >>confdefs.h <<_ACEOF @@ -5339,12 +6268,16 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +{ $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 : +if test "${ac_cv_header_time+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -5359,27 +6292,113 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 else - ac_cv_header_time=no + $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 "$as_me:$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 +cat >>confdefs.h <<\_ACEOF +#define TIME_WITH_SYS_TIME 1 +_ACEOF fi -ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" -case $ac_cv_c_uint32_t in #( + + { $as_echo "$as_me:$LINENO: checking for uint32_t" >&5 +$as_echo_n "checking for uint32_t... " >&6; } +if test "${ac_cv_c_uint32_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_uint32_t=no + for ac_type in 'uint32_t' 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; 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 * !(($ac_type) -1 >> (32 - 1) == 1)]; +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 + case $ac_type in + uint32_t) ac_cv_c_uint32_t=yes ;; + *) ac_cv_c_uint32_t=$ac_type ;; +esac + +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 + test "$ac_cv_c_uint32_t" != no && break + done +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint32_t" >&5 +$as_echo "$ac_cv_c_uint32_t" >&6; } + case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) -$as_echo "#define _UINT32_T 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _UINT32_T 1 +_ACEOF cat >>confdefs.h <<_ACEOF @@ -5388,12 +6407,75 @@ ;; esac -ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" -case $ac_cv_c_uint64_t in #( + + { $as_echo "$as_me:$LINENO: checking for uint64_t" >&5 +$as_echo_n "checking for uint64_t... " >&6; } +if test "${ac_cv_c_uint64_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_uint64_t=no + for ac_type in 'uint64_t' 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; 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 * !(($ac_type) -1 >> (64 - 1) == 1)]; +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 + case $ac_type in + uint64_t) ac_cv_c_uint64_t=yes ;; + *) ac_cv_c_uint64_t=$ac_type ;; +esac + +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 + test "$ac_cv_c_uint64_t" != no && break + done +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint64_t" >&5 +$as_echo "$ac_cv_c_uint64_t" >&6; } + case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) -$as_echo "#define _UINT64_T 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _UINT64_T 1 +_ACEOF cat >>confdefs.h <<_ACEOF @@ -5404,27 +6486,170 @@ # Checks for library functions. + for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = x""yes; then : +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 + $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;; +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 +fi + +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; } + +# 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 + + ac_header_preproc=no +fi + +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;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to mk@mathias-kettner.de ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&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 + $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; } + +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 HAVE_STDLIB_H 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +{ $as_echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then : +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then ac_cv_func_malloc_0_nonnull=no else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include @@ -5440,58 +6665,235 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +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_func_malloc_0_nonnull=yes else - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + $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_func_malloc_0_nonnull=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 +fi + + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 0 +_ACEOF + + case " $LIBOBJS " in + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" + ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define malloc rpl_malloc +_ACEOF + +fi + + + + +for ac_header in stdlib.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 + $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;; +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 +fi + +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; } + +# 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 + ac_header_preproc=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h - -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; +# 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;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to mk@mathias-kettner.de ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; esac - - -$as_echo "#define malloc rpl_malloc" >>confdefs.h - +{ $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 + 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; } - -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = x""yes; then : +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 HAVE_STDLIB_H 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 +{ $as_echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } -if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then : +if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then ac_cv_func_realloc_0_nonnull=no else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include @@ -5507,24 +6909,55 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +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_func_realloc_0_nonnull=yes else - ac_cv_func_realloc_0_nonnull=no + $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_func_realloc_0_nonnull=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } -if test $ac_cv_func_realloc_0_nonnull = yes; then : +if test $ac_cv_func_realloc_0_nonnull = yes; then -$as_echo "#define HAVE_REALLOC 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_REALLOC 1 +_ACEOF else - $as_echo "#define HAVE_REALLOC 0" >>confdefs.h + cat >>confdefs.h <<\_ACEOF +#define HAVE_REALLOC 0 +_ACEOF case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; @@ -5533,16 +6966,158 @@ esac -$as_echo "#define realloc rpl_realloc" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define realloc rpl_realloc +_ACEOF fi + + + for ac_header in sys/select.h sys/socket.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 : +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 + $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;; +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 +fi + +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; } + +# 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 + + ac_header_preproc=no +fi + +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;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to mk@mathias-kettner.de ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&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 + $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; } + +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 @@ -5551,15 +7126,19 @@ done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5 +{ $as_echo "$as_me:$LINENO: checking types of arguments for select" >&5 $as_echo_n "checking types of arguments for select... " >&6; } -if test "${ac_cv_func_select_args+set}" = set; then : +if test "${ac_cv_func_select_args+set}" = set; then $as_echo_n "(cached) " >&6 else for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_SELECT_H @@ -5579,9 +7158,32 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 +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 done done @@ -5590,7 +7192,7 @@ : ${ac_cv_func_select_args='int,int *,struct timeval *'} fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5 $as_echo "$ac_cv_func_select_args" >&6; } ac_save_IFS=$IFS; IFS=',' set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` @@ -5613,12 +7215,16 @@ rm -f conftest* -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +{ $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 "${ac_cv_type_signal+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -5631,14 +7237,35 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 else - ac_cv_type_signal=void + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF @@ -5646,25 +7273,29 @@ _ACEOF -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 -$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } -if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then : +{ $as_echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 +$as_echo_n "checking whether lstat dereferences a symlink specified with a trailing slash... " >&6; } +if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then ac_cv_func_lstat_dereferences_slashed_symlink=no else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; - /* Linux will dereference the symlink and fail, as required by POSIX. + /* Linux will dereference the symlink and fail. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; @@ -5672,15 +7303,42 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +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_func_lstat_dereferences_slashed_symlink=yes else - ac_cv_func_lstat_dereferences_slashed_symlink=no + $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_func_lstat_dereferences_slashed_symlink=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + else # If the `ln -s' command failed, then we probably don't even # have an lstat function. @@ -5689,7 +7347,7 @@ rm -f conftest.sym conftest.file fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && @@ -5699,7 +7357,7 @@ _ACEOF -if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then +if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" @@ -5708,57 +7366,186 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 -$as_echo_n "checking whether stat accepts an empty string... " >&6; } -if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_stat_empty_string_bug=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default +{ $as_echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 +$as_echo_n "checking whether stat accepts an empty string... " >&6; } +if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_stat_empty_string_bug=yes +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + return stat ("", &sbuf) == 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_func_stat_empty_string_bug=no +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_func_stat_empty_string_bug=yes +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 + + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5 +$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } +if test $ac_cv_func_stat_empty_string_bug = yes; then + case " $LIBOBJS " in + *" stat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS stat.$ac_objext" + ;; +esac + + +cat >>confdefs.h <<_ACEOF +#define HAVE_STAT_EMPTY_STRING_BUG 1 +_ACEOF + +fi + + + + + + + + + + + +for ac_func in bzero gettimeofday memmove regcomp select socket strcasecmp strdup strerror strtoul +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 () { -struct stat sbuf; - return stat ("", &sbuf) == 0; +return $ac_func (); ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_stat_empty_string_bug=no +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 - ac_cv_func_stat_empty_string_bug=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_var=no" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 -$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } -if test $ac_cv_func_stat_empty_string_bug = yes; then - case " $LIBOBJS " in - *" stat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS stat.$ac_objext" - ;; -esac - - -cat >>confdefs.h <<_ACEOF -#define HAVE_STAT_EMPTY_STRING_BUG 1 -_ACEOF +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi - -for ac_func in bzero gettimeofday memmove regcomp select socket strcasecmp strdup strerror strtoul -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 : +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 @@ -5796,13 +7583,13 @@ 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 + *_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= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; + *) $as_unset $ac_var ;; esac ;; esac done @@ -5810,8 +7597,8 @@ (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" @@ -5834,11 +7621,11 @@ if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 + { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi @@ -5852,15 +7639,14 @@ ac_libobjs= ac_ltlibobjs= -U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -5876,30 +7662,41 @@ fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi if test -z "${HAVE_DIET_TRUE}" && test -z "${HAVE_DIET_FALSE}"; then - as_fn_error $? "conditional \"HAVE_DIET\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_DIET\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"HAVE_DIET\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -5909,18 +7706,17 @@ debug=false ac_cs_recheck=false ac_cs_silent=false - SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_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 @@ -5928,15 +7724,23 @@ 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 @@ -5944,13 +7748,7 @@ as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -5961,7 +7759,7 @@ 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\\(.*\\)"`;; @@ -5984,6 +7782,13 @@ } 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 @@ -5993,15 +7798,15 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( +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 ;; @@ -6013,16 +7818,12 @@ 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 -# 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 || : +# 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 done PS1='$ ' PS2='> ' @@ -6034,89 +7835,7 @@ LANGUAGE=C export LANGUAGE -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - +# Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -6130,12 +7849,8 @@ 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\(//\)$' \| \ @@ -6155,25 +7870,76 @@ } s/.*/./; q'` -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits +# 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 ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( +case `echo -n x` in -n*) - case `echo 'xy\c'` in + case `echo 'x\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=' ';; + *) 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 @@ -6202,56 +7968,8 @@ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' + as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false @@ -6270,10 +7988,10 @@ if test -d "$1"; then test -d "$1/."; else - case $1 in #( + case $1 in -*)set "./$1";; esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' @@ -6288,19 +8006,13 @@ exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to +# 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 MK Livestatus $as_me 1.2.3i6, which was -generated by GNU Autoconf 2.67. Invocation command line was +This file was extended by MK Livestatus $as_me 1.2.0p3, which was +generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6332,15 +8044,13 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. +\`$as_me' instantiates files from templates according to the +current configuration. -Usage: $0 [OPTION]... [TAG]... +Usage: $0 [OPTION]... [FILE]... -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 @@ -6359,17 +8069,16 @@ Configuration commands: $config_commands -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -MK Livestatus config.status 1.2.3i6 -configured by $0, generated by GNU Autoconf 2.67, - with options \\"\$ac_cs_config\\" +MK Livestatus config.status 1.2.0p3 +configured by $0, generated by GNU Autoconf 2.63, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -6387,16 +8096,11 @@ 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 @@ -6410,29 +8114,27 @@ ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; esac - as_fn_append CONFIG_FILES " '$ac_optarg'" + CONFIG_FILES="$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 - as_fn_append CONFIG_HEADERS " '$ac_optarg'" + CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; + { $as_echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ @@ -6440,10 +8142,11 @@ ac_cs_silent=: ;; # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; + -*) { $as_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; - *) as_fn_append ac_config_targets " $1" + *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac @@ -6499,7 +8202,9 @@ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) { { $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; }; };; esac done @@ -6526,7 +8231,7 @@ trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 - trap 'as_fn_exit 1' 1 2 13 15 + trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. @@ -6537,7 +8242,11 @@ { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +} || +{ + $as_echo "$as_me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -6545,13 +8254,7 @@ if test -n "$CONFIG_FILES"; then -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi +ac_cr=' ' 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' @@ -6568,18 +8271,24 @@ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` + { { $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 '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + { { $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_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + { { $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; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -6601,7 +8310,7 @@ t delim :nl h -s/\(.\{148\}\)..*/\1/ +s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -6615,7 +8324,7 @@ t nl :delim h -s/\(.\{148\}\)..*/\1/ +s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p @@ -6668,28 +8377,22 @@ else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 + || { { $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; }; } _ACEOF -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// s/^[^=]*=[ ]*$// }' fi @@ -6717,7 +8420,9 @@ if test -z "$ac_t"; then break elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + { { $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; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -6802,7 +8507,9 @@ _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 + { { $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; }; } fi # test -n "$CONFIG_HEADERS" @@ -6815,7 +8522,9 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :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; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -6843,10 +8552,12 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + { { $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; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" + ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't @@ -6857,7 +8568,7 @@ `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 + { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. @@ -6870,7 +8581,9 @@ case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + || { { $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; }; } ;; esac ;; esac @@ -6898,7 +8611,47 @@ q } s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p + { 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; }; }; } ac_builddir=. case "$ac_dir" in @@ -6955,6 +8708,7 @@ # 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 @@ -6964,11 +8718,12 @@ /@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:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 + { $as_echo "$as_me:$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 @@ -6978,7 +8733,7 @@ s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF @@ -7007,22 +8762,26 @@ $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + || { { $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; }; } 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:${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:$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" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + || { { $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; }; } ;; :H) # @@ -7033,19 +8792,25 @@ $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + || { { $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:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 + { $as_echo "$as_me:$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_fn_error $? "could not create $ac_file" "$LINENO" 5 + || { { $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; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 + || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 +$as_echo "$as_me: error: could not create -" >&2;} + { (exit 1); exit 1; }; } fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" @@ -7083,7 +8848,7 @@ s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 + :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -7178,7 +8943,47 @@ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p + { as_dir=$dirpart/$fdir + 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; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done @@ -7190,12 +8995,15 @@ done # for ac_tag -as_fn_exit 0 +{ (exit 0); exit 0; } _ACEOF +chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + { { $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; }; } # configure is writing to config.log, and then calls config.status. @@ -7216,10 +9024,10 @@ exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 + $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff -Naur check_mk-1.2.3i6/livestatus.src/configure.ac livestatus.working/configure.ac --- check_mk-1.2.3i6/livestatus.src/configure.ac 2013-10-31 11:19:10.000000000 +0100 +++ livestatus.working/configure.ac 2013-11-21 15:51:13.000000000 +0100 @@ -27,8 +27,8 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ(2.61) -AC_INIT([MK Livestatus], [1.2.3i6], [mk@mathias-kettner.de]) +AC_PREREQ(2.59) +AC_INIT([MK Livestatus], [1.2.0p3], [mk@mathias-kettner.de]) AM_INIT_AUTOMAKE([-Wall foreign]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADER([config.h]) diff -Naur check_mk-1.2.3i6/livestatus.src/COPYING livestatus.working/COPYING --- check_mk-1.2.3i6/livestatus.src/COPYING 1970-01-01 01:00:00.000000000 +0100 +++ livestatus.working/COPYING 2013-11-21 15:51:13.000000000 +0100 @@ -0,0 +1,341 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, 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 Library 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) 19yy + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, 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) 19yy 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 Library General +Public License instead of this License. diff -Naur check_mk-1.2.3i6/livestatus.src/depcomp livestatus.working/depcomp --- check_mk-1.2.3i6/livestatus.src/depcomp 2012-10-04 15:12:37.000000000 +0200 +++ livestatus.working/depcomp 2010-11-11 01:38:37.000000000 +0100 @@ -1,10 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2007-03-29.01 +scriptversion=2009-04-28.21; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software -# Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free +# Software Foundation, Inc. # 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 @@ -17,9 +17,7 @@ # 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. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -87,6 +85,15 @@ depmode=dashmstdout fi +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u="sed s,\\\\\\\\,/,g" + depmode=msvisualcpp +fi + case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what @@ -192,14 +199,14 @@ ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' -' ' ' >> $depfile - echo >> $depfile +' ' ' >> "$depfile" + echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile + >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -328,7 +335,12 @@ if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. - sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi @@ -404,7 +416,7 @@ # Remove the call to Libtool. if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do + while test "X$1" != 'X--mode=compile'; do shift done shift @@ -455,32 +467,39 @@ "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do + while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift - cleared=no - for arg in "$@"; do + cleared=no eat=no + for arg + do case $cleared in no) set ""; shift cleared=yes ;; esac + if test $eat = yes; then + eat=no + continue + fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done - obj_suffix="`echo $object | sed 's/^.*\././'`" + obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" @@ -500,7 +519,7 @@ # Remove the call to Libtool. if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do + while test "X$1" != 'X--mode=compile'; do shift done shift @@ -538,13 +557,27 @@ msvisualcpp) # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. + # always write the preprocessed file to stdout. "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + IFS=" " for arg do case "$arg" in + -o) + shift + ;; + $object) + shift + ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift @@ -557,16 +590,23 @@ ;; esac done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + none) exec "$@" ;; @@ -585,5 +625,6 @@ # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff -Naur check_mk-1.2.3i6/livestatus.src/install-sh livestatus.working/install-sh --- check_mk-1.2.3i6/livestatus.src/install-sh 2012-10-04 15:12:37.000000000 +0200 +++ livestatus.working/install-sh 2010-11-11 01:38:37.000000000 +0100 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2006-12-25.00 +scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -515,5 +515,6 @@ # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff -Naur check_mk-1.2.3i6/livestatus.src/Makefile.in livestatus.working/Makefile.in --- check_mk-1.2.3i6/livestatus.src/Makefile.in 2013-10-31 11:23:02.000000000 +0100 +++ livestatus.working/Makefile.in 2013-11-21 15:51:41.000000000 +0100 @@ -22,7 +22,7 @@ # | | |___| | | | __/ (__| < | | | | . \ | # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | # | | -# | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +# | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | # +------------------------------------------------------------------+ # # This file is part of Check_MK. @@ -56,10 +56,10 @@ PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . -DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/configure config.guess config.sub depcomp \ - install-sh ltmain.sh missing + $(top_srcdir)/configure AUTHORS COPYING depcomp install-sh \ + missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -163,7 +163,6 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ @@ -526,7 +525,7 @@ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod u+w $(distdir) + chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) diff -Naur check_mk-1.2.3i6/livestatus.src/missing livestatus.working/missing --- check_mk-1.2.3i6/livestatus.src/missing 2012-10-04 15:12:37.000000000 +0200 +++ livestatus.working/missing 2010-11-11 01:38:37.000000000 +0100 @@ -1,10 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2006-05-10.23 +scriptversion=2009-04-28.21; # UTC -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -18,9 +18,7 @@ # 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. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -89,6 +87,9 @@ tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + Send bug reports to ." exit $? ;; @@ -106,15 +107,22 @@ esac +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect -# the program). +# the program). This is about non-GNU programs, so use $1 not +# $program. case $1 in - lex|yacc) + lex*|yacc*) # Not GNU programs, they don't have --version. ;; - tar) + tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 @@ -138,7 +146,7 @@ # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. -case $1 in +case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if @@ -148,7 +156,7 @@ touch aclocal.m4 ;; - autoconf) + autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the @@ -157,7 +165,7 @@ touch configure ;; - autoheader) + autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want @@ -187,7 +195,7 @@ while read f; do touch "$f"; done ;; - autom4te) + autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the @@ -210,7 +218,7 @@ fi ;; - bison|yacc) + bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package @@ -240,7 +248,7 @@ fi ;; - lex|flex) + lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package @@ -263,7 +271,7 @@ fi ;; - help2man) + help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the @@ -277,11 +285,11 @@ else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" - exit 1 + exit $? fi ;; - makeinfo) + makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -310,7 +318,7 @@ touch $file ;; - tar) + tar*) shift # We have already tried tar in the generic part. @@ -363,5 +371,6 @@ # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff -Naur check_mk-1.2.3i6/livestatus.src/README livestatus.working/README --- check_mk-1.2.3i6/livestatus.src/README 1970-01-01 01:00:00.000000000 +0100 +++ livestatus.working/README 2013-11-21 15:51:13.000000000 +0100 @@ -0,0 +1,61 @@ +This is a fork of Mattias Kettner's mk_livestatus. It has been ported to +Nagios 4 and contains some extra features such as sorting and page offsets. +This branch is being maintained by op5 until such a time comes when everything +we need has been merged back upstream. + +To find out more about mk_livestatus, see + http://mathias-kettner.de/checkmk_livestatus.html + +=== Differences between mk_livestatus and op5 fork of livestatus === + +Three additions to Livesetatus Query Language is added: + +----- +Sort: + +Sorts the result set by the specified column in the given direction. Multiple +Sort lines can be added. First sort line takes precedance. + +Example: + +GET hosts +Sort: last_hard_state_change desc + +----- +Offset: + +Lines to skip from the beginning of the result set. Useful for pagination in +combination with Limit header. + +Example: + +GET services +Sort: host_name asc +Sort: description asc +Limit: 100 +Offset: 300 + +----- +OutputFormat: wrapped_json + +An extension to the json output format. +The result set is packed in a json object, with a couple of possible fields: +- columns: an array of column names. (optional) +- data: an array of arrays, describing the result set, in the same syntax common + json output, without embedded column names. +- total_count: The number of lines in the resultsed, except the limitation of + Limit and Offset headers. + +=== About op5 === + +To find out more about op5, see + http://op5.org + +=== INSTALL === + +To install, run: + autoreconf -s + automake --add-missing + ./configure CPPFLAGS=-I$(path to nagios include files, usually /usr/local/nagios/include) + make + sudo make install diff -Naur check_mk-1.2.3i6/livestatus.src/src/auth.h livestatus.working/src/auth.h --- check_mk-1.2.3i6/livestatus.src/src/auth.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/auth.h 2013-11-21 15:51:13.000000000 +0100 @@ -34,6 +34,7 @@ #define UNKNOWN_AUTH_USER ((contact *)0xdeadbeaf) +extern char g_hidden_custom_var_prefix[256]; extern int g_service_authorization; extern int g_group_authorization; diff -Naur check_mk-1.2.3i6/livestatus.src/src/check_icmp.c livestatus.working/src/check_icmp.c --- check_mk-1.2.3i6/livestatus.src/src/check_icmp.c 1970-01-01 01:00:00.000000000 +0100 +++ livestatus.working/src/check_icmp.c 2013-11-21 15:51:13.000000000 +0100 @@ -0,0 +1,1107 @@ +// +------------------------------------------------------------------+ +// | ____ _ _ __ __ _ __ | +// | / ___| |__ ___ ___| | __ | \/ | |/ / | +// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +// | | |___| | | | __/ (__| < | | | | . \ | +// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +// | | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | +// +------------------------------------------------------------------+ +// +// This file is part of Check_MK. +// The official homepage is at http://mathias-kettner.de/check_mk. +// +// check_mk 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 in version 2. check_mk is distributed +// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU General Public License for more de- +// ails. You should have received a copy of the GNU General Public +// License along with GNU Make; see the file COPYING. If not, write +// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA. + +/* -------------------------------------------------------------------- + This version of check_icmp has been derived from Andreas Ericsson's + check_icmp plugin from the Nagios Plugins, which has again been + derived from another "check_icmp" program, that again was a hack of + fping. + + We which to thank all of those authors for their work, which saved + me a lot of time. Long live open source! + -------------------------------------------------------------------- */ + +#define DEFAULT_SOCKET_TIMEOUT 10 +#define STATE_OK 0 +#define STATE_WARNING 1 +#define STATE_CRITICAL 2 + +#define _GNU_SOURCE +#define __USE_BSD + +#include + +#ifndef u_int +typedef unsigned int u_int; +typedef unsigned char u_char; +typedef unsigned short u_short; +#endif + +#if HAVE_SYS_SOCKIO_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "/usr/include/netinet/ip_icmp.h" +// #include +#include +#include +#include +#include +#include +#include + +// Stuff needed for livecheck +#include +static jmp_buf exit_jmp; +static int exit_code; + +/** sometimes undefined system macros (quite a few, actually) **/ +#ifndef MAXTTL +# define MAXTTL 255 +#endif +#ifndef INADDR_NONE +# define INADDR_NONE (in_addr_t)(-1) +#endif + +#ifndef SOL_IP +#define SOL_IP 0 +#endif + +/* we bundle these in one #ifndef, since they're all from BSD + * Put individual #ifndef's around those that bother you */ +#ifndef ICMP_UNREACH_NET_UNKNOWN +# define ICMP_UNREACH_NET_UNKNOWN 6 +# define ICMP_UNREACH_HOST_UNKNOWN 7 +# define ICMP_UNREACH_ISOLATED 8 +# define ICMP_UNREACH_NET_PROHIB 9 +# define ICMP_UNREACH_HOST_PROHIB 10 +# define ICMP_UNREACH_TOSNET 11 +# define ICMP_UNREACH_TOSHOST 12 +#endif +/* tru64 has the ones above, but not these */ +#ifndef ICMP_UNREACH_FILTER_PROHIB +# define ICMP_UNREACH_FILTER_PROHIB 13 +# define ICMP_UNREACH_HOST_PRECEDENCE 14 +# define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 +#endif + +#ifndef DBL_MAX +# define DBL_MAX 9.9999999999e999 +#endif + +typedef unsigned short range_t; /* type for get_range() -- unimplemented */ + +typedef struct rta_host { + unsigned short id; /* id in **table, and icmp pkts */ + char *name; /* arg used for adding this host */ + char *msg; /* icmp error message, if any */ + struct sockaddr_in saddr_in; /* the address of this host */ + struct in_addr error_addr; /* stores address of error replies */ + unsigned long long time_waited; /* total time waited, in usecs */ + unsigned int icmp_sent, icmp_recv, icmp_lost; /* counters */ + unsigned char icmp_type, icmp_code; /* type and code from errors */ + unsigned short flags; /* control/status flags */ + double rta; /* measured RTA */ + double rtmax; /* max rtt */ + double rtmin; /* min rtt */ + unsigned char pl; /* measured packet loss */ + struct rta_host *next; /* linked list */ +} rta_host; + +#define FLAG_LOST_CAUSE 0x01 /* decidedly dead target. */ + +/* threshold structure. all values are maximum allowed, exclusive */ +typedef struct threshold { + unsigned char pl; /* max allowed packet loss in percent */ + unsigned int rta; /* roundtrip time average, microseconds */ +} threshold; + +/* the data structure */ +typedef struct icmp_ping_data { + struct timeval stime; /* timestamp (saved in protocol struct as well) */ + unsigned short ping_id; +} icmp_ping_data; + + + +#define MIN_PING_DATA_SIZE sizeof(struct icmp_ping_data) +#define MAX_IP_PKT_SIZE 65536 /* (theoretical) max IP packet size */ +#define IP_HDR_SIZE 20 +#define MAX_PING_DATA (MAX_IP_PKT_SIZE - IP_HDR_SIZE - ICMP_MINLEN) +#define DEFAULT_PING_DATA_SIZE (MIN_PING_DATA_SIZE + 44) + +/* various target states */ +#define TSTATE_INACTIVE 0x01 /* don't ping this host anymore */ +#define TSTATE_WAITING 0x02 /* unanswered packets on the wire */ +#define TSTATE_ALIVE 0x04 /* target is alive (has answered something) */ +#define TSTATE_UNREACH 0x08 + +/** prototypes **/ +void print_help (void); +void print_usage (void); +static u_int get_timevar(const char *); +static u_int get_timevaldiff(struct timeval *, struct timeval *); +static in_addr_t get_ip_address(const char *); +static int wait_for_reply(int, u_int); +static int recvfrom_wto(int, void *, unsigned int, struct sockaddr *, u_int *); +static int send_icmp_ping(int, struct rta_host *); +static int get_threshold(char *str, threshold *th); +static void run_checks(void); +static void set_source_ip(char *); +static int add_target(char *); +static int add_target_ip(char *, struct in_addr *); +static int handle_random_icmp(unsigned char *, struct sockaddr_in *); +static unsigned short icmp_checksum(unsigned short *, int); +static void finish(int); +static void crash(const char *, ...); + +/** external **/ +extern int optind, opterr, optopt; +extern char *optarg; + +/** global variables **/ +static struct rta_host **table, *cursor, *list; +static threshold crit = {80, 500000}, warn = {40, 200000}; +static int timeout = 10; +static unsigned short icmp_data_size = DEFAULT_PING_DATA_SIZE; +static unsigned short icmp_pkt_size = DEFAULT_PING_DATA_SIZE + ICMP_MINLEN; + +static unsigned int icmp_sent = 0, icmp_recv = 0, icmp_lost = 0; +static unsigned short targets_down = 0, targets = 0, packets = 0; +static unsigned int retry_interval, pkt_interval, target_interval; +static int status = STATE_OK; +extern int icmp_sock; +static pid_t pid; +static struct timezone tz; +static struct timeval prog_start; +static unsigned long long max_completion_time = 0; +static unsigned char ttl = 0; /* outgoing ttl */ +static unsigned int warn_down = 1, crit_down = 1; /* host down threshold values */ +static int min_hosts_alive = -1; +float pkt_backoff_factor = 1.5; +float target_backoff_factor = 1.5; + +#define targets_alive (targets - targets_down) +#define icmp_pkts_en_route (icmp_sent - (icmp_recv + icmp_lost)) + +char *g_output_buffer; +int g_output_buffer_size; +char *g_output_pointer; + +void init_global_variables() +{ + crit.pl = 80; + crit.rta = 500000; + warn.pl = 40; + warn.rta = 200000; + timeout = 10; + icmp_data_size = DEFAULT_PING_DATA_SIZE; + icmp_pkt_size = DEFAULT_PING_DATA_SIZE + ICMP_MINLEN; + + icmp_sent = 0; + icmp_recv = 0; + icmp_lost = 0; + targets_down = 0; + targets = 0; + packets = 0; + status = STATE_OK; + max_completion_time = 0; + ttl = 0; + warn_down = 1; + crit_down = 1; + min_hosts_alive = -1; + pkt_backoff_factor = 1.5; + target_backoff_factor = 1.5; +} + +void do_output(int crash, char *format, ...) +{ + va_list ap; + va_start(ap, format); + int place_left = g_output_pointer - g_output_buffer + g_output_buffer_size; + g_output_pointer += vsnprintf(g_output_pointer, place_left, format, ap); + va_end(ap); + *g_output_pointer = 0; + if (crash) { + exit_code = 3; + longjmp(exit_jmp, 1); + } +} +void do_output_char(char c) +{ + *g_output_pointer++ = c; +} + +static const char * +get_icmp_error_msg(unsigned char icmp_type, unsigned char icmp_code) +{ + const char *msg = "unreachable"; + + switch(icmp_type) { + case ICMP_UNREACH: + switch(icmp_code) { + case ICMP_UNREACH_NET: msg = "Net unreachable"; break; + case ICMP_UNREACH_HOST: msg = "Host unreachable"; break; + case ICMP_UNREACH_PROTOCOL: msg = "Protocol unreachable (firewall?)"; break; + case ICMP_UNREACH_PORT: msg = "Port unreachable (firewall?)"; break; + case ICMP_UNREACH_NEEDFRAG: msg = "Fragmentation needed"; break; + case ICMP_UNREACH_SRCFAIL: msg = "Source route failed"; break; + case ICMP_UNREACH_ISOLATED: msg = "Source host isolated"; break; + case ICMP_UNREACH_NET_UNKNOWN: msg = "Unknown network"; break; + case ICMP_UNREACH_HOST_UNKNOWN: msg = "Unknown host"; break; + case ICMP_UNREACH_NET_PROHIB: msg = "Network denied (firewall?)"; break; + case ICMP_UNREACH_HOST_PROHIB: msg = "Host denied (firewall?)"; break; + case ICMP_UNREACH_TOSNET: msg = "Bad TOS for network (firewall?)"; break; + case ICMP_UNREACH_TOSHOST: msg = "Bad TOS for host (firewall?)"; break; + case ICMP_UNREACH_FILTER_PROHIB: msg = "Prohibited by filter (firewall)"; break; + case ICMP_UNREACH_HOST_PRECEDENCE: msg = "Host precedence violation"; break; + case ICMP_UNREACH_PRECEDENCE_CUTOFF: msg = "Precedence cutoff"; break; + default: msg = "Invalid code"; break; + } + break; + + case ICMP_TIMXCEED: + /* really 'out of reach', or non-existant host behind a router serving + * two different subnets */ + switch(icmp_code) { + case ICMP_TIMXCEED_INTRANS: msg = "Time to live exceeded in transit"; break; + case ICMP_TIMXCEED_REASS: msg = "Fragment reassembly time exceeded"; break; + default: msg = "Invalid code"; break; + } + break; + + case ICMP_SOURCEQUENCH: msg = "Transmitting too fast"; break; + case ICMP_REDIRECT: msg = "Redirect (change route)"; break; + case ICMP_PARAMPROB: msg = "Bad IP header (required option absent)"; break; + + /* the following aren't error messages, so ignore */ + case ICMP_TSTAMP: + case ICMP_TSTAMPREPLY: + case ICMP_IREQ: + case ICMP_IREQREPLY: + case ICMP_MASKREQ: + case ICMP_MASKREPLY: + default: msg = ""; break; + } + + return msg; +} + +static int +handle_random_icmp(unsigned char *packet, struct sockaddr_in *addr) +{ + struct icmp p, sent_icmp; + struct rta_host *host = NULL; + + memcpy(&p, packet, sizeof(p)); + if(p.icmp_type == ICMP_ECHO && ntohs(p.icmp_id) == pid) { + /* echo request from us to us (pinging localhost) */ + return 0; + } + + /* only handle a few types, since others can't possibly be replies to + * us in a sane network (if it is anyway, it will be counted as lost + * at summary time, but not as quickly as a proper response */ + /* TIMXCEED can be an unreach from a router with multiple IP's which + * serves two different subnets on the same interface and a dead host + * on one net is pinged from the other. The router will respond to + * itself and thus set TTL=0 so as to not loop forever. Even when + * TIMXCEED actually sends a proper icmp response we will have passed + * too many hops to have a hope of reaching it later, in which case it + * indicates overconfidence in the network, poor routing or both. */ + if(p.icmp_type != ICMP_UNREACH && p.icmp_type != ICMP_TIMXCEED && + p.icmp_type != ICMP_SOURCEQUENCH && p.icmp_type != ICMP_PARAMPROB) + { + return 0; + } + + /* might be for us. At least it holds the original package (according + * to RFC 792). If it isn't, just ignore it */ + memcpy(&sent_icmp, packet + 28, sizeof(sent_icmp)); + if(sent_icmp.icmp_type != ICMP_ECHO || ntohs(sent_icmp.icmp_id) != pid || + ntohs(sent_icmp.icmp_seq) >= targets*packets) + { + return 0; + } + + /* it is indeed a response for us */ + host = table[ntohs(sent_icmp.icmp_seq)/packets]; + + icmp_lost++; + host->icmp_lost++; + /* don't spend time on lost hosts any more */ + if(host->flags & FLAG_LOST_CAUSE) return 0; + + /* source quench means we're sending too fast, so increase the + * interval and mark this packet lost */ + if(p.icmp_type == ICMP_SOURCEQUENCH) { + pkt_interval *= pkt_backoff_factor; + target_interval *= target_backoff_factor; + } + else { + targets_down++; + host->flags |= FLAG_LOST_CAUSE; + } + host->icmp_type = p.icmp_type; + host->icmp_code = p.icmp_code; + host->error_addr.s_addr = addr->sin_addr.s_addr; + + return 0; +} + + +/* This was the main() function of the original check_icmp. */ +int check_icmp(int argc, char **argv, char *output, int size) +{ + init_global_variables(); + + g_output_buffer = output; + g_output_buffer_size = size; + g_output_pointer = output; + + icmp_sock = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP); + + exit_code = 3; + if (setjmp(exit_jmp)) { + close(icmp_sock); + struct rta_host *h = list; + while (h) { + free(h->name); + struct rta_host *n = h->next; + free(h); + h = n; + } + if (table) + free(table); + return exit_code; + } + + int i; + char *ptr; + long int arg; + int icmp_sockerrno; + int result; + struct rta_host *host; + + /* we only need to be setsuid when we get the sockets, so do + * that before pointer magic (esp. on network data) */ + icmp_sockerrno = 0; + + /* POSIXLY_CORRECT might break things, so unset it (the portable way) */ + unsetenv("POSIXLY_CORRECT"); + + /* use the pid to mark packets as ours */ + /* Some systems have 32-bit pid_t so mask off only 16 bits */ + pid = getpid() & 0xffff; + + cursor = list = NULL; + table = NULL; + + crit.rta = 500000; + crit.pl = 80; + warn.rta = 200000; + warn.pl = 40; + pkt_interval = 80000; /* 80 msec packet interval by default */ + packets = 5; + + + /* parse the arguments */ + for(i = 1; i < argc; i++) { + while((arg = getopt(argc, argv, "w:c:n:p:t:H:s:i:b:I:l:m:")) != EOF) { + long size; + switch(arg) { + case 'b': + size = strtol(optarg,NULL,0); + if (size >= (sizeof(struct icmp) + sizeof(struct icmp_ping_data)) && + size < MAX_PING_DATA) { + icmp_data_size = size; + icmp_pkt_size = size + ICMP_MINLEN; + } + break; + case 'i': + pkt_interval = get_timevar(optarg); + break; + case 'I': + target_interval = get_timevar(optarg); + break; + case 'w': + get_threshold(optarg, &warn); + break; + case 'c': + get_threshold(optarg, &crit); + break; + case 'n': + case 'p': + packets = strtoul(optarg, NULL, 0); + break; + case 't': + timeout = strtoul(optarg, NULL, 0); + if(!timeout) timeout = 10; + break; + case 'H': + add_target(optarg); + break; + case 'l': + ttl = (unsigned char)strtoul(optarg, NULL, 0); + break; + case 'm': + min_hosts_alive = (int)strtoul(optarg, NULL, 0); + break; + case 'd': /* implement later, for cluster checks */ + warn_down = (unsigned char)strtoul(optarg, &ptr, 0); + if(ptr) { + crit_down = (unsigned char)strtoul(ptr + 1, NULL, 0); + } + break; + case 's': /* specify source IP address */ + set_source_ip(optarg); + break; + } + } + } + + argv = &argv[optind]; + while(*argv) { + add_target(*argv); + argv++; + } + if(!targets) { + errno = 0; + do_output(1, "No hosts to check"); + exit_code = 3; + longjmp(exit_jmp, 1); + } + + if(!ttl) ttl = 64; + + if(icmp_sock) { + result = setsockopt(icmp_sock, SOL_IP, IP_TTL, &ttl, sizeof(ttl)); + } + + /* stupid users should be able to give whatever thresholds they want + * (nothing will break if they do), but some anal plugin maintainer + * will probably add some printf() thing here later, so it might be + * best to at least show them where to do it. ;) */ + if(warn.pl > crit.pl) warn.pl = crit.pl; + if(warn.rta > crit.rta) warn.rta = crit.rta; + if(warn_down > crit_down) crit_down = warn_down; + + signal(SIGINT, finish); + signal(SIGHUP, finish); + signal(SIGTERM, finish); + signal(SIGALRM, finish); + alarm(timeout); + + /* make sure we don't wait any longer than necessary */ + gettimeofday(&prog_start, &tz); + max_completion_time = + ((targets * packets * pkt_interval) + (targets * target_interval)) + + (targets * packets * crit.rta) + crit.rta; + + if(packets > 20) { + errno = 0; + do_output(1, "packets is > 20 (%d)", packets); + } + + if(min_hosts_alive < -1) { + errno = 0; + do_output(1, "minimum alive hosts is negative (%i)", min_hosts_alive); + } + + host = list; + table = malloc(sizeof(struct rta_host **) * (argc - 1)); + i = 0; + while(host) { + host->id = i*packets; + table[i] = host; + host = host->next; + i++; + } + + run_checks(); + + errno = 0; + finish(0); + + exit_code = 0; + longjmp(exit_jmp, 1); +} + +static void +run_checks() +{ + u_int i, t, result; + u_int final_wait, time_passed; + + /* this loop might actually violate the pkt_interval or target_interval + * settings, but only if there aren't any packets on the wire which + * indicates that the target can handle an increased packet rate */ + for(i = 0; i < packets; i++) { + for(t = 0; t < targets; t++) { + /* don't send useless packets */ + if(!targets_alive) finish(0); + if(table[t]->flags & FLAG_LOST_CAUSE) { + continue; + } + + /* we're still in the game, so send next packet */ + (void)send_icmp_ping(icmp_sock, table[t]); + result = wait_for_reply(icmp_sock, target_interval); + } + result = wait_for_reply(icmp_sock, pkt_interval * targets); + } + + if(icmp_pkts_en_route && targets_alive) { + time_passed = get_timevaldiff(NULL, NULL); + final_wait = max_completion_time - time_passed; + + if(time_passed > max_completion_time) { + finish(0); + } + + /* catch the packets that might come in within the timeframe, but + * haven't yet */ + result = wait_for_reply(icmp_sock, final_wait); + } +} + +/* response structure: + * ip header : 20 bytes + * icmp header : 28 bytes + * icmp echo reply : the rest + */ +static int +wait_for_reply(int sock, u_int t) +{ + int n, hlen; + static unsigned char buf[4096]; + struct sockaddr_in resp_addr; + struct ip *ip; + struct icmp icp; + struct rta_host *host; + struct icmp_ping_data data; + struct timeval wait_start, now; + u_int tdiff, i, per_pkt_wait; + + /* if we can't listen or don't have anything to listen to, just return */ + if(!t || !icmp_pkts_en_route) return 0; + + gettimeofday(&wait_start, &tz); + + i = t; + per_pkt_wait = t / icmp_pkts_en_route; + while(icmp_pkts_en_route && get_timevaldiff(&wait_start, NULL) < i) { + t = per_pkt_wait; + + /* wrap up if all targets are declared dead */ + if(!targets_alive || + get_timevaldiff(&prog_start, NULL) >= max_completion_time) + { + finish(0); + } + + /* reap responses until we hit a timeout */ + n = recvfrom_wto(sock, buf, sizeof(buf), + (struct sockaddr *)&resp_addr, &t); + if(!n) { + continue; /* timeout for this one, so keep trying */ + } + if(n < 0) { + return n; + } + + ip = (struct ip *)buf; + +/* obsolete. alpha on tru64 provides the necessary defines, but isn't broken */ +/* #if defined( __alpha__ ) && __STDC__ && !defined( __GLIBC__ ) */ + /* alpha headers are decidedly broken. Using an ansi compiler, + * they provide ip_vhl instead of ip_hl and ip_v, so we mask + * off the bottom 4 bits */ +/* hlen = (ip->ip_vhl & 0x0f) << 2; */ +/* #else */ + hlen = ip->ip_hl << 2; +/* #endif */ + + if(n < (hlen + ICMP_MINLEN)) { + do_output(1, "received packet too short for ICMP (%d bytes, expected %d) from %s\n", + n, hlen + icmp_pkt_size, inet_ntoa(resp_addr.sin_addr)); + } + + /* check the response */ + memcpy(&icp, buf + hlen, sizeof(icp)); + + if(ntohs(icp.icmp_id) != pid || icp.icmp_type != ICMP_ECHOREPLY || + ntohs(icp.icmp_seq) >= targets*packets) { + handle_random_icmp(buf + hlen, &resp_addr); + continue; + } + + /* this is indeed a valid response */ + memcpy(&data, icp.icmp_data, sizeof(data)); + + host = table[ntohs(icp.icmp_seq)/packets]; + gettimeofday(&now, &tz); + tdiff = get_timevaldiff(&data.stime, &now); + + host->time_waited += tdiff; + host->icmp_recv++; + icmp_recv++; + if (tdiff > host->rtmax) + host->rtmax = tdiff; + if (tdiff < host->rtmin) + host->rtmin = tdiff; + } + + return 0; +} + +/* the ping functions */ +static int +send_icmp_ping(int sock, struct rta_host *host) +{ + char buf[icmp_pkt_size]; // avoid malloc + static union { + void *buf; /* re-use so we prevent leaks */ + struct icmp *icp; + u_short *cksum_in; + } packet = { NULL }; + packet.buf = buf; + + long int len; + struct icmp_ping_data data; + struct timeval tv; + struct sockaddr *addr; + + if(sock == -1) { + errno = 0; + do_output(1, "Attempt to send on bogus socket"); + return -1; + } + addr = (struct sockaddr *)&host->saddr_in; + + // Mathias -> Andreas: how can packet.buf be != 0 here? + memset(packet.buf, 0, icmp_pkt_size); + + if((gettimeofday(&tv, &tz)) == -1) return -1; + + data.ping_id = 10; /* host->icmp.icmp_sent; */ + memcpy(&data.stime, &tv, sizeof(tv)); + memcpy(&packet.icp->icmp_data, &data, sizeof(data)); + packet.icp->icmp_type = ICMP_ECHO; + packet.icp->icmp_code = 0; + packet.icp->icmp_cksum = 0; + packet.icp->icmp_id = htons(pid); + packet.icp->icmp_seq = htons(host->id++); + packet.icp->icmp_cksum = icmp_checksum(packet.cksum_in, icmp_pkt_size); + + + len = sendto(sock, packet.buf, icmp_pkt_size, 0, (struct sockaddr *)addr, + sizeof(struct sockaddr)); + if(len < 0 || (unsigned int)len != icmp_pkt_size) { + return -1; + } + + icmp_sent++; + host->icmp_sent++; + return 0; +} + +static int +recvfrom_wto(int sock, void *buf, unsigned int len, struct sockaddr *saddr, + u_int *timo) +{ + u_int slen; + int n; + struct timeval to, then, now; + fd_set rd, wr; + + if(!*timo) { + return 0; + } + + to.tv_sec = *timo / 1000000; + to.tv_usec = (*timo - (to.tv_sec * 1000000)); + + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_SET(sock, &rd); + errno = 0; + gettimeofday(&then, &tz); + n = select(sock + 1, &rd, &wr, NULL, &to); + if(n < 0) do_output(1, "select() in recvfrom_wto"); + gettimeofday(&now, &tz); + *timo = get_timevaldiff(&then, &now); + + if(!n) return 0; /* timeout */ + + slen = sizeof(struct sockaddr); + + return recvfrom(sock, buf, len, 0, saddr, &slen); +} + +static void +finish(int sig) +{ + u_int i = 0; + unsigned char pl; + double rta; + struct rta_host *host; + const char *status_string[] = + {"OK", "WARNING", "CRITICAL", "UNKNOWN", "DEPENDENT"}; + int hosts_ok = 0; + int hosts_warn = 0; + + alarm(0); + + /* iterate thrice to calculate values, give output, and print perfparse */ + host = list; + while(host) { + if(!host->icmp_recv) { + /* rta 0 is ofcourse not entirely correct, but will still show up + * conspicuosly as missing entries in perfparse and cacti */ + pl = 100; + rta = 0; + status = STATE_CRITICAL; + /* up the down counter if not already counted */ + if(!(host->flags & FLAG_LOST_CAUSE) && targets_alive) targets_down++; + } + else { + pl = ((host->icmp_sent - host->icmp_recv) * 100) / host->icmp_sent; + rta = (double)host->time_waited / host->icmp_recv; + } + host->pl = pl; + host->rta = rta; + if(pl >= crit.pl || rta >= crit.rta) { + status = STATE_CRITICAL; + } + else if(!status && (pl >= warn.pl || rta >= warn.rta)) { + status = STATE_WARNING; + hosts_warn++; + } + else { + hosts_ok++; + } + + host = host->next; + } + /* this is inevitable */ + if(!targets_alive) status = STATE_CRITICAL; + if(min_hosts_alive > -1) { + if(hosts_ok >= min_hosts_alive) status = STATE_OK; + else if((hosts_ok + hosts_warn) >= min_hosts_alive) status = STATE_WARNING; + } + do_output(0, "%s - ", status_string[status]); + + host = list; + while(host) { + if(i) { + if(i < targets) do_output(0, " :: "); + else do_output(0, "\n"); + } + i++; + if(!host->icmp_recv) { + status = STATE_CRITICAL; + if(host->flags & FLAG_LOST_CAUSE) { + do_output(0, "%s: %s @ %s. rta nan, lost %d%%", + host->name, + get_icmp_error_msg(host->icmp_type, host->icmp_code), + inet_ntoa(host->error_addr), + 100); + } + else { /* not marked as lost cause, so we have no flags for it */ + do_output(0, "%s: rta nan, lost 100%%", host->name); + } + } + else { /* !icmp_recv */ + do_output(0, "%s: rta %0.3fms, lost %u%%", + host->name, host->rta / 1000, host->pl); + } + + host = host->next; + } + + /* iterate once more for pretty perfparse output */ + do_output_char('|'); + i = 0; + host = list; + while(host) { + do_output(0, "%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; %srtmax=%0.3fms;;;; %srtmin=%0.3fms;;;; ", + (targets > 1) ? host->name : "", + host->rta / 1000, (float)warn.rta / 1000, (float)crit.rta / 1000, + (targets > 1) ? host->name : "", host->pl, warn.pl, crit.pl, + (targets > 1) ? host->name : "", (float)host->rtmax / 1000, + (targets > 1) ? host->name : "", (host->rtmin < DBL_MAX) ? (float)host->rtmin / 1000 : (float)0); + + host = host->next; + } + + if(min_hosts_alive > -1) { + if(hosts_ok >= min_hosts_alive) status = STATE_OK; + else if((hosts_ok + hosts_warn) >= min_hosts_alive) status = STATE_WARNING; + } + + /* finish with an empty line */ + do_output_char('\n'); + + exit_code = status; + longjmp(exit_jmp, 1); +} + +static u_int +get_timevaldiff(struct timeval *early, struct timeval *later) +{ + u_int ret; + struct timeval now; + + if(!later) { + gettimeofday(&now, &tz); + later = &now; + } + if(!early) early = &prog_start; + + /* if early > later we return 0 so as to indicate a timeout */ + if(early->tv_sec > later->tv_sec || + (early->tv_sec == later->tv_sec && early->tv_usec > later->tv_usec)) + { + return 0; + } + + ret = (later->tv_sec - early->tv_sec) * 1000000; + ret += later->tv_usec - early->tv_usec; + + return ret; +} + +static int +add_target_ip(char *arg, struct in_addr *in) +{ + struct rta_host *host; + + /* disregard obviously stupid addresses */ + if(in->s_addr == INADDR_NONE || in->s_addr == INADDR_ANY) + return -1; + + /* no point in adding two identical IP's, so don't. ;) */ + host = list; + while(host) { + if(host->saddr_in.sin_addr.s_addr == in->s_addr) { + return -1; + } + host = host->next; + } + + /* add the fresh ip */ + host = malloc(sizeof(struct rta_host)); + if(!host) { + do_output(1, "add_target_ip(%s, %s): malloc(%d) failed", + arg, inet_ntoa(*in), sizeof(struct rta_host)); + } + memset(host, 0, sizeof(struct rta_host)); + + /* set the values. use calling name for output */ + host->name = strdup(arg); + + /* fill out the sockaddr_in struct */ + host->saddr_in.sin_family = AF_INET; + host->saddr_in.sin_addr.s_addr = in->s_addr; + + host->rtmin = DBL_MAX; + + if(!list) list = cursor = host; + else cursor->next = host; + + cursor = host; + targets++; + + return 0; +} + +/* wrapper for add_target_ip */ +static int +add_target(char *arg) +{ + int i; + struct hostent *he; + struct in_addr *in, ip; + + /* don't resolve if we don't have to */ + if((ip.s_addr = inet_addr(arg)) != INADDR_NONE) { + /* don't add all ip's if we were given a specific one */ + return add_target_ip(arg, &ip); + /* he = gethostbyaddr((char *)in, sizeof(struct in_addr), AF_INET); */ + /* if(!he) return add_target_ip(arg, in); */ + } + else { + errno = 0; + he = gethostbyname(arg); + if(!he) { + errno = 0; + do_output(1, "Failed to resolve %s", arg); + return -1; + } + } + + /* possibly add all the IP's as targets */ + for(i = 0; he->h_addr_list[i]; i++) { + in = (struct in_addr *)he->h_addr_list[i]; + add_target_ip(arg, in); + break; + } + + return 0; +} + +static void +set_source_ip(char *arg) +{ + struct sockaddr_in src; + + memset(&src, 0, sizeof(src)); + src.sin_family = AF_INET; + if((src.sin_addr.s_addr = inet_addr(arg)) == INADDR_NONE) + src.sin_addr.s_addr = get_ip_address(arg); + if(bind(icmp_sock, (struct sockaddr *)&src, sizeof(src)) == -1) + do_output(1, "Cannot bind to IP address %s", arg); +} + +/* TODO: Move this to netutils.c and also change check_dhcp to use that. */ +static in_addr_t +get_ip_address(const char *ifname) +{ +#if defined(SIOCGIFADDR) + struct ifreq ifr; + struct sockaddr_in ip; + + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); + ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; + if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) + do_output(1, "Cannot determine IP address of interface %s", ifname); + memcpy(&ip, &ifr.ifr_addr, sizeof(ip)); + return ip.sin_addr.s_addr; +#else + errno = 0; + do_output(1, "Cannot get interface IP address on this platform."); +#endif +} + +/* + * u = micro + * m = milli + * s = seconds + * return value is in microseconds + */ +static u_int +get_timevar(const char *str) +{ + char p, u, *ptr; + unsigned int len; + u_int i, d; /* integer and decimal, respectively */ + u_int factor = 1000; /* default to milliseconds */ + + if(!str) return 0; + len = strlen(str); + if(!len) return 0; + + /* unit might be given as ms|m (millisec), + * us|u (microsec) or just plain s, for seconds */ + u = p = '\0'; + u = str[len - 1]; + if(len >= 2 && !isdigit((int)str[len - 2])) p = str[len - 2]; + if(p && u == 's') u = p; + else if(!p) p = u; + + if(u == 'u') factor = 1; /* microseconds */ + else if(u == 'm') factor = 1000; /* milliseconds */ + else if(u == 's') factor = 1000000; /* seconds */ + + i = strtoul(str, &ptr, 0); + if(!ptr || *ptr != '.' || strlen(ptr) < 2 || factor == 1) + return i * factor; + + /* time specified in usecs can't have decimal points, so ignore them */ + if(factor == 1) return i; + + d = strtoul(ptr + 1, NULL, 0); + + /* d is decimal, so get rid of excess digits */ + while(d >= factor) d /= 10; + + /* the last parenthesis avoids floating point exceptions. */ + return ((i * factor) + (d * (factor / 10))); +} + +/* not too good at checking errors, but it'll do (main() should barfe on -1) */ +static int +get_threshold(char *str, threshold *th) +{ + char *p = NULL, i = 0; + + if(!str || !strlen(str) || !th) return -1; + + /* pointer magic slims code by 10 lines. i is bof-stop on stupid libc's */ + p = &str[strlen(str) - 1]; + while(p != &str[1]) { + if(*p == '%') *p = '\0'; + else if(*p == ',' && i) { + *p = '\0'; /* reset it so get_timevar(str) works nicely later */ + th->pl = (unsigned char)strtoul(p+1, NULL, 0); + break; + } + i = 1; + p--; + } + th->rta = get_timevar(str); + + if(!th->rta) return -1; + + if(th->rta > MAXTTL * 1000000) th->rta = MAXTTL * 1000000; + if(th->pl > 100) th->pl = 100; + + return 0; +} + +unsigned short +icmp_checksum(unsigned short *p, int n) +{ + register unsigned short cksum; + register long sum = 0; + + while(n > 1) { + sum += *p++; + n -= 2; + } + + /* mop up the occasional odd byte */ + if(n == 1) sum += (unsigned char)*p; + + sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */ + sum += (sum >> 16); /* add carry */ + cksum = ~sum; /* ones-complement, trunc to 16 bits */ + + return cksum; +} + diff -Naur check_mk-1.2.3i6/livestatus.src/src/Column.cc livestatus.working/src/Column.cc --- check_mk-1.2.3i6/livestatus.src/src/Column.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Column.cc 2013-11-21 15:51:13.000000000 +0100 @@ -30,7 +32,6 @@ : _name(name) , _description(description) , _indirect_offset(indirect_offset) - , _extra_offset(-1) { } @@ -39,19 +40,20 @@ if (!data) return 0; - if (_indirect_offset >= 0) { + else if (_indirect_offset >= 0) { // add one indirection level // indirect_offset is place in structure, where // pointer to real object is - data = *((void **)((char *)data + _indirect_offset)); - if (!data) - return 0; + return *((void **)((char *)data + _indirect_offset)); } + else // no indirection + return data; +} - // one optional extra level of indirection - if (_extra_offset >= 0) - data = *((void **)((char *)data + _extra_offset)); - - return data; +int Column::compare(void *dataa, void *datab, Query *query) { + /* Column cant be compared. Assume everything is equal. Makes column + * unsorted. Override this function for comparable types + */ + return 0; } diff -Naur check_mk-1.2.3i6/livestatus.src/src/Column.h livestatus.working/src/Column.h --- check_mk-1.2.3i6/livestatus.src/src/Column.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Column.h 2013-11-21 15:51:13.000000000 +0100 @@ -40,7 +42,6 @@ class Filter; class Query; -class Table; class Column { @@ -48,20 +49,19 @@ string _description; public: int _indirect_offset; - int _extra_offset; public: Column(string name, string description, int indirect_offset); virtual ~Column() {} const char *name() const { return _name.c_str(); } const char *description() const { return _description.c_str(); } - virtual string valueAsString(void *data __attribute__ ((__unused__)), Query *) + virtual string valueAsString(void *data __attribute__ ((__unused__)), Query *) { return "invalid"; } virtual int type() = 0; virtual void output(void *data, Query *) = 0; virtual Filter *createFilter(int opid __attribute__ ((__unused__)), char *value __attribute__ ((__unused__))) { return 0; } void *shiftPointer(void *data); - void setExtraOffset(int o) { _extra_offset = o; } + virtual int compare(void *dataa, void *datab, Query *query); }; #endif // Column_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/ContactgroupsColumn.cc livestatus.working/src/ContactgroupsColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/ContactgroupsColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/ContactgroupsColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -26,27 +26,32 @@ #include "nagios.h" #include "Query.h" -void ContactgroupsColumn::output(void *data, Query *query) +contactgroupsmember *ContactgroupsColumn::getData(void *data) { - query->outputBeginList(); - if (data) { data = shiftPointer(data); - if (data) { - contactgroupsmember *cgm = *(contactgroupsmember **)((char *)data + _offset); - bool first = true; - while (cgm) { - contactgroup *cg = (contactgroup *)cgm->group_ptr; - if (!first) - query->outputListSeparator(); - else - first = false; - query->outputString(cg->group_name); - cgm = cgm->next; - } - } + if (data) + return *(contactgroupsmember **)((char *)data + _offset); } + return 0; +} +void ContactgroupsColumn::output(void *data, Query *query) +{ + query->outputBeginList(); + contactgroupsmember *cgm = getData(data); + if (cgm) { + bool first = true; + while (cgm) { + contactgroup *cg = (contactgroup *)cgm->group_ptr; + if (!first) + query->outputListSeparator(); + else + first = false; + query->outputString(cg->group_name); + cgm = cgm->next; + } + } query->outputEndList(); } diff -Naur check_mk-1.2.3i6/livestatus.src/src/ContactgroupsColumn.h livestatus.working/src/ContactgroupsColumn.h --- check_mk-1.2.3i6/livestatus.src/src/ContactgroupsColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/ContactgroupsColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -41,6 +41,8 @@ void *getNagiosObject(char *name); // return pointer to contact group bool isNagiosMember(void *data, void *nagobject); bool isEmpty(void *data); +private: + contactgroupsmember *getData(void *); }; diff -Naur check_mk-1.2.3i6/livestatus.src/src/ContactsColumn.cc livestatus.working/src/ContactsColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/ContactsColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/ContactsColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -29,8 +29,6 @@ #include "Query.h" #include "tables.h" -extern contact *contact_list; - void *ContactsColumn::getNagiosObject(char *name) { return (void *)find_contact(name); diff -Naur check_mk-1.2.3i6/livestatus.src/src/CustomVarsColumn.cc livestatus.working/src/CustomVarsColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/CustomVarsColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/CustomVarsColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -27,77 +27,85 @@ #include "logger.h" #include "CustomVarsFilter.h" #include "Query.h" +#include "auth.h" +#include void CustomVarsColumn::output(void *data, Query *query) { - if (_what == CVT_DICT) - query->outputBeginDict(); - else - query->outputBeginList(); - - customvariablesmember *cvm = getCVM(data); - - bool first = true; - while (cvm) { - if (first) - first = false; - else if (_what == CVT_DICT) - query->outputDictSeparator(); - else - query->outputListSeparator(); - if (_what == CVT_VARNAMES) - query->outputString(cvm->variable_name); - else if (_what == CVT_VALUES) - query->outputString(cvm->variable_value); - else { - query->outputString(cvm->variable_name); - query->outputDictValueSeparator(); - query->outputString(cvm->variable_value); - } - cvm = cvm->next; - } - - if (_what == CVT_DICT) - query->outputEndDict(); - else - query->outputEndList(); + if (_what == CVT_DICT) + query->outputBeginDict(); + else + query->outputBeginList(); + + customvariablesmember *cvm = getCVM(data); + + bool first = true; + while (cvm) { + if(g_hidden_custom_var_prefix[0]==0 || 0!=strncmp(g_hidden_custom_var_prefix, cvm->variable_name, strlen(g_hidden_custom_var_prefix))) { + if (first) + first = false; + else if (_what == CVT_DICT) + query->outputDictSeparator(); + else + query->outputListSeparator(); + if (_what == CVT_VARNAMES) + query->outputString(cvm->variable_name); + else if (_what == CVT_VALUES) + query->outputString(cvm->variable_value); + else { + query->outputString(cvm->variable_name); + query->outputDictValueSeparator(); + query->outputString(cvm->variable_value); + } + } + cvm = cvm->next; + } + + if (_what == CVT_DICT) + query->outputEndDict(); + else + query->outputEndList(); } Filter *CustomVarsColumn::createFilter(int opid, char *value) { - return new CustomVarsFilter(this, opid, value); + return new CustomVarsFilter(this, opid, value); } customvariablesmember *CustomVarsColumn::getCVM(void *data) { - if (!data) return 0; - data = shiftPointer(data); - if (!data) return 0; - return *(customvariablesmember **)((char *)data + _offset); + if (!data) return 0; + data = shiftPointer(data); + if (!data) return 0; + return *(customvariablesmember **)((char *)data + _offset); } bool CustomVarsColumn::contains(void *data, const char *value) { - customvariablesmember *cvm = getCVM(data); - while (cvm) { - char *ref = _what == CVT_VARNAMES ? cvm->variable_name : cvm->variable_value; - if (!strcmp(ref, value)) - return true; - cvm = cvm->next; - } - return false; + customvariablesmember *cvm = getCVM(data); + while (cvm) { + if(g_hidden_custom_var_prefix[0]==0 || 0!=strncmp(g_hidden_custom_var_prefix, cvm->variable_name, strlen(g_hidden_custom_var_prefix))) { + char *ref = _what == CVT_VARNAMES ? cvm->variable_name : cvm->variable_value; + if (!strcmp(ref, value)) + return true; + } + cvm = cvm->next; + } + return false; } char *CustomVarsColumn::getVariable(void *data, const char *varname) { - customvariablesmember *cvm = getCVM(data); - while (cvm) { - if (!strcmp(cvm->variable_name, varname)) - return cvm->variable_value; - cvm = cvm->next; - } - return 0; + customvariablesmember *cvm = getCVM(data); + while (cvm) { + if(g_hidden_custom_var_prefix[0]==0 || 0!=strncmp(g_hidden_custom_var_prefix, cvm->variable_name, strlen(g_hidden_custom_var_prefix))) { + if (!strcmp(cvm->variable_name, varname)) + return cvm->variable_value; + } + cvm = cvm->next; + } + return 0; } diff -Naur check_mk-1.2.3i6/livestatus.src/src/CustomVarsFilter.cc livestatus.working/src/CustomVarsFilter.cc --- check_mk-1.2.3i6/livestatus.src/src/CustomVarsFilter.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/CustomVarsFilter.cc 2013-11-21 15:51:13.000000000 +0100 @@ -22,13 +22,13 @@ // to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, // Boston, MA 02110-1301 USA. -#include -#include - #include "CustomVarsFilter.h" #include "opids.h" #include "logger.h" +#include #include "OutputBuffer.h" +#include +#include CustomVarsFilter::CustomVarsFilter(CustomVarsColumn *column, int opid, char *value) : _column(column) diff -Naur check_mk-1.2.3i6/livestatus.src/src/DoubleColumn.cc livestatus.working/src/DoubleColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/DoubleColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/DoubleColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -42,3 +44,12 @@ snprintf(buf, sizeof(buf), "%.10e", getValue(data)); return buf; } + +int DoubleColumn::compare(void *dataa, void *datab, Query *query) +{ + double a = getValue(dataa); + double b = getValue(datab); + if( a>b ) return 1; + if( a, DowntimeOrComment *>::iterator it = table->entriesIteratorBegin(); + for (map::iterator it = table->entriesIteratorBegin(); it != table->entriesIteratorEnd(); ++it) { - unsigned long id = it->first.first; - bool is_service = it->first.second; - DowntimeOrComment *dt = it->second; - - found_match = false; - - if (!is_service){ - if (dt->_host->name == ((host_struct*)data)->name) - found_match = true; - } - else - if ( dt->_service->description == ((service_struct*)data)->description && dt->_service->host_name == ((service_struct*)data)->host_name ) - found_match = true; - - if (found_match) + unsigned long id = it->first; + DowntimeOrComment *dt = it->second; + if ((void *)dt->_service == data || + (dt->_service == 0 && dt->_host == data)) { if (first) first = false; @@ -71,12 +59,6 @@ query->outputString(dt->_author_name); query->outputSublistSeparator(); query->outputString(dt->_comment); - if(_with_extra_info && !_is_downtime) { - query->outputSublistSeparator(); - query->outputInteger(((Comment*)dt)->_entry_type); - query->outputSublistSeparator(); - query->outputTime(dt->_entry_time); - } query->outputEndSublist(); } else @@ -99,9 +81,10 @@ // data points to a host or service // member is not a pointer, but an unsigned int (hack) int64_t id = (int64_t)member; // Hack. Convert it back. - DowntimeOrComment *dt = table->findEntry(id, _is_service); + DowntimeOrComment *dt = table->findEntry(id); return dt != 0 && - ( dt->_service == (service *)data || (dt->_service == 0 && dt->_host == (host *)data)); + ( dt->_service == (service *)data + || (dt->_service == 0 && dt->_host == (host *)data)); } bool DownCommColumn::isEmpty(void *data) @@ -109,7 +92,7 @@ if (!data) return true; TableDownComm *table = _is_downtime ? g_table_downtimes : g_table_comments; - for (map, DowntimeOrComment *>::iterator it = table->entriesIteratorBegin(); + for (map::iterator it = table->entriesIteratorBegin(); it != table->entriesIteratorEnd(); ++it) { diff -Naur check_mk-1.2.3i6/livestatus.src/src/DownCommColumn.h livestatus.working/src/DownCommColumn.h --- check_mk-1.2.3i6/livestatus.src/src/DownCommColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/DownCommColumn.h 2013-11-21 16:04:45.000000000 +0100 @@ -36,11 +36,9 @@ { bool _is_downtime; bool _with_info; - bool _is_service; // and not host - bool _with_extra_info; // provides date and type public: - DownCommColumn(string name, string description, int indirect_offset, bool is_downtime, bool is_service, bool with_info, bool with_extra_info) - : ListColumn(name, description, indirect_offset), _is_downtime(is_downtime), _is_service(is_service), _with_info(with_info), _with_extra_info(with_extra_info) {} + DownCommColumn(string name, string description, int indirect_offset, bool is_downtime, bool with_info) + : ListColumn(name, description, indirect_offset), _is_downtime(is_downtime), _with_info(with_info) {} int type() { return COLTYPE_LIST; } void output(void *, Query *); void *getNagiosObject(char *name); diff -Naur check_mk-1.2.3i6/livestatus.src/src/DowntimeOrComment.cc livestatus.working/src/DowntimeOrComment.cc --- check_mk-1.2.3i6/livestatus.src/src/DowntimeOrComment.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/DowntimeOrComment.cc 2013-11-21 15:51:13.000000000 +0100 @@ -24,6 +24,7 @@ #include "DowntimeOrComment.h" #include "logger.h" +#include DowntimeOrComment::DowntimeOrComment(nebstruct_downtime_struct *dt, unsigned long id) diff -Naur check_mk-1.2.3i6/livestatus.src/src/Filter.h livestatus.working/src/Filter.h --- check_mk-1.2.3i6/livestatus.src/src/Filter.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Filter.h 2013-11-21 15:51:13.000000000 +0100 @@ -33,27 +33,23 @@ using namespace std; class Query; -class Column; class Filter { string _error_message; // Error in constructor unsigned _error_code; - Column *_column; protected: Query *_query; // needed by TimeOffsetFilter (currently) void setError(unsigned code, const char *format, ...); public: - Filter() : _query(0), _column(0) {} + Filter() : _query(0) {} virtual ~Filter() {} string errorMessage() { return _error_message; } unsigned errorCode() { return _error_code; } bool hasError() { return _error_message != ""; } void setQuery(Query *q) { _query = q; } - void setColumn(Column *c) { _column = c; } - Column *column() { return _column; } virtual bool accepts(void *data) = 0; virtual void *indexFilter(const char *columnname __attribute__ ((__unused__))) { return 0; } virtual void findIntLimits(const char *columnname __attribute__ ((__unused__)), int *lower __attribute__ ((__unused__)), int *upper __attribute__ ((__unused__))) {} diff -Naur check_mk-1.2.3i6/livestatus.src/src/global_counters.h livestatus.working/src/global_counters.h --- check_mk-1.2.3i6/livestatus.src/src/global_counters.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/global_counters.h 2013-11-21 15:51:13.000000000 +0100 @@ -45,8 +45,7 @@ #define COUNTER_COMMANDS 7 #define COUNTER_LIVECHECKS 8 #define COUNTER_LIVECHECK_OVERFLOWS 9 -#define COUNTER_OVERFLOWS 10 -#define NUM_COUNTERS 11 +#define NUM_COUNTERS 10 EXTERN counter_t g_counters[NUM_COUNTERS]; EXTERN counter_t g_last_counter[NUM_COUNTERS]; diff -Naur check_mk-1.2.3i6/livestatus.src/src/HostlistColumnFilter.cc livestatus.working/src/HostlistColumnFilter.cc --- check_mk-1.2.3i6/livestatus.src/src/HostlistColumnFilter.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/HostlistColumnFilter.cc 2013-11-21 15:51:13.000000000 +0100 @@ -45,7 +45,7 @@ host_name = mem->host_ptr->name; if (host_name == _ref_value) { - is_member = true; + return true; break; } mem = mem->next; diff -Naur check_mk-1.2.3i6/livestatus.src/src/HostSpecialDoubleColumn.cc livestatus.working/src/HostSpecialDoubleColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/HostSpecialDoubleColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/HostSpecialDoubleColumn.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,46 +0,0 @@ -// +------------------------------------------------------------------+ -// | ____ _ _ __ __ _ __ | -// | / ___| |__ ___ ___| | __ | \/ | |/ / | -// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | -// | | |___| | | | __/ (__| < | | | | . \ | -// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | -// | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | -// +------------------------------------------------------------------+ -// -// This file is part of Check_MK. -// The official homepage is at http://mathias-kettner.de/check_mk. -// -// check_mk 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 in version 2. check_mk is distributed -// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- -// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more de- -// ails. You should have received a copy of the GNU General Public -// License along with GNU Make; see the file COPYING. If not, write -// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -// Boston, MA 02110-1301 USA. - -#include "HostSpecialDoubleColumn.h" -#include "nagios.h" -#include "logger.h" -#include "time.h" - -extern int interval_length; - -double HostSpecialDoubleColumn::getValue(void *data) -{ - data = shiftPointer(data); - if (!data) return 0; - - host *hst = (host *)data; - - switch (_type) { - case HSDC_STALENESS: - { - return (time(0) - hst->last_check) / ((hst->check_interval == 0 ? 1 : hst->check_interval) * interval_length); - } - } - return -1; // Never reached -} diff -Naur check_mk-1.2.3i6/livestatus.src/src/HostSpecialDoubleColumn.h livestatus.working/src/HostSpecialDoubleColumn.h --- check_mk-1.2.3i6/livestatus.src/src/HostSpecialDoubleColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/HostSpecialDoubleColumn.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,44 +0,0 @@ -// +------------------------------------------------------------------+ -// | ____ _ _ __ __ _ __ | -// | / ___| |__ ___ ___| | __ | \/ | |/ / | -// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | -// | | |___| | | | __/ (__| < | | | | . \ | -// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | -// | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | -// +------------------------------------------------------------------+ -// -// This file is part of Check_MK. -// The official homepage is at http://mathias-kettner.de/check_mk. -// -// check_mk 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 in version 2. check_mk is distributed -// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- -// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more de- -// ails. You should have received a copy of the GNU General Public -// License along with GNU Make; see the file COPYING. If not, write -// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -// Boston, MA 02110-1301 USA. - -#ifndef ServiceSpecialDoubleColumn_h -#define ServiceSpecialDoubleColumn_h - -#include "config.h" -#include "DoubleColumn.h" - -#define HSDC_STALENESS 1 - -class HostSpecialDoubleColumn : public DoubleColumn -{ - int _type; - -public: - HostSpecialDoubleColumn(string name, string description, int hsdc_type, int indirect) - : DoubleColumn(name, description, indirect) , _type(hsdc_type) {} - double getValue(void *data); -}; - -#endif // ServiceSpecialDoubleColumn_h - diff -Naur check_mk-1.2.3i6/livestatus.src/src/InputBuffer.cc livestatus.working/src/InputBuffer.cc --- check_mk-1.2.3i6/livestatus.src/src/InputBuffer.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/InputBuffer.cc 2013-11-21 15:51:13.000000000 +0100 @@ -195,7 +195,6 @@ FD_ZERO(&fds); FD_SET(_fd, &fds); - int retval = select(_fd + 1, &fds, NULL, NULL, &tv); if (retval > 0 && FD_ISSET(_fd, &fds)) { ssize_t r = read(_fd, _write_pointer, _end_pointer - _write_pointer); diff -Naur check_mk-1.2.3i6/livestatus.src/src/IntColumn.cc livestatus.working/src/IntColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/IntColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/IntColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,12 +5,14 @@ @@ -43,3 +45,11 @@ snprintf(i, sizeof(i), "%d", getValue(data, query)); return i; } + +int IntColumn::compare(void *dataa, void*datab, Query *query) { + /* return a-b; would work, but isn't overflow-safe */ + int32_t a = getValue(dataa, query); + int32_t b = getValue(datab, query); + if( a==b ) return 0; + return (a>b)?(1):(-1); +} diff -Naur check_mk-1.2.3i6/livestatus.src/src/IntColumn.h livestatus.working/src/IntColumn.h --- check_mk-1.2.3i6/livestatus.src/src/IntColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/IntColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -41,6 +43,7 @@ int type() { return COLTYPE_INT; } string valueAsString(void *data, Query *); Filter *createFilter(int operator_id, char *value); + int compare(void *dataa, void*datab, Query *query); }; #endif // IntColumn_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/livecheck.c livestatus.working/src/livecheck.c --- check_mk-1.2.3i6/livestatus.src/src/livecheck.c 1970-01-01 01:00:00.000000000 +0100 +++ livestatus.working/src/livecheck.c 2013-11-21 15:51:13.000000000 +0100 @@ -0,0 +1,247 @@ +// +------------------------------------------------------------------+ +// | ____ _ _ __ __ _ __ | +// | / ___| |__ ___ ___| | __ | \/ | |/ / | +// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +// | | |___| | | | __/ (__| < | | | | . \ | +// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +// | | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | +// +------------------------------------------------------------------+ +// +// This file is part of Check_MK. +// The official homepage is at http://mathias-kettner.de/check_mk. +// +// check_mk 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 in version 2. check_mk is distributed +// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU General Public License for more de- +// ails. You should have received a copy of the GNU General Public +// License along with GNU Make; see the file COPYING. If not, write +// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "strutil.h" + +pid_t g_pid; +void alarm_handler(int); +void term_handler(int); +char **parse_into_arguments(char *command); +int check_icmp(int argc, char **argv, char *output); +int icmp_sock = -1; + +// This program must be called with two arguments: +// 1. Path to check result directory +// 2. timeout for host checks +// 3. timeout for service checks +int main(int argc, char **argv) +{ + if (argc != 4) { + fprintf(stderr, "Usage: %s CHECKRESULTPATH HOST_CHECK_TIMEOUT SERVICE_CHECK_TIMEOUT\n", argv[0]); + exit(1); + } + char *check_result_path = argv[1]; + int host_check_timeout = atoi(argv[2]); + int service_check_timeout = atoi(argv[3]); + + char host[256]; + char service[512]; + char latency[16]; + char command[1024]; + int pid; + int check_result; + int real_uid = getuid(); // non-root user id + int real_gid = getgid(); // non-root group id + + signal(SIGALRM, alarm_handler); // handler for check timeout + signal(SIGINT, term_handler); + signal(SIGQUIT, term_handler); + signal(SIGTERM, term_handler); + + while (1) { + write(1, "*", 1); // Signal Nagios that we are finished + if (NULL == fgets(host, sizeof(host), stdin) + || NULL == fgets(service, sizeof(service), stdin) + || NULL == fgets(latency, sizeof(latency), stdin) + || NULL == fgets(command, sizeof(command), stdin)) + { + exit(0); + } + + int is_host_check = service[0] == '\n'; + struct timeb start; + ftime(&start); + char output[8192]; + int return_code; + + // Optimization(1): + // If it's check_icmp, we use our inline version + // of that. But only if we have (had) root priviledges + // and had been able to create a raw socket + if (geteuid() == 0 && strstr(command, "/check_icmp ")) { + char **arguments = parse_into_arguments(command); + int arg_c = 0; + while (arguments[arg_c]) + arg_c++; + return_code = check_icmp(arg_c, arguments, output); + } + else { + int fd[2]; + pipe(fd); + + pid = fork(); + if (pid == 0) { + // Drop root priviledges: only needed for ICMP socket + if (geteuid() == 0) + setuid(getuid()); + + close(fd[0]); // close read end + dup2(fd[1], 1); // point stdout into pipe + dup2(fd[1], 2); // also point stderr into pipe + close(fd[1]); // lives forth in 1 and 2 + int f = open("/dev/null", O_RDONLY); + dup2(f, 0); + close(f); + + // Allow for larger stack size + struct rlimit rl; + getrlimit(RLIMIT_STACK, &rl); + rl.rlim_cur = 32 * 1024 * 1024; + rl.rlim_max = 32 * 1024 * 1024; + setrlimit(RLIMIT_STACK, &rl); + + // Optimization(2): + // if Command begins / and command line does not + // contain any ', /, < or >, split by spaces and + // directly call exec. + // This save two fork()s and one shell. + if (command[0] == '/' + && NULL == strchr(command, '"') + && NULL == strchr(command, '\'') + && NULL == strchr(command, '>') + && NULL == strchr(command, '<') + && NULL == strchr(command, ';') + && NULL == strchr(command, '|')) + { + char **arguments = parse_into_arguments(command); + execv(arguments[0], arguments); + } + else { + int ret = system(command); + if (WIFEXITED(ret)) + exit(WEXITSTATUS(ret)); + } + exit(127); + } + else { /* parent process */ + close(fd[1]); + g_pid = pid; + unsigned timeout = is_host_check ? host_check_timeout : service_check_timeout; + if (timeout) + alarm(timeout); + + int bytes_read = read(fd[0], output, sizeof(output)); + close(fd[0]); + int ret; + waitpid(pid, &ret, 0); + g_pid = 0; + alarm(0); // cancel timeout + + if (WIFSIGNALED(ret)) { + int signum = WTERMSIG(ret); + if (signum == SIGKILL) { + snprintf(output, sizeof(output), "(Check Timed Out After %d Seconds)\n", timeout); + return_code = 3; + } + else { + snprintf(output, sizeof(output), "(Check Plugin Died With Signal %d)\n", signum); + return_code = 3; + } + } + else { + return_code = WEXITSTATUS(ret); + if (0 == bytes_read || output[0] == '\n') + snprintf(output, sizeof(output), "(No output returned from plugin)\n"); + } + } + } + struct timeb end; + ftime(&end); + char template[256]; + snprintf(template, sizeof(template), "%s/cXXXXXX", check_result_path); + int fd = mkstemp(template); + fchmod(fd, 0600); + FILE *checkfile = fdopen(fd, "w"); + fprintf(checkfile, "host_name=%s", host); + if (!is_host_check) + fprintf(checkfile, "service_description=%s", service); + fprintf(checkfile, + "### Check result created by livecheck(%d)\n" + "check_type=%d\n" + "check_options=0\n" + "scheduled_check=1\n" + "reschedule_check=1\n" + "latency=%s" + "start_time=%d.%03u\n" + "finish_time=%d.%03u\n" + "return_code=%d\n" + "output=%s\n", + getpid(), + is_host_check ? 0 : 1, + latency, + (int)start.time, + start.millitm, + (int)end.time, + end.millitm, + return_code, + output); + fchown(fd, real_uid, real_gid); + fclose(checkfile); + strcat(template, ".ok"); + fd = creat(template, 0600); + fchown(fd, real_uid, real_gid); + close(fd); + } +} + +char **parse_into_arguments(char *command) +{ + static char *arguments[128]; + char *c = command; + char *executable = next_field(&c); + arguments[0] = executable; + unsigned a = 1; + while (a < 127) { + char *arg = next_field(&c); + arguments[a++] = arg; + if (!arg) break; + } + return arguments; +} + +// Propagate signal to child, if we are killed +void term_handler(int signum) +{ + if (g_pid) { + kill(g_pid, signum); + } + exit(0); +} + +// handle check timeout +void alarm_handler(int signum) +{ + if (g_pid) { + kill(g_pid, SIGKILL); + } +} diff -Naur check_mk-1.2.3i6/livestatus.src/src/livechecking.c livestatus.working/src/livechecking.c --- check_mk-1.2.3i6/livestatus.src/src/livechecking.c 1970-01-01 01:00:00.000000000 +0100 +++ livestatus.working/src/livechecking.c 2013-11-21 15:51:13.000000000 +0100 @@ -0,0 +1,299 @@ +// +------------------------------------------------------------------+ +// | ____ _ _ __ __ _ __ | +// | / ___| |__ ___ ___| | __ | \/ | |/ / | +// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +// | | |___| | | | __/ (__| < | | | | . \ | +// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +// | | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | +// +------------------------------------------------------------------+ +// +// This file is part of Check_MK. +// The official homepage is at http://mathias-kettner.de/check_mk. +// +// check_mk 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 in version 2. check_mk is distributed +// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU General Public License for more de- +// ails. You should have received a copy of the GNU General Public +// License along with GNU Make; see the file COPYING. If not, write +// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA. + + +#include +#include +#include +#include + +#include "nagios.h" +#include "logger.h" +#include "global_counters.h" + +extern int g_debug_level; + +extern int currently_running_host_checks; +extern int currently_running_service_checks; +extern char *check_result_path; +extern char g_livecheck_path[]; +extern int host_check_timeout; +extern int service_check_timeout; + +extern int g_num_livehelpers; +extern int g_livecheck_enabled; + +#define LH_WAITING 0 +#define LH_READY 1 +#define LH_DEAD 2 + +struct live_helper { + int id; + pid_t pid; + int sock; + FILE *fsock; + int status; +}; +struct live_helper *g_live_helpers; + +void start_livecheck_helper(struct live_helper *lh) +{ + int fd[2]; // fd[0] used by us, fd[1] by livecheck helper + socketpair(AF_UNIX, SOCK_STREAM, 0, fd); + pid_t pid = fork(); + if (pid == 0) { + dup2(fd[1], 0); + dup2(fd[1], 1); + dup2(fd[1], 2); + close(fd[0]); + char ht[32]; + snprintf(ht, sizeof(ht), "%u", host_check_timeout); + char st[32]; + snprintf(st, sizeof(st), "%u", service_check_timeout); + + // reduce stack size in order to save memory + struct rlimit rl; + getrlimit(RLIMIT_STACK, &rl); + rl.rlim_cur = 65536; + setrlimit(RLIMIT_STACK, &rl); + execl(g_livecheck_path, "livecheck", check_result_path, ht, st, (char *)0); + logger(LG_INFO, "ERROR: Cannot start livecheck helper: %s", strerror(errno)); + exit(1); + } + close(fd[1]); + // Make sure our socket is not forked() by Nagios + if (0 < fcntl(fd[0], F_SETFD, FD_CLOEXEC)) { + logger(LG_INFO, "WARNING: Cannot set FD_CLOEXEC on fd %d: %s", + fd[0], strerror(errno)); + } + lh->pid = pid; + lh->sock = fd[0]; + lh->fsock = fdopen(fd[0], "r+"); + lh->status = LH_WAITING; // wait until helper sends "ready" byte. +} + +void terminate_livecheck_helper(struct live_helper *lh) { + fclose(lh->fsock); + kill(lh->pid, SIGTERM); + int status; + if (lh->pid != waitpid(lh->pid, &status, 0)) + { + // Nagios calls waitpid(-1, ...) from time to time and that + // wait catches away our exit code. They should better know + // which PID they are looking for :-(... + if (g_debug_level > 0) + logger(LG_INFO, "Could not wait() Livecheck helper [%d:%d], " + "Nagios was faster.", lh->pid, lh->sock); + } + else if (WIFSIGNALED(status) && WTERMSIG(status) != SIGTERM) + { + logger(LG_INFO, "Livecheck helper [%d:%d:%d] exited with signal %d.", + lh->id, lh->pid, lh->sock, WTERMSIG(status)); + } + else if (g_debug_level > 0) { + logger(LG_INFO, "Livecheck helper [%d:%d:%d] exited with status %d.", + lh->id, lh->pid, lh->sock, status); + } +} + +void restart_livecheck_helper(struct live_helper *lh) +{ + terminate_livecheck_helper(lh); + start_livecheck_helper(lh); +} + +void execute_livecheck(struct live_helper *lh, const char *host_name, + const char *service_description, double latency, const char *command) +{ + if (g_debug_level > 0) + logger(LG_INFO, "Executing livecheck for %s %s", host_name, service_description); + char signalbyte; + if (1 != read(lh->sock, &signalbyte, 1)) { + logger(LG_INFO, "ERROR: Livecheck helper [%d:%d:%d] not responding. " + "Restarting.", lh->id, lh->pid, lh->sock); + restart_livecheck_helper(lh); + /* trying again to read the ready byte. */ + if (1 != read(lh->sock, &signalbyte, 1)) { + logger(LG_INFO, "FATAL: Restarted helper [%d:%d:%d] doesn't " + "seem to live.", lh->id, lh->pid, lh->sock); + lh->status = LH_DEAD; + return; // This check will never be executed + } + } + fprintf(lh->fsock, "%s\n%s\n%.3f\n%s\n", + host_name, service_description, latency, command); + fflush(lh->fsock); + g_counters[COUNTER_LIVECHECKS]++; +} + +struct live_helper *get_free_live_helper() +{ + // Check if one of our helpers is free. First look + // at the flag + unsigned i; + for (i=0; i use select to detect livehelpers + // that have signalled us (by sending a byte) that they are + // free again. + fd_set fds; + FD_ZERO(&fds); + int max_fd = 0; + for (i=0; i= max_fd) + max_fd = fd; + } + } + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = 0; + int r = select(max_fd + 1, &fds, 0, 0, &tv); + if (r == 0) + return 0; + + struct live_helper *free_helper = 0; + for (i=0; itype != NEBTYPE_HOSTCHECK_ASYNC_PRECHECK) + return NEB_OK; // ignore other events + host *hst = hstdata->object_ptr; + + struct live_helper *lh = get_free_live_helper(); + if (!lh) { + if (g_debug_level > 0) + logger(LG_INFO, "No livecheck helper free."); + return NEB_OK; + } + + // Make core statstics work correctly + hst->check_options=CHECK_OPTION_NONE; + currently_running_host_checks++; + hst->is_executing=TRUE; + + // construct command line + clear_volatile_macros(); + grab_host_macros(hst); + + char *raw_command; + get_raw_command_line(hst->check_command_ptr, hst->check_command, &raw_command,0); + char *processed_command; + process_macros(raw_command, &processed_command, 0); + + execute_livecheck(lh, hst->name, "", hstdata->latency, processed_command); + + free(raw_command); + free(processed_command); + return NEBERROR_CALLBACKOVERRIDE; +} + +int broker_service_livecheck(int event_type __attribute__ ((__unused__)), void *data) +{ + nebstruct_service_check_data *svcdata = (nebstruct_service_check_data *)data; + if (event_type != NEBCALLBACK_SERVICE_CHECK_DATA + || svcdata->type != NEBTYPE_SERVICECHECK_ASYNC_PRECHECK) + return NEB_OK; // ignore other events + service *svc = svcdata->object_ptr; + + struct live_helper *lh = get_free_live_helper(); + if (!lh) { + if (g_debug_level > 0) + logger(LG_INFO, "No livecheck helper free."); + // Let the core handle this check himself + g_counters[COUNTER_LIVECHECK_OVERFLOWS]++; + return NEB_OK; + } + + // Make core statstics work correctly + svc->check_options=CHECK_OPTION_NONE; + currently_running_service_checks++; + svc->is_executing=TRUE; + + // construct command line + clear_volatile_macros(); + grab_host_macros(svc->host_ptr); + grab_service_macros(svc); + char *raw_command; + get_raw_command_line(svc->check_command_ptr, svc->check_command, &raw_command,0); + char *processed_command; + process_macros(raw_command, &processed_command, 0); + + execute_livecheck(lh, svc->host_name, svc->description, svcdata->latency, processed_command); + + free(raw_command); + free(processed_command); + return NEBERROR_CALLBACKOVERRIDE; +} + + +void init_livecheck() +{ + if (!g_livecheck_enabled) + return; + + logger(LG_INFO, "Starting %d livechecks helpers", g_num_livehelpers); + g_live_helpers = (struct live_helper *)malloc(sizeof(struct live_helper) * g_num_livehelpers); + + unsigned i; + for (i=0; i -#include -#include -#include -#include -#include -#include - -#include "nagios.h" -#include "logger.h" -#include "tables.h" -#include "auth.h" -#include "Logfile.h" -#include "LogEntry.h" -#include "LogCache.h" - -#define CHECK_MEM_CYCLE 1000 /* Check memory every N'th new message */ - -// watch nagios' logfile rotation -extern time_t last_log_rotation; -extern int g_debug_level; -extern char *log_archive_path; -extern char *log_file; - - -int num_cached_log_messages = 0; - -// Debugging logging is hard if debug messages are logged themselves... -void debug(const char *loginfo, ...) -{ - if (g_debug_level >= 3) - return; - - FILE *x = fopen("/tmp/livestatus.log", "a+"); - va_list ap; - va_start(ap, loginfo); - vfprintf(x, loginfo, ap); - fputc('\n', x); - va_end(ap); - fclose(x); -} - -LogCache::LogCache(unsigned long max_cached_messages) - : _max_cached_messages(max_cached_messages) - , _num_at_last_check(0) -{ - pthread_mutex_init(&_lock, 0); - updateLogfileIndex(); -} - -void LogCache::setMaxCachedMessages(unsigned long m) -{ - if (m != _max_cached_messages) { - logger(LOG_NOTICE, "Logfile cache: Changing max messages to %ld", m); - _max_cached_messages = m; - } -} - - -LogCache::~LogCache() -{ - forgetLogfiles(); - pthread_mutex_destroy(&_lock); -} - -void LogCache::lockLogCache() -{ - pthread_mutex_lock(&_lock); -} - -void LogCache::unlockLogCache() -{ - pthread_mutex_unlock(&_lock); -} - -bool LogCache::logCachePreChecks() -{ - // Do we have any logfiles (should always be the case, - // but we don't want to crash... - if (_logfiles.size() == 0) { - logger(LOG_INFO, "Warning: no logfile found, not even %s", log_file); - return false; - } - // Has Nagios rotated logfiles? => Update - // our file index. And delete all memorized - // log messages. - if (last_log_rotation > _last_index_update) { - logger(LG_INFO, "Nagios has rotated logfiles. Rebuilding logfile index"); - forgetLogfiles(); - updateLogfileIndex(); - } - return true; -} - -void LogCache::forgetLogfiles() -{ - logger(LOG_INFO, "Logfile cache: flushing complete cache."); - for (_logfiles_t::iterator it = _logfiles.begin(); - it != _logfiles.end(); - ++it) - { - delete it->second; - } - _logfiles.clear(); - num_cached_log_messages = 0; -} - -void LogCache::updateLogfileIndex() -{ - _last_index_update = time(0); - // We need to find all relevant logfiles. This includes - // directory. - // the current nagios.log and all files in the archive - scanLogfile(log_file, true); - - DIR *dir = opendir(log_archive_path); - - if (dir) { - char abspath[4096]; - struct dirent *ent, *result; - int len = offsetof(struct dirent, d_name) - + pathconf(log_archive_path, _PC_NAME_MAX) + 1; - ent = (struct dirent *)malloc(len); - - while (0 == readdir_r(dir, ent, &result) && result != 0) - { - if (ent->d_name[0] != '.') { - snprintf(abspath, sizeof(abspath), "%s/%s", log_archive_path, ent->d_name); - scanLogfile(abspath, false); - } - // ent = result; - } - free(ent); - closedir(dir); - } - else - logger(LG_INFO, "Cannot open log archive '%s'", log_archive_path); -} - -void LogCache::scanLogfile(char *path, bool watch) -{ - Logfile *logfile = new Logfile(path, watch); - time_t since = logfile->since(); - if (since) { - // make sure that no entry with that 'since' is existing yet. - // under normal circumstances this never happens. But the - // user might have copied files around. - if (_logfiles.find(since) == _logfiles.end()) - _logfiles.insert(make_pair(since, logfile)); - else { - logger(LG_WARN, "Ignoring duplicate logfile %s", path); - delete logfile; - } - } - else - delete logfile; -} - -void LogCache::dumpLogfiles() -{ - for (_logfiles_t::iterator it = _logfiles.begin(); - it != _logfiles.end(); - ++it) - { - Logfile *log = it->second; - debug("LOG %s from %d, %u messages, classes: 0x%04x", log->path(), log->since(), log->numEntries(), log->classesRead()); - } -} - -/* This method is called each time a log message is loaded - into memory. If the number of messages loaded in memory - is to large, memory will be freed by flushing logfiles - and message not needed by the current query. - - The parameters to this method reflect the current query, - not the messages that just has been loaded. - */ -void LogCache::handleNewMessage(Logfile *logfile, time_t since __attribute__ ((__unused__)), time_t until __attribute__ ((__unused__)), unsigned logclasses) -{ - if ( ++num_cached_log_messages <= _max_cached_messages ) - return; // current message count still allowed, everything ok - - /* Memory checking an freeing consumes CPU ressources. We save - ressources, by avoiding to make the memory check each time - a new message is loaded when being in a sitation where no - memory can be freed. We do this by suppressing the check when - the number of messages loaded into memory has not grown - by at least CHECK_MEM_CYCLE messages */ - if (num_cached_log_messages < _num_at_last_check + CHECK_MEM_CYCLE) - return; // Do not check this time - - // [1] Begin by deleting old logfiles - // Begin deleting with the oldest logfile available - _logfiles_t::iterator it; - for (it = _logfiles.begin(); it != _logfiles.end(); ++it) - { - Logfile *log = it->second; - if (log == logfile) { - // Do not touch the logfile the Query is currently accessing - break; - } - if (log->numEntries() > 0) { - num_cached_log_messages -= log->numEntries(); - log->flush(); // drop all messages of that file - if (num_cached_log_messages <= _max_cached_messages) { - // remember the number of log messages in cache when - // the last memory-release was done. No further - // release-check shall be done until that number changes. - _num_at_last_check = num_cached_log_messages; - return; - } - } - } - // The end of this loop must be reached by 'break'. At least one logfile - // must be the current logfile. So now 'it' points to the current logfile. - // We save that pointer for later. - _logfiles_t::iterator queryit = it; - - // [2] Delete message classes irrelevent to current query - // Starting from the current logfile (wo broke out of the - // previous loop just when 'it' pointed to that) - for (; it != _logfiles.end(); ++it) - { - Logfile *log = it->second; - if (log->numEntries() > 0 && (log->classesRead() & ~logclasses) != 0) { - if (g_debug_level > 2) - debug("Freeing classes 0x%02x of file %s", ~logclasses, log->path()); - long freed = log->freeMessages(~logclasses); // flush only messages not needed for current query - num_cached_log_messages -= freed; - if (num_cached_log_messages <= _max_cached_messages) { - _num_at_last_check = num_cached_log_messages; - return; - } - } - } - - // [3] Flush newest logfiles - // If there are still too many messages loaded, continue - // flushing logfiles from the oldest to the newest starting - // at the file just after (i.e. newer than) the current logfile - for (it = ++queryit; it != _logfiles.end(); ++it) - { - Logfile *log = it->second; - if (log->numEntries() > 0) { - debug("Flush newer log, msgs %d", log->numEntries()); - num_cached_log_messages -= log->numEntries(); - log->flush(); - if (num_cached_log_messages <= _max_cached_messages) { - _num_at_last_check = num_cached_log_messages; - return; - } - } - } - _num_at_last_check = num_cached_log_messages; - // If we reach this point, no more logfiles can be unloaded, - // despite the fact that there are still too many messages - // loaded. - - if (g_debug_level > 2) - debug("Cannot unload more messages. Still %d loaded (max is %d)", - num_cached_log_messages, _max_cached_messages); -} - diff -Naur check_mk-1.2.3i6/livestatus.src/src/LogCache.h livestatus.working/src/LogCache.h --- check_mk-1.2.3i6/livestatus.src/src/LogCache.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/LogCache.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,69 +0,0 @@ -// +------------------------------------------------------------------+ -// | ____ _ _ __ __ _ __ | -// | / ___| |__ ___ ___| | __ | \/ | |/ / | -// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | -// | | |___| | | | __/ (__| < | | | | . \ | -// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | -// | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | -// +------------------------------------------------------------------+ -// -// This file is part of Check_MK. -// The official homepage is at http://mathias-kettner.de/check_mk. -// -// check_mk 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 in version 2. check_mk is distributed -// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- -// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more de- -// ails. You should have received a copy of the GNU General Public -// License along with GNU Make; see the file COPYING. If not, write -// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -// Boston, MA 02110-1301 USA. - -#ifndef LogCache_h -#define LogCache_h - -#include -#include -#include "config.h" -#include "Table.h" - -class Logfile; - -typedef map _logfiles_t; - -class LogCache -{ - pthread_mutex_t _lock; - unsigned long _max_cached_messages; - unsigned long _num_at_last_check; - _logfiles_t _logfiles; - -public: - LogCache(unsigned long max_cached_messages); - ~LogCache(); - void setMaxCachedMessages(unsigned long m); - time_t _last_index_update; - - const char *name() { return "log"; } - const char *prefixname() { return "logs"; } - bool isAuthorized(contact *ctc, void *data); - void handleNewMessage(Logfile *logfile, time_t since, time_t until, unsigned logclasses); - Column *column(const char *colname); // override in order to handle current_ - _logfiles_t *logfiles() { return &_logfiles; }; - void forgetLogfiles(); - void updateLogfileIndex(); - - bool logCachePreChecks(); - void lockLogCache(); - void unlockLogCache(); - -private: - void scanLogfile(char *path, bool watch); - _logfiles_t::iterator findLogfileStartingBefore(time_t); - void dumpLogfiles(); -}; - -#endif // LogCache_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/LogEntry.cc livestatus.working/src/LogEntry.cc --- check_mk-1.2.3i6/livestatus.src/src/LogEntry.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/LogEntry.cc 2013-11-21 15:51:13.000000000 +0100 @@ -4,34 +4,30 @@ // | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | -// | |_____| | -// | __ __ _ ____ | -// | | \/ (_) ___ _ __ ___ / ___|___ _ __ ___ | -// | | |\/| | |/ __| '__/ _ \ | | / _ \| '__/ _ \ | -// | | | | | | (__| | | (_) | | |__| (_) | | | __/ | -// | |_| |_|_|\___|_| \___/ \____\___/|_| \___| | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // -// This file is part of the Check_MK Micro Core. Copyright by Mathias -// Kettner, Preysingstr. 74, 81667 München, Germany. All rights are -// reserved. You may *not* redistribute or modify this software unless -// you have a written permission of the owner. This file is *not* -// available under GNU GPL. If you do not like this then please use a -// different monitoring core. +// This file is part of Check_MK. +// The official homepage is at http://mathias-kettner.de/check_mk. // -// Please note: This software is experimental. Use at your own risk. +// check_mk 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 in version 2. check_mk is distributed +// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU General Public License for more de- +// ails. You should have received a copy of the GNU General Public +// License along with GNU Make; see the file COPYING. If not, write +// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA. #include -#include -#include - #include "LogEntry.h" #include "strutil.h" #include "logger.h" -LogEntry::LogEntry(unsigned lineno, char *line, unsigned logclasses = LOGCLASS_ALL) +LogEntry::LogEntry(unsigned lineno, char *line) { // zero all elements as fast as possible -> default values bzero(this, sizeof(LogEntry)); @@ -43,7 +39,6 @@ while (_msglen > 0 && _msg[_msglen-1] == '\n') _msg[--_msglen] = '\0'; - // keep unsplitted copy of the message (needs lots of memory, // maybe we could optimize that one day...) _complete = strdup(_msg); @@ -68,25 +63,24 @@ _time = atoi(_msg+1); _text = _msg + 13; // also skip space after timestamp - // If LOGCLASS_INFO is in logclasses we can't thin out the function calls - logclasses = 1 << LOGCLASS_INFO & logclasses ? LOGCLASS_ALL : logclasses; - // now classify the log message. Some messages // refer to other table, some do not. - if (((1 << LOGCLASS_ALERT & logclasses) && handleStatusEntry()) || - ((1 << LOGCLASS_NOTIFICATION & logclasses) && handleNotificationEntry()) || - ((1 << LOGCLASS_PASSIVECHECK & logclasses) && handlePassiveCheckEntry()) || - ((1 << LOGCLASS_COMMAND & logclasses) && handleExternalCommandEntry()) - ) - { - updateReferences(); - } - else { - (1 << LOGCLASS_PROGRAM & logclasses) && handleProgrammEntry(); // Performance killer strstr! - (1 << LOGCLASS_TEXT & logclasses) && handleTextEntry(); + if (handleStatusEntry() || + handleNotificationEntry() || + handlePassiveCheckEntry() || + handleExternalCommandEntry()) + { + if (_host_name) + _host = find_host(_host_name); + if (_svc_desc) + _service = find_service(_host_name, _svc_desc); + if (_contact_name) + _contact = find_contact(_contact_name); + if (_command_name) + _command = find_command(_command_name); } - - + else + handleProgrammEntry(); // rest is LOGCLASS_INFO } @@ -97,47 +91,17 @@ } - - -inline bool LogEntry::handleStatusEntry() +bool LogEntry::handleStatusEntry() { -//// TODO: check if its worth of implementing -//// Most lines are status entries anyway... -// int len_text = strlen(_text); -// if (len_text < 12) -// return false; -// -// // Quick basic check -// // We can skip all other strcmp() calls -// // if the first letter does not match -// switch (_text[0]) { -// case 'I': -// case 'C': -// case 'S': -// case 'T': -// case 'H': -// break; -// default: -// return false; -// } - // HOST states if (!strncmp(_text, "INITIAL HOST STATE: ", 20) - || !strncmp(_text, "CURRENT HOST STATE: ", 20) - || !strncmp(_text, "HOST ALERT: ", 12)) + || !strncmp(_text, "CURRENT HOST STATE: ", 20) + || !strncmp(_text, "HOST ALERT: ", 12)) { - if (_text[0] == 'H'){ + if (_text[0] == 'H') _logclass = LOGCLASS_ALERT; - _type = ALERT_HOST; - } - else if(_text[0] == 'I') { + else _logclass = LOGCLASS_STATE; - _type = STATE_HOST_INITIAL; - } - else { - _logclass = LOGCLASS_STATE; - _type = STATE_HOST; - } char *scan = _text; _text = next_token(&scan, ':'); @@ -150,23 +114,10 @@ _check_output = next_token(&scan, ';'); return true; } - else if (!strncmp(_text, "HOST DOWNTIME ALERT: ", 21)) - { - _logclass = LOGCLASS_ALERT; - _type = DOWNTIME_ALERT_HOST; - char *scan = _text; - _text = next_token(&scan, ':'); - scan++; - - _host_name = next_token(&scan, ';'); - _state_type = next_token(&scan, ';'); - _comment = next_token(&scan, ';') + 1; - return true; - } - else if (!strncmp(_text, "HOST FLAPPING ALERT: ", 21)) + else if (!strncmp(_text, "HOST DOWNTIME ALERT: ", 21) + || !strncmp(_text, "HOST FLAPPING ALERT: ", 21)) { _logclass = LOGCLASS_ALERT; - _type = FLAPPING_HOST; char *scan = _text; _text = next_token(&scan, ':'); scan++; @@ -179,21 +130,13 @@ // SERVICE states else if (!strncmp(_text, "INITIAL SERVICE STATE: ", 23) - || !strncmp(_text, "CURRENT SERVICE STATE: ", 23) - || !strncmp(_text, "SERVICE ALERT: ", 15)) + || !strncmp(_text, "CURRENT SERVICE STATE: ", 23) + || !strncmp(_text, "SERVICE ALERT: ", 15)) { - if (_text[0] == 'S'){ + if (_text[0] == 'S') _logclass = LOGCLASS_ALERT; - _type = ALERT_SERVICE; - } - else if(_text[0] == 'I') { - _logclass = LOGCLASS_STATE; - _type = STATE_SERVICE_INITIAL; - } - else{ + else _logclass = LOGCLASS_STATE; - _type = STATE_SERVICE; - } char *scan = _text; _text = next_token(&scan, ':'); scan++; @@ -206,24 +149,10 @@ _check_output = next_token(&scan, ';'); return true; } - else if (!strncmp(_text, "SERVICE DOWNTIME ALERT: ", 24)) - { - _logclass = LOGCLASS_ALERT; - _type = DOWNTIME_ALERT_SERVICE; - char *scan = _text; - _text = next_token(&scan, ':'); - scan++; - - _host_name = next_token(&scan, ';'); - _svc_desc = next_token(&scan, ';'); - _state_type = next_token(&scan, ';'); - _comment = next_token(&scan, ';') + 1; - return true; - } - else if (!strncmp(_text, "SERVICE FLAPPING ALERT: ", 24)) + else if (!strncmp(_text, "SERVICE DOWNTIME ALERT: ", 24) + || !strncmp(_text, "SERVICE FLAPPING ALERT: ", 24)) { _logclass = LOGCLASS_ALERT; - _type = FLAPPING_SERVICE; char *scan = _text; _text = next_token(&scan, ':'); scan++; @@ -234,24 +163,14 @@ _comment = next_token(&scan, ';') + 1; return true; } - - - else if (!strncmp(_text, "TIMEPERIOD TRANSITION: ", 23)) - { - _logclass = LOGCLASS_STATE; - _type = TIMEPERIOD_TRANSITION; - return true; - } - return false; -} - +} -inline bool LogEntry::handleNotificationEntry() +bool LogEntry::handleNotificationEntry() { if (!strncmp(_text, "HOST NOTIFICATION: ", 19) - || !strncmp(_text, "SERVICE NOTIFICATION: ", 22)) + || !strncmp(_text, "SERVICE NOTIFICATION: ", 22)) { _logclass = LOGCLASS_NOTIFICATION; bool svc = _text[0] == 'S'; @@ -275,14 +194,13 @@ _check_output = next_token(&scan, ';'); return true; } - return false; } -inline bool LogEntry::handlePassiveCheckEntry() +bool LogEntry::handlePassiveCheckEntry() { if (!strncmp(_text, "PASSIVE SERVICE CHECK: ", 23) - || !strncmp(_text, "PASSIVE HOST CHECK: ", 20)) + || !strncmp(_text, "PASSIVE HOST CHECK: ", 20)) { _logclass = LOGCLASS_PASSIVECHECK; bool svc = _text[8] == 'S'; @@ -301,7 +219,7 @@ return false; } -inline bool LogEntry::handleExternalCommandEntry() +bool LogEntry::handleExternalCommandEntry() { if (!strncmp(_text, "EXTERNAL COMMAND:", 17)) { @@ -317,32 +235,10 @@ return false; } -inline bool LogEntry::handleTextEntry() -{ - if (!strncmp(_text, "LOG VERSION: 2.0", 16)) - { - _logclass = LOGCLASS_PROGRAM; - _type = LOG_VERSION; - return true; - } - else if (!strncmp(_text, "logging initial states", 22) - || !strncmp(_text, "logging intitial states", 23)) - { - _logclass = LOGCLASS_PROGRAM; - _type = LOG_INITIAL_STATES; - return true; - } - return false; -} - -inline bool LogEntry::handleProgrammEntry() +bool LogEntry::handleProgrammEntry() { - if (strstr(_text, "starting... (PID=")){ - _logclass = LOGCLASS_PROGRAM; - _type = NAGIOS_STARTING; - return true; - } - else if (strstr(_text, "restarting...") || + if (strstr(_text, "restarting...") || + strstr(_text, "starting...") || strstr(_text, "shutting down...") || strstr(_text, "Bailing out") || strstr(_text, "active mode...") || @@ -355,7 +251,7 @@ } -inline int LogEntry::serviceStateToInt(char *s) +int LogEntry::serviceStateToInt(char *s) { char *last = s + strlen(s) - 1; if (*last == ')') @@ -373,7 +269,7 @@ } -inline int LogEntry::hostStateToInt(char *s) +int LogEntry::hostStateToInt(char *s) { char *last = s + strlen(s) - 1; if (*last == ')') @@ -389,25 +285,3 @@ } } - -unsigned LogEntry::updateReferences() -{ - unsigned updated = 0; - if (_host_name) { - _host = find_host(_host_name); - updated++; - } - if (_svc_desc) { - _service = find_service(_host_name, _svc_desc); - updated++; - } - if (_contact_name) { - _contact = find_contact(_contact_name); - updated++; - } - if (_command_name) { - _command = find_command(_command_name); - updated++; - } - return updated; -} diff -Naur check_mk-1.2.3i6/livestatus.src/src/LogEntry.h livestatus.working/src/LogEntry.h --- check_mk-1.2.3i6/livestatus.src/src/LogEntry.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/LogEntry.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -32,71 +32,46 @@ #define LOGCLASS_PASSIVECHECK 4 // passive checks #define LOGCLASS_COMMAND 5 // external commands #define LOGCLASS_STATE 6 // initial or current states -#define LOGCLASS_TEXT 7 // specific text passages. e.g "logging initial states" - // TODO: This LOGCLASS sets different logclasses on match -> fix this #define LOGCLASS_INVALID -1 // never stored #define LOGCLASS_ALL 0xffff #include "nagios.h" -enum LogEntryType { - NONE, - ALERT_HOST, - ALERT_SERVICE, - DOWNTIME_ALERT_HOST, - DOWNTIME_ALERT_SERVICE, - STATE_HOST, - STATE_HOST_INITIAL, - STATE_SERVICE, - STATE_SERVICE_INITIAL, - FLAPPING_HOST, - FLAPPING_SERVICE, - TIMEPERIOD_TRANSITION, - NAGIOS_STARTING, - LOG_VERSION, - LOG_INITIAL_STATES, -}; - struct LogEntry { - unsigned _lineno; // line number in file - time_t _time; - unsigned _logclass; - LogEntryType _type; - char *_complete; // copy of complete unsplit message - char *_options; // points into _complete after ':' - char *_msg; // split up with binary zeroes - unsigned _msglen; // size of _msg - char *_text; // points into msg - char *_host_name; // points into msg or is 0 - char *_svc_desc; // points into msg or is 0 - char *_command_name; - char *_contact_name; - int _state; - char *_state_type; - int _attempt; - char *_check_output; - char *_comment; - - host *_host; - service *_service; - contact *_contact; - command *_command; + unsigned _lineno; // line number in file + time_t _time; + unsigned _logclass; + char *_complete; // copy of complete unsplit message + char *_options; // points into _complete after ':' + char *_msg; // split up with binary zeroes + unsigned _msglen; // size of _msg + char *_text; // points into msg + char *_host_name; // points into msg or is 0 + char *_svc_desc; // points into msg or is 0 + char *_command_name; + char *_contact_name; + int _state; + char *_state_type; + int _attempt; + char *_check_output; + char *_comment; + + host *_host; + service *_service; + contact *_contact; + command *_command; - LogEntry(unsigned lineno, char *line, unsigned logclasses); + LogEntry(unsigned lineno, char *line); ~LogEntry(); - unsigned updateReferences(); private: bool handleStatusEntry(); - bool handleStatusEntryBetter(); bool handleNotificationEntry(); bool handlePassiveCheckEntry(); bool handleExternalCommandEntry(); bool handleProgrammEntry(); - bool handleLogversionEntry(); bool handleInfoEntry(); - bool handleTextEntry(); int serviceStateToInt(char *s); int hostStateToInt(char *s); }; diff -Naur check_mk-1.2.3i6/livestatus.src/src/Logfile.cc livestatus.working/src/Logfile.cc --- check_mk-1.2.3i6/livestatus.src/src/Logfile.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Logfile.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -25,19 +25,16 @@ #include #include #include +#include #include - #include "Logfile.h" #include "logger.h" #include "LogEntry.h" #include "Query.h" -#include "LogCache.h" - -#ifdef CMC -#include "Core.h" -extern Core *g_core; -#endif +#include "TableLog.h" +extern int num_cached_log_messages; +extern int g_debug_level; Logfile::Logfile(const char *path, bool watch) : _path(strdup(path)) @@ -73,26 +70,28 @@ Logfile::~Logfile() { - flush(); free(_path); + flush(); } void Logfile::flush() { - for (logfile_entries_t::iterator it = _entries.begin(); it != _entries.end(); ++it) + for (_entries_t::iterator it = _entries.begin(); + it != _entries.end(); + ++it) + { delete it->second; - + } _entries.clear(); _logclasses_read = 0; } -void Logfile::load(LogCache *logcache, time_t since, time_t until, unsigned logclasses) +void Logfile::load(TableLog *tablelog, time_t since, time_t until, unsigned logclasses) { - // HIER KOENNTE ICH FLUSHEN, WENN g_active_world nicht mehr stimmt - unsigned missing_types = logclasses & ~_logclasses_read; + FILE *file = 0; // The current logfile has the _watch flag set to true. // In that case, if the logfile has grown, we need to @@ -113,13 +112,13 @@ // have read to the end of the file if (_logclasses_read) { fsetpos(file, &_read_pos); // continue at previous end - loadRange(file, _logclasses_read, logcache, since, until, logclasses); + loadRange(file, _logclasses_read, tablelog, since, until, logclasses); fgetpos(file, &_read_pos); } if (missing_types) { fseek(file, 0, SEEK_SET); _lineno = 0; - loadRange(file, missing_types, logcache, since, until, logclasses); + loadRange(file, missing_types, tablelog, since, until, logclasses); _logclasses_read |= missing_types; fgetpos(file, &_read_pos); // remember current end of file } @@ -136,29 +135,32 @@ return; } - loadRange(file, missing_types, logcache, since, until, logclasses); + loadRange(file, missing_types, tablelog, since, until, logclasses); fclose(file); _logclasses_read |= missing_types; } } void Logfile::loadRange(FILE *file, unsigned missing_types, - LogCache *logcache, time_t since, time_t until, unsigned logclasses) + TableLog *tablelog, time_t since, time_t until, unsigned logclasses) { - //logger(LOG_NOTICE, "Read logfile: %s", this->_path); while (fgets(_linebuffer, MAX_LOGLINE, file)) { _lineno++; if (processLogLine(_lineno, missing_types)) { - logcache->handleNewMessage(this, since, until, logclasses); // memory management + num_cached_log_messages ++; + tablelog->handleNewMessage(this, since, until, logclasses); // memory management } } } + long Logfile::freeMessages(unsigned logclasses) { long freed = 0; - for (logfile_entries_t::iterator it = _entries.begin(); it != _entries.end(); ++it) + for (_entries_t::iterator it = _entries.begin(); + it != _entries.end(); + ++it) { LogEntry *entry = it->second; if ((1 << entry->_logclass) & logclasses) @@ -172,9 +174,10 @@ return freed; } -inline bool Logfile::processLogLine(uint32_t lineno, unsigned logclasses) + +bool Logfile::processLogLine(uint32_t lineno, unsigned logclasses) { - LogEntry *entry = new LogEntry(lineno, _linebuffer, logclasses); + LogEntry *entry = new LogEntry(lineno, _linebuffer); // ignored invalid lines if (entry->_logclass == LOGCLASS_INVALID) { delete entry; @@ -197,19 +200,12 @@ } } -logfile_entries_t* Logfile::getEntriesFromQuery(Query *query, LogCache *logcache, time_t since, time_t until, unsigned logclasses) -{ - updateReferences(); - load(logcache, since, until, logclasses); // make sure all messages are present - return &_entries; -} -bool Logfile::answerQuery(Query *query, LogCache *logcache, time_t since, time_t until, unsigned logclasses) +bool Logfile::answerQuery(Query *query, TableLog *tablelog, time_t since, time_t until, unsigned logclasses) { - updateReferences(); - load(logcache, since, until, logclasses); // make sure all messages are present + load(tablelog, since, until, logclasses); // make sure all messages are present uint64_t sincekey = makeKey(since, 0); - logfile_entries_t::iterator it = _entries.lower_bound(sincekey); + _entries_t::iterator it = _entries.lower_bound(sincekey); while (it != _entries.end()) { LogEntry *entry = it->second; @@ -222,12 +218,11 @@ return true; } -bool Logfile::answerQueryReverse(Query *query, LogCache *logcache, time_t since, time_t until, unsigned logclasses) +bool Logfile::answerQueryReverse(Query *query, TableLog *tablelog, time_t since, time_t until, unsigned logclasses) { - updateReferences(); - load(logcache, since, until, logclasses); // make sure all messages are present + load(tablelog, since, until, logclasses); // make sure all messages are present uint64_t untilkey = makeKey(until, 999999999); - logfile_entries_t::iterator it = _entries.upper_bound(untilkey); + _entries_t::iterator it = _entries.upper_bound(untilkey); while (it != _entries.begin()) { --it; @@ -245,19 +240,3 @@ return (uint64_t)((uint64_t)t << 32) | (uint64_t)lineno; } - -void Logfile::updateReferences() -{ -#ifdef CMC - // If our references in cached log entries do not point to the currently - // active configuration world, then update all references - if (_world != g_live_world) { - unsigned num = 0; - for (logfile_entries_t::iterator it = _entries.begin(); it != _entries.end(); ++it) - num += it->second->updateReferences(); - logger(LOG_NOTICE, "Updated %u log cache references of %s to new world.", num, _path); - _world = g_live_world; - } -#endif -} - diff -Naur check_mk-1.2.3i6/livestatus.src/src/Logfile.h livestatus.working/src/Logfile.h --- check_mk-1.2.3i6/livestatus.src/src/Logfile.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Logfile.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -36,48 +36,37 @@ class LogEntry; class Query; -class LogCache; -class World; - -typedef map logfile_entries_t; // key is time_t . lineno +class TableLog; class Logfile { -private: char *_path; time_t _since; // time of first entry bool _watch; // true only for current logfile ino_t _inode; // needed to detect switching fpos_t _read_pos; // read until this position uint32_t _lineno; // read until this line - - logfile_entries_t _entries; + unsigned _logclasses_read; // only these types have been read + typedef map _entries_t; // key is time_t . lineno + _entries_t _entries; char _linebuffer[MAX_LOGLINE]; - World *_world; // CMC: world our references point into - public: Logfile(const char *path, bool watch); ~Logfile(); char *path() { return _path; } - void load(LogCache *LogCache, time_t since, time_t until, unsigned logclasses); + void load(TableLog *tablelog, time_t since, time_t until, unsigned logclasses); void flush(); time_t since() { return _since; } unsigned classesRead() { return _logclasses_read; } long numEntries() { return _entries.size(); } - logfile_entries_t* getEntriesFromQuery(Query *query, LogCache *lc, time_t since, time_t until, unsigned); - bool answerQuery(Query *query, LogCache *lc, time_t since, time_t until, unsigned); - bool answerQueryReverse(Query *query, LogCache *lc, time_t since, time_t until, unsigned); - + bool answerQuery(Query *query, TableLog *tl, time_t since, time_t until, unsigned); + bool answerQueryReverse(Query *query, TableLog *tl, time_t since, time_t until, unsigned); long freeMessages(unsigned logclasses); - void updateReferences(); - - unsigned _logclasses_read; // only these types have been read - private: - void loadRange(FILE *file, unsigned missing_types, LogCache *, + void loadRange(FILE *file, unsigned missing_types, TableLog *, time_t since, time_t until, unsigned logclasses); bool processLogLine(uint32_t, unsigned); uint64_t makeKey(time_t, unsigned); diff -Naur check_mk-1.2.3i6/livestatus.src/src/logger.c livestatus.working/src/logger.c --- check_mk-1.2.3i6/livestatus.src/src/logger.c 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/logger.c 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -29,6 +29,7 @@ #include #include #include +#include extern char g_logfile_path[]; pthread_t g_mainthread_id; @@ -44,10 +45,8 @@ void close_logfile() { - if (g_logfile) { + if (g_logfile) fclose(g_logfile); - g_logfile = 0; - } } void logger(int priority, const char *loginfo, ...) @@ -69,7 +68,7 @@ char timestring[64]; time_t now_t = time(0); struct tm now; localtime_r(&now_t, &now); - strftime(timestring, 64, "%F %T ", &now); + strftime(timestring, 64, "%F %T ", &now); fputs(timestring, g_logfile); /* write log message */ diff -Naur check_mk-1.2.3i6/livestatus.src/src/logger.h livestatus.working/src/logger.h --- check_mk-1.2.3i6/livestatus.src/src/logger.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/logger.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -27,15 +27,6 @@ #include "config.h" -#ifdef CMC -#include -#define LG_DEBUG LOG_INFO -#define LG_INFO LOG_NOTICE -#define LG_WARN LOG_WARNING -#define LG_ERR LOG_ERR -#define LG_CRIT LOG_CRIT -#define LG_ALERT LOG_ALERT -#else // TODO: Really use log levels #define LG_INFO 262144 #define LG_WARN LOG_INFO @@ -43,23 +34,18 @@ #define LG_CRIT LOG_INFO #define LG_DEBUG LOG_INFO #define LG_ALERT LOG_INFO -#endif #ifdef __cplusplus -#ifndef CMC extern "C" { #endif -#endif void logger(int priority, const char *loginfo, ...); void open_logfile(); void close_logfile(); #ifdef __cplusplus -#ifndef CMC } #endif -#endif #endif // logger_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/Makefile.am livestatus.working/src/Makefile.am --- check_mk-1.2.3i6/livestatus.src/src/Makefile.am 2013-10-24 13:44:19.000000000 +0200 +++ livestatus.working/src/Makefile.am 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ # | | |___| | | | __/ (__| < | | | | . \ | # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | # | | -# | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +# | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | # +------------------------------------------------------------------+ # # This file is part of Check_MK. @@ -26,6 +26,8 @@ unixcat_SOURCES = unixcat.c unixcat_LDADD = -lpthread +EXTRA_DIST = *.h + pkglib_LIBRARIES = livestatus.so livestatus_so_SOURCES = \ @@ -41,21 +43,27 @@ Query.cc ServiceContactsColumn.cc ServicegroupsColumn.cc ServicelistColumn.cc \ ServicelistColumnFilter.cc ServicelistStateColumn.cc store.cc Store.cc \ StringColumn.cc StringColumnFilter.cc strutil.cc Table.cc TableColumns.cc \ - HostSpecialDoubleColumn.cc TableCommands.cc TableContacts.cc TableDownComm.cc TableHostgroups.cc \ - ServiceSpecialDoubleColumn.cc TableHosts.cc TableServicegroups.cc TableServices.cc TableStatus.cc \ - LogEntry.cc LogCache.cc Logfile.cc TableStateHistory.cc TableLog.cc TableTimeperiods.cc TableContactgroups.cc \ + TableCommands.cc TableContacts.cc TableDownComm.cc TableHostgroups.cc \ + TableHosts.cc TableServicegroups.cc TableServices.cc TableStatus.cc \ + LogEntry.cc Logfile.cc TableLog.cc TableTimeperiods.cc TableContactgroups.cc \ ContactgroupsMemberColumn.cc OffsetStringMacroColumn.cc OffsetStringServiceMacroColumn.cc \ OffsetStringHostMacroColumn.cc StatsColumn.cc IntAggregator.cc CountAggregator.cc \ DoubleAggregator.cc AttributelistColumn.cc AttributelistFilter.cc \ global_counters.c module.c logger.c waittriggers.c TimeperiodsCache.cc pnp4nagios.cc \ - ContactgroupsColumn.cc opids.cc auth.cc + ContactgroupsColumn.cc RowSortedSet.cc opids.cc auth.cc livechecking.c + +if HAVE_DIET + diet -v $(CC) -x c -Wno-deprecated-declarations $(CFLAGS) $(LDFLAGS) -I.. -s -o $@ $^ +else + $(CC) -x c -Wno-deprecated-declarations $(CFLAGS) $(LDFLAGS) -I.. -s -o $@ $^ +endif -livestatus_so_CXXFLAGS = -I$(top_srcdir)/nagios -fPIC +livestatus_so_CXXFLAGS = -fPIC livestatus_so_CFLAGS = $(livestatus_so_CXXFLAGS) livestatus.o: $(livestatus_so_OBJECTS) $(livestatus_so_DEPENDENCIES) -rm -f plugin.so - $(CXX) $(LDFLAGS) -s -fPIC -shared $(livestatus_so_OBJECTS) -o $@ -lpthread -lstdc++ + $(CXX) $(LDFLAGS) -fPIC -shared $(livestatus_so_OBJECTS) -o $@ -lpthread -lstdc++ all-local: livestatus.o diff -Naur check_mk-1.2.3i6/livestatus.src/src/Makefile.in livestatus.working/src/Makefile.in --- check_mk-1.2.3i6/livestatus.src/src/Makefile.in 2013-10-31 11:23:02.000000000 +0100 +++ livestatus.working/src/Makefile.in 2013-11-21 15:51:41.000000000 +0100 @@ -22,7 +22,7 @@ # | | |___| | | | __/ (__| < | | | | . \ | # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | # | | -# | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +# | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | # +------------------------------------------------------------------+ # # This file is part of Check_MK. @@ -143,20 +143,16 @@ livestatus_so-StringColumnFilter.$(OBJEXT) \ livestatus_so-strutil.$(OBJEXT) livestatus_so-Table.$(OBJEXT) \ livestatus_so-TableColumns.$(OBJEXT) \ - livestatus_so-HostSpecialDoubleColumn.$(OBJEXT) \ livestatus_so-TableCommands.$(OBJEXT) \ livestatus_so-TableContacts.$(OBJEXT) \ livestatus_so-TableDownComm.$(OBJEXT) \ livestatus_so-TableHostgroups.$(OBJEXT) \ - livestatus_so-ServiceSpecialDoubleColumn.$(OBJEXT) \ livestatus_so-TableHosts.$(OBJEXT) \ livestatus_so-TableServicegroups.$(OBJEXT) \ livestatus_so-TableServices.$(OBJEXT) \ livestatus_so-TableStatus.$(OBJEXT) \ livestatus_so-LogEntry.$(OBJEXT) \ - livestatus_so-LogCache.$(OBJEXT) \ livestatus_so-Logfile.$(OBJEXT) \ - livestatus_so-TableStateHistory.$(OBJEXT) \ livestatus_so-TableLog.$(OBJEXT) \ livestatus_so-TableTimeperiods.$(OBJEXT) \ livestatus_so-TableContactgroups.$(OBJEXT) \ @@ -176,7 +172,9 @@ livestatus_so-TimeperiodsCache.$(OBJEXT) \ livestatus_so-pnp4nagios.$(OBJEXT) \ livestatus_so-ContactgroupsColumn.$(OBJEXT) \ - livestatus_so-opids.$(OBJEXT) livestatus_so-auth.$(OBJEXT) + livestatus_so-RowSortedSet.$(OBJEXT) \ + livestatus_so-opids.$(OBJEXT) livestatus_so-auth.$(OBJEXT) \ + livestatus_so-livechecking.$(OBJEXT) livestatus_so_OBJECTS = $(am_livestatus_so_OBJECTS) PROGRAMS = $(bin_PROGRAMS) am_unixcat_OBJECTS = unixcat.$(OBJEXT) @@ -240,7 +238,6 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ @@ -293,6 +290,7 @@ top_srcdir = @top_srcdir@ unixcat_SOURCES = unixcat.c unixcat_LDADD = -lpthread +EXTRA_DIST = *.h pkglib_LIBRARIES = livestatus.so livestatus_so_SOURCES = \ AndingFilter.cc ClientQueue.cc Column.cc ColumnsColumn.cc CustomVarsExplicitColumn.cc \ @@ -307,16 +305,16 @@ Query.cc ServiceContactsColumn.cc ServicegroupsColumn.cc ServicelistColumn.cc \ ServicelistColumnFilter.cc ServicelistStateColumn.cc store.cc Store.cc \ StringColumn.cc StringColumnFilter.cc strutil.cc Table.cc TableColumns.cc \ - HostSpecialDoubleColumn.cc TableCommands.cc TableContacts.cc TableDownComm.cc TableHostgroups.cc \ - ServiceSpecialDoubleColumn.cc TableHosts.cc TableServicegroups.cc TableServices.cc TableStatus.cc \ - LogEntry.cc LogCache.cc Logfile.cc TableStateHistory.cc TableLog.cc TableTimeperiods.cc TableContactgroups.cc \ + TableCommands.cc TableContacts.cc TableDownComm.cc TableHostgroups.cc \ + TableHosts.cc TableServicegroups.cc TableServices.cc TableStatus.cc \ + LogEntry.cc Logfile.cc TableLog.cc TableTimeperiods.cc TableContactgroups.cc \ ContactgroupsMemberColumn.cc OffsetStringMacroColumn.cc OffsetStringServiceMacroColumn.cc \ OffsetStringHostMacroColumn.cc StatsColumn.cc IntAggregator.cc CountAggregator.cc \ DoubleAggregator.cc AttributelistColumn.cc AttributelistFilter.cc \ global_counters.c module.c logger.c waittriggers.c TimeperiodsCache.cc pnp4nagios.cc \ - ContactgroupsColumn.cc opids.cc auth.cc + ContactgroupsColumn.cc RowSortedSet.cc opids.cc auth.cc livechecking.c -livestatus_so_CXXFLAGS = -I$(top_srcdir)/nagios -fPIC +livestatus_so_CXXFLAGS = -fPIC livestatus_so_CFLAGS = $(livestatus_so_CXXFLAGS) all: all-am @@ -457,7 +455,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-Filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-GlobalCountersColumn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-HostContactsColumn.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-HostSpecialDoubleColumn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-HostSpecialIntColumn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-HostgroupsColumn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-HostlistColumn.Po@am__quote@ @@ -469,7 +466,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-IntColumnFilter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-ListColumn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-ListColumnFilter.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-LogCache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-LogEntry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-Logfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-OffsetDoubleColumn.Po@am__quote@ @@ -484,8 +480,8 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-OutputBuffer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-PerfdataAggregator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-Query.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-RowSortedSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-ServiceContactsColumn.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-ServiceSpecialDoubleColumn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-ServiceSpecialIntColumn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-ServicegroupsColumn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-ServicelistColumn.Po@am__quote@ @@ -506,7 +502,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-TableLog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-TableServicegroups.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-TableServices.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-TableStateHistory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-TableStatus.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-TableTimeperiods.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-TimeColumnFilter.Po@am__quote@ @@ -514,6 +509,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-TimeperiodsCache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-auth.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-global_counters.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-livechecking.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-logger.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-module.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/livestatus_so-opids.Po@am__quote@ @@ -593,6 +589,20 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CFLAGS) $(CFLAGS) -c -o livestatus_so-waittriggers.obj `if test -f 'waittriggers.c'; then $(CYGPATH_W) 'waittriggers.c'; else $(CYGPATH_W) '$(srcdir)/waittriggers.c'; fi` +livestatus_so-livechecking.o: livechecking.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CFLAGS) $(CFLAGS) -MT livestatus_so-livechecking.o -MD -MP -MF $(DEPDIR)/livestatus_so-livechecking.Tpo -c -o livestatus_so-livechecking.o `test -f 'livechecking.c' || echo '$(srcdir)/'`livechecking.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-livechecking.Tpo $(DEPDIR)/livestatus_so-livechecking.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='livechecking.c' object='livestatus_so-livechecking.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CFLAGS) $(CFLAGS) -c -o livestatus_so-livechecking.o `test -f 'livechecking.c' || echo '$(srcdir)/'`livechecking.c + +livestatus_so-livechecking.obj: livechecking.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CFLAGS) $(CFLAGS) -MT livestatus_so-livechecking.obj -MD -MP -MF $(DEPDIR)/livestatus_so-livechecking.Tpo -c -o livestatus_so-livechecking.obj `if test -f 'livechecking.c'; then $(CYGPATH_W) 'livechecking.c'; else $(CYGPATH_W) '$(srcdir)/livechecking.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-livechecking.Tpo $(DEPDIR)/livestatus_so-livechecking.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='livechecking.c' object='livestatus_so-livechecking.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CFLAGS) $(CFLAGS) -c -o livestatus_so-livechecking.obj `if test -f 'livechecking.c'; then $(CYGPATH_W) 'livechecking.c'; else $(CYGPATH_W) '$(srcdir)/livechecking.c'; fi` + .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @@ -1307,20 +1317,6 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-TableColumns.obj `if test -f 'TableColumns.cc'; then $(CYGPATH_W) 'TableColumns.cc'; else $(CYGPATH_W) '$(srcdir)/TableColumns.cc'; fi` -livestatus_so-HostSpecialDoubleColumn.o: HostSpecialDoubleColumn.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-HostSpecialDoubleColumn.o -MD -MP -MF $(DEPDIR)/livestatus_so-HostSpecialDoubleColumn.Tpo -c -o livestatus_so-HostSpecialDoubleColumn.o `test -f 'HostSpecialDoubleColumn.cc' || echo '$(srcdir)/'`HostSpecialDoubleColumn.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-HostSpecialDoubleColumn.Tpo $(DEPDIR)/livestatus_so-HostSpecialDoubleColumn.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HostSpecialDoubleColumn.cc' object='livestatus_so-HostSpecialDoubleColumn.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-HostSpecialDoubleColumn.o `test -f 'HostSpecialDoubleColumn.cc' || echo '$(srcdir)/'`HostSpecialDoubleColumn.cc - -livestatus_so-HostSpecialDoubleColumn.obj: HostSpecialDoubleColumn.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-HostSpecialDoubleColumn.obj -MD -MP -MF $(DEPDIR)/livestatus_so-HostSpecialDoubleColumn.Tpo -c -o livestatus_so-HostSpecialDoubleColumn.obj `if test -f 'HostSpecialDoubleColumn.cc'; then $(CYGPATH_W) 'HostSpecialDoubleColumn.cc'; else $(CYGPATH_W) '$(srcdir)/HostSpecialDoubleColumn.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-HostSpecialDoubleColumn.Tpo $(DEPDIR)/livestatus_so-HostSpecialDoubleColumn.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='HostSpecialDoubleColumn.cc' object='livestatus_so-HostSpecialDoubleColumn.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-HostSpecialDoubleColumn.obj `if test -f 'HostSpecialDoubleColumn.cc'; then $(CYGPATH_W) 'HostSpecialDoubleColumn.cc'; else $(CYGPATH_W) '$(srcdir)/HostSpecialDoubleColumn.cc'; fi` - livestatus_so-TableCommands.o: TableCommands.cc @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-TableCommands.o -MD -MP -MF $(DEPDIR)/livestatus_so-TableCommands.Tpo -c -o livestatus_so-TableCommands.o `test -f 'TableCommands.cc' || echo '$(srcdir)/'`TableCommands.cc @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-TableCommands.Tpo $(DEPDIR)/livestatus_so-TableCommands.Po @@ -1377,20 +1373,6 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-TableHostgroups.obj `if test -f 'TableHostgroups.cc'; then $(CYGPATH_W) 'TableHostgroups.cc'; else $(CYGPATH_W) '$(srcdir)/TableHostgroups.cc'; fi` -livestatus_so-ServiceSpecialDoubleColumn.o: ServiceSpecialDoubleColumn.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-ServiceSpecialDoubleColumn.o -MD -MP -MF $(DEPDIR)/livestatus_so-ServiceSpecialDoubleColumn.Tpo -c -o livestatus_so-ServiceSpecialDoubleColumn.o `test -f 'ServiceSpecialDoubleColumn.cc' || echo '$(srcdir)/'`ServiceSpecialDoubleColumn.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-ServiceSpecialDoubleColumn.Tpo $(DEPDIR)/livestatus_so-ServiceSpecialDoubleColumn.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ServiceSpecialDoubleColumn.cc' object='livestatus_so-ServiceSpecialDoubleColumn.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-ServiceSpecialDoubleColumn.o `test -f 'ServiceSpecialDoubleColumn.cc' || echo '$(srcdir)/'`ServiceSpecialDoubleColumn.cc - -livestatus_so-ServiceSpecialDoubleColumn.obj: ServiceSpecialDoubleColumn.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-ServiceSpecialDoubleColumn.obj -MD -MP -MF $(DEPDIR)/livestatus_so-ServiceSpecialDoubleColumn.Tpo -c -o livestatus_so-ServiceSpecialDoubleColumn.obj `if test -f 'ServiceSpecialDoubleColumn.cc'; then $(CYGPATH_W) 'ServiceSpecialDoubleColumn.cc'; else $(CYGPATH_W) '$(srcdir)/ServiceSpecialDoubleColumn.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-ServiceSpecialDoubleColumn.Tpo $(DEPDIR)/livestatus_so-ServiceSpecialDoubleColumn.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ServiceSpecialDoubleColumn.cc' object='livestatus_so-ServiceSpecialDoubleColumn.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-ServiceSpecialDoubleColumn.obj `if test -f 'ServiceSpecialDoubleColumn.cc'; then $(CYGPATH_W) 'ServiceSpecialDoubleColumn.cc'; else $(CYGPATH_W) '$(srcdir)/ServiceSpecialDoubleColumn.cc'; fi` - livestatus_so-TableHosts.o: TableHosts.cc @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-TableHosts.o -MD -MP -MF $(DEPDIR)/livestatus_so-TableHosts.Tpo -c -o livestatus_so-TableHosts.o `test -f 'TableHosts.cc' || echo '$(srcdir)/'`TableHosts.cc @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-TableHosts.Tpo $(DEPDIR)/livestatus_so-TableHosts.Po @@ -1461,20 +1443,6 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-LogEntry.obj `if test -f 'LogEntry.cc'; then $(CYGPATH_W) 'LogEntry.cc'; else $(CYGPATH_W) '$(srcdir)/LogEntry.cc'; fi` -livestatus_so-LogCache.o: LogCache.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-LogCache.o -MD -MP -MF $(DEPDIR)/livestatus_so-LogCache.Tpo -c -o livestatus_so-LogCache.o `test -f 'LogCache.cc' || echo '$(srcdir)/'`LogCache.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-LogCache.Tpo $(DEPDIR)/livestatus_so-LogCache.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='LogCache.cc' object='livestatus_so-LogCache.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-LogCache.o `test -f 'LogCache.cc' || echo '$(srcdir)/'`LogCache.cc - -livestatus_so-LogCache.obj: LogCache.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-LogCache.obj -MD -MP -MF $(DEPDIR)/livestatus_so-LogCache.Tpo -c -o livestatus_so-LogCache.obj `if test -f 'LogCache.cc'; then $(CYGPATH_W) 'LogCache.cc'; else $(CYGPATH_W) '$(srcdir)/LogCache.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-LogCache.Tpo $(DEPDIR)/livestatus_so-LogCache.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='LogCache.cc' object='livestatus_so-LogCache.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-LogCache.obj `if test -f 'LogCache.cc'; then $(CYGPATH_W) 'LogCache.cc'; else $(CYGPATH_W) '$(srcdir)/LogCache.cc'; fi` - livestatus_so-Logfile.o: Logfile.cc @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-Logfile.o -MD -MP -MF $(DEPDIR)/livestatus_so-Logfile.Tpo -c -o livestatus_so-Logfile.o `test -f 'Logfile.cc' || echo '$(srcdir)/'`Logfile.cc @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-Logfile.Tpo $(DEPDIR)/livestatus_so-Logfile.Po @@ -1489,20 +1457,6 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-Logfile.obj `if test -f 'Logfile.cc'; then $(CYGPATH_W) 'Logfile.cc'; else $(CYGPATH_W) '$(srcdir)/Logfile.cc'; fi` -livestatus_so-TableStateHistory.o: TableStateHistory.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-TableStateHistory.o -MD -MP -MF $(DEPDIR)/livestatus_so-TableStateHistory.Tpo -c -o livestatus_so-TableStateHistory.o `test -f 'TableStateHistory.cc' || echo '$(srcdir)/'`TableStateHistory.cc -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-TableStateHistory.Tpo $(DEPDIR)/livestatus_so-TableStateHistory.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='TableStateHistory.cc' object='livestatus_so-TableStateHistory.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-TableStateHistory.o `test -f 'TableStateHistory.cc' || echo '$(srcdir)/'`TableStateHistory.cc - -livestatus_so-TableStateHistory.obj: TableStateHistory.cc -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-TableStateHistory.obj -MD -MP -MF $(DEPDIR)/livestatus_so-TableStateHistory.Tpo -c -o livestatus_so-TableStateHistory.obj `if test -f 'TableStateHistory.cc'; then $(CYGPATH_W) 'TableStateHistory.cc'; else $(CYGPATH_W) '$(srcdir)/TableStateHistory.cc'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-TableStateHistory.Tpo $(DEPDIR)/livestatus_so-TableStateHistory.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='TableStateHistory.cc' object='livestatus_so-TableStateHistory.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-TableStateHistory.obj `if test -f 'TableStateHistory.cc'; then $(CYGPATH_W) 'TableStateHistory.cc'; else $(CYGPATH_W) '$(srcdir)/TableStateHistory.cc'; fi` - livestatus_so-TableLog.o: TableLog.cc @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-TableLog.o -MD -MP -MF $(DEPDIR)/livestatus_so-TableLog.Tpo -c -o livestatus_so-TableLog.o `test -f 'TableLog.cc' || echo '$(srcdir)/'`TableLog.cc @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-TableLog.Tpo $(DEPDIR)/livestatus_so-TableLog.Po @@ -1727,6 +1681,20 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-ContactgroupsColumn.obj `if test -f 'ContactgroupsColumn.cc'; then $(CYGPATH_W) 'ContactgroupsColumn.cc'; else $(CYGPATH_W) '$(srcdir)/ContactgroupsColumn.cc'; fi` +livestatus_so-RowSortedSet.o: RowSortedSet.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-RowSortedSet.o -MD -MP -MF $(DEPDIR)/livestatus_so-RowSortedSet.Tpo -c -o livestatus_so-RowSortedSet.o `test -f 'RowSortedSet.cc' || echo '$(srcdir)/'`RowSortedSet.cc +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-RowSortedSet.Tpo $(DEPDIR)/livestatus_so-RowSortedSet.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RowSortedSet.cc' object='livestatus_so-RowSortedSet.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-RowSortedSet.o `test -f 'RowSortedSet.cc' || echo '$(srcdir)/'`RowSortedSet.cc + +livestatus_so-RowSortedSet.obj: RowSortedSet.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-RowSortedSet.obj -MD -MP -MF $(DEPDIR)/livestatus_so-RowSortedSet.Tpo -c -o livestatus_so-RowSortedSet.obj `if test -f 'RowSortedSet.cc'; then $(CYGPATH_W) 'RowSortedSet.cc'; else $(CYGPATH_W) '$(srcdir)/RowSortedSet.cc'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-RowSortedSet.Tpo $(DEPDIR)/livestatus_so-RowSortedSet.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RowSortedSet.cc' object='livestatus_so-RowSortedSet.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -c -o livestatus_so-RowSortedSet.obj `if test -f 'RowSortedSet.cc'; then $(CYGPATH_W) 'RowSortedSet.cc'; else $(CYGPATH_W) '$(srcdir)/RowSortedSet.cc'; fi` + livestatus_so-opids.o: opids.cc @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(livestatus_so_CXXFLAGS) $(CXXFLAGS) -MT livestatus_so-opids.o -MD -MP -MF $(DEPDIR)/livestatus_so-opids.Tpo -c -o livestatus_so-opids.o `test -f 'opids.cc' || echo '$(srcdir)/'`opids.cc @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/livestatus_so-opids.Tpo $(DEPDIR)/livestatus_so-opids.Po @@ -1957,9 +1925,12 @@ uninstall-pkglibLIBRARIES +@HAVE_DIET_TRUE@ diet -v $(CC) -x c -Wno-deprecated-declarations $(CFLAGS) $(LDFLAGS) -I.. -s -o $@ $^ +@HAVE_DIET_FALSE@ $(CC) -x c -Wno-deprecated-declarations $(CFLAGS) $(LDFLAGS) -I.. -s -o $@ $^ + livestatus.o: $(livestatus_so_OBJECTS) $(livestatus_so_DEPENDENCIES) -rm -f plugin.so - $(CXX) $(LDFLAGS) -s -fPIC -shared $(livestatus_so_OBJECTS) -o $@ -lpthread -lstdc++ + $(CXX) $(LDFLAGS) -fPIC -shared $(livestatus_so_OBJECTS) -o $@ -lpthread -lstdc++ all-local: livestatus.o diff -Naur check_mk-1.2.3i6/livestatus.src/src/module.c livestatus.working/src/module.c --- check_mk-1.2.3i6/livestatus.src/src/module.c 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/module.c 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -38,10 +38,10 @@ #include #include #include +#include #include "nagios.h" #include "livestatus.h" -#include "downtime.h" #include "store.h" #include "logger.h" #include "config.h" @@ -50,7 +50,7 @@ #include "auth.h" #include "data_encoding.h" #include "waittriggers.h" - +#include "livechecking.h" #ifndef AF_LOCAL #define AF_LOCAL AF_UNIX @@ -64,26 +64,15 @@ # define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen ((ptr)->sun_path)) #endif -void TRIGGER(int what) -{ - pthread_cond_broadcast(&g_wait_cond[WT_ALL]); - pthread_cond_broadcast(&g_wait_cond[what]); -} - - NEB_API_VERSION(CURRENT_NEB_API_VERSION) -extern int event_broker_options; -extern int enable_environment_macros; +extern unsigned long event_broker_options; extern char *log_file; int g_idle_timeout_msec = 300 * 1000; /* maximum idle time for connection in keep alive state */ int g_query_timeout_msec = 10 * 1000; /* maximum time for reading a query */ -int g_num_clientthreads = 10; /* allow 10 concurrent connections per default */ -int g_num_queued_connections = 0; /* current number of queued connections (for statistics) */ -int g_num_active_connections = 0; /* current number of active connections (for statistics) */ +unsigned g_num_clientthreads = 10; /* allow 10 concurrent connections per default */ size_t g_thread_stack_size = 65536; /* stack size of threads */ -extern int g_disable_statehist_filtering; #define false 0 #define true 1 @@ -94,6 +83,7 @@ int g_max_fd_ever = 0; char g_socket_path[4096]; char g_pnp_path[4096]; +char g_livecheck_path[4096]; char g_logfile_path[4096]; int g_debug_level = 0; int g_should_terminate = false; @@ -103,42 +93,12 @@ unsigned long g_max_response_size = 100 * 1024 * 1024; // limit answer to 10 MB int g_thread_running = 0; int g_thread_pid = 0; +char g_hidden_custom_var_prefix[256]; int g_service_authorization = AUTH_LOOSE; int g_group_authorization = AUTH_STRICT; int g_data_encoding = ENCODING_UTF8; - -/* simple statistics data for TableStatus */ -extern struct host *host_list; -extern struct service *service_list; -extern scheduled_downtime *scheduled_downtime_list; -extern int log_initial_states; - - -int g_num_hosts; -int g_num_services; - - -void count_hosts() -{ - g_num_hosts = 0; - host *h = (host *)host_list; - while (h) { - g_num_hosts ++; - h = h->next; - } -} - -void count_services() -{ - g_num_services = 0; - service *s = (service *)service_list; - while (s) { - g_num_services ++; - s = s->next; - } -} - - +int g_num_livehelpers = 20; +int g_livecheck_enabled = 0; void* voidp; @@ -177,7 +137,6 @@ } } - void *main_thread(void *data __attribute__ ((__unused__))) { g_thread_pid = getpid(); @@ -203,7 +162,6 @@ if (0 < fcntl(cc, F_SETFD, FD_CLOEXEC)) logger(LG_INFO, "Cannot set FD_CLOEXEC on client socket: %s", strerror(errno)); queue_add_connection(cc); // closes fd - g_num_queued_connections++; g_counters[COUNTER_CONNECTIONS]++; } } @@ -211,6 +169,7 @@ return voidp; } + void *client_thread(void *data __attribute__ ((__unused__))) { void *input_buffer = create_inputbuffer(&g_should_terminate); @@ -218,8 +177,6 @@ while (!g_should_terminate) { int cc = queue_pop_connection(); - g_num_queued_connections--; - g_num_active_connections++; if (cc >= 0) { if (g_debug_level >= 2) logger(LG_INFO, "Accepted client connection on fd %d", cc); @@ -236,7 +193,6 @@ } close(cc); } - g_num_active_connections--; } delete_outputbuffer(output_buffer); delete_inputbuffer(input_buffer); @@ -245,9 +201,6 @@ void start_threads() { - count_hosts(); - count_services(); - if (!g_thread_running) { /* start thread that listens on socket */ pthread_atfork(livestatus_count_fork, NULL, livestatus_cleanup_after_fork); @@ -292,7 +245,6 @@ if (g_debug_level > 0) logger(LG_INFO, "Main thread + %u client threads have finished", g_num_clientthreads); g_thread_running = 0; - g_should_terminate = false; } free(g_clientthread_id); } @@ -374,18 +326,25 @@ { int result = NEB_OK; if (event_type == NEBCALLBACK_SERVICE_CHECK_DATA) { + if (g_livecheck_enabled) + result = broker_service_livecheck(event_type, data); + nebstruct_service_check_data *c = (nebstruct_service_check_data *)data; if (c->type == NEBTYPE_SERVICECHECK_PROCESSED) { g_counters[COUNTER_SERVICE_CHECKS]++; } } else if (event_type == NEBCALLBACK_HOST_CHECK_DATA) { + if (g_livecheck_enabled) + result = broker_host_livecheck(event_type, data); + nebstruct_host_check_data *c = (nebstruct_host_check_data *)data; if (c->type == NEBTYPE_HOSTCHECK_PROCESSED) { g_counters[COUNTER_HOST_CHECKS]++; } } - TRIGGER(WT_CHECK); + pthread_cond_broadcast(&g_wait_cond[WT_ALL]); + pthread_cond_broadcast(&g_wait_cond[WT_CHECK]); return result; } @@ -395,7 +354,8 @@ nebstruct_comment_data *co = (nebstruct_comment_data *)data; store_register_comment(co); g_counters[COUNTER_NEB_CALLBACKS]++; - TRIGGER(WT_COMMENT); + pthread_cond_broadcast(&g_wait_cond[WT_ALL]); + pthread_cond_broadcast(&g_wait_cond[WT_COMMENT]); return 0; } @@ -404,123 +364,70 @@ nebstruct_downtime_data *dt = (nebstruct_downtime_data *)data; store_register_downtime(dt); g_counters[COUNTER_NEB_CALLBACKS]++; - TRIGGER(WT_DOWNTIME); + pthread_cond_broadcast(&g_wait_cond[WT_ALL]); + pthread_cond_broadcast(&g_wait_cond[WT_DOWNTIME]); return 0; } int broker_log(int event_type __attribute__ ((__unused__)), void *data __attribute__ ((__unused__))) { - g_counters[COUNTER_NEB_CALLBACKS]++; g_counters[COUNTER_LOG_MESSAGES]++; - TRIGGER(WT_LOG); + pthread_cond_broadcast(&g_wait_cond[WT_ALL]); + pthread_cond_broadcast(&g_wait_cond[WT_LOG]); return 0; } + int broker_command(int event_type __attribute__ ((__unused__)), void *data) { nebstruct_external_command_data *sc = (nebstruct_external_command_data *)data; if (sc->type == NEBTYPE_EXTERNALCOMMAND_START) g_counters[COUNTER_COMMANDS]++; g_counters[COUNTER_NEB_CALLBACKS]++; - TRIGGER(WT_COMMAND); + pthread_cond_broadcast(&g_wait_cond[WT_ALL]); + pthread_cond_broadcast(&g_wait_cond[WT_COMMAND]); return 0; } int broker_state(int event_type __attribute__ ((__unused__)), void *data __attribute__ ((__unused__))) { g_counters[COUNTER_NEB_CALLBACKS]++; - TRIGGER(WT_STATE); + pthread_cond_broadcast(&g_wait_cond[WT_ALL]); + pthread_cond_broadcast(&g_wait_cond[WT_STATE]); return 0; } int broker_program(int event_type __attribute__ ((__unused__)), void *data __attribute__ ((__unused__))) { g_counters[COUNTER_NEB_CALLBACKS]++; - TRIGGER(WT_PROGRAM); + pthread_cond_broadcast(&g_wait_cond[WT_ALL]); + pthread_cond_broadcast(&g_wait_cond[WT_PROGRAM]); return 0; } -char* get_downtime_comment(char* host_name, char* svc_desc) -{ - char* comment; - int matches = 0; - scheduled_downtime* dt_list = scheduled_downtime_list; - while (dt_list != NULL) { - if (dt_list->type == HOST_DOWNTIME) { - if (strcmp(dt_list->host_name, host_name) == 0) { - matches++; - comment = dt_list->comment; - } - } - if (svc_desc != NULL && dt_list->type == SERVICE_DOWNTIME) { - if( strcmp(dt_list->host_name, host_name) == 0 - && strcmp(dt_list->service_description, svc_desc) == 0) { - matches++; - comment = dt_list->comment; - } - } - dt_list = dt_list->next; - } - return matches == 0 ? "No comment" : matches > 1 ? "Multiple Downtime Comments" : comment; -} - -void livestatus_log_initial_states() -{ - // Log DOWNTIME hosts - host *h = (host *)host_list; - char buffer[8192]; - - while (h) { - if (h->scheduled_downtime_depth > 0) { - snprintf(buffer, sizeof(buffer), "HOST DOWNTIME ALERT: %s;STARTED;%s", h->name, get_downtime_comment(h->name, NULL)); - write_to_all_logs(buffer, LG_INFO); - } - h = h->next; - } - // Log DOWNTIME services - service *s = (service *)service_list; - while (s) { - if (s->scheduled_downtime_depth > 0) { - snprintf(buffer, sizeof(buffer), "SERVICE DOWNTIME ALERT: %s;%s;STARTED;%s", s->host_name, s->description, - get_downtime_comment(s->host_name, s->description)); - write_to_all_logs(buffer, LG_INFO); - } - s = s->next; - } - // Log TIMERPERIODS - log_timeperiods_cache(); -} - - int broker_event(int event_type __attribute__ ((__unused__)), void *data) { g_counters[COUNTER_NEB_CALLBACKS]++; struct nebstruct_timed_event_struct *ts = (struct nebstruct_timed_event_struct *)data; - if (ts->event_type == EVENT_LOG_ROTATION) - { - if (g_thread_running == 1 ) - livestatus_log_initial_states(); - else if (log_initial_states == 1) - write_to_all_logs("logging initial states", LG_INFO); // initial info during startup - } update_timeperiods_cache(ts->timestamp.tv_sec); return 0; } - - int broker_process(int event_type __attribute__ ((__unused__)), void *data) { struct nebstruct_process_struct *ps = (struct nebstruct_process_struct *)data; if (ps->type == NEBTYPE_PROCESS_EVENTLOOPSTART) { update_timeperiods_cache(time(0)); + init_livecheck(); start_threads(); } return 0; } + + int verify_event_broker_options() { int errors = 0; @@ -572,6 +479,7 @@ return errors == 0; } + void register_callbacks() { neb_register_callback(NEBCALLBACK_HOST_STATUS_DATA, g_nagios_handle, 0, broker_host); // Needed to start threads @@ -635,10 +543,18 @@ /* there is no default PNP path */ g_pnp_path[0] = 0; + /* also livecheck is disabled per default */ + g_livecheck_path[0] = 0; + + /* also no custom variables is hidden by default */ + g_hidden_custom_var_prefix[0] = 0; + if (!args_orig) return; // no arguments, use default options - char *args = strdup(args_orig); + char *args = strdup(args_orig), *tmp; + /*save pointer so that we can free it later*/ + tmp = args; char *token; while (0 != (token = next_field(&args))) { @@ -739,18 +655,25 @@ } } else if (!strcmp(left, "livecheck")) { - logger(LG_INFO, "Livecheck has been removed from Livestatus. Sorry."); + strncpy(g_livecheck_path, right, sizeof(g_livecheck_path) - 1); + if (0 != access(g_livecheck_path, X_OK)) { + logger(LG_INFO, "ERROR: %s is not executable. Disabling livecheck.", g_livecheck_path); + g_livecheck_path[0] = 0; + } + g_livecheck_enabled = true; + } + else if (!strcmp(left, "hidden_custom_var_prefix")) { + strncpy(g_hidden_custom_var_prefix, right, sizeof(g_hidden_custom_var_prefix)); } - else if (!strcmp(left, "disable_statehist_filtering")) - { - g_disable_statehist_filtering = atoi(right); + else if (!strcmp(left, "num_livecheck_helpers")) { + g_num_livehelpers = atoi(right); } else { logger(LG_INFO, "Ignoring invalid option %s=%s", left, right); } } } - // free(args); won't free, since we use pointers? + free(tmp); } void omd_advertize() @@ -777,21 +700,17 @@ logger(LG_INFO, "Livestatus %s by Mathias Kettner. Socket: '%s'", VERSION, g_socket_path); logger(LG_INFO, "Please visit us at http://mathias-kettner.de/"); - omd_advertize(); - if (!open_unix_socket()) return 1; + event_broker_options = ~0; /* force settings to "everything" */ if (!verify_event_broker_options()) { logger(LG_CRIT, "Fatal: bailing out. Please fix event_broker_options."); logger(LG_CRIT, "Hint: your event_broker_options are set to %d. Try setting it to -1.", event_broker_options); return 1; } else if (g_debug_level > 0) - logger(LG_INFO, "Your event_broker_options are sufficient for livestatus.."); - - if (enable_environment_macros == 1) - logger(LG_INFO, "Warning: environment_macros are enabled. This might decrease the overall nagios performance"); + logger(LG_INFO, "Your event_broker_options are sufficient for livestatus."); store_init(); register_callbacks(); @@ -814,6 +733,7 @@ close_unix_socket(); store_deinit(); deregister_callbacks(); + deinit_livecheck(); close_logfile(); return 0; } diff -Naur check_mk-1.2.3i6/livestatus.src/src/nagios.h livestatus.working/src/nagios.h --- check_mk-1.2.3i6/livestatus.src/src/nagios.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/nagios.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -27,18 +27,14 @@ #include "config.h" -#ifdef CMC -#include "../cmc.h" -#else #define NSCORE -#include "nagios/objects.h" -#include "nagios/nagios.h" -#include "nagios/nebstructs.h" -#include "nagios/neberrors.h" -#include "nagios/broker.h" -#include "nagios/nebmodules.h" -#include "nagios/nebcallbacks.h" -#endif +#include +#include +#include +#include +#include +#include +#include #endif // nagios_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/NegatingFilter.h livestatus.working/src/NegatingFilter.h --- check_mk-1.2.3i6/livestatus.src/src/NegatingFilter.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/NegatingFilter.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetDoubleColumn.cc livestatus.working/src/OffsetDoubleColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/OffsetDoubleColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetDoubleColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetDoubleColumn.h livestatus.working/src/OffsetDoubleColumn.h --- check_mk-1.2.3i6/livestatus.src/src/OffsetDoubleColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetDoubleColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetIntColumn.cc livestatus.working/src/OffsetIntColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/OffsetIntColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetIntColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetIntColumn.h livestatus.working/src/OffsetIntColumn.h --- check_mk-1.2.3i6/livestatus.src/src/OffsetIntColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetIntColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetStringColumn.cc livestatus.working/src/OffsetStringColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/OffsetStringColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetStringColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetStringColumn.h livestatus.working/src/OffsetStringColumn.h --- check_mk-1.2.3i6/livestatus.src/src/OffsetStringColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetStringColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -36,7 +36,6 @@ OffsetStringColumn(string name, string description, int offset, int indirect_offset = -1) : StringColumn(name, description, indirect_offset), _offset(offset) {} char *getValue(void *data); - int offset() { return _offset; } }; diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetStringHostMacroColumn.cc livestatus.working/src/OffsetStringHostMacroColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/OffsetStringHostMacroColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetStringHostMacroColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetStringHostMacroColumn.h livestatus.working/src/OffsetStringHostMacroColumn.h --- check_mk-1.2.3i6/livestatus.src/src/OffsetStringHostMacroColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetStringHostMacroColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetStringMacroColumn.cc livestatus.working/src/OffsetStringMacroColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/OffsetStringMacroColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetStringMacroColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -22,6 +22,8 @@ // to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, // Boston, MA 02110-1301 USA. +#include + #include "OffsetStringMacroColumn.h" #include "AndingFilter.h" #include "Query.h" @@ -94,7 +96,7 @@ else if (!strcmp(macroname, "HOSTPERFDATA")) return hst->perf_data; else if (!strcmp(macroname, "HOSTCHECKCOMMAND")) - return hst->host_check_command; + return hst->check_command; else if (!strncmp(macroname, "_HOST", 5)) // custom macro return expandCustomVariables(macroname + 5, hst->custom_variables); @@ -112,7 +114,7 @@ else if (!strcmp(macroname, "SERVICEPERFDATA")) return svc->perf_data; else if (!strcmp(macroname, "SERVICECHECKCOMMAND")) - return svc->service_check_command; + return svc->check_command; else if (!strncmp(macroname, "_SERVICE", 8)) // custom macro return expandCustomVariables(macroname + 8, svc->custom_variables); } diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetStringMacroColumn.h livestatus.working/src/OffsetStringMacroColumn.h --- check_mk-1.2.3i6/livestatus.src/src/OffsetStringMacroColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetStringMacroColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetStringServiceMacroColumn.cc livestatus.working/src/OffsetStringServiceMacroColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/OffsetStringServiceMacroColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetStringServiceMacroColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetStringServiceMacroColumn.h livestatus.working/src/OffsetStringServiceMacroColumn.h --- check_mk-1.2.3i6/livestatus.src/src/OffsetStringServiceMacroColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetStringServiceMacroColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetTimeColumn.cc livestatus.working/src/OffsetTimeColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/OffsetTimeColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetTimeColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetTimeColumn.h livestatus.working/src/OffsetTimeColumn.h --- check_mk-1.2.3i6/livestatus.src/src/OffsetTimeColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetTimeColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetTimeperiodColumn.cc livestatus.working/src/OffsetTimeperiodColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/OffsetTimeperiodColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetTimeperiodColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OffsetTimeperiodColumn.h livestatus.working/src/OffsetTimeperiodColumn.h --- check_mk-1.2.3i6/livestatus.src/src/OffsetTimeperiodColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OffsetTimeperiodColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/opids.cc livestatus.working/src/opids.cc --- check_mk-1.2.3i6/livestatus.src/src/opids.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/opids.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/opids.h livestatus.working/src/opids.h --- check_mk-1.2.3i6/livestatus.src/src/opids.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/opids.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OringFilter.cc livestatus.working/src/OringFilter.cc --- check_mk-1.2.3i6/livestatus.src/src/OringFilter.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OringFilter.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OringFilter.h livestatus.working/src/OringFilter.h --- check_mk-1.2.3i6/livestatus.src/src/OringFilter.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OringFilter.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/OutputBuffer.cc livestatus.working/src/OutputBuffer.cc --- check_mk-1.2.3i6/livestatus.src/src/OutputBuffer.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OutputBuffer.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -111,9 +111,8 @@ writeData(fd, termination_flag, header, 16); writeData(fd, termination_flag, buffer, s); } - else { + else writeData(fd, termination_flag, _buffer, size()); - } reset(); } diff -Naur check_mk-1.2.3i6/livestatus.src/src/OutputBuffer.h livestatus.working/src/OutputBuffer.h --- check_mk-1.2.3i6/livestatus.src/src/OutputBuffer.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/OutputBuffer.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/PerfdataAggregator.cc livestatus.working/src/PerfdataAggregator.cc --- check_mk-1.2.3i6/livestatus.src/src/PerfdataAggregator.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/PerfdataAggregator.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -24,8 +24,6 @@ #include #include -#include - #include "strutil.h" #include "logger.h" #include "Query.h" diff -Naur check_mk-1.2.3i6/livestatus.src/src/PerfdataAggregator.h livestatus.working/src/PerfdataAggregator.h --- check_mk-1.2.3i6/livestatus.src/src/PerfdataAggregator.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/PerfdataAggregator.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. diff -Naur check_mk-1.2.3i6/livestatus.src/src/pnp4nagios.cc livestatus.working/src/pnp4nagios.cc --- check_mk-1.2.3i6/livestatus.src/src/pnp4nagios.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/pnp4nagios.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -38,7 +38,7 @@ } } -int pnpgraph_present(const char *host, const char *service) +int pnpgraph_present(char *host, char *service) { if (!g_pnp_path[0]) return -1; diff -Naur check_mk-1.2.3i6/livestatus.src/src/pnp4nagios.h livestatus.working/src/pnp4nagios.h --- check_mk-1.2.3i6/livestatus.src/src/pnp4nagios.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/pnp4nagios.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -25,7 +25,7 @@ #ifndef pnp4nagios_h #define pnp4nagios_h -int pnpgraph_present(const char *host, const char *service); +int pnpgraph_present(char *host, char *service); #endif // pnp4nagios_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/Query.cc livestatus.working/src/Query.cc --- check_mk-1.2.3i6/livestatus.src/src/Query.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Query.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,12 +5,14 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. // The official homepage is at http://mathias-kettner.de/check_mk. // +// Updated 2012 by Max Sikström - op5: Added Sort: and Offset: +// // check_mk 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 in version 2. check_mk is distributed @@ -27,6 +29,7 @@ #include #include #include +#include #include "logger.h" #include "opids.h" @@ -42,6 +45,7 @@ #include "Aggregator.h" #include "OringFilter.h" #include "NegatingFilter.h" +#include "RowSortedSet.h" #include "waittriggers.h" #include "data_encoding.h" #include "auth.h" @@ -65,9 +69,14 @@ _need_ds_separator(false), _output_format(OUTPUT_FORMAT_CSV), _limit(-1), + _offset(0), + _do_sorting(0), _current_line(0), - _timezone_offset(0) + _timezone_offset(0), + table_tmp_storage(0) { + _sorter.setQuery( this ); + while (input->moreLines()) { string line = input->nextLine(); @@ -78,6 +87,9 @@ if (!strncmp(buffer, "Filter:", 7)) parseFilterLine(lstrip(buffer + 7), true); + else if (!strncmp(buffer, "Sort:", 5)) + parseSortLine(lstrip(buffer + 5)); + else if (!strncmp(buffer, "Or:", 3)) parseAndOrLine(lstrip(buffer + 3), ANDOR_OR, true); @@ -111,6 +123,9 @@ else if (!strncmp(buffer, "Limit:", 6)) parseLimitLine(lstrip(buffer + 6)); + else if (!strncmp(buffer, "Offset:", 7)) + parseOffsetLine(lstrip(buffer + 7)); + else if (!strncmp(buffer, "AuthUser:", 9)) parseAuthUserHeader(lstrip(buffer + 9)); @@ -193,10 +208,6 @@ _columns.push_back(column); } -void Query::setError(int error_code, const char* msg) -{ - _output->setError(error_code, msg); -} bool Query::hasNoColumns() { @@ -247,10 +258,8 @@ delete filter; filter = 0; } - else { + else filter->setQuery(this); - filter->setColumn(column); - } return filter; } @@ -259,8 +268,8 @@ { char *value = next_field(&line); int number = atoi(value); - if (!isdigit(value[0]) || number <= 0) { - _output->setError(RESPONSE_CODE_INVALID_HEADER, "Invalid value for %s%s: need non-zero integer number", + if (!isdigit(value[0]) || number < 0) { + _output->setError(RESPONSE_CODE_INVALID_HEADER, "Invalid value for %s%s: need non-negative integer number", filter ? "" : "WaitCondition", andor == ANDOR_OR ? "Or" : "And"); return; @@ -307,8 +316,8 @@ { char *value = next_field(&line); int number = atoi(value); - if (!isdigit(value[0]) || number <= 0) { - _output->setError(RESPONSE_CODE_INVALID_HEADER, "Invalid value for Stats%s: need non-zero integer number", + if (!isdigit(value[0]) || number < 0) { + _output->setError(RESPONSE_CODE_INVALID_HEADER, "Invalid value for Stats%s: need non-negative integer number", andor == ANDOR_OR ? "Or" : "And"); return; } @@ -434,7 +443,7 @@ stats_col = new StatsColumn(column, 0, operation); _stats_columns.push_back(stats_col); - /* Default to old behaviour: do not output column headers if we + /* Default to old behaviour: do not output column headers if we do Stats queries */ _show_column_headers = false; } @@ -482,6 +491,39 @@ } } +void Query::parseSortLine(char *line) +{ + if (!_table) + return; + + char *column_name; + char *dir; + bool desc; + + column_name = next_field(&line); + dir = next_field(&line); + + desc = false; + if( dir != 0 ) { + if( 0==strcasecmp( dir, "desc" ) ) { + desc = true; + } + } + + if( column_name != 0 ) { + Column *column = _table->column(column_name); + if (column == 0) { + _output->setError(RESPONSE_CODE_INVALID_HEADER, + "Table '%s' has no column '%s'", _table->name(), column_name); + column = createDummyColumn(column_name); + } + + _sorter.addSortColumn( column, desc ); + + _do_sorting=true; + } +} + void Query::parseAuthUserHeader(char *line) { if (!_table) @@ -560,9 +602,11 @@ _output_format = OUTPUT_FORMAT_JSON; else if (!strcmp(format, "python")) _output_format = OUTPUT_FORMAT_PYTHON; + else if (!strcmp(format, "wrapped_json")) + _output_format = OUTPUT_FORMAT_WRAPPED_JSON; else _output->setError(RESPONSE_CODE_INVALID_HEADER, - "Invalid output format. Only 'csv' and 'json' are available."); + "Invalid output format. Only 'csv', 'json' and 'wrapped_json' are available."); } void Query::parseColumnHeadersLine(char *line) @@ -617,6 +661,22 @@ } } +void Query::parseOffsetLine(char *line) +{ + char *value = next_field(&line); + if (!value) { + _output->setError(RESPONSE_CODE_INVALID_HEADER, "Header Offset: missing value"); + } + else { + int offset = atoi(value); + if (!isdigit(value[0]) || offset < 0) + _output->setError(RESPONSE_CODE_INVALID_HEADER, + "Invalid value for Offset: must be non-negative integer"); + else + _offset = offset; + } +} + void Query::parseWaitTimeoutLine(char *line) { char *value = next_field(&line); @@ -712,8 +772,11 @@ _need_ds_separator = false; - if (_output_format != OUTPUT_FORMAT_CSV) - _output->addChar('['); + if( _do_sorting || doStats() ) { + Table::_nat_sort_t *natsort = _table->natSortColumns(); + for (unsigned i=0; isize(); i++) + _sorter.addSortColumn( (*natsort)[i], false ); + } if (doStats()) { @@ -722,6 +785,7 @@ // will be created each time a new group is found. if (_columns.size() == 0) { + _current_line = 1; /* There is only one line... */ _stats_aggregators = new Aggregator *[_stats_columns.size()]; for (unsigned i=0; i<_stats_columns.size(); i++) _stats_aggregators[i] = _stats_columns[i]->createAggregator(); @@ -730,6 +794,11 @@ if (_show_column_headers) { + if (_output_format == OUTPUT_FORMAT_WRAPPED_JSON) + _output->addString("{\"columns\":"); + if (_output_format != OUTPUT_FORMAT_CSV) + _output->addChar('['); + outputDatasetBegin(); bool first = true; @@ -745,7 +814,7 @@ outputString(column->name()); } - // Output dummy headers for stats columns + // Output dummy headers for stats columns int col = 1; char colheader[32]; for (_stats_columns_t::iterator it = _stats_columns.begin(); @@ -762,8 +831,21 @@ } outputDatasetEnd(); - _need_ds_separator = true; + + if (_output_format == OUTPUT_FORMAT_WRAPPED_JSON) + { + _output->addString("],\"data\":["); + } + else { + _need_ds_separator = true; + } + } else { + if (_output_format == OUTPUT_FORMAT_WRAPPED_JSON) + _output->addString("{\"data\":"); + if (_output_format != OUTPUT_FORMAT_CSV) + _output->addChar('['); } + } @@ -777,10 +859,8 @@ return false; } + if (_filter.accepts(data) && (!_auth_user || _table->isAuthorized(_auth_user, data))) { - _current_line++; - if (_limit >= 0 && (int)_current_line > _limit) - return false; if (doStats()) { @@ -789,8 +869,13 @@ // of aggregators for the current group if (_columns.size() > 0) { _stats_group_spec_t groupspec; + bool is_new; computeStatsGroupSpec(groupspec, data); - aggr = getStatsGroup(groupspec); + aggr = getStatsGroup(groupspec, &is_new); + if( is_new ) { + _current_line++; + _sorter.insert( data, _limit+_offset ); + } } else aggr = _stats_aggregators; @@ -801,48 +886,86 @@ // No output is done while processing the data, we only // collect stats. } - else - { - // output data of current row - if (_need_ds_separator && _output_format != OUTPUT_FORMAT_CSV) - _output->addBuffer(",\n", 2); - else - _need_ds_separator = true; + else { + _current_line++; + if (_do_sorting) { + _sorter.insert( data, _limit+_offset ); + } + else { + if (_limit >= 0 && (int)_current_line > _offset+_limit) { + if (_output_format == OUTPUT_FORMAT_WRAPPED_JSON) { + return true; /* wrapped_json also outputs total row count */ + } else { + return false; + } + } - outputDatasetBegin(); - for (_columns_t::iterator it = _columns.begin(); - it != _columns.end(); - ++it) - { - if (it != _columns.begin()) - outputFieldSeparator(); - Column *column = *it; - column->output(data, this); + if ((int)_current_line <= _offset) + return true; + + printRow( data ); } - outputDatasetEnd(); } } return true; } +void Query::printRow( void *data ) { + // output data of current row + if (_need_ds_separator && _output_format != OUTPUT_FORMAT_CSV) + _output->addBuffer(",\n", 2); + else + _need_ds_separator = true; + + outputDatasetBegin(); + for (_columns_t::iterator it = _columns.begin(); + it != _columns.end(); + ++it) + { + if (it != _columns.begin()) + outputFieldSeparator(); + Column *column = *it; + column->output(data, this); + } + outputDatasetEnd(); +} + void Query::finish() { + void *data; + long i; + long numelems; + long currow; + // grouped stats if (doStats() && _columns.size() > 0) { - // output values of all stats groups (output has been post poned until now) - for (_stats_groups_t::iterator it = _stats_groups.begin(); - it != _stats_groups.end(); - ++it) - { + vector outbuf; /* Used to reverse display order */ + + numelems = _limit; + if( _limit+_offset > _sorter.size() ) { + numelems = _sorter.size()-_offset; + if( numelems < 0 ) numelems = 0; + } + while( ((data = _sorter.extract()) != 0) && numelems-- ) { + outbuf.push_back( data ); + } + currow=0; + while( !outbuf.empty() ) { + data = outbuf.back(); + outbuf.pop_back(); + currow++; + // dataset separator after first group - if (it != _stats_groups.begin() && _output_format != OUTPUT_FORMAT_CSV) + if (currow>1 && _output_format != OUTPUT_FORMAT_CSV) _output->addBuffer(",\n", 2); outputDatasetBegin(); // output group columns first - _stats_group_spec_t groupspec = it->first; + _stats_group_spec_t groupspec; + computeStatsGroupSpec(groupspec, data); + bool first = true; for (_stats_group_spec_t::iterator iit = groupspec.begin(); iit != groupspec.end(); @@ -855,21 +978,31 @@ outputString((*iit).c_str()); } - Aggregator **aggr = it->second; - for (unsigned i=0; i<_stats_columns.size(); i++) { + Aggregator **aggr; + aggr = getStatsGroup(groupspec, 0); + for (i=0; i<_stats_columns.size(); i++) { outputFieldSeparator(); aggr[i]->output(this); - delete aggr[i]; // not needed any more } outputDatasetEnd(); - delete aggr; + } + // output values of all stats groups (output has been post poned until now) + for (_stats_groups_t::iterator it = _stats_groups.begin(); + it != _stats_groups.end(); + ++it) + { + Aggregator **aggr = it->second; + for (i=0; i<_stats_columns.size(); i++) { + delete aggr[i]; + } + delete[] aggr; } } // stats without group column else if (doStats()) { outputDatasetBegin(); - for (unsigned i=0; i<_stats_columns.size(); i++) + for (i=0; i<_stats_columns.size(); i++) { if (i > 0) outputFieldSeparator(); @@ -877,12 +1010,36 @@ delete _stats_aggregators[i]; } outputDatasetEnd(); - delete _stats_aggregators; + delete[] _stats_aggregators; + } + + else if( _do_sorting ) { + vector outbuf; /* Used to reverse display order */ + + numelems = _limit; + if( _limit+_offset > _sorter.size() ) { + numelems = _sorter.size()-_offset; + if( numelems < 0 ) numelems = 0; + } + while( ((data = _sorter.extract()) != 0) && numelems-- ) { + outbuf.push_back( data ); + } + while( !outbuf.empty() ) { + printRow( outbuf.back() ); + outbuf.pop_back(); + } } // normal query - if (_output_format != OUTPUT_FORMAT_CSV) - _output->addBuffer("]\n", 2); + if (_output_format != OUTPUT_FORMAT_CSV) { + _output->addChar(']'); + if (_output_format == OUTPUT_FORMAT_WRAPPED_JSON) { + _output->addString(",\"total_count\":"); + outputInteger(_current_line); + _output->addString("}"); + } + _output->addChar('\n'); + } } @@ -1032,8 +1189,7 @@ // three-byte sequences (avoid buffer overflow!) if ((*r & 0xF0) == 0xE0) { if (chars_left < 3) { - if (g_debug_level >= 2) - logger(LG_INFO, "Ignoring invalid UTF-8 sequence in string '%s'", value); + logger(LG_INFO, "Ignoring invalid UTF-8 sequence in string '%s'", value); break; // end of string. No use in continuing } else { @@ -1048,8 +1204,7 @@ // four-byte sequences else if ((*r & 0xF8) == 0xF0) { if (chars_left < 4) { - if (g_debug_level >= 2) - logger(LG_INFO, "Ignoring invalid UTF-8 sequence in string '%s'", value); + logger(LG_INFO, "Ignoring invalid UTF-8 sequence in string '%s'", value); break; // end of string. No use in continuing } else { @@ -1063,8 +1218,7 @@ } } else { - if (g_debug_level >= 2) - logger(LG_INFO, "Ignoring invalid UTF-8 sequence in string '%s'", value); + logger(LG_INFO, "Ignoring invalid UTF-8 sequence in string '%s'", value); } } @@ -1146,7 +1300,7 @@ } -Aggregator **Query::getStatsGroup(Query::_stats_group_spec_t &groupspec) +Aggregator **Query::getStatsGroup(Query::_stats_group_spec_t &groupspec, bool *is_new) { _stats_groups_t::iterator it = _stats_groups.find(groupspec); if (it == _stats_groups.end()) { @@ -1154,10 +1308,15 @@ for (unsigned i=0; i<_stats_columns.size(); i++) aggr[i] = _stats_columns[i]->createAggregator(); _stats_groups.insert(make_pair(groupspec, aggr)); + if( is_new != 0 ) + *is_new = true; return aggr; } - else + else { + if( is_new != 0 ) + *is_new = false; return it->second; + } } void Query::computeStatsGroupSpec(Query::_stats_group_spec_t &groupspec, void *data) diff -Naur check_mk-1.2.3i6/livestatus.src/src/Query.h livestatus.working/src/Query.h --- check_mk-1.2.3i6/livestatus.src/src/Query.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Query.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -35,6 +35,7 @@ #include "AndingFilter.h" #include "global_counters.h" +#include "RowSortedSet.h" class Table; class Column; @@ -43,9 +44,10 @@ class StatsColumn; class Aggregator; -#define OUTPUT_FORMAT_CSV 0 -#define OUTPUT_FORMAT_JSON 1 -#define OUTPUT_FORMAT_PYTHON 2 +#define OUTPUT_FORMAT_CSV 0 +#define OUTPUT_FORMAT_JSON 1 +#define OUTPUT_FORMAT_PYTHON 2 +#define OUTPUT_FORMAT_WRAPPED_JSON 3 #define RESPONSE_HEADER_OFF 0 #define RESPONSE_HEADER_FIXED16 1 @@ -74,6 +76,7 @@ bool _need_ds_separator; int _output_format; int _limit; + int _offset; unsigned _current_line; int _timezone_offset; @@ -82,6 +85,9 @@ _columns_t _columns; _columns_t _dummy_columns; // dynamically allocated. Must delete them. + bool _do_sorting; + RowSortedSet _sorter; + // stats queries typedef vector _stats_columns_t; _stats_columns_t _stats_columns; // must also delete @@ -92,6 +98,8 @@ _stats_groups_t _stats_groups; public: + void *table_tmp_storage; // Used for tables to store per query temporary data + Query(InputBuffer *, OutputBuffer *out, Table *); ~Query(); bool processDataset(void *); @@ -100,7 +108,6 @@ void setDefaultColumns(const char *); void addColumn(Column *column); void setShowColumnHeaders(bool x) { _show_column_headers = x; } - void setError(int error_code, const char * msg); bool hasNoColumns(); contact *authUser() { return _auth_user; } void outputDatasetBegin(); @@ -130,15 +137,15 @@ void findIntLimits(const char *columnname, int *lower, int *upper); void optimizeBitmask(const char *columnname, uint32_t *bitmask); int timezoneOffset() { return _timezone_offset; } - AndingFilter *filter() { return &_filter; } private: bool doStats(); void doWait(); - Aggregator **getStatsGroup(_stats_group_spec_t &groupspec); + Aggregator **getStatsGroup(_stats_group_spec_t &groupspec, bool *is_new); void computeStatsGroupSpec(_stats_group_spec_t &groupspec, void *data); Filter *createFilter(Column *column, int operator_id, char *value); void parseFilterLine(char *line, bool filter /* and not cond */); + void parseSortLine(char *line); void parseStatsLine(char *line); void parseStatsGroupLine(char *line); void parseAndOrLine(char *line, int andor, bool filter /* and not cond */); @@ -148,6 +155,7 @@ void parseColumnsLine(char *line); void parseColumnHeadersLine(char *line); void parseLimitLine(char *line); + void parseOffsetLine(char *line); void parseSeparatorsLine(char *line); void parseOutputFormatLine(char *line); void parseKeepAliveLine(char *line); @@ -159,6 +167,7 @@ void parseLocaltimeLine(char *line); int lookupOperator(const char *opname); Column *createDummyColumn(const char *name); + void printRow(void *data); }; diff -Naur check_mk-1.2.3i6/livestatus.src/src/RowSortedSet.cc livestatus.working/src/RowSortedSet.cc --- check_mk-1.2.3i6/livestatus.src/src/RowSortedSet.cc 1970-01-01 01:00:00.000000000 +0100 +++ livestatus.working/src/RowSortedSet.cc 2013-11-21 15:51:13.000000000 +0100 @@ -0,0 +1,109 @@ +// This is a file made for Check_MK by Mathias Kettner 2012 +// +// This file is written by Max Sikström to a branch for OP5 Montior +// http://www.op5.com +// +// check_mk 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 in version 2. check_mk is distributed +// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU General Public License for more de- +// ails. You should have received a copy of the GNU General Public +// License along with GNU Make; see the file COPYING. If not, write +// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA. + +#include "RowSortedSet.h" +#include "Column.h" + + +RowSortedSet::RowSortedSet() + :_query(0) +{ +} + + +void RowSortedSet::addSortColumn( Column *col, bool desc ) +{ + _sort_cols.push_back( _sort_col_t( col, desc ) ); +} + +void RowSortedSet::setQuery( Query *query ) +{ + _query = query; +} + +/* Direction should be as dataa-datab; positive if dataa>datab */ +int RowSortedSet::compare( void *dataa, void *datab ) +{ + int i; + int diff; + for (i=0; i<_sort_cols.size(); i++) { + diff = _sort_cols[i].col->compare( dataa, datab, _query ); + if( _sort_cols[i].desc ) { + diff = -diff; + } + if( diff != 0 ) { + return diff; + } + } + return 0; +} + +void RowSortedSet::insert( void *data, int limit ) +{ + int cur; + _heap.push_back( data ); /* Make space for object */ + + for( cur=_heap.size()-1; + cur != 0 && compare( _heap[(cur-1)>>1], data ) < 0; + cur=(cur-1)>>1 ) + { + _heap[cur] = _heap[(cur-1)>>1]; + } + _heap[cur] = data; + + + if( limit > 0 && _heap.size() > limit ) { + extract(); + } +} + +void *RowSortedSet::extract() +{ + void *data; + void *last; + int cur; + int child; + + if( _heap.empty() ) + return 0; + + data = _heap[0]; + last = _heap.back(); + _heap.pop_back(); + + for( cur=0; (cur<<1)+1 < _heap.size(); cur=child ) { + child = (cur<<1)+1; + + if( child+1 < _heap.size() ) + if( compare( _heap[child+1], _heap[child] ) > 0 ) + child++; + + if( compare( _heap[child], last ) > 0 ) { + _heap[cur] = _heap[child]; + } else { + break; + } + } + + _heap[cur] = last; + + return data; +} + +int RowSortedSet::size() +{ + return _heap.size(); +} diff -Naur check_mk-1.2.3i6/livestatus.src/src/RowSortedSet.h livestatus.working/src/RowSortedSet.h --- check_mk-1.2.3i6/livestatus.src/src/RowSortedSet.h 1970-01-01 01:00:00.000000000 +0100 +++ livestatus.working/src/RowSortedSet.h 2013-11-21 15:51:13.000000000 +0100 @@ -0,0 +1,62 @@ +// This is a file made for Check_MK by Mathias Kettner 2012 +// +// This file is written by Max Sikström to a branch for OP5 Montior +// http://www.op5.com +// +// check_mk 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 in version 2. check_mk is distributed +// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU General Public License for more de- +// ails. You should have received a copy of the GNU General Public +// License along with GNU Make; see the file COPYING. If not, write +// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA. + +#ifndef RowSortedSet_h +#define RowSortedSet_h + +#include + +using namespace std; + +class Column; +class Query; + +class RowSortedSet +{ + + struct _sort_col_t { + Column *col; + bool desc; + _sort_col_t( Column *in_col, bool in_desc ) : col(in_col), desc(in_desc) {} + }; + + typedef vector<_sort_col_t> _columns_t; + typedef vector rowset_t; + + rowset_t _heap; + _columns_t _sort_cols; + + Query *_query; + + int compare( void *dataa, void *datab ); + void bubbleDown(); + +public: + + RowSortedSet(); + + void addSortColumn( Column *col, bool desc ); + void setQuery( Query *query ); + + void insert( void *data, int limit ); + void *extract(); + + int size(); +}; + + +#endif // RowStorage_h + diff -Naur check_mk-1.2.3i6/livestatus.src/src/ServicelistColumnFilter.cc livestatus.working/src/ServicelistColumnFilter.cc --- check_mk-1.2.3i6/livestatus.src/src/ServicelistColumnFilter.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/ServicelistColumnFilter.cc 2013-11-21 15:51:13.000000000 +0100 @@ -22,6 +22,8 @@ // to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, // Boston, MA 02110-1301 USA. +#include + #include "ServicelistColumnFilter.h" #include "ServicelistColumn.h" #include "nagios.h" diff -Naur check_mk-1.2.3i6/livestatus.src/src/ServiceSpecialDoubleColumn.cc livestatus.working/src/ServiceSpecialDoubleColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/ServiceSpecialDoubleColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/ServiceSpecialDoubleColumn.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,68 +0,0 @@ -// +------------------------------------------------------------------+ -// | ____ _ _ __ __ _ __ | -// | / ___| |__ ___ ___| | __ | \/ | |/ / | -// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | -// | | |___| | | | __/ (__| < | | | | . \ | -// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | -// | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | -// +------------------------------------------------------------------+ -// -// This file is part of Check_MK. -// The official homepage is at http://mathias-kettner.de/check_mk. -// -// check_mk 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 in version 2. check_mk is distributed -// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- -// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more de- -// ails. You should have received a copy of the GNU General Public -// License along with GNU Make; see the file COPYING. If not, write -// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -// Boston, MA 02110-1301 USA. - -#include "ServiceSpecialDoubleColumn.h" -#include "nagios.h" -#include "logger.h" -#include "time.h" - -extern int interval_length; - -double ServiceSpecialDoubleColumn::getValue(void *data) -{ - data = shiftPointer(data); - if (!data) return 0; - - service *svc = (service *)data; - switch (_type) { - case SSDC_STALENESS: - { - time_t check_result_age = time(0) - svc->last_check; - if (svc->check_interval != 0) - return check_result_age / (svc->check_interval * interval_length); - - // check_mk PASSIVE CHECK without check interval uses - // the check interval of its check-mk service - bool is_cmk_passive = !strncmp(svc->check_command_ptr->name, "check_mk-", 9); - if (is_cmk_passive) { - host *host = svc->host_ptr; - service *tmp_svc; - servicesmember *svc_member = host->services; - while (svc_member != 0) { - tmp_svc = svc_member->service_ptr; - if (!strncmp(tmp_svc->check_command_ptr->name, "check-mk", 9)) { - return check_result_age / ((tmp_svc->check_interval == 0 ? 1 : tmp_svc->check_interval) * interval_length); - } - svc_member = svc_member->next; - } - return 1; // Shouldnt happen! We always expect a check-mk service - } - else // Other non-cmk passive and active checks without check_interval - { - return check_result_age / interval_length; - } - } - } - return -1; // Never reached -} diff -Naur check_mk-1.2.3i6/livestatus.src/src/ServiceSpecialDoubleColumn.h livestatus.working/src/ServiceSpecialDoubleColumn.h --- check_mk-1.2.3i6/livestatus.src/src/ServiceSpecialDoubleColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/ServiceSpecialDoubleColumn.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,44 +0,0 @@ -// +------------------------------------------------------------------+ -// | ____ _ _ __ __ _ __ | -// | / ___| |__ ___ ___| | __ | \/ | |/ / | -// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | -// | | |___| | | | __/ (__| < | | | | . \ | -// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | -// | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | -// +------------------------------------------------------------------+ -// -// This file is part of Check_MK. -// The official homepage is at http://mathias-kettner.de/check_mk. -// -// check_mk 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 in version 2. check_mk is distributed -// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- -// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more de- -// ails. You should have received a copy of the GNU General Public -// License along with GNU Make; see the file COPYING. If not, write -// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -// Boston, MA 02110-1301 USA. - -#ifndef ServiceSpecialDoubleColumn_h -#define ServiceSpecialDoubleColumn_h - -#include "config.h" -#include "DoubleColumn.h" - -#define SSDC_STALENESS 1 - -class ServiceSpecialDoubleColumn : public DoubleColumn -{ - int _type; - -public: - ServiceSpecialDoubleColumn(string name, string description, int ssdc_type, int indirect) - : DoubleColumn(name, description, indirect) , _type(ssdc_type) {} - double getValue(void *data); -}; - -#endif // ServiceSpecialDoubleColumn_h - diff -Naur check_mk-1.2.3i6/livestatus.src/src/store.cc livestatus.working/src/store.cc --- check_mk-1.2.3i6/livestatus.src/src/store.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/store.cc 2013-11-21 15:51:13.000000000 +0100 @@ -46,13 +46,16 @@ ClientQueue *g_client_queue = 0; TimeperiodsCache *g_timeperiods_cache = 0; +/* API functions for event broker module (with C linkage) */ + void store_init() { - g_store = new Store(); + g_store = new Store(); g_client_queue = new ClientQueue(); g_timeperiods_cache = new TimeperiodsCache(); } + void store_deinit() { if (g_store) { @@ -135,8 +138,3 @@ g_timeperiods_cache->update(now); } -void log_timeperiods_cache(){ - g_timeperiods_cache->logCurrentTimeperiods(); -} - - diff -Naur check_mk-1.2.3i6/livestatus.src/src/Store.cc livestatus.working/src/Store.cc --- check_mk-1.2.3i6/livestatus.src/src/Store.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Store.cc 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ @@ -22,6 +22,8 @@ // to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, // Boston, MA 02110-1301 USA. +#include + #include "Store.h" #include "Query.h" #include "logger.h" @@ -39,32 +41,31 @@ extern unsigned long g_max_cached_messages; Store::Store() - : _log_cache(g_max_cached_messages) - , _table_hosts(false) + :_table_hosts(false) , _table_hostsbygroup(true) , _table_services(false, false) , _table_servicesbygroup(true, false) , _table_servicesbyhostgroup(false, true) , _table_downtimes(true) , _table_comments(false) + , _table_log(g_max_cached_messages) { - _tables.insert(make_pair("columns", &_table_columns)); - _tables.insert(make_pair("commands", &_table_commands)); - _tables.insert(make_pair("comments", &_table_comments)); - _tables.insert(make_pair("contactgroups", &_table_contactgroups)); - _tables.insert(make_pair("contacts", &_table_contacts)); - _tables.insert(make_pair("downtimes", &_table_downtimes)); - _tables.insert(make_pair("hostgroups", &_table_hostgroups)); - _tables.insert(make_pair("hostsbygroup", &_table_hostsbygroup)); _tables.insert(make_pair("hosts", &_table_hosts)); - _tables.insert(make_pair("log", &_table_log)); - _tables.insert(make_pair("servicegroups", &_table_servicegroups)); + _tables.insert(make_pair("hostsbygroup", &_table_hostsbygroup)); + _tables.insert(make_pair("services", &_table_services)); _tables.insert(make_pair("servicesbygroup", &_table_servicesbygroup)); _tables.insert(make_pair("servicesbyhostgroup", &_table_servicesbyhostgroup)); - _tables.insert(make_pair("services", &_table_services)); - _tables.insert(make_pair("statehist", &_table_statehistory)); + _tables.insert(make_pair("hostgroups", &_table_hostgroups)); + _tables.insert(make_pair("servicegroups", &_table_servicegroups)); + _tables.insert(make_pair("contacts", &_table_contacts)); + _tables.insert(make_pair("commands", &_table_commands)); + _tables.insert(make_pair("downtimes", &_table_downtimes)); + _tables.insert(make_pair("comments", &_table_comments)); _tables.insert(make_pair("status", &_table_status)); + _tables.insert(make_pair("log", &_table_log)); _tables.insert(make_pair("timeperiods", &_table_timeperiods)); + _tables.insert(make_pair("contactgroups", &_table_contactgroups)); + _tables.insert(make_pair("columns", &_table_columns)); g_table_hosts = &_table_hosts; g_table_services = &_table_services; @@ -80,7 +81,6 @@ g_table_timeperiods = &_table_timeperiods; g_table_contactgroups = &_table_contactgroups; g_table_log = &_table_log; - g_table_statehistory = &_table_statehistory; g_table_columns = &_table_columns; for (_tables_t::iterator it = _tables.begin(); @@ -117,7 +117,7 @@ int r = input->readRequest(); if (r != IB_REQUEST_READ) { if (r != IB_END_OF_FILE) - output->setError(RESPONSE_CODE_INCOMPLETE_REQUEST, + output->setError(RESPONSE_CODE_INCOMPLETE_REQUEST, "Client connection terminated while request still incomplete"); return false; } @@ -134,9 +134,8 @@ output->setDoKeepalive(true); } else if (!strncmp(line, "LOGROTATE", 9)) { - logger(LG_INFO, "Forcing logfile rotation"); + logger(LG_INFO, "Forcing logfile rotation"); rotate_log_file(time(0)); - schedule_new_event(EVENT_LOG_ROTATION,TRUE,get_next_log_rotation_time(),FALSE,0,(void *)get_next_log_rotation_time,TRUE,NULL,NULL,0); } else { logger(LG_INFO, "Invalid request '%s'", line); @@ -147,15 +146,14 @@ void Store::answerCommandRequest(const char *command) { - int buffer_items = -1; - /* int ret = */ - submit_external_command((char *)command, &buffer_items); + process_external_command1((char *)command); } void Store::answerGetRequest(InputBuffer *input, OutputBuffer *output, const char *tablename) { output->reset(); + if (!tablename[0]) { output->setError(RESPONSE_CODE_INVALID_REQUEST, "Invalid GET request, missing tablename"); } @@ -175,6 +173,7 @@ query.start(); table->answerQuery(&query); query.finish(); + table->cleanupQuery(&query); gettimeofday(&after, 0); unsigned long ustime = (after.tv_sec - before.tv_sec) * 1000000 + (after.tv_usec - before.tv_usec); if (g_debug_level > 0) diff -Naur check_mk-1.2.3i6/livestatus.src/src/store.h livestatus.working/src/store.h --- check_mk-1.2.3i6/livestatus.src/src/store.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/store.h 2013-11-21 15:51:13.000000000 +0100 @@ -25,7 +25,7 @@ #ifndef store_h #define store_h -#include "config.h" +#include #ifdef __cplusplus extern "C" @@ -47,8 +47,6 @@ int queue_pop_connection(); void queue_wakeup_all(); void update_timeperiods_cache(time_t); - void log_timeperiods_cache(); - #ifdef __cplusplus } diff -Naur check_mk-1.2.3i6/livestatus.src/src/Store.h livestatus.working/src/Store.h --- check_mk-1.2.3i6/livestatus.src/src/Store.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Store.h 2013-11-21 15:51:13.000000000 +0100 @@ -38,15 +38,12 @@ #include "TableDownComm.h" #include "TableStatus.h" #include "TableLog.h" -#include "TableStateHistory.h" #include "TableColumns.h" #include "OutputBuffer.h" #include "InputBuffer.h" -#include "LogCache.h" class Store { - LogCache _log_cache; TableContacts _table_contacts; TableCommands _table_commands; TableHostgroups _table_hostgroups; @@ -62,7 +59,6 @@ TableDownComm _table_comments; TableStatus _table_status; TableLog _table_log; - TableStateHistory _table_statehistory; TableColumns _table_columns; typedef map _tables_t; @@ -70,7 +66,6 @@ public: Store(); - LogCache* logCache() { return &_log_cache; }; void registerHostgroup(hostgroup *); void registerComment(nebstruct_comment_data *); void registerDowntime(nebstruct_downtime_data *); @@ -82,7 +77,6 @@ void answerCommandRequest(const char *); }; - #endif // Store_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/StringColumn.cc livestatus.working/src/StringColumn.cc --- check_mk-1.2.3i6/livestatus.src/src/StringColumn.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/StringColumn.cc 2013-11-21 15:51:13.000000000 +0100 @@ -25,6 +27,7 @@ #include "StringColumn.h" #include "StringColumnFilter.h" #include "Query.h" +#include void StringColumn::output(void *data, Query *query) { @@ -40,3 +43,7 @@ } +int StringColumn::compare(void *dataa, void*datab, Query *query) { + return strcmp( getValue(dataa), getValue(datab) ); +} + diff -Naur check_mk-1.2.3i6/livestatus.src/src/StringColumnFilter.cc livestatus.working/src/StringColumnFilter.cc --- check_mk-1.2.3i6/livestatus.src/src/StringColumnFilter.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/StringColumnFilter.cc 2013-11-21 15:51:13.000000000 +0100 @@ -32,12 +32,12 @@ #include "logger.h" #include "OutputBuffer.h" -StringColumnFilter::StringColumnFilter(StringColumn *column, int opid, char *value) + StringColumnFilter::StringColumnFilter(StringColumn *column, int opid, char *value) : _column(column) , _ref_string(value) , _opid(abs(opid)) , _negate(opid < 0) - , _regex(0) + , _regex(0) { if (_opid == OP_REGEX || _opid == OP_REGEX_ICASE) { if (strchr(value, '{') || strchr(value, '}')) { diff -Naur check_mk-1.2.3i6/livestatus.src/src/StringColumn.h livestatus.working/src/StringColumn.h --- check_mk-1.2.3i6/livestatus.src/src/StringColumn.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/StringColumn.h 2013-11-21 15:51:13.000000000 +0100 @@ -39,6 +41,7 @@ void output(void *, Query *); int type() { return COLTYPE_STRING; } Filter *createFilter(int operator_id, char *value); + int compare(void *dataa, void*datab, Query *query); }; #endif // StringColumn_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/strutil.c livestatus.working/src/strutil.c --- check_mk-1.2.3i6/livestatus.src/src/strutil.c 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/strutil.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,110 +0,0 @@ -// +------------------------------------------------------------------+ -// | ____ _ _ __ __ _ __ | -// | / ___| |__ ___ ___| | __ | \/ | |/ / | -// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | -// | | |___| | | | __/ (__| < | | | | . \ | -// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | -// | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | -// +------------------------------------------------------------------+ -// -// This file is part of Check_MK. -// The official homepage is at http://mathias-kettner.de/check_mk. -// -// check_mk 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 in version 2. check_mk is distributed -// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- -// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more de- -// ails. You should have received a copy of the GNU General Public -// License along with GNU Make; see the file COPYING. If not, write -// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -// Boston, MA 02110-1301 USA. - -#include -#include - -#include "strutil.h" - -char *rstrip(char *c) -{ - char *w = c + strlen(c) - 1; - while (w >= c && isspace(*w)) - *w-- = '\0'; - return c; -} - -char *lstrip(char *c) -{ - while (isspace(*c)) c++; - return c; -} - -/* *c points to a string containing - white space separated columns. This method returns - a pointer to the zero-terminated next field. That - might be identical with *c itself. The pointer c - is then moved to the possible beginning of the - next field. */ -char *next_field(char **c) -{ - /* *c points to first character of field */ - char *begin = lstrip(*c); // skip leading spaces - if (!*begin) { - *c = begin; - return 0; // found end of string -> no more field - } - - char *end = begin; // copy pointer, search end of field - while (*end && !isspace(*end)) end++; // search for \0 or white space - if (*end) { // string continues -> terminate field with '\0' - *end = '\0'; - *c = end + 1; // skip to character right *after* '\0' - } - else - *c = end; // no more field, point to '\0' - return begin; -} - -/* similar to next_field() but takes one character as delimiter */ -char *next_token(char **c, char delim) -{ - char *begin = *c; - if (!*begin) { - *c = begin; - return 0; - } - - char *end = begin; - while (*end && *end != delim) end++; - if (*end) { - *end = 0; - *c = end + 1; - } - else - *c = end; - return begin; -} - -/* same as next_token() but returns "" instead of 0 if - no tokens has been found */ -char *save_next_token(char **c, char delim) -{ - if (!*c) - return (char *)""; - - char *result = next_token(c, delim); - if (result == 0) - return (char *)""; - else - return result; -} - - -int ends_with(const char *a, const char *b) -{ - return !strcmp(a + strlen(a) - strlen(b), b); -} - - diff -Naur check_mk-1.2.3i6/livestatus.src/src/Table.cc livestatus.working/src/Table.cc --- check_mk-1.2.3i6/livestatus.src/src/Table.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Table.cc 2013-11-21 15:51:13.000000000 +0100 @@ -23,12 +23,23 @@ // Boston, MA 02110-1301 USA. #include - #include "Table.h" #include "Column.h" #include "Query.h" #include "logger.h" +void Table::clearNatSort() +{ + _nat_sort.clear(); +} + +void Table::addNatSort(string colname) +{ + _columns_t::iterator it = _columns.find(colname); + if (it != _columns.end()) + _nat_sort.push_back( it->second ); +} + void Table::addColumn(Column *col) { // do not insert column if one with that name @@ -38,9 +49,8 @@ if (column(col->name())) { delete col; } - else { + else _columns.insert(make_pair(col->name(), col)); - } } diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableCommands.cc livestatus.working/src/TableCommands.cc --- check_mk-1.2.3i6/livestatus.src/src/TableCommands.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableCommands.cc 2013-11-21 15:51:13.000000000 +0100 @@ -28,12 +28,10 @@ #include "nagios.h" #include "Query.h" #include "OffsetStringColumn.h" +#include "OffsetIntColumn.h" #include "TableCommands.h" - -extern command *command_list; - TableCommands::TableCommands() { addColumns(this, "", -1); @@ -44,6 +42,8 @@ { command cmd; char *ref = (char *)&cmd; + table->addColumn(new OffsetIntColumn(prefix + "id", + "Command id", (char *)(&cmd.id) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "name", "The name of the command", (char *)(&cmd.name) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "line", diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableCommands.h livestatus.working/src/TableCommands.h --- check_mk-1.2.3i6/livestatus.src/src/TableCommands.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableCommands.h 2013-11-21 15:51:13.000000000 +0100 @@ -29,7 +29,7 @@ #include #include "Table.h" -#include "nagios.h" +#include "nagios/objects.h" class TableCommands : public Table { diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableContactgroups.cc livestatus.working/src/TableContactgroups.cc --- check_mk-1.2.3i6/livestatus.src/src/TableContactgroups.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableContactgroups.cc 2013-11-21 15:51:13.000000000 +0100 @@ -25,11 +25,10 @@ #include "nagios.h" #include "Query.h" #include "OffsetStringColumn.h" +#include "OffsetIntColumn.h" #include "TableContactgroups.h" #include "ContactgroupsMemberColumn.h" -extern contactgroup *contactgroup_list; - TableContactgroups::TableContactgroups() { addColumns(this, "", -1); @@ -40,6 +39,8 @@ { contactgroup cg; char *ref = (char *)&cg; + table->addColumn(new OffsetIntColumn(prefix + "id", + "Contactgroup id", (char *)(&cg.id) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "name", "The name of the contactgroup", (char *)(&cg.group_name) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "alias", diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableContactgroups.h livestatus.working/src/TableContactgroups.h --- check_mk-1.2.3i6/livestatus.src/src/TableContactgroups.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableContactgroups.h 2013-11-21 15:51:13.000000000 +0100 @@ -28,7 +28,7 @@ #include #include "config.h" #include "Table.h" -#include "nagios.h" +#include class TableContactgroups : public Table { diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableContacts.cc livestatus.working/src/TableContacts.cc --- check_mk-1.2.3i6/livestatus.src/src/TableContacts.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableContacts.cc 2013-11-21 15:51:13.000000000 +0100 @@ -31,8 +31,6 @@ #include "AttributelistColumn.h" #include "CustomVarsColumn.h" -extern contact *contact_list; - TableContacts::TableContacts() { addColumns(this, "", -1); @@ -42,6 +40,8 @@ { contact ctc; char *ref = (char *)&ctc; + table->addColumn(new OffsetIntColumn(prefix + "id", + "Contact id", (char *)(&ctc.id) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "name", "The login name of the contact person", (char *)(&ctc.name) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "alias", @@ -83,6 +83,9 @@ "A bitmask specifying which attributes have been modified", (char *)(&ctc.modified_attributes) - ref, indirect_offset, false)); table->addColumn(new AttributelistColumn(prefix + "modified_attributes_list", "A list of all modified attributes", (char *)(&ctc.modified_attributes) - ref, indirect_offset, true)); + + table->clearNatSort(); + table->addNatSort( prefix + "name" ); } diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableContacts.h livestatus.working/src/TableContacts.h --- check_mk-1.2.3i6/livestatus.src/src/TableContacts.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableContacts.h 2013-11-21 15:51:13.000000000 +0100 @@ -27,7 +27,7 @@ #include "config.h" #include "Table.h" -#include "nagios.h" +#include class TableContacts : public Table { diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableDownComm.cc livestatus.working/src/TableDownComm.cc --- check_mk-1.2.3i6/livestatus.src/src/TableDownComm.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableDownComm.cc 2013-11-21 15:51:13.000000000 +0100 @@ -109,11 +109,11 @@ add(new Comment(data)); } else if (data->type == NEBTYPE_COMMENT_DELETE) { - Comment comment(data); - remove(&comment); + remove(id); } } + void TableDownComm::addDowntime(nebstruct_downtime_data *data) { unsigned long id = data->downtime_id; @@ -121,30 +121,27 @@ add(new Downtime(data)); } else if (data->type == NEBTYPE_DOWNTIME_DELETE) { - Downtime downtime(data); - remove(&downtime); + remove(id); } } + void TableDownComm::add(DowntimeOrComment *data) { - dc_key tmp_key = make_pair(data->_id, data->_service != 0); - _entries_t::iterator it = _entries.find(tmp_key); - + _entries_t::iterator it = _entries.find(data->_id); // might be update -> delete previous data set if (it != _entries.end()) { delete it->second; _entries.erase(it); } - _entries.insert(make_pair(tmp_key, data)); + _entries.insert(make_pair(data->_id, data)); } -void TableDownComm::remove(DowntimeOrComment *data) +void TableDownComm::remove(unsigned id) { - dc_key tmp_key = make_pair(data->_id, data->_service != 0); - _entries_t::iterator it = _entries.find(tmp_key); + _entries_t::iterator it = _entries.find(id); if (it == _entries.end()) - logger(LG_INFO, "Cannot delete non-existing downtime/comment %u", data->_id); + logger(LG_INFO, "Cannot delete non-existing downtime/comment %u", id); else { delete it->second; _entries.erase(it); @@ -168,13 +165,11 @@ return is_authorized_for(ctc, dtc->_host, dtc->_service); } -DowntimeOrComment *TableDownComm::findEntry(unsigned long id, bool is_service) +DowntimeOrComment *TableDownComm::findEntry(unsigned long id) { - dc_key tmp_key = make_pair(id, is_service); - _entries_t::iterator it = _entries.find(tmp_key); - if (it != _entries.end()) { + _entries_t::iterator it = _entries.find(id); + if (it != _entries.end()) return it->second; - } else return 0; } diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableDownComm.h livestatus.working/src/TableDownComm.h --- check_mk-1.2.3i6/livestatus.src/src/TableDownComm.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableDownComm.h 2013-11-21 15:51:13.000000000 +0100 @@ -41,20 +41,18 @@ class TableDownComm : public Table { const char *_name; - - typedef pair dc_key; - typedef map _entries_t; + typedef map _entries_t; _entries_t _entries; public: TableDownComm(bool is_downtime); const char *name() { return _name; } ~TableDownComm(); - DowntimeOrComment *findEntry(unsigned long id, bool is_service); + DowntimeOrComment *findEntry(unsigned long id); void addDowntime(nebstruct_downtime_data *); void addComment(nebstruct_comment_data *); void add(DowntimeOrComment *data); - void remove(DowntimeOrComment *data); + void remove(unsigned id); void answerQuery(Query *); bool isAuthorized(contact *ctc, void *data); _entries_t::iterator entriesIteratorBegin() { return _entries.begin(); } diff -Naur check_mk-1.2.3i6/livestatus.src/src/Table.h livestatus.working/src/Table.h --- check_mk-1.2.3i6/livestatus.src/src/Table.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/Table.h 2013-11-21 15:51:13.000000000 +0100 @@ -29,6 +29,8 @@ #include "nagios.h" #include +#include +#include #include using namespace std; @@ -40,22 +42,28 @@ { public: typedef map _columns_t; + typedef vector _nat_sort_t; private: _columns_t _columns; + _nat_sort_t _nat_sort; /* Natural sort order columns */ public: Table() {} virtual ~Table(); virtual Column *column(const char *name); virtual void answerQuery(Query *) = 0; + virtual void cleanupQuery(Query * __attribute__ ((__unused__))) {} virtual const char *name() = 0; virtual const char *prefixname() { return name(); } virtual bool isAuthorized(contact *, void *) { return true; } virtual void *findObject(char *objectspec __attribute__ ((__unused__))) { return 0; } // objectspec may be modified while parsing + void clearNatSort(); + void addNatSort(string); void addColumn(Column *); bool hasColumn(Column *); void addAllColumnsToQuery(Query *); _columns_t *columns() { return &_columns; } + _nat_sort_t *natSortColumns() { return &_nat_sort; } }; diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableHostgroups.cc livestatus.working/src/TableHostgroups.cc --- check_mk-1.2.3i6/livestatus.src/src/TableHostgroups.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableHostgroups.cc 2013-11-21 15:51:13.000000000 +0100 @@ -26,17 +26,13 @@ #include "TableHostgroups.h" #include "Query.h" #include "OffsetStringColumn.h" +#include "OffsetIntColumn.h" #include "HostlistColumn.h" #include "HostlistStateColumn.h" #include "auth.h" #include "tables.h" #include "TableHosts.h" -/* this might be a hack (accessing Nagios' internal structures. - Hi Ethan: please help me here: how should this be code to be - portable? */ -extern hostgroup *hostgroup_list; - TableHostgroups::TableHostgroups() { addColumns(this, "", -1); @@ -46,6 +42,8 @@ { hostgroup hgr; char *ref = (char *)&hgr; + table->addColumn(new OffsetIntColumn(prefix + "id", + "Hostgroup id", (char *)(&hgr.id) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "name", "Name of the hostgroup", (char *)(&hgr.group_name) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "alias", @@ -103,6 +101,9 @@ "The total number of services with the state CRIT of hosts in this group", HLSC_NUM_SVC_HARD_CRIT, (char *)(&hgr.members) - ref, indirect_offset)); table->addColumn(new HostlistStateColumn(prefix + "num_services_hard_unknown", "The total number of services with the state UNKNOWN of hosts in this group", HLSC_NUM_SVC_HARD_UNKNOWN, (char *)(&hgr.members) - ref, indirect_offset)); + + table->clearNatSort(); + table->addNatSort( prefix + "name" ); } void TableHostgroups::answerQuery(Query *query) @@ -128,6 +129,9 @@ hostgroup *hg = (hostgroup *)data; hostsmember *mem = hg->members; + if (!mem) + return false; + while (mem) { host *hst = mem->host_ptr; bool is = g_table_hosts->isAuthorized(ctc, hst); @@ -137,5 +141,7 @@ return false; mem = mem->next; } + if(g_group_authorization == AUTH_LOOSE) + return false; return true; } diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableHostgroups.h livestatus.working/src/TableHostgroups.h --- check_mk-1.2.3i6/livestatus.src/src/TableHostgroups.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableHostgroups.h 2013-11-21 15:51:13.000000000 +0100 @@ -29,7 +29,7 @@ #include #include "Table.h" -#include "nagios.h" +#include "nagios/objects.h" class TableHostgroups : public Table { @@ -39,6 +39,7 @@ void *findObject(char *objectspec); bool isAuthorized(contact *, void *); void addColumns(Table *, string prefix, int indirect_offset); + void add(hostgroup *ctc); void answerQuery(Query *query); }; diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableHosts.cc livestatus.working/src/TableHosts.cc --- check_mk-1.2.3i6/livestatus.src/src/TableHosts.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableHosts.cc 2013-11-21 16:05:07.000000000 +0100 @@ -22,6 +22,8 @@ // to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, // Boston, MA 02110-1301 USA. +#include + #include "nagios.h" #include "logger.h" #include "TableHosts.h" @@ -44,22 +46,16 @@ #include "HostgroupsColumn.h" #include "ContactgroupsColumn.h" #include "HostSpecialIntColumn.h" -#include "HostSpecialDoubleColumn.h" #include "tables.h" #include "auth.h" -extern host *host_list; -extern hostgroup *hostgroup_list; - -struct hostbygroup { - host _host; - hostgroup *_hostgroup; -}; - bool TableHosts::isAuthorized(contact *ctc, void *data) { host *hst = (host *)data; + if (_by_group) { + hst = ((hostbygroup*)data)->_host; + } return is_authorized_for(ctc, hst, 0); } @@ -68,10 +64,13 @@ : _by_group(by_group) { struct hostbygroup ref; - addColumns(this, "", -1); if (by_group) { + addColumns(this, "", (char *)&(ref._host) - (char *)&ref); g_table_hostgroups->addColumns(this, "hostgroup_", (char *)&(ref._hostgroup) - (char *)&ref); } + else { + addColumns(this, "", -1); + } } @@ -80,6 +79,8 @@ host hst; char *ref = (char *)&hst; + table->addColumn(new OffsetIntColumn(prefix + "id", + "Host id", (char *)(&hst.id) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "name", "Host name", (char *)(&hst.name) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "display_name", @@ -89,9 +90,7 @@ table->addColumn(new OffsetStringColumn(prefix + "address", "IP address", (char *)(&hst.address) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "check_command", - "Nagios command for active host check of this host", (char *)(&hst.host_check_command) - ref, indirect_offset)); - table->addColumn(new OffsetStringHostMacroColumn(prefix + "check_command_expanded", - "Nagios command for active host check of this host with the macros expanded", (char *)(&hst.host_check_command) - ref, indirect_offset)); + "Nagios command for active host check of this host", (char *)(&hst.check_command) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "event_handler", "Nagios command used as event handler", (char *)(&hst.event_handler) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "notification_period", @@ -136,7 +135,7 @@ table->addColumn(new OffsetIntColumn(prefix + "process_performance_data", "Whether processing of performance data is enabled (0/1)", (char *)(&hst.process_performance_data) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "accept_passive_checks", - "Whether passive host checks are accepted (0/1)", (char *)(&hst.accept_passive_host_checks) - ref, indirect_offset)); + "Whether passive host checks are accepted (0/1)", (char *)(&hst.accept_passive_checks) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "event_handler_enabled", "Whether event handling is enabled (0/1)", (char *)(&hst.event_handler_enabled) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "acknowledgement_type", @@ -150,24 +149,28 @@ table->addColumn(new OffsetIntColumn(prefix + "current_attempt", "Number of the current check attempts", (char *)(&hst.current_attempt) - ref, indirect_offset)); table->addColumn(new OffsetTimeColumn(prefix + "last_notification", - "Time of the last notification (Unix timestamp)", (char *)(&hst.last_host_notification) - ref, indirect_offset)); + "Time of the last notification (Unix timestamp)", (char *)(&hst.last_notification) - ref, indirect_offset)); table->addColumn(new OffsetTimeColumn(prefix + "next_notification", - "Time of the next notification (Unix timestamp)", (char *)(&hst.next_host_notification) - ref, indirect_offset)); + "Time of the next notification (Unix timestamp)", (char *)(&hst.next_notification) - ref, indirect_offset)); table->addColumn(new OffsetTimeColumn(prefix + "next_check", "Scheduled time for the next check (Unix timestamp)", (char *)(&hst.next_check) - ref, indirect_offset)); table->addColumn(new OffsetTimeColumn(prefix + "last_hard_state_change", "Time of the last hard state change (Unix timestamp)", (char *)(&hst.last_hard_state_change) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "has_been_checked", "Whether the host has already been checked (0/1)", (char *)(&hst.has_been_checked) - ref, indirect_offset)); + /* FIXME: hourly_value is an unsigned int... */ + table->addColumn(new OffsetIntColumn(prefix + "hourly_value", + "Hourly Value", (char *)(&hst.hourly_value) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "current_notification_number", "Number of the current notification", (char *)(&hst.current_notification_number) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "pending_flex_downtime", "Whether a flex downtime is pending (0/1)", (char *)(&hst.pending_flex_downtime) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "total_services", "The total number of services of the host", (char *)(&hst.total_services) - ref, indirect_offset)); - // Note: this is redundant with "active_checks_enabled". Nobody noted this before... table->addColumn(new OffsetIntColumn(prefix + "checks_enabled", "Whether checks of the host are enabled (0/1)", (char *)(&hst.checks_enabled) - ref, indirect_offset)); + table->addColumn(new OffsetStringColumn(prefix + "check_source", + "The source of the check", (char *)(&hst.check_source) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "notifications_enabled", "Whether notifications of the host are enabled (0/1)", (char *)(&hst.notifications_enabled) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "acknowledged", @@ -184,6 +187,8 @@ "Time of the last check (Unix timestamp)", (char *)(&hst.last_check) - ref, indirect_offset)); table->addColumn(new OffsetTimeColumn(prefix + "last_state_change", "Time of the last state change - soft or hard (Unix timestamp)", (char *)(&hst.last_state_change) - ref, indirect_offset)); + table->addColumn(new OffsetIntColumn(prefix + "should_be_scheduled", + "Whether nagios still tries to run checks on this host (0/1)", (char *)(&hst.should_be_scheduled) - ref, indirect_offset)); table->addColumn(new OffsetTimeColumn(prefix + "last_time_up", "The last time the host was UP (Unix timestamp)", (char *)&hst.last_time_up - ref, indirect_offset)); @@ -202,8 +207,8 @@ "Whether active checks are enabled for the host (0/1)", (char *)(&hst.checks_enabled) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "check_options", "The current check option, forced, normal, freshness... (0-2)", (char *)(&hst.check_options) - ref, indirect_offset)); - table->addColumn(new OffsetIntColumn(prefix + "obsess_over_host", - "The current obsess_over_host setting... (0/1)", (char *)(&hst.obsess_over_host) - ref, indirect_offset)); + table->addColumn(new OffsetIntColumn(prefix + "obsess", + "The current obsess setting... (0/1)", (char *)(&hst.obsess) - ref, indirect_offset)); table->addColumn(new AttributelistColumn(prefix + "modified_attributes", "A bitmask specifying which attributes have been modified", (char *)(&hst.modified_attributes) - ref, indirect_offset, false)); table->addColumn(new AttributelistColumn(prefix + "modified_attributes_list", @@ -243,15 +248,16 @@ table->addColumn(new HostContactsColumn(prefix + "contacts", "A list of all contacts of this host, either direct or via a contact group", indirect_offset)); table->addColumn(new DownCommColumn(prefix + "downtimes", - "A list of the ids of all scheduled downtimes of this host", indirect_offset, true, false, false, false)); + "A list of the ids of all scheduled downtimes of this host", indirect_offset, true, false)); table->addColumn(new DownCommColumn(prefix + "downtimes_with_info", - "A list of the all scheduled downtimes of the host with id, author and comment", indirect_offset, true, false, true, false)); + "A list of the all scheduled downtimes of the host with id, author and comment", indirect_offset, true, true)); table->addColumn(new DownCommColumn(prefix + "comments", - "A list of the ids of all comments of this host", indirect_offset, false, false, false, false)); + "A list of the ids of all comments of this host", indirect_offset, false, false)); table->addColumn(new DownCommColumn(prefix + "comments_with_info", - "A list of all comments of the host with id, author and comment", indirect_offset, false, false, true, false)); + "A list of all comments of the host with id, author and comment", indirect_offset, false, true)); + table->addColumn(new DownCommColumn(prefix + "comments_with_extra_info", - "A list of all comments of the host with id, author, comment, entry type and entry time", indirect_offset, false, false, true, true)); + "A list of all comments of the host with id, author, comment, entry type and entry time", indirect_offset, false, true)); table->addColumn(new CustomVarsColumn(prefix + "custom_variable_names", "A list of the names of all custom variables", (char *)(&hst.custom_variables) - ref, indirect_offset, CVT_VARNAMES)); @@ -302,9 +308,6 @@ table->addColumn(new HostSpecialIntColumn(prefix + "pnpgraph_present", "Whether there is a PNP4Nagios graph present for this host (0/1)", HSIC_PNP_GRAPH_PRESENT, indirect_offset)); - table->addColumn(new HostSpecialDoubleColumn(prefix + "staleness", - "Staleness indicator for this host", HSDC_STALENESS, indirect_offset)); - table->addColumn(new HostgroupsColumn(prefix + "groups", "A list of all host groups this host is in", (char *)(&hst.hostgroups_ptr) - ref, indirect_offset)); table->addColumn(new ContactgroupsColumn(prefix + "contact_groups", @@ -316,6 +319,9 @@ "A list of all services of the host together with state and has_been_checked", (char *)(&hst.services) - ref, indirect_offset, false, 1)); table->addColumn(new ServicelistColumn(prefix + "services_with_info", "A list of all services including detailed information about each service", (char *)(&hst.services) - ref, indirect_offset, false, 2)); + + table->clearNatSort(); + table->addNatSort( prefix + "name" ); } void *TableHosts::findObject(char *objectspec) @@ -326,16 +332,20 @@ void TableHosts::answerQuery(Query *query) { + struct hostbygroup **_hg_tmp_storage = (struct hostbygroup **)&(query->table_tmp_storage); // Table hostsbygroup iterates over host groups if (_by_group) { hostgroup *hgroup = hostgroup_list; - hostbygroup hg; + hostbygroup *hg; while (hgroup) { - hg._hostgroup = hgroup; hostsmember *mem = hgroup->members; while (mem) { - memcpy(&hg._host, mem->host_ptr, sizeof(host)); - if (!query->processDataset(&hg)) + hg = new hostbygroup; + hg->_hostgroup = hgroup; + hg->_host = mem->host_ptr; + hg->_next = *_hg_tmp_storage; + *_hg_tmp_storage = hg; + if (!query->processDataset(hg)) break; mem = mem->next; } @@ -364,3 +374,15 @@ hst = hst->next; } } + +void TableHosts::cleanupQuery(Query *query) +{ + struct hostbygroup **_hg_tmp_storage = (struct hostbygroup **)&(query->table_tmp_storage); + + struct hostbygroup *cur; + while( *_hg_tmp_storage ) { + cur = *_hg_tmp_storage; + *_hg_tmp_storage = cur->_next; + delete cur; + } +} diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableHosts.h livestatus.working/src/TableHosts.h --- check_mk-1.2.3i6/livestatus.src/src/TableHosts.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableHosts.h 2013-11-21 15:51:13.000000000 +0100 @@ -30,12 +30,21 @@ #include "Table.h" #include "nagios.h" +using namespace std; + class TableContacts; class TableDownComm; +struct hostbygroup { + host *_host; + hostgroup *_hostgroup; + struct hostbygroup *_next; +}; + class TableHosts : public Table { bool _by_group; + public: TableHosts(bool by_group); const char *name() { return _by_group ? "hostsbygroup" : "hosts"; } @@ -44,6 +53,7 @@ void *findObject(char *objectspec); void addColumns(Table *, string prefix, int indirect_offset); void answerQuery(Query *query); + void cleanupQuery(Query *query); }; #endif // TableHosts_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableLog.cc livestatus.working/src/TableLog.cc --- check_mk-1.2.3i6/livestatus.src/src/TableLog.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableLog.cc 2013-11-21 15:51:13.000000000 +0100 @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include "nagios.h" #include "logger.h" @@ -43,76 +45,127 @@ #include "TableCommands.h" #include "TableContacts.h" #include "auth.h" -#include "Store.h" - #define CHECK_MEM_CYCLE 1000 /* Check memory every N'th new message */ // watch nagios' logfile rotation -extern Store *g_store; +extern time_t last_log_rotation; +extern int g_debug_level; + +int num_cached_log_messages = 0; -TableLog::TableLog() +// Debugging logging is hard if debug messages are logged themselves... +void debug(const char *loginfo, ...) { - addColumns(this, "", -1); + if (g_debug_level < 2) + return; + + FILE *x = fopen("/tmp/livestatus.log", "a+"); + va_list ap; + va_start(ap, loginfo); + vfprintf(x, loginfo, ap); + fputc('\n', x); + va_end(ap); + fclose(x); } -void TableLog::addColumns(Table *table, string prefix, int indirect_offset, bool add_host, bool add_services) + +TableLog::TableLog(unsigned long max_cached_messages) + : _num_cached_messages(0) + , _max_cached_messages(max_cached_messages) + , _num_at_last_check(0) { - LogEntry *ref = 0; - table->addColumn(new OffsetTimeColumn(prefix + "time", - "Time of the log event (UNIX timestamp)", (char *)&(ref->_time) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetIntColumn(prefix + "lineno", - "The number of the line in the log file", (char *)&(ref->_lineno) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetIntColumn(prefix + "class", - "The class of the message as integer (0:info, 1:state, 2:program, 3:notification, 4:passive, 5:command)", (char *)&(ref->_logclass) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "message", - "The complete message line including the timestamp", (char *)&(ref->_complete) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "type", - "The type of the message (text before the colon), the message itself for info messages", (char *)&(ref->_text) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "options", - "The part of the message after the ':'", (char *)&(ref->_options) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "comment", - "A comment field used in various message types", (char *)&(ref->_comment) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "plugin_output", - "The output of the check, if any is associated with the message", (char *)&(ref->_check_output) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetIntColumn(prefix + "state", - "The state of the host or service in question", (char *)&(ref->_state) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "state_type", - "The type of the state (varies on different log classes)", (char *)&(ref->_state_type) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetIntColumn(prefix + "attempt", - "The number of the check attempt", (char *)&(ref->_attempt) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "service_description", - "The description of the service log entry is about (might be empty)", - (char *)&(ref->_svc_desc) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "host_name", - "The name of the host the log entry is about (might be empty)", - (char *)&(ref->_host_name) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "contact_name", - "The name of the contact the log entry is about (might be empty)", - (char *)&(ref->_contact_name) - (char *)ref, indirect_offset)); - table->addColumn(new OffsetStringColumn(prefix + "command_name", - "The name of the command of the log entry (e.g. for notifications)", - (char *)&(ref->_command_name) - (char *)ref, indirect_offset)); + pthread_mutex_init(&_lock, 0); + LogEntry *ref = 0; + addColumn(new OffsetTimeColumn("time", + "Time of the log event (UNIX timestamp)", (char *)&(ref->_time) - (char *)ref, -1)); + addColumn(new OffsetIntColumn("lineno", + "The number of the line in the log file", (char *)&(ref->_lineno) - (char *)ref, -1)); + addColumn(new OffsetIntColumn("class", + "The class of the message as integer (0:info, 1:state, 2:program, 3:notification, 4:passive, 5:command)", (char *)&(ref->_logclass) - (char *)ref, -1)); + + addColumn(new OffsetStringColumn("message", + "The complete message line including the timestamp", (char *)&(ref->_complete) - (char *)ref, -1)); + addColumn(new OffsetStringColumn("type", + "The type of the message (text before the colon), the message itself for info messages", (char *)&(ref->_text) - (char *)ref, -1)); + addColumn(new OffsetStringColumn("options", + "The part of the message after the ':'", (char *)&(ref->_options) - (char *)ref, -1)); + addColumn(new OffsetStringColumn("comment", + "A comment field used in various message types", (char *)&(ref->_comment) - (char *)ref, -1)); + addColumn(new OffsetStringColumn("plugin_output", + "The output of the check, if any is associated with the message", (char *)&(ref->_check_output) - (char *)ref, -1)); + addColumn(new OffsetIntColumn("state", + "The state of the host or service in question", (char *)&(ref->_state) - (char *)ref, -1)); + addColumn(new OffsetStringColumn("state_type", + "The type of the state (varies on different log classes)", (char *)&(ref->_state_type) - (char *)ref, -1)); + addColumn(new OffsetIntColumn("attempt", + "The number of the check attempt", (char *)&(ref->_attempt) - (char *)ref, -1)); + addColumn(new OffsetStringColumn("service_description", + "The description of the service log entry is about (might be empty)", + (char *)&(ref->_svc_desc) - (char *)ref, -1)); + addColumn(new OffsetStringColumn("host_name", + "The name of the host the log entry is about (might be empty)", + (char *)&(ref->_host_name) - (char *)ref, -1)); + addColumn(new OffsetStringColumn("contact_name", + "The name of the contact the log entry is about (might be empty)", + (char *)&(ref->_contact_name) - (char *)ref, -1)); + addColumn(new OffsetStringColumn("command_name", + "The name of the command of the log entry (e.g. for notifications)", + (char *)&(ref->_command_name) - (char *)ref, -1)); // join host and service tables - if (add_host) - g_table_hosts->addColumns(table, "current_host_", (char *)&(ref->_host) - (char *)ref); - if (add_services) - g_table_services->addColumns(table, "current_service_", (char *)&(ref->_service) - (char *)ref, false /* no hosts table */); - g_table_contacts->addColumns(table, "current_contact_", (char *)&(ref->_contact) - (char *)ref); - g_table_commands->addColumns(table, "current_command_", (char *)&(ref->_command) - (char *)ref); + g_table_hosts->addColumns(this, "current_host_", (char *)&(ref->_host) - (char *)ref); + g_table_services->addColumns(this, "current_service_", (char *)&(ref->_service) - (char *)ref, false /* no hosts table */); + g_table_contacts->addColumns(this, "current_contact_", (char *)&(ref->_contact) - (char *)ref); + g_table_commands->addColumns(this, "current_command_", (char *)&(ref->_command) - (char *)ref); + + updateLogfileIndex(); } + TableLog::~TableLog() { + forgetLogfiles(); + pthread_mutex_destroy(&_lock); +} + + +void TableLog::forgetLogfiles() +{ + for (_logfiles_t::iterator it = _logfiles.begin(); + it != _logfiles.end(); + ++it) + { + delete it->second; + } + _logfiles.clear(); + _num_cached_messages = 0; } void TableLog::answerQuery(Query *query) { - g_store->logCache()->lockLogCache(); - g_store->logCache()->logCachePreChecks(); + // since logfiles are loaded on demand, we need + // to lock out concurrent threads. + pthread_mutex_lock(&_lock); + + // Do we have any logfiles (should always be the case, + // but we don't want to crash... + if (_logfiles.size() == 0) { + pthread_mutex_unlock(&_lock); + logger(LOG_INFO, "Warning: no logfile found, not even nagios.log"); + return; + } + + // Has Nagios rotated logfiles? => Update + // our file index. And delete all memorized + // log messages. + if (last_log_rotation > _last_index_update) { + logger(LG_INFO, "Nagios has rotated logfiles. Rebuilding logfile index"); + forgetLogfiles(); + updateLogfileIndex(); + } int since = 0; int until = time(0) + 1; @@ -128,41 +181,204 @@ uint32_t classmask = LOGCLASS_ALL; query->optimizeBitmask("class", &classmask); if (classmask == 0) { - g_store->logCache()->unlockLogCache(); + pthread_mutex_unlock(&_lock); return; } + /* This code start with the oldest log entries. I'm going to change this and start with the newest. That way, the Limit: header produces more reasonable results. */ /* NEW CODE - NEWEST FIRST */ _logfiles_t::iterator it; - it = g_store->logCache()->logfiles()->end(); // it now points beyond last log file + it = _logfiles.end(); // it now points beyond last log file --it; // switch to last logfile (we have at least one) // Now find newest log where 'until' is contained. The problem // here: For each logfile we only know the time of the *first* entry, // not that of the last. - while (it != g_store->logCache()->logfiles()->begin() && it->first > until) // while logfiles are too new... + while (it != _logfiles.begin() && it->first > until) // while logfiles are too new... --it; // go back in history - if (it->first > until) { // all logfiles are too new - g_store->logCache()->unlockLogCache(); + if (it->first > until) { // all logfiles are too new + pthread_mutex_unlock(&_lock); return; } while (true) { Logfile *log = it->second; - if (!log->answerQueryReverse(query, g_store->logCache(), since, until, classmask)) + debug("Query is now at logfile %s, needing classes 0x%x", log->path(), classmask); + if (!log->answerQueryReverse(query, this, since, until, classmask)) break; // end of time range found - if (it == g_store->logCache()->logfiles()->begin()) + if (it == _logfiles.begin()) break; // this was the oldest one --it; } - g_store->logCache()->unlockLogCache(); + + // dumpLogfiles(); + pthread_mutex_unlock(&_lock); } +extern char *log_file; +extern char *log_archive_path; + +void TableLog::updateLogfileIndex() +{ + _last_index_update = time(0); + + // We need to find all relevant logfiles. This includes + // the current nagios.log and all files in the archive + // directory. + scanLogfile(log_file, true); + DIR *dir = opendir(log_archive_path); + if (dir) { + char abspath[4096]; + struct dirent *ent, *result; + int len = offsetof(struct dirent, d_name) + + pathconf(log_archive_path, _PC_NAME_MAX) + 1; + ent = (struct dirent *)malloc(len); + while (0 == readdir_r(dir, ent, &result) && result != 0) + { + if (ent->d_name[0] != '.') { + snprintf(abspath, sizeof(abspath), "%s/%s", log_archive_path, ent->d_name); + scanLogfile(abspath, false); + } + // ent = result; + } + free(ent); + closedir(dir); + } + else + logger(LG_INFO, "Cannot open log archive '%s'", log_archive_path); +} + +void TableLog::scanLogfile(char *path, bool watch) +{ + Logfile *logfile = new Logfile(path, watch); + time_t since = logfile->since(); + if (since) { + // make sure that no entry with that 'since' is existing yet. + // under normal circumstances this never happens. But the + // user might have copied files around. + if (_logfiles.find(since) == _logfiles.end()) + _logfiles.insert(make_pair(since, logfile)); + else { + logger(LG_WARN, "Ignoring duplicate logfile %s", path); + delete logfile; + } + } + else + delete logfile; +} + +void TableLog::dumpLogfiles() +{ + for (_logfiles_t::iterator it = _logfiles.begin(); + it != _logfiles.end(); + ++it) + { + Logfile *log = it->second; + debug("LOG %s from %d, %u messages, classes: 0x%04x", log->path(), log->since(), log->numEntries(), log->classesRead()); + } +} + +/* This method is called each time a log message is loaded + into memory. If the number of messages loaded in memory + is to large, memory will be freed by flushing logfiles + and message not needed by the current query. + + The parameters to this method reflect the current query, + not the messages that just has been loaded. + */ +void TableLog::handleNewMessage(Logfile *logfile, time_t since __attribute__ ((__unused__)), time_t until __attribute__ ((__unused__)), unsigned logclasses) +{ + if (++_num_cached_messages <= _max_cached_messages) + return; // current message count still allowed, everything ok + + /* Memory checking an freeing consumes CPU ressources. We save + ressources, by avoiding to make the memory check each time + a new message is loaded when being in a sitation where no + memory can be freed. We do this by suppressing the check when + the number of messages loaded into memory has not grown + by at least CHECK_MEM_CYCLE messages */ + if (_num_cached_messages < _num_at_last_check + CHECK_MEM_CYCLE) + return; // Do not check this time + + // [1] Begin by deleting old logfiles + // Begin deleting with the oldest logfile available + _logfiles_t::iterator it; + for (it = _logfiles.begin(); it != _logfiles.end(); ++it) + { + Logfile *log = it->second; + ///if (g_debug_level > 2) + // debug("Logfile %s (%s, %d entries)", log->path(), log == logfile ? "current" : "other", log->numEntries()); + if (log == logfile) { + // Do not touch the logfile the Query is currently accessing + // and + break; + } + if (log->numEntries() > 0) { + _num_cached_messages -= log->numEntries(); + log->flush(); // drop all messages of that file + if (_num_cached_messages <= _max_cached_messages) { + // remember the number of log messages in cache when + // the last memory-release was done. No further + // release-check shall be done until that number changes. + _num_at_last_check = _num_cached_messages; + return; + } + } + } + // The end of this loop must be reached by 'break'. At least one logfile + // must be the current logfile. So now 'it' points to the current logfile. + // We save that pointer for later. + _logfiles_t::iterator queryit = it; + + // [2] Delete message classes irrelevent to current query + // Starting from the current logfile (wo broke out of the + // previous loop just when 'it' pointed to that) + for (; it != _logfiles.end(); ++it) + { + Logfile *log = it->second; + if (log->numEntries() > 0 && (log->classesRead() & ~logclasses) != 0) { + if (g_debug_level > 2) + debug("Freeing classes 0x%02x of file %s", ~logclasses, log->path()); + long freed = log->freeMessages(~logclasses); // flush only messages not needed for current query + _num_cached_messages -= freed; + if (_num_cached_messages <= _max_cached_messages) { + _num_at_last_check = _num_cached_messages; + return; + } + } + } + + // [3] Flush newest logfiles + // If there are still too many messages loaded, continue + // flushing logfiles from the oldest to the newest starting + // at the file just after (i.e. newer than) the current logfile + for (it = ++queryit; it != _logfiles.end(); ++it) + { + Logfile *log = it->second; + + if (log->numEntries() > 0) { + _num_cached_messages -= log->numEntries(); + log->flush(); + if (_num_cached_messages <= _max_cached_messages) { + _num_at_last_check = _num_cached_messages; + return; + } + } + } + _num_at_last_check = _num_cached_messages; + // If we reach this point, no more logfiles can be unloaded, + // despite the fact that there are still too many messages + // loaded. + if (g_debug_level > 2) + debug("Cannot unload more messages. Still %d loaded (max is %d)", + _num_cached_messages, _max_cached_messages); +} + bool TableLog::isAuthorized(contact *ctc, void *data) { LogEntry *entry = (LogEntry *)data; @@ -174,9 +390,9 @@ // suppress entries for messages that belong to // hosts that do not exist anymore. else if (entry->_logclass == LOGCLASS_ALERT - || entry->_logclass == LOGCLASS_NOTIFICATION - || entry->_logclass == LOGCLASS_PASSIVECHECK - || entry->_logclass == LOGCLASS_STATE) + || entry->_logclass == LOGCLASS_NOTIFICATION + || entry->_logclass == LOGCLASS_PASSIVECHECK + || entry->_logclass == LOGCLASS_STATE) return false; else return true; diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableLog.h livestatus.working/src/TableLog.h --- check_mk-1.2.3i6/livestatus.src/src/TableLog.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableLog.h 2013-11-21 15:51:13.000000000 +0100 @@ -34,20 +34,31 @@ class TableLog : public Table { + typedef map _logfiles_t; + _logfiles_t _logfiles; + pthread_mutex_t _lock; + time_t _last_index_update; + unsigned long _num_cached_messages; + unsigned long _max_cached_messages; + unsigned long _num_at_last_check; public: - TableLog(); + TableLog(unsigned long max_cached_messages); ~TableLog(); const char *name() { return "log"; } const char *prefixname() { return "logs"; } bool isAuthorized(contact *ctc, void *data); void handleNewMessage(Logfile *logfile, time_t since, time_t until, unsigned logclasses); - void addColumns(Table *, string prefix, int indirect_offset, bool add_host = true, bool add_service = true); void answerQuery(Query *query); Column *column(const char *colname); // override in order to handle current_ private: + void forgetLogfiles(); + void updateLogfileIndex(); + void scanLogfile(char *path, bool watch); bool answerQuery(Query *, Logfile *, time_t, time_t); + _logfiles_t::iterator findLogfileStartingBefore(time_t); + void dumpLogfiles(); }; #endif // TableLog_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableServicegroups.cc livestatus.working/src/TableServicegroups.cc --- check_mk-1.2.3i6/livestatus.src/src/TableServicegroups.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableServicegroups.cc 2013-11-21 15:51:13.000000000 +0100 @@ -26,16 +26,13 @@ #include "TableServicegroups.h" #include "Query.h" #include "OffsetStringColumn.h" +#include "OffsetIntColumn.h" #include "ServicelistColumn.h" #include "ServicelistStateColumn.h" #include "auth.h" #include "tables.h" #include "TableServices.h" -/* this might be a hack (accessing Nagios' internal structures. -Ethan: please help me here: how should this be code to be -portable? */ -extern servicegroup *servicegroup_list; TableServicegroups::TableServicegroups() { @@ -46,6 +43,8 @@ { servicegroup sgr; char *ref = (char *)&sgr; + table->addColumn(new OffsetIntColumn(prefix + "id", + "Servicegroup id", (char *)(&sgr.group_name) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "name", "The name of the service group", (char *)(&sgr.group_name) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "alias", @@ -83,6 +82,9 @@ "The number of services in the group that are CRIT", SLSC_NUM_HARD_CRIT, (char *)(&sgr.members) - ref, indirect_offset)); table->addColumn(new ServicelistStateColumn(prefix + "num_services_hard_unknown", "The number of services in the group that are UNKNOWN", SLSC_NUM_HARD_UNKNOWN, (char *)(&sgr.members) - ref, indirect_offset)); + + table->clearNatSort(); + table->addNatSort( prefix + "name" ); } void TableServicegroups::answerQuery(Query *query) @@ -107,6 +109,9 @@ servicegroup *sg = (servicegroup *)data; servicesmember *mem = sg->members; + if (!mem) + return false; + while (mem) { service *svc = mem->service_ptr; bool is = g_table_services->isAuthorized(ctc, svc); @@ -116,5 +121,7 @@ return false; mem = mem->next; } + if(g_group_authorization == AUTH_LOOSE) + return false; return true; } diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableServicegroups.h livestatus.working/src/TableServicegroups.h --- check_mk-1.2.3i6/livestatus.src/src/TableServicegroups.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableServicegroups.h 2013-11-21 15:51:13.000000000 +0100 @@ -39,6 +39,7 @@ void *findObject(char *objectspec); bool isAuthorized(contact *, void *); void addColumns(Table *, string prefix, int indirect_offset); + void add(servicegroup *); void answerQuery(Query *query); }; diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableServices.cc livestatus.working/src/TableServices.cc --- check_mk-1.2.3i6/livestatus.src/src/TableServices.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableServices.cc 2013-11-21 16:10:27.000000000 +0100 @@ -22,6 +22,8 @@ // to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, // Boston, MA 02110-1301 USA. +#include + #include "nagios.h" #include "TableServices.h" #include "Query.h" @@ -33,7 +35,6 @@ #include "OffsetTimeperiodColumn.h" #include "OffsetStringServiceMacroColumn.h" #include "ServiceSpecialIntColumn.h" -#include "ServiceSpecialDoubleColumn.h" #include "AttributelistColumn.h" #include "TableHosts.h" #include "TableServicegroups.h" @@ -47,31 +48,26 @@ #include "auth.h" #include "strutil.h" -extern service *service_list; -extern servicegroup *servicegroup_list; -extern hostgroup *hostgroup_list; - -struct servicebygroup { - service _service; - servicegroup *_servicegroup; -}; -struct servicebyhostgroup { - service _service; - hostgroup *_hostgroup; -}; - void TableServices::answerQuery(Query *query) { + struct servicebygroup **_sg_tmp_storage = (struct servicebygroup **)&(query->table_tmp_storage); + struct servicebyhostgroup **_shg_tmp_storage = (struct servicebyhostgroup **)&(query->table_tmp_storage); + // Table servicesbygroup iterate over service groups if (_by_group) { servicegroup *sgroup = servicegroup_list; - servicebygroup sg; + servicebygroup *sg; while (sgroup) { - sg._servicegroup = sgroup; servicesmember *mem = sgroup->members; while (mem) { - memcpy(&sg._service, mem->service_ptr, sizeof(service)); - if (!query->processDataset(&sg)) + sg = new servicebygroup; + sg->_service = mem->service_ptr; + sg->_host = mem->service_ptr->host_ptr; + sg->_servicegroup = sgroup; + sg->_next = *_sg_tmp_storage; + *_sg_tmp_storage = sg; + + if (!query->processDataset(sg)) break; mem = mem->next; } @@ -84,17 +80,22 @@ else if (_by_hostgroup) { hostgroup *hgroup = hostgroup_list; - servicebyhostgroup shg; + servicebyhostgroup *shg; while (hgroup) { - shg._hostgroup = hgroup; hostsmember *mem = hgroup->members; while (mem) { host *hst = mem->host_ptr; servicesmember *smem = hst->services; while (smem) { service *svc = smem->service_ptr; - memcpy(&shg._service, svc, sizeof(service)); - if (!query->processDataset(&shg)) + shg = new servicebyhostgroup; + shg->_service = svc; + shg->_host = svc->host_ptr; + shg->_hostgroup = hgroup; + shg->_next = *_shg_tmp_storage; + *_shg_tmp_storage = shg; + + if (!query->processDataset(shg)) break; smem = smem->next; } @@ -162,6 +163,12 @@ bool TableServices::isAuthorized(contact *ctc, void *data) { service *svc = (service *)data; + if(_by_group) { + svc = ((servicebygroup*)data)->_service; + } + if(_by_hostgroup) { + svc = ((servicebyhostgroup*)data)->_service; + } return is_authorized_for(ctc, svc->host_ptr, svc); } @@ -172,13 +179,19 @@ { struct servicebygroup sgref; struct servicebyhostgroup hgref; - addColumns(this, "", -1, true); if (by_group) { + addColumns(this, "", (char *)&(sgref._service) - (char *)&sgref, false); + g_table_hosts->addColumns(this, "host_", (char *)(&sgref._host) - (char *)&sgref); g_table_servicegroups->addColumns(this, "servicegroup_", (char *)&(sgref._servicegroup) - (char *)&sgref); } else if (by_hostgroup) { + addColumns(this, "", (char *)&(hgref._service) - (char *)&hgref, false); + g_table_hosts->addColumns(this, "host_", (char *)(&hgref._host) - (char *)&hgref); g_table_hostgroups->addColumns(this, "hostgroup_", (char *)&(hgref._hostgroup) - (char *)&hgref); } + else { + addColumns(this, "", -1, true); + } } @@ -189,14 +202,14 @@ service svc; const char *ref = (const char *)&svc; + table->addColumn(new OffsetIntColumn(prefix + "id", + "Service id", (char *)&svc.id - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "description", "Description of the service (also used as key)", (char *)(&svc.description) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "display_name", "An optional display name (not used by Nagios standard web pages)", (char *)(&svc.display_name) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "check_command", - "Nagios command used for active checks", (char *)(&svc.service_check_command) - ref, indirect_offset)); - table->addColumn(new OffsetStringServiceMacroColumn(prefix + "check_command_expanded", - "Nagios command used for active checks with the macros expanded", (char *)(&svc.service_check_command) - ref, indirect_offset)); + "Nagios command used for active checks", (char *)(&svc.check_command) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "event_handler", "Nagios command used as event handler", (char *)(&svc.event_handler) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "plugin_output", @@ -262,6 +275,12 @@ "The last time the service was CRITICAL (Unix timestamp)", (char *)&svc.last_time_critical - ref, indirect_offset)); table->addColumn(new OffsetTimeColumn(prefix + "last_time_unknown", "The last time the service was UNKNOWN (Unix timestamp)", (char *)&svc.last_time_unknown - ref, indirect_offset)); + /* FIXME: hourly_value is an unsigned int... */ + table->addColumn(new OffsetIntColumn(prefix + "hourly_value", + "Hourly Value", (char *)(&svc.hourly_value) - ref, indirect_offset)); + table->addColumn(new OffsetIntColumn(prefix + "should_be_scheduled", + "Whether nagios still tries to run checks on this service (0/1)", (char *)(&svc.should_be_scheduled) - ref, indirect_offset)); + table->addColumn(new OffsetTimeColumn(prefix + "last_check", "The time of the last check (Unix timestamp)", (char *)&svc.last_check - ref, indirect_offset)); @@ -283,8 +302,10 @@ "Whether the service is flapping (0/1)", (char *)(&svc.is_flapping) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "checks_enabled", "Whether active checks are enabled for the service (0/1)", (char *)(&svc.checks_enabled) - ref, indirect_offset)); + table->addColumn(new OffsetStringColumn(prefix + "check_source", + "The source of the check", (char *)(&svc.check_source) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "accept_passive_checks", - "Whether the service accepts passive checks (0/1)", (char *)(&svc.accept_passive_service_checks) - ref, indirect_offset)); + "Whether the service accepts passive checks (0/1)", (char *)(&svc.accept_passive_checks) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "event_handler_enabled", "Whether and event handler is activated for the service (0/1)", (char *)(&svc.event_handler_enabled) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "notifications_enabled", @@ -301,16 +322,14 @@ "Whether flap detection is enabled for the service (0/1)", (char *)(&svc.flap_detection_enabled) - ref, indirect_offset)); table->addColumn(new OffsetIntColumn(prefix + "check_freshness", "Whether freshness checks are activated (0/1)", (char *)(&svc.check_freshness) - ref, indirect_offset)); - table->addColumn(new OffsetIntColumn(prefix + "obsess_over_service", - "Whether 'obsess_over_service' is enabled for the service (0/1)", (char *)(&svc.obsess_over_service) - ref, indirect_offset)); + table->addColumn(new OffsetIntColumn(prefix + "obsess", + "Whether 'obsess' is enabled for the service (0/1)", (char *)(&svc.obsess) - ref, indirect_offset)); table->addColumn(new AttributelistColumn(prefix + "modified_attributes", "A bitmask specifying which attributes have been modified", (char *)(&svc.modified_attributes) - ref, indirect_offset, false)); table->addColumn(new AttributelistColumn(prefix + "modified_attributes_list", "A list of all modified attributes", (char *)(&svc.modified_attributes) - ref, indirect_offset, true)); table->addColumn(new ServiceSpecialIntColumn(prefix + "pnpgraph_present", "Whether there is a PNP4Nagios graph present for this service (0/1)", SSIC_PNP_GRAPH_PRESENT, indirect_offset)); - table->addColumn(new ServiceSpecialDoubleColumn(prefix + "staleness", - "The staleness indicator for this service", SSDC_STALENESS, indirect_offset)); // columns of type double table->addColumn(new OffsetDoubleColumn(prefix + "check_interval", @@ -342,15 +361,16 @@ table->addColumn(new ServiceContactsColumn(prefix + "contacts", "A list of all contacts of the service, either direct or via a contact group", indirect_offset)); table->addColumn(new DownCommColumn(prefix + "downtimes", - "A list of all downtime ids of the service", indirect_offset, true, true, false, false)); + "A list of all downtime ids of the service", indirect_offset, true, false)); table->addColumn(new DownCommColumn(prefix + "downtimes_with_info", - "A list of all downtimes of the service with id, author and comment", indirect_offset, true, true, true, false)); + "A list of all downtimes of the service with id, author and comment", indirect_offset, true, true)); table->addColumn(new DownCommColumn(prefix + "comments", - "A list of all comment ids of the service", indirect_offset, false, true, false, false)); + "A list of all comment ids of the service", indirect_offset, false, false)); table->addColumn(new DownCommColumn(prefix + "comments_with_info", - "A list of all comments of the service with id, author and comment", indirect_offset, false, true, true, false)); + "A list of all comments of the service with id, author and comment", indirect_offset, false, true)); + table->addColumn(new DownCommColumn(prefix + "comments_with_extra_info", - "A list of all comments of the service with id, author, comment, entry type and entry time", indirect_offset, false, true, true, true)); + "A list of all comments of the service with id, author, comment, entry type and entry time", indirect_offset, false, true)); if (add_hosts) g_table_hosts->addColumns(this, "host_", (char *)(&svc.host_ptr) - ref); @@ -360,12 +380,17 @@ table->addColumn(new CustomVarsColumn(prefix + "custom_variable_values", "A list of the values of all custom variable of the service", (char *)(&svc.custom_variables) - ref, indirect_offset, CVT_VALUES)); table->addColumn(new CustomVarsColumn(prefix + "custom_variables", - "A dictionary of the custom variables", (char *)(&svc.custom_variables) - ref, indirect_offset, CVT_DICT)); + "A dictorionary of the custom variables", (char *)(&svc.custom_variables) - ref, indirect_offset, CVT_DICT)); table->addColumn(new ServicegroupsColumn(prefix + "groups", "A list of all service groups the service is in", (char *)(&svc.servicegroups_ptr) - ref, indirect_offset)); table->addColumn(new ContactgroupsColumn(prefix + "contact_groups", "A list of all contact groups this service is in", (char *)(&svc.contact_groups) - ref, indirect_offset)); + + table->clearNatSort(); + if (add_hosts) + table->addNatSort( prefix + "host_name" ); + table->addNatSort( prefix + "description" ); } @@ -390,3 +415,27 @@ } return find_service(host_name, description); } + +void TableServices::cleanupQuery(Query *query) +{ + struct servicebygroup **_sg_tmp_storage = (struct servicebygroup **)&(query->table_tmp_storage); + struct servicebyhostgroup **_shg_tmp_storage = (struct servicebyhostgroup **)&(query->table_tmp_storage); + + if( _by_group ) { + struct servicebygroup *sg_cur; + while( *_sg_tmp_storage ) { + sg_cur = *_sg_tmp_storage; + *_sg_tmp_storage = sg_cur->_next; + delete sg_cur; + } + } + + if( _by_hostgroup ) { + struct servicebyhostgroup *shg_cur; + while( *_shg_tmp_storage ) { + shg_cur = *_shg_tmp_storage; + *_shg_tmp_storage = shg_cur->_next; + delete shg_cur; + } + } +} diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableServices.h livestatus.working/src/TableServices.h --- check_mk-1.2.3i6/livestatus.src/src/TableServices.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableServices.h 2013-11-21 15:51:13.000000000 +0100 @@ -29,13 +29,27 @@ #include #include "Table.h" -#include "nagios.h" +#include "nagios/objects.h" using namespace std; class TableHosts; class TableContacts; class TableDowntimes; +struct servicebygroup { + service *_service; + host *_host; + servicegroup *_servicegroup; + struct servicebygroup *_next; +}; + +struct servicebyhostgroup { + service *_service; + host *_host; + hostgroup *_hostgroup; + struct servicebyhostgroup *_next; +}; + class TableServices : public Table { bool _by_group; @@ -50,6 +64,7 @@ void *findObject(char *objectspec); void add(service *svc); void answerQuery(Query *); + void cleanupQuery(Query *); void addColumns(Table *, string prefix, int indirect_offset, bool add_hosts); }; diff -Naur check_mk-1.2.3i6/livestatus.src/src/tables.h livestatus.working/src/tables.h --- check_mk-1.2.3i6/livestatus.src/src/tables.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/tables.h 2013-11-21 15:51:13.000000000 +0100 @@ -55,8 +55,6 @@ EXTERN TableStatus *g_table_status; class TableLog; EXTERN TableLog *g_table_log; -class TableStateHistory; -EXTERN TableStateHistory *g_table_statehistory; class TableColumns; EXTERN TableColumns *g_table_columns; diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableStateHistory.cc livestatus.working/src/TableStateHistory.cc --- check_mk-1.2.3i6/livestatus.src/src/TableStateHistory.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableStateHistory.cc 1970-01-01 01:00:00.000000000 +0100 @@ -1,871 +0,0 @@ -// +------------------------------------------------------------------+ -// | ____ _ _ __ __ _ __ | -// | / ___| |__ ___ ___| | __ | \/ | |/ / | -// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | -// | | |___| | | | __/ (__| < | | | | . \ | -// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | -// | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | -// +------------------------------------------------------------------+ -// -// This file is part of Check_MK. -// The official homepage is at http://mathias-kettner.de/check_mk. -// -// check_mk 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 in version 2. check_mk is distributed -// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- -// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more de- -// ails. You should have received a copy of the GNU General Public -// License along with GNU Make; see the file COPYING. If not, write -// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -// Boston, MA 02110-1301 USA. - -#include -#include -#include -#include -#include -#include -#include - -#include "nagios.h" -#include "logger.h" -#include "OffsetIntColumn.h" -#include "OffsetTimeColumn.h" -#include "OffsetStringColumn.h" -#include "OffsetDoubleColumn.h" -#include "Query.h" -#include "tables.h" -#include "auth.h" -#include "Store.h" -#include "LogEntry.h" -#include "TableStateHistory.h" - -#ifdef CMC -#include "Host.h" -#include "Service.h" -#include "Timeperiod.h" -#endif - -int g_disable_statehist_filtering = 0; - - - -struct HostServiceState; -typedef vector HostServices; - -typedef void* HostServiceKey; - -struct HostServiceState { - bool _is_host; - time_t _time; - int _lineno; - time_t _from; - time_t _until; - - time_t _duration; - double _duration_part; - - // Do not change order within this block! - // These durations will be bzero'd - time_t _duration_state_UNMONITORED; - double _duration_part_UNMONITORED; - time_t _duration_state_OK; - double _duration_part_OK; - time_t _duration_state_WARNING; - double _duration_part_WARNING; - time_t _duration_state_CRITICAL; - double _duration_part_CRITICAL; - time_t _duration_state_UNKNOWN; - double _duration_part_UNKNOWN; - - // State information - int _host_down; // used if service - int _state; // -1/0/1/2/3 - int _in_notification_period; - int _in_downtime; - int _in_host_downtime; - int _is_flapping; - - // Service information - HostServices _services; - - // Absent state handling - bool _may_no_longer_exist; - bool _has_vanished; - time_t _last_known_time; - - - const char *_debug_info; - // Pointer to dynamically allocated strings (strdup) that live here. - // These pointers are 0, if there is no output (e.g. downtime) - char *_log_output; - char *_notification_period; // may be "": -> no period known, we assume "always" - host *_host; - service *_service; - const char *_host_name; // Fallback if host no longer exists - const char *_service_description; // Fallback if service no longer exists - - HostServiceState() { bzero(this, sizeof(HostServiceState)); } - ~HostServiceState(); - void debug_me(const char *loginfo, ...); -}; - -extern Store *g_store; - -#define CLASSMASK_STATEHIST 0xC6 - -// Debug information -int total_update_calls = 0; - -// Debugging logging is hard if debug messages are logged themselves... -void debug_statehist(const char *loginfo, ...) -{ - FILE *x = fopen("/tmp/livestatus_state.log", "a+"); - va_list ap; - va_start(ap, loginfo); - vfprintf(x, loginfo, ap); - fputc('\n', x); - va_end(ap); - fclose(x); -} - - -// Debug output of HostServiceState struct -void log_hst(HostServiceState *state) -{ - debug_statehist("\n++++++++++++++\nSTATE INFO"); - if (state->_host_name) - debug_statehist("host name %s", state->_host_name); - if (state->_service_description) - debug_statehist("svc description %s", state->_service_description); - - debug_statehist("time %d", state->_time); - debug_statehist("state %d", state->_state); - if (state->_log_output) - debug_statehist("check_output %s", state->_log_output); - if (state->_debug_info) - debug_statehist("debug_info %s", state->_debug_info); - if (state->_notification_period) - debug_statehist("notification period %s", state->_notification_period); - debug_statehist("from %d", state->_from); - debug_statehist("until %d", state->_until); - debug_statehist("duration %d", state->_duration); -} - -HostServiceState::~HostServiceState() -{ - if (_log_output != 0) - free(_log_output); -}; - -TableStateHistory::TableStateHistory() -{ - HostServiceState *ref = 0; - addColumn(new OffsetTimeColumn("time", - "Time of the log event (seconds since 1/1/1970)", (char *)&(ref->_time) - (char *)ref, -1)); - addColumn(new OffsetIntColumn("lineno", - "The number of the line in the log file", (char *)&(ref->_lineno) - (char *)ref, -1)); - addColumn(new OffsetTimeColumn("from", - "Start time of state (seconds since 1/1/1970)", (char *)&(ref->_from) - (char *)ref, -1)); - addColumn(new OffsetTimeColumn("until", - "End time of state (seconds since 1/1/1970)", (char *)&(ref->_until) - (char *)ref, -1)); - addColumn(new OffsetIntColumn("duration", - "Duration of state (until - from)", (char *)&(ref->_duration) - (char *)ref, -1)); - addColumn(new OffsetDoubleColumn("duration_part", - "Duration part in regard to the query timeframe", (char *)(&ref->_duration_part) - (char *)ref, -1)); - addColumn(new OffsetIntColumn("state", - "The state of the host or service in question - OK(0) / WARNING(1) / CRITICAL(2) / UNKNOWN(3) / UNMONITORED(-1)", (char *)&(ref->_state) - (char *)ref, -1)); - addColumn(new OffsetIntColumn("host_down", - "Shows if the host of this service is down", (char *)&(ref->_host_down) - (char *)ref, -1)); - addColumn(new OffsetIntColumn("in_downtime", - "Shows if the host or service is in downtime", (char *)&(ref->_in_downtime) - (char *)ref, -1)); - addColumn(new OffsetIntColumn("in_host_downtime", - "Shows if the host of this service is in downtime", (char *)&(ref->_in_host_downtime) - (char *)ref, -1)); - addColumn(new OffsetIntColumn("is_flapping", - "Shows if the host or service is flapping", (char *)&(ref->_is_flapping) - (char *)ref, -1)); - addColumn(new OffsetIntColumn("in_notification_period", - "Shows if the host or service is within its notification period", (char *)&(ref->_in_notification_period) - (char *)ref, -1)); - addColumn(new OffsetStringColumn("notification_period", - "The notification period of the host or service in question", (char *)&(ref->_notification_period) - (char *)ref, -1)); - addColumn(new OffsetStringColumn("debug_info", - "Debug information", (char *)&(ref->_debug_info) - (char *)ref, -1)); - addColumn(new OffsetStringColumn("host_name", - "Host name", (char *)&(ref->_host_name) - (char *)ref, -1)); - addColumn(new OffsetStringColumn("service_description", - "Description of the service", (char *)&(ref->_service_description) - (char *)ref, -1)); - addColumn(new OffsetStringColumn("log_output", - "Logfile output relevant for this state", (char *)&(ref->_log_output) - (char *)ref, -1)); - addColumn(new OffsetIntColumn("duration_ok", - "OK duration of state ( until - from )", (char *)&(ref->_duration_state_OK) - (char *)ref, -1)); - addColumn(new OffsetDoubleColumn("duration_part_ok", - "OK duration part in regard to the query timeframe", (char *)(&ref->_duration_part_OK) - (char *)ref, -1)); - - addColumn(new OffsetIntColumn("duration_warning", - "WARNING duration of state (until - from)", (char *)&(ref->_duration_state_WARNING) - (char *)ref, -1)); - addColumn(new OffsetDoubleColumn("duration_part_warning", - "WARNING duration part in regard to the query timeframe", (char *)(&ref->_duration_part_WARNING) - (char *)ref, -1)); - - addColumn(new OffsetIntColumn("duration_critical", - "CRITICAL duration of state (until - from)", (char *)&(ref->_duration_state_CRITICAL) - (char *)ref, -1)); - addColumn(new OffsetDoubleColumn("duration_part_critical", - "CRITICAL duration part in regard to the query timeframe", (char *)(&ref->_duration_part_CRITICAL) - (char *)ref, -1)); - - addColumn(new OffsetIntColumn("duration_unknown", - "UNKNOWN duration of state (until - from)", (char *)&(ref->_duration_state_UNKNOWN) - (char *)ref, -1)); - addColumn(new OffsetDoubleColumn("duration_part_unknown", - "UNKNOWN duration part in regard to the query timeframe", (char *)(&ref->_duration_part_UNKNOWN) - (char *)ref, -1)); - - addColumn(new OffsetIntColumn("duration_unmonitored", - "UNMONITORED duration of state (until - from)", (char *)&(ref->_duration_state_UNMONITORED) - (char *)ref, -1)); - addColumn(new OffsetDoubleColumn("duration_part_unmonitored", - "UNMONITORED duration part in regard to the query timeframe", (char *)(&ref->_duration_part_UNMONITORED) - (char *)ref, -1)); - - - // join host and service tables - g_table_hosts->addColumns(this, "current_host_", (char *)&(ref->_host) - (char *)ref); - g_table_services->addColumns(this, "current_service_", (char *)&(ref->_service) - (char *)ref, false /* no hosts table */); -} - -LogEntry *TableStateHistory::getPreviousLogentry() -{ - if (_it_entries == _entries->begin()) { - // open previous logfile - if (_it_logs == g_store->logCache()->logfiles()->begin()) - return 0; - else { - _it_logs--; - _entries = _it_logs->second->getEntriesFromQuery(_query, g_store->logCache(), _since, _until, CLASSMASK_STATEHIST); - _it_entries = _entries->end(); - } - } - return (--_it_entries)->second; -} - -LogEntry *TableStateHistory::getNextLogentry() -{ - if (++_it_entries == _entries->end()) { - if (++_it_logs == g_store->logCache()->logfiles()->end()) { - // No further logfiles available - // prevent errors on subsequent getNextLogentry() - --_it_entries; - --_it_logs; - return 0; - } - else { - _entries = _it_logs->second->getEntriesFromQuery(_query, g_store->logCache(), _since, _until, CLASSMASK_STATEHIST); - _it_entries = _entries->begin(); - } - } - return _it_entries->second; -} - -void TableStateHistory::answerQuery(Query *query) -{ - // Create a partial filter, that contains only such filters that - // check attributes of current hosts and services - typedef deque object_filter_t; - object_filter_t object_filter; - AndingFilter *orig_filter = query->filter(); - - if (!g_disable_statehist_filtering) { - deque::iterator it = orig_filter->begin(); - while (it != orig_filter->end()) { - Filter *filter = *it; - Column *column = filter->column(); - if (column) { - const char *column_name = column->name(); - if (!strncmp(column_name, "current_", 8) - || !strncmp(column_name, "host_", 5) - || !strncmp(column_name, "service_", 8)) - { - object_filter.push_back(filter); - // logger(LOG_NOTICE, "Nehme Column: %s", column_name); - } - else { - // logger(LOG_NOTICE, "Column geht nciht: %s", column_name); - } - } - else { - // logger(LOG_NOTICE, "Mist: Filter ohne Column"); - } - ++it; - } - } - - - g_store->logCache()->lockLogCache(); - g_store->logCache()->logCachePreChecks(); - - // Keep track of the historic state of services/hosts here - typedef map state_info_t; - state_info_t state_info; - - // Store hosts/services that we have filtered out here - typedef set object_blacklist_t; - object_blacklist_t object_blacklist; - - _query = query; - _since = 0; - _until = time(0) + 1; - - // Optimize time interval for the query. In log querys - // there should always be a time range in form of one - // or two filter expressions over time. We use that - // to limit the number of logfiles we need to scan and - // to find the optimal entry point into the logfile - _query->findIntLimits("time", &_since, &_until); - if (_since == 0) { - query->setError(RESPONSE_CODE_INVALID_REQUEST, "Start of timeframe required. e.g. Filter: time > 1234567890"); - g_store->logCache()->unlockLogCache(); - return; - } - - _query_timeframe = _until - _since - 1; - if (_query_timeframe == 0) { - query->setError(RESPONSE_CODE_INVALID_REQUEST, "Query timeframe is 0 seconds"); - g_store->logCache()->unlockLogCache(); - return; - } - - // Switch to last logfile (we have at least one) - _it_logs = g_store->logCache()->logfiles()->end(); - --_it_logs; - - // Now find the log where 'since' starts. - while (_it_logs != g_store->logCache()->logfiles()->begin() && _it_logs->first >= _since) { - --_it_logs; // go back in history - } - - // Check if 'until' is within these logfiles - if (_it_logs->first > _until) { - // All logfiles are too new, invalid timeframe - // -> No data available. Return empty result. - g_store->logCache()->unlockLogCache(); - return; - } - - // Set initial logentry - // Further logfile traversal is handled via getPreviousLogentry() / getNextLogentry() - _entries = _it_logs->second->getEntriesFromQuery(query, g_store->logCache(), _since, _until, CLASSMASK_STATEHIST); - _it_entries = _entries->begin(); - - // Start at the logentry LOG VERSION: 2.0 which is logged in the first lines of each logfile - // If no entry is found there will be an UNMONITORED entry till the host or service appears - LogEntry* entry = _it_entries->second; - bool version_found = false; - while (entry != 0) { - if (entry->_time >= _since){ - break; - } - if (entry->_type == LOG_VERSION) { - version_found = true; - break; - } - entry = getNextLogentry(); - } - -// if (!version_found) { -// query->setError(RESPONSE_CODE_INVALID_REQUEST, "Unable to find any LOG VERSION entries before query " -// "timeframe. Logfiles seem corrupted."); -// g_store->logCache()->unlockLogCache(); -// return; -// } - - HostServiceKey key; - bool only_update = true; - bool in_nagios_initial_states = false; - - // Debug parameters - int total_calls_saved = 0; - total_update_calls = 0; - int logentry_counter = 0; - - - while (0 != (entry = getNextLogentry())) - { - logentry_counter++; -// -// if (logentry_counter % 50000 == 0) -// logger(LOG_NOTICE, "Statehist Entry: %d", logentry_counter); - - if (entry->_time >= _until) { - getPreviousLogentry(); - break; - } - if (only_update && entry->_time >= _since) { - // Reached start of query timeframe. From now on let's produce real output - only_update = false; - } - - if (in_nagios_initial_states && !(entry->_type == STATE_SERVICE_INITIAL || entry->_type == STATE_HOST_INITIAL)) { - // Set still unknown hosts / services to unmonitored - state_info_t::iterator it_hst = state_info.begin(); - while (it_hst != state_info.end()) - { - HostServiceState* hst = it_hst->second; - if (hst->_may_no_longer_exist) { - hst->_has_vanished = true; - } - it_hst++; - } - in_nagios_initial_states = false; - } - - key = 0; - bool is_service = false; - switch (entry->_type) { - case ALERT_SERVICE: - case STATE_SERVICE: - case STATE_SERVICE_INITIAL: - case DOWNTIME_ALERT_SERVICE: - case FLAPPING_SERVICE: - key = entry->_service; - is_service = true; - case ALERT_HOST: - case STATE_HOST: - case STATE_HOST_INITIAL: - case DOWNTIME_ALERT_HOST: - case FLAPPING_HOST: - { - if (!is_service) - key = entry->_host; - - if (key == 0) - continue; - - if (object_blacklist.find(key) != object_blacklist.end()) - { - // Host/Service is not needed for this query and has already - // been filtered out. - continue; - } - - // Find state object for this host/service - HostServiceState *state; - state_info_t::iterator it_hst = state_info.find(key); - if (it_hst == state_info.end()) - { - // Create state object that we also need for filtering right now - state = new HostServiceState(); - state->_is_host = entry->_svc_desc == 0; - state->_host = entry->_host; - state->_service = entry->_service; - #ifdef CMC - state->_host_name = entry->_host->_name; - state->_service_description = entry->_service != 0 ? entry->_service->_name : ""; - #else - state->_host_name = entry->_host->name; - state->_service_description = entry->_service != 0 ? entry->_service->description : ""; - #endif - - // No state found. Now check if this host/services is filtered out. - // Note: we currently do not filter out hosts since they might be - // needed for service states - if (entry->_svc_desc) - { - bool filtered_out = false; - for (object_filter_t::iterator it = object_filter.begin(); - it != object_filter.end(); - ++it) - { - Filter *filter = *it; - if (!filter->accepts(state)) { - // logger(LOG_NOTICE, "kann ich rausschmeissen: %s/%s", key.first.c_str(), key.second.c_str()); - filtered_out = true; - break; - } - } - - if (filtered_out) { - object_blacklist.insert(key); - delete state; - continue; - } - } - - // Host/Service relations - if (state->_is_host) { - state_info_t::iterator it_inh = state_info.begin(); - while (it_inh != state_info.end()) { - if (it_inh->second->_host == state->_host){ - state->_services.push_back(it_inh->second); - } - it_inh++; - } - } else { - state_info_t::iterator it_inh = state_info.find(state->_host); - if (it_inh != state_info.end()) - it_inh->second->_services.push_back(state); - } - - - // Store this state object for tracking state transitions - state_info.insert(std::make_pair(key, state)); - state->_from = _since; - - // Get notification period of host/service - // If this host/service is no longer availabe in nagios -> set to "" - if (state->_service != 0) - #ifdef CMC - state->_notification_period = (char *)state->_service->notificationPeriod()->name(); - #else - state->_notification_period = state->_service->notification_period; - #endif - else if (state->_host != 0) - #ifdef CMC - state->_notification_period = (char *)state->_host->notificationPeriod()->name(); - #else - state->_notification_period = state->_host->notification_period; - #endif - else - state->_notification_period = (char *)""; - - - // Determine initial in_notification_period status - _notification_periods_t::const_iterator tmp_period = _notification_periods.find(state->_notification_period); - if (tmp_period != _notification_periods.end()) - state->_in_notification_period = tmp_period->second; - else - state->_in_notification_period = 1; - - // If this key is a service try to find its host and apply its _in_host_downtime and _host_down parameters - if (!state->_is_host) { - state_info_t::iterator my_host = state_info.find(state->_host); - if (my_host != state_info.end()) { - state->_in_host_downtime = my_host->second->_in_host_downtime; - state->_host_down = my_host->second->_host_down; - } - } - - // Log UNMONITORED state if this host or service just appeared within the query timeframe - if (!only_update) { - state->_debug_info = "UNMONITORED "; - state->_state = -1; - } - } - else - state = it_hst->second; - - int state_changed = updateHostServiceState(query, entry, state, only_update); - // Host downtime or state changes also affect its services - if (entry->_type == ALERT_HOST || entry->_type == STATE_HOST || entry->_type == DOWNTIME_ALERT_HOST){ - - - if (state_changed != 0) { - total_calls_saved += state_info.size() - state->_services.size(); - HostServices::iterator it_svc = state->_services.begin(); - while (it_svc != state->_services.end()) { - updateHostServiceState(query, entry, *it_svc, only_update); - it_svc++; - } - } - } - break; - } - case TIMEPERIOD_TRANSITION: - { - char *save_ptr; - char *buffer = strdup(entry->_options); - char *tp_name = strtok_r(buffer, ";", &save_ptr); - strtok_r(NULL, ";", &save_ptr); - char *tp_state = strtok_r(NULL, ";", &save_ptr); - - _notification_periods[tp_name] = atoi(tp_state); - state_info_t::iterator it_hst = state_info.begin(); - while (it_hst != state_info.end()) { - updateHostServiceState(query, entry, it_hst->second, only_update); - it_hst++; - } - free(buffer); - break; - } - case LOG_INITIAL_STATES: - { - // This feature is only available if log_initial_states is set to 1 - // If log_initial_states is set, each nagios startup logs the initial states of all known - // hosts and services. Therefore we can detect if a host is no longer available after - // a nagios startup. If it still exists an INITIAL HOST/SERVICE state entry will follow up shortly. - state_info_t::iterator it_hst = state_info.begin(); - while (it_hst != state_info.end()) { - if (!it_hst->second->_has_vanished) { - it_hst->second->_last_known_time = entry->_time; - it_hst->second->_may_no_longer_exist = true; - } - it_hst++; - } - in_nagios_initial_states = true; - break; - } - } - } - - //logger(LOG_DEBUG, "Processed statehist logentries: %d", logentry_counter); - //logger(LOG_DEBUG, "Total calls %d saved: %d", total_update_calls, total_calls_saved); - //logger(LOG_DEBUG, "Objects: %d, Blacklisted: %d", state_info.size(), object_blacklist.size()); - - // Create final reports - state_info_t::iterator it_hst = state_info.begin(); - while (it_hst != state_info.end()) - { - HostServiceState* hst = it_hst->second; - - // No trace since the last two nagios startup -> host/service has vanished - if (hst->_may_no_longer_exist) { - // Log last known state up to nagios restart - hst->_time = hst->_last_known_time; - hst->_until = hst->_last_known_time; - process(query, hst); - - // Set absent state - hst->_state = -1; - hst->_until = hst->_time; - hst->_debug_info = "UNMONITORED"; - if (hst->_log_output) - free(hst->_log_output); - hst->_log_output = 0; - } - - hst->_time = _until - 1; - hst->_until = hst->_time; - - process(query, hst); - it_hst++; - } - it_hst = state_info.begin(); - while (it_hst != state_info.end()) { - delete it_hst->second; - it_hst++; - } - - g_store->logCache()->unlockLogCache(); -} - -bool TableStateHistory::objectFilteredOut(Query *query, void *entry) -{ - return false; -} - -inline int TableStateHistory::updateHostServiceState(Query *query, const LogEntry *entry, HostServiceState *hs_state, const bool only_update){ - int state_changed = 1; - total_update_calls++; - - // Revive host / service if it was unmonitored - if (entry->_type != TIMEPERIOD_TRANSITION && hs_state->_has_vanished) - { - hs_state->_time = hs_state->_last_known_time; - hs_state->_until = hs_state->_last_known_time; - process(query, hs_state); - - hs_state->_may_no_longer_exist = false; - hs_state->_has_vanished = false; - // Set absent state - hs_state->_state = -1; - hs_state->_debug_info = "UNMONITORED"; - hs_state->_in_downtime = 0; - hs_state->_in_notification_period = 0; - hs_state->_is_flapping = 0; - if (hs_state->_log_output) - free(hs_state->_log_output); - hs_state->_log_output = 0; - - // Apply latest notification period information and set the host_state to unmonitored - _notification_periods_t::const_iterator it_status = _notification_periods.find(hs_state->_notification_period); - if (it_status != _notification_periods.end()) { - hs_state->_in_notification_period = it_status->second; - } - else // No notification period information available -> within notification period - hs_state->_in_notification_period = 1; - } - - // Update basic information - hs_state->_time = entry->_time; - hs_state->_lineno = entry->_lineno; - hs_state->_until = entry->_time; - - // A timeperiod entry never brings an absent host or service into existence.. - if (entry->_type != TIMEPERIOD_TRANSITION) - hs_state->_may_no_longer_exist = false; - - switch (entry->_type) - { - case STATE_HOST: - case STATE_HOST_INITIAL: - case ALERT_HOST: - { - if (hs_state->_is_host) { - if (hs_state->_state != entry->_state) { - if (!only_update) - process(query, hs_state); - hs_state->_state = entry->_state; - hs_state->_host_down = entry->_state > 0; - hs_state->_debug_info = "HOST STATE"; - } else - state_changed = 0; - } - else if (hs_state->_host_down != entry->_state > 0) - { - if (!only_update) - process(query, hs_state); - hs_state->_host_down = entry->_state > 0; - hs_state->_debug_info = "SVC HOST STATE"; - - } - break; - } - case STATE_SERVICE: - case STATE_SERVICE_INITIAL: - case ALERT_SERVICE: - { - if (hs_state->_state != entry->_state) { - if (!only_update) - process(query, hs_state); - hs_state->_debug_info = "SVC ALERT"; - hs_state->_state = entry->_state; - } - break; - } - case DOWNTIME_ALERT_HOST: - { - int downtime_active = !strncmp(entry->_state_type,"STARTED",7) ? 1 : 0; - - if (hs_state->_in_host_downtime != downtime_active) { - if (!only_update) - process(query, hs_state); - hs_state->_debug_info = hs_state->_is_host ? "HOST DOWNTIME" : "SVC HOST DOWNTIME"; - hs_state->_in_host_downtime = downtime_active; - if (hs_state->_is_host) - hs_state->_in_downtime = downtime_active; - } else - state_changed = 0; - break; - } - case DOWNTIME_ALERT_SERVICE: - { - int downtime_active = !strncmp(entry->_state_type,"STARTED",7) ? 1 : 0; - if (hs_state->_in_downtime != downtime_active) { - if (!only_update) - process(query, hs_state); - hs_state->_debug_info = "DOWNTIME SERVICE"; - hs_state->_in_downtime = downtime_active; - } - break; - - } - case FLAPPING_HOST: - case FLAPPING_SERVICE: - { - int flapping_active = !strncmp(entry->_state_type,"STARTED",7) ? 1 : 0; - if (hs_state->_is_flapping != flapping_active) { - if (!only_update) - process(query, hs_state); - hs_state->_debug_info = "FLAPPING "; - hs_state->_is_flapping = flapping_active; - } else - state_changed = 0; - break; - } - case TIMEPERIOD_TRANSITION: - { - char *save_ptr; - char *buffer = strdup(entry->_options); - char *tp_name = strtok_r(buffer, ";", &save_ptr); - strtok_r(NULL, ";", &save_ptr); - char *tp_state = strtok_r(NULL, ";", &save_ptr); - - // if no _host pointer is available the initial status of _in_notification_period (1) never changes - if (hs_state->_host && !strcmp(tp_name, hs_state->_notification_period)) { - int new_status = atoi(tp_state); - if (new_status != hs_state->_in_notification_period) { - if (!only_update) - process(query, hs_state); - hs_state->_debug_info = "TIMEPERIOD "; - hs_state->_in_notification_period = new_status; - } - } - free(buffer); - break; - } - } - - if (entry->_type != TIMEPERIOD_TRANSITION) { - if (hs_state->_log_output) - free(hs_state->_log_output); - - if ( (entry->_type == STATE_HOST_INITIAL || entry->_type == STATE_SERVICE_INITIAL) && - (entry->_check_output != 0 && !strcmp(entry->_check_output, "(null)")) ) - hs_state->_log_output = 0; - - else - hs_state->_log_output = entry->_check_output ? strdup(entry->_check_output) : 0; - } - - return state_changed; -} - - -inline void TableStateHistory::process(Query *query, HostServiceState *hs_state) -{ - hs_state->_duration = hs_state->_until - hs_state->_from; - hs_state->_duration_part = (double)hs_state->_duration / (double)_query_timeframe; - - bzero(&hs_state->_duration_state_UNMONITORED, sizeof(time_t) * 5 + sizeof(double) * 5); - - switch (hs_state->_state) { - case -1: - hs_state->_duration_state_UNMONITORED = hs_state->_duration; - hs_state->_duration_part_UNMONITORED = hs_state->_duration_part; - break; - case STATE_OK: - hs_state->_duration_state_OK = hs_state->_duration; - hs_state->_duration_part_OK = hs_state->_duration_part; - break; - case STATE_WARNING: - hs_state->_duration_state_WARNING = hs_state->_duration; - hs_state->_duration_part_WARNING = hs_state->_duration_part; - break; - case STATE_CRITICAL: - hs_state->_duration_state_CRITICAL = hs_state->_duration; - hs_state->_duration_part_CRITICAL = hs_state->_duration_part; - break; - case STATE_UNKNOWN: - hs_state->_duration_state_UNKNOWN = hs_state->_duration; - hs_state->_duration_part_UNKNOWN = hs_state->_duration_part; - break; - default: - break; - } - - // if (hs_state->_duration > 0) - query->processDataset(hs_state); - hs_state->_from = hs_state->_until; -}; - -bool TableStateHistory::isAuthorized(contact *ctc, void *data) -{ - HostServiceState *entry = (HostServiceState *)data; - service *svc = entry->_service; - host *hst = entry->_host; - - if (hst || svc) - return is_authorized_for(ctc, hst, svc); - else - return false; -} - -Column *TableStateHistory::column(const char *colname) -{ - // First try to find column in the usual way - Column *col = Table::column(colname); - if (col) return col; - - // Now try with prefix "current_", since our joined - // tables have this prefix in order to make clear that - // we access current and not historic data and in order - // to prevent mixing up historic and current fields with - // the same name. - string with_current = string("current_") + colname; - return Table::column(with_current.c_str()); -} diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableStateHistory.h livestatus.working/src/TableStateHistory.h --- check_mk-1.2.3i6/livestatus.src/src/TableStateHistory.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableStateHistory.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,75 +0,0 @@ -// +------------------------------------------------------------------+ -// | ____ _ _ __ __ _ __ | -// | / ___| |__ ___ ___| | __ | \/ | |/ / | -// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | -// | | |___| | | | __/ (__| < | | | | . \ | -// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | -// | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | -// +------------------------------------------------------------------+ -// -// This file is part of Check_MK. -// The official homepage is at http://mathias-kettner.de/check_mk. -// -// check_mk 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 in version 2. check_mk is distributed -// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- -// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A -// PARTICULAR PURPOSE. See the GNU General Public License for more de- -// ails. You should have received a copy of the GNU General Public -// License along with GNU Make; see the file COPYING. If not, write -// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -// Boston, MA 02110-1301 USA. - -#ifndef TableStateHistory_h -#define TableStateHistory_h - -#include -#include -#include "config.h" -#include "string.h" -#include "logger.h" -#include "nagios.h" -#include "Logfile.h" -#include "LogCache.h" -#include "Query.h" - -class HostServiceState; - -class TableStateHistory : public Table -{ - int _query_timeframe; - Query *_query; - int _since; - int _until; - - // Notification periods information, name: active(1)/inactive(0) - typedef map _notification_periods_t; - _notification_periods_t _notification_periods; - - // Helper functions to traverse through logfiles - _logfiles_t::iterator _it_logs; - logfile_entries_t *_entries; - logfile_entries_t::iterator _it_entries; - LogEntry *_current_entry; - -public: - TableStateHistory(); - const char *name() { return "statehist"; } - const char *prefixname() { return "statehist_"; } - bool isAuthorized(contact *ctc, void *data); - void handleNewMessage(Logfile *logfile, time_t since, time_t until, unsigned logclasses); - void answerQuery(Query *query); - Column *column(const char *colname); // override in order to handle current_ - int updateHostServiceState(Query *query, const LogEntry *entry, HostServiceState *state, const bool only_update); - -private: - LogEntry* getPreviousLogentry(); - LogEntry* getNextLogentry(); - void process(Query *query, HostServiceState *hs_state); - bool objectFilteredOut(Query *, void *entry); -}; - - -#endif // TableStateHistory_h diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableStatus.cc livestatus.working/src/TableStatus.cc --- check_mk-1.2.3i6/livestatus.src/src/TableStatus.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableStatus.cc 2013-11-21 15:51:13.000000000 +0100 @@ -37,7 +37,6 @@ extern time_t program_start; extern int nagios_pid; -extern time_t last_command_check; extern time_t last_log_rotation; extern int enable_notifications; extern int execute_service_checks; @@ -54,19 +53,8 @@ extern int check_external_commands; extern int num_cached_log_messages; extern int interval_length; -extern int g_num_hosts; -extern int g_num_services; -extern int g_num_clientthreads; -extern int g_num_queued_connections; -extern int g_num_active_connections; - -// Livecheck has been removed, but we still need to provide the -// columns - for compatibility -int livechecks_performed = 0; -int livecheck_overflows = 0; - -extern circular_buffer external_command_buffer; -extern int external_command_buffer_slots; +extern int livechecks_performed; +extern int livecheck_overflows; TableStatus::TableStatus() { @@ -105,11 +93,6 @@ addColumn(new GlobalCountersColumn("log_messages_rate", "the averaged number of new log messages per second", COUNTER_LOG_MESSAGES, true)); - addColumn(new GlobalCountersColumn("external_commands", - "The number of external commands since program start", COUNTER_COMMANDS, false)); - addColumn(new GlobalCountersColumn("external_commands_rate", - "the averaged number of external commands per second", COUNTER_COMMANDS, true)); - addColumn(new GlobalCountersColumn("livechecks", "The number of checks executed via livecheck", COUNTER_LIVECHECKS, false)); addColumn(new GlobalCountersColumn("livechecks_rate", @@ -152,44 +135,26 @@ "Whether Nagios checks for external commands at its command pipe (0/1)", &check_external_commands)); addColumn(new TimePointerColumn("program_start", "The time of the last program start as UNIX timestamp", (int*)&program_start)); - addColumn(new TimePointerColumn("last_command_check", - "The time of the last check for a command as UNIX timestamp", (int*)&last_command_check)); addColumn(new TimePointerColumn("last_log_rotation", "Time time of the last log file rotation", (int*)&last_log_rotation)); addColumn(new IntPointerColumn("interval_length", "The default interval length from nagios.cfg", (int*)&interval_length)); addColumn(new IntPointerColumn("num_hosts", - "The total number of hosts", (int*)&g_num_hosts)); + "The total number of hosts", (int*)&num_objects.hosts)); addColumn(new IntPointerColumn("num_services", - "The total number of services", (int*)&g_num_services)); + "The total number of services", (int*)&num_objects.services)); addColumn(new StringPointerColumn("program_version", "The version of the monitoring daemon", get_program_version())); - // External command buffer - addColumn(new IntPointerColumn("external_command_buffer_slots", - "The size of the buffer for the external commands", - &external_command_buffer_slots)); - addColumn(new IntPointerColumn("external_command_buffer_usage", - "The number of slots in use of the external command buffer", - &(external_command_buffer.items))); - addColumn(new IntPointerColumn("external_command_buffer_max", - "The maximum number of slots used in the external command buffer", - &(external_command_buffer.high))); - // Livestatus' own status addColumn(new IntPointerColumn("cached_log_messages", "The current number of log messages MK Livestatus keeps in memory", &num_cached_log_messages )); addColumn(new StringPointerColumn("livestatus_version", "The version of the MK Livestatus module", (char *)VERSION)); - addColumn(new IntPointerColumn("livestatus_active_connections", - "The current number of active connections to MK Livestatus", &g_num_active_connections)); - addColumn(new IntPointerColumn("livestatus_queued_connections", - "The current number of queued connections to MK Livestatus (that wait for a free thread)", &g_num_queued_connections)); - addColumn(new IntPointerColumn("livestatus_threads", - "The maximum number of connections to MK Livestatus that can be handled in parallel", &g_num_clientthreads)); + // Livecheck } void TableStatus::answerQuery(Query *query) diff -Naur check_mk-1.2.3i6/livestatus.src/src/TableTimeperiods.cc livestatus.working/src/TableTimeperiods.cc --- check_mk-1.2.3i6/livestatus.src/src/TableTimeperiods.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TableTimeperiods.cc 2013-11-21 15:51:13.000000000 +0100 @@ -25,11 +25,10 @@ #include "nagios.h" #include "Query.h" #include "OffsetStringColumn.h" +#include "OffsetIntColumn.h" #include "OffsetTimeperiodColumn.h" #include "TableTimeperiods.h" -extern timeperiod *timeperiod_list; - TableTimeperiods::TableTimeperiods() { addColumns(this, "", -1); @@ -40,6 +39,8 @@ { timeperiod tp; char *ref = (char *)&tp; + table->addColumn(new OffsetIntColumn(prefix + "id", + "Timeperiod id", (char *)(&tp.id) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "name", "The name of the timeperiod", (char *)(&tp.name) - ref, indirect_offset)); table->addColumn(new OffsetStringColumn(prefix + "alias", diff -Naur check_mk-1.2.3i6/livestatus.src/src/TimeperiodsCache.cc livestatus.working/src/TimeperiodsCache.cc --- check_mk-1.2.3i6/livestatus.src/src/TimeperiodsCache.cc 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TimeperiodsCache.cc 2013-11-21 15:51:13.000000000 +0100 @@ -23,13 +23,13 @@ // Boston, MA 02110-1301 USA. #include +#include +#include #include "TimeperiodsCache.h" #include "nagios.h" #include "logger.h" -extern timeperiod *timeperiod_list; - TimeperiodsCache::TimeperiodsCache() { pthread_mutex_init(&_cache_lock, 0); @@ -42,28 +42,6 @@ pthread_mutex_destroy(&_cache_lock); } -void TimeperiodsCache::logCurrentTimeperiods(){ - pthread_mutex_lock(&_cache_lock); - time_t now = time(0); - // Loop over all timeperiods and compute if we are - // currently in. Detect the case where no time periods - // are known (yet!). This might be the case when a timed - // event broker message arrives *before* the start of the - // event loop. - timeperiod *tp = timeperiod_list; - while (tp) { - bool is_in = 0 == check_time_against_period(now, tp); - // check previous state and log transition if state has changed - _cache_t::iterator it = _cache.find(tp); - if (it == _cache.end()) { // first entry - logTransition(tp->name, -1, is_in ? 1 : 0); - _cache.insert(std::make_pair(tp, is_in)); - } - logTransition(tp->name, it->second ? 1 : 0, is_in ? 1 : 0); - tp = tp->next; - } - pthread_mutex_unlock(&_cache_lock); -} void TimeperiodsCache::update(time_t now) { diff -Naur check_mk-1.2.3i6/livestatus.src/src/TimeperiodsCache.h livestatus.working/src/TimeperiodsCache.h --- check_mk-1.2.3i6/livestatus.src/src/TimeperiodsCache.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/TimeperiodsCache.h 2013-11-21 15:51:13.000000000 +0100 @@ -40,7 +40,6 @@ ~TimeperiodsCache(); void update(time_t now); bool inTimeperiod(timeperiod *tp); - void logCurrentTimeperiods(); private: void logTransition(char *name, int from, int to); }; diff -Naur check_mk-1.2.3i6/livestatus.src/src/TODO livestatus.working/src/TODO --- check_mk-1.2.3i6/livestatus.src/src/TODO 1970-01-01 01:00:00.000000000 +0100 +++ livestatus.working/src/TODO 2013-11-21 15:51:13.000000000 +0100 @@ -0,0 +1,2 @@ +* AuthUser: is not honored in some list columns (do this + like in ServiceslistColumn) diff -Naur check_mk-1.2.3i6/livestatus.src/src/waittriggers.c livestatus.working/src/waittriggers.c --- check_mk-1.2.3i6/livestatus.src/src/waittriggers.c 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/waittriggers.c 2013-11-21 15:51:13.000000000 +0100 @@ -48,10 +48,3 @@ }; pthread_mutex_t g_wait_mutex = PTHREAD_MUTEX_INITIALIZER; - -void trigger(int what) -{ - pthread_cond_broadcast(&g_wait_cond[WT_ALL]); - pthread_cond_broadcast(&g_wait_cond[what]); -} - diff -Naur check_mk-1.2.3i6/livestatus.src/src/waittriggers.h livestatus.working/src/waittriggers.h --- check_mk-1.2.3i6/livestatus.src/src/waittriggers.h 2013-10-31 11:20:11.000000000 +0100 +++ livestatus.working/src/waittriggers.h 2013-11-21 15:51:13.000000000 +0100 @@ -5,7 +5,7 @@ // | | |___| | | | __/ (__| < | | | | . \ | // | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | // | | -// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | // +------------------------------------------------------------------+ // // This file is part of Check_MK. @@ -40,16 +40,6 @@ #define WT_ALLNAMES "all, check, state, log, downtime, comment, command and program" -#ifdef __cplusplus -extern "C" -{ -#endif -void trigger(int what); -#ifdef __cplusplus -} -#endif - - extern const char *wt_names[]; extern pthread_cond_t g_wait_cond[]; extern pthread_mutex_t g_wait_mutex;